Commit Graph

107 Commits

Author SHA1 Message Date
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
Andrea Fercia ffedf3d752 Accessibility: Widgets: Make the "Available Widgets" section operable with a keyboard.
For a number of years, the "Available Widgets" section has been off-limits for
keyboard users. Now it can be used also with the keyboard. This change introduces
also some improvements for assistive technologies.

- makes the widget toggles focusable and adds an `aria-expanded` attribute to indicate their state
- improves the toggles labelling to clarify context (add/edit)
- changes the controls to choose a sidebar from list items to buttons
- adds an `aria-label` attribute to the buttons to clarify their purpose
- adds an `aria-pressed` attribute to the buttons to indicate which one is selected
- improves color contrast of the selected button
- uses a `wp.a11y.speak()` message to announce to screen reader users when a widget has been added to a sidebar
- moves focus back to the toggle button when closing a widget

See #40677.

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


git-svn-id: http://core.svn.wordpress.org/trunk@42624 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-07 22:27:31 +00:00
Gary Pendergast aaf99e6913 Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.


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


git-svn-id: http://core.svn.wordpress.org/trunk@42172 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-30 23:11:00 +00:00
Gary Pendergast a779284c00 General: Reformat inline `if ()` statements inside HTML tags.
This pattern occurs a handful of times across the codebase:

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

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

See #41057.


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


git-svn-id: http://core.svn.wordpress.org/trunk@42046 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-23 04:09:49 +00:00
Andrea Fercia 8c7a2b1d54 Accessibility: Improve the sidebar toggles in the Widgets screen.
- uses button elements for the toggles
- uses `aria-expanded` on the toggles to communicate to assistive technologies the panels expanded/collapsed state
- adds the "circular focus" style to the toggles to give users a clear indication of the currently focused element
- standardizes CSS class names to `.toggle-indicator` and `.handlediv` as these names are already used across the admin for similar controls

Props monikarao, xavortm, mihai2u, Kopepasah.
Fixes #37013.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41456 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-27 16:29:44 +00:00
Weston Ruter 9b5d71bad0 Widgets: Add dirty state tracking for widgets on admin screen.
* Mark a widget as dirty when a field input triggers a `change` or `input` event; clear dirty state when widget is successfully saved.
* Disable Save button and re-label "Saved" when widget not dirty.
* Show AYS dialog when leaving widgets admin screen with unsaved changes.
* When widgets are dirty, expand all unsaved widgets at AYS check and focus on first one.
* Change "Close" link to "Done"; hide link when widget is dirty and reveal when saved.
* The "Done" link persistently appears in the Customizer even after making a change (when the widget is dirty) because changes are autosaved into the changeset.
* Prevent saving widget when form fails `checkValidity`.
* Fix frequency of triggering of `change` event on the rich Text widget's `textarea` limited now to when there are actual changes.
* Add a class of `widget-dirty` to widget containers when the widget has unsaved changes.

Props westonruter, timmydcrawford, melchoyce.
Fixes #41610, #23120.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41185 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-08 19:11:43 +00:00
Andrea Fercia 1d739a0925 Accessibility: Make some Widgets buttons real buttons.
Links used as UI controls that behave like buttons, should be buttons.
- changes the widgets "toggle", "Delete", and "Close" links to buttons
- uses `aria-expanded` to announce the state of the toggle buttons
- increases a bit the clickable area of the toggle
- ensures the "circular focus" doesn't get cut-off in some browsers by centering the toggle arrows
- uses a `<span>` element with an `aria-hidden` attribute to hide CSS generated font icons from assistive technologies
- standardizes on `.toggle-indicator:before` rather than `:after`
- changes two `#f00` reds in `#dc3232`, see #35622

Fixes #31476.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40356 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-04-19 21:14:44 +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
Andrea Fercia 6b449abadc Accessibility: bump headings one level up on the Appearance > Widgets screen for a better headings hierarchy.
Props mrahmadawais, afercia.
Fixes #33659.
Built from https://develop.svn.wordpress.org/trunk@35015


