Commit Graph

44 Commits

Author SHA1 Message Date
Sergey Biryukov
19bca10d79 Coding Standards: Replace echo sprintf() with printf().
See #49542.
Built from https://develop.svn.wordpress.org/trunk@48111


git-svn-id: http://core.svn.wordpress.org/trunk@47880 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-20 13:18: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
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
ac9b6fcef8 Docs: Use a consistent description for the $manager parameter in various Customizer class constructions.
See #48303.
Built from https://develop.svn.wordpress.org/trunk@47383


git-svn-id: http://core.svn.wordpress.org/trunk@47170 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-26 15:33:05 +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
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
b026fde152 Docs: Remove @static notations from property DocBlocks in wp-admin/* and wp-includes/* classes.
This tag has been used in the past, but should no longer be used. Just using the `static` keyword in code is enough for PhpDocumentor on PHP5+ to recognize static variables and methods, and PhpDocumentor will mark them as static.

Props birgire.
See #42803.
Built from https://develop.svn.wordpress.org/trunk@42747


git-svn-id: http://core.svn.wordpress.org/trunk@42577 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-25 20:32: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
Andrea Fercia
d1948f623a Accessibility: CodeMirror editing areas minor improvements.
- properly labels all the code editor areas (Theme/Plugin, Custom HTML widget, Additional CSS), whether CodeMirror is enabled or disabled
- adds `role="textbox"` and `aria-multiline="true"` to the CodeMirror editing area to allow assistive technologies properly identify it as a textarea
- standardizes the "keyboard trap" help text across the admin and keeps it as a list for better readability
- use the Help text elements as target for `aria-describedby`, to make screen readers read out the help text when focusing the editors
- fixes the `aria-expanded` attribute usage in the Customizer "Additional CSS" help toggle
- moves focus to the CodeMirror editing area when clicking on the associated label
- in the Plugin editor screen: changes a `<big>` element to `<h2>` for better semantics and consistency with the Theme editor screen
- also, removes a few textdomain leftovers, see `better-code-editing` and `default`

Props westonruter, melchoyce, afercia.
Fixes #41872.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41419 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-24 16:00:46 +00:00
Weston Ruter
f6a26be345 Customize: Add notifications API to sections and panels.
* Adds a `notifications` property to instances of `wp.customize.Panel` and `wp.customize.Section`.
* Adds a `setupNotifications()` method to `Panel`, `Section`, and `Control`.
* Adds a `getNotificationsContainerElement()` method to the `Panel` and `Section` classes, like `Control` has.
* Replace hard-coded notification in header media section with a notification.
* Limit rendering notifications to panels and sections that are expanded, and to controls that have an expanded section.

See #34893, #35210, #38778.
Fixes #38794.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41223 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-19 05:40:44 +00:00
Drew Jaynes
0860bb2771 Docs: Remove @access notations from method DocBlocks in wp-includes/* classes.
Prior to about 2013, many class methods lacked even access modifiers which made the `@access` notations that much more useful. Now that we've gotten to a point where the codebase is more mature from a maintenance perspective and we can finally remove these notations. Notable exceptions to this change include standalone functions notated as private as well as some classes still considered to represent "private" APIs.

See #41452.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-27 00:41:44 +00:00
Weston Ruter
ad293eade7 Customize: Auto-expand a widget area section when expanding the Widgets panel if there is only one registered sidebar and it is active.
Introduces `WP_Customize_Panel::$auto_expand_sole_section` property which allows panels to opt-in to the behavior, which the Widgets panel is made to do by default.

Props delawski, westonruter, melchoyce.
Fixes #37471.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40302 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-04-07 19:27:40 +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
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
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
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
Drew Jaynes
c6ee6246ef Docs: Remove a duplicate @static tag from the WP_Customize_Panel->instance_count property DocBlock.
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36535 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-18 00:14:26 +00:00
Weston Ruter
dc343e41fa Customizer: Hide help toggle button in panel when no description is supplied.
This aligns with the `.customize-panel-description` element which is also excluded if there is no description.

Props drebbits.web.
Fixes #35540.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36341 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-21 22:01:26 +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
Weston Ruter
bd801ae5db Customize: Remove redundant aria-label attributes.
Adds an `$options` array argument to `WP_Screen::render_screen_options()` to allow the `div#screen-options-wrap` element to be omitted when `wrap` value is `false`.

Props afercia, westonruter.
Fixes #33182.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34061 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-13 06:16:26 +00:00
Dominik Schilling
727123ddbc Customizer: Switch buttons to match the focus order with the visual order.
props afercia.
see #33181.
Built from https://develop.svn.wordpress.org/trunk@33505


git-svn-id: http://core.svn.wordpress.org/trunk@33472 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-29 22:10:24 +00:00
Drew Jaynes
2475426aa8 Fix syntax and add missing @access tags to a variety of methods added to WP_Customize_Nav_Menus_Panel in 4.3.
See [32855]. See #32891.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33191 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-13 20:44:24 +00:00
Scott Taylor
8b1286417e ob_get_contents() followed by ob_end_clean() can be replaced by ob_get_clean().
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32936 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-27 01:12:24 +00:00
Scott Taylor
55b2385cf5 Add missing access modifier to WP_Customize_Nav_Menus_Panel::wp_nav_menu_manage_columns().
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32847 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-19 22:05:25 +00:00
Konstantin Obenland
50e32a1969 Keep WP_Customize_Nav_Menus_Panel with other panels rather than controls.
Accidentally merged into the wrong file in [32806].
H/t celloexpressions for noticing.

See https://wordpress.slack.com/archives/core-customize/p1434696254000258.
See #32576.


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


git-svn-id: http://core.svn.wordpress.org/trunk@32826 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-19 08:37:27 +00:00
Dominik Schilling
2d2445516c Customizer: Decode HTML entities of panel/section titles.
Titles are now passed into Underscore templates but HTML-escaped, see #30737.

fixes #32670.
Built from https://develop.svn.wordpress.org/trunk@32822


git-svn-id: http://core.svn.wordpress.org/trunk@32793 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-17 19:48:25 +00:00
Weston Ruter
98b03d376e Add JS templates for Customizer Panels and Sections.
This extends the approach taken for Customizer Controls in #29572.

Props celloexpressions, westonruter, ocean90.
See #30737.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32628 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-30 00:03:30 +00:00
Scott Taylor
19a3aacc94 Add @static* annotations where they are missing.
Initialize all static vars that are not, most to `null`.

See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32620 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-29 15:43:29 +00:00
Dominik Schilling
fccc19b510 Customizer: Replace accordion behavior of sections with a slide-in navigation.
This allows users to focus on the contents of the active section more easily and separating the navigation from the content/controls in the Customizer.

props valendesigns, celloexpressions.
see #31336.
Built from https://develop.svn.wordpress.org/trunk@32649


git-svn-id: http://core.svn.wordpress.org/trunk@32619 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-29 13:57:26 +00:00
Drew Jaynes
6a899c6709 Add a missing file header to wp-includes/class-wp-customize-panel.php, separate out the class DocBlock for WP_Customize_Panel.
See #31446.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31522 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 08:09:25 +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
Dominik Schilling
0826f8ede2 Customizer: Add panel/section type as CSS class to the HTML container.
see #28709.
Built from https://develop.svn.wordpress.org/trunk@30714


git-svn-id: http://core.svn.wordpress.org/trunk@30704 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-02 22:16: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
Drew Jaynes
a8fcffa02a 4.1 Docs Audit: Improve inline documentation for various properties and methods in the WP_Customize_Panel class.
See #30469.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30597 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-28 11:03:24 +00:00
Dominik Schilling
73b4f6f449 Customizer: Add stable sorting for panels, sections and controls in JS. Improve sorting in PHP.
props westonruter.
fixes #30225.
Built from https://develop.svn.wordpress.org/trunk@30214


git-svn-id: http://core.svn.wordpress.org/trunk@30214 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-03 21:35:23 +00:00
Dominik Schilling
3c962ee5d8 Improve/introduce Customizer JavaScript models for Controls, Sections, and Panels.
* Introduce models for panels and sections.
* Introduce API to expand and focus a control, section or panel.
* Allow deep-linking to panels, sections, and controls inside of the Customizer.
* Clean up `accordion.js`, removing all Customizer-specific logic.
* Add initial unit tests for `wp.customize.Class` in `customize-base.js`.

https://make.wordpress.org/core/2014/10/27/toward-a-complete-javascript-api-for-the-customizer/ provides an overview of how to use the JavaScript API.

props westonruter, celloexpressions, ryankienstra.
see #28032, #28579, #28580, #28650, #28709, #29758.
fixes #29529.


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


git-svn-id: http://core.svn.wordpress.org/trunk@30102 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-29 22:51:22 +00:00
Dominik Schilling
67c8d7f847 Customizer: Extract content markup for panels to its own method, WP_Customize_Panel::render_content().
This allows to override the behavior of a panel, or even to completely replace its contents with something other than controls or sections.

props celloexpressions.
fixes #29324.
Built from https://develop.svn.wordpress.org/trunk@29950


git-svn-id: http://core.svn.wordpress.org/trunk@29699 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-17 21:25:19 +00:00
Helen Hou-Sandí
f348ccccf8 Customizer panels: use a single back button for all panels.
This also ensures the back button is visible on iOS devices.

props celloexpressions.
fixes #29135.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29384 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-25 23:05:15 +00:00
Andrew Nacin
ba9ee74028 Separate WP_Customize_Panel from WP_Customize_Section.
props celloexpressions.
fixes #29197.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29265 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-14 04:40:17 +00:00