Commit Graph

268 Commits

Author SHA1 Message Date
Pascal Birchler f54558e75b General: Introduce a `wp_list_sort()` helper function.
In addition to `wp_list_filter()` for filtering a list of objects, and `wp_list_pluck()` for plucking a certain field out of each object in a list, this new function can be used for sorting a list of objects by specific fields. These functions are now all contained within the new `WP_List_Util()` class and `wp_list_sort()` is used in various parts of core for sorting lists.

Props flixos90, DrewAPicture, jorbin.
Fixes #37128.
Built from https://develop.svn.wordpress.org/trunk@38859


git-svn-id: http://core.svn.wordpress.org/trunk@38802 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-21 11:12:51 +00:00
Weston Ruter 1ccd9e7a6c Customize: Introduce custom CSS for extending theme styles.
* Custom CSS is associated with a given theme and is displayed in an inline `style` element at the `wp_head` hook after the `wp_print_styles` is called so that it overrides any enqueued stylesheets.
* A `wp_get_custom_css()` function is used for accessing the CSS associated with the current theme (or another theme) and a `wp_get_custom_css` filter for manipulating it.
* CSS is managed in customizer via a new "Additional CSS" section with a single `textarea` control. 
* `WP_Customize_Section::$description_hidden` is introduced for hiding extended descriptions in customizer sections behind a help toggle as done with panels.
* CSS is stored in a `custom_css` post type with the theme (stylesheet) slug as the `post_name`.
* `WP_Customize_Custom_CSS_Setting` is introduced to handle validation of CSS, previewing, and persisting the CSS to the `custom_css` post type.
* The `custom_css` setting is tied to a new `unfiltered_css` capability which maps to `unfiltered_html` by default.
* Escaping the message in the notification template is removed to allow markup (`code` tags) to be rendered.

See https://make.wordpress.org/core/2016/10/11/feature-proposal-better-theme-customizations-via-custom-css-with-live-previews/

Props johnregan3, celloexpressions, folletto, westonruter.
Fixes #35395.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38772 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-19 18:15:31 +00:00
Weston Ruter 1c3b96537f 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.

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/

Fixes #37661, #34843.
Props celloexpressions, folletto, westonruter, karmatosed, afercia.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38756 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-19 03:20:29 +00:00
Weston Ruter f1ba1918c9 Customize: Implement customized state persistence with changesets.
Includes infrastructure developed in the Customize Snapshots feature plugin.

See https://make.wordpress.org/core/2016/10/12/customize-changesets-technical-design-decisions/

Props westonruter, valendesigns, utkarshpatel, stubgo, lgedeon, ocean90, ryankienstra, mihai2u, dlh, aaroncampbell, jonathanbardo, jorbin.
See #28721.
See #31089.
Fixes #30937.
Fixes #31517.
Fixes #30028.
Fixes #23225.
Fixes #34142.
Fixes #36485.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38753 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-18 20:05:31 +00:00
Andrea Fercia eeefec932f Administration: Improve the usage of the button CSS classes.
Introduces some consistency in the usage of the button CSS classes, fixes the
focus style for accessibility and responsiveness of the buttons.

- Adds the `button` class to all primary buttons make them responsive
- Removes all `secondary-button` classes and replaces it with button when needed. `button-secondary` shouldn't be used and exists just for backward compatibility reasons
- Replaces classes inside `submit_button()` with a shorthand for some buttons, and use an empty string for the default `button` class. Passing `button` is unnecessary
- Adjusts `get_submit_button()` to remove empty items

Props iseulde, dimchik, chris_d2d, mhowell, afercia.
Fixes #27314, #37138, #37448.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38615 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-28 19:54:28 +00:00
Weston Ruter 037a236e42 Customize: Ensure nav menu items lacking a label use the title from the original object.
Use original title as placeholder for label and in control title. Prevent original title from overriding empty label in initial setting values.

Fixes #38015.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38561 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-17 21:50:30 +00:00
Weston Ruter bce5ea9494 Customize: Use new `$status_code` parameter for `wp_send_json_error()` instead of calling `status_header()` separately.
Props johnbillion.
See #35666.
Fixes #37897.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38419 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-31 19:01:28 +00:00
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
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
Dominik Schilling 7ff940d217 Customize: Make the menu edit button look like a link.
The button was introduced in [37901] to allow users switching to the selected menu for further edits. A link makes it more clear that the user is taken away from the current view.
This also adds an aria label and makes the button label more verbose, 'Edit Menu'.

Props afercia.
Props helen for review.
Fixes #36795.
Built from https://develop.svn.wordpress.org/trunk@38189


