Commit Graph

216 Commits

Author SHA1 Message Date
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
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
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
Peter Wilson
e6ccdf161f General: Further improve error messages following [42648].
Props kristastevens, melchoyce.
Fixes #38332 for trunk.


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


git-svn-id: http://core.svn.wordpress.org/trunk@42547 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-19 02:13:32 +00:00
Peter Wilson
0d39b35c11 General: Replace Cheatin’ uh? with friendlier error messages.
While intended as a playful error message, `Cheatin’ uh?` can be interpreted as insulting or accusatory in an already stressful situation. This replaces Cheatin’ with more meaningful error messages, depending on the error that occurs.

Props ElectricFeet, EricMeyer, karmatosed, dd32, BandonRandon, melchoyce for language; dmsnell for original patch; peterwilsoncc.
Fixes #38332.


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


git-svn-id: http://core.svn.wordpress.org/trunk@42477 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-05 02:30: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
f14b24792a Press This: Use "installation" when referring to the act of installing Press This.
Props Presskopp
Fixes #41620

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


git-svn-id: http://core.svn.wordpress.org/trunk@41628 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-09 14:08:48 +00:00
Andrew Ozz
a5f8097899 Retire Press This and extract it to a plugin. First run.
Props kraftbj, azaozz.
See #41689.
Built from https://develop.svn.wordpress.org/trunk@41584


git-svn-id: http://core.svn.wordpress.org/trunk@41417 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-24 14:22:54 +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
69e7fe3c5b Press This: don't check for already-hoisted global in press-this.php.
See #37699.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38407 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-31 06:29:28 +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
Scott Taylor
85d63f2af5 Press This: the file for the WP_Press_This class should not produce side effects. Similar to what we did in r38355 for WP_Site_Icon, drop the instances of global instantiation for $wp_press_this via loading the file. The variable can be set inline when necessary. In most of those places, if the global is already set, the file does not load and stomp it currently.
See #37699.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38338 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-27 06:07:29 +00:00
Dominik Schilling
25e66e4f1e Text Changes: Unify permission error messages.
The new format looks like "Sorry, you are not allowed to <action>.". This provides a consistent experience for all error messages related to missing permissions. It also reduces the number of similar strings and allows translators to provide a consistent style in their language.

Props ramiy, Presskopp.
Fixes #34521.
Built from https://develop.svn.wordpress.org/trunk@37914


git-svn-id: http://core.svn.wordpress.org/trunk@37855 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-29 15:16:29 +00:00
Sergey Biryukov
3e0929740e Provide more helpful feedback than just "Cheatin' uh?" for permission errors in wp-admin/press-this.php.
props ericlewis, kraftbj, lukecarbis, mrmist.
fixes #33676. see #14530.
Built from https://develop.svn.wordpress.org/trunk@33865


git-svn-id: http://core.svn.wordpress.org/trunk@33833 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-02 18:38:21 +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
Andrew Ozz
1857055bb8 PressThis v2, first run. Props michael-arestad, stephdau, marcelomazza, DrewAPicture, iseulde, afercia, kraftbj, rachelbaker, AramZS, dd32. See #31373.
Built from https://develop.svn.wordpress.org/trunk@31534


git-svn-id: http://core.svn.wordpress.org/trunk@31515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 01:50:26 +00:00
Scott Taylor
af0e5cc851 Inline <script>s that are only printed in the admin for pages that are served with the HTML5 doctype absolutely do not need CDATA comments.
Props tw2113 for the initial patch.
See #18788.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31015 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-03 05:46:25 +00:00
Andrew Nacin
432e4dcb50 Press This: Ensure the error message is printed. props johnbillion
Built from https://develop.svn.wordpress.org/trunk@30438


git-svn-id: http://core.svn.wordpress.org/trunk@30433 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-20 13:58:23 +00:00
John Blackbourn
d88ed475b0 Switch to a 403 response code in places where it is more appropriate than a 500 due to permissions errors.
Fixes #10551
Props nacin

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


git-svn-id: http://core.svn.wordpress.org/trunk@30355 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-16 06:16:22 +00:00
Sergey Biryukov
15a1e0731e Use proper functions for escaped translations.
pros jcastaneda.
fixes #30012.
Built from https://develop.svn.wordpress.org/trunk@29961


git-svn-id: http://core.svn.wordpress.org/trunk@29708 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-18 20:11:18 +00:00
Andrew Ozz
8253a54416 PressThis: when the Text editor is the default, run the initial textarea content through pre_wpautop() to convert the paragraph tags. Fixes #29081.
Built from https://develop.svn.wordpress.org/trunk@29334


