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


PHP WP_Theme::get_allowed_on_site方法代码示例

本文整理汇总了PHP中WP_Theme::get_allowed_on_site方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_Theme::get_allowed_on_site方法的具体用法?PHP WP_Theme::get_allowed_on_site怎么用?PHP WP_Theme::get_allowed_on_site使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WP_Theme的用法示例。


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

示例1: wpmu_get_blog_allowedthemes

/**
 * @deprecated 3.4.0
 * @see WP_Theme::get_allowed_on_site()
 */
function wpmu_get_blog_allowedthemes($blog_id = 0)
{
    _deprecated_function(__FUNCTION__, '3.4', 'WP_Theme::get_allowed_on_site()');
    return array_map('intval', WP_Theme::get_allowed_on_site($blog_id));
}
开发者ID:RA2WP,项目名称:RA2WP,代码行数:9,代码来源:ms-deprecated.php

示例2: wp_get_themes

/**
 * Returns an array of WP_Theme objects based on the arguments.
 *
 * Despite advances over get_themes(), this function is quite expensive, and grows
 * linearly with additional themes. Stick to wp_get_theme() if possible.
 *
 * @since 3.4.0
 *
 * @param array $args The search arguments. Optional.
 * - errors      mixed  True to return themes with errors, false to return themes without errors, null
 *                      to return all themes. Defaults to false.
 * - allowed     mixed  (Multisite) True to return only allowed themes for a site. False to return only
 *                      disallowed themes for a site. 'site' to return only site-allowed themes. 'network'
 *                      to return only network-allowed themes. Null to return all themes. Defaults to null.
 * - blog_id     int    (Multisite) The blog ID used to calculate which themes are allowed. Defaults to 0,
 *                      synonymous for the current blog.
 * @return Array of WP_Theme objects.
 */
function wp_get_themes($args = array())
{
    global $wp_theme_directories;
    $defaults = array('errors' => false, 'allowed' => null, 'blog_id' => 0);
    $args = wp_parse_args($args, $defaults);
    $theme_directories = search_theme_directories();
    if (count($wp_theme_directories) > 1) {
        // Make sure the current theme wins out, in case search_theme_directories() picks the wrong
        // one in the case of a conflict. (Normally, last registered theme root wins.)
        $current_theme = get_stylesheet();
        if (isset($theme_directories[$current_theme])) {
            $root_of_current_theme = get_raw_theme_root($current_theme);
            if (!in_array($root_of_current_theme, $wp_theme_directories)) {
                $root_of_current_theme = WP_CONTENT_DIR . $root_of_current_theme;
            }
            $theme_directories[$current_theme]['theme_root'] = $root_of_current_theme;
        }
    }
    if (empty($theme_directories)) {
        return array();
    }
    if (is_multisite() && null !== $args['allowed']) {
        $allowed = $args['allowed'];
        if ('network' === $allowed) {
            $theme_directories = array_intersect_key($theme_directories, WP_Theme::get_allowed_on_network());
        } elseif ('site' === $allowed) {
            $theme_directories = array_intersect_key($theme_directories, WP_Theme::get_allowed_on_site($args['blog_id']));
        } elseif ($allowed) {
            $theme_directories = array_intersect_key($theme_directories, WP_Theme::get_allowed($args['blog_id']));
        } else {
            $theme_directories = array_diff_key($theme_directories, WP_Theme::get_allowed($args['blog_id']));
        }
    }
    $themes = array();
    static $_themes = array();
    foreach ($theme_directories as $theme => $theme_root) {
        // XTEC ************ AFEGIT - Hide reactor at the theme selector
        // 2014.08.29 @sarjona
        if ($theme == 'reactor') {
            break;
        }
        //************ FI
        if (isset($_themes[$theme_root['theme_root'] . '/' . $theme])) {
            $themes[$theme] = $_themes[$theme_root['theme_root'] . '/' . $theme];
        } else {
            $themes[$theme] = $_themes[$theme_root['theme_root'] . '/' . $theme] = new WP_Theme($theme, $theme_root['theme_root']);
        }
    }
    if (null !== $args['errors']) {
        foreach ($themes as $theme => $wp_theme) {
            if ($wp_theme->errors() != $args['errors']) {
                unset($themes[$theme]);
            }
        }
    }
    return $themes;
}
开发者ID:pausaura,项目名称:agora_nodes,代码行数:75,代码来源:theme.php

示例3: snapshot_utility_get_blog_active_themes

/**
 * Utility function to get a list of allowed/active theme for the site.
 *
 * @since 1.0.0
 * @see
 *
 * @param int $blog_id only used if multisite
 * @return array of allowed themes
 */
