Commit Graph

37 Commits

Author SHA1 Message Date
audrasjb 6263f22b10 Docs: Replace multiple single line comments with multi-line comments.
This changeset updates various comments as per WordPress PHP Inline Documentation Standards.
See https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/#5-inline-comments.

Follow-up to [56174], [56175], [56176], [56177], [56178], [56179], [56180], [56191].

Props costdev, audrasjb.
See #58459.



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


git-svn-id: http://core.svn.wordpress.org/trunk@55704 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-10 22:48:22 +00:00
Sergey Biryukov 5a59007323 I18N: Remove code from a translatable string in `wp-includes/ms-default-constants.php`.
This replaces the `VHOST` and `SUBDOMAIN_INSTALL` constant names in a message in `ms_subdomain_constants()` with placeholders, as they don't need to be translated.

Follow-up to [36773].

Props weboccults, hztyfoon, pratiweb.
Fixes #56216.
Built from https://develop.svn.wordpress.org/trunk@53699


git-svn-id: http://core.svn.wordpress.org/trunk@53258 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-14 13:35:13 +00:00
Sergey Biryukov 80548a4039 Code Modernization: Check the return type of `parse_url()` in `ms_cookie_constants()`.
As per the PHP manual:
> If the `component` parameter is omitted, an associative array is returned.
> If the `component` parameter is specified, `parse_url()` returns a string (or an int, in the case of `PHP_URL_PORT`) instead of an array. If the requested component doesn't exist within the given URL, `null` will be returned.

