Commit Graph

49 Commits

Author SHA1 Message Date
Scott Taylor
cf6adef68f Revert [31032], this did not get much love.
See #25277.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31170 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-16 01:11:23 +00:00
Scott Taylor
b39c37ff89 After [31030]: if a callable is passed as the 3rd arg to wp_localize_script()/WP_Scripts->localize(), pass $handle and $object_name to the user func when invoking it.
Props jtsternberg.
Fixes #26111.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31014 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-03 05:13:24 +00:00
Scott Taylor
650a6d1062 Add the ability to print data *after* a script, whether it is concatenated or not:
* Add a third argument to `WP_Scripts->print_extra_script()`, `$key`, which will be passed to `->get_data()` (no longer passes hardcoded `'data'`)
* When `$key` is set to `'data-after'`, the inline script will be printed after the `<script>` tag. If the scripts are being concatenated, all scripts' `'data-after'` data will be printed after the concatenated `<script>` has been rendered.

Props hakre, wonderboymusic.
Fixes #25277.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31013 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-03 05:08: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
Drew Jaynes
23707b1ada Convert various uses of (optional) in core parameter descriptions to use the style prescribed in the inline documentation standards for PHP.
The style for marking parameters optional in inline PHP docs is: `@param type $var Optional. Description. Accepts. Default.`, where Accepts can be omitted on a case-by-case basis.

Props coffee2code.
Fixes #30591.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-06 21:24:45 +00:00
John Blackbourn
d0b10b5022 Apply a filter to the <script> tag for enqueued scripts in the same way a filter is applied to the <link> tag for enqueued styles.
Fixes #13592
Props quietnic, MikeHansenMe

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


git-svn-id: http://core.svn.wordpress.org/trunk@30398 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-20 05:18:25 +00:00
Gary Pendergast
007ec52958 Add wp_json_encode(), a wrapper for json_encode() that ensures everything is converted to UTF-8.
Change all core calls from `json_encode()` to `wp_json_encode()`.

Fixes #28786.


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


git-svn-id: http://core.svn.wordpress.org/trunk@30055 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-28 18:35:19 +00:00
Scott Taylor
53968da5e2 WP_Scripts->in_default_dir() should use the WPINC constant
Props wojtek.szkutnik
See #14157.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28706 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-29 22:23:15 +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
e58c1d08e7 Inline documentation for hooks in wp-includes/class.wp-scripts.php.
Props kpdesign for a wording switcheroo.
Fixes #27518.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27568 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-26 05:48:14 +00:00
Andrew Nacin
6655f30fd9 If the script_loader_src filter returns nothing, bail instead of printing <script src="">.
props niallkennedy.
fixes #22470.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25386 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-16 22:12:09 +00:00
Andrew Nacin
bf759fe207 If someone tries to localize 'jquery', which is now an alias with jquery-core and jquery-migrate dependencies, add the data to jquery-core.
fixes #24197.



git-svn-id: http://core.svn.wordpress.org/trunk@24635 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-10 05:38:17 +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
nacin
bc2655affc If a plugin triggers the WP_Scripts constructor prior to init, fire wp_default_scripts()
then and again on init.

Only add our localized strings once we've fired init, in case we do have the situation
where we fire wp_default_scripts() twice.

Fixes issues where plugins or themes try to enqueue a default script handle prior to
init. Does not allow #19959 to regress.

see #20971 for trunk.



