本文整理汇总了PHP中get_broken_themes函数的典型用法代码示例。如果您正苦于以下问题:PHP get_broken_themes函数的具体用法?PHP get_broken_themes怎么用?PHP get_broken_themes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_broken_themes函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_themes
/**
* Gets the currently available themes.
*
* @return array The currently available themes
*/
public function get_themes()
{
$this->_pre_search($this->get_theme_dirs());
$options = array('errors' => null, 'allowed' => null);
$theme_map = null;
if (function_exists('wp_get_themes')) {
$theme_map = wp_get_themes($options);
} else {
$theme_map = get_themes() + get_broken_themes();
}
add_filter('theme_root_uri', array($this, 'get_root_uri_for_our_themes'), 10, 3);
foreach ($theme_map as $theme) {
$theme->get_theme_root_uri();
}
$this->_post_search();
return $theme_map;
}
示例2: 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];
}
示例3: get_broken_themes
<br class="clear" />
<?php
}
?>
<?php
$wp_list_table->display();
?>
</form>
<br class="clear" />
<?php
// List broken themes, if any.
$broken_themes = get_broken_themes();
if (current_user_can('edit_themes') && count($broken_themes)) {
?>
<h3><?php
_e('Broken Themes');
?>
</h3>
<p><?php
_e('The following themes are installed but incomplete. Themes must have a stylesheet and a template.');
?>
</p>
<table id="broken-themes">
<tr>
<th><?php
示例4: test_broken_themes
/**
* @expectedDeprecated get_themes
* @expectedDeprecated get_broken_themes
*/
function test_broken_themes()
{
$themes = get_themes();
$expected = array('broken-theme' => array('Name' => 'broken-theme', 'Title' => 'broken-theme', 'Description' => __('Stylesheet is missing.')));
$this->assertEquals($expected, get_broken_themes());
}