Commit Graph

95 Commits

Author SHA1 Message Date
Scott Taylor
a3ffebce30 Bootstrap: do not go gentle into that good night r38411, r38412, and parts of r38389.
See #36335.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38411 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-31 16:31:29 +00:00
Weston Ruter
abd9cdc07b Customize: Allow users to more seamlessly create page-based nav menus during customization.
Introduces the ability to create stubs for the various post types to add to a given menu. This eliminates the need to leave the customizer to first create the post in the admin and then return to managing menus. Only the title of the newly-created post can be supplied; the post content will be blank and will need to be provided in the normal edit post screen outside the customizer, unless a plugin enables a post editing in the customizer experience. When a post is created and added to a nav menu in the customizer, the newly created post that is added to a menu is given the `auto-draft` status, and if the changes are not published, the `auto-draft` post will be automatically deleted within 7 days via `wp_delete_auto_drafts()`. However, if the customizer changes are saved, then these nav menu item `auto-draft` post stubs will be transitioned to `publish`.

Includes portions of code from the Customize Posts <https://github.com/xwp/wp-customize-posts> and Front-end Editor <https://github.com/iseulde/wp-front-end-editor> plugins.

For more information, see https://make.wordpress.org/core/2016/06/16/feature-proposal-content-authorship-in-menus-with-live-preview/

Props celloexpressions, westonruter, valendesigns, afercia, melchoyce, mapk, iseulde, mrahmadawais.
Fixes #34923.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38377 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-29 22:59:28 +00:00
Scott Taylor
390ceba6c7 Bootstrap: after r38409 and r38410, revert r38402 which reverted r38399.
This fixes the paths in `wp-vendor/` that were including `src`. I want to drop this in so we can find out what else will break.

See #36335.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38352 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-27 22:32:37 +00:00
Dion Hulse
0e31a46161 Bootstrap: Revert [38399] as it's broken /build/ and subsequently core.svn.wordpress.org.
The generated classmaps reference `/src/` files and operates in the assumption that the base directory is one level above `wp-settings.php`, which it isn't after our build processes are run.

See #36335

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


git-svn-id: http://core.svn.wordpress.org/trunk@38343 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-27 14:37:32 +00:00
Scott Taylor
6a529648cf Bootstrap: Autoload classes using a Composer-generated PHP 5.2-compatible Autoloader.
* `wp-admin` and `wp-includes` are scanned for classes to autoload
* Several 3rd-party and Ryan McCue-shaped libraries are excluded when the classmap is generated, see `composer.json`: `autoload.exclude-from-classmap`
* `wp-vendor/autoload_52.php` is included at the top of `wp-settings.php` - no changes need to be made to unit tests to include the autoloader
* An avalanche of `require()` and `require_once()` calls that loaded class files have been removed from the codebase.

The following files have been added to `svn:ignore` - they are not 5.2-compatible and fail during pre-commit:
* src/wp-vendor/autoload.php
* src/wp-vendor/composer/autoload_real.php
* src/wp-vendor/composer/autoload_static.php
* src/wp-vendor/composer/ClassLoader.php

We favor these files instead:
* src/wp-vendor/autoload_52.php
* src/wp-vendor/composer/autoload_real_52.php
* src/wp-vendor/composer/ClassLoader52.php

When new PHP classes are added to the codebase, simply run `composer install` or `composer update` from the project root to update the autoloader.

The future is now.

See #36335.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38340 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-27 09:15:29 +00:00
John Blackbourn
ab052361a3 Docs: Correct and clarify various @since docs.
Fixes #37562

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