git-svn-id: http://core.svn.wordpress.org/trunk@34980 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-10 16:34:25 +00:00
Drew Jaynes aa6fbdaa92 Docs: Add a missing DocBlock summary for `wp_list_widget_controls_dynamic_sidebar()`.
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34792 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-05 03:06:24 +00:00
Weston Ruter 208330f2dc Customizer: Defer embedding widget controls to improve DOM performance and initial load time.
The Menu Customizer feature includes a performance technique whereby the controls for nav menu items are only embedded into the DOM once the containing menu section is expanded. This commit implements the same DOM deferral for widgets but goes a step further than just embedding the controls once the widget area's Customizer section is expanded: it also defers the embedding of the widget control's form until the widget is expanded, at which point the `widget-added` event also fires to allow any additional widget initialization to be done. The deferred DOM embedding can speed up initial load time by 10x or more. This DOM deferral also yields a reduction in overall memory usage in the browser process.

Includes changes to `wp_widget_control()` to facilitate separating out the widget form from the surrounding accordion container; also includes unit tests for this previously-untested function. Also included are initial QUnit tests (finally) for widgets in the Customizer.

Fixes #33901.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34527 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-25 21:02:27 +00:00
Scott Taylor f8d7a43920 Move `wp_widgets_access_body_class()` (a hook callback) from `wp-admin/widgets.php` to `wp-admin/includes/widgets.php`.
See #33813.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33986 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-10 21:22:23 +00:00
Sergey Biryukov a3f82f92f1 Widgets: Don't display sidebar description container if it's empty.
Props paulwilde.
Fixes #32448.
Built from https://develop.svn.wordpress.org/trunk@33934


git-svn-id: http://core.svn.wordpress.org/trunk@33903 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-06 07:59:24 +00:00
Sergey Biryukov 4b5ef333a0 Correct the docblock for `wp_list_widget_controls()`.
Props swissspidy.
Fixes #33751.
Built from https://develop.svn.wordpress.org/trunk@33930


git-svn-id: http://core.svn.wordpress.org/trunk@33899 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-05 23:38:25 +00:00
Scott Taylor c6a4512b1b Add missing doc blocks to `wp-admin/includes/*`.
Fix some egregious uses of tabbing.
Some functions can simply return `apply_filters(...)` instead of setting a variable that is immediately returned.

See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32624 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-29 20:17:26 +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
Scott Taylor b56b9b3e5c Add `@global` annotations for `wp-admin/*`.
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32612 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-28 21:41:30 +00:00
Scott Taylor 7f8b548df1 In HTML5, the `action` attribute is no longer required. Remove this attribute when empty.
The admin HTML is served with the HTML5 doctype.

"The action and formaction content attributes, if specified, must have a value that is a valid non-empty URL potentially surrounded by spaces." 
http://www.w3.org/html/wg/drafts/html/master/forms.html#attr-fs-action

Props voldemortensen.
Fixes #30126.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31181 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-16 04:16:24 +00:00
Drew Jaynes 097dc8ee15 Fix syntax for single- and multi-line comments in wp-admin-directory files.
See #28931.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28990 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-17 09:14:16 +00:00
Scott Taylor 2f513d3320 Fix some `hackificator` odds and ends in `wp-admin`:
* `wp-activate.php` and `wp-admin/themes.php` don't need the closing PHP tag
* Switch single quotes for HTML attribute values to double in a few places
* Convert `include_once file.php` syntax to `include_once( 'file.php' )`
* Add access modifiers to methods/members in: `_WP_List_Table_Compat`, `Walker_Nav_Menu_Edit`, `Walker_Nav_Menu_Checklist`, `WP_Screen`, `Walker_Category_Checklist`
* `edit_user()` doesn't need to import the `$wpdb` global
* `wp_list_widgets()` doesn't need to import the `$sidebars_widgets` global
* switch/endswitch syntax is not supported in Hack
* A `<ul>` in `wp-admin/users.php` is unclosed

