本文整理汇总了PHP中MS_Factory::current_blog_id方法的典型用法代码示例。如果您正苦于以下问题:PHP MS_Factory::current_blog_id方法的具体用法?PHP MS_Factory::current_blog_id怎么用?PHP MS_Factory::current_blog_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MS_Factory
的用法示例。
在下文中一共展示了MS_Factory::current_blog_id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: is_current_site
/**
* Checks if the specified rule-key defines a rule that is relevant for the
* current site in the network.
*
* If network-wide protection is disabled this function always returns true.
*
* @since 1.0.0
* @param string $key
* @return bool
*/
public static function is_current_site($key)
{
$res = true;
$site_id = 0;
if (MS_Plugin::is_network_wide()) {
$parts = explode(':', $key);
// Some rules have no site_id prefix (like URL rules)
if (2 == count($parts)) {
list($site_id, $type) = $parts;
$site_id = intval($site_id);
$res = MS_Factory::current_blog_id() == $site_id;
}
}
return $res;
}
示例2: site_filter
/**
* When network-wide protection is enabled then allow the user to choose the
* source-site of the content.
*
* Protection options can only be changed on a site-by-site base. So if the
* user has 3 sites he can protect all pages on all sites but has to select
* each site individually here.
*
* @since 1.0.0
*/
protected function site_filter()
{
if (!MS_Plugin::is_network_wide()) {
return false;
}
$sites = MS_Helper_Settings::get_blogs();
$site_options = array();
$current_blog_id = MS_Factory::current_blog_id();
$admin_script = 'admin.php?' . $_SERVER['QUERY_STRING'];
foreach ($sites as $blog_id => $title) {
$key = get_admin_url($blog_id, $admin_script);
if ($current_blog_id == $blog_id) {
$current_value = $key;
}
$site_options[$key] = $title;
}
$site_list = array('id' => 'select-site', 'type' => MS_Helper_Html::INPUT_TYPE_SELECT, 'value' => $current_value, 'field_options' => $site_options);
?>
<div class="ms-tab-container">
<label class="ms-tab-link" for="select-site">
<?php
_e('Select Site', 'membership2');
?>
</label>
</div>
<div>
<?php
lib3()->html->element($site_list);
?>
</div>
<?php
}