Commit Graph

203 Commits

Author SHA1 Message Date
Sergey Biryukov
58aa1cc8c5 Docs: Adjust wp_is_json_request() and wp_is_xml_request() return value descriptions for consistency.
See #48771, #48303.
Built from https://develop.svn.wordpress.org/trunk@46760


git-svn-id: http://core.svn.wordpress.org/trunk@46560 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-22 18:28:04 +00:00
Sergey Biryukov
597b22c99c Docs: Correct spelling and capitalization in wp-includes/load.php:
* Fix typo in `is_blog_admin()` description.
* Capitalize PHP correctly in `enable_wp_debug_mode_checks` filter description.
* Capitalize XML correctly in `wp_is_xml_request()` return value description.

Props stevegrunwell.
Fixes #48771.
Built from https://develop.svn.wordpress.org/trunk@46759


git-svn-id: http://core.svn.wordpress.org/trunk@46559 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-22 18:16:03 +00:00
John Blackbourn
f545bb3f63 Docs: Improve documentation of known return types, plus other docs fixes.
See #48303

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


git-svn-id: http://core.svn.wordpress.org/trunk@46460 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-05 21:23:02 +00:00
John Blackbourn
3caaa40fc6 Docs: Switch more docs over to typed array notation, plus some fixes.
See #48303, #41756

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


git-svn-id: http://core.svn.wordpress.org/trunk@46393 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-26 21:09:04 +00:00
Sergey Biryukov
7c9d4950b7 Bootstrap/Load: Reorganize the initialization flow so that the check for PHP and MySQL requirements could run as early as possible.
This allows us to use PHP 5.6+ syntax in more files, and display a proper error message on older PHP versions, instead of causing a parse error.

Fixes #48059.
Built from https://develop.svn.wordpress.org/trunk@46183


git-svn-id: http://core.svn.wordpress.org/trunk@45995 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-19 12:02:58 +00:00
Aaron Jorbin
dd3ad3ac51 GENERAL: Remove magic quote functions
The path to magic quote sanity took a fun and exciting turn: PHP core removed it and WordPress updated the minimum version.

For the formally external pclzip, the code is commented out to make investigating easier and in case we ever need to merge upstream (if that still exists) changes.

Props ayeshrajans, jrf, jorbin.
See #47783.
Fixes #18322.

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


git-svn-id: http://core.svn.wordpress.org/trunk@45917 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-13 22:21:01 +00:00
Sergey Biryukov
e199663322 I18N: Capitalize translator comments consistently, add trailing punctuation.
Includes minor code layout fixes.

See #44360.
Built from https://develop.svn.wordpress.org/trunk@45932


git-svn-id: http://core.svn.wordpress.org/trunk@45743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-03 00:41:05 +00:00
Sergey Biryukov
16b8d91baa I18N: Improve translator comments.
* Add missing translator comments.
* Fix placement of some translator comments. Translator comments should be on the line directly above the line containing the translation function call for optimal compatibility with various `.pot` file generation tools. The CS auto-fixing, which changed some inconsistent function calls to multi-line function calls, is part of the reason why this was no longer the case for a select group of translator comments.

Includes minor code layout fixes.

Polyglots, rejoice! All WordPress core files now have translator comments for all strings with placeholders!

Props jrf, subrataemfluence, GaryJ, webdados, Dency, swissspidy, alvarogois, marcomartins, mihaiiceyro, vladwtz, niq1982, flipkeijzer, michielatyoast, chandrapatel, thrijith, joshuanoyce, FesoVik, tessak22, bhaktirajdev, cleancoded, dhavalkasvala, garrett-eclipse, bibliofille, socalchristina, priyankkpatel, 5hel2l2y, adamsilverstein, JeffPaul, pierlo, SergeyBiryukov.
Fixes #44360.
Built from https://develop.svn.wordpress.org/trunk@45926


git-svn-id: http://core.svn.wordpress.org/trunk@45737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-01 17:13:59 +00:00
Sergey Biryukov
6041a08347 Bootstrap/Load: Change "Insufficient Requirements" wp_die() heading to "Requirements Not Met", which is more appropriate for the context it's used in.
Props yoavf.
Fixes #47575.
Built from https://develop.svn.wordpress.org/trunk@45770


