Commit Graph

55 Commits

Author SHA1 Message Date
Sergey Biryukov
dcb08f0637 Docs: Fix placement of some duplicate hook references.
Hook documentation should be on the line directly above the line containing the `do_action()` or `apply_filters()` call. The CS auto-fixing, which changed some inconsistent function calls to multi-line function calls, is part of the reason why this was no longer the case for a select group of duplicate hook references.

Includes minor code layout fixes.

See #47110.
Built from https://develop.svn.wordpress.org/trunk@46088


git-svn-id: http://core.svn.wordpress.org/trunk@45900 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-10 19:23:55 +00:00
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
Sergey Biryukov
c89962511b Script/Style Dependencies: Simplify some logic in WP_Styles::do_item().
Combine repetitive assignments, make the code more consistent with `WP_Scripts::do_item()`.

See #44551.
Built from https://develop.svn.wordpress.org/trunk@43564


git-svn-id: http://core.svn.wordpress.org/trunk@43393 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-08-11 17:42:24 +00:00
John Blackbourn
2361ca884f Docs: Document more parameters and properties using typed array notation.
See #41756

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


git-svn-id: http://core.svn.wordpress.org/trunk@42706 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-25 19:33:31 +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
9fdbe6538e Docs: Remove & prefixes from parameter documentation to avoid doc parsing errors.
Props sudar for the original patch.

See #35974

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


git-svn-id: http://core.svn.wordpress.org/trunk@41520 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-02 22:03:33 +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
Drew Jaynes
1d95dcfa2c Docs: Remove superfluous @package WordPress and @subpackage notations used outside of file headers in a variety of core files.
Per the inline documentation standards for PHP, there should only be one `@package` and/or `@subpackage` notation per file, and only in the file header.

