exists() ) return false; $user_id = $user->ID; } return is_super_admin( $user_id ); } if ( !function_exists( 'graceful_fail' ) ) : /** * @since MU * @deprecated 3.0.0 * @deprecated Use wp_die() * @see wp_die() */ function graceful_fail( $message ) { _deprecated_function( __FUNCTION__, '3.0', 'wp_die()' ); $message = apply_filters( 'graceful_fail', $message ); $message_template = apply_filters( 'graceful_fail_template', ' Error!

%s

' ); die( sprintf( $message_template, $message ) ); } endif; /** * @since MU * @deprecated 3.0.0 * @deprecated Use get_user_by() * @see get_user_by() */ function get_user_details( $username ) { _deprecated_function( __FUNCTION__, '3.0', 'get_user_by()' ); return get_user_by('login', $username); } /** * @since MU * @deprecated 3.0.0 * @deprecated Use clean_post_cache() * @see clean_post_cache() */ function clear_global_post_cache( $post_id ) { _deprecated_function( __FUNCTION__, '3.0', 'clean_post_cache()' ); } /** * @since MU * @deprecated 3.0.0 * @deprecated Use is_main_site() * @see is_main_site() */ function is_main_blog() { _deprecated_function( __FUNCTION__, '3.0', 'is_main_site()' ); return is_main_site(); } /** * @since MU * @deprecated 3.0.0 * @deprecated Use is_email() * @see is_email() */ function validate_email( $email, $check_domain = true) { _deprecated_function( __FUNCTION__, '3.0', 'is_email()' ); return is_email( $email, $check_domain ); } /** * @since MU * @deprecated 3.0.0 * @deprecated No alternative available. For performance reasons this function is not recommended. */ function get_blog_list( $start = 0, $num = 10, $deprecated = '' ) { _deprecated_function( __FUNCTION__, '3.0' ); global $wpdb; $blogs = $wpdb->get_results( $wpdb->prepare("SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' ORDER BY registered DESC", $wpdb->siteid), ARRAY_A ); foreach ( (array) $blogs as $details ) { $blog_list[ $details['blog_id'] ] = $details; $blog_list[ $details['blog_id'] ]['postcount'] = $wpdb->get_var( "SELECT COUNT(ID) FROM " . $wpdb->get_blog_prefix( $details['blog_id'] ). "posts WHERE post_status='publish' AND post_type='post'" ); } unset( $blogs ); $blogs = $blog_list; if ( false == is_array( $blogs ) ) return array(); if ( $num == 'all' ) return array_slice( $blogs, $start, count( $blogs ) ); else return array_slice( $blogs, $start, $num ); } /** * @since MU * @deprecated 3.0.0 * @deprecated No alternative available. For performance reasons this function is not recommended. */ function get_most_active_blogs( $num = 10, $display = true ) { _deprecated_function( __FUNCTION__, '3.0' ); $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; } if ( $display == true ) { if ( is_array( $most_active ) ) { reset( $most_active ); foreach ( (array) $most_active as $key => $details ) { $url = esc_url('http://' . $details['domain'] . $details['path']); echo '
  • ' . $details['postcount'] . " $url
  • "; } } } return array_slice( $most_active, 0, $num ); } /** * Redirect a user based on $_GET or $_POST arguments. * * The function looks for redirect arguments in the following order: * 1) $_GET['ref'] * 2) $_POST['ref'] * 3) $_SERVER['HTTP_REFERER'] * 4) $_GET['redirect'] * 5) $_POST['redirect'] * 6) $url * * @since MU * @deprecated 3.3.0 * @deprecated Use wp_redirect() * @uses wpmu_admin_redirect_add_updated_param() * * @param string $url */ function wpmu_admin_do_redirect( $url = '' ) { _deprecated_function( __FUNCTION__, '3.3' ); $ref = ''; if ( isset( $_GET['ref'] ) ) $ref = $_GET['ref']; if ( isset( $_POST['ref'] ) ) $ref = $_POST['ref']; if ( $ref ) { $ref = wpmu_admin_redirect_add_updated_param( $ref ); wp_redirect( $ref ); exit(); } if ( empty( $_SERVER['HTTP_REFERER'] ) == false ) { wp_redirect( $_SERVER['HTTP_REFERER'] ); exit(); } $url = wpmu_admin_redirect_add_updated_param( $url ); if ( isset( $_GET['redirect'] ) ) { if ( substr( $_GET['redirect'], 0, 2 ) == 's_' ) $url .= '&action=blogs&s='. esc_html( substr( $_GET['redirect'], 2 ) ); } elseif ( isset( $_POST['redirect'] ) ) { $url = wpmu_admin_redirect_add_updated_param( $_POST['redirect'] ); } wp_redirect( $url ); exit(); } /** * Adds an 'updated=true' argument to a URL. * * @since MU * @deprecated 3.3.0 * @deprecated Use add_query_arg() * * @param string $url * @return string */ function wpmu_admin_redirect_add_updated_param( $url = '' ) { _deprecated_function( __FUNCTION__, '3.3' ); if ( strpos( $url, 'updated=true' ) === false ) { if ( strpos( $url, '?' ) === false ) return $url . '?updated=true'; else return $url . '&updated=true'; } return $url; } /** * Retrieve option value for a given blog id based on name of option. * * If the option does not exist or does not have a value, then the return value * will be false. This is useful to check whether you need to install an option * and is commonly used during installation of plugin options and to test * whether upgrading is required. * * If the option was serialized then it will be unserialized when it is returned. * * @since MU * @deprecated 3.5.0 * * @param int $id A blog ID. Can be null to refer to the current blog. * @param string $option Name of option to retrieve. Expected to not be SQL-escaped. * @param mixed $default Optional. Default value to return if the option does not exist. * @return mixed Value set for the option. */ function get_blog_option( $id, $option, $default = false ) { _deprecated_function( __FUNCTION__, '3.5' ); $id = (int) $id; if ( empty( $id ) ) $id = get_current_blog_id(); if ( get_current_blog_id() == $id ) return get_option( $option, $default ); switch_to_blog( $id ); $option = get_option( $option, $default ); restore_current_blog(); return $option; } /** * Add a new option for a given blog id. * * You do not need to serialize values. If the value needs to be serialized, then * it will be serialized before it is inserted into the database. Remember, * resources can not be serialized or added as an option. * * You can create options without values and then update the values later. * Existing options will not be updated and checks are performed to ensure that you * aren't adding a protected WordPress option. Care should be taken to not name * options the same as the ones which are protected. * * @since MU * @deprecated 3.5.0 * * @param int $id A blog ID. Can be null to refer to the current blog. * @param string $option Name of option to add. Expected to not be SQL-escaped. * @param mixed $value Optional. Option value, can be anything. Expected to not be SQL-escaped. * @return bool False if option was not added and true if option was added. */ function add_blog_option( $id, $option, $value ) { _deprecated_function( __FUNCTION__, '3.5' ); $id = (int) $id; if ( empty( $id ) ) $id = get_current_blog_id(); if ( get_current_blog_id() == $id ) return add_option( $option, $value ); switch_to_blog( $id ); $return = add_option( $option, $value ); restore_current_blog(); return $return; } /** * Removes option by name for a given blog id. Prevents removal of protected WordPress options. * * @since MU * @deprecated 3.5.0 * * @param int $id A blog ID. Can be null to refer to the current blog. * @param string $option Name of option to remove. Expected to not be SQL-escaped. * @return bool True, if option is successfully deleted. False on failure. */ function delete_blog_option( $id, $option ) { _deprecated_function( __FUNCTION__, '3.5' ); $id = (int) $id; if ( empty( $id ) ) $id = get_current_blog_id(); if ( get_current_blog_id() == $id ) return delete_option( $option ); switch_to_blog( $id ); $return = delete_option( $option ); restore_current_blog(); return $return; } /** * Update an option for a particular blog. * * @since MU * @deprecated 3.5.0 * * @param int $id The blog id * @param string $option The option key * @param mixed $value The option value * @return bool True on success, false on failrue. */ function update_blog_option( $id, $option, $value, $deprecated = null ) { _deprecated_function( __FUNCTION__, '3.5' ); $id = (int) $id; if ( null !== $deprecated ) _deprecated_argument( __FUNCTION__, '3.1' ); if ( get_current_blog_id() == $id ) return update_option( $option, $value ); switch_to_blog( $id ); $return = update_option( $option, $value ); restore_current_blog(); refresh_blog_details( $id ); return $return; }