git-svn-id: http://core.svn.wordpress.org/trunk@29114 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-01 00:55:15 +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
Helen Hou-Sandí
56a2b67e21 Make sure inputs in Press This have a type so they are styled appropriately. see #18380.
Built from https://develop.svn.wordpress.org/trunk@27772


git-svn-id: http://core.svn.wordpress.org/trunk@27609 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-27 02:39:14 +00:00
Drew Jaynes
19daa96fb5 Fix typo from [27695]. See #26924.
Built from https://develop.svn.wordpress.org/trunk@27696


git-svn-id: http://core.svn.wordpress.org/trunk@27535 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-25 08:07:15 +00:00
Drew Jaynes
7dc9b02577 Correct misleading verbiage in 'print' hook docs.
Standardizes 'print' hook docs on the concept that hooks are fired when scripts and styles are printed.

Props ericlewis for the initial patch.
Fixes #26924.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27534 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-25 08:05:15 +00:00
Drew Jaynes
cb8951b0b3 Remove all @package and @subpackage PHPDoc tags not at the file- or class-levels in core.
See #27200.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27119 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-25 17:14:14 +00:00
Andrew Ozz
915607ca0d Thickbox is needed for the media modal back-compat. Are there plugins that still use this? Also needed for PressThis. See #24067.
Built from https://develop.svn.wordpress.org/trunk@26898


git-svn-id: http://core.svn.wordpress.org/trunk@26781 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-01-02 22:49:09 +00:00
Matt Thomas
2c7b69f7c1 In Press This, extend the sidebar for ru_RU. Fixes #26508, props SergeyBiryukov.
Built from https://develop.svn.wordpress.org/trunk@26836


git-svn-id: http://core.svn.wordpress.org/trunk@26723 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-09 19:23:10 +00:00
Matt Thomas
01fdd027f0 Press This fixes:
* Override responsive styles for the Press This window
* Remove the old header logo in Press This
* Add the new Dashicon WP logo

See #25858.


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


git-svn-id: http://core.svn.wordpress.org/trunk@26331 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-27 19:16:10 +00:00
Sergey Biryukov
38c5e9a668 Inline documentation for hooks in wp-admin/press-this.php.
props ninio, kpdesign.
fixes #25731.
Built from https://develop.svn.wordpress.org/trunk@26237


git-svn-id: http://core.svn.wordpress.org/trunk@26144 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-16 19:13: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
Andrew Nacin
1700a5efb1 Press This: Add admin_head-like hooks that are specific to the page.
props sillybean.
fixes #18843.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25111 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-26 21:00:09 +00:00
Sergey Biryukov
c3b321d0bd Consistently use get_post_format_string() to get Standard post format name with the correct context. props johnbillion. fixes #23503.
git-svn-id: http://core.svn.wordpress.org/trunk@24522 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-06-27 06:56:45 +00:00
Sergey Biryukov
57c10eadbb Use ellipsis instead of three dots. props tjsingleton, jordie23, wojtek.szkutnik, DrewAPicture, SergeyBiryukov. see #8714.
git-svn-id: http://core.svn.wordpress.org/trunk@24207 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-05-08 21:27:31 +00:00
Andrew Nacin
b34ca3234e Remove manual printing of userSettings as utils.js receives this as inline script data (since 3.5). see #24210.
git-svn-id: http://core.svn.wordpress.org/trunk@24187 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-05-07 15:49:20 +00:00
Ryan Boren
f3a83744e9 Use wp_unslash() instead of stripslashes() and stripslashes_deep(). Use wp_slash() instead of add_magic_quotes().
git-svn-id: http://core.svn.wordpress.org/trunk@23567 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-01 17:14:09 +00:00
Ryan Boren
43a7e695e9 Revert 23416, 23419, 23445 except for wp_reset_vars() changes. We are going a different direction with the slashing cleanup, so resetting to a clean slate. see #21767
git-svn-id: http://core.svn.wordpress.org/trunk@23554 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-01 16:28:40 +00:00
Ryan Boren
cc5ed3a485 Change all core API to expect unslashed rather than slashed arguments.
The exceptions to this are update_post_meta() and add_post_meta() which are often used by plugins in POST handlers and will continue accepting slashed data for now.

