Commit Graph

63 Commits

Author SHA1 Message Date
audrasjb 0a16223d4c Docs: Use third-person singular verbs for Script Loader related function descriptions, as per docblocks standards.
See #56792.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54605 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-15 14:57:13 +00:00
audrasjb b211123173 Docs: Improve `wp_style_add_data()` function description.
This changeset removes an extra apostrophe in `wp_style_add_data()` DocBlock.

Props lanacodes, ashrafulsarkar, SergeyBiryukov.
Fixes #57466.
See #56792.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54604 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-15 14:50:11 +00:00
Sergey Biryukov 25c78a1b2a Code Modernization: Rename parameters that use reserved keywords in `wp-includes/functions.wp-styles.php`.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit renames the `$list` parameter to `$status` in `wp_style_is()`.

Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@54931


git-svn-id: http://core.svn.wordpress.org/trunk@54483 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-12-04 12:48:11 +00:00
John Blackbourn f9db66d504 Docs: Various improvements to inline docblocks.
See #55646

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


git-svn-id: http://core.svn.wordpress.org/trunk@54029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 09:02:14 +00:00
desrosj fac3744387 Script Loader: Document `path` as an accepted value for `$key` in `wp_style_add_data()`.
Follow up to [50836].

Props tmatsuur.
Fixes #53792.
Built from https://develop.svn.wordpress.org/trunk@52216


git-svn-id: http://core.svn.wordpress.org/trunk@51808 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-19 15:14:00 +00:00
Sergey Biryukov fcc79f847a Docs: Provide a more accurate description for a few script and style functions.
This should make it clear that the functions only work if the script or style has already been registered.

This affects:
* `wp_localize_script()`
* `wp_set_script_translations()`
* `wp_script_add_data()`
* `wp_style_add_data()`

Follow-up to [7970], [18464], [25594], [31223], [36633], [44169], [44350].

Props audrasjb.
Fixes #54044.
Built from https://develop.svn.wordpress.org/trunk@51726


git-svn-id: http://core.svn.wordpress.org/trunk@51332 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-02 08:30:58 +00:00
Sergey Biryukov a9a6b25cae Script Loader: Include the script or style handle in `_wp_scripts_maybe_doing_it_wrong()` message.
This makes the message more helpful and allows for easier debugging.

Props janthiel.
Fixes #50406.
Built from https://develop.svn.wordpress.org/trunk@48070


git-svn-id: http://core.svn.wordpress.org/trunk@47837 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-17 10:16:08 +00:00
John Blackbourn 701ad95968 Script Loader: Fix a docblock so it points to the correct page on the developer reference.
Props joyously, pbiron

Fixes #48503
Built from https://develop.svn.wordpress.org/trunk@47204


git-svn-id: http://core.svn.wordpress.org/trunk@47004 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-07 17:42:06 +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 6ed1a7b615 Docs: Correct the documentation placement for `wp_print_styles` and `shortcode_atts_{$shortcode}` hooks.
Props jrf.
See #48255.
Built from https://develop.svn.wordpress.org/trunk@46688


git-svn-id: http://core.svn.wordpress.org/trunk@46488 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-09 13:43:01 +00:00
John Blackbourn f545bb3f63 Docs: Improve documentation of known return types, plus other docs fixes.
See #48303

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


git-svn-id: http://core.svn.wordpress.org/trunk@46460 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-05 21:23:02 +00:00
John Blackbourn 9890e68661 Docs: Switch to typed array notation for the docs for asset dependency functions.
Props marekdedic

See #48303

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


git-svn-id: http://core.svn.wordpress.org/trunk@46392 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-26 21:02:02 +00:00
Sergey Biryukov b99aa8682c Docs: Fix typo in `wp_add_inline_script()` and `wp_add_inline_style()` description.
Props jankimoradiya.
Fixes #45705.
Built from https://develop.svn.wordpress.org/trunk@44350


git-svn-id: http://core.svn.wordpress.org/trunk@44180 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-20 02:42:48 +00:00
Sergey Biryukov 0d05b99e1b Docs: Document that the `$src` parameter of `WP_Dependencies::add()` can be boolean.
Props dimadin.
Fixes #45009.
Built from https://develop.svn.wordpress.org/trunk@43661


git-svn-id: http://core.svn.wordpress.org/trunk@43490 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-09-28 21:51:24 +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
Sergey Biryukov 2bb27252f9 Script Loader: Correct default value for `$src` in `wp_enqueue_script()` and `wp_enqueue_style()`.
Props Frank Klein for initial patch.
See #37770.
Built from https://develop.svn.wordpress.org/trunk@38519


