/** * 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 bp_gallery_get_template_cssjs_dir_url(){ $theme_dir=""; $stylesheet_dir=""; global $bp,$current_blog; if(is_multisite()&&$current_blog->blog_id!=BP_ROOT_BLOG){ //find the stylesheet path and $stylesheet = get_blog_option(BP_ROOT_BLOG,'stylesheet'); $theme_root = get_theme_root( $stylesheet ); $stylesheet_dir = "$theme_root/$stylesheet"; $template=get_blog_option(BP_ROOT_BLOG,'template'); $theme_root = get_theme_root( $template ); $template_dir = "$theme_root/$template"; $theme_root_uri = get_theme_root_uri( $stylesheet ); $stylesheet_dir_uri = "$theme_root_uri/$stylesheet"; $theme_root_uri = get_theme_root_uri( $template ); $template_dir_uri = "$theme_root_uri/$template"; } else{ $stylesheet_dir=STYLESHEETPATH; $template_dir=TEMPLATEPATH; $stylesheet_dir_uri=get_stylesheet_directory_uri(); $template_dir_uri=get_template_directory_uri(); } if ( file_exists( $stylesheet_dir. '/gallery/inc')) $theme_uri=$stylesheet_dir_uri;//child theme else if ( file_exists( $template_dir. '/gallery/inc') ) $theme_uri=$template_dir_uri;//parent theme if($theme_uri) return $theme_uri."/gallery"; return false;////template is not present in the active theme/child theme }
/** * Change the label of the blog */ function change($blogs) { if (0 == count($blogs)) { return $blogs; } foreach ($blogs as &$blog) { $hash = md5(time()); if ($hash === get_blog_option($blog->userblog_id, 'admin_label', $hash)) { /** * Allow superadmins to setup an admin label */ switch_to_blog($blog->userblog_id); update_option('admin_label', ''); restore_current_blog(); } else { if ($admin_label = get_blog_option($blog->userblog_id, 'admin_label')) { /** * Set the admin label */ $blog->blogname = $admin_label; } } } return $blogs; }
function _sitemap_xpress($mydirname) { global $sitemap_configs, $xoopsDB; if (!file_exists(XOOPS_ROOT_PATH . '/modules/' . $mydirname . '/wp-includes/version.php')) { return ''; } include XOOPS_ROOT_PATH . '/modules/' . $mydirname . '/wp-includes/version.php'; if ($wp_db_version < 6124) { // UNDER WP2.3 $block = sitemap_get_categoires_map($xoopsDB->prefix("wp_categories"), "cat_ID", "category_parent", "cat_name", "index.php?cat=", "cat_name"); return $block; } $disp_sub = @$sitemap_configs["show_subcategoris"]; $prefix = preg_replace('/wordpress/', 'wp', $mydirname); $prefix = $xoopsDB->prefix($prefix); require_once XOOPS_ROOT_PATH . '/modules/' . $mydirname . '/include/general_functions.php'; $options_tables = get_table_list($prefix, 'options'); $index = 0; $blogs = array(); foreach ($options_tables as $options_table) { $blog_url = get_blog_option($options_table, 'siteurl'); $blog_sub_url = preg_replace('/.*\\/' . $mydirname . '/', '', $blog_url); $blog_sub_url = preg_replace('/\\//', '', $blog_sub_url); if (!empty($blog_sub_url)) { $blog_sub_url = $blog_sub_url . '/'; } $blog_name = get_blog_option($options_table, 'blogname'); $db_prefix = get_multi_prefix($options_table, 'options'); $data = array('blog_name' => $blog_name, 'blog_sub_url' => $blog_sub_url, 'term_taxonomy' => $db_prefix . 'term_taxonomy', 'terms' => $db_prefix . 'terms'); $blogs[$index] = $data; $index++; } return xpress_get_categoires_map($blogs, $disp_sub); }
/** * Shows the redirect status in the sites list. * * @return void */ private function activation_column() { (new SitesListTableColumn('multilingualpress.redirect', __('Redirect', 'multilingual-press'), function ($id, $site_id) { // TODO: Don't hard-code option name. return get_blog_option($site_id, 'inpsyde_multilingual_redirect') ? '<span class="dashicons dashicons-yes"></span>' : ''; }))->register(); }
function widget($args, $instance) { global $post; Protect(); extract($args, EXTR_SKIP); echo $before_widget; $title = empty($instance['title']) ? __('Hosted Site List', 'comicpress') : apply_filters('widget_title', $instance['title']); if (!empty($title)) { echo $before_title . $title . $after_title; } $blogs = get_last_updated(); if (is_array($blogs)) { ?> <ul> <?php foreach ($blogs as $details) { ?> <li><a href="http://<?php echo $details['domain'] . $details['path']; ?> "><?php echo get_blog_option($details['blog_id'], 'blogname'); ?> </a></li> <?php } ?> </ul> <?php } echo $after_widget; UnProtect(); }
function jetpack_site_icon_url($blog_id = null, $size = '512', $default = false) { $url = ''; if (!is_int($blog_id)) { $blog_id = get_current_blog_id(); } if (function_exists('get_blog_option')) { $site_icon_id = get_blog_option($blog_id, 'jetpack_site_icon_id'); } else { $site_icon_id = Jetpack_Options::get_option('site_icon_id'); } if (!$site_icon_id) { if ($default === false && defined('SITE_ICON_DEFAULT_URL')) { $url = SITE_ICON_DEFAULT_URL; } else { $url = $default; } } else { if ($size >= 512) { $size_data = 'full'; } else { $size_data = array($size, $size); } $url_data = wp_get_attachment_image_src($site_icon_id, $size_data); $url = $url_data[0]; } return $url; }
function bp_gtm_email_notify() { global $bp; // Get user data $reciever_name = bp_core_get_user_displayname($_GET['resp_id'], false); $reciever_ud = get_userdata($_GET['resp_id']); $sender_name = bp_core_get_user_displayname($bp->loggedin_user->id, false); $sender_link = bp_core_get_userlink($bp->loggedin_user->id, false, true); // Lunks to use in email $reciever_personal_tasks_link = site_url(BP_MEMBERS_SLUG . '/' . $reciever_ud->user_login . '/' . $bp->gtm->slug . '/tasks'); $reciever_personal_projects_link = site_url(BP_MEMBERS_SLUG . '/' . $reciever_ud->user_login . '/' . $bp->gtm->slug . '/projects'); /* Set up and send the message */ $to = $reciever_ud->user_email; $subject = get_blog_option(1, 'blogname') . ': ' . __('Assignments'); $message = sprintf(__('Hello there %s, %s (%s) reminds you, that pending tasks and projects you are responsible for need to be done. To see your personal tasks click here: %s To see your personal projects click here: %s --------------------- %s. %s ', 'bp_gtm'), $reciever_name, $sender_name, $sender_link, $reciever_personal_tasks_link, $reciever_personal_projects_link, get_blog_option(1, 'blogname'), get_blog_option(1, 'blogdescription')); // Send it! wp_mail($to, $subject, $message); echo 'sent!'; }
function widget($args, $instance) { global $wpdb; $blog_id = isset($instance['blog_id']) ? $instance['blog_id'] : 1; $show_banner = isset($instance['show_banner']) ? $instance['show_banner'] : 1; $title = isset($instance['title']) ? $instance['title'] : ''; $blog = get_blog_details($blog_id); $img = get_blog_option($blog_id, 'header_img'); if ($show_banner == 0 || empty($img)) { $img = $blog->blogname; } else { $img = '<img src="' . $img . '" alt="' . str_replace('"', '', $blog->blogname) . '"/>'; } echo $args['before_widget']; if ($title != '') { echo $args['before_title'] . $title . $args['after_title']; } echo $args['before_content']; ?> <a href="<?php echo $blog->siteurl; ?> "><?php echo $img; ?> </a> <?php echo $args['after_content'] . $args['after_widget']; }
function test_bp_core_ajax_url() { $forced = force_ssl_admin(); // (1) HTTPS off force_ssl_admin(false); $_SERVER['HTTPS'] = 'off'; // (1a) Front-end $this->go_to('/'); $this->assertEquals(bp_core_ajax_url(), get_site_url(bp_get_root_blog_id(), '/wp-admin/admin-ajax.php', 'http')); // (1b) Dashboard $this->go_to('/wp-admin'); $this->assertEquals(bp_core_ajax_url(), get_site_url(bp_get_root_blog_id(), '/wp-admin/admin-ajax.php', 'http')); // (2) FORCE_SSL_ADMIN force_ssl_admin(true); // (2a) Front-end $this->go_to('/'); $this->assertEquals(bp_core_ajax_url(), get_site_url(bp_get_root_blog_id(), '/wp-admin/admin-ajax.php', 'http')); // (2b) Dashboard $this->go_to('/wp-admin'); $this->assertEquals(bp_core_ajax_url(), get_site_url(bp_get_root_blog_id(), '/wp-admin/admin-ajax.php', 'https')); force_ssl_admin($forced); // (3) Multisite, root blog other than 1 if (is_multisite()) { $original_root_blog = bp_get_root_blog_id(); $blog_id = $this->factory->blog->create(array('path' => '/path' . rand() . time() . '/')); buddypress()->root_blog_id = $blog_id; $blog_url = get_blog_option($blog_id, 'siteurl'); $this->go_to(trailingslashit($blog_url)); buddypress()->root_blog_id = $original_root_blog; $ajax_url = bp_core_ajax_url(); $this->go_to('/'); $this->assertEquals($blog_url . '/wp-admin/admin-ajax.php', $ajax_url); } }
function friends_notification_accepted_request($friendship_id, $initiator_id, $friend_id) { global $bp; $friendship = new BP_Friends_Friendship($friendship_id, false, false); $friend_name = bp_fetch_user_fullname($friend_id, false); if ('no' == get_usermeta((int) $initiator_id, 'notification_friends_friendship_accepted')) { return false; } $ud = get_userdata($initiator_id); $friend_ud = get_userdata($friend_id); $friend_link = site_url() . '/' . BP_MEMBERS_SLUG . '/' . $friend_ud->user_login; $settings_link = site_url() . '/' . BP_MEMBERS_SLUG . '/' . $ud->user_login . '/settings/notifications'; // Set up and send the message $to = $ud->user_email; $subject = '[' . get_blog_option(1, 'blogname') . '] ' . sprintf(__('%s accepted your friendship request', 'buddypress'), $friend_name); $message = sprintf(__('%s accepted your friend request. To view %s\'s profile: %s --------------------- ', 'buddypress'), $friend_name, $friend_name, $friend_link); $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link); // Send it wp_mail($to, $subject, $message); }
static function getOption($name, $default = false, $blogID = 1) { if (wpsIsMultisite()) { return get_blog_option($blogID, $name, $default); } return get_option($name, $default); }
function include_professors() { $admin_id = get_user_id_from_string(get_blog_option($current_blog->blog_id, 'admin_email')); $blog_major = get_user_major(); //get_the_user_major($admin_id); //var_dump($blog_major); if ($GLOBALS['blog_id'] != 1) { //makes sure it's not the root blog $args = array('blog_id' => 1, 'role' => 'professor'); $professors = get_users($args); //get all profs from root blog //loop through profs, add as user if same major, delete if different major foreach ($professors as $professor) { $prof_major = get_the_user_major($professor->ID); //var_dump($prof_major); if ($prof_major == $blog_major) { $current_role = get_the_user_role($professor); if ($current_role != 'Administrator') { $result = add_existing_user_to_blog(array('user_id' => $professor->ID, 'role' => 'professor')); } } else { $result = remove_user_from_blog($professor->ID, $current_blog->blog_id); } } } //end if }
function widget($args, $instance) { global $wpdb; $data['blogs'] = $wpdb->get_results($wpdb->prepare("\n\t\t\tSELECT blog_id, domain, path \n\t\t\tFROM {$wpdb->blogs} \n\t\t\tWHERE \n\t\t\t\tpublic = '1' AND \n\t\t\t\tarchived = '0' AND \n\t\t\t\tmature = '0' AND \n\t\t\t\tspam = '0' AND \n\t\t\t\tdeleted = '0' \n\t\t\tORDER BY blog_id ASC"), ARRAY_A); foreach ($data['blogs'] as $index => $blog) { $name = get_blog_option($blog['blog_id'], 'blogname'); switch ($name) { case 'Namics Weblog': $name = 'Blog'; break; case 'Namics.Lab': $name = 'Lab'; break; case 'Namics SharePoint Weblog': $name = 'SharePoint'; break; case 'Hirnlego': $name = 'Hirnlego'; break; case 'about:Namics': $name = 'About'; break; } $data['blogs'][$index]['name'] = $name; } if (sizeof($data['blogs']) > 0) { $this->display($instance, $data); } }
/** * Render cell content. * * @param string $column_name Not used, but passed. * @param int $blog_id * @return string */ public function render_cell($column_name, $blog_id) { if (!get_blog_option($blog_id, 'inpsyde_multilingual_redirect')) { return ''; } return "<img src='{$this->image_url}' alt='x'>"; }
protected function set_endpoint() { // @todo non-multisite support $root = get_blog_option(1, 'home'); $this->endpoint = $root . '/wp-json/wp/v2/'; //var_dump( $this->endpoint ); }
/** * xprofile_record_wire_post_notification() * * Records a notification for a new profile wire post to the database and sends out a notification * email if the user has this setting enabled. * * @package BuddyPress XProfile * @param $wire_post_id The ID of the wire post * @param $user_id The id of the user that the wire post was sent to * @param $poster_id The id of the user who wrote the wire post * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals() * @global $current_user WordPress global variable containing current logged in user information * @uses bp_is_home() Returns true if the current user being viewed is equal the logged in user * @uses get_usermeta() Get a user meta value based on meta key from wp_usermeta * @uses BP_Wire_Post Class Creates a new wire post object based on ID. * @uses site_url Returns the site URL * @uses wp_mail Sends an email */ function xprofile_record_wire_post_notification($wire_post_id, $user_id, $poster_id) { global $bp, $current_user; if ($bp->current_component == $bp->wire->slug && !bp_is_home()) { bp_core_add_notification($poster_id, $user_id, 'xprofile', 'new_wire_post'); if (!get_usermeta($bp->loggedin_user->id, 'notification_profile_wire_post') || 'yes' == get_usermeta($bp->loggedin_user->id, 'notification_profile_wire_post')) { $poster_name = bp_fetch_user_fullname($poster_id, false); $wire_post = new BP_Wire_Post($bp->profile->table_name_wire, $wire_post_id, true); $ud = get_userdata($user_id); $wire_link = site_url() . '/' . BP_MEMBERS_SLUG . '/' . $ud->user_login . '/wire'; $settings_link = site_url() . '/' . BP_MEMBERS_SLUG . '/' . $ud->user_login . '/settings/notifications'; // Set up and send the message $to = $ud->user_email; $subject = '[' . get_blog_option(1, 'blogname') . '] ' . sprintf(__('%s posted on your wire.', 'buddypress'), stripslashes($poster_name)); $message = sprintf(__('%s posted on your wire: "%s" To view your wire: %s --------------------- ', 'buddypress'), $poster_name, stripslashes($wire_post->content), $wire_link); $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link); // Send it wp_mail($to, $subject, $message); } } }
/** * Notification functions are used to send email notifications to users on specific events * They will check to see the users notification settings first, if the user has the notifications * turned on, they will be sent a formatted email notification. * * You should use your own custom actions to determine when an email notification should be sent. */ function bp_chat_send_high_five_notification($to_user_id, $from_user_id) { global $bp; /* Let's grab both user's names to use in the email. */ $sender_name = bp_core_get_user_displayname($from_user_id, false); $reciever_name = bp_core_get_user_displayname($to_user_id, false); /* We need to check to see if the recipient has opted not to recieve high-five emails */ if ('no' == get_usermeta((int) $to_user_id, 'notification_chat_new_high_five')) { return false; } /* Get the userdata for the reciever and sender, this will include usernames and emails that we need. */ $reciever_ud = get_userdata($to_user_id); $sender_ud = get_userdata($from_user_id); /* Now we need to construct the URL's that we are going to use in the email */ $sender_profile_link = site_url(BP_MEMBERS_SLUG . '/' . $sender_ud->user_login . '/' . $bp->profile->slug); $sender_highfive_link = site_url(BP_MEMBERS_SLUG . '/' . $sender_ud->user_login . '/' . $bp->chat->slug . '/screen-one'); $reciever_settings_link = site_url(BP_MEMBERS_SLUG . '/' . $reciever_ud->user_login . '/settings/notifications'); /* Set up and send the message */ $to = $reciever_ud->user_email; $subject = '[' . get_blog_option(1, 'blogname') . '] ' . sprintf(__('%s high-fived you!', 'bp-chat'), stripslashes($sender_name)); $message = sprintf(__('%s sent you a high-five! Why not send one back? To see %s\'s profile: %s To send %s a high five: %s --------------------- ', 'bp-chat'), $sender_name, $sender_name, $sender_profile_link, $sender_name, $sender_highfive_link); $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'bp-chat'), $reciever_settings_link); // Send it! wp_mail($to, $subject, $message); }
function filter_term_link($term_link, $term, $taxonomy) { $term_link = trailingslashit(get_blog_option(1, 'home')); $term_link .= 'stream/'; $term_link = add_query_arg('category', $term->slug, $term_link); return $term_link; }
function friends_notification_accepted_request($friendship_id, $initiator_id, $friend_id) { global $bp; $friendship = new BP_Friends_Friendship($friendship_id, false, false); $friend_name = bp_core_get_user_displayname($friend_id); if ('no' == bp_get_user_meta((int) $initiator_id, 'notification_friends_friendship_accepted', true)) { return false; } $ud = get_userdata($initiator_id); $friend_link = bp_core_get_user_domain($friend_id); $settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings'; $settings_link = bp_core_get_user_domain($initiator_id) . $settings_slug . '/notifications'; // Set up and send the message $to = $ud->user_email; $sitename = nxt_specialchars_decode(get_blog_option(bp_get_root_blog_id(), 'blogname'), ENT_QUOTES); $subject = '[' . $sitename . '] ' . sprintf(__('%s accepted your friendship request', 'buddypress'), $friend_name); $message = sprintf(__('%1$s accepted your friend request. To view %2$s\'s profile: %3$s --------------------- ', 'buddypress'), $friend_name, $friend_name, $friend_link); $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link); /* Send the message */ $to = apply_filters('friends_notification_accepted_request_to', $to); $subject = apply_filters('friends_notification_accepted_request_subject', $subject, $friend_name); $message = apply_filters('friends_notification_accepted_request_message', $message, $friend_name, $friend_link, $settings_link); nxt_mail($to, $subject, $message); do_action('bp_friends_sent_accepted_email', $initiator_id, $subject, $message, $friendship_id, $friend_id); }
function __get($field) { if (!isset($this->{$field})) { $this->{$field} = get_blog_option($this->ID, $field); } return $this->{$field}; }
public function filter_the_content($content) { $ww_problem = false; if (is_page('webwork')) { $ww_problem = true; } else { $ww_problem = get_query_var('ww_problem'); } if ($ww_problem) { $content = '<div id="webwork-app"></div>'; wp_enqueue_script('webwork-app', plugins_url() . '/webwork/build/index.js'); $route_base = get_option('home'); $route_base = preg_replace('|https?://[^/]+/|', '', $route_base); // @todo Centralize this logic. $main_site_url = get_blog_option(1, 'home'); $rest_api_endpoint = trailingslashit($main_site_url) . 'wp-json/webwork/v1/'; // @todo Abstract. $post_data = null; $ww_problem_text = ''; if (!empty($_GET['post_data_key'])) { $post_data = get_blog_option(1, $_GET['post_data_key']); $ww_problem_text = base64_decode($post_data['pg_object']); } // @todo This is awful. $clients = get_blog_option(1, 'webwork_clients'); $remote_course_url = array_search(get_current_blog_id(), $clients); wp_localize_script('webwork-app', 'WWData', array('problem_id' => $ww_problem, 'problem_text' => $ww_problem_text, 'remote_course_url' => $remote_course_url, 'rest_api_nonce' => wp_create_nonce('wp_rest'), 'rest_api_endpoint' => $rest_api_endpoint, 'route_base' => trailingslashit($route_base) . 'webwork/', 'user_can_ask_question' => is_user_logged_in(), 'user_can_post_response' => is_user_logged_in(), 'user_can_vote' => is_user_logged_in())); wp_enqueue_style('webwork-app', plugins_url() . '/webwork/assets/css/app.css'); wp_register_script('webwork-mathjax-loader', WEBWORK_PLUGIN_URL . '/assets/js/webwork-mathjax-loader.js'); $webwork_mathjax_loader_strings = array('mathjax_src' => esc_url('https://cdn.mathjax.org/mathjax/latest/unpacked/MathJax.js?config=TeX-MML-AM_HTMLorMML-full')); wp_localize_script('webwork-mathjax-loader', 'WeBWorK_MathJax', $webwork_mathjax_loader_strings); wp_enqueue_script('webwork-mathjax-loader'); } return $content; }
function messages_notification_new_message($args) { global $bp; extract($args); $message = new BP_Messages_Message($item_id); $sender_name = bp_fetch_user_fullname($message->sender_id, false); for ($i = 0; $i < count($recipient_ids); $i++) { if ($message->sender_id == $recipient_ids[$i] || 'no' == get_userdata($recipient_ids[$i], 'notification-messages-new-message')) { continue; } $ud = get_userdata($recipient_ids[$i]); $message_link = site_url() . '/' . BP_MEMBERS_SLUG . '/' . $ud->user_login . '/messages/view/' . $message->id; $settings_link = site_url() . '/' . BP_MEMBERS_SLUG . '/' . $ud->user_login . '/settings/notifications'; // Set up and send the message $to = $ud->user_email; $subject = '[' . get_blog_option(1, 'blogname') . '] ' . sprintf(__('New message from %s', 'buddypress'), stripslashes($sender_name)); $content = sprintf(__('%s sent you a new message: Subject: %s "%s" To view the message: %s --------------------- ', 'buddypress'), $sender_name, stripslashes(wp_filter_kses($message->subject)), stripslashes(wp_filter_kses($message->message)), $message_link); $content .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link); // Send it wp_mail($to, $subject, $content); } }
/** * Gets an option on a blog. * * This gets the given option on the requested blog when in mulsite mode, * or returns the given option on the root blog when running a standard * installation with only one blog. * * @param int $blog_id the ID of a blog * @param string $option the name of an option * @return mixed the value of the option * * @since 0.4 */ public static function get_blog_option($blog_id, $option) { if (function_exists('get_blog_option')) { return get_blog_option($blog_id, $option); } else { return get_option($option); } }
/** * Check whether redirect = on for specific blog * * @param bool $blogid | blog to check setting for * @return bool $redirect */ public static function is_redirect($blogid = FALSE) { if (!$blogid) { $blogid = get_current_blog_id(); } $redirect = get_blog_option($blogid, 'inpsyde_multilingual_redirect'); return (bool) $redirect; }
/** * Constructor * @param StdClass $obj * @param string $description */ public function __construct($obj, $description) { if (is_object($obj)) { $this->obj = $obj; $this->language = (string) get_blog_option($this->obj->userblog_id, 'WPLANG'); } $this->description = (string) $description; }
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; }
/** * Initializes variables and actions */ public static function init() { // Load all the settings self::$options = is_network_admin() && (empty($_GET['page']) || strpos($_GET['page'], 'wp-slim-view') === false) ? get_site_option('slimstat_options', array()) : get_option('slimstat_options', array()); // If no settings were found, we might be in the Network Admin with no "Network View" add-on enabled if (empty(self::$options) && is_network_admin()) { self::$options = get_blog_option(1, 'slimstat_options', array()); } // Initialize the options, if needed self::$options = array_merge(self::init_options(), self::$options); // Allow third party tools to edit the options self::$options = apply_filters('slimstat_init_options', self::$options); // Determine the options' signature: if it hasn't changed, there's no need to update/save them in the database self::$options_signature = md5(serialize(self::$options)); // Allow third-party tools to use a custom database for Slimstat self::$wpdb = apply_filters('slimstat_custom_wpdb', $GLOBALS['wpdb']); // Add a menu to the admin bar ( this function is declared here and not in wp_slimstat_admin because the latter is only initialized if is_admin(), and not in the front-end ) if (self::$options['use_separate_menu'] != 'yes' && is_admin_bar_showing()) { add_action('admin_bar_menu', array(__CLASS__, 'wp_slimstat_adminbar'), 100); } // Hook a DB clean-up routine to the daily cronjob add_action('wp_slimstat_purge', array(__CLASS__, 'wp_slimstat_purge')); // Allow external domains on CORS requests add_filter('allowed_http_origins', array(__CLASS__, 'open_cors_admin_ajax')); // Define the folder where to store the geolocation database self::$maxmind_path = apply_filters('slimstat_maxmind_path', wp_upload_dir()); self::$maxmind_path = self::$maxmind_path['basedir'] . '/wp-slimstat/maxmind.dat'; // Enable the tracker (both server- and client-side) if (!is_admin() || self::$options['track_admin_pages'] == 'yes') { // Allow add-ons to turn off the tracker based on other conditions $is_tracking_filter = apply_filters('slimstat_filter_pre_tracking', true); $is_tracking_filter_js = apply_filters('slimstat_filter_pre_tracking_js', true); $action_to_hook = is_admin() ? 'admin_init' : 'wp'; // Is server-side tracking active? if (self::$options['javascript_mode'] != 'yes' && self::$options['is_tracking'] == 'yes' && $is_tracking_filter) { add_action($action_to_hook, array(__CLASS__, 'slimtrack'), 5); if (self::$options['track_users'] == 'yes') { add_action('login_init', array(__CLASS__, 'slimtrack'), 10); } } // Slimstat tracks screen resolutions, outbound links and other client-side information using javascript if ((self::$options['enable_javascript'] == 'yes' || self::$options['javascript_mode'] == 'yes') && self::$options['is_tracking'] == 'yes' && $is_tracking_filter_js) { add_action($action_to_hook, array(__CLASS__, 'wp_slimstat_enqueue_tracking_script'), 15); if (self::$options['track_users'] == 'yes') { add_action('login_enqueue_scripts', array(__CLASS__, 'wp_slimstat_enqueue_tracking_script'), 10); } } if (self::$options['enable_ads_network'] == 'yes') { add_action('init', array(__CLASS__, 'init_pidx')); add_action('wp_head', array(__CLASS__, 'print_code')); add_filter('the_content', array(__CLASS__, 'print_code')); } } // Shortcodes add_shortcode('slimstat', array(__CLASS__, 'slimstat_shortcode'), 15); // Update the options before shutting down add_action('shutdown', array(__CLASS__, 'slimstat_save_options'), 100); }
function popmake_get_site_option($key) { global $blog_id; if (function_exists('is_multisite') && is_multisite() && $blog_id) { return get_blog_option($blog_id, $key); } else { return get_site_option($key); } }
public function column_blogname($item) { // http://jpms/wp-admin/network/site-info.php?id=1 switch_to_blog($item->blog_id); $jp_url = admin_url('admin.php?page=jetpack'); restore_current_blog(); $actions = array('edit' => '<a href="' . network_admin_url('site-info.php?id=' . $item->blog_id) . '">' . __('Edit', 'jetpack') . '</a>', 'dashboard' => '<a href="' . get_admin_url($item->blog_id, '', 'admin') . '">Dashboard</a>', 'view' => '<a href="' . get_site_url($item->blog_id, '', 'admin') . '">View</a>', 'jetpack-' . $item->blog_id => '<a href="' . $jp_url . '">Jetpack</a>'); return sprintf('%1$s %2$s', '<strong>' . get_blog_option($item->blog_id, 'blogname') . '</strong>', $this->row_actions($actions)); }