当前位置: 首页>>代码示例>>PHP>>正文


PHP search_theme_directories函数代码示例

本文整理汇总了PHP中search_theme_directories函数的典型用法代码示例。如果您正苦于以下问题:PHP search_theme_directories函数的具体用法?PHP search_theme_directories怎么用?PHP search_theme_directories使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了search_theme_directories函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: add_theme

function add_theme($themes)
{
    $merge_themes = array();
    if (\Pressbooks\Book::isBook()) {
        $registered_themes = search_theme_directories();
        foreach ($registered_themes as $key => $val) {
            if ($val['theme_root'] == __DIR__ . '/themes') {
                $merge_themes[$key] = 1;
            }
        }
        // add our theme
        $themes = array_merge($themes, $merge_themes);
    }
    return $themes;
}
开发者ID:BCcampus,项目名称:candela,代码行数:15,代码来源:candela-utility.php

示例2: core_build_folders_array

 private function core_build_folders_array()
 {
     $theme_directories = search_theme_directories();
     foreach ($theme_directories as $k => $v) {
         $dir = explode('/', $k);
         if (isset($dir[1])) {
             if (!in_array($dir[0], $this->folders_array)) {
                 $this->folders_array[] = $dir[0];
             }
         } else {
             if (!in_array('root', $this->folders_array)) {
                 $this->folders_array[] = 'root';
             }
         }
     }
 }
开发者ID:navjotjsingh,项目名称:ThemeCategories,代码行数:16,代码来源:theme-folder-categories.php

示例3: add_themes_to_filter

 /**
  * Add the plugin's specific themes to the PressBooks theme filter.
  * Inspirated from Textbook's one.
  *
  * @since    0.1
  * @param    array $themes The currently allowed themes in PressBooks
  * @return   array The array from the input, with the plugin's themes
  */
 public function add_themes_to_filter($themes)
 {
     $pbt_themes = array();
     if (\Pressbooks\Book::isBook()) {
         $registered_themes = search_theme_directories();
         foreach ($registered_themes as $key => $val) {
             if ($val['theme_root'] == plugin_dir_path(dirname(__FILE__)) . 'themes') {
                 $pbt_themes[$key] = 1;
             }
         }
         // add our theme to the whitelist
         $themes = array_merge($themes, $pbt_themes);
         return $themes;
     } else {
         return $themes;
     }
 }
开发者ID:Books4Languages,项目名称:Pressbooks-Lingua-Theme,代码行数:25,代码来源:class-pressbooks-lingua-theme-themes.php

示例4: rzct_options_page

function rzct_options_page()
{
    include_once RZCT_BASE_DIR . '/admin/rzct-process.php';
    $results = rzct_create_theme();
    if ($results === true) {
        return;
    }
    ?>
	<div class="wrap">
		<?php 
    screen_icon();
    ?>
		<h2><?php 
    esc_html_e('Create a Child Theme', 'rzct');
    ?>
</h2>
		<?php 
    settings_errors();
    ?>
		<form method="post" action="">
		<?php 
    wp_nonce_field('rzct_nonce');
    ?>
		<table class="form-table">
		<?php 
    $opts = array('name' => esc_html__('Child Theme Name', 'rzct'), 'template' => search_theme_directories(), 'uri' => esc_html__('Theme URI (optional)', 'rzct'), 'description' => esc_html__('Description (optional)', 'rzct'), 'version' => esc_html__('Version (optional)', 'rzct'), 'author' => esc_html__('Author (optional)', 'rzct'), 'author_uri' => esc_html__('Author URI (optional)', 'rzct'));
    echo "<tr valign='top'><th scope='row'>" . esc_html__('Template', 'rzct') . "</th><td><select name='rzct_template'>";
    foreach ($opts['template'] as $k => $v) {
        echo "<option value='" . $k . "'>" . $k . "</option>";
    }
    echo "</select></td></tr>";
    echo "<tr valign='top'><th scope='row'>{$opts['name']}</th><td><input class='regular-text' type='text' name='rzct_name' value=''></td></tr>\n\t\t\t<tr valign='top'><th scope='row'>{$opts['uri']}</th><td><input class='regular-text' type='text' name='rzct_uri' value=''></td></tr>\n\t\t\t<tr valign='top'><th scope='row'>{$opts['description']}</th><td><input class='regular-text' type='text' name='rzct_description' value=''></td></tr>\n\t\t\t<tr valign='top'><th scope='row'>{$opts['version']}</th><td><input class='regular-text' type='text' name='rzct_version' value=''></td></tr>\n\t\t\t<tr valign='top'><th scope='row'>{$opts['author']}</th><td><input class='regular-text' type='text' name='rzct_author' value=''></td></tr>\n\t\t\t<tr valign='top'><th scope='row'>{$opts['author_uri']}</th><td><input class='regular-text' type='text' name='rzct_author_uri' value=''></td></tr>\n\t\t\t<tr valign='top'><th scope='row'>Create a functions.php?</th><td><input class='regular-text' type='checkbox' name='rzct_function'></td</tr>\n\t\t\t<tr valign='top'><th scope='row'>Include changes to parent theme?</th><td><input class='regular-text' type='checkbox' name='rzct_parent'></td></tr>";
    ?>
		</table>
		<?php 
    submit_button(esc_html__('Create a child theme and activate it!', 'rzct'));
    ?>
		</form>
	</div>
<?php 
}
开发者ID:curtjen,项目名称:redzap-child-theme-generator,代码行数:41,代码来源:rzct-admin-page.php