git-svn-id: http://core.svn.wordpress.org/trunk@38130 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-03 22:45:30 +00:00
Sergey Biryukov 65ff895eca I18N: Combine duplicate "Menu Locations" and "Menu Options" strings.
Props ramiy.
See #18218.
Built from https://develop.svn.wordpress.org/trunk@38080


git-svn-id: http://core.svn.wordpress.org/trunk@38021 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-17 16:47:39 +00:00
Weston Ruter 64a2d70a90 Customize: Ensure that `WP_Customize_Nav_Menu_Section` is able to represent a placeholder nav menu.
Placeholder nav menus (ones that have yet to be saved into the DB) have negative integer IDs.

Fixes #37293.
Props valendesigns, stubgo, westonruter.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-06 05:33:30 +00:00
Dominik Schilling 56e463a38e Customize: Fix site icon preview in RTL.
* Set the direction of previews to LTR.
* Remove the ID attribute from the favicon preview in the customizer panel. The preview in the media modal uses the same ID which prevented updating the correct favicon preview.

Fixes #37286.
Built from https://develop.svn.wordpress.org/trunk@37964


git-svn-id: http://core.svn.wordpress.org/trunk@37905 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-05 12:42:27 +00:00
Dominik Schilling 4e66d6a568 Customize: Add a RTL version of "browser.png" for the site icon preview.
Props sidati.
Fixes #37063.
Built from https://develop.svn.wordpress.org/trunk@37963


git-svn-id: http://core.svn.wordpress.org/trunk@37904 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-05 11:32:29 +00:00
Dominik Schilling eb3a1bef13 Customize: Improve flow from menu locations to editing a menu.
Adds an Edit button beside the menu location to allow users to switch to the selected menu for further edits.

Props celloexpressions.
Fixes #36795.
Built from https://develop.svn.wordpress.org/trunk@37901


git-svn-id: http://core.svn.wordpress.org/trunk@37842 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-28 23:07:30 +00:00
Dominik Schilling 2a76ccac4e Customize: Separate preview and actions in the site icon control.
Reverts [37456] to allow users to remove/change a site icon even if the attachment has corrupt/missing data about sizes.

Fixes #36749.
Built from https://develop.svn.wordpress.org/trunk@37724


git-svn-id: http://core.svn.wordpress.org/trunk@37690 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-16 09:45:27 +00:00
Weston Ruter 1c2324f834 Customize: Update server-sent setting validation notifications as changes are entered.
Send back setting validities with full refreshes and selective refreshes so that invalid settings can have notifications displayed immediately before attempting save, and so that these notifications can be cleared as soon as the input is corrected.

* Splits out JS logic for listing controls into separate methods  `wp.customize.Setting.prototype.findControls()` and `wp.customize.findControlsForSettings()`.
* Adds a `setting` property to the `data` on notifications added to controls that are synced from their settings.
* Adds `selective-refresh-setting-validities` message sent from preview to pane.
* Changes `WP_Customize_Manager::validate_setting_values()` to return when settings are valid as well as invalid.
* Adds `WP_Customize_Manager::prepare_setting_validity_for_js()`.
* Add setting validities to data exported to JS in Customizer Preview and in selective refresh responses.

Fixes #36944.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37666 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-14 19:17:28 +00:00
Drew Jaynes fb6d8bae49 Docs: Apply inline `@see` tags to hooks referenced in DocBlocks for core classes.
Applying these specially-crafted `@see` tags allows the Code Reference parser to recognize and link these elements as actions and filters.

