Commit Graph

97 Commits

Author SHA1 Message Date
Pascal Birchler d2fb0bd81e General: Remove any usage of `wp_reset_vars()`.
The way `wp_reset_vars()` sets global variables based on `$_POST` and `$_GET` values makes code hard to understand and maintain. It also makes it easy to forget to sanitize input.

This change removes the few places where `wp_reset_vars()` is used in the admin to explicitly use `$_REQUEST` and sanitize any input.

Props swissspidy, audrasjb, davideferre, killua99, weijland, voldemortensen.
Fixes #38073.
Built from https://develop.svn.wordpress.org/trunk@58069


git-svn-id: http://core.svn.wordpress.org/trunk@57534 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-01 18:01:12 +00:00
audrasjb 42c9882b46 Revisions: Add missing escaping function for `$post_edit_link` in `wp-admin/revision.php`.
Props nidhidhandhukiya, Presskopp, mukesh27, rajinsharwar, costdev.
Fixes #59141.



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


git-svn-id: http://core.svn.wordpress.org/trunk@55949 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-24 09:32:21 +00:00
audrasjb 418a21fdbc Help/About: Use the new `/documentation/` URLs for HelpHub links in WordPress Admin.
As `https://wordpress.org/support/` was redirected to `https://wordpress.org/documentation/`, this changeset replaces various `/support/article/*` links with `/documentation/article/*` to avoid an extra redirect.

This also updates links to Support Forums by replacing `https://wordpress.org/support/` URLs with `https://wordpress.org/support/forums/`.

Props SergeyBiryukov, audrasjb, dhrupo, hasanmisbah, sakibmd, sabernhardt.
See #57726.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54945 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-23 10:38:21 +00:00
Sergey Biryukov 10e842a662 Coding Standards: Use strict comparison in `wp-admin/revision.php`.
Follow-up to [7913], [12751].

See #54728.
Built from https://develop.svn.wordpress.org/trunk@52538


git-svn-id: http://core.svn.wordpress.org/trunk@52128 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-01-07 16:47:00 +00:00
desrosj 28d78c0c37 Coding Standards: Apply some alignment fixes from `composer format`.
Follow up to [51475].

See #53729.
Built from https://develop.svn.wordpress.org/trunk@51499


git-svn-id: http://core.svn.wordpress.org/trunk@51110 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-27 19:01:59 +00:00
Sergey Biryukov 8a90b8691f Docs: Add a comment about the `$title` global usage in various admin files.
This should make it clear that the variable is used as part of the HTML `<title>` tag on admin screens.

Props ravipatel, hellofromTonya, sabernhardt, audrasjb, SergeyBiryukov.
Fixes #53729.
Built from https://develop.svn.wordpress.org/trunk@51475


git-svn-id: http://core.svn.wordpress.org/trunk@51086 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-22 13:53:00 +00:00
Sergey Biryukov a2d42351c5 Text Changes: Unify various "Back to..." vs. "Return to..." vs. "Go to..." strings.
Standardize on "Go to..." as a more appropriate option for most cases.

Props garrett-eclipse, kharisblank, audrasjb, ramiy, valentinbora.
Fixes #47235.
Built from https://develop.svn.wordpress.org/trunk@49539


git-svn-id: http://core.svn.wordpress.org/trunk@49277 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-09 10:53:10 +00:00
Sergey Biryukov df74d8f10d Revisions: Ensure the global `$post` remains the same after revision is restored.
Because `wp_insert_post()` and `wp_transition_post_status()` are called during the process, plugins can unexpectedly modify `$post`.

Props markparnell, tofandel, archon810, SergeyBiryukov.
Fixes #46671.
Built from https://develop.svn.wordpress.org/trunk@48625


git-svn-id: http://core.svn.wordpress.org/trunk@48387 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-26 21:25:02 +00:00
Sergey Biryukov a6cf8df9d1 Docs: Synchronize some comments in `wp-admin/revision.php`.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48624


git-svn-id: http://core.svn.wordpress.org/trunk@48386 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-26 20:43:02 +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 001ffe81fb Docs: Improve inline comments per the documentation standards.
Includes minor code layout fixes for better readability.

See #48303.
Built from https://develop.svn.wordpress.org/trunk@47122


git-svn-id: http://core.svn.wordpress.org/trunk@46922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-29 00:45:18 +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 8e85299a00 General: First pass at replacing Codex URLs with a corresponding HelpHub or DevHub article.
Props ianbelanger, tobifjellner, SergeyBiryukov.
See #47771.
Built from https://develop.svn.wordpress.org/trunk@45674


