Commit Graph

398 Commits

Author SHA1 Message Date
Sergey Biryukov
5a60d4b3b0 Customize: Do not allow changesets to be deleted when someone is editing them.
This makes the behavior consistent with that of locked posts, which can't be deleted via the list tables when another user is editing them.

Props dlh.
Fixes #50501.
Built from https://develop.svn.wordpress.org/trunk@48211


git-svn-id: http://core.svn.wordpress.org/trunk@47980 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-29 10:33:08 +00:00
Sergey Biryukov
e13c363b17 Docs: Capitalize "ID", when referring to a post ID, term ID, etc. in a more consistent way.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48104


git-svn-id: http://core.svn.wordpress.org/trunk@47873 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-20 12:02:12 +00:00
John Blackbourn
1a77bb81d8 Docs: Remove unnecessary variables names from @return tags.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48100


git-svn-id: http://core.svn.wordpress.org/trunk@47869 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-19 22:55:12 +00:00
Sergey Biryukov
de59ad23a4 Docs: Consistently include an empty line between @since tag and @see, @link, or @global, per the documentation standards.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48067


git-svn-id: http://core.svn.wordpress.org/trunk@47834 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-16 21:07:14 +00:00
Sergey Biryukov
434bee9fc9 Coding Standards: Fix WPCS issues in wp-includes/class-wp-customize-manager.php.
Follow-up to [47819].

Props sorenbronsted.
See #49542.
Built from https://develop.svn.wordpress.org/trunk@47821


git-svn-id: http://core.svn.wordpress.org/trunk@47597 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-19 08:41:12 +00:00
Sergey Biryukov
307725883a Themes: Prevent installation of themes that require a higher version of PHP or WordPress.
Props afragen.
Fixes #49653. See #48491.
Built from https://develop.svn.wordpress.org/trunk@47819


git-svn-id: http://core.svn.wordpress.org/trunk@47595 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-18 16:03:09 +00:00
Sergey Biryukov
266b52513b Docs: Correct @since versions, remove duplicate comment.
Follow-up to [47633].
Built from https://develop.svn.wordpress.org/trunk@47663


git-svn-id: http://core.svn.wordpress.org/trunk@47440 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-29 17:25:10 +00:00
whyisjake
55cd633c37 Customize: Add additional filters to Customizer to prevent JSON corruption.
This solution extends the wp_insert_post_data filter to pass in addition to the slashed/sanitized/processed data, and the slashed/sanitized/unprocessed data, to also pass the initial slashed/unsanitized/unprocessed data which was passed into wp_insert_post(). This then allows plugins to have complete control over how sanitization is performed based on the post type.

Props westonruter, peterwilsoncc, sstoqnov, whyisjake, xknown.
 

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


git-svn-id: http://core.svn.wordpress.org/trunk@47408 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-29 15:14:10 +00:00
Sergey Biryukov
38676936ba Coding Standards: Use strict type check for in_array() and array_search() where strings are involved.
This reduces the number of `WordPress.PHP.StrictInArray.MissingTrueStrict` issues from 486 to 50.

Includes minor code layout fixes for better readability.

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


git-svn-id: http://core.svn.wordpress.org/trunk@47325 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-05 03:02:11 +00:00
Sergey Biryukov
50afd0aa1b Docs: Add a reference to WP_Customize_Panel::__construct() for information on accepted arguments in WP_Customize_Manager::add_panel().
Synchronize the documentation between two places, use `WP_Customize_Panel::__construct()` as the canonical source.

Props iaaxpage, marekdedic.
Fixes #48344.
Built from https://develop.svn.wordpress.org/trunk@47387


git-svn-id: http://core.svn.wordpress.org/trunk@47174 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-27 20:36:07 +00:00
Sergey Biryukov
9043b9833f Docs: Add a reference to WP_Customize_Section::__construct() for information on accepted arguments in WP_Customize_Manager::add_section().
Synchronize the documentation between two places, use `WP_Customize_Section::__construct()` as the canonical source.

Props amolv, marekdedic.
Fixes #48346.
Built from https://develop.svn.wordpress.org/trunk@47386


git-svn-id: http://core.svn.wordpress.org/trunk@47173 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-27 20:29:06 +00:00
Sergey Biryukov
569319f553 Docs: Clarify the type of theme_supports argument in various Customizer classes.
Props marekdedic.
See #48347.
Built from https://develop.svn.wordpress.org/trunk@47385


git-svn-id: http://core.svn.wordpress.org/trunk@47172 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-27 20:23:06 +00:00
Sergey Biryukov
8c5a8f1811 Docs: Add a reference to WP_Customize_Setting::__construct() for information on accepted arguments in WP_Customize_Manager::add_setting().
Synchronize the documentation between two places, use `WP_Customize_Setting::__construct()` as the canonical source.

Props tmanoilov, marekdedic.
Fixes #48347.
Built from https://develop.svn.wordpress.org/trunk@47384


git-svn-id: http://core.svn.wordpress.org/trunk@47171 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-27 20:09:06 +00:00
Sergey Biryukov
3d75b5bac5 Docs: Add a @see reference to WP_Customize_Control::__construct() in child class constructors.
Follow-up to [47363], [47364].

See #48343, #48348.
Built from https://develop.svn.wordpress.org/trunk@47382