git-svn-id: http://core.svn.wordpress.org/trunk@45581 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-08 12:54:56 +00:00
Sergey Biryukov
6da93732e7 Docs: Add missing description for $current_screen global.
Props mukesh27.
Fixes #45604. See #47110.
Built from https://develop.svn.wordpress.org/trunk@45740


git-svn-id: http://core.svn.wordpress.org/trunk@45551 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-04 02:03:55 +00:00
Sergey Biryukov
e0311b76c7 Docs: Add missing description for $wp_locale global.
Props mukesh27.
See #45604, #47110.
Built from https://develop.svn.wordpress.org/trunk@45737


git-svn-id: http://core.svn.wordpress.org/trunk@45548 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-04 01:46:55 +00:00
Sergey Biryukov
29b072e706 Docs: Add missing description for $wpdb, $wp_db_version, and $wp_current_db_version globals.
Props mukesh27, utsav72640, immeet94, SergeyBiryukov.
See #45604.
Built from https://develop.svn.wordpress.org/trunk@45734


git-svn-id: http://core.svn.wordpress.org/trunk@45545 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-04 01:12:56 +00:00
Sergey Biryukov
1d283ef54f Docs: Clarify that is_network_admin() does not check if the site is a Multisite network; is_multisite() should be used for that.
Props svovaf, dilipbheda, tazotodua.
Fixes #47415.
Built from https://develop.svn.wordpress.org/trunk@45672


git-svn-id: http://core.svn.wordpress.org/trunk@45483 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-25 15:19:58 +00:00
Gary Pendergast
abcbee954f Coding Standards: Fix instances of WordPress.PHP.NoSilencedErrors.Discouraged.
Noteable changes:
- The `magic_quotes_runtime` and `magic_quotes_sybase` settings were removed in PHP 5.4, so no longer need to be set.
- Some functions that use external libraries can generate errors that can't be tested for, so are globally allowed to silence errors.
- Quite a few functions would cause errors if `safe_mode` was set. This setting was removed in PHP 5.4.
- Only a handful of `header()` calls needed corresponding `headers_sent()` checks for unit tests to pass, but more may need to be added as the nightlies builds are tested.

See #46732.

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


git-svn-id: http://core.svn.wordpress.org/trunk@45422 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-09 05:45:58 +00:00
Gary Pendergast
4803fc405e Coding Standards: Fix the Squiz.PHP.DisallowMultipleAssignments violations in wp-includes.
See #47632.


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


git-svn-id: http://core.svn.wordpress.org/trunk@45401 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-02 23:42:58 +00:00
Gary Pendergast
55af0f0d0a Coding Standards: Fix/ignore the WordPress.NamingConventions.ValidFunctionName violations.
See #47632


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


git-svn-id: http://core.svn.wordpress.org/trunk@45391 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-01 08:01:57 +00:00
Sergey Biryukov
27720e15a7 Bootstrap/Load: In wp_get_server_protocol(), check if $_SERVER['SERVER_PROTOCOL'] is defined, to avoid a notice in CLI context.
Props thakkarhardik, malthert.
Fixes #47005.
Built from https://develop.svn.wordpress.org/trunk@45400


git-svn-id: http://core.svn.wordpress.org/trunk@45211 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-05-24 01:47:51 +00:00
Sergey Biryukov
550bc5cad2 Build/Test Tools: Use a non-zero exit code in wp_check_php_mysql_versions() when minimum PHP or MySQL requirements are not met.
This allows automated scripts and test suites to interpret the result correctly.

Props jrf, spacedmonkey.
Fixes #47169.
Built from https://develop.svn.wordpress.org/trunk@45350


git-svn-id: http://core.svn.wordpress.org/trunk@45161 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-05-17 12:34:52 +00:00
Felix Arntz
52354f3f0b Bootstrap/Load: Do not redefine constants because tests don't like it.
See #46045.

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


git-svn-id: http://core.svn.wordpress.org/trunk@44925 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-05 15:53:50 +00:00
Felix Arntz
6d58109b09 Bootstrap/Load: Ensure WP_Fatal_Error_Handler does not conflict with existing mechanisms treating fatal errors.
Prior to this change, resuming or activating a plugin or theme that is still broken would result in a redirect loop if in recovery mode. If outside recovery mode, it would cause the error template to be displayed.

Furthermore this applies to breaking a plugin or theme when editing from the backend.

Props aandrewdixon, azaozz, dhanukanuwan, henrywright, ocean90, ohiosierra, PandelisZ, xkon.
Fixes #46045, #46751.

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