git-svn-id: http://core.svn.wordpress.org/trunk@45485 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-25 22:45:57 +00:00
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 4487551344 Help: Update support forum links.
There are a lot of places in Core that link to https://wordpress.org/support/ for the support forums, but that's now the URL for HelpHub. The new forums link is https://wordpress.org/support/forums/.

Props jitendrabanjara1991, dilipbheda, mukesh27, ianbelanger.
Fixes #46790.


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


git-svn-id: http://core.svn.wordpress.org/trunk@44949 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-08 22:59:56 +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
Sergey Biryukov 4848a09b35 I18N: Use the actual placeholder instead of a number in translator comments if the corresponding string does not use numbered placeholders.
Add missing translator comments in `WP_Theme_Install_List_Table` and `wp_notify_postauthor()`.
Add missing commas in some translator comments.

Fixes #43523.
Built from https://develop.svn.wordpress.org/trunk@42827


git-svn-id: http://core.svn.wordpress.org/trunk@42657 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-11 16:44:34 +00:00
Sergey Biryukov 24f43065b9 Docs: Document globals in `wp-admin/revision.php` as `@global` instead of `@param`.
See #42505.
Built from https://develop.svn.wordpress.org/trunk@42795


git-svn-id: http://core.svn.wordpress.org/trunk@42625 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-08 03:53:34 +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
John Blackbourn 4cf5550d8d I18n: Begin introducing translator comments for strings which include placeholders but no accompanying translator comment.
Adds context to one string used in two different contexts for the new user and new site signup email notification.

More to come.

See #38882

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


git-svn-id: http://core.svn.wordpress.org/trunk@39263 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-21 01:22:32 +00:00
Andrea Fercia d65a038ca3 Accessibility: Remove target=_blank from the Plugins, Themes, Media, Update, and Tools screens help tabs links.
Stop taking control of users' browsers.

Props rianrietveld.
Fixes #38215. See #23432.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38665 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-04 07:08:29 +00:00
Rachel Baker c283b3c0c6 Revisions: Allow autosaves to be restored when revisions are disabled.
Fixes bug introduced in [23639] where autosaves are not restored if revisions are disabled.

Props adamsilverstein.
Fixes #36262.



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


git-svn-id: http://core.svn.wordpress.org/trunk@37950 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-08 01:16:31 +00:00
Rachel Baker a2904cc309 Revisions: Change the capability needed to view revision diffs to `edit_post`.
Built from https://develop.svn.wordpress.org/trunk@37779


git-svn-id: http://core.svn.wordpress.org/trunk@37744 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-21 14:22:26 +00:00
Scott Taylor 6d4442ba12 Revisions screen: change language from "Return to post editor" to "Return to editor" - more generic for usage by custom post types.
Props lancewillett, adamsilverstein.
Fixes #31910.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33935 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-09 03:23:23 +00:00
Konstantin Obenland 7dc1d06e64 Proper heading for admin screens.
First step towards restoring a good heading structure in wp-admin.
The previous `<h1>` contained the site title and a link to the front page and was removed with the toolbar refactoring in 3.2.

Props joedolson, afercia.
Fixes #31650.


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


git-svn-id: http://core.svn.wordpress.org/trunk@32945 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-27 15:41:25 +00:00
Dominik Schilling 64fc7294b6 Use HTTPS URLs for codex.wordpress.org.
see #27115.
Built from https://develop.svn.wordpress.org/trunk@32116


git-svn-id: http://core.svn.wordpress.org/trunk@32095 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-12 21:29:32 +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
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
Andrew Nacin dce0b9adea Use SSL when linking to WordPress.org. see #27115.
Built from https://develop.svn.wordpress.org/trunk@27469


git-svn-id: http://core.svn.wordpress.org/trunk@27314 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-08 04:14:15 +00:00
Andrew Nacin abe142d2c6 Revisions: Add 'Return to post editor' link.
props adamsilverstein, jenmylo.
fixes #24682.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27231 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-03 19:50:15 +00:00
Andrew Ozz 8d6059b383 Remove all screen_icon() calls and deprecate the functions, props TobiasBg, fixes #26119
Built from https://develop.svn.wordpress.org/trunk@26518


