Commit Graph

14 Commits

Author SHA1 Message Date
desrosj
02a98204d7 Grouped backports to the 4.8 branch.
- Query: Improve sanitization within `WP_Tax_Query`.
- Query: Improve sanitization within `WP_Meta_Query`.
- Upgrade/Install: Avoid using `unserialize()` unnecessarily.
- Formatting: Correctly encode ASCII characters in post slugs.

Merges [52454-52457] to the 4.8 branch.
Props vortfu, dd32, ehtis, zieladam, whyisjake, xknown, peterwilsoncc, desrosj, iandunn.
Built from https://develop.svn.wordpress.org/branches/4.8@52475


git-svn-id: http://core.svn.wordpress.org/branches/4.8@52067 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-01-06 18:16:48 +00:00
Gary Pendergast
af69f4ab1a General: Restore usage of $wpdb, instead of $this->db.
Hiding the `$wpdb` global behind a property decreases the readability of the code, as well as causing irrelevant output when dumping an object.

Reverts [38275], [38278], [38279], [38280], [38387].
See #37699.


Built from https://develop.svn.wordpress.org/trunk@38768


git-svn-id: http://core.svn.wordpress.org/trunk@38711 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-10 06:38:31 +00:00
Scott Taylor
e7ffad7fac Query: add a protected field, $db, (composition, as it were) to WP_*_Query classes to hold the value for the database abstraction, instead of importing the global $wpdb into every method that uses it. Reduces the number of global imports by 32.
See #37699.

Built from https://develop.svn.wordpress.org/trunk@38275


git-svn-id: http://core.svn.wordpress.org/trunk@38216 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-18 18:21:31 +00:00
Jeremy Felt
6f3f00ea97 Multisite: Change WP_Network id property to an integer.
For consistency and developer sanity.

Props flixos90.
Fixes #37050.

Built from https://develop.svn.wordpress.org/trunk@37870


git-svn-id: http://core.svn.wordpress.org/trunk@37811 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-26 14:26:29 +00:00
Drew Jaynes
50ab6e8df0 Docs: Improve first-order clause documentation for the $meta_query parameter in the constructor for WP_Meta_Query.
First-order meta query clauses are defined as clauses that have either a 'key' or 'value' array key. When using named first-order clauses in meta queries to order results in the parent query, `WP_Meta_Query` can additionally accept first-order clauses at the sub-clause level, which was not previous documented.

Fixes #32659.

Built from https://develop.svn.wordpress.org/trunk@37688


git-svn-id: http://core.svn.wordpress.org/trunk@37654 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-12 00:02:30 +00:00
Boone Gorges
fc1d2c99c9 In WP_Meta_Query, don't cast meta_value to CHAR.
`CHAR` is redundant, since the `meta_value` column is `LONGTEXT`. Meanwhile,
use of `CAST()` causes MySQL to ignore any index that the administrator may
have added to the column.

A number of automated tests were doing searches for `CAST` in the SQL strings
generated by `WP_Meta_Query` (for reasons unrelated to the `CAST()` behavior).
These tests have been updated to expect the new query format.

Props ericlewis.
Fixes #36625.
Built from https://develop.svn.wordpress.org/trunk@37594


git-svn-id: http://core.svn.wordpress.org/trunk@37562 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-30 04:36:27 +00:00
Drew Jaynes
602b51a209 Docs: Standardize filter docs in core classes in wp-includes/* to use third-person singular verbs per the inline documentation standards for PHP.
See #36913.

Built from https://develop.svn.wordpress.org/trunk@37492


git-svn-id: http://core.svn.wordpress.org/trunk@37460 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 18:15:28 +00:00
Drew Jaynes
fe3b007fdd Docs: Remove inline @see tags from function, class, and method references in inline docs.
Known functions, classes, and methods are now auto-linked in Code Reference pages following #meta1483.

Note: Hook references are still linked via inline `@see` tags due to the unlikelihood of reliably matching for known hooks based on a RegEx pattern.

See #32246.

Built from https://develop.svn.wordpress.org/trunk@37342


git-svn-id: http://core.svn.wordpress.org/trunk@37308 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-02 04:00:28 +00:00
Drew Jaynes
4caa9e474c Docs: Correctly document parameters in the hook doc for the get_meta_sql filter as individual parameters rather than an array.
When an array of parameters is passed to `do_action|apply_filters_ref_array`, parameters should be documented as individuals instead of as part of the whole.

Props sudar.
Fixes #35962.

Built from https://develop.svn.wordpress.org/trunk@36735


git-svn-id: http://core.svn.wordpress.org/trunk@36702 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-26 17:10:26 +00:00
Boone Gorges
68f3ee8f64 Docs: WP_Meta_Query accepts 'EXISTS' or 'NOT EXISTS' for $compare.
Props apaliku, jdgrimes.
Fixes #35891.
Built from https://develop.svn.wordpress.org/trunk@36609


git-svn-id: http://core.svn.wordpress.org/trunk@36576 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-22 03:56:27 +00:00
Drew Jaynes
217b661703 Docs: Add missing descriptions for the $wpdb global in DocBlocks all the places.
See #32246.

Built from https://develop.svn.wordpress.org/trunk@35170


git-svn-id: http://core.svn.wordpress.org/trunk@35136 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-14 23:44:25 +00:00
Drew Jaynes
0d1dcaa832 Docs: Add a file header to wp-includes/class-wp-meta-query.php, introduced in [33761].
Also clarifies the class DocBlock summary for `WP_Meta_Query`.

See #33413. See #33701.

Built from https://develop.svn.wordpress.org/trunk@34405


git-svn-id: http://core.svn.wordpress.org/trunk@34369 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-22 13:26:23 +00:00
Boone Gorges
c0a0d4ba50 Use stricter sanitization for meta query clause keys.
By forcing all clause keys to be strings, we make it possible to use strict
comparison when validating values of 'orderby' as passed to `WP_Query`. This
eliminates situations where the presence of numeric clause keys could result
in an improperly validated 'orderby' value.

Props nikolov.tmw.
Fixes #32937.
Built from https://develop.svn.wordpress.org/trunk@34090


git-svn-id: http://core.svn.wordpress.org/trunk@34058 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-12 21:06:24 +00:00
Scott Taylor
b6c01b80fa Meta: move WP_Meta_Query into its own file. meta.php loads the new files, so this is 100% BC if someone is loading meta.php directly. New files created using svn cp.
Creates: 
`class-wp-meta-query.php` 
`meta-functions.php` 

`meta.php` contains only top-level code. Class file only contains the class. Functions file only contains functions.

See #33413.

Built from https://develop.svn.wordpress.org/trunk@33761


git-svn-id: http://core.svn.wordpress.org/trunk@33729 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-26 13:02:21 +00:00