git-svn-id: http://core.svn.wordpress.org/trunk@44923 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-05 15:20:55 +00:00
Sergey Biryukov
b4ded564ff PHPCS: Remove extra tab added in [45019].
See #45974.
Built from https://develop.svn.wordpress.org/trunk@45022


git-svn-id: http://core.svn.wordpress.org/trunk@44831 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-27 00:03:51 +00:00
Sergey Biryukov
3e5c258b74 Bootstrap/Load: Use wp_die() instead of hardcoded HTML in wp_maintenance(), so the output can be filtered by plugins.
Props spacedmonkey.
Fixes #45974.
Built from https://develop.svn.wordpress.org/trunk@45019


git-svn-id: http://core.svn.wordpress.org/trunk@44828 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-26 23:39:51 +00:00
Sergey Biryukov
f6b6dc7e73 Docs: Fix typo in wp_is_xml_request() description.
See #46026.
Built from https://develop.svn.wordpress.org/trunk@45018


git-svn-id: http://core.svn.wordpress.org/trunk@44827 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-26 23:21:51 +00:00
Sergey Biryukov
546841949f Bootstrap/Load: Add support for XML requests to wp_die().
In addition to AJAX, XML-RPC, JSON, and JSONP requests, `wp_die()` now handles XML requests correctly, returning information in the expected content type.

Props spacedmonkey, birgire.
Fixes #46026. See #44458.
Built from https://develop.svn.wordpress.org/trunk@45016


git-svn-id: http://core.svn.wordpress.org/trunk@44825 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-26 23:11:52 +00:00
Sergey Biryukov
4101255505 Bootstrap/Load: Add support for JSONP requests to wp_die().
In addition to AJAX, XML-RPC, and JSON requests, `wp_die()` now handles JSONP requests correctly, returning information in the expected content type.

Props spacedmonkey, TimothyBlynJacobs.
Fixes #46025. See #44458.
Built from https://develop.svn.wordpress.org/trunk@45015


git-svn-id: http://core.svn.wordpress.org/trunk@44824 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-26 22:26:52 +00:00
Felix Arntz
3a77265148 Bootstrap/Load: Introduce a recovery mode for fixing fatal errors.
Using the new fatal handler introduced in [44962], an email is sent to the admin when a fatal error occurs. This email includes a secret link to enter recovery mode. When clicked, the link will be validated and on success a cookie will be placed on the client, enabling recovery mode for that user. This functionality is executed early before plugins and themes are loaded, in order to be unaffected by potential fatal errors these might be causing.

When in recovery mode, broken plugins and themes will be paused for that client, so that they are able to access the admin backend despite of these errors. They are notified about the broken extensions and the errors caused, and can then decide whether they would like to temporarily deactivate the extension or fix the problem and resume the extension.

A link in the admin bar allows the client to exit recovery mode.

Props timothyblynjacobs, afragen, flixos90, nerrad, miss_jwo, schlessera, spacedmonkey, swissspidy.
Fixes #46130, #44458.

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


git-svn-id: http://core.svn.wordpress.org/trunk@44804 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-21 21:53:51 +00:00
Felix Arntz
92c3c46abe Bootstrap/Load: Revert fatal error recovery mechanism from 5.1 to polish for 5.2.
Due to the high number of follow-up tickets and associated security concerns, it was decided to reschedule the fatal error recovery feature for WordPress 5.2, in order to address these issues properly. The feature will continue to be developed, with iterations being merged into trunk early in the 5.2 release cycle.

Fixes #46141. See #44458, #45932, #45940, #46038, #46047, #46068.

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


git-svn-id: http://core.svn.wordpress.org/trunk@44548 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-30 11:01:52 +00:00
Gary Pendergast
4f861b9548 Coding Standards: Fix the Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace violations.
See #45934.


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


git-svn-id: http://core.svn.wordpress.org/trunk@44397 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-11 06:40:50 +00:00
Felix Arntz
1e4088fc98 Bootstrap/Load: Introduce fatal error recovery mechanism allowing users to still log in to their admin dashboard.
This changeset introduces a `WP_Shutdown_Handler` class that detects fatal errors and which extension (plugin or theme) causes them. Such an error is then recorded, and an error message is displayed. Subsequently, in certain protected areas, for example the admin, the broken extension will be paused, ensuring that the website is still usable in the respective area. The major benefit is that this mechanism allows site owners to still log in to their website, to fix the problem by either disabling the extension or solving the bug and then resuming the extension.

