@@ -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 ;
@@ -212,7 +217,7 @@ public function do_item( $handle, $group = false ) {
212217 return true ;
213218 }
214219
215- $ href = $ this ->_css_href ( $ src , $ ver , $ handle );
220+ $ href = $ this ->_css_href ( $ src , $ obj -> ver , $ handle );
216221 if ( ! $ href ) {
217222 return true ;
218223 }
@@ -419,19 +424,29 @@ public function all_deps( $handles, $recursion = false, $group = false ) {
419424 *
420425 * @since 2.6.0
421426 *
422- * @param string $src The source of the enqueued style.
423- * @param string $ver The version of the enqueued style.
424- * @param string $handle The style's registered handle.
427+ * @param string $src The source of the enqueued style.
428+ * @param string|false|null $ver The version of the enqueued style.
429+ * @param string $handle The style's registered handle.
425430 * @return string Style's fully-qualified URL.
426431 */
427432 public function _css_href ( $ src , $ ver , $ handle ) {
428433 if ( ! is_bool ( $ src ) && ! preg_match ( '|^(https?:)?//| ' , $ src ) && ! ( $ this ->content_url && str_starts_with ( $ src , $ this ->content_url ) ) ) {
429434 $ src = $ this ->base_url . $ src ;
430435 }
431436
432- if ( ! empty ( $ ver ) ) {
433- $ src = add_query_arg ( 'ver ' , $ ver , $ src );
437+ $ query_args = array ();
438+ if ( false === $ ver && is_string ( $ this ->default_version ) ) {
439+ $ query_args ['ver ' ] = $ this ->default_version ;
440+ } elseif ( is_scalar ( $ ver ) ) {
441+ $ query_args ['ver ' ] = (string ) $ ver ;
442+ }
443+ if ( isset ( $ this ->args [ $ handle ] ) ) {
444+ parse_str ( $ this ->args [ $ handle ], $ parsed_args );
445+ if ( $ parsed_args ) {
446+ $ query_args = array_merge ( $ query_args , $ parsed_args );
447+ }
434448 }
449+ $ src = add_query_arg ( rawurlencode_deep ( $ query_args ), $ src );
435450
436451 /**
437452 * Filters an enqueued style's fully-qualified URL.
0 commit comments