Example #1
0
/**
 * Returns themes array
 *
 * @return array
 */
function w3_get_themes()
{
    $themes = array();
    $wp_themes = w3tc_get_themes();
    foreach ($wp_themes as $wp_theme) {
        $theme_key = w3_get_theme_key($wp_theme['Theme Root'], $wp_theme['Template'], $wp_theme['Stylesheet']);
        $themes[$theme_key] = $wp_theme['Name'];
    }
    return $themes;
}
Example #2
0
function w3tc_get_theme($themename)
{
    global $wp_version;
    if (version_compare($wp_version, '3.4', '<')) {
        return get_theme($themename);
    }
    $wp_themes = w3tc_get_themes();
    if (is_array($wp_themes) && array_key_exists($themename, $wp_themes)) {
        return $wp_themes[$themename];
    }
    return array();
}
Example #3
0
 /**
  * @param $extensions
  * @param W3_Config $config
  * @return mixed
  */
 function extension($extensions, $config)
 {
     $fc_enabled = (w3_is_pro($config) || w3_is_enterprise($config)) && $config->get_boolean('fragmentcache.enabled');
     $activation_enabled = $fc_enabled && defined('PARENT_THEME_NAME') && PARENT_THEME_NAME == 'Genesis' && defined('PARENT_THEME_VERSION') && version_compare(PARENT_THEME_VERSION, '1.9.0') >= 0;
     $message = array();
     if (is_network_admin()) {
         w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/themes.php');
         $themes = w3tc_get_themes();
         $exists = false;
         foreach ($themes as $theme) {
             if (strtolower($theme->Template) == 'genesis') {
                 $exists = true;
             }
         }
         if (!$exists) {
             $message[] = 'Genesis Framework';
         }
     } elseif (!(defined('PARENT_THEME_NAME') && PARENT_THEME_NAME == 'Genesis')) {
         $message[] = 'Genesis Framework version >= 1.9.0';
     }
     if (!$fc_enabled) {
         $message[] = 'Fragment Cache (W3 Total Cache Pro)';
     }
     $extensions['genesis.theme'] = array('name' => 'Genesis Framework', 'author' => 'W3 EDGE', 'description' => 'Provides 30-60% improvement in page generation time for the Genesis Framework by Copyblogger Media.', 'author uri' => 'http://www.w3-edge.com/', 'extension uri' => 'http://www.w3-edge.com/', 'extension id' => 'genesis.theme', 'version' => '0.1', 'enabled' => $activation_enabled, 'requirements' => implode(', ', $message), 'path' => 'w3-total-cache/extensions/Genesis.php');
     return $extensions;
 }
Example #4
0
 /**
  * Return array of themes
  *
  * @return array
  */
 function get_themes()
 {
     $themes = array();
     $wp_themes = w3tc_get_themes();
     foreach ($wp_themes as $wp_theme) {
         $theme_key = sprintf('%s/%s', $wp_theme['Template'], $wp_theme['Stylesheet']);
         $themes[$theme_key] = $wp_theme['Name'];
     }
     return $themes;
 }