Jetpack::get_parsed_theme_data PHP Method

get_parsed_theme_data() public static method

Gets and parses theme data to send with the heartbeat data
Since: 3.8.1
public static get_parsed_theme_data ( ) : array
return array Array of theme data
    public static function get_parsed_theme_data()
    {
        $all_themes = wp_get_themes(array('allowed' => true));
        $header_keys = array('Name', 'Author', 'Version', 'ThemeURI', 'AuthorURI', 'Status', 'Tags');
        $themes = array();
        foreach ($all_themes as $slug => $theme_data) {
            $theme_headers = array();
            foreach ($header_keys as $header_key) {
                $theme_headers[$header_key] = $theme_data->get($header_key);
            }
            $themes[$slug] = array('is_active_theme' => $slug == wp_get_theme()->get_template(), 'slug' => $slug, 'theme_root' => $theme_data->get_theme_root_uri(), 'parent' => $theme_data->parent(), 'headers' => $theme_headers);
        }
        return $themes;
    }

Usage Example

コード例 #1
0
 /**
  * Get additional stat data to sync to WPCOM
  */
 function get_additional_stat_data($prefix = '')
 {
     $return["{$prefix}themes"] = Jetpack::get_parsed_theme_data();
     $return["{$prefix}plugins-extra"] = Jetpack::get_parsed_plugin_data();
     $return["{$prefix}users"] = count_users();
     $return["{$prefix}site-count"] = 0;
     if (function_exists('get_blog_count')) {
         $return["{$prefix}site-count"] = get_blog_count();
     }
     return $return;
 }
All Usage Examples Of Jetpack::get_parsed_theme_data
Jetpack