Extensions are only paused in certain designated areas. The frontend for example stays unaffected, as it is impossible to know what pausing the extension would cause to be missing, so it might be preferrable to clearly see that the website is temporarily not accessible instead.

The fatal error recovery is especially important in scope of encouraging the switch to a maintained PHP version, as not necessarily every WordPress extension is compatible with all PHP versions. If problems occur now, non-technical site owners that do not have immediate access to the codebase are not locked out of their site and can at least temporarily solve the problem quickly.

Websites that have custom requirements in that regard can implement their own shutdown handler by adding a `shutdown-handler.php` drop-in that returns the handler instance to use, which must be based on a class that inherits `WP_Shutdown_Handler`. That handler will then be used in place of the default one.

Websites that would like to modify specifically the error template displayed in the frontend can add a `php-error.php` drop-in that works similarly to the existing `db-error.php` drop-in.

Props afragen, bradleyt, flixos90, ocean90, schlessera, SergeyBiryukov, spacedmonkey.
Fixes #44458.

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


git-svn-id: http://core.svn.wordpress.org/trunk@44355 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-09 20:05:49 +00:00
Gary Pendergast
0049b17f8a Bootstrap: Allow WP_DEBUG_LOG to override the debug.log location.
Setting `WP_DEBUG_LOG` to a file path will now cause the debug log to be written to that file, rather than the default `WP_CONTENT_DIR/debug.log`.

Props SergeyBiryukov, ethitter, sebastian.pisula, nacin.
Fixes #18391.


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


git-svn-id: http://core.svn.wordpress.org/trunk@44284 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-08 03:42:48 +00:00
Jeremy Felt
4b6b8a55fe Load: Disable PHP errors for JSON requests
Because WP REST API requests aren't identified until `parse_request`, it's impractical to reference the `REST_REQUEST` constant in `wp_debug_mode()`. Instead, it's more helpful to assume that a request wanting a JSON response probably doesn't want PHP errors breaking the response.

Merges [43730] to trunk.

Props chrisl27, duanestorey, earnjam.
Fixes #44534.

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


git-svn-id: http://core.svn.wordpress.org/trunk@43815 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-12 03:08:23 +00:00
Gary Pendergast
56c162fbc9 Coding Standards: Upgrade WPCS to 1.0.0
WPCS 1.0.0 includes a bunch of new auto-fixers, which drops the number of coding standards issues across WordPress significantly. Prior to running the auto-fixers, there were 15,312 issues detected. With this commit, we now drop to 4,769 issues.

This change includes three notable additions:
- Multiline function calls must now put each parameter on a new line.
- Auto-formatting files is now part of the `grunt precommit` script. 
- Auto-fixable coding standards issues will now cause Travis failures.

Fixes #44600.


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


git-svn-id: http://core.svn.wordpress.org/trunk@43400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-08-17 01:51:36 +00:00
Sergey Biryukov
9a8f48c9bc Docs: Add missing verb in is_admin(), is_blog_admin(), is_network_admin(), is_user_admin() descriptions.
See #42505.
Built from https://develop.svn.wordpress.org/trunk@43022


git-svn-id: http://core.svn.wordpress.org/trunk@42851 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-04-29 21:14:22 +00:00
John Blackbourn
ea8052df59 Upgrade/Install: Don't include wp-includes/formatting.php twice during installation.
This avoids a fatal error caused by function redeclaration.

Props ocean90, kkarpieszuk

Fixes #43609

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


git-svn-id: http://core.svn.wordpress.org/trunk@42817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-04-18 23:54:20 +00:00
Dominik Schilling
5c291d49de Pinking shears.
See #41057.
Built from https://develop.svn.wordpress.org/trunk@42843


git-svn-id: http://core.svn.wordpress.org/trunk@42673 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-18 14:23:33 +00:00
Felix Arntz
176a289050 Multisite: Introduce metadata for sites.
A new global multisite table `wp_blogmeta` is added to the database schema, and a set of `*_site_meta()` API functions are introduced.

The implementation fails gracefully when the new table is not yet available, which may happen especially shortly after the core update, before the network has been upgraded to the new database schema. The presence of the table is detected once and stored as a global setting on the main network.