See #41017.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40838 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-01 16:58:42 +00:00
Drew Jaynes
9cb5247392 Docs: Standardize filter docs in remaining wp-includes/* files to use third-person singular verbs per the inline documentation standards for PHP.
See #36913.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37486 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 18:50:28 +00:00
Dominik Schilling
f4ef187c2c Dependencies: Improve group processing of script dependencies.
This is a follow-up to [36604].

When processing dependencies `$this->group` will be the minimum of the script's registered group and all preceding siblings. This is wrong because only a scripts ancestors in the dependency chain should affect where it is loaded. Effectively `$this->group` introduced a form of global state which potentially corrupted the group of dependencies. Sorting covers up this problem.
The issue in #35873 was that script were not moving their dependencies to a lower group when necessary.

The fix:
* In `WP_Dependencies::all_deps()` pass the new `$group` value to `WP_Dependencies::all_deps()`. Previously the wrong value was passed because the parent script could have moved with `WP_Scripts::set_group()`.
* In `WP_Scripts::all_deps()` pass the `$group` parameter to `WP_Dependencies::all_deps()` so it doesn't always use `false` for `$group`. Same for `WP_Styles::all_deps()`.

Props stephenharris, gitlost.
Fixes #35956.
Built from https://develop.svn.wordpress.org/trunk@36871


git-svn-id: http://core.svn.wordpress.org/trunk@36838 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-06 19:50:27 +00:00
Dominik Schilling
820c9e2fca Docs: Improve inline docs for WP_Dependencies, WP_Styles, and WP_Scripts.
Also, make them and related files part of WordPress.

See #35964.
Built from https://develop.svn.wordpress.org/trunk@36744


git-svn-id: http://core.svn.wordpress.org/trunk@36711 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-27 20:34:29 +00:00
Dominik Schilling
d81ebb08fb Docs: Add missing @since tags to WP_Styles properties/methods.
See #35964.
Built from https://develop.svn.wordpress.org/trunk@36733


git-svn-id: http://core.svn.wordpress.org/trunk@36700 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-26 14:39:26 +00:00
Dominik Schilling
a04b869652 Styles: Pass the media attribute as an argument to the style_loader_tag filter.
Props sebastian.pisula.
Fixes #34765.
Built from https://develop.svn.wordpress.org/trunk@36592


git-svn-id: http://core.svn.wordpress.org/trunk@36559 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-19 21:05:26 +00:00
Dominik Schilling
9d8204467c Styles: Bail if WP_Styles::_css_href() returns an empty value.
The style `colors` gets registered with `true` as the source value which gets handled later by `wp_style_loader_src()`, a callback for the `style_loader_src` filter in `WP_Styles::_css_href()`. `wp_style_loader_src()` may return false, for example for the default color scheme.

This was removed in [36550].

See #35229.
Built from https://develop.svn.wordpress.org/trunk@36590


git-svn-id: http://core.svn.wordpress.org/trunk@36557 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-19 20:34:26 +00:00
Dominik Schilling
bc5d22266d Script/Style Dependencies: Make sure that inline styles for handles without a source are printed.
This prevents breaking plugins which are adding inline styles to the `wp-admin` handle after [36341].

Props dd32, ocean90.
Fixes #35229.
Built from https://develop.svn.wordpress.org/trunk@36550


git-svn-id: http://core.svn.wordpress.org/trunk@36517 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-17 17:11:26 +00:00
Drew Jaynes
b72f822a69 Add a missing $html parameter variable in the hook docs for the style_loader_tag filter.
See #32246. See #32891.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33194 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-13 21:03:24 +00:00
Boone Gorges
a680859400 Pass stylesheet URL as an argument to 'style_loader_tag' filter.
This change brings the filter's signature in line with 'script_loader_tag'.

Props nicholas_io.
Fixes #32660.
Built from https://develop.svn.wordpress.org/trunk@32898


git-svn-id: http://core.svn.wordpress.org/trunk@32869 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-21 19:35:26 +00:00
Scott Taylor
c502a281bb After [32656], add @access annotations to methods that have no doc block in wp-includes/*.
Makes it easier to search for no doc blocks via `}[\n\t\r ]+(protected|private|public)`.

See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32627 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-29 21:37:24 +00:00
Scott Taylor
451914addb Add missing doc blocks to class.wp-(scripts|styles).php.
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32536 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-24 05:05:26 +00:00
Scott Taylor
f7aef5b69a Ensure that inline styles attached to conditional stylesheets are also conditional.
Adds unit test.

Props georgestephanis.
Fixes #29180.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31012 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-03 04:10:21 +00:00
Scott Taylor
e619abda6e Improve various @param docs for src/wp-includes/*.
See #30224.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30671 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-01 01:34:24 +00:00
Sergey Biryukov
beca5ad5a3 wp_add_inline_style():
* Change the `wp-inline-style-$handle` class added in [29956] to `$handle-inline-css` for consistency with existing patterns.
* Add the ID attribute when concatenation is enabled as well.

props georgestephanis.
see #30032.
Built from https://develop.svn.wordpress.org/trunk@29958


git-svn-id: http://core.svn.wordpress.org/trunk@29705 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-18 19:04:20 +00:00
Sergey Biryukov
26c8088a97 Add ID attribute to style element from wp_add_inline_style().
props westonruter.
fixes #30032.
Built from https://develop.svn.wordpress.org/trunk@29956


git-svn-id: http://core.svn.wordpress.org/trunk@29703 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-18 17:58:19 +00:00
Scott Taylor
5030fdef62 Add missing access modifiers to methods in WP_Scripts and WP_Styles.
See #27881, #22234.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28344 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-19 06:17:14 +00:00
Drew Jaynes
aa20678c48 Ensure the style_loader_tag filter hook is only documented once.
See #26869.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28039 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-25 06:29:14 +00:00
Drew Jaynes
86a6a217a4 Inline documentation for hooks in wp-includes/class.wp-styles.php.
Props lkwdwrd.
Fixes #27445.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27660 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-28 21:24:14 +00:00
Andrew Nacin
20948e27e8 Revert [27203], restore JIT color scheme stylesheets. Restores [27111].
fixes #27175. see #20729.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27358 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-12 16:12:15 +00:00
Andrew Nacin
0c47e9b732 Simplify how admin color schemes are enqueued.
Removes a piece of [27111].

fixes #20729.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27060 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-20 06:59:13 +00:00
Andrew Nacin
12a64b39db Fix the conditional enqueueing/printing of colors stylesheets, without breaking dependencies.
fixes #18380.
see #20729 which should properly fix this.

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


git-svn-id: http://core.svn.wordpress.org/trunk@26978 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-06 22:16:11 +00:00
Andrew Nacin
1e30be32c4 Use CSSJanus via a Grunt task to generate right-to-left CSS.
RTL files are now created on build for core CSS files. These files replace the LTR file completely, rather than being in addition to the existing LTR file.

Benefits:
 * For the user: less CSS is served in RTL, less HTTP requests on the frontend, and less work for the browser.
 * For the core developer: Let the tools do the work.

Notes for core development:
 * The file generation task is `grunt rtl`.
 * `grunt watch` now handles generating RTL files in /build when a CSS file in /src is saved.
 * /src is now locked to LTR. RTL testing must occur via /build. When attempting to run an RTL text direction with /src, an admin notice will display.

Expect RTL bugs. Please report them.

props yoavf.
see #24977.

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


git-svn-id: http://core.svn.wordpress.org/trunk@26022 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-12 21:19:15 +00:00
Andrew Nacin
f9be8e4f0c Revert [25202] and enforce that wp_add_inline_style() does not want <style> tags.
Prior to 3.7, these tags were not printed (and thus needed to be provided), but only in the admin and when concatenation was enabled. They should never be required. Strip them when we find them and issue a notice for incorrect usage.

props atimmer, georgestephanis.
fixes #24813.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25698 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-15 14:35:09 +00:00
Sergey Biryukov
259ee74782 Prevent WP_Styles::do_item() from adding its own style tags when concatenation is disabled. props stephenharris. fixes #24813.
Built from https://develop.svn.wordpress.org/trunk@25202


git-svn-id: http://core.svn.wordpress.org/trunk@25174 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-01 13:15:09 +00:00
Andrew Nacin
0fa23c1ac2 WP Styles: Correctly print 'after' data when scripts are concatenated. props stephenh1988. fixes #20836.
git-svn-id: http://core.svn.wordpress.org/trunk@24047 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-04-22 19:22:09 +00:00
nacin
5c228ae869 Allow protocol-relative URLs when registering/enqueueing scripts and styles.
props mimecine, TobiasBg, georgestephanis.
props kurtpayne for the test coverage.
fixes #16560.



git-svn-id: http://core.svn.wordpress.org/trunk@21166 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-28 20:18:38 +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
azaozz
23b9d7759a Introduce WP_Dependencies::get_data() method, change scripts and styles priority to follow the "natural" order in HTML, i.e. the last one wins, props scribu, see #11520
git-svn-id: http://svn.automattic.com/wordpress/trunk@18480 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-07-28 18:24:00 +00:00
azaozz
21058cf460 Use json_encode() for adding script data (formerly l10n). Add the same functionality to WP_Styles for adding inline css after a stylesheet has been outputted. See #11520
git-svn-id: http://svn.automattic.com/wordpress/trunk@18464 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-07-25 00:36:06 +00:00
azaozz
23f490bb02 Support for using wp_enqueue_script() and wp_enqueue_style() in the HTML body. All scripts and styles are added in the footer, fixes #9346
git-svn-id: http://svn.automattic.com/wordpress/trunk@18446 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-07-21 16:32:01 +00:00
nacin
496752e14e Proper RTL + .dev.css support, first pass. See #12292
git-svn-id: http://svn.automattic.com/wordpress/trunk@13351 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-02-23 23:46:07 +00:00
azaozz
481737b4ae Fix the 'colors' meta-css src (boolean) value generating parse_url errors, fixes #11820
git-svn-id: http://svn.automattic.com/wordpress/trunk@13193 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-02-18 10:30:28 +00:00
azaozz
77706e5c74 Too many question marks, see #11315
git-svn-id: http://svn.automattic.com/wordpress/trunk@12559 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-12-28 00:56:41 +00:00
azaozz
7b40c7a03f WP_Dependencies: pass NULL to disable script and style version query strings, props scribu amattie, fixes #11315
git-svn-id: http://svn.automattic.com/wordpress/trunk@12558 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-12-28 00:48:20 +00:00
markjaquith
3ebf837ced Deprecate sanitize_url() and clean_url() in favor of esc_url_raw() and esc_url()
git-svn-id: http://svn.automattic.com/wordpress/trunk@11383 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-05-18 16:00:33 +00:00
ryan
1971247149 Fix RTL color stylesheet loading. Props hakre. fixes #9735
git-svn-id: http://svn.automattic.com/wordpress/trunk@11219 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-05-06 17:47:58 +00:00
markjaquith
6c2ffddf31 _a(), _ea(), _xa(), attr() are now esc_attr__(), esc_attr_e(), esc_attr_x(), esc_attr() -- still short, but less cryptic. see #9650
git-svn-id: http://svn.automattic.com/wordpress/trunk@11204 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-05-05 19:43:53 +00:00
ryan
2d489767bb s/attribute_escape/attr/. see #9650
git-svn-id: http://svn.automattic.com/wordpress/trunk@11109 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-04-28 05:58:45 +00:00
ryan
3dd79f8587 Run RTL CSS urls through the style_loader_src filter. Props nbachiyski. fixes #9528
git-svn-id: http://svn.automattic.com/wordpress/trunk@10918 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-04-13 16:07:27 +00:00
azaozz
1f9f97058e Append "-css" to the IDs for <link rel="stylesheet"> tags in the head, props Denis-de-Bernardy, fixes #9486
git-svn-id: http://svn.automattic.com/wordpress/trunk@10899 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-04-08 22:49:39 +00:00
azaozz
f20f62b27d Improvements to the script loader: allows plugins to queue scripts for the front end head and footer, adds hooks for server side caching of compressed scripts, adds support for ENFORCE_GZIP constant (deflate is used by default since it's faster), see #8628, fixes #8884
git-svn-id: http://svn.automattic.com/wordpress/trunk@10442 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-01-26 12:59:10 +00:00
azaozz
fc7d871678 Split the script queue in head and footer part, concatenate and compress the default js and css, first run, see #8628
git-svn-id: http://svn.automattic.com/wordpress/trunk@10357 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-01-14 14:18:51 +00:00