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; } } }
/** * 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(); } } }
/** * 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; }
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']); } }
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; }
/** * 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); }
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(); } } }
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)); }
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 }
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; }
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; }
/** * 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; }
/** * 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; }
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(); }
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>'; }
function get_most_active_blogs($num = 10, $display = true) { $most_active = get_site_option("most_active"); $update = false; if (is_array($most_active)) { if ($most_active['time'] + 60 < time()) { // cache for 60 seconds. $update = true; } } else { $update = true; } if ($update == true) { unset($most_active); $blogs = get_blog_list(0, 'all', false); // $blog_id -> $details if (is_array($blogs)) { reset($blogs); foreach ((array) $blogs as $key => $details) { $most_active[$details['blog_id']] = $details['postcount']; $blog_list[$details['blog_id']] = $details; // array_slice() removes keys!! } arsort($most_active); reset($most_active); foreach ((array) $most_active as $key => $details) { $t[$key] = $blog_list[$key]; } unset($most_active); $most_active = $t; } update_site_option("most_active", $most_active); } if ($display == true) { if (is_array($most_active)) { reset($most_active); foreach ((array) $most_active as $key => $details) { $url = clean_url("http://" . $details['domain'] . $details['path']); echo "<li>" . $details['postcount'] . " <a href='{$url}'>{$url}</a></li>"; } } } return array_slice($most_active, 0, $num); }
} elseif (!isset($_POST['ext']) || !array_key_exists($_POST['ext'], $extensions)) { wp_die('Please select a valid extension.'); } elseif (!isset($_POST['e2e_post_type']) || !array_key_exists($_POST['e2e_post_type'], $post_types) && $_POST['e2e_post_type'] != 'comment_authors' && $_POST['e2e_post_type'] != 'attachment') { wp_die('Please select a post type.'); } elseif (!isset($_POST['post_fld']) && $_POST['e2e_post_type'] == 'post') { wp_die('Please select fields.'); } elseif (!isset($_POST['page_fld']) && $_POST['e2e_post_type'] == 'page') { wp_die('Please select fields.'); } elseif (!isset($_POST['comment_authors_fld']) && $_POST['e2e_post_type'] == 'comment_authors') { wp_die('Please select fields.'); } else { $post_type = $_POST['e2e_post_type']; $ext = $_POST['ext']; $str = ''; if (is_multisite() && $network_admin) { $blog_info = get_blog_list(0, 'all'); foreach ($blog_info as $blog) { switch_to_blog($blog['blog_id']); include 'loop.php'; restore_current_blog(); } } else { include 'loop.php'; } $filename = sanitize_file_name(get_bloginfo('name')) . '.' . $ext; if ($ext == 'xls') { header("Content-type: application/vnd.ms-excel;"); } elseif ($ext == 'xlsx') { header("Content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, charset=utf-8;"); } header("Content-Disposition: attachment; filename=" . $filename);
/** * Return an array of all blog upload dir paths */ function ns_get_multisite_upload_paths($args = array('limit' => 9999)) { $upload_paths = array(); $sites = function_exists('wp_get_sites') ? wp_get_sites($args) : get_blog_list(0, 'all'); foreach ($sites as $site) { switch_to_blog($site['blog_id']); $wp_upload_dir = wp_upload_dir(); $upload_paths[$site['blog_id']] = $wp_upload_dir['basedir']; restore_current_blog(); } return $upload_paths; }
function xpress_primary_blog_link() { global $xoops_config; global $current_user; global $blog_id; $ret = array(); if (xpress_is_multiblog() && is_user_logged_in()){ $blog_list = get_blog_list(); $root_path = get_blog_status(1,'path'); $primary_blog_id = @$current_user->primary_blog; if(empty($primary_blog_id)) return $ret; $primary_path = get_blog_status($primary_blog_id,'path'); $script = str_replace($root_path, "", $primary_path); if ($primary_blog_id !== $blog_id){ $ret['url'] = get_blogaddress_by_id($primary_blog_id); $ret['menu_url'] = $script; $ret['title'] = __('Your Primary Blog','xpressme'); $ret['link'] = '<a href="' . $ret['url'] . '">' . $ret['title'] . '</a>'; } } return $ret; }
/** * Upgrades the settings. * * ## OPTIONS * * [--network-wide] * : Perform the settings upgrade on all blogs of the network. * * ## EXAMPLES * * wp amt upgrade * wp amt upgrade --network-wide * * @synopsis [--network-wide] */ function upgrade($args, $assoc_args) { // Multisite if ($assoc_args['network-wide']) { if (is_multisite()) { $blog_list = get_blog_list(0, 'all'); if (empty($blog_list)) { WP_CLI::error('No blogs could be found.'); } foreach ($blog_list as $blog) { switch_to_blog($blog['blog_id']); $plugin_info = get_plugin_data(plugin_dir_path(__FILE__) . 'add-meta-tags.php', $markup = true, $translate = true); WP_CLI::line('Upgrading settings of: ' . get_bloginfo('name') . ' - (ID: ' . $blog['blog_id'] . ')'); amt_plugin_upgrade(); restore_current_blog(); } WP_CLI::success('Add-Meta-Tags settings have been upgraded network wide.'); } else { WP_CLI::warning('No network detected. Reverting to signle site settings upgrade.'); } } // Single site installation amt_plugin_upgrade(); WP_CLI::success('Add-Meta-Tags settings have been upgraded.'); /* 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'] ); } $plugin_info = get_plugin_data( plugin_dir_path( __FILE__ ) . 'add-meta-tags.php', $markup = true, $translate = true ); WP_CLI::line( 'Upgrading settings of: ' . get_bloginfo('name') . ' - (ID: ' . $blog['blog_id'] . ')' ); amt_plugin_upgrade(); if ( is_multisite() ) { restore_current_blog(); } } */ // get_plugin_data( $plugin_file, $markup = true, $translate = true ) //$plugin info = get_plugin_data( AMT_PLUGIN_DIR . 'add-meta-tags.php', $markup = true, $translate = true ); // WP_CLI::line( ' ' ); // WP_CLI::line( count( $field_groups ) . ' field groups found for blog_id ' . $blog['blog_id'] ); // Print a success message //WP_CLI::success( "Operation complete." ); }
function urlHandler_sitelist() { $url = get_relative($_SERVER['REQUEST_URI']); if (strtolower($url) != "/bapi.sitelist.js") { return; } // not our handler header('Content-Type: application/javascript'); header('Cache-Control: public'); $blog_list = get_blog_list(0, 'all'); $i = 0; echo '{'; foreach ($blog_list as $blog) { if ($i > 0) { echo ', '; } echo $blog['domain'] . $blog['path']; $i++; } echo '}'; exit; }
function cfgp_reset_shadow_blog() { $results = array(); /* Get list of all blogs */ $blog_list = get_blog_list(null, 'all'); /* Delete all post_meta in all blogs */ foreach ($blog_list as $blog_info) { cfgp_delete_cfgp_post_meta($blog_info['blog_id']); } $results['meta_deleted'] = true; /* Delete the sitemeta, if this is a legacy install of plugin */ global $wpdb; $sql = ' DELETE FROM wp_sitemeta WHERE meta_key = "cfgp_blog_id" '; $results['sitemeta_deleted'] = $wpdb->query($sql); /* Delete the shadow blog */ if (!function_exists('wpmu_delete_blog')) { require_once ABSPATH . 'wp-admin/includes/ms.php'; } wpmu_delete_blog(cfgp_get_shadow_blog_id(), true); $results['success'] = 'true'; return $results; }
/** * update the social login options in all the old blogs */ function the_champ_update_old_blogs($oldConfig) { $optionParts = explode('_', current_filter()); $option = $optionParts[2] . '_' . $optionParts[3] . '_' . $optionParts[4]; $newConfig = get_option($option); if (isset($newConfig['config_multisite']) && $newConfig['config_multisite'] == 1) { $blogs = get_blog_list(0, 'all'); foreach ($blogs as $blog) { update_blog_option($blog['blog_id'], $option, $newConfig); } } }
"><?php the_title(); ?> </a></li> <?php } } ?> </ul> <br /> <h3><?php _e('Blogs List', 'xpress'); ?> </h3> <?php $blog_list = get_blog_list(0, 'all'); echo "<ul>\n"; foreach ($blog_list as $blog) { $url = 'http://' . $blog['domain'] . $blog['path']; $blog_name = get_blog_option($blog['blog_id'], 'blogname'); $post_count = $blog['postcount']; echo "<li><a href=\" {$url} \"> {$blog_name} </a> (" . __('post count', 'xpress') . ":{$post_count}) </li>"; } echo "</ul>\n"; ?> <br /> <?php echo '<h3>' . __('New Entries', 'xpress') . "</h3>\n"; $data_array = xpress_grobal_recent_posts();
function global_recent_comments_block($options) { $mydirname = empty($options[0]) ? 'xpress' : $options[0]; $this_template = empty($options[1]) ? 'db:' . $mydirname . '_global_recent_comments_block.html' : trim($options[1]); $disp_count = empty($options[2]) ? '10' : $options[2]; $disp_length = empty($options[3]) ? '30' : $options[3]; $date_format = empty($options[4]) ? '' : $options[4]; $time_format = empty($options[5]) ? '' : $options[5]; $com_select = empty($options[6]) ? '0' : $options[6]; $selected = explode(',', $com_select); $mydirpath = get_xpress_dir_path(); if (empty($date_format)) { $date_format = get_settings('date_format'); } if (empty($time_format)) { $time_format = get_settings('time_format'); } $disp_all = in_array('0', $selected); $disp_comment = in_array('1', $selected); $disp_trackback = in_array('2', $selected); $disp_pingback = in_array('3', $selected); $type_select = ''; if (!$disp_all) { if ($disp_comment) { $in_where = "''"; } if ($disp_trackback) { if (empty($in_where)) { $in_where = "'trackback' "; } else { $in_where .= ",'trackback'"; } } if ($disp_pingback) { if (empty($in_where)) { $in_where = "'pingback' "; } else { $in_where .= ",'pingback'"; } } if (!empty($in_where)) { $type_select = " AND comment_type IN({$in_where}) "; } } global $wpdb, $wp_rewrite, $switched, $blog_id; $block = array(); $comment_array = array(); if (xpress_is_multiblog()) { $blogs = get_blog_list(0, 'all'); foreach ($blogs as $blog) { switch_to_blog($blog['blog_id']); $wp_rewrite->init(); if (!is_null($wpdb)) { $comment_sql = "SELECT comment_ID,comment_post_ID,comment_author,comment_author_email,comment_author_url,comment_content, comment_type,UNIX_TIMESTAMP(comment_date) as comment_unix_time "; $comment_sql .= "FROM {$wpdb->comments} LEFT JOIN {$wpdb->posts} ON {$wpdb->posts}.ID = {$wpdb->comments}.comment_post_ID "; if (xpress_is_wp_version('<', '2.1')) { $comment_sql .= "WHERE comment_approved = '1' AND post_status = 'publish' {$type_select} "; } else { $comment_sql .= "WHERE comment_approved = '1' AND post_type = 'post' AND post_status = 'publish' {$type_select} "; } $comment_sql .= "ORDER BY comment_date_gmt DESC LIMIT {$disp_count}"; $comments = $wpdb->get_results($comment_sql); if ($comments) { $blog_title = get_bloginfo('name'); $blog_link = get_bloginfo('url'); $blog_title_link = '<a href="' . $blog_link . '">' . $blog_title . '</a>'; foreach ($comments as $comment) { $comment_content = $comment->comment_content; $comment_unix_time = $comment->comment_unix_time; $comment_excerpt = $disp_length > 0 ? xpress_substr($comment_content, 0, $disp_length) : $comment->comment_content; $comment_link = get_comment_link($comment->comment_ID); $comment_title = $comment_excerpt; $comment_title_link = "<a href='{$comment_link}' rel='external nofollow' class='url'>{$comment_title}</a>"; $post_link = get_permalink($comment->comment_post_ID); $post_title = get_the_title($comment->comment_post_ID); $post_title_link = '<a href="' . $post_link . '">' . $post_title . '</a>'; $author_link = $comment->comment_author_url; $author_name = $comment->comment_author; $author_name_link = empty($author_link) || 'http://' == $author_link ? $author_name : "<a href='{$author_link}' rel='external nofollow' class='url'>{$author_name}</a>"; $comment_type = empty($comment->comment_type) ? 'comment' : $comment->comment_type; $post_title_comment_link = '<a href="' . $comment_link . '">' . $post_title . '</a>'; $from_auther_to_post = sprintf(__('%1$s on %2$s', 'xpress'), $author_name_link, $post_title_comment_link); $row_data = array('blog_title' => $blog_title, 'blog_link' => $blog_link, 'blog_title_link' => $blog_title_link, 'comment_ID' => $comment->comment_ID, 'comment_post_ID' => $comment->comment_post_ID, 'comment_unix_time' => $comment_unix_time, 'comment_date' => date($date_format, $comment->comment_unix_time), 'comment_date_time' => date($date_format . ' ' . $time_format, $comment->comment_unix_time), 'comment_content' => $comment_content, 'comment_excerpt' => $comment_excerpt, 'comment_link' => $comment_link, 'comment_title' => $comment_title, 'comment_title_link' => $comment_title_link, 'post_link' => $post_link, 'post_title' => $post_title, 'post_title_link' => $post_title_link, 'author_link' => $author_link, 'author_name' => $author_name, 'author_name_link' => $author_name_link, 'comment_type' => $comment_type, 'from_auther_to_post' => $from_auther_to_post); $comment_array[] = $row_data; } $block['data_count'] = $item_no; } } restore_current_blog(); $wp_rewrite->init(); } // end of foreach usort($comment_array, "the_comment_time_cmp"); if (!empty($disp_count)) { $comment_array = array_slice($comment_array, 0, $disp_count); } $item_no = 0; foreach ($comment_array as $comment) { $block['contents']['item' . $item_no] = $comment; $item_no++; } $block['data_count'] = $item_no; } else { $block['err_message'] = __('This blog is not set to the multi blog.', 'xpress'); } return $block; }
function checkMU_uninstall_dpProEventCalendar($network_wide) { global $wpdb; if ($network_wide) { $blog_list = get_blog_list(0, 'all'); foreach ($blog_list as $blog) { switch_to_blog($blog['blog_id']); uninstall_dpProEventCalendar(); } switch_to_blog($wpdb->blogid); } else { uninstall_dpProEventCalendar(); } }
/** * displays a site select in MS */ function siteselect($value) { $size = isset($value['size']) ? $value['size'] : '10'; if (isset($value['target'])) { if (isset($value['options'])) { $value['options'] = $value['options'] + $this->get_select_target_options($value['target']); } else { $value['options'] = $this->get_select_target_options($value['target']); } } echo '<tr valign="top"><td scope="row"><strong>' . $value['name'] . '</strong></td><td>'; echo '<select name="' . $value['id'] . '[]" id="' . $value['id'] . '" multiple="multiple" size="' . $size . '" style="height:auto">'; $blog_list = get_blog_list( 0, 'all' ); foreach ($blog_list AS $blog) { echo '<option value="' . $blog['blog_id'] . '"'; if (isset($this->saved_options[$value['id']])) { if (is_array($this->saved_options[$value['id']])) { if (in_array($blog['blog_id'], $this->saved_options[$value['id']])) { echo ' selected="selected"'; } } } echo '>' . $blog['domain'].$blog['path'] . '</option>'; } echo '</select><br /></td><td>'; if(isset($value['desc'])){ echo '<p class="description">' . $value['desc'] . '</p>'; } echo '</td></tr>'; }
function widget_controlView($is_admin = false) { global $DiamondCache; // Title if ($_POST['wgt_post_hidden']) { $option = $_POST['wgt_p_title']; update_option('wgt_title', $option); } $wgt_title = get_option('wgt_title'); echo '<input type="hidden" name="wgt_post_hidden" value="success" />'; echo '<label for="wgt_p_title">' . __('Widget Title', 'diamond') . ':<br /><input id="wgt__ptitle" name="wgt_p_title" type="text" value="' . $wgt_title . '" /></label>'; if ($_POST['wgt_post_hidden']) { $DiamondCache->addSettings('recent-posts', 'expire', $_POST['diamond_p_cache']); } $dccache = $DiamondCache->getSettings('recent-posts', 'expire'); if ($dccache == '') { $dccache = 120; } echo '<br />'; echo '<label for="diamond_p_cache">' . __('Cache Expire Time (sec)', 'diamond') . ':<br /><input id="diamond_p_cache" name="diamond_p_cache" type="text" value="' . $dccache . '" /></label>'; // Count if ($_POST['wgt_post_hidden']) { $option = $_POST['wgt_count']; update_option('wgt_count', $option); } $wgt_count = get_option('wgt_count'); echo '<br /><label for="wgt_number">' . __('Posts count', 'diamond') . ':<br /><input id="wgt_count" name="wgt_count" type="text" value="' . $wgt_count . '" /></label>'; // miss blogs if ($_POST['wgt_post_hidden']) { $option = $_POST['wgt_miss']; $tmp = ''; $sep = ''; if (isset($option) && $option != '') { foreach ($option as $op) { $tmp .= $sep . $op; $sep = ';'; } } update_option('wgt_miss', $tmp); } $wgt_miss = get_option('wgt_miss'); $miss = split(';', $wgt_miss); echo '<br /><label for="wgt_miss">' . __('Exclude blogs: (The first 50 blogs)', 'diamond'); $blog_list = get_blog_list(0, 50); echo '<br />'; foreach ($blog_list as $blog) { echo '<input id="wgt_miss_' . $blog['blog_id'] . '" name="wgt_miss[]" type="checkbox" value="' . $blog['blog_id'] . '" '; if (in_array($blog['blog_id'], $miss)) { echo ' checked="checked" '; } echo ' />'; echo get_blog_option($blog['blog_id'], 'blogname'); echo '<br />'; } echo '</label>'; //Whitelist if ($_POST['wgt_post_hidden']) { $option = $_POST['wgt_white']; $tmp = ''; $sep = ''; if (isset($option) && $option != '') { foreach ($option as $op) { $tmp .= $sep . $op; $sep = ';'; } } update_option('wgt_white', $tmp); } $wgt_white = get_option('wgt_white'); $miss = split(';', $wgt_white); echo '<br /><label for="wgt_white">' . __('White List: (The first 50 blogs)', 'diamond'); $blog_list = get_blog_list(0, 50); echo '<br />'; foreach ($blog_list as $blog) { echo '<input id="wgt_white_' . $blog['blog_id'] . '" name="wgt_white[]" type="checkbox" value="' . $blog['blog_id'] . '" '; if (in_array($blog['blog_id'], $miss)) { echo ' checked="checked" '; } echo ' />'; echo get_blog_option($blog['blog_id'], 'blogname'); echo '<br />'; } echo '</label>'; // Format if ($_POST['wgt_post_hidden']) { $option = $_POST['wgt_format']; if (!isset($option) || $option == '') { $option = '<strong>{title}</strong> - {date}'; } update_option('wgt_format', get_format_code($option)); } $wgt_format = htmlentities(str_replace('\\"', '"', get_format_txt(get_option('wgt_format')))); echo '<label for="wgt_number">' . __('Format string', 'diamond') . ':<br /><input id="wgt_format" name="wgt_format" type="text" value="' . $wgt_format . '" /></label><br />'; echo '{title} - ' . __('The post\'s title', 'diamond') . '<br />'; echo '{title_txt} - ' . __('The post\'s title', 'diamond') . ' ' . __('(without link)', 'diamond') . '<br />'; echo '{excerpt} - ' . __('The post\'s excerpt', 'diamond') . '<br />'; echo '{date} - ' . __('The post\'s date', 'diamond') . '<br />'; echo '{author} - ' . __('The post\'s author', 'diamond') . '<br />'; echo '{avatar} - ' . __('Author\'s avatar', 'diamond') . '<br />'; echo '{blog} - ' . __('The post\'s blog name', 'diamond') . '<br />'; echo '{blog_link} - ' . __('The post\'s blog link', 'diamond') . '<br />'; echo '{blog_url} - ' . __('The post\'s blog url', 'diamond') . '<br />'; echo '{more} - ' . __('The "Read More" link', 'diamond') . '<br />'; echo '<br />'; if ($_POST['wgt_post_hidden']) { $option = $_POST['wgt_avsize']; update_option('wgt_avsize', $option); } $wgt_avsize = get_option('wgt_avsize'); echo '<label for="wgt_avsize">' . __('Avatar Size (px)', 'diamond') . ':<br /><input id="wgt_avsize" name="wgt_avsize" type="text" value="' . $wgt_avsize . '" /></label>'; echo '<br />'; if ($_POST['wgt_post_hidden']) { $option = $_POST['wgt_defav']; update_option('wgt_defav', $option); } $wgt_defav = get_option('wgt_defav'); echo '<label for="wgt_defav">' . __('Default Avatar URL', 'diamond') . ':<br /><input id="wgt_defav" name="wgt_defav" type="text" value="' . $wgt_defav . '" /></label>'; echo '<br />'; if ($_POST['wgt_post_hidden']) { $option = $_POST['wgt_mtext']; if (!isset($option) || $option == '') { $option = __('Read More', 'diamond'); } update_option('wgt_mtext', $option); } $wgt_mtext = get_option('wgt_mtext'); echo '<label for="wgt_mtext">' . __('"Read More" link text', 'diamond') . ':<br /><input id="wgt_mtext" name="wgt_mtext" type="text" value="' . $wgt_mtext . '" /></label>'; echo '<br />'; if ($_POST['wgt_post_hidden']) { $option = $_POST['wgt_dt']; update_option('wgt_dt', $option); } $wgt_dt = get_option('wgt_dt'); if (!isset($wgt_dt) || trim($wgt_dt) == '') { $wgt_dt = 'M. d. Y.'; update_option('wgt_dt', $wgt_dt); } echo '<label for="wgt_dt">' . __('DateTime format (<a href="http://php.net/manual/en/function.date.php" target="_blank">manual</a>)', 'diamond') . ':<br /><input id="wgt_dt" name="wgt_dt" type="text" value="' . $wgt_dt . '" /></label>'; echo '<br />'; if (!$is_admin) { echo '<br />'; _e('if you like this widget then', 'diamond'); echo ': <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=paypal%40amegrant%2ehu&lc=HU&item_name=Diamond%20Multisite%20WordPress%20Widget¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted" target="_blank">'; _e('Buy me a beer!', 'diamond'); echo '</a><br />'; } if ($_POST['wgt_post_hidden']) { $option = $_POST['wgt_post_limit']; update_option('wgt_post_limit', $option); } $wgt_post_limit = get_option('wgt_post_limit'); if (!isset($wgt_post_limit) || trim($wgt_post_limit) == '') { $wgt_post_limit = 0; update_option('wgt_post_limit', $wgt_post_limit); } echo '<label for="wgt_post_limit">' . __('Maximum posts per blog (0 for unlimited)', 'diamond') . ':<br /><input id="wgt_post_limit" name="wgt_post_limit" type="text" value="' . $wgt_post_limit . '" /></label>'; echo '<br />'; }
/** * Deprecated functionality to retrieve a list of the most active sites. * * @since MU * @deprecated 3.0.0 * * @param int $num Optional. Number of activate blogs to retrieve. Default 10. * @param bool $display Optional. Whether or not to display the most active blogs list. Default true. * @return array List of "most active" sites. */ function get_most_active_blogs($num = 10, $display = true) { _deprecated_function(__FUNCTION__, '3.0.0'); $blogs = get_blog_list(0, 'all', false); // $blog_id -> $details if (is_array($blogs)) { reset($blogs); $most_active = array(); $blog_list = array(); foreach ((array) $blogs as $key => $details) { $most_active[$details['blog_id']] = $details['postcount']; $blog_list[$details['blog_id']] = $details; // array_slice() removes keys!! } arsort($most_active); reset($most_active); $t = array(); foreach ((array) $most_active as $key => $details) { $t[$key] = $blog_list[$key]; } unset($most_active); $most_active = $t; } if ($display) { if (is_array($most_active)) { reset($most_active); foreach ((array) $most_active as $key => $details) { $url = esc_url('http://' . $details['domain'] . $details['path']); echo '<li>' . $details['postcount'] . " <a href='{$url}'>{$url}</a></li>"; } } } return array_slice($most_active, 0, $num); }
function ultra_multisite_allsites() { $arr = array(); // get all blogs $blogs = get_blog_list(0, 'all'); if (0 < count($blogs)) { foreach ($blogs as $blog) { switch_to_blog($blog['blog_id']); if (get_theme_mod('show_in_home', 'on') !== 'on') { continue; } $blog_details = get_blog_details($blog['blog_id']); //print_r($blog_details); //echo "<div style='height:200px; overflow:auto;width:100%;'>"; print_r(get_blog_option( $blog[ 'blog_id' ], 'ultra_demo' )); echo "</div>"; $id = $blog['blog_id']; $name = $blog_details->blogname; $arr[$id] = $name; } } return $arr; }