git-svn-id: http://core.svn.wordpress.org/trunk@47169 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-26 13:30:08 +00:00
Sergey Biryukov
89689e5ba9 Docs: Clarify in WP_Customize_Manager::remove_*() methods that removing a setting, panel, section, or control does not destroy the class instance or remove its filters.
Props dlh, fgiannar, jon81, westonruter.
Fixes #48747.
Built from https://develop.svn.wordpress.org/trunk@47367


git-svn-id: http://core.svn.wordpress.org/trunk@47154 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-25 17:50:05 +00:00
Sergey Biryukov
d51c720d2f Docs: Add a reference to WP_Customize_Control::__construct() for information on accepted arguments in WP_Customize_Manager::add_control().
Synchronize the documentation between two places, use `WP_Customize_Control::__construct()` as the canonical source.

Props hAmpzter, marekdedic, SergeyBiryukov.
Fixes #48343.
Built from https://develop.svn.wordpress.org/trunk@47364


git-svn-id: http://core.svn.wordpress.org/trunk@47151 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-25 16:41:07 +00:00
Sergey Biryukov
a6949956d1 Administration: Capitalize Trash consistently in various messages and comments.
When used as a noun referring to the "virtual" place, `Trash` should be capitalized.

Props garrett-eclipse, aandrewdixon, Presskopp.
Fixes #45317.
Built from https://develop.svn.wordpress.org/trunk@47233


git-svn-id: http://core.svn.wordpress.org/trunk@47033 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-10 04:12:07 +00:00
Sergey Biryukov
47ed56f38f Code Modernization: Replace dirname( __FILE__ ) calls with __DIR__ magic constant.
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
2020-02-06 06:33:11 +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
John Blackbourn
aa1fdcbd52 Docs: Correct various docblocks documentation.
See #48303
Built from https://develop.svn.wordpress.org/trunk@46821


git-svn-id: http://core.svn.wordpress.org/trunk@46621 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-06 22:23:04 +00:00
Sergey Biryukov
d5434d7cc7 Customize: If the return URL for Close button is a page added to the Appearance menu by a deactivated theme, fall back to the Themes screen.
Props JarretC, Jean-David, SergeyBiryukov.
Fixes #46686.
Built from https://develop.svn.wordpress.org/trunk@46754


git-svn-id: http://core.svn.wordpress.org/trunk@46554 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-20 18:49:03 +00:00
Sergey Biryukov
b0ddfb2435 Docs: Move the @link tag for Customize API in WP_Customize_Manager::add_setting() and WP_Customize_Setting to a more appropriate place.
See #48303.
Built from https://develop.svn.wordpress.org/trunk@46691


git-svn-id: http://core.svn.wordpress.org/trunk@46491 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-10 01:43:02 +00:00
John Blackbourn
9ac1d82f23 Docs: Further improve documentation of known return types, plus other docs fixes.
See #48303

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


git-svn-id: http://core.svn.wordpress.org/trunk@46461 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-05 21:27:02 +00:00
desrosj
583e49d95f Customize: Formally deprecate unused Customizer classes.
The `WP_Customize_New_Menu_Control` and `WP_Customize_New_Menu_Section` PHP classes and `wp.customize.Menus.NewMenuControl` JS class were deprecated in 4.9 through [42034] with the intention of removing them in 5.0. Since more time has passed than originally intended, this change leaves `WP_Customize_New_Menu_Control` and `WP_Customize_New_Menu_Section` to prevent any potential backwards compatibility issues, and formally deprecates them. The `wp.customize.Menus.NewMenuControl` JS class is removed.

Props weston.ruter, matthias-reuter, jrf.
Fixes #42364.
Built from https://develop.svn.wordpress.org/trunk@46637


git-svn-id: http://core.svn.wordpress.org/trunk@46437 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-03 16:48:00 +00:00
Sergey Biryukov
71e8fedf6c Customize: Ensure that WP_Customize_Manager::import_theme_starter_content() properly handles starter content with (nested) arrays as values.
Previously, searching for symbol references to replace with post or attachment IDs in array values resulted in a PHP warning.

Props timph, JarretC, SergeyBiryukov.
Fixes #45484.
Built from https://develop.svn.wordpress.org/trunk@46548


git-svn-id: http://core.svn.wordpress.org/trunk@46345 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-15 16:43:01 +00:00
Sergey Biryukov
b36c4692d4 Code Modernization: Use the ** operator instead of the pow() function in wp_convert_bytes_to_hr() for better performance.
Use the `MB_IN_BYTES` constant instead of the `pow()` function in `WP_Customize_Manager::_validate_header_video()` for better readability.

Props ayeshrajans, jrf.
Fixes #48083.
Built from https://develop.svn.wordpress.org/trunk@46225


git-svn-id: http://core.svn.wordpress.org/trunk@46037 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-21 12:49:57 +00:00
Sergey Biryukov
eb3f420848 Code Modernization: Remove all code using a version_compare() with a PHP version older than PHP 5.6.
Props jrf.
Fixes #48074.
Built from https://develop.svn.wordpress.org/trunk@46214