Core does not yet use site metadata, but there are several use-cases to be implemented or explored in the near future, and it allows plugins to extend sites with arbitrary data, which will come in particularly handy with the upcoming REST API endpoint for sites.

Props spacedmonkey, johnjamesjacoby, jeremyfelt, flixos90.
Fixes #37923.

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


git-svn-id: http://core.svn.wordpress.org/trunk@42666 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-16 02:15:31 +00:00
Sergey Biryukov
4848a09b35 I18N: Use the actual placeholder instead of a number in translator comments if the corresponding string does not use numbered placeholders.
Add missing translator comments in `WP_Theme_Install_List_Table` and `wp_notify_postauthor()`.
Add missing commas in some translator comments.

Fixes #43523.
Built from https://develop.svn.wordpress.org/trunk@42827


git-svn-id: http://core.svn.wordpress.org/trunk@42657 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-11 16:44:34 +00:00
John Blackbourn
c9b07e6411 Docs: Standardise and correct documentation relating to parameters which accept plugin names.
See #42505

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


git-svn-id: http://core.svn.wordpress.org/trunk@42617 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-05 21:50:31 +00:00
Mark Jaquith
edfe2ece51 Cache API: Allow external object caches to gracefully degrade to the default object cache.
Rework logic for how external object caches are detected, so that if
an external cache does not define a `wp_cache_init()`, the built-in
object cache will be used.

Object caches can now wrap their entire contents in logic checks. So a
Redis caching backend could make sure that the `Redis` PHP class is
available before defining all the caching functions. And if Redis is
not available, the site doesn't break or throw errors or think it is
using caching when it isn't. This is particularly useful for doing
local development, where you might want to develop on a site without
running Memcache or Redis like you are in production.

* Accounts for multisite, which may re-initialize the object cache
multiple times.
* Accounts for object caches that may include `object-cache.php` during
`advanced-cache.php` (before WP loads it).

Props jtsternberg, markjaquith.
Fixes #22661.


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


git-svn-id: http://core.svn.wordpress.org/trunk@42553 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-21 14:59:30 +00:00
Drew Jaynes
6e665d1f15 Docs: Link to the "Conditional Tags" article in the Theme Developer Handbook from the descriptions for a variety of core conditional tag functions.
These notations largely serve to direct consumers (of both the source and the parsed code reference) to extended information on individual and related conditional tags throughout WordPress. The changeset also standardizes corresponding DocBlock summaries to use third-person singular verbs.

Notations been added for the following functions:

* comments_open()
* email exists()
* has_excerpt()
* has_post_thumbnail()
* has_tag()
* in_category()
* in_the_loop()
* is_404()
* is_active_sidebar()
* is_active_widget()
* is_admin()
* is_admin_bar_showing()
* is_archive()
* is_attachment()
* is_author()
* is_blog_installed()
* is_category()
* is_comments_popup()
* is_date()
* is_day()
* is_dynamic_sidebar()
* is_feed()
* is_front_page()
* is_home()
* is_local_attachment()
* is_main_query
* is_month()
* is_multi_author
* is_new_day()
* is_page()
* is_page_template()
* is_paged()
* is_plugin_active()
* is_plugin_active_for_network()
* is_plugin_inactive()
* is_plugin_page()
* is_post_type_archive()
* is_preview()
* is_rtl()
* is_search()
* is_single()
* is_singular()
* is_sticky()
* is_tag()
* is_tax()
* is_taxonomy_hierarchical()
* is_time()
* is_trackback()
* is_user_logged_in()
* is_year()
* pings_open()
* post_type_exists()
* taxonomy_exists()
* term_exists()
* username exists()
* wp_attachment_is_image()
* wp_script_is()

Props janalwin.
Fixes #43254.

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


git-svn-id: http://core.svn.wordpress.org/trunk@42538 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-13 16:54:31 +00:00
Sergey Biryukov
c2e74ab915 Database: In require_wp_db(), check if database constants are defined before using them.
Otherwise, `wp-admin/setup-config.php` triggers an undefined constant warning in PHP 7.2.

Props mariusvw, jryancard for initial patch.
Fixes #35560.
Built from https://develop.svn.wordpress.org/trunk@42701


git-svn-id: http://core.svn.wordpress.org/trunk@42529 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-11 18:47:30 +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
Gary Pendergast
a779284c00 General: Reformat inline if () statements inside HTML tags.
This pattern occurs a handful of times across the codebase:

