本文整理汇总了PHP中get_blog_list函数的典型用法代码示例。如果您正苦于以下问题:PHP get_blog_list函数的具体用法?PHP get_blog_list怎么用?PHP get_blog_list使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_blog_list函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ajax_load
function ajax_load()
{
if (isset($_GET['action'])) {
if ($_GET['action'] == 'menu') {
get_menu_list();
exit;
}
if ($_GET['action'] == 'category_list') {
get_category_list();
exit;
}
if ($_GET['action'] == 'blog_list') {
get_blog_list();
exit;
}
if ($_GET['action'] == 'lol_list') {
get_lol_list();
exit;
}
if ($_GET['action'] == 'lol_hero_list') {
get_lol_hero_list();
exit;
}
if ($_GET['action'] == 'lol_info') {
get_lol_info();
exit;
}
}
}
示例2: status
/**
* Example subcommand
*
* @param array $args
*/
function status($args, $assoc_args)
{
if (is_multisite()) {
$blog_list = get_blog_list(0, 'all');
} else {
$blog_list = array();
$blog_list[] = array('blog_id' => 1);
}
foreach ($blog_list as $blog) {
if (is_multisite()) {
switch_to_blog($blog['blog_id']);
}
$field_groups = get_posts(array('numberposts' => -1, 'post_type' => 'acf-field-group', 'sort_column' => 'menu_order', 'order' => 'ASC'));
WP_CLI::line(' ');
WP_CLI::line(count($field_groups) . ' field groups found for blog_id ' . $blog['blog_id']);
if (!empty($field_groups)) {
foreach ($field_groups as $group) {
WP_CLI::line('- ' . sanitize_title($group->post_title));
}
}
WP_CLI::line(' ');
if (is_multisite()) {
restore_current_blog();
}
}
}
示例3: locked
/**
* Check if plugin is locked
*
* @return boolean
*/
function locked()
{
static $locked = null;
if ($locked === null) {
if (w3_is_wpmu()) {
if (isset($_GET['sitewide'])) {
$locked = false;
} else {
global $blog_id;
$blogs = get_blog_list();
foreach ($blogs as $blog) {
if ($blog['blog_id'] != $blog_id) {
$active_plugins = get_blog_option($blog['blog_id'], 'active_plugins');
if (in_array(W3TC_FILE, $active_plugins)) {
$locked = true;
break;
}
}
}
}
} else {
$locked = false;
}
}
return $locked;
}
示例4: SetupMenu
function SetupMenu()
{
if (!empty($this->menu)) {
return;
}
/*$this->menu = array(
'url' => array(
0 => array(
'id' => 0, // >39 = right-hand side
'title' => 'Title',
'url' => 'http://.../',
),
//1 => array(...) - submenu
),
'eh' => array(
0 => array(
'id' => 40, // >39 = right-hand side
'title' => 'Title',
'url' => 'http://.../',
),
//1 => array(...) - submenu
),
);*/
global $wpdb;
$this->menu['switch'] = array(0 => array('id' => 0, 'title' => 'Switch Theme Preview', 'url' => '#'));
foreach (get_blog_list() as $blog) {
$this->menu['switch'][] = array('id' => $blog['blog_id'], 'title' => get_blog_option($blog['blog_id'], "blogname"), 'url' => 'http://' . $blog['domain'] . $blog['path']);
}
}
示例5: blog_list_block
function blog_list_block($options)
{
$mydirname = empty($options[0]) ? 'xpress' : $options[0];
$this_template = empty($options[1]) ? 'db:' . $mydirname . '_block_category.html' : trim($options[1]);
$orderby = empty($options[2]) ? 'name' : $options[2];
$order = empty($options[3]) ? 'ASC' : $options[3];
if (xpress_is_multiblog() && function_exists('get_blog_list')) {
$blogs = get_blog_list(0, 'all');
$data = array();
foreach ($blogs as $blog) {
$url = get_blog_option($blog['blog_id'], 'siteurl');
$blog_name = get_blog_option($blog['blog_id'], 'blogname');
$blog_link = "<a href=\" {$url} \"> {$blog_name} </a>";
$blog_id = $blog['blog_id'];
$post_count = $blog['postcount'];
$last_post_date = '';
$last_post_time = '';
$last_post_date_time = '';
$row_data = array('blog_id' => $blog_id, 'blog_name' => $blog_link, 'last_post_date' => $last_post_date, 'last_post_time' => $last_post_time, 'post_date_time' => $last_post_date_time, 'last_post_date_time' => $post_modified_date, 'post_count' => $post_count);
$data[] = $row_data;
}
if (strcmp($order, 'ASC') == 0) {
switch ($orderby) {
case 'count':
usort($data, "r_post_count_cmp");
break;
case 'ID':
usort($data, "r_blog_id_cmp");
break;
default:
usort($data, "r_blog_name_cmp");
}
} else {
switch ($orderby) {
case 'count':
usort($data, "post_count_cmp");
break;
case 'ID':
usort($data, "blog_id_cmp");
break;
default:
usort($data, "blog_name_cmp");
}
}
$block = array();
$item_no = 0;
foreach ($data as $row) {
$block['contents']['item' . $item_no] = $row;
$item_no++;
}
// end of foreach
$block['data_count'] = $item_no;
//xml unserialise error
} else {
$block['err_message'] = __('This blog is not set to the multi blog.', 'xpress');
}
return $block;
}
示例6: get_all_blog_comments
/**
* Returns a sorted array of all comments across all blogs on the MU install
*
* @param int $num_per_blog The number of posts per blog to return
* @param string $orderby The column to sort on. Uses the same {@link http://codex.wordpress.org/Function_Reference/get_comments#Parameters Order By Paramaters as get_comments}
* @param string $sort The field in the comment object to be used in the quicksort
* @return array Sorted array of posts
*/
function get_all_blog_comments($num_per_blog = 1, $orderby = 'comment_date_gmt', $sort = 'comment_date_gmt')
{
$comments = array();
$blogs = get_blog_list(0, 'all');
foreach ($blogs as $blog) {
switch_to_blog($blog['blog_id']);
$comments = array_merge($comments, get_comments('orderby=' . $orderby . '&number=' . $num_per_blog));
restore_current_blog();
}
return _quicksort($comments, $sort);
}
示例7: uninstall_sitewidely
public function uninstall_sitewidely()
{
$blogs = get_blog_list(0, 'all', false);
if (is_array($blogs)) {
reset($blogs);
foreach ((array) $blogs as $key => $details) {
switch_to_blog($details['blog_id']);
self::uninstall();
restore_current_blog();
}
}
}
示例8: install
public static function install($network_wide)
{
global $wpdb;
if (is_multisite() && $network_wide) {
$tmpPrefix = $wpdb->prefix;
$blogs = function_exists('wp_get_sites') ? wp_get_sites(array('network_id' => $wpdb->siteid)) : get_blog_list(0, 'all');
foreach ($blogs as $blog) {
$wpdb->prefix = $wpdb->get_blog_prefix($blog['blog_id']);
N2Base::getApplication("system")->getApplicationType('backend')->render(array("controller" => "install", "action" => "index", "useRequest" => false), array(true));
}
$wpdb->prefix = $tmpPrefix;
return true;
}
N2Base::getApplication("system")->getApplicationType('backend')->render(array("controller" => "install", "action" => "index", "useRequest" => false), array(true));
}
示例9: sap_metabox
function sap_metabox($post)
{
$values = get_post_custom($post->ID);
$site_id = isset($values['sap_site_id']) ? esc_attr($values['sap_site_id'][0]) : '';
$background_color = isset($values['sap_background_color']) ? esc_attr($values['sap_background_color'][0]) : '';
$text_color = isset($values['sap_text_color']) ? esc_attr($values['sap_text_color'][0]) : '';
wp_nonce_field('sap_metabox_nonce', 'metabox_nonce');
echo 'Location for this announcement: <b>' . $site_id . '</b><br><br>';
echo '<br>values var_dump: ';
var_dump($values);
$blog_list = get_blog_list(0, 'all');
$sites = array();
foreach ($blog_list as $blog) {
$sites[] = $blog['domain'] . $blog['path'];
}
?>
<select name="sap_site_id" id="sap_site_id">
<?php
foreach ($sites as $site) {
echo '<option value="' . $site . '">' . $site . '</option>';
}
?>
</select>
<p>Select Background Color</p>
<input name="sap_background_color" type="text" value="<?php
echo $background_color;
?>
" class="my-color-field" />
<p>Select Text Color</p>
<input name="sap_text_color" type="text" value="<?php
echo $text_color;
?>
" class="my-color-field" />
<script type="text/javascript">
jQuery(document).ready(function($){
$('.my-color-field').wpColorPicker();
});
</script>
<?php
}
示例10: bloglist_shortcode
function bloglist_shortcode($atts)
{
if (!function_exists('get_blog_list')) {
return;
}
$blogs = get_blog_list();
if (!$blogs) {
return '';
}
extract(shortcode_atts(array('showcurrent' => 'no'), $atts));
if ($showcurrent == '0' || $showcurrent == 'no' || $showcurrent == 'false') {
$showcurrent = false;
} else {
$showcurrent = true;
}
ob_start();
?>
<ul class="blog-list">
<?php
foreach ($blogs as $blog) {
if ($blog['blog_id'] == get_current_blog_id() && !$showcurrent) {
continue;
}
?>
<li><a href="<?php
echo get_blog_option($blog['blog_id'], 'siteurl');
?>
"><?php
echo get_blog_option($blog['blog_id'], 'blogname');
?>
</a></li>
<?php
switch_to_blog($cblog_id);
}
?>
</ul>
<?php
$result = ob_get_clean();
return $result;
}
示例11: get_postslist_table
function get_postslist_table($author_lk)
{
global $wpdb, $post, $posts, $ratings;
$ratings = array();
$posts = array();
//print_r($_POST);
//exit;
$start = $this->start . ',';
$posts[] = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->base_prefix . "posts WHERE post_author='%d' AND post_type='%s' AND post_status NOT IN ('draft','auto-draft') ORDER BY post_date DESC LIMIT {$start} 20", $author_lk, $this->posttype));
if (is_multisite()) {
$blog_list = get_blog_list(0, 'all');
foreach ($blog_list as $blog) {
$pref = $wpdb->base_prefix . $blog['blog_id'] . '_posts';
$posts[] = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $pref . " WHERE post_author='%d' AND post_type='%s' AND post_status NOT IN ('draft','auto-draft') ORDER BY post_date DESC LIMIT {$start} 20", $author_lk, $this->posttype));
}
}
if ($posts[0]) {
$p_list = array();
if (function_exists('rcl_format_rating')) {
foreach ($posts as $postdata) {
foreach ($postdata as $p) {
$p_list[] = $p->ID;
}
}
$rayt_p = rcl_get_ratings(array('object_id' => $p_list, 'rating_type' => array($this->posttype)));
foreach ((array) $rayt_p as $r) {
if (!isset($r->object_id)) {
continue;
}
$ratings[$r->object_id] = $r->rating_total;
}
}
$posts_block = rcl_get_include_template('posts-list.php', __FILE__);
wp_reset_postdata();
} else {
$posts_block = '<p>' . $this->name . ' ' . __('has not yet been published', 'wp-recall') . '</p>';
}
return $posts_block;
}
示例12: locked
/**
* Check if plugin is locked
*
* @return boolean
*/
function locked()
{
static $locked = null;
if ($locked === null) {
if (w3_is_network() && function_exists('get_blog_list')) {
global $blog_id;
$blogs = get_blog_list();
foreach ($blogs as $blog) {
if ($blog['blog_id'] != $blog_id) {
$active_plugins = get_blog_option($blog['blog_id'], 'active_plugins');
if (in_array(W3TC_FILE, $active_plugins)) {
$locked = true;
break;
}
}
}
} else {
$locked = false;
}
}
return $locked;
}
示例13: locked
/**
* Check if plugin is locked
*
* @return boolean
*/
function locked()
{
global $blog_id;
static $locked = null;
if ($locked === null) {
$locked = false;
// check only for WP MU
if ($blog_id && function_exists('get_blog_option')) {
$blogs = get_blog_list();
foreach ($blogs as $blog) {
if ($blog['blog_id'] != $blog_id) {
$active_plugins = get_blog_option($blog['blog_id'], 'active_plugins');
if (in_array(W3TC_FILE, $active_plugins)) {
$locked = true;
break;
}
}
}
}
}
return $locked;
}
示例14: render
function render()
{
$this->open_section_box($this->id, __("Select Source", "ns-cloner"));
?>
<label class="ns-cloner-site-search-label">Search by url</label>
<input type="text" class="ns-cloner-site-search" />
<label class="ns-cloner-site-select-label">Or select</label>
<select name="source_id" class="ns-cloner-site-select">
<?php
$sites = function_exists('wp_get_sites') ? wp_get_sites(array('limit' => 9999)) : get_blog_list(0, 'all');
?>
<?php
foreach ($sites as $site) {
?>
<option value="<?php
echo $site['blog_id'];
?>
">
<?php
$title = get_blog_details($site['blog_id'])->blogname;
?>
<?php
$url = is_subdomain_install() ? "{$site['domain']}" : "{$site['domain']}{$site['path']}";
?>
<?php
echo "{$site['blog_id']} - " . substr($title, 0, 30) . " ({$url})";
?>
<?php
}
?>
</select>
<p class="description ns-cloner-clear"><?php
_e('Pick an existing source site to clone. If you haven\'t already, now is a great time to set up a "template" site exactly the way you want the new clone site to start out (theme, plugins, settings, etc.).', 'ns-cloner');
?>
</p>
<?php
$this->close_section_box();
}
示例15: widget_endView
function widget_endView($args)
{
if (!is_super_admin()) {
return;
}
if (get_option('diamond_allow_broadcast') == 0) {
return;
}
global $wpdb;
echo '<fieldset><legend>';
echo __('Broadcast this post', 'diamond');
echo '</legend>';
echo '<label>';
echo __('Select blogs where you want to copy this post', 'diamond');
echo '<select name="diamond_blogs[]" id="diamond_blogs" style="height:120px; width: 100%" multiple="multiple">';
echo '<option value="0">';
_e('--- No broadcast ---', 'diamond');
echo '</option>';
$blog_list = get_blog_list();
$shared = get_post_custom_values('diamond_broadcast_blogs', $_GET['post'] ? $_GET['post'] : 0);
$sharr = split(";", $shared[0]);
foreach ($blog_list as $blog) {
if ($blog['blog_id'] != $wpdb->blogid) {
echo '<option value="' . $blog['blog_id'] . '">' . get_blog_option($blog['blog_id'], 'blogname');
}
if ($sharr && in_array($blog['blog_id'], $sharr)) {
echo __(' (copied)', 'diamond');
}
echo '</option>';
}
echo '</select>';
echo '</label>';
//print_r($shared[0]);
//print_r($sharr) ;
//print_r($shared);
echo '</fieldset>';
}