示例5: __construct

 /**
  * Constructor for WP_Theme.
  *
  * @param string $theme_dir Directory of the theme within the theme_root.
  * @param string $theme_root Theme root.
  * @param WP_Error|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)
 {
     // Initialize caching on first run.
     if (!isset(self::$persistently_cache)) {
         self::$persistently_cache = apply_filters('wp_cache_themes_persistently', false, 'WP_Theme');
         if (self::$persistently_cache) {
             wp_cache_add_global_groups('themes');
             if (is_int(self::$persistently_cache)) {
                 self::$cache_expiration = self::$persistently_cache;
             }
         } else {
             wp_cache_add_non_persistent_groups('themes');
         }
     }
     $this->theme_root = $theme_root;
     $this->stylesheet = $theme_dir;
     $theme_file = $this->stylesheet . '/style.css';
     $cache = $this->cache_get('theme');
     if (is_array($cache)) {
         foreach (array('errors', 'headers', 'template') as $key) {
             if (isset($cache[$key])) {
                 $this->{$key} = $cache[$key];
             }
         }
         if ($this->errors) {
             return;
         }
         if (isset($cache['theme_root_template'])) {
             $theme_root_template = $cache['theme_root_template'];
         }
     } elseif (!file_exists($this->theme_root . '/' . $theme_file)) {
         $this->headers['Name'] = $this->stylesheet;
         $this->errors = new WP_Error('theme_no_stylesheet', __('Stylesheet is missing.'));
         $this->cache_add('theme', array('headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet));
         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&#8217;t exist. Please check your installation.'));
         }
         return;
     } elseif (!is_readable($this->theme_root . '/' . $theme_file)) {
         $this->headers['Name'] = $this->stylesheet;
         $this->errors = new WP_Error('theme_stylesheet_not_readable', __('Stylesheet is not readable.'));
         $this->cache_add('theme', array('headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet));
         return;
     } else {
         $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)) {
             if (basename($this->stylesheet) != $default_theme_slug) {
                 $this->headers['Name'] .= '/' . $this->stylesheet;
             }
         }
     }
     // (If template is set from cache, we know it's good.)
     if (!$this->template && !($this->template = $this->headers['Template'])) {
         if (file_exists($this->theme_root . '/' . $this->stylesheet . '/index.php')) {
             $this->template = $this->stylesheet;
         } else {
             $this->errors = new WP_Error('theme_no_index', __('Template is missing.'));
             $this->cache_add('theme', array('headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet));
             return;
         }
     }
     // If we got our data from cache, we can assume that 'template' is pointing to the right place.
     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')) {
             $this->template = $parent_dir . '/' . $this->template;
         } elseif (($directories = search_theme_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.'), $this->template));
             $this->cache_add('theme', array('headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template));
             return;
         }
     }
     // Set the parent, if we're a child theme.
     if ($this->template != $this->stylesheet) {
         // If we are a parent, then there is a problem. Only two generations allowed! Cancel things out.
         if (is_a($child, '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.'), $child->template));
             $child->cache_add('theme', array('headers' => $child->headers, 'errors' => $child->errors, 'stylesheet' => $child->stylesheet, 'template' => $child->template));
             // 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.'), $this->template));
                 $this->cache_add('theme', array('headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template));
//.........这里部分代码省略.........
开发者ID:netconstructor,项目名称:WordPress-1,代码行数:101,代码来源:class-wp-theme.php

示例6: get_theme_roots

/**
 * Retrieve theme roots.
 *
 * @since 2.9.0
 *
 * @return array|string An array of theme roots keyed by template/stylesheet or a single theme root if all themes have the same root.
 */