git-svn-id: http://core.svn.wordpress.org/trunk@38142 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-04 22:54:31 +00:00
Drew Jaynes
6cc13f0c54 Docs: Fix formatting, tense, verb conjugation, and other syntax for wp-includes/* elements introduced or changed in 4.6.
Part 1/2.

See #37318.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38062 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-20 16:57:32 +00:00
Weston Ruter
f1b7a9c77d Customize: Ensure that WP_Customize_Setting::value() can return a previewed value for aggregated multidimensionals.
Fixes #37294.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37923 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-06 05:59:28 +00:00
Drew Jaynes
e2c18aaf64 Docs: Standardize filter docs in the Customizer classes to use third-person singular verbs per the inline documentation standards for PHP.
See #36913.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37459 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 18:10:29 +00:00
Weston Ruter
87b0a1b989 Customize: Add setting validation model and control notifications to augment setting sanitization.
When a setting is invalid, not only will it be blocked from being saved but all other settings will be blocked as well. This ensures that Customizer saves aren't partial but are more transactional. User will be displayed the error in a notification so that they can fix and re-attempt saving.

PHP changes:

* Introduces `WP_Customize_Setting::validate()`, `WP_Customize_Setting::$validate_callback`, and the `customize_validate_{$setting_id}` filter.
* Introduces `WP_Customize_Manager::validate_setting_values()` to do validation (and sanitization) for the setting values supplied, returning a list of `WP_Error` instances for invalid settings.
* Attempting to save settings that are invalid will result in the save being blocked entirely, with the errors being sent in the `customize_save_response`. Modifies `WP_Customize_Manager::save()` to check all settings for validity issues prior to calling their `save` methods.
* Introduces `WP_Customize_Setting::json()` for parity with the other Customizer classes. This includes exporting of the `type`.
* Modifies `WP_Customize_Manager::post_value()` to apply `validate` after `sanitize`, and if validation fails, to return the `$default`.
* Introduces `customize_save_validation_before` action which fires right before the validation checks are made prior to saving.

JS changes:

* Introduces `wp.customize.Notification` in JS which to represent `WP_Error` instances returned from the server when setting validation fails.
* Introduces `wp.customize.Setting.prototype.notifications`.
* Introduces `wp.customize.Control.prototype.notifications`, which are synced with a control's settings' notifications.
* Introduces `wp.customize.Control.prototype.renderNotifications()` to re-render a control's notifications in its notification area. This is called automatically when the notifications collection changes.
* Introduces `wp.customize.settingConstructor`, allowing custom setting types to be used in the same way that custom controls, panels, and sections can be made.
* Injects a notification area into existing controls which is populated in response to the control's `notifications` collection changing. A custom control can customize the placement of the notification area by overriding the new `getNotificationsContainerElement` method.
* When a save fails due to setting invalidity, the invalidity errors will be added to the settings to then populate in the controls' notification areas, and the first such invalid control will be focused.

Props westonruter, celloexpressions, mrahmadawais.
See #35210.
See #30937.
Fixes #34893.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37444 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-20 21:10:27 +00:00
Weston Ruter
f98a2ed41d Customize: Pass WP_Customize_Setting instance as second argument to customize_value_{$id_base} filter.
Adds parity with setting instance being passed as second argument to `customize_sanitize_{$id}` and `customize_sanitize_js_{$id}`. Allows the actual ID of the (multidimensional) setting value being filtered to be inspected.

Props celloexpressions, westonruter.
Fixes #36452.

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


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

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

See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37308 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-02 04:00:28 +00:00
Dominik Schilling
9363b592e3 Customize: Harden assignment of Customizer settings transports for selective refreshable widgets
Theme support for `customize-selective-refresh-widgets` can be added _after_ the logic for registering the settings for incoming widgets that have been changed. This is due to themes adding the theme support in `after_setup_theme` which is also the action where `WP_Customize_Widgets::register_settings()` is called. If these both happen at priority 10, which one is called first depends on which one was added first. The other issue is that at the time that `WP_Customize_Widgets::register_settings()` is called at `after_setup_theme`, it is called before `widgets_init` and thus no widgets are yet registered. This means that any settings registered at this point will always have a `refresh` transport even if the theme supports `customize-selective-refresh-widgets`, since the `WP_Widget` instance is not visible yet to see if it supports selective refresh.

The fix: Defer `WP_Customize_Widgets::register_settings()` from `after_setup_theme` to `widgets_init` at priority 95 when the widget objects have all been registered. Also, ensure that the preview filter for `sidebars_widgets` is added before the sidebars are iterated for adding the controls.

Props westonruter.
Fixes #36389.
Built from https://develop.svn.wordpress.org/trunk@37166


git-svn-id: http://core.svn.wordpress.org/trunk@37133 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-04-07 20:59:29 +00:00
Weston Ruter
87a9bf2b37 Docs: Use markdown instead of HTML for code formatting.
Fixes phpdoc usage in [36622], [36608], [35724], [35307].

See #35898.
See #35869.
See #34738.
See #33552.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36612 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-23 19:18:27 +00:00
Weston Ruter
aa9ef96a52 Customize: Prevent dropping backslashes from input on general settings and settings for nav menus and some widgets.
Ensures that intentional backslashes (e.g. "\o/") can be used in:

* Site title
* Site description
* Nav menu name
* Custom Menu widget title
* Tag Cloud widget title
* Text widget body if can't `unfiltered_html`

The latter three are also fixed on the widgets admin page.

Fixes #35898.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36589 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-23 01:02:26 +00:00
Eric Lewis
22467e840f Networks and sites: Replace "blog" usage with "site" in docs.
Multisite functions use the term "blog" to refer to what we now call a "site," e.g. `get_current_blog_id()`. These functions are here to stay because of our commitment to backwards compatibility. What we can do is set the documentation straight.

See #35417.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36383 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-28 03:35:27 +00:00
Weston Ruter
5dae1386aa Customize: Ensure that a setting (especially a multidimensional one) can still be previewed when the post value to preview is set after preview() is invoked.
* Introduce `customize_post_value_set_{$setting_id}` and `customize_post_value_set` actions which are done when `WP_Customize_Manager::set_post_value()` is called.
* Clear the `preview_applied` flag for aggregated multidimensional settings when a post value is set. This ensures the new value is used instead of a previously-cached previewed value.
* Move `$is_preview` property from subclasses to `WP_Customize_Setting` parent class.
* Deferred preview: Ensure that when `preview()` short-circuits due to not being applicable that it will be called again later when the post value is set.
* Populate post value for updated-widget with the (unsanitized) JS-value in `WP_Customize_Widgets::call_widget_update()` so that value will be properly sanitized when accessed in `WP_Customize_Manager::post_value()`.

Includes unit tests with assertions to check the reported issues and validate the fixes.

Fixes defect introduced in [35007].
See #32103.
Fixes #34738.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35688 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-21 02:52:27 +00:00
Scott Taylor
21d74f5b1d Customize: move WP_Customize_Setting subclasses to wp-includes/customize, they load in the exact same place.
See #34432.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35347 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-24 18:11:24 +00:00
Weston Ruter
d7e13544ea Customizer: Prevent nav_menu_item settings from becoming dirty when their controls are set up.
Since `wp_setup_nav_menu_item()` returns the `classes` property as an array but the Customizer manages the value as a string, the setting needs to initially export the value as a string. This prevents the `classes` property type change from causing the setting to get marked as dirty even though nothing changed. This is a regression from [34788].

See #34111.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35274 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-20 22:45:29 +00:00
Weston Ruter
c77bb38b3d Customizer: Allow new option settings to not be saved as autoloaded by passing an autoload arg value of false.
The `autoload` argument value is passed along to `update_option()` which has accepted an `$autoload` parameter since [31628].

Props westonruter, dlh.
See #26394.
Fixes #33499.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35271 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-20 21:19:25 +00:00
Weston Ruter
6d9d18315d Customizer: Implement indicators for invalid nav menu items.
The same indicator on the nav menus admin page is now present for nav menu items in the Customizer. When a menu item is present for a post type that is no longer registered, the menu item will appear with the indicator.

Props kucrut, westonruter.
Fixes #33665.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35268 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-20 19:08:25 +00:00
Weston Ruter
1fe64b1c65 Customizer: Fix scalability performance problem for previewing multidimensional settings.
As the number of multidimensional settings (serialized options and theme mods) increase for a given ID base (e.g. a widget of a certain type), the number of calls to the `multidimensional` methods on `WP_Customize_Setting` increase exponentially, and the time for the preview to refresh grows in time exponentially as well.

To improve performance, this change reduces the number of filters needed to preview the settings off of a multidimensional root from N to 1. This improves performance from `O(n^2)` to `O(n)`, but the linear increase is so low that the performance is essentially `O(1)` in comparison. This is achieved by introducing the concept of an "aggregated multidimensional" setting, where the root value of the multidimensional serialized setting value gets cached in a static array variable shared across all settings.

Also improves performance by only adding preview filters if there is actually a need to do so: there is no need to add a filter if there is an initial value and if there is no posted value for a given setting (if it is not dirty).

Fixes #32103.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34972 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-10 09:06:25 +00:00
Weston Ruter
0b93819465 Customizer: Ensure WP_Customize_Setting::update() returns boolean value.
Adds unit tests for `WP_Customize_Setting::save()` (and `WP_Customize_Setting::update()`), along with the actions `customize_update_{$type}`, and `customize_save_{$id_base}` which they trigger.

Fixes #34140.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34803 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-05 21:58:24 +00:00
Scott Taylor
44dace3487 Add Customizer docs.
Props ericlewis.
See #33503.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33880 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-05 19:53:24 +00:00
Weston Ruter
bf9d1485ee Customizer: Ensure that all existing menus are shown in the Custom Menu widget's dropdown.
* Ensure that a Custom Menu widget selecting a newly-inserted menu gets updated to use the new menu ID upon Save & Publish.
* Dynamically update the visibility of the Custom Menu widget's "no menus" message when the number of menus changes between 0 and 1+.
* Send all dirty Customized settings in `update-widget` Ajax request and `preview()` them so that the widget update/form callbacks have access to any data dependencies in the current Customizer session (such as newly created unsaved menus).
* Update link in Custom Menu widget to point to Menus panel as opposed to Menus admin page, when in the Customizer.
* Fix an issue with extra space at top immediately after creating new menu.
* Fix doubled `update-widget` Ajax requests when changing select dropdown; prevent initial from being aborted.
* Add missing `wp_get_nav_menus()` hooks to preview Customizer updates/inserts for `nav_menu` settings; includes tests.
* Update `wp_get_nav_menu_object()` to allow a menu object to be passed in (and thus passed through).

Props westonruter, adamsilverstein.
Fixes #32814.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33455 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-29 16:03:24 +00:00
Aaron Jorbin
d8eaaf66df Use explicit variable variable syntax
PHP7 introduces a backwards compatable change to variable varibale syntax that requires us to use curly brackets to maintain the syntax between php5 and php7.  For more info, see https://wiki.php.net/rfc/uniform_variable_syntax#semantic_differences_in_existing_syntax for the semantic differences.  

Props ocean90
Fixes #31982


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


git-svn-id: http://core.svn.wordpress.org/trunk@33394 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-26 18:04:26 +00:00
Weston Ruter
d5ce83c94c Customizer: Introduce customize_nav_menu_available_item_types and customize_nav_menu_available_items filters.
Allows for new available menu item types/objects to be registered in addition to filtering the available items that are returned for each menu item type/object.

Props valendesigns, imath, westonruter.
See #32832.
Fixes #32708.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33338 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-22 20:29:25 +00:00
Weston Ruter
c5bd85552e Customizer: Improve performance of menus by caching results of wp_setup_nav_menu_item() calls.
Also fixes property list in phpdoc for `wp_setup_nav_menu_item()`.

Fixes #32769.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33228 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-14 07:09:24 +00:00
Drew Jaynes
c6cff377e7 Fix syntax and add missing @access tags to a variety of methods and properties in WP_Customize_Nav_Menu_Item_Setting added in 4.3.
See [32806]. See #32891.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33193 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-13 21:01:25 +00:00
Weston Ruter
912b434198 Customizer: Fix saving menus with empty names or names that are already used.
Adds validation for initially-supplied nav menu name, blocking empty names from being supplied. If later an empty name is supplied and the nav menu is saved, the name "(unnamed)" will be supplied instead and supplied back to the client. If a name is supplied for the menu which is currently used by another menu, then the name conflict is resolved by adding a numerical counter similar to how `post_name` conflicts are resolved. Includes unit tests.

Fixes #32760.


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


git-svn-id: http://core.svn.wordpress.org/trunk@33042 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-03 20:47:25 +00:00
Dominik Schilling
759bcdbad1 Customizer: Escape original title of menu items.
see #32576.
Built from https://develop.svn.wordpress.org/trunk@32893


git-svn-id: http://core.svn.wordpress.org/trunk@32864 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-20 19:55:25 +00:00
Scott Taylor
88743c7cd7 Add missing access modifiers in class-wp-customize-setting.php.
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32849 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-19 22:08:26 +00:00
Scott Taylor
5e994cd6a1 Customizer et al, use elseif in PHP, not else if.
This was corrected via brute force in [31090].

See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32845 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-19 22:01:25 +00:00
Dominik Schilling
62e3a0c15c Add menu management to the Customizer.
This brings in the Menu Customizer plugin: https://wordpress.org/plugins/menu-customizer/.

props celloexpressions, westonruter, valendesigns, voldemortensen, ocean90, adamsilverstein, kucrut, jorbin, designsimply, afercia, davidakennedy, obenland.
see #32576.
Built from https://develop.svn.wordpress.org/trunk@32806


git-svn-id: http://core.svn.wordpress.org/trunk@32777 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-16 22:08:26 +00:00
Aaron Jorbin
36e593a46c Restore [32732] as it wasn't the actual cause of test failures as those failures where fixed separately.
See #32732


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


git-svn-id: http://core.svn.wordpress.org/trunk@32738 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-14 18:56:26 +00:00
Aaron Jorbin
3d2f8542ac Revert [32732] since it is causing the tests to break
See #32732


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


git-svn-id: http://core.svn.wordpress.org/trunk@32737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-14 18:43:25 +00:00
Scott Taylor
740b92853d WP_Customize_Setting::is_current_blog_previewed() should only return false, not false or void. The one invocation of the method only loosely checks the return value.
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32703 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-12 17:29:26 +00:00
Scott Taylor
bd8fafea54 Use void instead of null where appropriate when pipe-delimiting @return types. If a @return only contains void, remove it.
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32538 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-24 05:40:25 +00:00
Scott Taylor
082bfab426 Clean up @global doc blocks/imports for class-wp-customizer-*.php and friends.
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32512 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-22 05:06:25 +00:00
Scott Taylor
b2bbbf9759 In class-wp-customize-*, clarify/add some @param/@return blocks. Disambiguate some functions that are trying to return the void response of another function they call internally.
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32505 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-21 22:05:24 +00:00
Drew Jaynes
d483e3a32a Add missing @access tags to two DocBlocks in WP_Customize_Setting.
See [31707]. See #31888.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32013 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-05 15:17:27 +00:00
Dominik Schilling
953cf28ac6 Customizer: Return the original value when filtering theme mods/options and the current blog has changed.
props westonruter.
fixes #31428.
Built from https://develop.svn.wordpress.org/trunk@31707


git-svn-id: http://core.svn.wordpress.org/trunk@31688 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-10 23:05:27 +00:00
Dominik Schilling
b96a624cb9 Customizer: Fix previewing and applying widgets when previewing another theme.
* Unset `wp_get_sidebars_widgets()`' non-admin cache var `$_wp_sidebars_widgets` in Customize theme preview.
* Add `WP_Customize_Setting::$dirty` so that settings can be initially-dirty when the Customizer loads.
* Mark `old_sidebars_widgets_data` setting initially-dirty.
* Mark all `sidebars_widgets` settings as initially-dirty during theme switch.

props westonruter.
see #31484.
Built from https://develop.svn.wordpress.org/trunk@31705


git-svn-id: http://core.svn.wordpress.org/trunk@31686 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-10 22:39:28 +00:00
Drew Jaynes
26f8fbd705 Add a missing file header and clean up class DocBlocks in wp-includes/class-wp-customize-setting.php.
* Adds a file header separate from the `WP_Customize_Setting` class block
* Fixes formatting for the `WP_Customize_Setting`, `WP_Customize_Filter_Setting`, `WP_Customize_Header_Image_Setting`, and `WP_Customize_Background_Image_Setting` class DocBlocks.

See #31446.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31524 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 08:18:26 +00:00
Dominik Schilling
3aea5f144b Customizer: Introduce an API to create WP_Customize_Settings for dynamically-created settings.
* Introduce WP_Customize_Manager::add_dynamic_settings() to register dynamically-created settings.
* Introduce `customize_dynamic_setting_args` filter to pass an array of args to a dynamic setting's constructor.
* Add unit tests for WP_Customize_Manager and WP_Customize_Widgets.
* See WP_Customize_Widgets as an example.

props westonruter.
fixes #30936.
Built from https://develop.svn.wordpress.org/trunk@31370


git-svn-id: http://core.svn.wordpress.org/trunk@31351 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-08 23:11:25 +00:00
Dominik Schilling
9d162f0945 Ensure that WP_Customize_Setting::value() returns default value for setting if not dirty.
There was regression introduced by #28580 where only changed (dirty) settings now are POST'ed to the Customizer preview.

* Allow WP_Customize_Manager::post_value() to accept a second $default argument.
* Introduce WP_Customize_Manager::unsanitized_post_values() for accessing previously-private member variable _post_values.
* Do require_once instead of require for Customizer classes.
* Add unit tests for WP_Customize_Manager and WP_Customize_Setting.

props westonruter.
fixes #30988.
Built from https://develop.svn.wordpress.org/trunk@31329


git-svn-id: http://core.svn.wordpress.org/trunk@31310 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-03 10:15:21 +00:00
Scott Taylor
0a511680f4 Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value. Constructors do not have meaningful return values, anything that is returned from here is discarded.
See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31107 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-10 06:54:23 +00:00
Scott Taylor
905f35f289 In Customizer classes:
* `public final function` methods should be `final public function` - confusing Hack and aligns with PSR2
* Some methods were missing access modifiers

See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31064 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-08 06:02:24 +00:00
Scott Taylor
a215b8801d Improve various @param docs for src/wp-includes/class-wp-customize*.php.
See #30224.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30666 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-30 23:33:23 +00:00
Drew Jaynes
bffe95d34c Docs Formatting: Backtick-escape inline code for all remaining dynamic hook docs in wp-includes/*.
Affects DocBlocks for the following hooks:
* `auth_post_meta_{$meta_key}`
* `term_links-$taxonomy`
* `customize_render_control_ . $this->id`
* `customize_render_panel_{$this->id}`
* `customize_render_section_{$this->id}`
* `customize_preview_{$this->id}`
* `customize_save_ . $this->id_data[ 'base' ]`
* `customize_update_ . $this->type`
* `customize_value_ . $this->id_data[ 'base' ]`
* `customize_sanitize_js_{$this->id}`
* `comment_form_field_{$name}`
* `comment_{$old_status}_to_{$new_status}`
* `comment_{$new_status}_{$comment->comment_type}`
* `extra_{$context}_headers`
* `get_template_part_{$slug}`
* `get_the_generator_{$type}`
* `get_{$adjacent}_post_join`
* `get_{$adjacent}_post_where`
* `get_{$adjacent}_post_sort`
* `{$adjacent}_post_rel_link`
* `{$adjacent}_post_link`
* `{$adjacent}_image_link`
* `blog_option_{$option}`
* `$permastructname . _rewrite_rules`
* `{$type}_template`
* `theme_mod_{$name}`
* `pre_set_theme_mod_$name`
* `current_theme_supports-{$feature}`
* `get_user_option_{$option}`
* `edit_user_{$field}`
* `pre_user_{$field}`
* `user_{$field}`

See #30552.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30646 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-30 12:10:23 +00:00