X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/dc1231b7312fbdca99e9e887cc2bb35a28f85cdc..03f2fa83c13c1b532284205fa7efcab9b8b2c41f:/wp-includes/class-wp-theme.php diff --git a/wp-includes/class-wp-theme.php b/wp-includes/class-wp-theme.php index ad70a4bf..2128df23 100644 --- a/wp-includes/class-wp-theme.php +++ b/wp-includes/class-wp-theme.php @@ -4,10 +4,21 @@ * * @package WordPress * @subpackage Theme + * @since 3.4.0 */ - final class WP_Theme implements ArrayAccess { + /** + * Whether the theme has been marked as updateable. + * + * @since 4.4.0 + * @access public + * @var bool + * + * @see WP_MS_Themes_List_Table + */ + public $update = false; + /** * Headers for style.css files. * @@ -45,6 +56,7 @@ final class WP_Theme implements ArrayAccess { 'twentythirteen' => 'Twenty Thirteen', 'twentyfourteen' => 'Twenty Fourteen', 'twentyfifteen' => 'Twenty Fifteen', + 'twentysixteen' => 'Twenty Sixteen', ); /** @@ -1010,18 +1022,15 @@ final class WP_Theme implements ArrayAccess { /** * Filter list of page templates for a theme. * - * This filter does not currently allow for page templates to be added. - * * @since 3.9.0 + * @since 4.4.0 Converted to allow complete control over the `$page_templates` array. * * @param array $page_templates Array of page templates. Keys are filenames, * values are translated names. * @param WP_Theme $this The theme object. * @param WP_Post|null $post The post being edited, provided for context, or null. */ - $return = apply_filters( 'theme_page_templates', $page_templates, $this, $post ); - - return array_intersect_assoc( $return, $page_templates ); + return (array) apply_filters( 'theme_page_templates', $page_templates, $this, $post ); } /** @@ -1142,6 +1151,23 @@ final class WP_Theme implements ArrayAccess { return false; } + /** + * Determines the latest WordPress default theme that is installed. + * + * This hits the filesystem. + * + * @return WP_Theme|false Object, or false if no theme is installed, which would be bad. + */ + public static function get_core_default_theme() { + foreach ( array_reverse( self::$default_themes ) as $slug => $name ) { + $theme = wp_get_theme( $slug ); + if ( $theme->exists() ) { + return $theme; + } + } + return false; + } + /** * Returns array of stylesheet names of themes allowed on the site or network. *