Commit Graph

60 Commits

Author SHA1 Message Date
Gary Pendergast
cf3fa9f7c8 Coding Standards: Fix the Squiz.PHP.DisallowMultipleAssignments violations in wp-admin.
See #47632.


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


git-svn-id: http://core.svn.wordpress.org/trunk@45394 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-01 12:52:01 +00:00
Gary Pendergast
56c162fbc9 Coding Standards: Upgrade WPCS to 1.0.0
WPCS 1.0.0 includes a bunch of new auto-fixers, which drops the number of coding standards issues across WordPress significantly. Prior to running the auto-fixers, there were 15,312 issues detected. With this commit, we now drop to 4,769 issues.

This change includes three notable additions:
- Multiline function calls must now put each parameter on a new line.
- Auto-formatting files is now part of the `grunt precommit` script. 
- Auto-fixable coding standards issues will now cause Travis failures.

Fixes #44600.


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


git-svn-id: http://core.svn.wordpress.org/trunk@43400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-08-17 01:51:36 +00:00
Adam Silverstein
d1d6e8864e Revisions: improve show_split_view=false support for title.
* When show_split_view argument false, show title changes in a single column and only show title once if title is unchanged.

Props johnbillion, mbelchev.
Fixes #42402.  


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


git-svn-id: http://core.svn.wordpress.org/trunk@42795 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-04-10 16:12:30 +00:00
John Blackbourn
b13e73d05c Docs: Document more parameters and properties using typed array notation.
See #41756

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


git-svn-id: http://core.svn.wordpress.org/trunk@42705 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-25 18:10:32 +00:00
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
Adam Silverstein
415e9379f9 Revisions: correct a timezone display issue.
When preparing the data for the revisions screen, add ' +0000' to the gmt date string before passing it thru `strtotime`.

Props biranit, nacin, buley.
Fixes #25365.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41392 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-21 23:33:44 +00:00
John Blackbourn
dbdc1c28b1 I18N: Correct various instances of incorrect usage of esc_attr_e().
Fixes #37457
Props henry.wright, afercia

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


git-svn-id: http://core.svn.wordpress.org/trunk@38365 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-28 18:06:30 +00:00
Drew Jaynes
22adda2aa0 Hooks: Standardize naming of dynamic hooks to use interpolation vs concatenation.
Benefits gained in discoverability and self-documentation throughout core trump the negligible performance hit in using interpolation in hook names.