git-svn-id: http://core.svn.wordpress.org/trunk@46026 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-20 22:02:57 +00:00
desrosj
3cf6276ed0 Code Modernization: Remove JSON extension workarounds for PHP < 5.6.
The PHP native JSON extension has been bundled and compiled with PHP by default since version 5.2.0. Because the minimum version of PHP required by WordPress is now 5.6.20 (see #46594 and [45058]), JSON extension related polyfills and backwards compatibility code can now be removed.

This change removes code that supported JSON related functionality on older versions of PHP. This includes (but is not limited to) checks that `json_last_error()` exists, checking and setting the `JSON_UNESCAPED_SLASHES` and `JSON_PRETTY_PRINT` constants if not previously defined, and deprecating the `_wp_json_prepare_data()` function (which was 100% workaround code).

Follow up of [46205].

See #47699.
Props jrf, Clorith, pento.
Built from https://develop.svn.wordpress.org/trunk@46206


git-svn-id: http://core.svn.wordpress.org/trunk@46018 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-20 20:08:57 +00:00
Sergey Biryukov
6e39938fb5 Code Modernisation: Replace call_user_func_array() in wp-includes/class-wp-customize-*.php with direct function calls in combination with the spread operator.
Props jrf.
See #47678.
Built from https://develop.svn.wordpress.org/trunk@46133


git-svn-id: http://core.svn.wordpress.org/trunk@45945 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-15 11:27:55 +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
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
Gary Pendergast
a571a7d621 Code Modernisation: Fix known instances of array access on data types that can't be accessed as arrays.
PHP 7.4 addes a warning when trying access a null/bool/int/float/resource (everything but array, string and object) as if it were an array.

This change fixes all of these warnings visible in unit tests.

Props jrf.
See #47704.



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


git-svn-id: http://core.svn.wordpress.org/trunk@45450 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-15 06:25:57 +00:00
Sergey Biryukov
53719315b4 I18N: Merge duplicate "Original" strings used in the same context (referring to image size).
Props mukesh27.
Fixes #47486.
Built from https://develop.svn.wordpress.org/trunk@45494


git-svn-id: http://core.svn.wordpress.org/trunk@45305 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-06-05 15:23:52 +00:00
Sergey Biryukov
19503190ba Docs: Correct @type annotation for WP_Customize_Manager::$_changeset_data.
Props diddledan.
Fixes #46852.
Built from https://develop.svn.wordpress.org/trunk@45426


git-svn-id: http://core.svn.wordpress.org/trunk@45237 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-05-26 02:07:53 +00:00
Sergey Biryukov
e4ce9663a3 I18N: Merge two similar "you may need to press the Esc key twice" strings.
Props ramiy, tmatsuur, hareesh-pillai.
Fixes #47036.
Built from https://develop.svn.wordpress.org/trunk@45396


git-svn-id: http://core.svn.wordpress.org/trunk@45207 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-05-24 01:18:53 +00:00
Sergey Biryukov
d2ccaacedf Docs: Correct spelling in various comments and DocBlocks, per the conventions in Core Contributor Handbook.
Props man4toman, samanehmirrajabi.
Fixes #45857.
Built from https://develop.svn.wordpress.org/trunk@45232


git-svn-id: http://core.svn.wordpress.org/trunk@45041 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-17 13:26:51 +00:00
Sergey Biryukov
b6471e9be4 Bootstrap/Load: Remove duplicate leading slashes on inclusion of various files under ABSPATH.
Props dmsnell, birgire, szepe.viktor.
Fixes #46327.
Built from https://develop.svn.wordpress.org/trunk@45190


git-svn-id: http://core.svn.wordpress.org/trunk@44999 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-13 04:46:52 +00:00
Sergey Biryukov
30491f2410 Customize: Add a link to theme reviews in the theme details modal in the Customizer and on Add Themes screen.
Props celloexpressions, Travel_girl, Ixium, marco-peralta, dd32.
Fixes #36612.
Built from https://develop.svn.wordpress.org/trunk@44975


git-svn-id: http://core.svn.wordpress.org/trunk@44806 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-21 22:02:51 +00:00
Aaron Jorbin
71cf332e65 Replace usages of basename() with wp_basename() in order to support multibyte filenames
This is focused on the pieces of code that touch media files and the tests that support them. `basename` isn't multibyte compatible out of the box. See http://php.net/basename and https://bugs.php.net/bug.php?id=62119.

See #43170.
Props Viper007Bond.

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


git-svn-id: http://core.svn.wordpress.org/trunk@44617 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-01 20:58:52 +00:00
Peter Wilson
d9a1f99d9c Customize: Remove wp_targeted_link_rel pre-save filter from change-sets.
The pre-save filters added to links in [43732] could invalidate JSON data when saving Customizer change-sets.

This removes the filters when saving and publishing change-sets.

Props peterwilsoncc, nikeo for testing.
See #45292.


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


git-svn-id: http://core.svn.wordpress.org/trunk@44545 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-29 21:29:50 +00:00
Gary Pendergast
d8f4a04232 Customizer: Improve browser compatibility of the preview iframe.
When `home` and `siteurl` are different, the customizer preview iframe will be blank in Chrome and Safari, due to their `X-Frame-Options` implementation quirks.

Changing this to `SAMEORIGIN` and adding the `frame-ancestors` Content Security Policy gives the correct behaviour.

Props fullyint.
Fixes #40020.


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


git-svn-id: http://core.svn.wordpress.org/trunk@44411 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-14 06:38:51 +00:00
desrosj
be0b403077 Docs: Future-proof comments referencing 5.0 TODOs.
Some Customizer-related files contain inline comments referencing work to do for #42364 for 5.0. Those comments are now outdated as #42364 was moved to the 5.1 milestone.

Merges [43887] to trunk.

Props dlh, pento.
Fixes #45115.
Built from https://develop.svn.wordpress.org/trunk@44228


git-svn-id: http://core.svn.wordpress.org/trunk@44058 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-17 03:07:55 +00:00
Felix Arntz
1422d8ffd9 Customize: Safeguard a check on the customize_validate_{$setting_id} filter value to ensure it is a WP_Error.
While the filter is documented to only support a `WP_Error`, it has been a common practice to return true in a validation function if no errors have occurred. This was already caught when the same filter was executed in `WP_Customize_Setting`, it was however missing in `WP_Customize_Manager::validate_setting_values()`.

Fixes #44809.

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


git-svn-id: http://core.svn.wordpress.org/trunk@43407 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-08-19 16:38:24 +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
9c084c6968 Posts, Post Types: Introduce edit_post_{$post->post_type} hook.
The hook fires before the general `edit_post` hook and has the same parameters.

It also complements the `save_post_{$post->post_type}` hook added in [25050].

Props Mte90, garrett-eclipse.
Fixes #34706.
Built from https://develop.svn.wordpress.org/trunk@43535


git-svn-id: http://core.svn.wordpress.org/trunk@43364 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-07-25 20:57:25 +00:00
Sergey Biryukov
cd4c960a6c Administration: Change all the occurrences of "(opens in a new window)" to "(opens in a new tab)".
Props chetan200891, ianbelanger, afercia.
Fixes #43803.
Built from https://develop.svn.wordpress.org/trunk@43174


git-svn-id: http://core.svn.wordpress.org/trunk@43003 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-05-05 09:45:22 +00:00
John Blackbourn
b13e73d05c Docs: Document more parameters and properties using typed array notation.
See #41756

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


git-svn-id: http://core.svn.wordpress.org/trunk@42705 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-25 18:10:32 +00:00
Sergey Biryukov
fdc4f68678 Docs: Remove copy/pasted default value description for $type in WP_Customize_Manager::add_setting().
Props DannyCooper.
Fixes #43497.
Built from https://develop.svn.wordpress.org/trunk@42797


git-svn-id: http://core.svn.wordpress.org/trunk@42627 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-08 13:06:33 +00:00
Sergey Biryukov
0e802a627d General: Introduce WP_Error::has_errors() method and use it where appropriate.
Props robdxw, DrewAPicture, SergeyBiryukov.
Fixes #42742.
Built from https://develop.svn.wordpress.org/trunk@42761


git-svn-id: http://core.svn.wordpress.org/trunk@42591 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-27 02:31:31 +00:00
Peter Wilson
e6ccdf161f General: Further improve error messages following [42648].
Props kristastevens, melchoyce.
Fixes #38332 for trunk.


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


git-svn-id: http://core.svn.wordpress.org/trunk@42547 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-19 02:13:32 +00:00
John Blackbourn
91464bce65 Docs: Add missing code formatting to various @since entries.
See #42505

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


git-svn-id: http://core.svn.wordpress.org/trunk@42506 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-09 16:55:31 +00:00
Peter Wilson
0d39b35c11 General: Replace Cheatin’ uh? with friendlier error messages.
While intended as a playful error message, `Cheatin’ uh?` can be interpreted as insulting or accusatory in an already stressful situation. This replaces Cheatin’ with more meaningful error messages, depending on the error that occurs.

Props ElectricFeet, EricMeyer, karmatosed, dd32, BandonRandon, melchoyce for language; dmsnell for original patch; peterwilsoncc.
Fixes #38332.


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


git-svn-id: http://core.svn.wordpress.org/trunk@42477 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-05 02:30:34 +00:00
Dion Hulse
1e5629d1f1 Themes: Use api.wordpress.org/themes/info/1.2/ to query theme information.
See #43192.

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


git-svn-id: http://core.svn.wordpress.org/trunk@42461 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-01 05:19:30 +00:00
Weston Ruter
c6013a2b87 Customize: Ensure customize_autosaved requests only use revision of logged-in user.
Props dlh, westonruter.
See #42433, #39896.
Fixes #42450.

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


git-svn-id: http://core.svn.wordpress.org/trunk@42444 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-01-30 00:21:30 +00:00
Weston Ruter
b32df8f64e Customize: Ensure heartbeat keeps changeset locked when in branching mode.
Props dlh.
See #42024.
Fixes #42658.

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


git-svn-id: http://core.svn.wordpress.org/trunk@42441 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-01-29 23:05:31 +00:00
Weston Ruter
183cda343a Customize: Prevent frontend previewing from causing a customization lock on the changeset.
Props dlh.
Amends [41839].
See #42024.
Fixes #42975.

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


git-svn-id: http://core.svn.wordpress.org/trunk@42370 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-01-22 06:49:31 +00:00
Weston Ruter
87cae6e261 Customize: Use changeset-specific "locked" messages when branching is enabled.
Props dlh.
See #39896.
Fixes #42655.

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


git-svn-id: http://core.svn.wordpress.org/trunk@42367 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-01-22 06:28:31 +00:00
Weston Ruter
cd9f48b54f Customize: Prevent showing SFTP theme installation notification in multisite when user cannot install themes.
Props flixos90.
See #37661, #42184.
Fixes #42674.

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


git-svn-id: http://core.svn.wordpress.org/trunk@42365 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-01-22 06:15: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
Weston Ruter
e484b66335 Customize: Allow notifications for linting errors in code editor control (for Additional CSS) to be overridden to allow saving.
Implements the same override that was implemented in [41721] for the theme/plugin editors.

See #41897, #41887.
Fixes #42528.

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


git-svn-id: http://core.svn.wordpress.org/trunk@42001 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-13 22:46:34 +00:00
Weston Ruter
e4fe01e2b4 Customize: Fix logic inversion in [42113] which prevented themes from being installed in Customizer.
Also fix PHP notice related to parent themes and WordPress.org theme query results.

Props dd32, obenland, celloexpressions, westonruter, atachibana for testing.
See #42406, #37661.
Fixes #42442.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41953 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-07 04:17:47 +00:00
Weston Ruter
8902ddba18 Customize: Always use underlying changeset post date as initial date in scheduled date fields if date is future.
Prevent user from having to re-enter the previously-supplied future date if they had switched from schedule to draft but wanted to switch back again. Improves parity with behavior of post edit screen.

Props dlh, westonruter, obenland.
See #39896, #28721.
Fixes #42413.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41938 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-02 20:00:48 +00:00
Weston Ruter
5f16c57782 Customize: Prevent re-importing starter content when changeset is saved as draft or scheduled.
Themes cannot currently be switched in Customizer after changeset is saved anyway.

Props dlh, westonruter.
See #40146, #42411, #42126.
Fixes #42395.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41936 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-02 19:00:54 +00:00
Konstantin Obenland
b61de38e87 Customize: Spiff up theme updates
Fixes UI bugs around theme updates in the Customizer. Theme versions now get updated and users are no longer left alone after a successful update.

Props rinkuyadav999, celloexpressions for initial patch.
Fixes #42365.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41880 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-31 01:33:47 +00:00
Weston Ruter
9a18c87e0c Customize: Fix phpdoc for params in WP_Customize_Manager::add_section().
Amends [40804].
See #39671.
Fixes #42372.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41873 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-29 03:22:49 +00:00
Weston Ruter
685e3c1a67 Customize: Deprecate nav menu classes that are no longer used, instead of removing them immediately.
* Deprecate PHP classes `WP_Customize_New_Menu_Section` and `WP_Customize_New_Menu_Control`.
* Deprecate JS class `wp.customize.Menus.NewMenuControl`.
* Also introduce `wp.customize.Menus.createNavMenu()` for logic to create nav menus separately from the logic for handling UI interactions.

Amends [41768].
See #40104, #42364.
Fixes #42357.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41868 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-28 05:48:47 +00:00
Weston Ruter
a6af74ec32 Customize: Register the Publish Settings section in JS to ensure it does not get unregistered via PHP.
The `publish_settings` section is a fundamental dependency for Customizer, so it must be guaranteed to be registered.

Also unconditionally register core types for panels, sections, and controls in case plugin unhooks all `customize_register` actions.

See #39896.
Fixes #42337.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41859 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-25 21:45:49 +00:00
Sergey Biryukov
29d5ee851c I18N: Use a consistent pattern for translator comments for placeholders in some more Customizer strings.
See #41974.
Built from https://develop.svn.wordpress.org/trunk@42006


git-svn-id: http://core.svn.wordpress.org/trunk@41840 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-24 22:47:46 +00:00
Weston Ruter
6737643773 Customize: Prevent theme installation and deletion in Customizer while SFTP credentials need to be requested.
This is a temporary measure while we wait for credentials to be able to be supplied in the Customizer.

Amends [41788].
See #42184, #37661, #42126.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41831 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-24 19:06:47 +00:00
John Blackbourn
2623caf8b0 Docs: Correct a class name in the docs for WP_Customize_Manager::post_value().
See #41017

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


git-svn-id: http://core.svn.wordpress.org/trunk@41823 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-24 11:57:49 +00:00
Mel Choyce
4d41bf7127 Customization Locking: Update error message to use existing strings.
Props ramiy.
See #42024.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41787 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-20 10:32:53 +00:00
Weston Ruter
a402312a8d Customize: Prevent using default template for a base control when it has content rendered on the server.
Also prevent invalid `type` attribute from being added to a `select` element.

See #30738.
Fixes #42286.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41786 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-20 03:30:46 +00:00
Weston Ruter
20aad6b5c5 Customize: Consistently use input_attrs as control param key in JS instead of inputAttrs.
See #30738, #41897.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41770 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-19 03:25:47 +00:00
Sergey Biryukov
82dd23d36f I18N: Make context for "Schedule" string added in [41898] more accurate.
Props ocean90.
Fixes #42165.
Built from https://develop.svn.wordpress.org/trunk@41905


git-svn-id: http://core.svn.wordpress.org/trunk@41739 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-18 15:39:52 +00:00
Sergey Biryukov
97bab0459a I18N: Add a context for "Schedule" string.
Props Mirucon.
Fixes #42165.
Built from https://develop.svn.wordpress.org/trunk@41898


git-svn-id: http://core.svn.wordpress.org/trunk@41732 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-18 14:45:51 +00:00
Weston Ruter
434e3aba82 Customize: Add changeset locking in Customizer to prevent users from overriding each other's changes.
* Customization locking is checked when changesets are saved and when heartbeat ticks.
* Lock is lifted immediately upon a user closing the Customizer.
* Heartbeat is introduced into Customizer.
* Changes made to user after it was locked by another user are stored as an autosave revision for restoration.
* Lock notification displays link to preview the other user's changes on the frontend.
* A user loading a locked Customizer changeset will be presented with an option to take over.
* Autosave revisions attached to a published changeset are converted into auto-drafts so that they will be presented to users for restoration.
* Focus constraining is improved in overlay notifications.
* Escape key is stopped from propagating in overlay notifications, and it dismisses dismissible overlay notifications.
* Introduces `changesetLocked` state which is used to disable the Save button and suppress the AYS dialog when leaving the Customizer.
* Fixes bug where users could be presented with each other's autosave revisions.

Props sayedwp, westonruter, melchoyce.
See #31436, #31897, #39896.
Fixes #42024.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41673 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-12 04:01:46 +00:00
Weston Ruter
b2c816ff74 Customize: Correct docs for WP_Customize_Manager::changeset_uuid() after changes in [41626].
Props dlh.
Fixes #42174.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41659 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-11 05:45:46 +00:00
Weston Ruter
3f2b453a4d Customize: Introduce WP_Customize_Manager::trash_changeset_post() to reduce duplication and ensure proper changeset trashing logic.
Trashing a changeset via `wp_trash_post()` does not have the desired result since it mutates `post_content` (via Kses) and the `post_name` (even though it is a UUID).

Props dlh.
See #39896, #42030.
Fixes #42175.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41658 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-11 05:42:49 +00:00
Weston Ruter
5123283cf7 Customize: Improve and clarify help text for Themes panel.
Props michelleweber, melchoyce, celloexpressions.
See #37661.
Fixes #42047.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41649 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-10 20:53:49 +00:00
Weston Ruter
7b0dbf49fc Customize: Improve behavior and extensibility of theme loading and searching.
* Introduce `WP_Customize_Themes_Section::$filter_type`, which has built-in functionality for `local` and `remote` filtering. When this set to `local`, all themes are assumed to be loaded from Ajax when the section is first loaded, and subsequent searching/filtering is applied to the loaded collection of themes within the section. This is how the core "Installed" section behaves - third-party sources with limited numbers of themes may consider leveraging this implementation. When this is set to `remote`, searching and filtering always triggers a new remote query via Ajax. The core "WordPress.org" section uses this approach, as it has over 5000 themes to search.
* Refactor `filterSearch()` to accept a raw term string as input. This enables a feature filter to be used on a section where `filter_type` is `local`.
* Refactor `filter()` on a theme control to check for an array of terms. Also sort the results by the number of matches. Rather than searching for an exact match, this will now search for each word in a search distinctly, allowing things like tags to rank in search results more accurately.
* Split `loadControls()` into two functions for themes section JS: `loadThemes()` to initiate and manage an Ajax request and `loadControls()` to create theme controls based on the results of the Ajax call. If third-party sections need to change the way controls are loaded, such as by using a custom control subclass of `WP_Customize_Theme_Control`, this allows them to use the core logic for managing the Ajax call and only override the actual control-creation process.
* Introduce `customize_load_themes` filter to facilitate loading themes from third-party sources (or modifying the results of the core sections).
* Bring significant improvements to the installed themes search filter.

Props celloexpressions.
Amends [41648].
See #37661.
Fixes #42049.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41641 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-10 07:09:52 +00:00
Weston Ruter
f462387431 Customize: Improve keyboard accessibility for publish settings section.
Props sayedwp.
See #39896.
Fixes #42027.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41636 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-09 23:01:46 +00:00
Weston Ruter
35b5c9e762 Customize: Eliminate use of customize-loader in core so Customizer is opened consistently in top window.
* Open the door for future browser history feature in #28536, which is currently not feasible when customize-loader is used.
* Remove customizer-loader from being used on admin screens for Dashboard, Themes, non-shiny theme install/update.
* Keep the customize-loader functionality available for plugins, for the time being. It may become deprecated.
* Ensure `return` param in customizer links in Themes screen update to reflect `search` updated by `pushState`.
* Persist `return` when reloading Customizer due to theme switch, autosave restoration, or changeset trashing.
* Use `location.replace()` instead of changing `location.href` when trashing.
* Hide theme browser while Themes screen is loading when there is a `search` to prevent flash of unfiltered themes.
* Use throttling instead of debouncing when searching themes to ensure that screen is updated immediately on page load.
* Fix encoding and decoding of `search` param between URL and search field.
* Add support for dismissing autosaves when closing customize-loader, when it is used by plugins.
* Skip sending changeset UUID to customize-loader for population in browser location if changeset branching is not enabled.

See #28536.
Fixes #40254.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41631 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-09 16:04:48 +00:00
John Blackbourn
8ec310d44c Customize: Don't use an abbreviation in screen reader help text.
Props pixolin
Fixes 42153

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


git-svn-id: http://core.svn.wordpress.org/trunk@41627 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-09 13:49:52 +00:00
Pascal Birchler
d323ea9e18 Customize: Add missing word in error message about already published changesets.
Introduced in [41626].

Fixes #42144.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41624 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-08 09:25:55 +00:00
Weston Ruter
a01ae9a8c3 Customize: Fix confusion related to visibility of Themes panel with drafted/scheduled changesets.
* Prevent autoloading an existing draft/future changeset when theme not active.
* Add missing notifications container to Themes panel.
* Remove deactivation of themes panel when selected status is not publish.
* Show notification in Themes panel when themes cannot be previewed and disable preview buttons.
* Reject installTheme call when theme preview not available.
* Return promise from installTheme and eliminate use of global events in favor of promises.

Props westonruter, melchoyce, zoonini.
See #37661, #39896.
Fixes #42126.


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


git-svn-id: http://core.svn.wordpress.org/trunk@41622 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-07 06:00:54 +00:00
Weston Ruter
9d6134a88c Customize: Add default control template for standard input types.
Re-use default template instead of introducing custom one for the Discard Changes button.

See #30738.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41605 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-05 02:56:47 +00:00
Weston Ruter
275f4713a5 Customize: Improve the menu creation flow.
Often, folks run into two issues when they create new menus: they click "Add a Menu" thinking it will add a new page to their menu, or they forget to assign their new menu to a location, and then wonder why it doesn't show up on their site.

This commit rearranges the order of items in the menu panel, and updates the flow for creating a menu by breaking it up into steps. Additionally, more help text has been added to guide people through the process of creating a menu.

Also adds default `type` lookups for Panel and Section instances. See #30741.

Props bpayton, obenland, westonruter, celloexpessions, afercia, melchoyce, zoonini, michelleweber.
Fixes #40104.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41602 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-05 02:22:49 +00:00
Weston Ruter
f5bc1d1f52 Customize: Allow controls to be created with pre-instantiated Setting object(s), or even with plain Value object(s).
* Allow passing settings in keyed object (e.g. `settings: { default: 'id' }  ), or as an array (e.g. `settings: [ 'id' ]`) with first being default; again, `Setting`/`Value` objects may be supplied instead of IDs.
* Allow a single setting to be supplied with just a single `setting` param, either a string or a `Setting`/`Value` object.
* Update `changeset_status` and `scheduled_changeset_date` to be added dynamically with JS and simply passing of `api.state()` instances as `setting`.
* Introduce a `data-customize-setting-key-link` attribute which, unlike `data-customize-setting-link`, allows passing the setting key (e.g. `default`) as opposed to the setting ID.
* Allow `WP_Customize_Control::get_link()` to return `data-customize-setting-key-link` when setting is not registered.
* Eliminate `default_value` from `WP_Customize_Date_Time_Control` since now comes from supplied `Value`.
* Export status choices as `wp.customize.settings.changeset.statusChoices`.
* Export date and time formats as `wp.customize.settings.dateFormat` and `wp.customize.settings.timeFormat` respectively.

Props westonruter, sayedwp.
See #39896, #30738, #30741, #42083.
Fixes #37964, #36167.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41584 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-04 20:02:49 +00:00
Sergey Biryukov
08b5714221 Customize: Improve the wording for Site Icon control intro.
Props michelleweber, dlh, menakas, melchoyce.
Fixes #40430.
Built from https://develop.svn.wordpress.org/trunk@41749


git-svn-id: http://core.svn.wordpress.org/trunk@41583 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-04 19:59:48 +00:00
Weston Ruter
f8c6040ff5 Customize: Improve usability of Customize JS API.
* Eliminate need to pass both ID and instance in calls to `Values#add()` for panels, sections, controls, settings, partials, and notifications.
* Eliminate need to supply `content` param when constructing a `Control`.
* Unwrap the `options.params` object passed in constructors to just pass a flat `options`. (Back-compat is maintained.)
* Add support for `templateId` param for `Control` to override which template is used for the content.
* Remove unused `previewer` being supplied in `Control` instances.
* Rename `classes` to `containerClasses` on `Notification`.
* Automatically supply `instanceNumber` to improve stable sorting.
* Use `api.Notifications` for notifications in settings instead of `api.Value`.

See #30741.
Fixes #42083.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41560 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-04 06:48:46 +00:00
Weston Ruter
0909a73eed Customize: Let establish_loaded_changeset query changesets from any author not just current user when determining which changeset to autoload in non-branching mode.
See #39896.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41554 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-04 00:01:46 +00:00
Weston Ruter
8d79246606 Customize: Add button in Publish Settings to discard unsaved changes (including drafted and scheduled), reverting Customizer to the last published state.
Props westonruter, melchoyce.
Amends [41667].
See #39896, #21666.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41528 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-03 00:22:49 +00:00
Weston Ruter
a83e4eb40e Customize: Fix WP_Customize_Date_Time_Control to be re-usable for plugins and custom settings.
* Allow time fields to be omitted by constructing with `timeIncluded` as `false`.
* Ensure `reportValidity` is only called on a control when it is in an expanded section.
* Rename "ampm" to "meridian".
* Improve accessibility and fix HTML validation and style issues for both the date/time control and the preview link control.
* Fix styling of dropdowns and clean CSS.
* Improve accessibility of nav menus component.

Props westonruter, afercia, sayedwp, melchoyce.
Amends [41626].
See #39896.
Fixes #42022.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41504 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-02 04:12:47 +00:00
Weston Ruter
728e44ab5a Customize: Add infrastructure for trashing/reverting of unpublished changes; introduce full-screen OverlayNotification for trashing and theme install/preview.
* Introduce a new `wp.customize.previewer.trash()` JS API to trash the current changeset, along with logic to `WP_Customize_Manager` to handle deleting changeset drafts.
* Add `trashing` to `wp.customize.state` which is then used to update the UI.
* UI for trashing is pending design feedback. One possibility is to add a new trash button to Publish Settings section that invokes `wp.customize.previewer.trash()`.
* Improve logic for managing the visibility and disabled states for publish buttons.
* Prevent attempting `requestChangesetUpdate` while processing and bump processing while doing `save`.
* Update `changeset_date` state only if sent in save response.
* Merge `ThemesSection#loadThemePreview()` into `ThemesPanel#loadThemePreview()`.
* Remove unused `autosaved` state.
* Start autosaving and prompting at beforeunload after a change first happens. This is key for theme previews since even if a user did not make any changes, there were still dirty settings which would get stored in an auto-draft unexpectedly.
* Allow `Notification` to accept additional `classes` to be added to `container`.
* Introduce `OverlayNotification` and use for theme installing, previewing, and trashing. Such overlay notifications take over the entire window.

Props westonruter, celloexpressions.
See #37661, #39896, #21666, #35210.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41501 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-02 03:37:46 +00:00
Weston Ruter
76f590b99b Customize: Introduce a new experience for discovering, installing, and previewing themes within the customizer.
Unify the theme-browsing and theme-customization experiences by introducing a comprehensive theme browser and installer directly accessible in the customizer. Replaces the customizer theme switcher with a full-screen panel for discovering/browsing and installing themes available on WordPress.org. Themes can now be installed and previewed directly in the customizer without entering the wp-admin context. Also includes an extensible framework for browsing and installing themes from other sources.

Also includes CSS auto-prefixing added via `grunt precommit:css`.

For details, see: https://make.wordpress.org/core/2016/10/03/feature-proposal-a-new-experience-for-discovering-installing-and-previewing-themes-in-the-customizer/

Previously [38813] but reverted in [39140].
Fixes #37661, #34843, #38666.
Props celloexpressions, folletto, westonruter, karmatosed, melchoyce, afercia.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41482 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-29 20:13:50 +00:00
Sergey Biryukov
10c46f5751 I18N: Use a consistent pattern for translator comments for placeholders in Customizer and widget strings.
Props danieltj, Rahmohn.
Fixes #41974.
Built from https://develop.svn.wordpress.org/trunk@41640


git-svn-id: http://core.svn.wordpress.org/trunk@41474 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-29 11:42:48 +00:00
Sergey Biryukov
033b371145 I18N: Improve i18n in help text for Custom HTML widget and Additional CSS section.
Fixes #42032.
Built from https://develop.svn.wordpress.org/trunk@41639


git-svn-id: http://core.svn.wordpress.org/trunk@41473 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-29 11:10:50 +00:00
Weston Ruter
8043c2d8e5 Customize: Introduce drafting and scheduling for Customizer changesets.
* Incorporates code from the Customize Snapshots and Customize Posts feature plugins.
* Adds a new Publish Settings section for managing the changeset status, scheduled date, and frontend preview link.
* Updates Publish button to reflect the status selected in the Publish Settings (including Save Draft and Schedule).
* Deactivates the Themes section when a non-publish status selected, and deactivates the Publish Settings section when previewing a theme switch.
* Introduces an `outer` section type (`wp.customize.OuterSection` in JS) for the Publish Settings section to use and for available widgets and available nav menu panels to use in the future. These sections can be expanded while other sections are expanded.
* Introduces `WP_Customize_Date_Time_Control` in PHP and `wp.customize.DateTimeControl` in JS for managing a date/time value.
* Keeps track of scheduled time and proactively publish from the client when the time arrives, as opposed to waiting for WP Cron.
* Auto-publishes a scheduled changeset when attempting to access one that missed its schedule.
* Starts a new changeset if attempting to save a changeset that was previously publish.
* Adds `force` arg to `requestChangesetUpdate()` to force an update request even when there are no pending changes.
* Adds utils methods for `getCurrentTimestamp` and `getRemainingTime`.
* Adds new state values for `selectedChangesetStatus`, `changesetDate`, `selectedChangesetDate`.
* Fixes logic for when to short-circuit check to close Customizer when there are unsaved changes.
* Adds getter methods for `autosaved` and `branching` parameters, with the latter applying the `customize_changeset_branching` filter.
* Call to `establish_loaded_changeset` on the fly when `changeset_uuid()` is called if no changeset UUID was specififed.
* De-duplicates logic for dismissing auto-draft changesets.
* Includes unit tests.

Builds on [41597].
Props sayedwp, westonruter, melchoyce, JoshuaWold, folletto, stubgo, karmatosed, dlh, paaljoachim, afercia, johnregan3, utkarshpatel, valendesigns.
See #30937.
Fixes #39896, #28721, #39275.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41461 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-27 22:25:46 +00:00
Weston Ruter
cb8173e053 Customize: Dismiss all autosaved auto-drafts for user and not just the one suggested when dismissing restoration notification.
Amends [41597].
See #39896.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41438 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-26 20:33:46 +00:00