Commit Graph

46 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
Sergey Biryukov b80ce60f70 Coding Standards: Use pre-increment/decrement for stand-alone statements.
Note: This is enforced by WPCS 3.0.0:

1. There should be no space between an increment/decrement operator and the variable it applies to.
2. Pre-increment/decrement should be favoured over post-increment/decrement for stand-alone statements. “Pre” will in/decrement and then return, “post” will return and then in/decrement. Using the “pre” version is slightly more performant and can prevent future bugs when code gets moved around.

References:
* [https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#increment-decrement-operators WordPress PHP Coding Standards: Increment/decrement operators]
* [https://github.com/WordPress/WordPress-Coding-Standards/pull/2130 WPCS: PR #2130 Core: add sniffs to check formatting of increment/decrement operators]

Props jrf.
See #59161, #58831.
Built from https://develop.svn.wordpress.org/trunk@56549


git-svn-id: http://core.svn.wordpress.org/trunk@56061 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-09 09:28:26 +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 0e3147c40e Coding Standards: Replace alias PHP functions with the canonical names.
Using the canonical function name for PHP functions is strongly recommended, as aliases may be deprecated or removed without (much) warning.

This replaces all uses of the following:
* `join()` with `implode()`
* `sizeof()` with `count()`
* `is_writeable()` with `is_writable()`
* `doubleval()` with a `(float)` cast

In part, this is a follow-up to #47746.

Props jrf.
See #50767.
Built from https://develop.svn.wordpress.org/trunk@49193


git-svn-id: http://core.svn.wordpress.org/trunk@48955 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-18 17:27:06 +00:00
Sergey Biryukov aa69c25d5f Coding Standards: Use strict comparison in some `wp-admin` files.
Props pikamander2, mukesh27, SergeyBiryukov.
Fixes #49239.
Built from https://develop.svn.wordpress.org/trunk@47785


git-svn-id: http://core.svn.wordpress.org/trunk@47561 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-12 18:32:08 +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
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 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
Drew Jaynes 6c7148943b Docs: Standardize capitalization of Ajax throughout core documentation per the core spelling guide.
Ajax, while considered an acronym for Asynchronous JavaScript and XML, is most commonly capitalized only in the first character.

Part props ocean90.
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37969 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-10 00:51:30 +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 f5d23b82bd In `wp-admin/link.php`, `break` is unreachabled after `exit`.
See #27882.


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


git-svn-id: http://core.svn.wordpress.org/trunk@28135 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-06 18:06:14 +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
Andrew Nacin 83e0ce2ac1 Remove unused variables reset by wp_reset_vars(). Many of these haven't been used since b2. see #21767.
git-svn-id: http://core.svn.wordpress.org/trunk@23445 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-16 18:28:41 +00:00
Ryan Boren e55bebac25 Show a better message ondmins on link-manager.php, link-add.php, link.php when links are disabled.
Props nacin
fixes #22569


git-svn-id: http://core.svn.wordpress.org/trunk@22855 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-27 00:20:27 +00:00
azaozz 6aaf0dad43 Add the jQuery UI Touch Punch plugin to handle dragging on mobile devices, props georgestephanis, see #20014
git-svn-id: http://svn.automattic.com/wordpress/trunk@20433 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-11 02:20:51 +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
dd32 4f3b9f7b7f Use Absolute URL's & API's in header redirects in more locations. See #14062
git-svn-id: http://svn.automattic.com/wordpress/trunk@16008 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-10-27 10:43:43 +00:00
nacin f9df8a36ae s/blog/site/ in more places. props PeteMall, see #11644.
git-svn-id: http://svn.automattic.com/wordpress/trunk@14313 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-04-30 01:54:32 +00:00
nacin 65d12646e1 Don't show "Link added." in link-add.php if an empty form was submitted. fixes #12262.
git-svn-id: http://svn.automattic.com/wordpress/trunk@13960 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-04-03 07:48:30 +00:00
ryan 1b236b4b9d Fix parents for page and link editors. fixes #8421
git-svn-id: http://svn.automattic.com/wordpress/trunk@9966 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2008-11-29 17:51:30 +00:00
ryan cc7c443f62 Move screen_meta() to admin header. Add all meta boxes before requiring admin-header.
git-svn-id: http://svn.automattic.com/wordpress/trunk@9620 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2008-11-11 22:40:16 +00:00
ryan 2fdde1e736 Notice fixes from filosofo and Viper007Bond. see #7509
git-svn-id: http://svn.automattic.com/wordpress/trunk@9506 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2008-11-04 03:22:24 +00:00
azaozz 39e0608b33 Some css cleanup and fixes after the merge, see #7552
git-svn-id: http://svn.automattic.com/wordpress/trunk@8697 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2008-08-21 02:25:14 +00:00
ryan d3b414932c Collapse crazyhorse to trunk. Incoming! see #7552
git-svn-id: http://svn.automattic.com/wordpress/trunk@8691 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2008-08-20 21:42:31 +00:00
westi 7f894ae416 phpdoc for wp-admin. See #7496 props santosj.
git-svn-id: http://svn.automattic.com/wordpress/trunk@8645 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2008-08-14 06:30:38 +00:00
ryan bc07ef1efe Theme preview and thickbox CSS cleanup. Props azaozz. see #5486
git-svn-id: http://svn.automattic.com/wordpress/trunk@7961 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2008-05-20 17:19:33 +00:00
ryan a1449b1ebc Enqueue XFN for link pages. Props mdawaffe. fixes #6217
git-svn-id: http://svn.automattic.com/wordpress/trunk@7196 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2008-03-10 05:44:56 +00:00
ryan 4a8632e6fa Fix edit link page menu parentage.
git-svn-id: http://svn.automattic.com/wordpress/trunk@6934 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2008-02-20 07:44:25 +00:00
ryan 1266b9c53f Update edit link pages. Link categories need work.
git-svn-id: http://svn.automattic.com/wordpress/trunk@6695 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2008-01-31 20:04:54 +00:00
matt 2073c22bbd Post screen improvements^H^H^H, er, changes. Will file tickets for todos.
git-svn-id: http://svn.automattic.com/wordpress/trunk@6544 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2008-01-03 08:03:29 +00:00
ryan 2762527a1e Add current_user_can() checks to link.php. Props DD32. fixes #4627
git-svn-id: http://svn.automattic.com/wordpress/trunk@6255 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-10-16 16:09:01 +00:00
ryan 4214428322 Separate AJAX cat adder into post and link flavors. see #4189
git-svn-id: http://svn.automattic.com/wordpress/trunk@5637 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2007-06-02 02:53:09 +00:00
ryan ca40a96b1f Standardize on Links instead of Bookmarks until we change our minds again.
git-svn-id: http://svn.automattic.com/wordpress/trunk@4499 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-11-20 02:17:07 +00:00
ryan 9f534ebae6 Remove trailing spaces and convert spaces to tabs. Props Nazgul. fixes #986
git-svn-id: http://svn.automattic.com/wordpress/trunk@4495 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-11-19 07:56:05 +00:00
ryan e55c8a5dc9 Exit after redirect.
git-svn-id: http://svn.automattic.com/wordpress/trunk@4468 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-11-15 00:02:28 +00:00
ryan 4e5380a24a wp_die() improvements from Sewar. fixes #2902
git-svn-id: http://svn.automattic.com/wordpress/trunk@4006 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-10 05:29:10 +00:00
ryan 42557940a1 Use wp_die(). Props filosofo. fixes #2914
git-svn-id: http://svn.automattic.com/wordpress/trunk@3985 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-05 22:00:03 +00:00
ryan 55af15d623 wp_reset_vars() from Sewar. fixes #2888
git-svn-id: http://svn.automattic.com/wordpress/trunk@3946 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-07-03 19:03:37 +00:00
ryan ff19f4b5a5 Use wp_redirect().
git-svn-id: http://svn.automattic.com/wordpress/trunk@3928 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-27 05:38:56 +00:00
ryan ec9b6242a3 Use wp_get_referer(). fixes #2800
git-svn-id: http://svn.automattic.com/wordpress/trunk@3918 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-24 07:34:35 +00:00
ryan a481db2b6a Script loader fixes from mdawaffe. fixes #2765
git-svn-id: http://svn.automattic.com/wordpress/trunk@3830 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-06-01 21:51:20 +00:00
ryan 96c3f739a8 Update nonce action strings. Props mdawaffe.
git-svn-id: http://svn.automattic.com/wordpress/trunk@3804 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-05-26 23:08:05 +00:00
ryan 4d49e98fe4 Script loader from mdawaffe. #2701
git-svn-id: http://svn.automattic.com/wordpress/trunk@3788 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-05-22 17:16:05 +00:00
ryan 3f57a94f4c Nonce from above. #2678
git-svn-id: http://svn.automattic.com/wordpress/trunk@3759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-05-02 22:36:06 +00:00
ryan e9c75f4bd2 Bookmark/link rework. #2499
git-svn-id: http://svn.automattic.com/wordpress/trunk@3570 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2006-02-27 04:57:30 +00:00