Reference: [https://www.php.net/manual/en/function.parse-url.php#refsect1-function.parse-url-returnvalues PHP Manual: parse_url(): Return Values]

It is entirely possible for the `siteurl` option to not have a "path" component.

In PHP 8.1, this would lead to a `trim(): Passing null to parameter #1 ($string) of type string is deprecated` notice.

Changing the logic around and adding validation for the return type value of `parse_url()` prevents that.

As this function is declaring global constants, adding tests for this change is not really an option without potentially affecting other tests.

Follow-up to [51606], [51622], [51626], [51629].

Props jrf, hellofromTonya, SergeyBiryukov.
See #53635.
Built from https://develop.svn.wordpress.org/trunk@51630


git-svn-id: http://core.svn.wordpress.org/trunk@51236 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-17 22:08:57 +00:00
Sergey Biryukov b16368c268 Docs: Remove `@staticvar` tags from core.
The tag was supported in phpDocumentor 1.x, but is no longer supported in 2.x and 3.x.

Usage of static variables is considered an internal implementation detail and has no information value for someone reading the docs.

Props alishanvr, jrf.
Fixes #50426.
Built from https://develop.svn.wordpress.org/trunk@48109


git-svn-id: http://core.svn.wordpress.org/trunk@47878 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-20 12:40:12 +00:00
Sergey Biryukov 7932193708 Coding Standards: Use strict comparison where static strings are involved.
This reduces the number of `WordPress.PHP.StrictComparisons.LooseComparison` issues in half, from 1897 to 890.

Includes minor code layout fixes for better readability.

See #49542.
Built from https://develop.svn.wordpress.org/trunk@47808


git-svn-id: http://core.svn.wordpress.org/trunk@47584 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-16 18:42:12 +00:00
Sergey Biryukov 001ffe81fb Docs: Improve inline comments per the documentation standards.
Includes minor code layout fixes for better readability.

See #48303.
Built from https://develop.svn.wordpress.org/trunk@47122


git-svn-id: http://core.svn.wordpress.org/trunk@46922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-29 00:45:18 +00:00
Gary Pendergast aaf99e6913 Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.


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


git-svn-id: http://core.svn.wordpress.org/trunk@42172 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-30 23:11:00 +00:00
Jeremy Felt abdfe59c28 Multisite: Use `get_current_blog_id()` instead of `$wpdb->blogid`.
`get_current_blog_id()` is more appropriate for determining the ID of the current site in most cases. This eliminates the need for the global `$wpdb` in several functions and is better than the implicit global used in admin pages.

Props bnap00, spacedmonkey.
Fixes #41684.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41495 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-02 01:44:47 +00:00
Jeremy Felt 1560fbcbc5 Multisite: Use `get_network()` and `get_current_network_id()` for current network data.
`get_network()` falls back to the current network when called without any arguments. Between this and `get_current_network_id()`, we can replace almost all instances of the global `$current_site` and all instances of `get_current_site()`.

This effectively deprecates `get_current_site()`, something that we'll do in a future ticket.

Props flixos90.
Fixes #37414.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38757 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-19 04:47:30 +00:00
Sergey Biryukov 139387b7e5 Docs: Use 3-digit, x.x.x-style semantic versioning for `_doing_it_wrong()`, `_deprecated_function()`, `_deprecated_argument()`, and `_deprecated_file()` throughout core.
Props metodiew.
Fixes #36495.
Built from https://develop.svn.wordpress.org/trunk@37985


git-svn-id: http://core.svn.wordpress.org/trunk@37926 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-06 12:40:29 +00:00
Sergey Biryukov 3cd78105dd I18N: Remove `<code>` tags from translatable string in `wp-admin/network/site-new.php`.
Props ramiy.
Fixes #35994.
Built from https://develop.svn.wordpress.org/trunk@36773


git-svn-id: http://core.svn.wordpress.org/trunk@36740 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-29 03:17:26 +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
Jeremy Felt 9926983b66 Revert [34778], continue using `_site_option()` for the current network.
The `_network_option()` parameter order will be changing to accept `$network_id` first. The `_site_option()` functions will remain in use throughout core as our way of retrieving a network option for the current network.

See #28290.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34877 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-07 17:11:25 +00:00
Jeremy Felt 54512d64cb MS: Use `*_network_option()` functions throughout core.
Replaces all uses of `*_site_option()` with the corresponding "network" function.

This excludes one usage in `wp-admin/admin-footer.php` that needs more investigation.

Props spacedmonkey.
See #28290.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-02 19:08:26 +00:00
Scott Taylor 4d26d999ce Fix doc blocks for `ms-*.php` files.
A few functions can return a conditional instead of an `if`/`else` of `true`/`false`.

See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32581 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-26 21:51:31 +00:00
Scott Taylor baf7f5604d After [29200], switch back to using `static` vars instead of adding 2 `global`s, as per Sergey.
Fixes #28697.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29034 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-19 23:14:15 +00:00
Scott Taylor 8496504f59 Properly set `$subdomain_error` to `false` when applicable in `ms_subdomain_constants()`. This was previously untestable because it used static vars: use globals instead.
Adds unit test.
Fixes #28697.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28984 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-16 22:35:14 +00:00
Sergey Biryukov 74f77b85a6 Use get_current_site() instead of the $current_site global when possible.
props jeremyfelt.
fixes #25158.
Built from https://develop.svn.wordpress.org/trunk@26120


git-svn-id: http://core.svn.wordpress.org/trunk@26032 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-13 03:23:10 +00:00
Andrew Nacin 987c35a790 Multisite in a subdirectory: For subdomain installs, use a root admin cookie path, not a wp-admin specific one.
This is necessary because, like subdirectory installs, we will have wp-admin accessed at different levels.

fixes #22705.



git-svn-id: http://core.svn.wordpress.org/trunk@23005 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-04 00:51:02 +00:00
Andrew Nacin dc3fbf216f Have wp_upload_dir() account for blog switching, ms-files rewriting, and the UPLOADS constant properly. This type of logic needs a lot of code comments.
Prevents wp_upload_dir() from obeying the UPLOADS constant when ms-files rewriting is enabled and a blog is switched.

Reverts [22106] thanks to [22108].

see #19235.



git-svn-id: http://core.svn.wordpress.org/trunk@22222 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-12 22:05:02 +00:00
Andrew Nacin 4ea9f01296 Account for the old 'main override' in wp_upload_dir() for the main site in a post-MU network by declining to define the UPLOADS constant.
Fixes uploads on the main site of a post-MU network that uses ms-files rewriting. see #19235.



git-svn-id: http://core.svn.wordpress.org/trunk@21892 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-18 18:07:18 +00:00
Andrew Nacin 7d8078a215 Attach the default ms_files_rewriting site option filter in ms-default-constants, as ms-default-filters is not included during SHORTINIT. see #19235.
git-svn-id: http://core.svn.wordpress.org/trunk@21881 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-17 22:05:06 +00:00
Andrew Nacin dc49f24a6c Remove ms-files.php rewriting from WordPress multisite. fixes #19235.
Keep existing networks compatible with a ms_files_rewriting network option.



git-svn-id: http://core.svn.wordpress.org/trunk@21823 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-11 22:22:20 +00:00
ryan e3b46b25d3 Lose EOF ?>. Clean up EOF newlines. fixes #12307
git-svn-id: http://svn.automattic.com/wordpress/trunk@19712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-08 17:01:11 +00:00
ryan 1a552dd029 Strip trailing whitespace
git-svn-id: http://svn.automattic.com/wordpress/trunk@14924 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-05-26 02:42:15 +00:00
nacin 1852eae49f Deprecate VHOST in favor of a boolean, SUBDOMAIN_INSTALL. Core will keep VHOST defined for plugins' sake, but you should only define SUBDOMAIN_INSTALL. Throws a notice if VHOST is defined, and a warning if they somehow conflict. Sunrise can still handle them. fixes #11796.
git-svn-id: http://svn.automattic.com/wordpress/trunk@14452 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-05-04 20:48:28 +00:00
wpmuguru 49e39c3b59 only use domain cookies in a subdomain install, see #12142
git-svn-id: http://svn.automattic.com/wordpress/trunk@14380 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-05-03 18:53:05 +00:00
nacin c449adb237 File-level phpdoc for multisite files.
git-svn-id: http://svn.automattic.com/wordpress/trunk@13998 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-04-04 13:29:35 +00:00
wpmuguru aa5acc9224 fix warning on cookie_domain, see #12457
git-svn-id: http://svn.automattic.com/wordpress/trunk@13707 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-03-15 17:43:18 +00:00
wpmuguru 8c9d21d3c5 Dont define BLOGUPLOADDIR if UPLOADS is defined, see #12558
git-svn-id: http://svn.automattic.com/wordpress/trunk@13632 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-03-09 18:19:28 +00:00
nacin 5be468ea5f Allow localhost in a multisite subdirectory install. More network.php improvements. see #12457 for localhost. see #11816
git-svn-id: http://svn.automattic.com/wordpress/trunk@13622 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-03-09 06:14:42 +00:00
ryan dbfb51c6e0 Trim trailing whites
git-svn-id: http://svn.automattic.com/wordpress/trunk@13268 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-02-21 00:03:42 +00:00
wpmuguru 99c15de631 use current site domain for cookie domain when cookie domain not set, See #12142
git-svn-id: http://svn.automattic.com/wordpress/trunk@13127 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-02-14 00:12:08 +00:00
westi b20c3c41d4 Improve the implementation of the default constant defining functions for multisite. See #11881.
git-svn-id: http://svn.automattic.com/wordpress/trunk@13065 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-02-12 08:22:34 +00:00
wpmuguru d1069acd38 improvements to custom content dir support, props nacin, see #11742
git-svn-id: http://svn.automattic.com/wordpress/trunk@12936 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-02-03 18:19:56 +00:00
wpmuguru b01479de37 reorganize code on ms startup. props nacin, see #11644
git-svn-id: http://svn.automattic.com/wordpress/trunk@12921 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-02-01 20:26:08 +00:00
ryan 39957f273e Add ms-default-constants.php. Props nacin. see #11881
git-svn-id: http://svn.automattic.com/wordpress/trunk@12886 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-01-28 17:16:58 +00:00