Commit Graph

80 Commits

Author SHA1 Message Date
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
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
Peter Wilson 22cba90dea Docs: Fix typo in `wp_print_scripts()`' reference to `WP_Scripts::do_item()`.
Fixes #48141.

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


git-svn-id: http://core.svn.wordpress.org/trunk@46110 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-25 22:23:55 +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
Sergey Biryukov 7cadbb50bf Docs: Fix incorrect `@see` notation in `wp_localize_script()` DocBlock.
Props coffee2code, shamim51.
Fixes #47104.
Built from https://develop.svn.wordpress.org/trunk@45392


git-svn-id: http://core.svn.wordpress.org/trunk@45203 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-05-24 01:02:51 +00:00
Dominik Schilling f34e1dbad1 I18N: Make domain argument optional in `wp_set_script_translations()` / `WP_Scripts::set_translations()`.
Props swissspidy.
Fixes #45489.
Built from https://develop.svn.wordpress.org/trunk@44395


git-svn-id: http://core.svn.wordpress.org/trunk@44225 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-04 21:12:50 +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
Drew Jaynes 161df2a5d9 Docs: Fix an `@see` reference to use the correct class name in the `wp_script_add_data()` DocBlock.
Props joyously.
See #42505.

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


git-svn-id: http://core.svn.wordpress.org/trunk@44162 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-19 16:29:48 +00:00
Gary Pendergast f46fbae857 I18N: Add JavaScript translation support.
Adds the `wp_set_script_translations()` function which registers translations for a JavaScript file. This function takes a handle, domain and optionally a path and ensures JavaScript translation files are loaded if they exist.

Merges [43825,43828,43859,43898] from the 5.0 branch to trunk.

Props herregroen, atimmer, omarreiss, nerrad, swissspidy, ocean90, georgestephanis.
Fixes #45103, #45256.


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


git-svn-id: http://core.svn.wordpress.org/trunk@43999 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-14 05:52:52 +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
Dominik Schilling 5c291d49de Pinking shears.
See #41057.
Built from https://develop.svn.wordpress.org/trunk@42843


git-svn-id: http://core.svn.wordpress.org/trunk@42673 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-18 14:23:33 +00:00
Drew Jaynes 6e665d1f15 Docs: Link to the "Conditional Tags" article in the Theme Developer Handbook from the descriptions for a variety of core conditional tag functions.
These notations largely serve to direct consumers (of both the source and the parsed code reference) to extended information on individual and related conditional tags throughout WordPress. The changeset also standardizes corresponding DocBlock summaries to use third-person singular verbs.

Notations been added for the following functions:

* comments_open()
* email exists()
* has_excerpt()
* has_post_thumbnail()
* has_tag()
* in_category()
* in_the_loop()
* is_404()
* is_active_sidebar()
* is_active_widget()
* is_admin()
* is_admin_bar_showing()
* is_archive()
* is_attachment()
* is_author()
* is_blog_installed()
* is_category()
* is_comments_popup()
* is_date()
* is_day()
* is_dynamic_sidebar()
* is_feed()
* is_front_page()
* is_home()
* is_local_attachment()
* is_main_query
* is_month()
* is_multi_author
* is_new_day()
* is_page()
* is_page_template()
* is_paged()
* is_plugin_active()
* is_plugin_active_for_network()
* is_plugin_inactive()
* is_plugin_page()
* is_post_type_archive()
* is_preview()
* is_rtl()
* is_search()
* is_single()
* is_singular()
* is_sticky()
* is_tag()
* is_tax()
* is_taxonomy_hierarchical()
* is_time()
* is_trackback()
* is_user_logged_in()
* is_year()
* pings_open()
* post_type_exists()
* taxonomy_exists()
* term_exists()
* username exists()
* wp_attachment_is_image()
* wp_script_is()

Props janalwin.
Fixes #43254.

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


git-svn-id: http://core.svn.wordpress.org/trunk@42538 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-13 16:54: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
Weston Ruter f1ba1918c9 Customize: Implement customized state persistence with changesets.
Includes infrastructure developed in the Customize Snapshots feature plugin.

See https://make.wordpress.org/core/2016/10/12/customize-changesets-technical-design-decisions/

Props westonruter, valendesigns, utkarshpatel, stubgo, lgedeon, ocean90, ryankienstra, mihai2u, dlh, aaroncampbell, jonathanbardo, jorbin.
See #28721.
See #31089.
Fixes #30937.
Fixes #31517.
Fixes #30028.
Fixes #23225.
Fixes #34142.
Fixes #36485.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38753 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-18 20:05:31 +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 d611efe5b1 I18N: Add translator comments for strings in `wp-includes/functions.wp-scripts.php`.
Props ramiy.
Fixes #37803.
Built from https://develop.svn.wordpress.org/trunk@38345


