diff -r 3d4e9c994f10 -r a86126ab1dd4 wp/wp-includes/class-wp-theme.php --- a/wp/wp-includes/class-wp-theme.php Tue Oct 22 16:11:46 2019 +0200 +++ b/wp/wp-includes/class-wp-theme.php Tue Dec 15 13:49:49 2020 +0100 @@ -21,6 +21,8 @@ /** * Headers for style.css files. * + * @since 3.4.0 + * @since 5.4.0 Added `Requires at least` and `Requires PHP` headers. * @var array */ private static $file_headers = array( @@ -35,6 +37,8 @@ 'Tags' => 'Tags', 'TextDomain' => 'Text Domain', 'DomainPath' => 'Domain Path', + 'RequiresWP' => 'Requires at least', + 'RequiresPHP' => 'Requires PHP', ); /** @@ -54,6 +58,7 @@ 'twentysixteen' => 'Twenty Sixteen', 'twentyseventeen' => 'Twenty Seventeen', 'twentynineteen' => 'Twenty Nineteen', + 'twentytwenty' => 'Twenty Twenty', ); /** @@ -172,13 +177,13 @@ /** * Constructor for WP_Theme. * - * @since 3.4.0 + * @since 3.4.0 * * @global array $wp_theme_directories * - * @param string $theme_dir Directory of the theme within the theme_root. - * @param string $theme_root Theme root. - * @param WP_Error|void $_child If this theme is a parent theme, the child may be passed for validation purposes. + * @param string $theme_dir Directory of the theme within the theme_root. + * @param string $theme_root Theme root. + * @param WP_Theme|null $_child If this theme is a parent theme, the child may be passed for validation purposes. */ public function __construct( $theme_dir, $theme_root, $_child = null ) { global $wp_theme_directories; @@ -201,7 +206,9 @@ $this->stylesheet = $theme_dir; // Correct a situation where the theme is 'some-directory/some-theme' but 'some-directory' was passed in as part of the theme root instead. - if ( ! in_array( $theme_root, (array) $wp_theme_directories ) && in_array( dirname( $theme_root ), (array) $wp_theme_directories ) ) { + if ( ! in_array( $theme_root, (array) $wp_theme_directories, true ) + && in_array( dirname( $theme_root ), (array) $wp_theme_directories, true ) + ) { $this->stylesheet = basename( $this->theme_root ) . '/' . $this->stylesheet; $this->theme_root = dirname( $theme_root ); } @@ -226,7 +233,14 @@ } elseif ( ! file_exists( $this->theme_root . '/' . $theme_file ) ) { $this->headers['Name'] = $this->stylesheet; if ( ! file_exists( $this->theme_root . '/' . $this->stylesheet ) ) { - $this->errors = new WP_Error( 'theme_not_found', sprintf( __( 'The theme directory "%s" does not exist.' ), esc_html( $this->stylesheet ) ) ); + $this->errors = new WP_Error( + 'theme_not_found', + sprintf( + /* translators: %s: Theme directory name. */ + __( 'The theme directory "%s" does not exist.' ), + esc_html( $this->stylesheet ) + ) + ); } else { $this->errors = new WP_Error( 'theme_no_stylesheet', __( 'Stylesheet is missing.' ) ); } @@ -241,7 +255,7 @@ ) ); if ( ! file_exists( $this->theme_root ) ) { // Don't cache this one. - $this->errors->add( 'theme_root_missing', __( 'ERROR: The themes directory is either empty or doesn’t exist. Please check your installation.' ) ); + $this->errors->add( 'theme_root_missing', __( 'Error: The themes directory is either empty or doesn’t exist. Please check your installation.' ) ); } return; } elseif ( ! is_readable( $this->theme_root . '/' . $theme_file ) ) { @@ -262,7 +276,8 @@ $this->headers = get_file_data( $this->theme_root . '/' . $theme_file, self::$file_headers, 'theme' ); // Default themes always trump their pretenders. // Properly identify default themes that are inside a directory within wp-content/themes. - if ( $default_theme_slug = array_search( $this->headers['Name'], self::$default_themes ) ) { + $default_theme_slug = array_search( $this->headers['Name'], self::$default_themes, true ); + if ( $default_theme_slug ) { if ( basename( $this->stylesheet ) != $default_theme_slug ) { $this->headers['Name'] .= '/' . $this->stylesheet; } @@ -270,8 +285,14 @@ } if ( ! $this->template && $this->stylesheet === $this->headers['Template'] ) { - /* translators: %s: Template */ - $this->errors = new WP_Error( 'theme_child_invalid', sprintf( __( 'The theme defines itself as its parent theme. Please check the %s header.' ), 'Template' ) ); + $this->errors = new WP_Error( + 'theme_child_invalid', + sprintf( + /* translators: %s: Template. */ + __( 'The theme defines itself as its parent theme. Please check the %s header.' ), + 'Template' + ) + ); $this->cache_add( 'theme', array( @@ -285,11 +306,15 @@ } // (If template is set from cache [and there are no errors], we know it's good.) - if ( ! $this->template && ! ( $this->template = $this->headers['Template'] ) ) { + if ( ! $this->template ) { + $this->template = $this->headers['Template']; + } + + if ( ! $this->template ) { $this->template = $this->stylesheet; if ( ! file_exists( $this->theme_root . '/' . $this->stylesheet . '/index.php' ) ) { $error_message = sprintf( - /* translators: 1: index.php, 2: link to documentation, 3: style.css */ + /* translators: 1: index.php, 2: Documentation URL, 3: style.css */ __( 'Template is missing. Standalone themes need to have a %1$s template file. Child themes need to have a Template header in the %3$s stylesheet.' ), 'index.php', __( 'https://developer.wordpress.org/themes/advanced-topics/child-themes/' ), @@ -313,16 +338,25 @@ if ( ! is_array( $cache ) && $this->template != $this->stylesheet && ! file_exists( $this->theme_root . '/' . $this->template . '/index.php' ) ) { // If we're in a directory of themes inside /themes, look for the parent nearby. // wp-content/themes/directory-of-themes/* - $parent_dir = dirname( $this->stylesheet ); - if ( '.' != $parent_dir && file_exists( $this->theme_root . '/' . $parent_dir . '/' . $this->template . '/index.php' ) ) { + $parent_dir = dirname( $this->stylesheet ); + $directories = search_theme_directories(); + + if ( '.' !== $parent_dir && file_exists( $this->theme_root . '/' . $parent_dir . '/' . $this->template . '/index.php' ) ) { $this->template = $parent_dir . '/' . $this->template; - } elseif ( ( $directories = search_theme_directories() ) && isset( $directories[ $this->template ] ) ) { + } elseif ( $directories && isset( $directories[ $this->template ] ) ) { // Look for the template in the search_theme_directories() results, in case it is in another theme root. // We don't look into directories of themes, just the theme root. $theme_root_template = $directories[ $this->template ]['theme_root']; } else { // Parent theme is missing. - $this->errors = new WP_Error( 'theme_no_parent', sprintf( __( 'The parent theme is missing. Please install the "%s" parent theme.' ), esc_html( $this->template ) ) ); + $this->errors = new WP_Error( + 'theme_no_parent', + sprintf( + /* translators: %s: Theme directory name. */ + __( 'The parent theme is missing. Please install the "%s" parent theme.' ), + esc_html( $this->template ) + ) + ); $this->cache_add( 'theme', array( @@ -342,7 +376,14 @@ // If we are a parent, then there is a problem. Only two generations allowed! Cancel things out. if ( $_child instanceof WP_Theme && $_child->template == $this->stylesheet ) { $_child->parent = null; - $_child->errors = new WP_Error( 'theme_parent_invalid', sprintf( __( 'The "%s" theme is not a valid parent theme.' ), esc_html( $_child->template ) ) ); + $_child->errors = new WP_Error( + 'theme_parent_invalid', + sprintf( + /* translators: %s: Theme directory name. */ + __( 'The "%s" theme is not a valid parent theme.' ), + esc_html( $_child->template ) + ) + ); $_child->cache_add( 'theme', array( @@ -354,7 +395,14 @@ ); // The two themes actually reference each other with the Template header. if ( $_child->stylesheet == $this->template ) { - $this->errors = new WP_Error( 'theme_parent_invalid', sprintf( __( 'The "%s" theme is not a valid parent theme.' ), esc_html( $this->template ) ) ); + $this->errors = new WP_Error( + 'theme_parent_invalid', + sprintf( + /* translators: %s: Theme directory name. */ + __( 'The "%s" theme is not a valid parent theme.' ), + esc_html( $this->template ) + ) + ); $this->cache_add( 'theme', array( @@ -394,7 +442,7 @@ /** * When converting the object to a string, the theme name is returned. * - * @since 3.4.0 + * @since 3.4.0 * * @return string Theme name, ready for display (translated) */ @@ -405,9 +453,7 @@ /** * __isset() magic method for properties formerly returned by current_theme_info() * - * @staticvar array $properties - * - * @since 3.4.0 + * @since 3.4.0 * * @param string $offset Property to check if set. * @return bool Whether the given property is set. @@ -430,13 +476,13 @@ 'theme_root_uri', ); - return in_array( $offset, $properties ); + return in_array( $offset, $properties, true ); } /** * __get() magic method for properties formerly returned by current_theme_info() * - * @since 3.4.0 + * @since 3.4.0 * * @param string $offset Property to get. * @return mixed Property value. @@ -480,7 +526,7 @@ /** * Method to implement ArrayAccess for keys formerly returned by get_themes() * - * @since 3.4.0 + * @since 3.4.0 * * @param mixed $offset * @param mixed $value @@ -490,7 +536,7 @@ /** * Method to implement ArrayAccess for keys formerly returned by get_themes() * - * @since 3.4.0 + * @since 3.4.0 * * @param mixed $offset */ @@ -499,9 +545,7 @@ /** * Method to implement ArrayAccess for keys formerly returned by get_themes() * - * @staticvar array $keys - * - * @since 3.4.0 + * @since 3.4.0 * * @param mixed $offset * @return bool @@ -529,7 +573,7 @@ 'Parent Theme', ); - return in_array( $offset, $keys ); + return in_array( $offset, $keys, true ); } /** @@ -542,7 +586,7 @@ * and care should be taken to use `$theme::display( 'Name' )` to get a properly * translated header. * - * @since 3.4.0 + * @since 3.4.0 * * @param mixed $offset * @return mixed @@ -616,7 +660,7 @@ * @return bool Whether the theme exists. */ public function exists() { - return ! ( $this->errors() && in_array( 'theme_not_found', $this->errors()->get_error_codes() ) ); + return ! ( $this->errors() && in_array( 'theme_not_found', $this->errors()->get_error_codes(), true ) ); } /** @@ -637,8 +681,8 @@ * * @since 3.4.0 * - * @param string $key Type of data to store (theme, screenshot, headers, post_templates) - * @param string $data Data to store + * @param string $key Type of data to store (theme, screenshot, headers, post_templates) + * @param array|string $data Data to store * @return bool Return value from wp_cache_add() */ private function cache_add( $key, $data ) { @@ -668,8 +712,14 @@ foreach ( array( 'theme', 'screenshot', 'headers', 'post_templates' ) as $key ) { wp_cache_delete( $key . '-' . $this->cache_hash, 'themes' ); } - $this->template = $this->textdomain_loaded = $this->theme_root_uri = $this->parent = $this->errors = $this->headers_sanitized = $this->name_translated = null; - $this->headers = array(); + $this->template = null; + $this->textdomain_loaded = null; + $this->theme_root_uri = null; + $this->parent = null; + $this->errors = null; + $this->headers_sanitized = null; + $this->name_translated = null; + $this->headers = array(); $this->__construct( $this->stylesheet, $this->theme_root ); } @@ -687,7 +737,7 @@ * @since 3.4.0 * * @param string $header Theme header. Name, Description, Author, Version, ThemeURI, AuthorURI, Status, Tags. - * @return string|false String on success, false on failure. + * @return string|array|false String or array (for Tags header) on success, false on failure. */ public function get( $header ) { if ( ! isset( $this->headers[ $header ] ) ) { @@ -723,10 +773,11 @@ * * @since 3.4.0 * - * @param string $header Theme header. Name, Description, Author, Version, ThemeURI, AuthorURI, Status, Tags. - * @param bool $markup Optional. Whether to mark up the header. Defaults to true. - * @param bool $translate Optional. Whether to translate the header. Defaults to true. - * @return string|false Processed header, false on failure. + * @param string $header Theme header. Name, Description, Author, Version, ThemeURI, AuthorURI, Status, Tags. + * @param bool $markup Optional. Whether to mark up the header. Defaults to true. + * @param bool $translate Optional. Whether to translate the header. Defaults to true. + * @return string|array|false Processed header. An array for Tags if `$markup` is false, string otherwise. + * False on failure. */ public function display( $header, $markup = true, $translate = true ) { $value = $this->get( $header ); @@ -753,13 +804,12 @@ * Sanitize a theme header. * * @since 3.4.0 - * - * @staticvar array $header_tags - * @staticvar array $header_tags_with_a + * @since 5.4.0 Added support for `Requires at least` and `Requires PHP` headers. * - * @param string $header Theme header. Name, Description, Author, Version, ThemeURI, AuthorURI, Status, Tags. - * @param string $value Value to sanitize. - * @return mixed + * @param string $header Theme header. Accepts 'Name', 'Description', 'Author', 'Version', + * 'ThemeURI', 'AuthorURI', 'Status', 'Tags', 'RequiresWP', 'RequiresPHP'. + * @param string $value Value to sanitize. + * @return string|array An array for Tags header, string otherwise. */ private function sanitize_header( $header, $value ) { switch ( $header ) { @@ -777,7 +827,8 @@ 'em' => true, 'strong' => true, ); - $value = wp_kses( $value, $header_tags ); + + $value = wp_kses( $value, $header_tags ); break; case 'Author': // There shouldn't be anchor tags in Author, but some themes like to be challenging. @@ -793,7 +844,8 @@ 'em' => true, 'strong' => true, ); - $value = wp_kses( $value, $header_tags_with_a ); + + $value = wp_kses( $value, $header_tags_with_a ); break; case 'ThemeURI': case 'AuthorURI': @@ -803,6 +855,8 @@ $value = array_filter( array_map( 'trim', explode( ',', strip_tags( $value ) ) ) ); break; case 'Version': + case 'RequiresWP': + case 'RequiresPHP': $value = strip_tags( $value ); break; } @@ -815,11 +869,9 @@ * * @since 3.4.0 * - * @staticvar string $comma - * - * @param string $header Theme header. Name, Description, Author, Version, ThemeURI, AuthorURI, Status, Tags. - * @param string $value Value to mark up. - * @param string $translate Whether the header has been translated. + * @param string $header Theme header. Name, Description, Author, Version, ThemeURI, AuthorURI, Status, Tags. + * @param string|array $value Value to mark up. An array for Tags header, string otherwise. + * @param string $translate Whether the header has been translated. * @return string Value, marked up. */ private function markup_header( $header, $value, $translate ) { @@ -842,7 +894,7 @@ case 'Tags': static $comma = null; if ( ! isset( $comma ) ) { - /* translators: used between list items, there is a space after the comma */ + /* translators: Used between list items, there is a space after the comma. */ $comma = __( ', ' ); } $value = implode( $comma, $value ); @@ -861,11 +913,9 @@ * * @since 3.4.0 * - * @staticvar array $tags_list - * - * @param string $header Theme header. Name, Description, Author, Version, ThemeURI, AuthorURI, Status, Tags. - * @param string $value Value to translate. - * @return string Translated value. + * @param string $header Theme header. Name, Description, Author, Version, ThemeURI, AuthorURI, Status, Tags. + * @param string|array $value Value to translate. An array for Tags header, string otherwise. + * @return string|array Translated value. An array for Tags header, string otherwise. */ private function translate_header( $header, $value ) { switch ( $header ) { @@ -874,8 +924,10 @@ if ( isset( $this->name_translated ) ) { return $this->name_translated; } + // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText,WordPress.WP.I18n.NonSingularStringLiteralDomain $this->name_translated = translate( $value, $this->get( 'TextDomain' ) ); + return $this->name_translated; case 'Tags': if ( empty( $value ) || ! function_exists( 'get_theme_feature_list' ) ) { @@ -909,7 +961,8 @@ 'seasonal' => __( 'Seasonal' ), ); - $feature_list = get_theme_feature_list( false ); // No API + $feature_list = get_theme_feature_list( false ); // No API. + foreach ( $feature_list as $tags ) { $tags_list += $tags; } @@ -971,7 +1024,7 @@ * @return string Absolute path of the stylesheet directory. */ public function get_stylesheet_directory() { - if ( $this->errors() && in_array( 'theme_root_missing', $this->errors()->get_error_codes() ) ) { + if ( $this->errors() && in_array( 'theme_root_missing', $this->errors()->get_error_codes(), true ) ) { return ''; } @@ -1079,7 +1132,7 @@ public function get_screenshot( $uri = 'uri' ) { $screenshot = $this->cache_get( 'screenshot' ); if ( $screenshot ) { - if ( 'relative' == $uri ) { + if ( 'relative' === $uri ) { return $screenshot; } return $this->get_stylesheet_directory_uri() . '/' . $screenshot; @@ -1090,7 +1143,7 @@ foreach ( array( 'png', 'gif', 'jpg', 'jpeg' ) as $ext ) { if ( file_exists( $this->get_stylesheet_directory() . "/screenshot.$ext" ) ) { $this->cache_add( 'screenshot', 'screenshot.' . $ext ); - if ( 'relative' == $uri ) { + if ( 'relative' === $uri ) { return 'screenshot.' . $ext; } return $this->get_stylesheet_directory_uri() . '/' . 'screenshot.' . $ext; @@ -1106,11 +1159,13 @@ * * @since 3.4.0 * - * @param mixed $type Optional. Array of extensions to return. Defaults to all files (null). - * @param int $depth Optional. How deep to search for files. Defaults to a flat scan (0 depth). -1 depth is infinite. - * @param bool $search_parent Optional. Whether to return parent files. Defaults to false. - * @return array Array of files, keyed by the path to the file relative to the theme's directory, with the values - * being absolute paths. + * @param string[]|string $type Optional. Array of extensions to find, string of a single extension, + * or null for all extensions. Default null. + * @param int $depth Optional. How deep to search for files. Defaults to a flat scan (0 depth). + * -1 depth is infinite. + * @param bool $search_parent Optional. Whether to return parent files. Default false. + * @return string[] Array of files, keyed by the path to the file relative to the theme's directory, with the values + * being absolute paths. */ public function get_files( $type = null, $depth = 0, $search_parent = false ) { $files = (array) self::scandir( $this->get_stylesheet_directory(), $type, $depth ); @@ -1127,8 +1182,8 @@ * * @since 4.7.0 * - * @return array Array of page templates, keyed by filename and post type, - * with the value of the translated header name. + * @return string[] Array of page templates, keyed by filename and post type, + * with the value of the translated header name. */ public function get_post_templates() { // If you screw up your current theme and we invalidate your parent, most things still work. Let it slide. @@ -1186,7 +1241,7 @@ * @param WP_Post|null $post Optional. The post being edited, provided for context. * @param string $post_type Optional. Post type to get the templates for. Default 'page'. * If a post is provided, its post type is used. - * @return array Array of page templates, keyed by filename, with the value of the translated header name. + * @return string[] Array of template header names keyed by the template file name. */ public function get_page_templates( $post = null, $post_type = 'page' ) { if ( $post ) { @@ -1201,8 +1256,7 @@ * * @since 4.9.6 * - * @param string[] $post_templates Array of page templates. Keys are filenames, - * values are translated names. + * @param string[] $post_templates Array of template header names keyed by the template file name. * @param WP_Theme $this The theme object. * @param WP_Post|null $post The post being edited, provided for context, or null. * @param string $post_type Post type to get the templates for. @@ -1218,8 +1272,7 @@ * @since 4.4.0 Converted to allow complete control over the `$page_templates` array. * @since 4.7.0 Added the `$post_type` parameter. * - * @param string[] $post_templates Array of page templates. Keys are filenames, - * values are translated names. + * @param string[] $post_templates Array of template header names keyed by the template file name. * @param WP_Theme $this The theme object. * @param WP_Post|null $post The post being edited, provided for context, or null. * @param string $post_type Post type to get the templates for. @@ -1242,8 +1295,8 @@ * @param string $relative_path Optional. The basename of the absolute path. Used to control the * returned path for the found files, particularly when this function * recurses to lower depths. Default empty. - * @return array|false Array of files, keyed by the path to the file relative to the `$path` directory prepended - * with `$relative_path`, with the values being absolute paths. False otherwise. + * @return string[]|false Array of files, keyed by the path to the file relative to the `$path` directory prepended + * with `$relative_path`, with the values being absolute paths. False otherwise. */ private static function scandir( $path, $extensions = null, $depth = 0, $relative_path = '' ) { if ( ! is_dir( $path ) ) { @@ -1256,7 +1309,7 @@ } $relative_path = trailingslashit( $relative_path ); - if ( '/' == $relative_path ) { + if ( '/' === $relative_path ) { $relative_path = ''; } @@ -1273,7 +1326,7 @@ $exclusions = (array) apply_filters( 'theme_scandir_exclusions', array( 'CVS', 'node_modules', 'vendor', 'bower_components' ) ); foreach ( $results as $result ) { - if ( '.' == $result[0] || in_array( $result, $exclusions, true ) ) { + if ( '.' === $result[0] || in_array( $result, $exclusions, true ) ) { continue; } if ( is_dir( $path . '/' . $result ) ) { @@ -1293,7 +1346,7 @@ /** * Loads the theme's textdomain. * - * Translation files are not inherited from the parent theme. Todo: if this fails for the + * Translation files are not inherited from the parent theme. TODO: If this fails for the * child theme, it should probably try to load the parent theme's translations. * * @since 3.4.0 @@ -1317,8 +1370,9 @@ return true; } - $path = $this->get_stylesheet_directory(); - if ( $domainpath = $this->get( 'DomainPath' ) ) { + $path = $this->get_stylesheet_directory(); + $domainpath = $this->get( 'DomainPath' ); + if ( $domainpath ) { $path .= $domainpath; } else { $path .= '/languages'; @@ -1333,9 +1387,9 @@ * * @since 3.4.0 * - * @param string $check Optional. Whether to check only the 'network'-wide settings, the 'site' - * settings, or 'both'. Defaults to 'both'. - * @param int $blog_id Optional. Ignored if only network-wide settings are checked. Defaults to current site. + * @param string $check Optional. Whether to check only the 'network'-wide settings, the 'site' + * settings, or 'both'. Defaults to 'both'. + * @param int $blog_id Optional. Ignored if only network-wide settings are checked. Defaults to current site. * @return bool Whether the theme is allowed for the network. Returns true in single-site. */ public function is_allowed( $check = 'both', $blog_id = null ) { @@ -1343,14 +1397,14 @@ return true; } - if ( 'both' == $check || 'network' == $check ) { + if ( 'both' === $check || 'network' === $check ) { $allowed = self::get_allowed_on_network(); if ( ! empty( $allowed[ $this->get_stylesheet() ] ) ) { return true; } } - if ( 'both' == $check || 'site' == $check ) { + if ( 'both' === $check || 'site' === $check ) { $allowed = self::get_allowed_on_site( $blog_id ); if ( ! empty( $allowed[ $this->get_stylesheet() ] ) ) { return true; @@ -1365,7 +1419,7 @@ * * This hits the filesystem. * - * @since 4.4.0 + * @since 4.4.0 * * @return WP_Theme|false Object, or false if no theme is installed, which would be bad. */ @@ -1408,8 +1462,6 @@ * * @since 3.4.0 * - * @staticvar array $allowed_themes - * * @return string[] Array of stylesheet names. */ public static function get_allowed_on_network() { @@ -1435,8 +1487,6 @@ * * @since 3.4.0 * - * @staticvar array $allowed_themes - * * @param int $blog_id Optional. ID of the site. Defaults to the current site. * @return string[] Array of stylesheet names. */ @@ -1459,7 +1509,7 @@ return (array) apply_filters( 'site_allowed_themes', $allowed_themes[ $blog_id ], $blog_id ); } - $current = $blog_id == get_current_blog_id(); + $current = get_current_blog_id() == $blog_id; if ( $current ) { $allowed_themes[ $blog_id ] = get_option( 'allowedthemes' ); @@ -1586,8 +1636,8 @@ * * @since 3.4.0 * - * @param string $a First name. - * @param string $b Second name. + * @param WP_Theme $a First theme. + * @param WP_Theme $b Second theme. * @return int Negative if `$a` falls lower in the natural order than `$b`. Zero if they fall equally. * Greater than 0 if `$a` falls higher in the natural order than `$b`. Used with usort(). */ @@ -1600,8 +1650,8 @@ * * @since 3.4.0 * - * @param string $a First name. - * @param string $b Second name. + * @param WP_Theme $a First theme. + * @param WP_Theme $b Second theme. * @return int Negative if `$a` falls lower in the natural order than `$b`. Zero if they fall equally. * Greater than 0 if `$a` falls higher in the natural order than `$b`. Used with usort(). */