This avoids the performance overhead of the function call every time `dirname( __FILE__ )` was used instead of `__DIR__`.
This commit also includes:
* Removing unnecessary parentheses from `include`/`require` statements. These are language constructs, not function calls.
* Replacing `include` statements for several files with `require_once`, for consistency:
* `wp-admin/admin-header.php`
* `wp-admin/admin-footer.php`
* `wp-includes/version.php`
Props ayeshrajans, desrosj, valentinbora, jrf, joostdevalk, netweb.
Fixes#48082.
Built from https://develop.svn.wordpress.org/trunk@47198
git-svn-id: http://core.svn.wordpress.org/trunk@46998 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This renames the file containing the `WP_Date_Query` class to conform to the coding standards.
This commit also includes:
- A new `date.php` that includes the new file, for anyone that may've been including the file directly.
- Replaces references to the old filename with the new filename.
Fixes#47775. See #47632.
Built from https://develop.svn.wordpress.org/trunk@45678
git-svn-id: http://core.svn.wordpress.org/trunk@45489 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Use of `date()` in core depends on PHP timezone set to UTC and not changed by third party code (which cannot be guaranteed).
`gmdate()` is functionally equivalent, but is not affected by PHP timezone setting: it's always UTC, which is the exact behavior the core needs.
Props nielsdeblaauw, Rarst.
Fixes#46438. See #44491.
Built from https://develop.svn.wordpress.org/trunk@45424
git-svn-id: http://core.svn.wordpress.org/trunk@45235 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Prior to about 2013, many class methods lacked even access modifiers which made the `@access` notations that much more useful. Now that we've gotten to a point where the codebase is more mature from a maintenance perspective and we can finally remove these notations. Notable exceptions to this change include standalone functions notated as private as well as some classes still considered to represent "private" APIs.
See #41452.
Built from https://develop.svn.wordpress.org/trunk@41162
git-svn-id: http://core.svn.wordpress.org/trunk@41002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Provides a consistent way to query `$wpdb->blogs` for `WP_Site` objects based on domain, path, site ID, network ID, and more.
Introduces and uses `update_site_cache()` and `_prime_site_caches()` to maintain a cached list of `WP_Site` objects for use in multiple queries.
Props spacedmonkey, flixos90, DrewAPicture, jeremyfelt, ocean90.
See #35791.
Built from https://develop.svn.wordpress.org/trunk@37477
git-svn-id: http://core.svn.wordpress.org/trunk@37445 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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
If the 'compare' argument equals 'IN' or 'NOT IN', arrays of any number of specific, valid values are accepted and simply considered based on the value of 'operator' (OR or AND). If the 'compare' argument is a range such as 'BETWEEN' or 'NOT BETWEEN', arrays of only two valid values are accepted.
Props boonebgorges.
Fixes#31036.
Built from https://develop.svn.wordpress.org/trunk@31336
git-svn-id: http://core.svn.wordpress.org/trunk@31317 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Introduced in [29925], `validate_date_values()` throws `_doing_it_wrong()`
notices when values passed as part of a `WP_Date_Query` do not reflect actual
dates. However, the validation did not account properly for the case where an
array of multiple values is passed, as when doing IN or BETWEEN queries.
Props dlh.
Fixes#31001 for trunk.
Built from https://develop.svn.wordpress.org/trunk@31179
git-svn-id: http://core.svn.wordpress.org/trunk@31160 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The initial `dayofweek` param sets day 1 to Sunday. This is out of step with
ISO standards, which calls Monday day 1. To maintain backward compatibility
with the existing parameter, we introduce the new `dayofweek_iso` for the
new, more compliant param.
Props mboynes.
Fixes#28063.
Built from https://develop.svn.wordpress.org/trunk@30142
git-svn-id: http://core.svn.wordpress.org/trunk@30142 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The 'inclusive' parameter for WP_Date_Query determines whether non-precise
dates for 'before' and 'after' will be rounded up or down. Previously, this was
supported only when 'before' and 'after' were arrays; string-formatted dates
were run through strtotime(), which rounded them all down (inclusive in the
case of after, non-inclusive in the case of before). Now, we attempt to parse
formats that look like MySQL-formatted date strings, and apply inclusive logic
to them if we recognize them successfully.
Fixes#29908.
string values. Array values support the 'inclusive
Built from https://develop.svn.wordpress.org/trunk@29936
git-svn-id: http://core.svn.wordpress.org/trunk@29688 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The use of non-aliased column names (eg 'post_date' instead of 'wp_posts.post_date')
in WP_Date_Query causes SQL notices and other failures when queries involve
table joins, such as date_query combined with tax_query or meta_query. This
changeset modifies WP_Date_Query::validate_column() to add the table alias when
it can be detected from the column name (ie, in the case of core columns).
A side effect of this change is that it is now possible to use WP_Date_Query
to build WHERE clauses across multiple tables, though there is currently no
core support for the automatic generation of the necessary JOIN clauses. See
Props ew_holmes, wonderboymusic, neoxx, Viper007Bond, boonebgorges.
Fixes#25775.
Built from https://develop.svn.wordpress.org/trunk@29933
git-svn-id: http://core.svn.wordpress.org/trunk@29685 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This enhancement makes it possible to filter post, comment, and other queries
by date in ways that are arbitrarily complex, using mixed AND and OR relations.
Includes unit tests for the new syntax. In a few places, the existing unit
tests were slightly too strict (such as when checking the exact syntax of a SQL
string); these existing tests have been narrowed.
Props boonebgorges.
Fixes#29822.
Built from https://develop.svn.wordpress.org/trunk@29923
git-svn-id: http://core.svn.wordpress.org/trunk@29675 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Don't run non-numeric values through intval() for sanitization; this transforms them into 1s and 0s, which can cause unintended results.
* Be more generous about numeric array keys (don't require 0 and 1) in BETWEEN and NOT BETWEEN clauses.
Fixes#29801.
Built from https://develop.svn.wordpress.org/trunk@29797
git-svn-id: http://core.svn.wordpress.org/trunk@29566 1a063a9b-81f0-0310-95a4-ce76da25c4cd