Commit Graph

33 Commits

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


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


git-svn-id: http://core.svn.wordpress.org/trunk@45401 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-02 23:42:58 +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
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
c90cfa3b50 General: Fix some precision alignment formatting warnings.
The WPCS `WordPress.WhiteSpace.PrecisionAlignment` rule throws warnings for a bunch of code that will likely cause issues for `wpcbf`. Fixing these manually beforehand gives us better auto-fixed results later.

See #41057.


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


git-svn-id: http://core.svn.wordpress.org/trunk@42057 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-26 23:57:55 +00:00
John Blackbourn
4a16295dc5 Docs: Standardise the format used for documenting parameters passed by reference.
See #35974, #41017

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


git-svn-id: http://core.svn.wordpress.org/trunk@41522 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-02 22:14:46 +00:00
Drew Jaynes
0860bb2771 Docs: Remove @access notations from method DocBlocks in wp-includes/* classes.
Prior to about 2013, many class methods lacked even access modifiers which made the `@access` notations that much more useful. Now that we've gotten to a point where the codebase is more mature from a maintenance perspective and we can finally remove these notations. Notable exceptions to this change include standalone functions notated as private as well as some classes still considered to represent "private" APIs.

See #41452.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-27 00:41:44 +00:00
Aaron Jorbin
a8802232ec Make sure rewrite rules are not written until wp_loaded has fired
If a plugin attempts to change the rewrite rules to early, other plugins may have their rules inadvertently discarded. Additionally, some function such as `url_to_post_id` cause a rewrite rule lookup that could cause this accidental flushing. This forces the flushing to only occur once `wp_loaded` has been fired.

Fixes #37892.
Props Chouby.


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


git-svn-id: http://core.svn.wordpress.org/trunk@38694 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-07 19:44:28 +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
fb6d8bae49 Docs: Apply inline @see tags to hooks referenced in DocBlocks for core classes.
Applying these specially-crafted `@see` tags allows the Code Reference parser to recognize and link these elements as actions and filters.

See #36921.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37507 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-23 18:54:27 +00:00
Drew Jaynes
602b51a209 Docs: Standardize filter docs in core classes in wp-includes/* to use third-person singular verbs per the inline documentation standards for PHP.
See #36913.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37460 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 18:15:28 +00:00
Drew Jaynes
b1804afeaf Docs: Standardize on 'backward compatibility/compatible' nomenclature in core inline docs.
Also use 'back-compat' in some inline comments where backward compatibility is the subject and shorthand feels more natural.

Note: 'backwards compatibility/compatibile' can also be considered correct, though it's primary seen in regular use in British English.

Props ocean90.
Fixes #36835.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37397 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-13 18:41:31 +00:00
John Blackbourn
53851c612c Rewrite Rules: Allow rewrite rules to work in nested WordPress installations on IIS.
Props WiZZarD_
Fixes #35558

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


git-svn-id: http://core.svn.wordpress.org/trunk@36921 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-10 20:01:28 +00:00
Pascal Birchler
b0b13aff2f Embeds: Allow embedding static front pages and pages having a child page with an embed slug.
This makes `embed` a special slug that can't be used for new pages/posts. When `https://example.com/foo/embed/` is an existing page, embeds fall back to `https://example.com/foo/?embed=true`.
Adds unit tests.

Fixes #34971.
Built from https://develop.svn.wordpress.org/trunk@36307


git-svn-id: http://core.svn.wordpress.org/trunk@36274 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-15 07:56:26 +00:00
Pascal Birchler
d63ae29fac After [36254], commit all the necessary files and not just the unit test.
Built from https://develop.svn.wordpress.org/trunk@36255


git-svn-id: http://core.svn.wordpress.org/trunk@36222 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-10 19:07:26 +00:00
Pascal Birchler
f079f57357 Rewrite: Add a remove_rewrite_tag() helper function.
It can be used to properly remove registered rewrite tags. Adds unit tests.

Fixes #35236.
Built from https://develop.svn.wordpress.org/trunk@36217


git-svn-id: http://core.svn.wordpress.org/trunk@36184 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-07 09:39:27 +00:00
Pascal Birchler
dbe28bf8e3 Rewrite: Add a remove_permastruct() helper function.
It can be used to remove permastructs that were added using `add_permastruct()`.

Fixes #35235.
Built from https://develop.svn.wordpress.org/trunk@36181


git-svn-id: http://core.svn.wordpress.org/trunk@36148 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-06 07:40:26 +00:00
Drew Jaynes
10367a4692 Docs: Add missing parameter and return descriptions to the DocBlock for WP_Rewrite::iis7_url_rewrite_rules().
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35905 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-14 23:58:27 +00:00
Drew Jaynes
cc4c59a1fa Docs: Add a couple of strategically-placed spaces in WP_Rewrite.
Fixes #34218.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34929 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-08 22:07:24 +00:00
Drew Jaynes
aab0da2e17 Docs: Mark the optional parameters for WP_Rewrite::generate_rewrite_rules() as such, and improve overall formatting.
Also brings in the list of acceptable constants for the `$ep_mask` parameter.

See #34218.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34927 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-08 21:49:26 +00:00
Drew Jaynes
e147ba60b0 Docs: Convert the description for the optional $args parameter in WP_Rewrite::add_permastruct() into a hash notation.
See #34218.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34925 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-08 21:35:26 +00:00
Drew Jaynes
9f4d5731e9 Docs: Improve more formatting and syntax for inline comments in WP_Rewrite.
See #34218.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34923 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-08 21:24:24 +00:00
Drew Jaynes
17010f97c7 Docs: Add saner formatting and make readability improvements to a variety of inline comments in WP_Rewrite and WP_Rewrite::generate_rewrite_rules().
See #34218.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-08 21:18:25 +00:00
Sergey Biryukov
0b13fdf2fc Docs: Fix typo in [34944].
See #34218.
Built from https://develop.svn.wordpress.org/trunk@34955


git-svn-id: http://core.svn.wordpress.org/trunk@34920 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-08 21:00:26 +00:00
John Blackbourn
db4f4c5538 Improve the parameter names and inline documentation for add_rewrite_rule(), WP_Rewrite::add_rule(), and WP_Rewrite::add_external_rule().
Fixes #34197

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


git-svn-id: http://core.svn.wordpress.org/trunk@34911 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-08 17:28:25 +00:00
Drew Jaynes
305ae14461 Docs: Fix third-person singular verbs in DocBlock summaries throughout WP_Rewrite.
See #34218.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34909 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-08 17:12:24 +00:00
Drew Jaynes
d2dee54669 Docs: Relocate some more DocBlock-level @see tags and add some missing @access tags in WP_Rewrite.
See #34218.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34906 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-08 16:51:24 +00:00
Drew Jaynes
1e6f1c9a9b Docs: Relocate some DocBlock-level @see tags in WP_Rewrite.
See #34218.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34905 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-08 16:49:24 +00:00
Drew Jaynes
02645d5711 Docs: Remove invalid inline @link tags from a variety of DocBlocks in WP_Rewrite.
See #34218.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34904 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-08 16:47:25 +00:00
Drew Jaynes
d1fd329ea2 Docs: Add a file header to wp-includes/class-wp-rewrite.php.
See #34218.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34903 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-08 16:41:26 +00:00
Gary Pendergast
83c3e3e00e Embeds: Add oEmbed provider support.
For the past 6 years, WordPress has operated as an oEmbed consumer, allowing users to easily embed content from other sites. By adding oEmbed provider support, this allows any oEmbed consumer to embed posts from WordPress sites.

In addition to creating an oEmbed provider, WordPress' oEmbed consumer code has been enhanced to work with any site that provides oEmbed data (as long as it matches some strict security rules), and provides a preview from within the post editor.

For security, embeds appear within a sandboxed iframe - the iframe content is a template that can be styled or replaced entirely by the theme on the provider site.

Props swissspidy, pento, melchoyce, netweb, pfefferle, johnbillion, extendwings, davidbinda, danielbachhuber, SergeyBiryukov, afercia

Fixes #32522.


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


git-svn-id: http://core.svn.wordpress.org/trunk@34868 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-07 10:36:25 +00:00
Scott Taylor
619063b4e2 Rewrite: allow add_rewrite_rule|WP_Rewrite::add_rule() to accept an associative array for the value of $redirect instead of requiring a query string.
Adds unit tests.

Props scribu, DrewAPicture.
Fixes #16840.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34672 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-30 01:11:25 +00:00
Scott Taylor
175d476b0e Canonical/Rewrite: sanity check posts that are paged with <!--nextpage-->. Page numbers past the max number of pages are returning the last page of content and causing infinite duplicate content.
Awesome rewrite bug: the `page` query var was being set to `'/4'` in `$wp`. When cast to `int`, it returns `0` (Bless you, PHP). `WP_Query` calls `trim( $page, '/' )` when setting its own query var. The few places that were checking `page`	before posts were queried now have sanity checks, so that these changes work without flushing rewrites.	

Adds/updates unit tests.

Props wonderboymusic, dd32.
See #11694.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34456 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-24 14:04:24 +00:00
Scott Taylor
207abc77e1 Rewrite: move WP_Rewrite into its own file. rewrite.php loads the new files, so this is 100% BC if someone is loading rewrite.php directly. New files created using svn cp.
The rewrite functions have all kinds of cross-dependencies (like `WP_Query`), so loading the file by itself would have been bizarre (and still is).

Creates: 
`rewrite-constants.php` 
`rewrite-functions.php` 
`class-wp-rewrite.php` 

`rewrite.php` contains only top-level code. Class file only contains the class. Functions file only contains functions.

See #33413.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33719 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-26 04:42:20 +00:00