git-svn-id: http://core.svn.wordpress.org/trunk@21132 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-26 05:33:19 +00:00
ryan
d910c26182 Pinking shears 6-20000
git-svn-id: http://svn.automattic.com/wordpress/trunk@20000 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-27 19:46:52 +00:00
nacin
a0b0149065 Coverage for load-scripts.php. fixes #19959.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19872 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-08 16:15:24 +00:00
nacin
e82da3b730 Wait until init to fire wp_default_scripts. Fixes localization issues when a plugin calls wp_enqueue_script() too early (in spite of the _doing_it_wrong warning signs added in #11526). fixes #19959.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19865 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-08 15:29:24 +00:00
azaozz
909e20ed27 Move an unsightly semicolon to where it belongs in wp_localize_script(), props tw2113, fixes #19830
git-svn-id: http://svn.automattic.com/wordpress/trunk@19832 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-06 18:52:57 +00:00
ryan
07ff8b216b Use one space, not two, after trailing punctuation. fixes #19537
git-svn-id: http://svn.automattic.com/wordpress/trunk@19593 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-12-13 23:45:31 +00:00
nacin
60dc347247 Remove wp_add_script_before() from 3.3. Continue to use wp_localize_script() for your data-passing needs. fixes #11520.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19573 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-12-08 20:46:58 +00:00
azaozz
10859e2b8f Ressurect WP_Scripts::localize() and fix public function names, fixes #11520
git-svn-id: http://svn.automattic.com/wordpress/trunk@19217 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-11-08 18:05:59 +00:00
azaozz
b26dcf5ce6 Recursively convert html entities in script localization strings, see #11520
git-svn-id: http://svn.automattic.com/wordpress/trunk@18813 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-29 06:43:46 +00:00
nacin
fc7fb8b03e Revert [18804] until we have a proper solution. see #11520.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18810 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-29 05:50:44 +00:00
azaozz
e30854e968 Convert html entities in script localization strings, see #11520
git-svn-id: http://svn.automattic.com/wordpress/trunk@18804 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-29 00:34:24 +00:00
azaozz
f634dd5af4 Editor API enhancement, first run (still needs some work), see #17144
git-svn-id: http://svn.automattic.com/wordpress/trunk@18498 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-08-03 10:19:00 +00:00
azaozz
852882df30 Optimize script-loader a bit, see #11520
git-svn-id: http://svn.automattic.com/wordpress/trunk@18496 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-08-03 01:54:29 +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
b8ce0261df More param fixes, props duck_. see #14783.
git-svn-id: http://svn.automattic.com/wordpress/trunk@16469 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-18 19:12:48 +00:00
ryan
847499e531 Pinking shears
git-svn-id: http://svn.automattic.com/wordpress/trunk@16438 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-17 18:47:34 +00:00
westi
583ac68a44 Move the l10n helper function into a seperate js file so we can always output it first.
Fixes #15124.

git-svn-id: http://svn.automattic.com/wordpress/trunk@16282 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-10 21:53:30 +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
markjaquith
d7b015645d esc_js(). Shorter, follows new escaping naming convention.
git-svn-id: http://svn.automattic.com/wordpress/trunk@11245 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-05-09 07:27:22 +00:00
azaozz
d467c7522a Queue all default scripts for the head when a custom script lists them as dependencies, fixes #9620
git-svn-id: http://svn.automattic.com/wordpress/trunk@11058 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-04-22 21:01:36 +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
cc4580779e Let plugins register footer scripts easier and add filters to the concatenating functions
git-svn-id: http://svn.automattic.com/wordpress/trunk@10367 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-01-15 19:50:23 +00:00
azaozz
3f7facfbe6 Add action hook in admin footer so plugins can output scripts there on specific pages only, props GamerZ, fixes #8859
git-svn-id: http://svn.automattic.com/wordpress/trunk@10362 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-01-15 00:08:20 +00:00
azaozz
3d495ac587 Remove unused var
git-svn-id: http://svn.automattic.com/wordpress/trunk@10358 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-01-14 14:40:08 +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
azaozz
11ba27a054 Fix external dependencies in class.wp-scripts.php, fixes #8505
git-svn-id: http://svn.automattic.com/wordpress/trunk@10135 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2008-12-09 02:50:28 +00:00
westi
55968bde15 Move convertEntities js function into the BackPress scriptloader. Fixes #8505 props sambauers.
git-svn-id: http://svn.automattic.com/wordpress/trunk@10086 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2008-12-06 09:54:24 +00:00
azaozz
5785542e00 Filter HTML entities when inserting strings with js, includes patch by nbachiyski, fixes #8254
git-svn-id: http://svn.automattic.com/wordpress/trunk@9809 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2008-11-20 10:54:59 +00:00
westi
6a527db989 phpdoc updates for wp-includes See #7550 props jacobsantos.
git-svn-id: http://svn.automattic.com/wordpress/trunk@9002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2008-09-27 10:06:18 +00:00
ryan
e2aa6d619c Introduce content_url(). Don't prepend base url to content url in script loader. see #6938 #7001
git-svn-id: http://svn.automattic.com/wordpress/trunk@8301 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2008-07-09 17:24:36 +00:00
ryan
9178934544 Add wp_default_styles(), convert wp_admin_css(). Props mdawaffe. see #7011
git-svn-id: http://svn.automattic.com/wordpress/trunk@7976 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2008-05-21 23:24:23 +00:00
ryan
e9aa24cffb Style loader from mdawaffe. see #7011
git-svn-id: http://svn.automattic.com/wordpress/trunk@7970 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2008-05-21 05:56:04 +00:00