`<div class="foo<?php if ( $bar ) { echo ' baz'; } ?>">`

Unfortunately, it doesn't really play nicely with `phpcbf`, so all instances need to be removed in preperation for auto code formatting.

See #41057.


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


git-svn-id: http://core.svn.wordpress.org/trunk@42046 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-23 04:09:49 +00:00
Sergey Biryukov
73dc2a45e3 Docs: Document $ini_all staticvar in wp_is_ini_value_changeable().
Props nileshdudakiya94.
Fixes #41399.
Built from https://develop.svn.wordpress.org/trunk@41922


git-svn-id: http://core.svn.wordpress.org/trunk@41756 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-18 19:54:48 +00:00
Weston Ruter
1a22fb3b60 File Editor: Increase robustness of fatal error checking when saving PHP file edits.
* Increase PHP execution time limit prior to issuing loopback requests where are themselves given timeouts to ensure PHP file can be reverted.
* Output scrape messages on success and failure so that absence of either can also be flagged as an error condition.
* Forward browser's HTTP Basic Auth credentials in loopback requests to admin and home URL.
* Display more helpful message when loopback request fails.

Amends [41721].
See #21622.
Fixes #42102.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41639 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-10 05:27:49 +00:00
Weston Ruter
5f7a5c1246 File Editors: Introduce sandboxed live editing of PHP files with rollbacks for both themes and plugins.
* Edits to active plugins which cause PHP fatal errors will no longer auto-deactivate the plugin. Supersedes #39766.
* Introduce sandboxed PHP file edits for active themes, preventing accidental whitescreening of a user's site when introducing a fatal error.
* After writing a change to a PHP file for an active theme or plugin, perform loopback requests on the file editor admin screens and the homepage to check for fatal errors. If a fatal error is encountered, roll back the edited file and display the error to the user to fix and try again.
* Introduce a secure way to scrape PHP fatal errors from a site via `wp_start_scraping_edited_file_errors()` and `wp_finalize_scraping_edited_file_errors()`.
* Moves file modifications from `theme-editor.php` and `plugin-editor.php` to common `wp_edit_theme_plugin_file()` function.
* Refactor themes and plugin editors to submit file changes via Ajax instead of doing full page refreshes when JS is available.
* Use `get` method for theme/plugin dropdowns.
* Improve styling of plugin editors, including width of plugin/theme dropdowns.
* Improve notices API for theme/plugin editor JS component.
* Strip common base directory from plugin file list. See #24048.
* Factor out functions to list editable file types in `wp_get_theme_file_editable_extensions()` and `wp_get_plugin_file_editable_extensions()`.
* Scroll to line in editor that has linting error when attempting to save. See #41886.
* Add checkbox to dismiss lint errors to proceed with saving. See #41887.
* Only style the Update File button as disabled instead of actually disabling it for accessibility reasons.
* Ensure that value from CodeMirror is used instead of `textarea` when CodeMirror is present.
* Add "Are you sure?" check when leaving editor when there are unsaved changes.

Supersedes [41560].
See #39766, #24048, #41886.
Props westonruter, Clorith, melchoyce, johnbillion, jjj, jdgrimes, azaozz.
Fixes #21622, #41887.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41555 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-04 00:20:45 +00:00
Sergey Biryukov
6fda2e67b0 Docs: Add a @global entry for $wp_filter in wp_start_object_cache().
Props bhaveshkhadodara.
Fixes #41222.
Built from https://develop.svn.wordpress.org/trunk@40992


git-svn-id: http://core.svn.wordpress.org/trunk@40842 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-01 22:13:41 +00:00
Pascal Birchler
763f09fb7e Upgrade/Install: After [40638], make sure wp_is_file_mod_allowed() actually returns the right value.
See #38673.


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


git-svn-id: http://core.svn.wordpress.org/trunk@40500 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-11 19:54:43 +00:00
Pascal Birchler
33047ba14e Upgrade/Install: After [40394], rename wp_disallow_file_mods() to wp_is_file_mod_allowed().
This makes it more clear what this function is about.

Props Mte90.
Fixes #38673.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40499 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-11 19:24:41 +00:00
Pascal Birchler
064e62cbea Cron API: Add a new wp_doing_cron() helper function.
This replaces `DOING_CRON` checks via the constant.

Props tfrommen.
Fixes #39591.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40445 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-06 14:30:40 +00:00