git-svn-id: http://core.svn.wordpress.org/trunk@38460 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-04 04:09:28 +00:00
Sergey Biryukov 139387b7e5 Docs: Use 3-digit, x.x.x-style semantic versioning for `_doing_it_wrong()`, `_deprecated_function()`, `_deprecated_argument()`, and `_deprecated_file()` throughout core.
Props metodiew.
Fixes #36495.
Built from https://develop.svn.wordpress.org/trunk@37985


git-svn-id: http://core.svn.wordpress.org/trunk@37926 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-06 12:40:29 +00:00
Peter Wilson 47d26cd9fb DOCS: Replace HTTP links with HTTPS.
Replaces unsecure links in documentation and translator comments with their secure versions.

Props johnpgreen, netweb

Fixes #36993

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


git-svn-id: http://core.svn.wordpress.org/trunk@37640 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-10 04:50:33 +00:00
Sergey Biryukov 9dcfd91833 I18N: Update translator comments after [37190].
See #36496.
Built from https://develop.svn.wordpress.org/trunk@37191


git-svn-id: http://core.svn.wordpress.org/trunk@37157 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-04-13 04:30:29 +00:00
Sergey Biryukov 5e31cb45fe I18N: After [37188], display `script` and `style` tags in the message as `<script>` and `<style>`.
Props dd32.
See #36496.
Built from https://develop.svn.wordpress.org/trunk@37190


git-svn-id: http://core.svn.wordpress.org/trunk@37156 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-04-13 04:16:27 +00:00
Sergey Biryukov 7e40b1d282 I18N: Remove tag and function names from two translatable strings.
Add translator comments.

Props andg for initial patch.
Fixes #36496.
Built from https://develop.svn.wordpress.org/trunk@37188


git-svn-id: http://core.svn.wordpress.org/trunk@37154 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-04-13 03:02:27 +00:00
John Blackbourn 7ecfdc69b7 Docs: Improvements and corrections for the `$ver` parameter of the dependencies API functions.
See #32246

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


git-svn-id: http://core.svn.wordpress.org/trunk@36960 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-14 22:37:26 +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 57aec38add Styles: Clarify the allowed values for the `$media` parameter of `wp_register_style()`/`wp_enqueue_style()`.
Adds unit test.

Fixes #35921.
Built from https://develop.svn.wordpress.org/trunk@36649


git-svn-id: http://core.svn.wordpress.org/trunk@36616 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-23 20:41:26 +00:00
John Blackbourn 0003a004db Docs: Miscellaneous docblock code quality tweaks.
See #32246

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


git-svn-id: http://core.svn.wordpress.org/trunk@36039 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-23 07:53:26 +00:00
Scott Taylor 05682bdaa8 After [32596] and [32597], ensure that `wp_scripts|styles()` is called to ensure an instance is created of `WP_Scripts|Styles()` before calling `->do_items()`.
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32699 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-12 16:54:24 +00:00
Scott Taylor bbe2301960 Cleanup the use of `$wp_styles` global in `functions.wp-styles.php`.
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32567 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-25 16:35:24 +00:00
John Blackbourn 987716720f Add a return value to `wp_register_script()` and `wp_register_style()` which matches the return value of `WP_Dependencies::add()`.
Props katzwebdesign, pareshradadiya, DrewAPicture.

Fixes #31126

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


git-svn-id: http://core.svn.wordpress.org/trunk@32453 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-10 19:57:25 +00:00
Drew Jaynes 5a70c1a9dc Add a missing return description for `wp_styles()`.
See [31194]. See #31888.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32020 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-05 15:56:26 +00:00
Scott Taylor e760ecfb13 Make `_wp_scripts_maybe_doing_it_wrong( $function )` "private".
Props obenland for the thought leadership.
See #20513.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31177 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-16 02:42:22 +00:00
Scott Taylor 9ee49b130c After [31192], create a function, `wp_styles()`, to reduce duplicated code in `functions.wp-styles.php`. The style functions can reuse `wp_scripts_maybe_doing_it_wrong( $function )` internally.
See #20513.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31175 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-16 02:31:23 +00:00
Scott Taylor fe6b5983df In PHP 5.0.0, `is_a()` became deprecated in favour of the `instanceof` operator. Calling `is_a()` would result in an `E_STRICT` warning.
In PHP 5.3.0, `is_a()` is no longer deprecated, and will therefore no longer throw `E_STRICT` warnings.

