]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/class-wp-theme.php
WordPress 4.4
[autoinstalls/wordpress.git] / wp-includes / class-wp-theme.php
index ad70a4bf9e38f789819e2ac40b933c1401df1d9b..2128df230f7f275913039680a56d173260a95d39 100644 (file)
@@ -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.
         *