Props ramiy.
See #37748.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38248 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-22 18:25:31 +00:00
Drew Jaynes
c3055cc190 Docs: Standardize hook docs in wp-admin/* to use third-person singular verbs per the inline documentation standards for PHP.
See #36913.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37456 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 18:01:30 +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
Sergey Biryukov
ab0eb71d21 Revisions: Clean up _wp_post_revision_fields():
* Move the array processing to a new function, `_wp_post_revision_data()`.
* Make both functions accept a post array or a `WP_Post` object. 
* Always apply the `_wp_post_revision_fields` filter and pass the post data to it.

Fixes #13382.
Built from https://develop.svn.wordpress.org/trunk@36659


git-svn-id: http://core.svn.wordpress.org/trunk@36626 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-24 00:44:59 +00:00
Drew Jaynes
7a49f64cb9 Docs: Add a version to the file header for wp-admin/includes/revision.php.
See #33701.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35351 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-24 18:29:25 +00:00
John Blackbourn
0e1ecdcbf3 Revert [34917] until the broken test is fixed.
See #13382

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


git-svn-id: http://core.svn.wordpress.org/trunk@34890 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-08 01:04:25 +00:00
Boone Gorges
b0e0323337 Add tests for update_user_caches().
See #24635.
Built from https://develop.svn.wordpress.org/trunk@34918


git-svn-id: http://core.svn.wordpress.org/trunk@34883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-07 22:35:26 +00:00
Drew Jaynes
3f747a6395 Revisions: Also pass the $revision post object to the wp_prepare_revision_for_js filter, introduced in [34541].
Props helen.
Fixes #28627.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34797 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-05 18:33:28 +00:00
Drew Jaynes
a134491455 Docs: Document the $revision_data parameter passed to the wp_prepare_revision_for_js filter with a hash notation.
The hook was introduced in [34541].

See #28627.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34796 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-05 18:03:26 +00:00
Scott Taylor
8a8e6557d0 Revisions: add a 'wp_prepare_revision_for_js' filter.
Props jtsternberg, adamsilverstein.
Fixes #28627.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34505 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-25 14:04:24 +00:00
Dion Hulse
cc903c3422 Remove ambiguity in the time display format in core, switches to using 24hr notation where am/pm isn't specified.
* `H:i - 09:54`
* `g:i a - 9:54 am`
* `F j, Y - January 3, 2015`

These shouldn't be used without a/A (am/AM)
* `h:i - 01:23`
* `G:i - 1:23`

Props iseulde. Fixes #31121

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


git-svn-id: http://core.svn.wordpress.org/trunk@31841 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-23 02:14:27 +00:00
Scott Taylor
1bac6fb886 In wp-admin/includes/revision.php, $post->modified is a coding error. It should be $post->post_modified.
See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31104 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-10 05:50:22 +00:00
John Blackbourn
543f408098 Correct the default value of the show_split_view argument for revisions so they are correctly displayed side by side ins
tead of inline.

Fixes #24908

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


git-svn-id: http://core.svn.wordpress.org/trunk@30729 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-04 14:36:24 +00:00
Drew Jaynes
ad297dab6d Correctly capitalize JavaScript throughout core docs.
Fixes #30569.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30685 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-02 00:31:22 +00:00
Drew Jaynes
78bb3e5ff5 Docs Formatting: Backtick-escape inline code for all dynamic hook docs in wp-admin/includes/*.
Also adds a few inline `@see` cross-references as they apply.

Affects DocBlocks for the following hooks:
* `views_{$this->screen->id}`
* `bulk_actions-{$this->screen->id}`
* `manage_{$this->screen->id}_sortable_columns`
* `theme_action_links_$stylesheet`
* `after_theme_row_$stylesheet`
* `install_plugins_table_api_args_$tab`
* `$prefix . plugin_action_links`
* `after_plugin_row_$plugin_file`
* `manage_taxonomies_for_{$post_type}_columns`
* `manage_{$post_type}_posts_columns`
* `manage_{$post->post_type}_posts_custom_column`
* `{$taxonomy}_row_actions`
* `manage_{$this->screen->taxonomy}_custom_column`
* `install_themes_table_api_args_' . $tab`
* `auto_update_ . $type`
* `{$action}_prefilter`
* `admin_head_{$content_func}`
* `nav_menu_items_{$post_type_name}`
* `activate_ . $plugin`
* `deactivate_ . $plugin`
* `edit_{$post_type}_per_page`
* `postbox_classes_{$page}_{$id}`
* `_wp_post_revision_field_$field`
* `manage_{$screen->id}_columns`
* `in_plugin_update_message-{$file}`
* `in_theme_update_message-{$theme_key}`

See #30552.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30638 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-30 11:28:24 +00:00
Drew Jaynes
659413eb98 4.1 Docs Audit: Document the $post global in the DocBlock for wp_print_revision_templates().
See #30469.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30592 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-28 09:05:23 +00:00
Drew Jaynes
a6fc2d610b Minor syntactical adjustments to the inline documentation for the revision_text_diff_options hook.
Converts backticked-inline-code to inline `@see` tags (for the full benefit of Code Reference automagical behavior).

See [30396]. See #24908.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30486 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-21 03:50:24 +00:00
John Blackbourn
3e3c383e79 Introduce two new filters to the post revisions screen:
* `process_text_diff_html` for contextually filtering a diffed line. Allows for the line to be processed in a different manner to the default `htmlspecialchars`.
 * `revision_text_diff_options` for filtering the options passed to `wp_text_diff()` when viewing a post revision.

Fixes #24908
Props adamsilverstein

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


git-svn-id: http://core.svn.wordpress.org/trunk@30392 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-19 23:21:23 +00:00
John Blackbourn
a005e0b11b Display a faux revision when a post only has one revision but has an autosave.
Fixes #29044
Props adamsilverstein

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


git-svn-id: http://core.svn.wordpress.org/trunk@30352 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-16 03:36:23 +00:00
Scott Taylor
a4963672d6 Add a single responsibility function for outputting Revisions JS templates: wp_print_revision_templates().
Use it in `wp-admin/revision.php`.

Props ericlewis.
Fixes #30220.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30129 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-01 00:15:24 +00:00
John Blackbourn
a866a7192f Introduce some actions and filters which aid plugins in revisioning post meta.
* `wp_save_post_revision_post_has_changed` filter which can be used to determine if a post has been changed, and therefore if a revision should be created for a post.
 * `wp_get_revision_ui_diff` filter which can be used to filter the fields displayed in the post revision diff UI.
 * `wp_creating_autosave` action which is fired just before an autosave is created.

See #20564.
Props mattheu, adamsilverstein.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30091 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-29 19:02:21 +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
Scott Taylor
3d7a4e6798 Remove unused variable setting for $revisions in wp_prepare_revisions_for_js().
See #27882.


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


git-svn-id: http://core.svn.wordpress.org/trunk@28092 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-06 03:45:14 +00:00
Andrew Nacin
5361a8abca Spell out duplicate hook locations.
props DrewAPicture.
fixes #25658.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25868 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-24 22:59:20 +00:00
Andrew Nacin
8ae8e01b67 Remove the old wp_auto_updates_maybe_update cron event. Schedule the new wp_maybe_auto_update event at 7 a.m. and 7 p.m. in the site's timezone.
see #27704.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25825 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-24 22:53:14 +00:00
Andrew Nacin
74488bdcb0 Spell out duplicate hook locations.
props DrewAPicture.
fixes #25658.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25780 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-22 17:22:11 +00:00
Drew Jaynes
bdcc067c4c Inline documentation for hooks in wp-admin/includes/revision.php.
Fixes #25283.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25504 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-23 22:45:10 +00:00
Sergey Biryukov
533519086e Better alignment for wp_prepare_revisions_for_js() inline docs. see #25283.
Built from https://develop.svn.wordpress.org/trunk@25420


git-svn-id: http://core.svn.wordpress.org/trunk@25345 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-12 23:15:10 +00:00
Sergey Biryukov
b01adf9615 Inline documentation fixes and additions for wp-admin/revision.php and wp-admin/includes/revision.php.
props adamsilverstein.
see #25283.
Built from https://develop.svn.wordpress.org/trunk@25419


git-svn-id: http://core.svn.wordpress.org/trunk@25344 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-12 22:59:08 +00:00
Andrew Nacin
e0c4fc0032 Fix pass by reference issue. see #24873.
git-svn-id: http://core.svn.wordpress.org/trunk@24866 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-29 17:53:24 +00:00
Mark Jaquith
b53325cad3 Revisions: Fix PHP loading of comparison to first revision, and premature rendering of tooltip.
Props aaroncampbell, markjaquith. Fixes #24873 for trunk.

git-svn-id: http://core.svn.wordpress.org/trunk@24864 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-29 17:26:03 +00:00
Mark Jaquith
ab09a13efa Rename the new 'left'/'right' flags on the _wp_post_revision_field_$field filter to 'from'/'to'.
Fixes #24848 for trunk.

git-svn-id: http://core.svn.wordpress.org/trunk@24835 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-28 23:28:21 +00:00
Mark Jaquith
1e189c9689 Add some missing PHPDoc @since lines.
Fixes #24742. Props DrewAPicture.

git-svn-id: http://core.svn.wordpress.org/trunk@24804 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-27 23:11:03 +00:00
Andrew Nacin
c8fe64a602 Revisions changes.
* Eliminates the bloated Revisions meta box in favor of 'Revisions: #' in the publish box.
 * Adds ability to compare autosave to current post, when revisions are disabled.
 * Makes autosaves stand out visually, including "Restore This Autosave".

Also:
 * Adds missing capability check for restoring a revision.
 * When no revision matches the post's current modified time, avoid marking an autosave as 'current'.
 * Fixes wp_get_post_autosave() to return an autosave even when revisions are disabled.
 * Add 'check_enabled' arg to wp_get_post_revisions(); false avoids the wp_revisions_enabled() check.
 * Adds a responsive slider that is narrower for fewer versions. props markjaquith.

see #24804.



git-svn-id: http://core.svn.wordpress.org/trunk@24790 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-24 06:08:14 +00:00
Mark Jaquith
13c63d211a Revisions: Pinned controls, layout tweaks, copy tweaks, misc.
* When you scroll down the diff view, the controls will pin to the top.
* The revisions meta view was cleaned up. Copy changes.
* Loading indicator in the center of the screen (so it follows as you scroll).
* Tooltips "flip" when you cross the center line, so that they don't hit the container edge and wrap for later revisions.
* The "Restore" button's inactive state is handled on render, instead of after.
* Make sure we always have a current revision, even if the timestamp doesn't work out on the most recent one.

See #24804. Props markjaquith, nacin, ocean90, aaroncampbell.

git-svn-id: http://core.svn.wordpress.org/trunk@24761 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-22 05:05:45 +00:00
Andrew Nacin
94555444ab If two revisions were created at the same time, mark the one with the greater ID as current. Also avoid flagging autosaves as current. fixes #24782.
git-svn-id: http://core.svn.wordpress.org/trunk@24730 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-18 14:10:33 +00:00
Andrew Nacin
8d9a830c3c Remove stray character.
git-svn-id: http://core.svn.wordpress.org/trunk@24726 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-17 21:09:14 +00:00
Andrew Nacin
18a208af1b Inline docs for admin/includes/revision.php. props DrewAPicture, fixes #24742.
git-svn-id: http://core.svn.wordpress.org/trunk@24722 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-17 20:39:35 +00:00
Mark Jaquith
24553b2f03 Improvements to output of revisions author data.
* Do not output "false" if avatars are disabled. props ocean90.
* Cache the author data separately to cut down on calls to `get_the_author_meta()` and `get_avatar()`. props nacin.

Fixes #24743.

git-svn-id: http://core.svn.wordpress.org/trunk@24708 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-15 23:01:27 +00:00
Mark Jaquith
e8b9088c5f Revisions: Cleanup, bug fixes, refactoring, polish.
* Hide the tooltip initially.
* Fix a bug with routing.
* Further separate the Slider model and view, refactoring its code.
* More reliance on events than direct calls between areas.
* Smarter background diff loading (single mode). Loads the diffs closest to your position first.
* Removed a bunch of manual templating and `render()` methods. Now relies more on the WP Backbone Views functionality.
* include the requested `id` in `ensure:load`.
* new trigger: `ensure`, for `ensure()` attempts, regardless of whether they are already loaded.
* pass along a promise in both `ensure` and `ensure:load`.
* in `ensure`, remove requests for diffs we aready have

See #24425.

git-svn-id: http://core.svn.wordpress.org/trunk@24671 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-12 14:01:39 +00:00
Mark Jaquith
7cf1702442 Fix a PHP 5.4-ism that slipped in.
git-svn-id: http://core.svn.wordpress.org/trunk@24670 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-12 07:26:11 +00:00
Mark Jaquith
ef8ff9efac Revisions: sort by date, not modified, to match revisions meta box.
See #24425.

git-svn-id: http://core.svn.wordpress.org/trunk@24668 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-12 05:41:39 +00:00