See #36921.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37507 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-23 18:54:27 +00:00
Drew Jaynes 9cb5247392 Docs: Standardize filter docs in remaining wp-includes/* files to use third-person singular verbs per the inline documentation standards for PHP.
See #36913.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37486 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 18:50:28 +00:00
Pascal Birchler 0afb5d0041 Customize: Change attachment condition in the site icon control to prevent errors.
Props neverything.
Fixes #36749 for trunk.
Built from https://develop.svn.wordpress.org/trunk@37456


git-svn-id: http://core.svn.wordpress.org/trunk@37424 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-17 20:39:30 +00:00
Weston Ruter b036bf1012 Customize: Clean up media control CSS.
Removes unnecessary wrapper elements and refactors class names to eliminate duplication of rule selectors.

Props celloexpressions.
Fixes #30618.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37392 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-12 20:23:54 +00:00
Weston Ruter b074113016 Customize: Remove use of reserved word `default` in Underscore template which breaks IE8.
Fixes regression introduced in r30712.

Props adamsilverstein.
Fixes #36793.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37383 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-11 19:07:30 +00:00
Weston Ruter 574be8f2a8 Customize: Ensure that `wp_setup_nav_menu_item` filter applies consistently on `nav_menu_item` setting values.
The filter was being applied in `WP_Customize_Nav_Menu_Item_Setting::value()` but not in `WP_Customize_Nav_Menu_Item_Setting::value_as_wp_post_nav_menu_item()`.

Props celloexpressions, westonruter.
Fixes #35203.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37371 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-10 06:41:29 +00:00
Andrea Fercia 85cac9d47e Customizer, Site Icon preview: improve alt attributes and text accessibility.
Props shahpranaf, TacoVerdo, afercia.

Fixes #36562.
Built from https://develop.svn.wordpress.org/trunk@37229


git-svn-id: http://core.svn.wordpress.org/trunk@37195 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-04-17 12:01:27 +00:00
Weston Ruter a311bea6d1 Customize: Fix toggle of title attribute field visibility on nav menus admin page.
Improves alignment with nav menus in the Customizer, fixing regression introduced in [36908].

See #35273.
Props sidati, westonruter.
Fixes #36353.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37119 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-30 21:55:27 +00:00
Weston Ruter 1a9fda07a4 Customize: Put focus on change button instead of remove button in media control.
Allow controls to specify the primary element to receive focus by adding a `control-focus` class.

Props adamsilverstein, westonruter.
Fixes #36337.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37118 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-30 21:41:26 +00:00
Drew Jaynes c4eab31668 Docs: Use a third-person singular verb in the DocBlock summary for `WP_Customize_Site_Icon_Control::content_template()`, introduced in [36698].
Also adds a missing `@access` notation.

See #33755. See #35986.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36979 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-16 16:41:27 +00:00
Drew Jaynes 7add7e84f5 Docs: Add a missing version and access information to the DocBlock for the `WP_Customize_Selective_Refresh->$manager` property, introduced in [36586].
See #27355. See #35986.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36978 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-16 16:39:26 +00:00
Drew Jaynes 3bdf4f1524 Docs: Standardize the file header and class summarries for the file containing `WP_Customize_Selective_Refresh`, introduced in [36586].
See #27355. See #35986.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36977 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-16 16:29:26 +00:00
Drew Jaynes b23a2750aa Docs: Standardize the file header and class summaries for the file containing `WP_Customize_Partial`, introduced in [36586].
See #27355. See #35986.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36976 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-16 16:24:27 +00:00
Konstantin Obenland d21d537280 Customize: Use full URL to image to prevent breakage if moved.
See https://core.trac.wordpress.org/ticket/33755#comment:103
See #33755.


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


git-svn-id: http://core.svn.wordpress.org/trunk@36916 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-10 18:53:25 +00:00
Weston Ruter 7441acafaf Customize: Fix persistence of toggles for displayed nav menu item properties.
* Eliminates need to click more than one checkbox to have preferences saved.
* Adds debouncing to saving user-selected menu item properties.
* Also removes discrepancies between available nav menu item properties on admin page vs Customizer.

Fixes #35273.
Props afercia, westonruter.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36876 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-09 21:41:28 +00:00
Konstantin Obenland f39d1e4fcc Customize: Reduce vertical space of site icon control.
Makes the control easier to find, reduces visual clutter, and is more
consistent with Customizer UI conventions.

Props celloexpressions.
Fixes #35943.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36875 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-09 21:19:27 +00:00
Weston Ruter d27ae61355 Customize: Remove selective refresh error message from appearing inline within the preview.
The error message will still be available in the developer console.

Removes part of [36586].
See #27355.
Fixes #36164.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36857 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-09 04:37:28 +00:00
Weston Ruter a8ca958d43 Customize: Eliminate unnecessary `WP_Customize_Site_Logo_Control` in favor of re-using `WP_Customize_Image_Control`.
* Removes double `margin-bottom` from all the media controls.
* All media controls now send `{settingId}-attachment-data` messages to the preview when a media setting is updated so that the preview has access to the attachment data.
* Fixes receiving of `attachment-data` message for `custom_logo` which resulted in instant JS-applied preview not working. See #36096.

See #33755.
Fixes #35941.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36818 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-04 23:47:26 +00:00
Konstantin Obenland 1ef0d464d7 Customize: Rename custom logo classes after [36837].
Fixes #35945.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36805 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-03 19:59:27 +00:00
Konstantin Obenland 147d6d7d6c Customize: Site logos are custom logos.
Brings the nomenclature closer to custom headers and backgrounds.

See https://wordpress.slack.com/archives/core/p1456955151003150
See #35945. 

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


git-svn-id: http://core.svn.wordpress.org/trunk@36804 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-03 19:56:26 +00:00
Dominik Schilling 447b284107 Customizer: Merge two translator comments.
Built from https://develop.svn.wordpress.org/trunk@36809


git-svn-id: http://core.svn.wordpress.org/trunk@36776 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-02 23:10:26 +00:00
Weston Ruter b757de7da9 Customize: Define params on `WP_Customize_Partial::render_callback()` for the sake of subclasses overriding this method.
Fixes a strict standards notice regarding the method signature needing to be compatible.

See #27355.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36768 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-02 06:09:26 +00:00
Weston Ruter 0e5bb06cb8 Customize: Allow `button_labels` to be overridden in `$args` passed to `WP_Customize_Media_Control` and `WP_Customize_Image_Control`.
Props chetanchauhan, celloexpressions.
See #33755.
Fixes #35542.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36736 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-29 00:40:26 +00:00
Drew Jaynes e0cd5f9dba Docs: Add a missing summary, `@access` tag, and parameter documentation to the DocBlock for `WP_Customize_Filter_Setting::update()`.
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-27 21:17:25 +00:00
Dominik Schilling e5ea82d81a Spelling: Standardize on "front end"/"back end" (noun) and "front-end"/"back-end" (adjective).
Props obrienlabs, thewanderingbrit.
Fixes #34887.
Built from https://develop.svn.wordpress.org/trunk@36709


git-svn-id: http://core.svn.wordpress.org/trunk@36676 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-25 12:53:27 +00:00
Konstantin Obenland 237f6a0e58 Customize: Introduce Logo support for themes.
Allows a common theme feature to have a common implementation provided by core and available in a consistent location for users.
See https://make.wordpress.org/core/2016/02/24/theme-logo-support/

Props kwight, enejb, jeherve, bhubbard, samhotchkiss, zinigor, eliorivero, adamsilverstein, melchoyce, ryan, mikeschroder, westonruter, pento, karmatosed, celloexpressions, obenland. 
See #33755.


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


git-svn-id: http://core.svn.wordpress.org/trunk@36665 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-24 22:10:26 +00:00
Weston Ruter 2214f69e43 Customize: Allow controls to be registered without any associated settings.
* Improves parity between partials and controls. A partial or control can be settingless if instantiated with `settings` param as empty array (otherwise, if null, then the partial/control ID is used). 
* Eliminate need to create dummy settings that serve no purpose except to place a control in the UI.
* Removes dummy settings for `create_new_menu` and `new_menu_name`.
* Introduces `WP_Customize_Control::$capability` and `WP_Customize_Partial::$capability`, and if set checks them in the respective `check_capabilities()` methods.
* Prevents PHP fatal error from happening when non-existing settings are provided to control: "Call to a member function `check_capabilities()` on a non-object".
* Fixes issue where nav menu items and widgets were no longer working with selective refresh because cap check was failing.

See #27355.
Fixes #35926.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36656 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-24 18:28:28 +00:00
Weston Ruter aa2db425d8 Customize: Skip exporting partials to client and handling rendering requests if user can't modify associated settings.
Introduces `WP_Customize_Partial::check_capabilities()` for parity with `WP_Customize_Control::check_capabilities()`.
 
See #27355.
Fixes #35914.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36610 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-23 18:14:26 +00:00
Weston Ruter 53e0315242 Customize: Let `WP_Customize_Selective_Refresh` class be `final` to match manager and other component classes.
This class is not intended to be extended.
 
See #27355.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36591 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-23 01:28:25 +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
Weston Ruter b206327acb Customize: Fix previewing and updating of nav menu items containing slashed/slashable characters.
Prevents slashes from being added when a user without `unfiltered_html` previews a nav menu item containing an apostrophe or some other slashable character, and prevents the loss of an intentional slash (e.g. "\o/") when saving a nav menu item, regardless of capability.

Fixes #35869.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36575 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-22 00:14:25 +00:00
Weston Ruter 6b775d4afe Customize: Add selective refresh framework with implementation for widgets and re-implementation for nav menus.
See https://make.wordpress.org/core/2016/02/16/selective-refresh-in-the-customizer/.

Props westonruter, valendesigns, DrewAPicture, ocean90.
Fixes #27355.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36553 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-19 18:41:28 +00:00
Weston Ruter 3fdb8bafc4 Customize: Ensure that "Change" button appears when there are only 2 themes.
Fixes defect introduced in [35535].

Props igmoweb.
See #34549.
Fixes #35081.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35907 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-15 01:21:26 +00:00
Sergey Biryukov d0b7dd489e I18N: Remove `<strong>` tags from translatable strings in `WP_Customize_Manager::register_controls()` and `WP_Customize_Header_Image_Control::render_content()`.
Add translator comments.

See #35039.
Built from https://develop.svn.wordpress.org/trunk@35923


git-svn-id: http://core.svn.wordpress.org/trunk@35887 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-14 12:54: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
Sergey Biryukov 17af54fc7c Customizer: Use correct context and translator comments for menu location strings.
See #33431.
Built from https://develop.svn.wordpress.org/trunk@35722


git-svn-id: http://core.svn.wordpress.org/trunk@35686 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-20 17:46:25 +00:00
Dominik Schilling d1805c9da8 Customizer: Merge two similar strings.
Remove also `{{ data.menu_name }}` since it doesn't print anything.

Fixes #33630.
Built from https://develop.svn.wordpress.org/trunk@35695


git-svn-id: http://core.svn.wordpress.org/trunk@35659 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-18 22:25:25 +00:00
Scott Taylor a9fb6e9ae0 Customizer i18n: provide translator context for current menu name and location.
Props ryankienstra.
Fixes #33431.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35640 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-18 19:21:28 +00:00
Helen Hou-Sandí ae9e173082 Buttons: Standardize on `.button-link` for link-like buttons.
This serves as both a reset and some basic styling. The class name also aligns with parallel components in other popular projects.

props paulwilde for the initial patch.
fixes #34242.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35600 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-13 15:47:27 +00:00
Weston Ruter c470b872bd Customize: Improve alignment of `WP_Customize_Nav_Menu_Item_Setting::sanitize()` behavior with `wp_update_nav_menu_item()`.
* Apply `title_save_pre`, `excerpt_save_pre`, and `content_save_pre` filters on a nav menu item's `title`, `attr_title`, and `description` properties respectively. This ensures that arbitrary markup can be supplied if the user has `unfiltered_html` cap, and for these fields to have markup stripped if not.
* Ensure a nav menu item's `post_status` is sanitized as `publish` or `draft` using the same conditions as `wp_update_nav_menu_item()`.
* Align `WP_Customize_Nav_Menu_Item_Setting::sanitize()` behavior for sanitizing `position` to be the same as `wp_update_nav_menu_item()`.
* Also apply `nav_menu_attr_title` and `nav_menu_description` filters in `WP_Customize_Nav_Menu_Item_Setting::value_as_wp_post_nav_menu_item()` to ensure that previewing markup entered into menu item description will preview the same way as when the nav menu item is saved.
* Add unit tests.

Fixes #32812.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35544 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-09 00:48:26 +00:00
Scott Taylor e649fabb6a Accessibility: add missing `alt` attributes to a gaggle of `<img>`s.
Props afercia.
Fixes #34583.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35531 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-07 16:12:27 +00:00
Weston Ruter 1a55cbe59d Customize: Hide "Change" button in themes section if there are fewer than two available themes.
Props danielbachhuber, westonruter.
Fixes #34549.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35499 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-05 01:26:25 +00:00
Weston Ruter 77e365efbf Customize: Add support for `post_type_archive` nav menu items.
Props celloexpressions, westonruter.
Fixes #16075.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35464 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-04 04:30:26 +00:00
Andrea Fercia be620e6da6 Customizer: Remove the no more used `add-menu-item-loading` spinner.
Also makes more room for longer translations.

Props dipali.dhole27@gmail.com.
Fixes #34342.
Built from https://develop.svn.wordpress.org/trunk@35396


git-svn-id: http://core.svn.wordpress.org/trunk@35360 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-26 13:59:26 +00:00
Drew Jaynes 2f42bf0a73 Docs: Add missing DocBlocks for the `$type` and `$sidebar_id` properties, and summaries for the `to_json()` and `render_content()` methods in `WP_Widget_Area_Customize_Control`.
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35357 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-25 19:58:26 +00:00
Scott Taylor 68526a8bf1 Customize: move `WP_Customize_Control` subclasses to `wp-includes/customize`, they load in the exact same place.
See #34432.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35353 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-24 18:57:25 +00:00
Scott Taylor 61aefacd2c Customize: move `WP_Customize_Panel` subclass to `wp-includes/customize`, it loads in the exact same place.
See #34432.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35350 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-24 18:25:24 +00:00
Scott Taylor 574f53399c Customize: move `WP_Customize_Section` subclasses to `wp-includes/customize`, they load in the exact same place.
See #34432.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35349 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-24 18:21:25 +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