git-svn-id: http://core.svn.wordpress.org/trunk@38286 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-23 23:53:27 +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
Drew Jaynes d28f1a08ef Docs: Apply inline `@see` tags to hooks referenced in DocBlocks in a variety of wp-includes/* files.
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@37543


git-svn-id: http://core.svn.wordpress.org/trunk@37511 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-23 19:01:27 +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 23ffb773aa Docs: Use correct `@since` tags for script enqueue functions.
See [4968], [3788].
See #35964.
Built from https://develop.svn.wordpress.org/trunk@36729


git-svn-id: http://core.svn.wordpress.org/trunk@36696 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-26 12:50:28 +00:00
Dominik Schilling e5ea82d81a Spelling: Standardize on "front end"/"back end" (noun) and "front-end"/"back-end" (adjective).
Props obrienlabs, thewanderingbrit.
Fixes #34887.
Built from https://develop.svn.wordpress.org/trunk@36709


git-svn-id: http://core.svn.wordpress.org/trunk@36676 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-25 12:53:27 +00:00
Drew Jaynes ae4cf5079d Docs: Use a third-person singular verb in the DocBlock summary for `wp_add_inline_script()`, introduced in [36633].
See #14853. See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36674 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-25 05:14:25 +00:00
Pascal Birchler b47a3831ee Script Loader: Introduce `wp_add_inline_script()`.
This new function can be used to add inline JavaScript before and after enqueued scripts, just like `wp_add_inline_style()` works for CSS.

Props atimmer, abiralneupane, ocean90, swissspidy.
Fixes #14853.
Built from https://develop.svn.wordpress.org/trunk@36633


git-svn-id: http://core.svn.wordpress.org/trunk@36600 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-23 16:44: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
Konstantin Kovshenin 919867b090 Docs: Remove some more dittography.
See #34885, r35793.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35760 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-06 21:50:25 +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 ebd7fe8a2f Cleanup the use of `$wp_scripts` global in `functions.wp-scripts.php`.
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32566 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-25 16:24:25 +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
Scott Taylor 4ca760354f Revert [31030] and [31033]. Incidentally, there is no lazy-loading happening here anyway.
Pushing #26111 to future.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32103 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-14 15:13:28 +00:00
Drew Jaynes 4303322ed1 Add a variety of missing descriptions and fix syntax for `wp_scripts()`, `_wp_scripts_maybe_doing_it_wrong()`, and `wp_script_add_data()`.
See #31888.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32019 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-05 15:55:25 +00:00
Dominik Schilling 4fbba16960 Avoid a PHP notice in `wp_enqueue_script()` if $handle is an array.
Calling `wp_enqueue_script()` with an array as the first argument is a "hidden feature" and should be avoided. Use dependencies instead.

props sorich87 for initial patch.
fixes #31636.
see #14488.
Built from https://develop.svn.wordpress.org/trunk@31887


git-svn-id: http://core.svn.wordpress.org/trunk@31866 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-25 17:55:27 +00:00
Andrew Ozz 9d3ea188d7 Add support for IE conditional comments for WP_Scripts to match the functionality of WP_Styles, including unit tests. Props filosofo, aaroncampbell, ethitter, georgestephanis, valendesigns. Fixes #16024.
Built from https://develop.svn.wordpress.org/trunk@31223


git-svn-id: http://core.svn.wordpress.org/trunk@31204 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-17 01:37:22 +00:00
Scott Taylor 3f8d8cec00 Add `@ignore` to `_wp_scripts_maybe_doing_it_wrong()`.
Props DrewAPicture for the thought leadership.
See #20513.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31183 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-16 05:38:21 +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 2849a791b4 In `wp_print_scripts()`, bail if `$handles` is `false` and the `$wp_scripts` global has not been instantiated.
See [31192], #20513.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31174 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-16 02:28:22 +00:00
Scott Taylor 74a8d68bbf `functions.wp-scripts.php` contains a lot of duplicated code. Make 2 new functions: `wp_scripts()` and `wp_scripts_maybe_doing_it_wrong( $function )`, to encapsulate the repeated logic.
Props GaryJ, scribu, wonderboymusic.
Fixes #20513.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31173 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-16 02:07:22 +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 e649887e40 Allow the 3rd argument to `wp_localize_script()/WP_Scripts->localize()` to be a `callable`, allowing data to be lazy-loaded when the script is actually enqueued.
Props jtsternberg.
Fixes #26111.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31011 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-03 03:54:22 +00:00
Scott Taylor 2d7c3eec73 When calling `wp_enqueue_script()` with a registered `$handle`, no `$src` (using the default value, `false`), and `true` as the value for `$in_footer`, ensure that the script actually loads in the footer. If the handle was registered with `$in_footer` equal to `true`, this already worked. Make it work for scripts like where `$in_footer` was initially `false`, example: `wp_enqueue_script( 'json2', false, array(), false, true );`
Props SergeyBiryukov.
Fixes #14488.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31009 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-03 02:41:23 +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
Drew Jaynes 07c58f5cca Ensure inline code is markdown-escaped as such, HTML tags are removed from summaries, and that code snippets in descriptions are properly indented.
Affects DocBlocks for the following core elements:
* Markdown-indent a code snippet in the description for `_deprecated_argument()`
* Markdown-indent a code snippet in the description for `wp_localize_script()`
* Backtick-escape HTML tags in two parameter descriptions for `wp_register()`
* Various DocBlock formatting in the description for `get_bloginfo()`
* Remove HTML tag from the summary for `_wp_render_title_tag()`
* Backtick-escape a HTML tag in the description for `get_archives_link()`
* Markdown-indent a code snippet in the description for `wp_admin_css_color()`
* Markdown-indent a code snippet in the description for the `welcome_panel` hook

Props rarst.
See #30473.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30530 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-24 05:39:22 +00:00
Mark Jaquith 0d3b83551f Use HTTPS URLs for core.trac.wordpress.org
see #27115
Built from https://develop.svn.wordpress.org/trunk@29788


git-svn-id: http://core.svn.wordpress.org/trunk@29560 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-29 13:28:16 +00:00
Andrew Nacin 6af7341655 Revert [28840]; wp_localize_script() must be called on a registered handle.
see #24724.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29452 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-02 19:35:16 +00:00
Scott Taylor 6bcb24a344 In `wp_localize_script()`, instantiate the `$wp_scripts` global instead of bailing when it is called before `wp_enqueue_scripts`. This allows `wp_enqueue_media()` to be called on the front end with no JS errors.
Props ericlewis.
Fixes #24724.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28644 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-26 01:38:15 +00:00