git-svn-id: http://core.svn.wordpress.org/trunk@26411 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-02 03:53:11 +00:00
Andrew Nacin 70fd806759 Revert r25824:25875 from the core.svn.wordpress.org repository.
These commits were accidentally re-synced commits from develop.svn.wordpress.org due to a race condition. Thankfully, the history of this repository matters fairly little. It also happened only for trunk.


git-svn-id: http://core.svn.wordpress.org/trunk@25876 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-25 02:29:52 +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
Ryan Boren b87d4b77e5 Pinking shears
Built from https://develop.svn.wordpress.org/trunk@25880


git-svn-id: http://core.svn.wordpress.org/trunk@25792 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-23 14:38:10 +00:00
Andrew Nacin fd57b239d2 Don't rely on include_path to include files.
Always use dirname() or, once available, ABSPATH.

props ketwaroo, hakre.
fixes #17092.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25533 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-25 00:18:11 +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 c7a35ddee1 Update help text for [24860]. props ocean90. see #24804. for trunk.
git-svn-id: http://core.svn.wordpress.org/trunk@24922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-31 15:27:02 +00:00
Andrew Nacin c8450ceff1 Change 'Change two revisions' to 'Compare any two revisions' for clarity. props siobhan. see #24804.
git-svn-id: http://core.svn.wordpress.org/trunk@24859 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-29 06:56:49 +00:00
Aaron Campbell c168ef72cc Disable ability to restore a revision if another user has the post lock
props adamsilverstein. Fixes #24829 for trunk.


git-svn-id: http://core.svn.wordpress.org/trunk@24827 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-28 21:51:44 +00:00
Mark Jaquith 174bbc20d8 Revisions: Combine our tooltip and from/to templates into one generic template
We had three copies of essentially the same template. Now just one, with minor logic inside.

Also fixes a bug where tooltip.revision was being initially set to a diff instead of a revision.

For trunk. See #24804.

git-svn-id: http://core.svn.wordpress.org/trunk@24814 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-28 20:15:28 +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
Andrew Nacin 9f58cc923c Fix strings in revisions UI. see #24804, [24761].
git-svn-id: http://core.svn.wordpress.org/trunk@24763 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-22 05:32: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
Mark Jaquith 65b08eeece Revisions: Re-work how tick marks and tooltips are aligned. IE fixes.
* Pixel-based alignment of tooltips.
* Bottom-based alignment, so arrow lines up using CSS only.
* Better RTL styles (mostly mirror-imaged).
* Better RTL calculations in `revisions.js` (less logic).
* Better IE support.

See #24736. Props markjaquith, adamsilverstein, ocean90.

git-svn-id: http://core.svn.wordpress.org/trunk@24751 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-19 13:49:15 +00:00
Mark Jaquith 93514ba101 Revisions: Better error handling.
* Shows an error message if the current diff can't be loaded.
* For bulk pre-loading, catches errors, and cuts subsequent requests in half, until eventually giving up.
* Some CSS fixes related to this, and the loading spinner.
* `wp.revisions.loadAll()` now returns a promise representing whether or not all revisions could be loaded.

Fixes #24758.

git-svn-id: http://core.svn.wordpress.org/trunk@24732 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-18 16:35:19 +00:00
Mark Jaquith 32522054c8 Revisions: use escaped templating for some of the tags.
Fixes #24775.

git-svn-id: http://core.svn.wordpress.org/trunk@24729 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-18 14:01:58 +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 13a7d2a743 Revisions: Loading indicator, cleanup, bug fixes.
* Loading indicator when the user is waiting for a trip to the server.
* Bug fixes for diff priming.
* Fix the date display.
* Forget about local comparator, instead order by `modified` on the server.
* Initialize the frame model before the view (this was the source of a LOT of heartache).

git-svn-id: http://core.svn.wordpress.org/trunk@24667 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-12 05:11:56 +00:00
Mark Jaquith c44ce3b6e6 Revisions: real URLs and preloading of the requested diff.
* Real URLs are being used now, using pushState. `?revision={id}` or `?from={from}&to={to}`.
* Drop the redundant `action=edit` from the URLs (this is the default).
* The initial comparison is preloaded, whether a single revision or a compare-two situation.

See #24425.

git-svn-id: http://core.svn.wordpress.org/trunk@24664 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-11 22:56:48 +00:00
Andrew Nacin bcd2644d92 Proper translation of '<time> ago' in revisions. props johnbillion, fixes #24721.
git-svn-id: http://core.svn.wordpress.org/trunk@24643 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-10 16:15:18 +00:00