function snapshot_utility_get_blog_active_themes($blog_id=0) {

	// Get All themes in the system.
	$themes_all = wp_get_themes();

	/* The get_themes returns an unusable array. So we need to rework it to be able to
	   compare to the array returned from allowedthemes */
	foreach($themes_all as $themes_all_key => $themes_all_set) {
		unset($themes_all[$themes_all_key]);
		$themes_all[$themes_all_set['Stylesheet']] = $themes_all_set['Name'];
	}

	if (is_multisite()) {

		//$allowed_themes = wpmu_get_blog_allowedthemes( $blog_id );
		$allowed_themes = WP_Theme::get_allowed_on_site( $blog_id );

		$themes_blog = get_blog_option( $blog_id, 'allowedthemes' );
		if (!$themes_blog)
			$themes_blog = array();

		//$site_allowed_themes = get_site_allowed_themes();
		$site_allowed_themes = WP_Theme::get_allowed_on_network();
		if (!$site_allowed_themes)
			$site_allowed_themes = array();

		$themes_blog = array_merge($themes_blog, $site_allowed_themes);

		if ((isset($themes_blog)) && (isset($themes_all))) {
			foreach($themes_all as $themes_all_key => $themes_all_name) {
				if (!isset($themes_blog[$themes_all_key]))
					unset($themes_all[$themes_all_key]);
			}
			//echo "themes_all<pre>"; print_r($themes_all); echo "</pre>";
			asort($themes_all);
			return $themes_all;
		}

	} else {
		return $themes_all;
	}
}
开发者ID:BCcampus,项目名称:candela,代码行数:51,代码来源:snapshot_utilities.php

示例4: bp_groupblog_management_page

function bp_groupblog_management_page()
{
    global $wpdb;
    // only allow site admins to come here.
    if (is_super_admin() == false) {
        wp_die(__('You do not have permission to access this page.', 'groupblog'));
    }
    // process form submission
    if (isset($_POST['action']) && $_POST['action'] == 'update') {
        bp_groupblog_update_defaults();
        $updated = true;
    } else {
        $updated = false;
    }
    // make sure we're using latest data
    $opt = get_site_option('bp_groupblog_blog_defaults_options');
    ?>

	<?php 
    if ($updated) {
        ?>
  	<div id="message" class="updated fade">
  		<p><?php 
        _e('Options saved.', 'groupblog');
        ?>
</p>
  	</div>
  <?php 
    }
    ?>

	<div class="wrap" style="position: relative">
		<h2><?php 
    _e('BuddyPress GroupBlog Settings', 'groupblog');
    ?>
</h2>

		<form name="bp-groupblog-setup" id="bp-groupblog-setup" action="" method="post">

			<div id="tabctnr">

				<ul class="tabnav">
	      	<li><a href="#groupblog_default_theme"><?php 
    _e('Theme', 'groupblog');
    ?>
</a></li>
	        <li><a href="#groupblog_landing_page"><?php 
    _e('Redirect', 'groupblog');
    ?>
</a></li>
	        <li><a href="#groupblog_template_layout"><?php 
    _e('Layout', 'groupblog');
    ?>
</a></li>
	        <li><a href="#groupblog_default_blog_settings"><?php 
    _e('Defaults', 'groupblog');
    ?>
</a></li>
	        <li><a href="#groupblog_validation_settings"><?php 
    _e('Validation', 'groupblog');
    ?>
</a></li>
	        <li><a href="#groupblog_about"><?php 
    _e('About', 'groupblog');
    ?>
</a></li>
	      </ul>

				<div id='groupblog_default_theme'>
					<?php 
    $current_groupblog_theme = '';
    // get all themes
    if (function_exists('wp_get_themes')) {
        // get theme data the WP3.4 way...
        $themes = wp_get_themes(false, 'network', 0);
        $ct = wp_get_theme();
        $allowed_themes = WP_Theme::get_allowed_on_network();
        $blog_allowed_themes = WP_Theme::get_allowed_on_site();
    } else {
        // pre WP3.4 functions
        $themes = get_themes();
        $ct = current_theme_info();
        $allowed_themes = get_site_allowed_themes();
        $blog_allowed_themes = wpmu_get_blog_allowedthemes();
    }
    if ($allowed_themes == false) {
        $allowed_themes = array();
    }
    if (is_array($blog_allowed_themes)) {
        $allowed_themes = array_merge($allowed_themes, $blog_allowed_themes);
    }
    if ($wpdb->blogid != 1) {
        unset($allowed_themes['h3']);
    }
    if (isset($allowed_themes[esc_html($ct->stylesheet)]) == false) {
        $allowed_themes[esc_html($ct->stylesheet)] = true;
    }
    reset($themes);
    foreach ($themes as $key => $theme) {
        if (isset($allowed_themes[esc_html($theme['Stylesheet'])]) == false) {
//.........这里部分代码省略.........
开发者ID:adisonc,项目名称:MaineLearning,代码行数:101,代码来源:bp-groupblog-admin.php


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