See #27881.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28326 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-19 05:04:16 +00:00
Sergey Biryukov e7467f9b44 Remove temporary hooks added in [26865].
fixes #26661.
Built from https://develop.svn.wordpress.org/trunk@27324


git-svn-id: http://core.svn.wordpress.org/trunk@27176 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-28 00:45:16 +00:00
Sergey Biryukov cce9d251a4 Add comments for temporary hooks. see #26661.
Built from https://develop.svn.wordpress.org/trunk@26866


git-svn-id: http://core.svn.wordpress.org/trunk@26752 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-23 00:48:11 +00:00
Sergey Biryukov 507b595c2b Add temporary hooks for the widgets feature team to wp_widget_control().
props westonruter.
see #26661.
Built from https://develop.svn.wordpress.org/trunk@26865


git-svn-id: http://core.svn.wordpress.org/trunk@26751 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-23 00:45:11 +00:00
Matt Thomas baefdf5bf8 Revert r26593 so Available and Inactive widgets are once again collapsible. Make the arrows only appear on hover when uncollapsed. Fixes #26327, props nacin.
Built from https://develop.svn.wordpress.org/trunk@26608


git-svn-id: http://core.svn.wordpress.org/trunk@26498 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-04 16:31:10 +00:00
Matt Thomas 26a22db98e Set Available and Inactive Widget areas to not collapse, since they don't look like collapsing elements. Fixes #26327, props MikeHansenMe.
Built from https://develop.svn.wordpress.org/trunk@26593


git-svn-id: http://core.svn.wordpress.org/trunk@26483 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-03 21:32:10 +00:00
Andrew Ozz f46e743343 Widgets: drop onto closed sidebars.
- Make dropping a widget easier by preventing the source sidebar from resizing while the widget is being dragged.
- Move widgets dropped on closed sidebars to the top. UI Sortable places them randomly near the bottom.
- Fix possible regression in wp_list_widget_controls(), add an optional argument to output the sidebar name inside the sortable container.
- Updated styles for sidebar description and widget-hover class.
Part props shaunandrews, fixes #25952.
Built from https://develop.svn.wordpress.org/trunk@26426


git-svn-id: http://core.svn.wordpress.org/trunk@26326 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-27 01:30:10 +00:00
Matt Thomas 87ce6cc5c3 Bring in the widgets component of MP6. See #25858.
* A cleaner UI, with a simpler design for available and inactive widgets, and more emphasis on your sidebars.
* Available widgets and sidebars expand to two columns at larger screen sizes making it easier to manage sites with lots of sidebars.
* New dropzone indicator for empty sidebars.

Props shaunandrews, joen, iammattthomas.


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


git-svn-id: http://core.svn.wordpress.org/trunk@26051 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-13 20:06:06 +00:00
Sergey Biryukov 74638ccb5a Fix typos in phpdoc. props TheLastCicada. fixes #24302.
git-svn-id: http://core.svn.wordpress.org/trunk@24229 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-05-10 01:39:30 +00:00
Andrew Nacin 9e2d46819e Revert [22387]. see #14466. see #22374.
git-svn-id: http://core.svn.wordpress.org/trunk@22406 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-06 22:36:24 +00:00
Andrew Nacin bc93c0fdc5 Prefix sidebar IDs on the widgets screen with "sidebar-". props batmoo. fixes #14466.
git-svn-id: http://core.svn.wordpress.org/trunk@22387 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-05 23:17:25 +00:00
Andrew Nacin 1acd8b556f New HiDPI spinner. Uses clean <span class="spinner"></span> markup.
Be on the lookout for weirdness.
props lessbloat. see #21456.