To avoid warnings in PHP < 5.3.0, convert all `is_a()` calls to `$var instanceof WP_Class` calls.

`instanceof` does not throw any error if the variable being tested is not an object, it simply returns `false`.

Props markoheijnen, wonderboymusic.
Fixes #25672.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31169 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-16 01:06:24 +00:00
Scott Taylor a0df295f5c Improve various `@param` docs.
See #30224.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30664 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-30 23:24:25 +00:00
Sergey Biryukov bf856e3a62 Translate some previously untranslated _doing_it_wrong() messages.
props georgestephanis.
fixes #25614.
Built from https://develop.svn.wordpress.org/trunk@29840


git-svn-id: http://core.svn.wordpress.org/trunk@29604 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-05 21:06:15 +00:00
Drew Jaynes 02d3a290ec Inline documentation for hooks in wp-includes/functions.wp-styles.php.
Props admiralthrawn.
Fixes #25722.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25909 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-27 17:59:09 +00:00
Andrew Nacin b02867a1c4 Avoid printing a possible HTML element. fixes #24813.
Built from https://develop.svn.wordpress.org/trunk@25809


git-svn-id: http://core.svn.wordpress.org/trunk@25721 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-16 04:46:10 +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
Drew Jaynes 74ade89101 Improve inline documentation for wp-includes/functions.wp-styles.php.
Props kpdesign.
Fixes #25401.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25511 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-24 02:24:09 +00:00
Sergey Biryukov d6f65fb147 Update @since for wp_script_is() and wp_style_is(). props jdgrimes. see #25326.
Built from https://develop.svn.wordpress.org/trunk@25449


git-svn-id: http://core.svn.wordpress.org/trunk@25370 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-16 12:46:11 +00:00
Ryan Boren 20d04dfca8 Introduce wp_style_add_data() as a wrapper for $wp_styles->add_data().
Props obenland, nacin
fixes #18753


git-svn-id: http://core.svn.wordpress.org/trunk@24740 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-18 19:46:38 +00:00
Andrew Nacin dcb573103c Stop recommending the init hook in the _doing_it_wrong() message for too-early scripts and styles. Instead, recommend the three _enqueue_scripts hooks. If they're noticing they are doing it wrong, let's push them to 100% correct, not partly correct.
see #22896.



git-svn-id: http://core.svn.wordpress.org/trunk@23377 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-02 02:42:09 +00:00
Andrew Nacin e03bb0d1ac Have wp_script_is() and wp_style_is() accept 'enqueued', as it reads better than 'queue' and is consistent with 'registered'. fixes #21741.
git-svn-id: http://core.svn.wordpress.org/trunk@21672 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-30 18:57:57 +00:00
ryan 83b131f8e3 User lowercase true, false, null instead of uppercase. Props c3mdigital, mfields. fixes #16302
git-svn-id: http://svn.automattic.com/wordpress/trunk@19687 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-05 20:50:54 +00:00
ryan d1ba11c7d1 Update some @since. Props dgwyer. fixes #19638
git-svn-id: http://svn.automattic.com/wordpress/trunk@19673 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-04 19:03:33 +00:00
ryan eeb71b5499 Trigger the wp_print_syles action from wp_print_styles() only when handles are not passed. Prevents front-end styles from leaking into the admin. Props nacin. see #19510 for trunk
git-svn-id: http://svn.automattic.com/wordpress/trunk@19649 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-02 22:32:00 +00:00
ryan 62afab8db3 Pinking shears
git-svn-id: http://svn.automattic.com/wordpress/trunk@19054 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-10-24 19:13:23 +00:00
nacin 51ca772adf Call _doing_it_wrong() individually in wp_scripts and wp_styles functions. Partially reverts [18556], [18557], removes wp_styles_init(), wp_scripts_init(). fixes #11526.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18561 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-08-17 21:02:43 +00:00
azaozz 7140ac9bf4 Don't call debug_backtrace() in wp_scripts_init() and wp_styles_init(), props dd32, see #11526
git-svn-id: http://svn.automattic.com/wordpress/trunk@18557 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-08-17 06:26:41 +00:00
azaozz e5e90d732b Add _doing_it_wrong() when a plugin or theme accesses $wp_scripts or $wp_styles too early (also fixes localization), props SergeyBiryukov, fixes #11526
git-svn-id: http://svn.automattic.com/wordpress/trunk@18556 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-08-17 05:48:13 +00:00