function get_theme_roots()
{
    global $wp_theme_directories;
    if (count($wp_theme_directories) <= 1) {
        return '/themes';
    }
    $theme_roots = get_site_transient('theme_roots');
    if (false === $theme_roots) {
        search_theme_directories(true);
        // Regenerate the transient.
        $theme_roots = get_site_transient('theme_roots');
    }
    return $theme_roots;
}
开发者ID:radman,项目名称:noobyo-blog,代码行数:21,代码来源:theme.php

示例7: dirname

require_once dirname(__FILE__) . '/admin.php';
require ABSPATH . 'wp-admin/includes/theme-install.php';
wp_reset_vars(array('tab'));
if (!current_user_can('install_themes')) {
    wp_die(__('You do not have sufficient permissions to install themes on this site.'));
}
if (is_multisite() && !is_network_admin()) {
    wp_redirect(network_admin_url('theme-install.php'));
    exit;
}
$title = __('Add Themes');
$parent_file = 'themes.php';
if (!is_network_admin()) {
    $submenu_file = 'themes.php';
}
$installed_themes = search_theme_directories();
foreach ($installed_themes as $k => $v) {
    if (false !== strpos($k, '/')) {
        unset($installed_themes[$k]);
    }
}
wp_localize_script('theme', '_wpThemeSettings', array('themes' => false, 'settings' => array('isInstall' => true, 'canInstall' => current_user_can('install_themes'), 'installURI' => current_user_can('install_themes') ? self_admin_url('theme-install.php') : null, 'adminUrl' => parse_url(self_admin_url(), PHP_URL_PATH)), 'l10n' => array('addNew' => __('Add New Theme'), 'search' => __('Search Themes'), 'searchPlaceholder' => __('Search themes...'), 'upload' => __('Upload Theme'), 'back' => __('Back'), 'error' => __('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.'), 'themesFound' => __('Number of Themes found: %d'), 'noThemesFound' => __('No themes found. Try a different search.'), 'collapseSidebar' => __('Collapse Sidebar'), 'expandSidebar' => __('Expand Sidebar')), 'installedThemes' => array_keys($installed_themes)));
wp_enqueue_script('theme');
if ($tab) {
    /**
     * Fires before each of the tabs are rendered on the Install Themes page.
     *
     * The dynamic portion of the hook name, `$tab`, refers to the current
     * theme install tab. Possible values are 'dashboard', 'search', 'upload',
     * 'featured', 'new', or 'updated'.
     *
开发者ID:qaryas,项目名称:qaryas_site,代码行数:31,代码来源:theme-install.php

示例8: get_all

 public static function get_all()
 {
     if (isset($GLOBALS['ithemes-updater-packages-all'])) {
         return $GLOBALS['ithemes-updater-packages-all'];
     }
     $packages = array();
     // Compatibility fix for WP < 3.1 as the global var is empty by default
     if (empty($GLOBALS['wp_theme_directories'])) {
         get_themes();
     }
     $themes = search_theme_directories();
     if (is_array($themes)) {
         foreach ($themes as $slug => $data) {
             if (!file_exists("{$data['theme_root']}/{$data['theme_file']}")) {
                 continue;
             }
             $headers = get_file_data("{$data['theme_root']}/{$data['theme_file']}", array('package' => 'iThemes Package'), 'theme');
             if (empty($headers['package'])) {
                 continue;
             }
             $packages["{$data['theme_root']}/{$data['theme_file']}"] = $headers['package'];
         }
     }
     require_once ABSPATH . 'wp-admin/includes/plugin.php';
     $plugins = get_plugins();
     foreach ($plugins as $file => $data) {
         if (!file_exists(WP_PLUGIN_DIR . "/{$file}")) {
             continue;
         }
         $headers = get_file_data(WP_PLUGIN_DIR . "/{$file}", array('package' => 'iThemes Package'), 'plugin');
         if (empty($headers['package'])) {
             continue;
         }
         $packages[WP_PLUGIN_DIR . "/{$file}"] = $headers['package'];
     }
     foreach ($packages as $path => $package) {
         $packages[$path] = strtolower($package);
     }
     $GLOBALS['ithemes-updater-packages-all'] = $packages;
     return $packages;
 }
开发者ID:AgilData,项目名称:WordPress-Skeleton,代码行数:41,代码来源:packages.php

示例9: get_themes

/**
 * Retrieve list of themes with theme data in theme directory.
 *
 * The theme is broken, if it doesn't have a parent theme and is missing either
 * style.css and, or index.php. If the theme has a parent theme then it is
 * broken, if it is missing style.css; index.php is optional. The broken theme
 * list is saved in the {@link $wp_broken_themes} global, which is displayed on
 * the theme list in the administration panels.
 *
 * @since 1.5.0
 * @global array $wp_broken_themes Stores the broken themes.
 * @global array $wp_themes Stores the working themes.
 *
 * @return array Theme list with theme data.
 */
function get_themes()
{
    global $wp_themes, $wp_broken_themes;
    if (isset($wp_themes)) {
        return $wp_themes;
    }
    /* Register the default root as a theme directory */
    register_theme_directory(get_theme_root());
    if (!($theme_files = search_theme_directories())) {
        return false;
    }
    asort($theme_files);
    $wp_themes = array();
    foreach ((array) $theme_files as $theme_file) {
        $theme_root = $theme_file['theme_root'];
        $theme_file = $theme_file['theme_file'];
        if (!is_readable("{$theme_root}/{$theme_file}")) {
            $wp_broken_themes[$theme_file] = array('Name' => $theme_file, 'Title' => $theme_file, 'Description' => __('File not readable.'));
            continue;
        }
        $theme_data = get_theme_data("{$theme_root}/{$theme_file}");
        $name = $theme_data['Name'];
        $title = $theme_data['Title'];
        $description = wptexturize($theme_data['Description']);
        $version = $theme_data['Version'];
        $author = $theme_data['Author'];
        $template = $theme_data['Template'];
        $stylesheet = dirname($theme_file);
        $screenshot = false;
        foreach (array('png', 'gif', 'jpg', 'jpeg') as $ext) {
            if (file_exists("{$theme_root}/{$stylesheet}/screenshot.{$ext}")) {
                $screenshot = "screenshot.{$ext}";
                break;
            }
        }
        if (empty($name)) {
            $name = dirname($theme_file);
            $title = $name;
        }
        $parent_template = $template;
        if (empty($template)) {
            if (file_exists("{$theme_root}/{$stylesheet}/index.php")) {
                $template = $stylesheet;
            } else {
                continue;
            }
        }
        $template = trim($template);
        if (!file_exists("{$theme_root}/{$template}/index.php")) {
            $parent_dir = dirname(dirname($theme_file));
            if (file_exists("{$theme_root}/{$parent_dir}/{$template}/index.php")) {
                $template = "{$parent_dir}/{$template}";
                $template_directory = "{$theme_root}/{$template}";
            } else {
                /**
                 * The parent theme doesn't exist in the current theme's folder or sub folder
                 * so lets use the theme root for the parent template.
                 */
                if (isset($theme_files[$template]) && file_exists($theme_files[$template]['theme_root'] . "/{$template}/index.php")) {
                    $template_directory = $theme_files[$template]['theme_root'] . "/{$template}";
                } else {
                    if (empty($parent_template)) {
                        $wp_broken_themes[$name] = array('Name' => $name, 'Title' => $title, 'Description' => __('Template is missing.'), 'error' => 'no_template');
                    } else {
                        $wp_broken_themes[$name] = array('Name' => $name, 'Title' => $title, 'Description' => sprintf(__('The parent theme is missing. Please install the "%s" parent theme.'), $parent_template), 'error' => 'no_parent', 'parent' => $parent_template);
                    }
                    continue;
                }
            }
        } else {
            $template_directory = trim($theme_root . '/' . $template);
        }
        $stylesheet_files = array();
        $template_files = array();
        $stylesheet_dir = @dir("{$theme_root}/{$stylesheet}");
        if ($stylesheet_dir) {
            while (($file = $stylesheet_dir->read()) !== false) {
                if (!preg_match('|^\\.+$|', $file)) {
                    if (preg_match('|\\.css$|', $file)) {
                        $stylesheet_files[] = "{$theme_root}/{$stylesheet}/{$file}";
                    } elseif (preg_match('|\\.php$|', $file)) {
                        $template_files[] = "{$theme_root}/{$stylesheet}/{$file}";
                    }
                }
            }
//.........这里部分代码省略.........
开发者ID:smrpr,项目名称:Fatlace,代码行数:101,代码来源:theme.php

示例10: __construct

 /**
  * Create an instance of WPDKTheme class
  *
  * @brief Construct
  *
  * @param string              $file
  * @param bool|WPDKThemeSetup $setup Optional. A your custom theme setup class model
  *
  * @return WPDKTheme
  */
 public function __construct($file, $setup = false)
 {
     if (false == $setup) {
         $this->setup = $setup = new WPDKThemeSetup();
     }
     $this->setup = apply_filters('wpdk_theme_setup-' . $file, $setup);
     // Autoload
     $this->_wpxThemeClassLoadingPath = array();
     spl_autoload_extensions('.php');
     // for faster execution
     spl_autoload_register(array($this, 'autoloadEnvironment'));
     // Path unix
     $this->path = trailingslashit(dirname($file));
     $this->classesPath = $this->path . 'classes/';
     // URLs.
     $this->url = trailingslashit(get_template_directory_uri());
     $this->assetsURL = $this->url . 'assets/';
     $this->cssURL = $this->assetsURL . 'css/';
     $this->imagesURL = $this->assetsURL . 'images/';
     $this->javascriptURL = $this->assetsURL . 'js/';
     $theme_key = basename(dirname($file));
     $theme_directories = search_theme_directories();
     $theme_file = $theme_directories[$theme_key]['theme_file'];
     $theme_root = $theme_directories[$theme_key]['theme_root'];
     // WP_Theme is a final class, so I must create a part object
     $this->theme = new WP_Theme($theme_key, $theme_root);
     // Loading constants defnies
     $defines = trailingslashit(dirname($file)) . self::DEFINES;
     if (file_exists($defines)) {
         require_once $defines;
     }
     // Register autoload classes
     if (method_exists($this, 'registerClasses')) {
         $this->registerClasses();
     }
     // Avoid access to admin
     add_action('admin_init', array($this, 'admin_init'));
     // Cleanup
     add_action('init', array($this, '_init'));
     // Setup
     add_action('init', array($this, 'init_theme'));
     // Shortcodes
     add_action('init', array($this, 'init_shortcode'));
     // Ajax setup
     if (wpdk_is_ajax()) {
         add_action('init', array($this, 'ajax'));
     }
     // After setup
     add_action('after_setup_theme', array($this, '_after_setup_theme'));
     add_action('after_setup_theme', array($this, 'after_setup_theme'));
     // Fires when scripts and styles are enqueued.
     add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'));
     // Fires before styles in the $handles queue are printed.
     add_action('wp_print_styles', array($this, 'wp_print_styles'));
     // Print scripts or data in the head tag on the front end.
     add_action('wp_head', array($this, '_wp_head'), 0);
     add_action('wp_head', array($this, 'wp_head'));
     // Footer
     add_action('wp_footer', array($this, 'wp_footer'));
     // Add classes to body class
     add_filter('body_class', array($this, '_body_classes'));
     // Custom size
     add_filter('image_size_names_choose', array($this, 'image_size_names_choose'));
 }
开发者ID:wpxtreme,项目名称:wpdk,代码行数:74,代码来源:wpdk-wordpress-theme.php

示例11: get_themes

 /**
  * get_themes method
  *
  * Wrapper to WP `wp_get_themes` or `get_themes` (whichever is available).
  * Method resets global variables and hooks, required for indexing, whilst
  * performing theme search. After themes are found - it caches these using
  * local static variable and restores global functions.
  *
  * @param bool $force Set to true to re-list themes
  *
  * @return array Map of theme names and their paths
  */
 public function get_themes($force = false, $options = array())
 {
     static $theme_map = array();
     $key = json_encode($options);
     if ($force || !isset($theme_map[$key])) {
         global $wp_theme_directories, $wp_broken_themes;
         $restore_vals = array('wp_theme_directories' => array(AI1EC_THEMES_ROOT), 'wp_broken_themes' => array());
         // mark restore point
         foreach ($restore_vals as $key => $cval) {
             $restore_vals[$key] = ${$key};
             ${$key} = $cval;
         }
         // disable and clean cache
         add_filter('wp_cache_themes_persistently', '__return_false', 1);
         search_theme_directories(true);
         $theme_list = NULL;
         if (function_exists('wp_get_themes')) {
             $theme_list = wp_get_themes($options);
         } else {
             if (isset($options['errors']) && $options['errors']) {
                 $theme_list = get_broken_themes();
             } else {
                 $theme_list = get_themes();
             }
         }
         foreach ($theme_list as $theme) {
             $theme_map[$key][$theme->get('Name')] = $theme;
             $theme->get_theme_root_uri();
             // pre-cache
         }
         unset($theme_list);
         // remove cache disablers and restore values
         remove_filter('wp_cache_themes_persistently', '__return_false', 1);
         foreach ($restore_vals as $key => $cval) {
             ${$key} = $cval;
         }
         search_theme_directories(true);
     }
     return $theme_map[$key];
 }
开发者ID:briancompton,项目名称:knightsplaza,代码行数:52,代码来源:class-ai1ec-themes-list-table.php

示例12: filterChildThemes

	/**
	 * Pressbooks filters allowed themes, this adds our themes to the list
	 * 
	 * @since 1.0.7
	 * @param array $themes
	 * @return array
	 */
	function filterChildThemes( $themes ) {
		$pbt_themes = array();

		if ( \Pressbooks\Book::isBook() ) {
			$registered_themes = search_theme_directories();

			foreach ( $registered_themes as $key => $val ) {
				if ( $val['theme_root'] == PBT_PLUGIN_DIR . 'themes-book' ) {
					$pbt_themes[$key] = 1;
				}
			}
			// add our theme
			$themes = array_merge( $themes, $pbt_themes );

			return $themes;
		} else {
			return $themes;
		}
	}
开发者ID:hughmcguire,项目名称:pressbooks-textbook,代码行数:26,代码来源:pressbooks-textbook.php

示例13: _replace_search_globals

 /**
  * Replacecs global variables.
  *
  * @param array $variables_map
  *
  * @return array
  */
 protected function _replace_search_globals(array $variables_map)
 {
     foreach ($variables_map as $key => $current_value) {
         global ${$key};
         $variables_map[$key] = ${$key};
         ${$key} = $current_value;
     }
     search_theme_directories(true);
     return $variables_map;
 }
开发者ID:sedici,项目名称:wpmu-istec,代码行数:17,代码来源:search.php

示例14: bulk_upgrade

 function bulk_upgrade($themes)
 {
     $this->init();
     $this->bulk = true;
     $this->upgrade_strings();
     $current = get_site_transient('update_themes');
     add_filter('upgrader_pre_install', array(&$this, 'current_before'), 10, 2);
     add_filter('upgrader_post_install', array(&$this, 'current_after'), 10, 2);
     add_filter('upgrader_clear_destination', array(&$this, 'delete_old_theme'), 10, 4);
     $this->skin->header();
     // Connect to the Filesystem first.
     $res = $this->fs_connect(array(WP_CONTENT_DIR));
     if (!$res) {
         $this->skin->footer();
         return false;
     }
     $this->skin->bulk_header();
     // Only start maintenance mode if running in Multisite OR the theme is in use
     $maintenance = is_multisite();
     // @TODO: This should only kick in for individual sites if at all possible.
     foreach ($themes as $theme) {
         $maintenance = $maintenance || $theme == get_stylesheet() || $theme == get_template();
     }
     if ($maintenance) {
         $this->maintenance_mode(true);
     }
     $results = array();
     $this->update_count = count($themes);
     $this->update_current = 0;
     foreach ($themes as $theme) {
         $this->update_current++;
         if (!isset($current->response[$theme])) {
             $this->skin->set_result(false);
             $this->skin->before();
             $this->skin->error('up_to_date');
             $this->skin->after();
             $results[$theme] = false;
             continue;
         }
         $this->skin->theme_info = $this->theme_info($theme);
         // Get the URL to the zip file
         $r = $current->response[$theme];
         $options = array('package' => $r['package'], 'destination' => WP_CONTENT_DIR . '/themes', 'clear_destination' => true, 'clear_working' => true, 'hook_extra' => array('theme' => $theme));
         $result = $this->run($options);
         $results[$theme] = $this->result;
         // Prevent credentials auth screen from displaying multiple times
         if (false === $result) {
             break;
         }
     }
     //end foreach $plugins
     $this->maintenance_mode(false);
     $this->skin->bulk_footer();
     $this->skin->footer();
     // Cleanup our hooks, in case something else does a upgrade on this connection.
     remove_filter('upgrader_pre_install', array(&$this, 'current_before'), 10, 2);
     remove_filter('upgrader_post_install', array(&$this, 'current_after'), 10, 2);
     remove_filter('upgrader_clear_destination', array(&$this, 'delete_old_theme'), 10, 4);
     // Force refresh of theme update information
     delete_site_transient('update_themes');
     search_theme_directories(true);
     foreach (wp_get_themes() as $theme) {
         $theme->cache_delete();
     }
     return $results;
 }
开发者ID:par-orillonsoft,项目名称:Wishmagnet,代码行数:66,代码来源:class-wp-upgrader.php

示例15: allowedRootThemes

 /**
  * Used by add_filter( 'allowed_themes' ) Will hide any theme not in ./themes-root/* with exceptions
  * for 'pressbooks-root', the PB_ROOT_THEME constant, and $GLOBALS['PB_SECRET_SAUCE']['ROOT_THEMES'][]
  *
  * @param array $themes
  *
  * @return array
  */
 function allowedRootThemes($themes)
 {
     $exceptions = array('pressbooks-root');
     if (defined('PB_ROOT_THEME')) {
         $exceptions[] = PB_ROOT_THEME;
     }
     if (isset($GLOBALS['PB_SECRET_SAUCE']['ROOT_THEMES'])) {
         if (is_array($GLOBALS['PB_SECRET_SAUCE']['ROOT_THEMES'])) {
             $exceptions = array_merge($exceptions, $GLOBALS['PB_SECRET_SAUCE']['ROOT_THEMES']);
         } else {
             $exceptions[] = $GLOBALS['PB_SECRET_SAUCE']['ROOT_THEMES'];
         }
     }
     $compare = search_theme_directories();
     foreach ($compare as $key => $val) {
         if (!in_array($key, $exceptions) && untrailingslashit($val['theme_root']) != PB_PLUGIN_DIR . 'themes-root') {
             unset($themes[$key]);
         }
     }
     return $themes;
 }
开发者ID:jflowers45,项目名称:pressbooks,代码行数:29,代码来源:class-pb-pressbooks.php


注:本文中的search_theme_directories函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。