<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[12558] trunk/wp-includes: WP_Dependencies:
pass NULL to disable script and style version query strings,
props scribu amattie, fixes #11315</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12558">12558</a></dd>
<dt>Author</dt> <dd>azaozz</dd>
<dt>Date</dt> <dd>2009-12-28 00:48:20 +0000 (Mon, 28 Dec 2009)</dd>
</dl>
<h3>Log Message</h3>
<pre>WP_Dependencies: pass NULL to disable script and style version query strings, props scribu amattie, fixes <a href="http://trac.wordpress.org/ticket/11315">#11315</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpincludesclasswpdependenciesphp">trunk/wp-includes/class.wp-dependencies.php</a></li>
<li><a href="#trunkwpincludesclasswpscriptsphp">trunk/wp-includes/class.wp-scripts.php</a></li>
<li><a href="#trunkwpincludesclasswpstylesphp">trunk/wp-includes/class.wp-styles.php</a></li>
<li><a href="#trunkwpincludesfunctionswpscriptsphp">trunk/wp-includes/functions.wp-scripts.php</a></li>
<li><a href="#trunkwpincludesfunctionswpstylesphp">trunk/wp-includes/functions.wp-styles.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpincludesclasswpdependenciesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/class.wp-dependencies.php (12557 => 12558)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/class.wp-dependencies.php        2009-12-27 22:30:58 UTC (rev 12557)
+++ trunk/wp-includes/class.wp-dependencies.php        2009-12-28 00:48:20 UTC (rev 12558)
</span><span class="lines">@@ -232,8 +232,6 @@
</span><span class="cx">                 @list($this->handle, $this->src, $this->deps, $this->ver, $this->args) = func_get_args();
</span><span class="cx">                 if ( !is_array($this->deps) )
</span><span class="cx">                         $this->deps = array();
</span><del>-                if ( !$this->ver )
-                        $this->ver = false;
</del><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function add_data( $name, $data ) {
</span></span></pre></div>
<a id="trunkwpincludesclasswpscriptsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/class.wp-scripts.php (12557 => 12558)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/class.wp-scripts.php        2009-12-27 22:30:58 UTC (rev 12557)
+++ trunk/wp-includes/class.wp-scripts.php        2009-12-28 00:48:20 UTC (rev 12558)
</span><span class="lines">@@ -90,9 +90,13 @@
</span><span class="cx">                 if ( false === $group && in_array($handle, $this->in_footer, true) )
</span><span class="cx">                         $this->in_footer = array_diff( $this->in_footer, (array) $handle );
</span><span class="cx">
</span><del>-                $ver = $this->registered[$handle]->ver ? $this->registered[$handle]->ver : $this->default_version;
</del><ins>+                if ( null === $this->registered[$handle]->ver )
+                        $ver = '';
+                else
+                        $ver = $this->registered[$handle]->ver ? $this->registered[$handle]->ver : $this->default_version;
+
</ins><span class="cx">                 if ( isset($this->args[$handle]) )
</span><del>-                        $ver .= '&amp;' . $this->args[$handle];
</del><ins>+                        $ver = $ver ? $ver . '&amp;' . $this->args[$handle] : '?' . $this->args[$handle];
</ins><span class="cx">
</span><span class="cx">                 $src = $this->registered[$handle]->src;
</span><span class="cx">
</span><span class="lines">@@ -114,7 +118,8 @@
</span><span class="cx">                         $src = $this->base_url . $src;
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                $src = add_query_arg('ver', $ver, $src);
</del><ins>+                if ( !empty($ver) )
+                        $src = add_query_arg('ver', $ver, $src);
</ins><span class="cx">                 $src = esc_url(apply_filters( 'script_loader_src', $src, $handle ));
</span><span class="cx">
</span><span class="cx">                 if ( $this->do_concat )
</span></span></pre></div>
<a id="trunkwpincludesclasswpstylesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/class.wp-styles.php (12557 => 12558)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/class.wp-styles.php        2009-12-27 22:30:58 UTC (rev 12557)
+++ trunk/wp-includes/class.wp-styles.php        2009-12-28 00:48:20 UTC (rev 12558)
</span><span class="lines">@@ -35,9 +35,13 @@
</span><span class="cx">                 if ( !parent::do_item($handle) )
</span><span class="cx">                         return false;
</span><span class="cx">
</span><del>-                $ver = $this->registered[$handle]->ver ? $this->registered[$handle]->ver : $this->default_version;
</del><ins>+                if ( null === $this->registered[$handle]->ver )
+                        $ver = '';
+                else
+                        $ver = $this->registered[$handle]->ver ? $this->registered[$handle]->ver : $this->default_version;
+
</ins><span class="cx">                 if ( isset($this->args[$handle]) )
</span><del>-                        $ver .= '&amp;' . $this->args[$handle];
</del><ins>+                        $ver = $ver ? $ver . '&amp;' . $this->args[$handle] : '?' . $this->args[$handle];
</ins><span class="cx">
</span><span class="cx">                 if ( $this->do_concat ) {
</span><span class="cx">                         if ( $this->in_default_dir($this->registered[$handle]->src) && !isset($this->registered[$handle]->extra['conditional']) && !isset($this->registered[$handle]->extra['alt']) ) {
</span><span class="lines">@@ -100,7 +104,8 @@
</span><span class="cx">                         $src = $this->base_url . $src;
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                $src = add_query_arg('ver', $ver, $src);
</del><ins>+                if ( !empty($ver) )
+                        $src = add_query_arg('ver', $ver, $src);
</ins><span class="cx">                 $src = apply_filters( 'style_loader_src', $src, $handle );
</span><span class="cx">                 return esc_url( $src );
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkwpincludesfunctionswpscriptsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/functions.wp-scripts.php (12557 => 12558)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/functions.wp-scripts.php        2009-12-27 22:30:58 UTC (rev 12557)
+++ trunk/wp-includes/functions.wp-scripts.php        2009-12-28 00:48:20 UTC (rev 12558)
</span><span class="lines">@@ -38,7 +38,12 @@
</span><span class="cx"> * Register new JavaScript file.
</span><span class="cx"> *
</span><span class="cx"> * @since r16
</span><del>- * @see WP_Dependencies::add() For parameter information.
</del><ins>+ * @param string $handle Script name
+ * @param string $src Script url
+ * @param array $deps (optional) Array of script names on which this script depends
+ * @param string|bool $ver (optional) Script version (used for cache busting), set to NULL to disable
+ * @param bool (optional) Wether to enqueue the script before </head> or before </body>
+ * @return null
</ins><span class="cx"> */
</span><span class="cx"> function wp_register_script( $handle, $src, $deps = array(), $ver = false, $in_footer = false ) {
</span><span class="cx">         global $wp_scripts;
</span><span class="lines">@@ -56,7 +61,7 @@
</span><span class="cx"> * Localizes only if script has already been added.
</span><span class="cx"> *
</span><span class="cx"> * @since r16
</span><del>- * @see WP_Script::localize()
</del><ins>+ * @see WP_Scripts::localize()
</ins><span class="cx"> */
</span><span class="cx"> function wp_localize_script( $handle, $object_name, $l10n ) {
</span><span class="cx">         global $wp_scripts;
</span><span class="lines">@@ -86,8 +91,8 @@
</span><span class="cx"> * Registers the script if src provided (does NOT overwrite) and enqueues.
</span><span class="cx"> *
</span><span class="cx"> * @since r16
</span><del>- * @see WP_Script::add(), WP_Script::enqueue()
-*/
</del><ins>+ * @see wp_register_script() For parameter information.
+ */
</ins><span class="cx"> function wp_enqueue_script( $handle, $src = false, $deps = array(), $ver = false, $in_footer = false ) {
</span><span class="cx">         global $wp_scripts;
</span><span class="cx">         if ( !is_a($wp_scripts, 'WP_Scripts') )
</span></span></pre></div>
<a id="trunkwpincludesfunctionswpstylesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/functions.wp-styles.php (12557 => 12558)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/functions.wp-styles.php        2009-12-27 22:30:58 UTC (rev 12557)
+++ trunk/wp-includes/functions.wp-styles.php        2009-12-28 00:48:20 UTC (rev 12558)
</span><span class="lines">@@ -45,9 +45,8 @@
</span><span class="cx"> * @param string|bool $src Path to the stylesheet from the root directory of WordPress. Example: '/css/mystyle.css'.
</span><span class="cx"> * @param array $deps Array of handles of any stylesheet that this stylesheet depends on.
</span><span class="cx"> * (Stylesheets that must be loaded before this stylesheet.) Pass an empty array if there are no dependencies.
</span><del>- * @param string|bool $ver String specifying the stylesheet version number, if it has one. This parameter
- * is used to ensure that the correct version is sent to the client regardless of caching, and so should be included
- * if a version number is available and makes sense for the stylesheet.
</del><ins>+ * @param string|bool $ver String specifying the stylesheet version number. Set to NULL to disable.
+ * Used to ensure that the correct version is sent to the client regardless of caching.
</ins><span class="cx"> * @param string $media The media for which this stylesheet has been defined.
</span><span class="cx"> */
</span><span class="cx"> function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media = 'all' ) {
</span><span class="lines">@@ -78,6 +77,8 @@
</span><span class="cx"> /**
</span><span class="cx"> * Enqueue a CSS style file.
</span><span class="cx"> *
</span><ins>+ * Registers the style if src provided (does NOT overwrite) and enqueues.
+ *
</ins><span class="cx"> * @since r79
</span><span class="cx"> * @see WP_Styles::add(), WP_Styles::enqueue()
</span><span class="cx"> * @global object $wp_styles The WP_Styles object for printing styles.
</span></span></pre>
</div>
</div>
</body>
</html>