Introduce wp_upate_post_meta() and wp_add_post_meta() as unslashed alternatives to update_post_meta() and add_post_meta(). These functions could become methods in WP_Post so don't use them too heavily yet.

Remove all escape() calls from wp_xmlrpc_server. Now that core expects unslashed data this is no longer needed.

Remove addslashes(), addslashes_gpc(), add_magic_quotes() calls on data being prepared for handoff to core functions that until now expected slashed data. Adding slashes in no longer necessary.

Introduce wp_unslash() and use to it remove slashes from GPCS data before using it in core API. Almost every instance of stripslashes() in core should now be wp_unslash(). In the future (a release or three) when GPCS is no longer slashed, wp_unslash() will stop stripping slashes and simply return what is passed. At this point wp_unslash() calls can be removed from core.

Introduce wp_slash() for slashing GPCS data. This will also turn into a noop once GPCS is no longer slashed. wp_slash() should almost never be used. It is mainly of use in unit tests.

Plugins should use wp_unslash() on data being passed to core API.

Plugins should no longer slash data being passed to core. So when you get_post() and then wp_insert_post() the post data from get_post() no longer needs addslashes(). Most plugins were not bothering with this. They will magically start doing the right thing. Unfortunately, those few souls who did it properly will now have to avoid calling addslashes() for 3.6 and newer.

Use wp_kses_post() and wp_kses_data(), which expect unslashed data, instead of wp_filter_post_kses() and wp_filter_kses(), which expect slashed data. Filters are no longer passed slashed data.

Remove many no longer necessary calls to $wpdb->escape() and esc_sql().

In wp_get_referer() and wp_get_original_referer(), return unslashed data.

Remove old stripslashes() calls from WP_Widget::update() handlers. These haven't been necessary since WP_Widget.

Switch several queries over to prepare().

Expect something to break.

Props alexkingorg
see #21767


git-svn-id: http://core.svn.wordpress.org/trunk@23416 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-14 22:51:06 +00:00
Ryan Boren
d4abd95449 Scope button classes so they can be used on the frontend without interfering with theme styles.
Props helenyhou, koopersmith
fixes #22644


git-svn-id: http://core.svn.wordpress.org/trunk@22948 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-30 13:40:59 +00:00
Andrew Nacin
61caecfa93 Use the create_posts post type cap in more places. Remove the janky create_posts meta cap. see #16714.
git-svn-id: http://core.svn.wordpress.org/trunk@22908 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-28 22:28:20 +00:00
Andrew Nacin
2aa561013b Extend Press This by a few pixels to allow longer strings. props SergeyBiryukov. fixes #20975.
git-svn-id: http://core.svn.wordpress.org/trunk@22427 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-07 19:27:19 +00:00
Andrew Ozz
cbd737470c Kill use of colons in class names, props SergeyBiryukov, fixes #21152
git-svn-id: http://core.svn.wordpress.org/trunk@22396 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-06 01:01:52 +00:00
Ryan Boren
a550a6d489 Use the create_posts capability in more places.
In get_post_type_capabilities(), make sure create_posts reflects customizations to the edit_posts capability when create_posts is not specifically set.


git-svn-id: http://core.svn.wordpress.org/trunk@22291 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-24 22:15:43 +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 Ozz
563c7caac5 Main editor: maintain the height when switching Visual to Text and back, save the height when resizing as user state, output the height in the textarea tag when loading, (thanks @nacin for the help), fixes #21718
git-svn-id: http://core.svn.wordpress.org/trunk@22007 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-26 03:30:21 +00:00
azaozz
34535097b7 Remove nearly all tabindex attributes from the admin, leaving them only where absolutely necessary (for now that's only the toolbar).
Add tabindex="-1" for the menu images links to avoid double tab stops there when the menu is expanded.

Fix/add auto-focus on the first input fields on the Add/Edit Post, all taxonomy, all edit taxonomy, Log In and Edit Comment screens.

See #21340.

git-svn-id: http://core.svn.wordpress.org/trunk@21311 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-24 00:15:15 +00:00
markjaquith
6a1d888ea5 Better image extension regexes, so we don't just grab the "jpe" from "jpeg" files in media_sideload_image(). props sivel. fixes #16693
git-svn-id: http://core.svn.wordpress.org/trunk@21219 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-05 20:51:55 +00:00
nacin
a9ee3b61f5 Remove charset attribute from script elements. props neoxx, fixes #21146.
git-svn-id: http://core.svn.wordpress.org/trunk@21204 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-03 13:27:14 +00:00