本文整理汇总了PHP中is_blog_admin函数的典型用法代码示例。如果您正苦于以下问题:PHP is_blog_admin函数的具体用法?PHP is_blog_admin怎么用?PHP is_blog_admin使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_blog_admin函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_currentuserinfo
/**
* Populate global variables with information about the currently logged in user.
*
* Will set the current user, if the current user is not set. The current user
* will be set to the logged in person. If no user is logged in, then it will
* set the current user to 0, which is invalid and won't have any permissions.
*
* @since 0.71
* @uses $current_user Checks if the current user is set
* @uses wp_validate_auth_cookie() Retrieves current logged in user.
*
* @return bool|null False on XMLRPC Request and invalid auth cookie. Null when current user set
*/
function get_currentuserinfo()
{
global $current_user;
if (!empty($current_user)) {
if ($current_user instanceof WP_User) {
return;
}
// Upgrade stdClass to WP_User
if (is_object($current_user) && isset($current_user->ID)) {
$cur_id = $current_user->ID;
$current_user = null;
wp_set_current_user($cur_id);
return;
}
// $current_user has a junk value. Force to WP_User with ID 0.
$current_user = null;
wp_set_current_user(0);
return false;
}
if (defined('XMLRPC_REQUEST') && XMLRPC_REQUEST) {
wp_set_current_user(0);
return false;
}
if (!($user = wp_validate_auth_cookie())) {
if (is_blog_admin() || is_network_admin() || empty($_COOKIE[LOGGED_IN_COOKIE]) || !($user = wp_validate_auth_cookie($_COOKIE[LOGGED_IN_COOKIE], 'logged_in'))) {
wp_set_current_user(0);
return false;
}
}
wp_set_current_user($user);
}
示例2: hide_admin_bar_from_front_end
function hide_admin_bar_from_front_end()
{
if (is_blog_admin()) {
return true;
}
return false;
}
示例3: handle_ms_user_deletions
/**
* Handles Multisite User removal deletions.
*
* @package s2Member\User_Deletions
* @since 3.5
*
* @attaches-to ``add_action("remove_user_from_blog");``
*
* @param int|str $user_id Numeric WordPress User ID.
* @param int|str $blog_id Numeric WordPress Blog ID.
* @param bool $s2says Optional. Defaults to false. If true, it's definitely OK to process this deletion?
* The ``$s2says`` flag can be used when/if the routine is called directly for whatever reason.
* @return null
*/
public static function handle_ms_user_deletions($user_id = FALSE, $blog_id = FALSE, $s2says = FALSE)
{
static $processed = array();
// No duplicate processing.
global $pagenow;
// Need this to detect the current admin page.
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_before_handle_ms_user_deletions", get_defined_vars());
unset($__refs, $__v);
if (is_multisite() && empty($processed[$user_id])) {
if (($s2says || is_blog_admin() && $pagenow === "users.php") && ($processed[$user_id] = true)) {
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_during_handle_ms_user_deletions_before", get_defined_vars());
unset($__refs, $__v);
c_ws_plugin__s2member_user_deletions::handle_user_deletions($user_id);
// Hand this over.
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_during_handle_ms_user_deletions_after", get_defined_vars());
unset($__refs, $__v);
}
}
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_after_handle_ms_user_deletions", get_defined_vars());
unset($__refs, $__v);
return;
}
示例4: handle_ms_user_deletions
/**
* Handles Multisite User removal deletions.
*
* @package s2Member\User_Deletions
* @since 3.5
*
* @attaches-to ``add_action('remove_user_from_blog');``
*
* @param int|string $user_id Numeric WordPress User ID.
* @param int|string $blog_id Numeric WordPress Blog ID.
* @param bool $s2says Optional. Defaults to false. If true, it's definitely OK to process this deletion?
* The ``$s2says`` flag can be used when/if the routine is called directly for whatever reason.
*/
public static function handle_ms_user_deletions($user_id = 0, $blog_id = 0, $s2says = FALSE)
{
static $processed = array();
// No duplicate processing.
global $pagenow;
// Need this to detect the current admin page.
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_before_handle_ms_user_deletions', get_defined_vars());
unset($__refs, $__v);
if ($user_id && is_multisite() && empty($processed[$user_id]) && ($s2says || is_blog_admin() && $pagenow === 'users.php')) {
$processed[$user_id] = TRUE;
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_during_handle_ms_user_deletions_before', get_defined_vars());
unset($__refs, $__v);
c_ws_plugin__s2member_user_deletions::handle_user_deletions($user_id);
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_during_handle_ms_user_deletions_after', get_defined_vars());
unset($__refs, $__v);
}
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_after_handle_ms_user_deletions', get_defined_vars());
unset($__refs, $__v);
}
示例5: is_blog_admin
public static function is_blog_admin()
{
if (version_compare(get_bloginfo("version"), "3.1-RC", ">=")) {
return is_blog_admin();
}
/**/
return is_admin();
}
示例6: hide_admin_bar_from_front_end
function hide_admin_bar_from_front_end()
{
if (is_blog_admin()) {
return true;
}
remove_action('wp_head', '_admin_bar_bump_cb');
return false;
}
示例7: jl_brd_recent_drafts
function jl_brd_recent_drafts()
{
if (!(is_blog_admin() && current_user_can('edit_posts'))) {
return;
}
wp_add_dashboard_widget('jl_brd_dashboard_recent_drafts', __('Recent Drafts'), 'jl_brd_dashboard_recent_drafts');
remove_meta_box('dashboard_recent_drafts', 'dashboard', 'side');
// recent drafts
remove_meta_box('dashboard_recent_drafts', 'dashboard', 'normal');
// recent drafts
}
示例8: admin_user_new_fields
/**
* Adds Custom Fields to `/wp-admin/user-new.php`.
*
* We have to buffer because `/user-new.php` has NO Hooks.
*
* @package s2Member\New_Users
* @since 3.5
*
* @attaches-to ``add_action("load-user-new.php");``
*
* @return null
*/
public static function admin_user_new_fields()
{
global $pagenow;
// The current admin page file name.
do_action("ws_plugin__s2member_before_admin_user_new_fields", get_defined_vars());
if (is_blog_admin() && $pagenow === "user-new.php" && current_user_can("create_users")) {
ob_start("c_ws_plugin__s2member_user_new_in::_admin_user_new_fields");
do_action("ws_plugin__s2member_during_admin_user_new_fields", get_defined_vars());
}
do_action("ws_plugin__s2member_after_admin_user_new_fields", get_defined_vars());
return;
}
示例9: wphd_remove_admin_bar_links
function wphd_remove_admin_bar_links()
{
global $blog, $current_user, $id, $wp_admin_bar, $wphd_user_capability;
if ((!current_user_can('' . $wphd_user_capability . '') || !current_user_can_for_blog($blog->userblog_id, '' . $wphd_user_capability . '')) && is_admin_bar_showing()) {
/* If Multisite, check whether they are assigned to any network sites before removing links */
$user_id = get_current_user_id();
$blogs = get_blogs_of_user($user_id);
if (is_multisite() && empty($blogs)) {
return;
} else {
if (is_admin() || is_blog_admin()) {
$wp_admin_bar->remove_menu('edit-my-profile');
}
}
$wp_admin_bar->remove_menu('dashboard');
}
}
示例10: get_currentuserinfo
/**
* Populate global variables with information about the currently logged in user.
*
* Will set the current user, if the current user is not set. The current user
* will be set to the logged in person. If no user is logged in, then it will
* set the current user to 0, which is invalid and won't have any permissions.
*
* @since 0.71
* @uses $current_user Checks if the current user is set
* @uses wp_validate_auth_cookie() Retrieves current logged in user.
*
* @return bool|null False on XMLRPC Request and invalid auth cookie. Null when current user set
*/
function get_currentuserinfo()
{
global $current_user;
if (defined('XMLRPC_REQUEST') && XMLRPC_REQUEST) {
return false;
}
if (!empty($current_user)) {
return;
}
if (!($user = wp_validate_auth_cookie())) {
if (is_blog_admin() || is_network_admin() || empty($_COOKIE[LOGGED_IN_COOKIE]) || !($user = wp_validate_auth_cookie($_COOKIE[LOGGED_IN_COOKIE], 'logged_in'))) {
wp_set_current_user(0);
return false;
}
}
wp_set_current_user($user);
}
示例11: admin_user_new_fields
/**
* Adds Custom Fields to `/wp-admin/user-new.php`.
*
* We have to buffer because `/user-new.php` has NO Hooks.
*
* @package optimizeMember\New_Users
* @since 3.5
*
* @attaches-to ``add_action("load-user-new.php");``
*
* @return null
*/
public static function admin_user_new_fields()
{
global $pagenow;
/* The current admin page file name. */
/**/
do_action("ws_plugin__optimizemember_before_admin_user_new_fields", get_defined_vars());
/**/
if (is_blog_admin() && $pagenow === "user-new.php" && current_user_can("create_users")) {
ob_start("c_ws_plugin__optimizemember_user_new_in::_admin_user_new_fields");
/**/
do_action("ws_plugin__optimizemember_during_admin_user_new_fields", get_defined_vars());
}
/**/
do_action("ws_plugin__optimizemember_after_admin_user_new_fields", get_defined_vars());
/**/
return;
/* Return for uniformity. */
}
示例12: handle_ms_user_deletions
/**
* Handles Multisite User removal deletions.
*
* @package s2Member\User_Deletions
* @since 3.5
*
* @attaches-to ``add_action("remove_user_from_blog");``
*
* @param int|str $user_id Numeric WordPress® User ID.
* @param int|str $blog_id Numeric WordPress® Blog ID.
* @param bool $s2says Optional. Defaults to false. If true, it's definitely OK to process this deletion?
* The ``$s2says`` flag can be used when/if the routine is called directly for whatever reason.
* @return null
*/
public static function handle_ms_user_deletions($user_id = FALSE, $blog_id = FALSE, $s2says = FALSE)
{
static $processed = array();
/* No duplicate processing. */
global $pagenow;
/* Need this to detect the current admin page. */
/**/
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
do_action("ws_plugin__s2member_before_handle_ms_user_deletions", get_defined_vars());
unset($__refs, $__v);
/* Unset defined __refs, __v. */
/**/
if (is_multisite() && empty($processed[$user_id])) {
if (($s2says || is_blog_admin() && $pagenow === "users.php") && ($processed[$user_id] = true)) {
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
do_action("ws_plugin__s2member_during_handle_ms_user_deletions_before", get_defined_vars());
unset($__refs, $__v);
/* Unset defined __refs, __v. */
/**/
c_ws_plugin__s2member_user_deletions::handle_user_deletions($user_id);
/* Hand this over. */
/**/
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
do_action("ws_plugin__s2member_during_handle_ms_user_deletions_after", get_defined_vars());
unset($__refs, $__v);
/* Unset defined __refs, __v. */
}
}
/**/
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
do_action("ws_plugin__s2member_after_handle_ms_user_deletions", get_defined_vars());
unset($__refs, $__v);
/* Unset defined __refs, __v. */
/**/
return;
/* Return for uniformity. */
}
示例13: _admin_user_new_fields
/**
* Callback adds Custom Fields to `/wp-admin/user-new.php`.
*
* We have to buffer because `/user-new.php` has NO Hooks.
*
* @package s2Member\New_Users
* @since 3.5
*
* @attaches-to ``ob_start("c_ws_plugin__s2member_user_new_in::_admin_user_new_fields");``
*
* @return string Output buffer.
*/
public static function _admin_user_new_fields($buffer = FALSE)
{
global $pagenow;
// The current admin page file name.
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("_ws_plugin__s2member_before_admin_user_new_fields", get_defined_vars());
unset($__refs, $__v);
if (is_blog_admin() && $pagenow === "user-new.php" && current_user_can("create_users")) {
$_p = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST));
$unfs = '<div style="margin:25px 0 25px 0; height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
$unfs .= '<h3 style="position:relative;"><img src="' . esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]) . '/images/large-icon.png" title="s2Member (a Membership management system for WordPress)" alt="" style="position:absolute; top:-15px; right:0; border:0;" />s2Member Configuration & Profile Fields' . (is_multisite() ? ' (for this Blog)' : '') . '</h3>' . "\n";
$unfs .= '<table class="form-table">' . "\n";
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("_ws_plugin__s2member_during_admin_user_new_fields_before", get_defined_vars());
unset($__refs, $__v);
if (is_multisite()) {
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("_ws_plugin__s2member_during_admin_user_new_fields_before_first_name", get_defined_vars());
unset($__refs, $__v);
$unfs .= '<tr>' . "\n";
$unfs .= '<th><label for="ws-plugin--s2member-user-new-first-name">First Name:</label></th>' . "\n";
$unfs .= '<td><input type="text" autocomplete="off" name="ws_plugin__s2member_user_new_first_name" id="ws-plugin--s2member-user-new-first-name" value="' . esc_attr($_p["ws_plugin__s2member_user_new_first_name"]) . '" class="regular-text" /></td>' . "\n";
$unfs .= '</tr>' . "\n";
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("_ws_plugin__s2member_during_admin_user_new_fields_after_first_name", get_defined_vars());
unset($__refs, $__v);
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("_ws_plugin__s2member_during_admin_user_new_fields_before_last_name", get_defined_vars());
unset($__refs, $__v);
$unfs .= '<tr>' . "\n";
$unfs .= '<th><label for="ws-plugin--s2member-user-new-last-name">Last Name:</label></th>' . "\n";
$unfs .= '<td><input type="text" autocomplete="off" name="ws_plugin__s2member_user_new_last_name" id="ws-plugin--s2member-user-new-last-name" value="' . esc_attr($_p["ws_plugin__s2member_user_new_last_name"]) . '" class="regular-text" /></td>' . "\n";
$unfs .= '</tr>' . "\n";
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("_ws_plugin__s2member_during_admin_user_new_fields_after_last_name", get_defined_vars());
unset($__refs, $__v);
}
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("_ws_plugin__s2member_during_admin_user_new_fields_before_subscr_gateway", get_defined_vars());
unset($__refs, $__v);
$unfs .= '<tr>' . "\n";
$unfs .= '<th><label for="ws-plugin--s2member-user-new-s2member-subscr-gateway">Paid Subscr. Gateway:</label> <a href="#" onclick="alert(\'A Payment Gateway code is associated with the Paid Subscr. ID below. A Paid Subscription ID (or a Buy Now Transaction ID) is only valid for paid Members. Also known as (a Recurring Profile ID, a ClickBank Receipt #, a Google Order ID, an AliPay Trade No.). Under normal circumstances, this is filled automatically by s2Member. This field is ONLY here for Customer Service purposes; just in case you ever need to enter a Paid Subscr. Gateway/ID manually. This field will be empty for Free Subscribers, and/or anyone who is NOT paying you.\\n\\nThe value of Paid Subscr. ID, can be a PayPal Standard `Subscription ID`, or a PayPal Pro `Recurring Profile ID`, or a PayPal `Transaction ID`; depending on the type of sale. Your PayPal account will supply this information. If you\\\'re using Google Wallet, use the Google Order ID. ClickBank provides a Receipt #, ccBill provides a Subscription ID, Authorize.Net provides a Subscription ID, and AliPay provides a Transaction ID. The general rule is... IF there\\\'s a Subscription ID, use that! If there\\\'s NOT, use the Transaction ID.\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
$unfs .= '<td><select name="ws_plugin__s2member_user_new_s2member_subscr_gateway" id="ws-plugin--s2member-user-new-s2member-subscr-gateway" style="width:25em;"><option value=""></option>' . "\n";
foreach (apply_filters("ws_plugin__s2member_profile_s2member_subscr_gateways", array("paypal" => "PayPal (code: paypal)"), get_defined_vars()) as $gateway => $gateway_name) {
$unfs .= '<option value="' . esc_attr($gateway) . '"' . ($gateway === $_p["ws_plugin__s2member_user_new_s2member_subscr_gateway"] ? ' selected="selected"' : '') . '>' . esc_html($gateway_name) . '</option>' . "\n";
}
$unfs .= '</select>' . "\n";
$unfs .= '</td>' . "\n";
$unfs .= '</tr>' . "\n";
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("_ws_plugin__s2member_during_admin_user_new_fields_after_subscr_gateway", get_defined_vars());
unset($__refs, $__v);
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("_ws_plugin__s2member_during_admin_user_new_fields_before_subscr_id", get_defined_vars());
unset($__refs, $__v);
$unfs .= '<tr>' . "\n";
$unfs .= '<th><label for="ws-plugin--s2member-user-new-s2member-subscr-id">Paid Subscr. ID:</label> <a href="#" onclick="alert(\'A Paid Subscription ID (or a Buy Now Transaction ID) is only valid for paid Members. Also known as (a Recurring Profile ID, a ClickBank Receipt #, a Google Order ID, an AliPay Trade No.). Under normal circumstances, this is filled automatically by s2Member. This field is ONLY here for Customer Service purposes; just in case you ever need to enter a Paid Subscr. Gateway/ID manually. This field will be empty for Free Subscribers, and/or anyone who is NOT paying you.\\n\\nThe value of Paid Subscr. ID, can be a PayPal Standard `Subscription ID`, or a PayPal Pro `Recurring Profile ID`, or a PayPal `Transaction ID`; depending on the type of sale. Your PayPal account will supply this information. If you\\\'re using Google Wallet, use the Google Order ID. ClickBank provides a Receipt #, ccBill provides a Subscription ID, Authorize.Net provides a Subscription ID, and AliPay provides a Transaction ID. The general rule is... if there\\\'s a Subscription ID, use that! If there\\\'s NOT, use the Transaction ID.\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
$unfs .= '<td><input type="text" autocomplete="off" name="ws_plugin__s2member_user_new_s2member_subscr_id" id="ws-plugin--s2member-user-new-s2member-subscr-id" value="' . format_to_edit($_p["ws_plugin__s2member_user_new_s2member_subscr_id"]) . '" class="regular-text" /></td>' . "\n";
$unfs .= '</tr>' . "\n";
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("_ws_plugin__s2member_during_admin_user_new_fields_after_subscr_id", get_defined_vars());
unset($__refs, $__v);
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("_ws_plugin__s2member_during_admin_user_new_fields_before_custom", get_defined_vars());
unset($__refs, $__v);
$unfs .= '<tr>' . "\n";
//.........这里部分代码省略.........
示例14: wp_dashboard_primary
/**
* WordPress News dashboard widget.
*
* @since 2.7.0
*/
function wp_dashboard_primary()
{
$feeds = array('news' => array('link' => apply_filters('dashboard_primary_link', __('https://wordpress.org/news/')), 'url' => apply_filters('dashboard_primary_feed', __('http://wordpress.org/news/feed/')), 'title' => apply_filters('dashboard_primary_title', __('WordPress Blog')), 'items' => 1, 'show_summary' => 1, 'show_author' => 0, 'show_date' => 1), 'planet' => array('link' => apply_filters('dashboard_secondary_link', __('https://planet.wordpress.org/')), 'url' => apply_filters('dashboard_secondary_feed', __('https://planet.wordpress.org/feed/')), 'title' => apply_filters('dashboard_secondary_title', __('Other WordPress News')), 'items' => apply_filters('dashboard_secondary_items', 3), 'show_summary' => 0, 'show_author' => 0, 'show_date' => 0));
if (!is_multisite() && is_blog_admin() && current_user_can('install_plugins') || is_network_admin() && current_user_can('manage_network_plugins') && current_user_can('install_plugins')) {
$feeds['plugins'] = array('link' => '', 'url' => array('popular' => 'http://wordpress.org/plugins/rss/browse/popular/'), 'title' => '', 'items' => 1, 'show_summary' => 0, 'show_author' => 0, 'show_date' => 0);
}
wp_dashboard_cached_rss_widget('dashboard_primary', 'wp_dashboard_primary_output', $feeds);
}
示例15: wp_add_dashboard_widget
function wp_add_dashboard_widget($widget_id, $widget_name, $callback, $control_callback = null)
{
$screen = get_current_screen();
global $wp_dashboard_control_callbacks;
if ($control_callback && current_user_can('edit_dashboard') && is_callable($control_callback)) {
$wp_dashboard_control_callbacks[$widget_id] = $control_callback;
if (isset($_GET['edit']) && $widget_id == $_GET['edit']) {
list($url) = explode('#', add_query_arg('edit', false), 2);
$widget_name .= ' <span class="postbox-title-action"><a href="' . esc_url($url) . '">' . __('Cancel') . '</a></span>';
$callback = '_wp_dashboard_control_callback';
} else {
list($url) = explode('#', add_query_arg('edit', $widget_id), 2);
$widget_name .= ' <span class="postbox-title-action"><a href="' . esc_url("{$url}#{$widget_id}") . '" class="edit-box open-box">' . __('Configure') . '</a></span>';
}
}
if (is_blog_admin()) {
$side_widgets = array('dashboard_quick_press', 'dashboard_recent_drafts', 'dashboard_primary', 'dashboard_secondary');
} else {
if (is_network_admin()) {
$side_widgets = array('dashboard_primary', 'dashboard_secondary');
} else {
$side_widgets = array();
}
}
$location = 'normal';
if (in_array($widget_id, $side_widgets)) {
$location = 'side';
}
$priority = 'core';
if ('dashboard_browser_nag' === $widget_id) {
$priority = 'high';
}
add_meta_box($widget_id, $widget_name, $callback, $screen->id, $location, $priority);
}