@@ -22,30 +22,34 @@ class WP_Styles extends WP_Dependencies {
2222 * Full URL with trailing slash.
2323 *
2424 * @since 2.6.0
25- * @var string
25+ * @see wp_default_styles()
26+ * @var string|null
2627 */
2728 public $ base_url ;
2829
2930 /**
3031 * URL of the content directory.
3132 *
3233 * @since 2.8.0
33- * @var string
34+ * @see wp_default_styles()
35+ * @var string|null
3436 */
3537 public $ content_url ;
3638
3739 /**
3840 * Default version string for stylesheets.
3941 *
4042 * @since 2.6.0
41- * @var string
43+ * @see wp_default_styles()
44+ * @var string|null
4245 */
4346 public $ default_version ;
4447
4548 /**
4649 * The current text direction.
4750 *
4851 * @since 2.6.0
52+ * @see wp_default_styles()
4953 * @var string
5054 */
5155 public $ text_direction = 'ltr ' ;
@@ -96,6 +100,7 @@ class WP_Styles extends WP_Dependencies {
96100 * List of default directories.
97101 *
98102 * @since 2.8.0
103+ * @see wp_default_styles()
99104 * @var string[]|null
100105 */
101106 public $ default_dirs ;
@@ -217,7 +222,7 @@ public function do_item( $handle, $group = false ) {
217222 return true ;
218223 }
219224
220- $ href = $ this ->_css_href ( $ src , $ ver , $ handle );
225+ $ href = $ this ->_css_href ( $ src , $ obj -> ver , $ handle );
221226 if ( ! $ href ) {
222227 return true ;
223228 }
@@ -423,19 +428,29 @@ public function all_deps( $handles, $recursion = false, $group = false ) {
423428 *
424429 * @since 2.6.0
425430 *
426- * @param string $src The source of the enqueued style.
427- * @param string $ver The version of the enqueued style.
428- * @param string $handle The style's registered handle.
431+ * @param string $src The source of the enqueued style.
432+ * @param string|false|null $ver The version of the enqueued style.
433+ * @param string $handle The style's registered handle.
429434 * @return string Style's fully-qualified URL.
430435 */
431436 public function _css_href ( $ src , $ ver , $ handle ) {
432437 if ( ! is_bool ( $ src ) && ! preg_match ( '|^(https?:)?//| ' , $ src ) && ! ( $ this ->content_url && str_starts_with ( $ src , $ this ->content_url ) ) ) {
433438 $ src = $ this ->base_url . $ src ;
434439 }
435440
436- if ( ! empty ( $ ver ) ) {
437- $ src = add_query_arg ( 'ver ' , $ ver , $ src );
441+ $ query_args = array ();
442+ if ( empty ( $ ver ) && null !== $ ver && is_string ( $ this ->default_version ) ) {
443+ $ query_args ['ver ' ] = $ this ->default_version ;
444+ } elseif ( is_scalar ( $ ver ) ) {
445+ $ query_args ['ver ' ] = (string ) $ ver ;
446+ }
447+ if ( isset ( $ this ->args [ $ handle ] ) ) {
448+ parse_str ( $ this ->args [ $ handle ], $ parsed_args );
449+ if ( $ parsed_args ) {
450+ $ query_args = array_merge ( $ query_args , $ parsed_args );
451+ }
438452 }
453+ $ src = add_query_arg ( rawurlencode_deep ( $ query_args ), $ src );
439454
440455 /**
441456 * Filters an enqueued style's fully-qualified URL.
0 commit comments