git-svn-id: http://core.svn.wordpress.org/trunk@22019 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-26 19:57:44 +00:00
Andrew Nacin c1b0670c2d Updates and fixes to the new button styles. By default, buttons are now the same size as they were in 3.4. Then there is a smaller button (designed for minor elements) and a larger button (designed for things like Publish and Save Changes). Better focus styles. props lessbloat. see #21598.
git-svn-id: http://core.svn.wordpress.org/trunk@21944 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-21 19:34:23 +00:00
azaozz 99496fb30c Widgets: add localization context for 'Add' and 'Edit', props nacin, fixes #21338
git-svn-id: http://core.svn.wordpress.org/trunk@21356 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-27 03:56:27 +00:00
azaozz 93979aa0ef Widgets: Add the name of the widget to the Add and Edit buttons on the Accessible Widget Management Screen, props cannona, fixes #21338
git-svn-id: http://core.svn.wordpress.org/trunk@21355 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-27 03:33:38 +00:00
ryan e3b46b25d3 Lose EOF ?>. Clean up EOF newlines. fixes #12307
git-svn-id: http://svn.automattic.com/wordpress/trunk@19712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-08 17:01:11 +00:00
duck_ c1d1590171 Fix typos in documentation (wp-admin/). See #18560.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18632 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-03 14:18:10 +00:00
ryan 8192d0dae8 Validation fixes. Props ocean90, peaceablewhale. see #17364
git-svn-id: http://svn.automattic.com/wordpress/trunk@18010 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-05-23 23:33:30 +00:00
ryan 3f72e340d6 Update since phpdoc. Props demetris. fixes #15445
git-svn-id: http://svn.automattic.com/wordpress/trunk@16660 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-01 19:24:38 +00:00
scribu 03dd41a0d2 Improve hook readability via curly brackets. Props jjj for initial patch. Fixes #15422
git-svn-id: http://svn.automattic.com/wordpress/trunk@16365 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-14 15:50:02 +00:00
nacin 5f4a583fb1 Remove more create_function calls. props huichen, see #14424.
git-svn-id: http://svn.automattic.com/wordpress/trunk@16313 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-11 22:50:36 +00:00
nacin 5560332a2c Update phpdoc for wp_list_widgets(). fixes #15373.
git-svn-id: http://svn.automattic.com/wordpress/trunk@16269 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-10 12:28:03 +00:00
markjaquith fc6e89da45 Expand submit_button() capabilities. Replace all (or almost all) manual HTML instances in WP. props sbressler. see #15064
git-svn-id: http://svn.automattic.com/wordpress/trunk@16061 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-10-28 21:56:43 +00:00
ryan 172aa06718 Revert [14347] and [14372]. It broke more than we expected. Try again in 3.1. see #13051
git-svn-id: http://svn.automattic.com/wordpress/trunk@14374 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-05-03 18:16:22 +00:00
ryan 91354eefee Escape links by default. Props alexkingorg. see #13051
git-svn-id: http://svn.automattic.com/wordpress/trunk@14347 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-05-02 22:53:59 +00:00
nacin 00706d68ce Use admin_url() for images in wp-admin, to allow for filtering. Props mdawaffe, see #12300
git-svn-id: http://svn.automattic.com/wordpress/trunk@13256 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-02-20 21:09:49 +00:00
ryan 6da55f7792 Trailing whitespace cleanup
git-svn-id: http://svn.automattic.com/wordpress/trunk@12733 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-01-15 22:11:12 +00:00
markjaquith 14f6764df9 Change 'Remove' link on widgets to 'Delete' because it doesn't just remove it, it deletes the settings for that widget instance. props Denis-de-Bernardy. fixes #10379
git-svn-id: http://svn.automattic.com/wordpress/trunk@12360 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-12-10 08:51:36 +00:00
azaozz c3f7df6b24 Fix notices and phpdoc, props hakre, fixes #10758
git-svn-id: http://svn.automattic.com/wordpress/trunk@12284 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-11-26 11:29:54 +00:00
azaozz f2dc806c22 Add sidebar descriptions to sidebar settings and widget admin screen, props jeremyclarke scribu, fixes #11157
git-svn-id: http://svn.automattic.com/wordpress/trunk@12213 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-11-19 09:12:16 +00:00
azaozz fe813ce063 Do not reuse deleted widget instances IDs, fixes #10092 for trunk
git-svn-id: http://svn.automattic.com/wordpress/trunk@11577 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-06-15 23:57:52 +00:00