当前位置: 首页>>代码示例>>PHP>>正文


PHP is_super_admin函数代码示例

本文整理汇总了PHP中is_super_admin函数的典型用法代码示例。如果您正苦于以下问题:PHP is_super_admin函数的具体用法?PHP is_super_admin怎么用?PHP is_super_admin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了is_super_admin函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: update_notifier_bar_menu

function update_notifier_bar_menu()
{
    if (function_exists('simplexml_load_string')) {
        // Stop if simplexml_load_string funtion isn't available
        global $wp_admin_bar, $wpdb;
        if (!is_super_admin() || !is_admin_bar_showing()) {
            // Don't display notification in admin bar if it's disabled or the current user isn't an administrator
            return;
        }
        $xml = get_latest_theme_version(NOTIFIER_CACHE_INTERVAL);
        // Get the latest remote XML file on our server
        // get version
        if (function_exists('wp_get_theme')) {
            $theme_data = wp_get_theme(get_template());
            $version = $theme_data->version;
        } else {
            $theme_data = get_theme_data(get_template_directory() . '/style.css');
            $version = $theme_data['Version'];
        }
        if (!is_object($xml)) {
            return;
        }
        if (version_compare($xml->latest, $version, '>')) {
            // Compare current theme version with the remote XML version
            $wp_admin_bar->add_menu(array('id' => 'update_notifier', 'title' => '<span>' . NOTIFIER_THEME_NAME . ' <span id="ab-updates">1 Update</span></span>', 'href' => get_admin_url() . 'index.php?page=theme-update-notifier'));
        }
    }
}
开发者ID:GaryJones,项目名称:goombiel,代码行数:28,代码来源:update-notifier.php

示例2: setup_nav

 /**
  * Setup BuddyBar navigation
  */
 function setup_nav()
 {
     // Define local variable
     $sub_nav = array();
     // Add the settings navigation item
     $main_nav = array('name' => __('Settings', 'buddypress'), 'slug' => $this->slug, 'position' => 100, 'show_for_displayed_user' => bp_core_can_edit_settings(), 'screen_function' => 'bp_settings_screen_general', 'default_subnav_slug' => 'general');
     // Determine user to use
     if (bp_displayed_user_domain()) {
         $user_domain = bp_displayed_user_domain();
     } elseif (bp_loggedin_user_domain()) {
         $user_domain = bp_loggedin_user_domain();
     } else {
         return;
     }
     $settings_link = trailingslashit($user_domain . $this->slug);
     // Add General Settings nav item
     $sub_nav[] = array('name' => __('General', 'buddypress'), 'slug' => 'general', 'parent_url' => $settings_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_settings_screen_general', 'position' => 10, 'user_has_access' => bp_core_can_edit_settings());
     // Add Notifications nav item
     $sub_nav[] = array('name' => __('Notifications', 'buddypress'), 'slug' => 'notifications', 'parent_url' => $settings_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_settings_screen_notification', 'position' => 20, 'user_has_access' => bp_core_can_edit_settings());
     // Add Spam Account nav item
     if (bp_current_user_can('bp_moderate')) {
         $sub_nav[] = array('name' => __('Capabilities', 'buddypress'), 'slug' => 'capabilities', 'parent_url' => $settings_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_settings_screen_capabilities', 'position' => 80, 'user_has_access' => !bp_is_my_profile());
     }
     // Add Delete Account nav item
     if (!bp_disable_account_deletion() || bp_current_user_can('delete_users')) {
         $sub_nav[] = array('name' => __('Delete Account', 'buddypress'), 'slug' => 'delete-account', 'parent_url' => $settings_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_settings_screen_delete_account', 'position' => 90, 'user_has_access' => bp_is_my_profile() || !is_super_admin(bp_displayed_user_id()));
     }
     parent::setup_nav($main_nav, $sub_nav);
 }
开发者ID:adisonc,项目名称:MaineLearning,代码行数:32,代码来源:bp-settings-loader.php

示例3: build

 /**
  * Builds the composite and returns button markup.
  * @return string
  */
 public function build()
 {
     $environment = $this->builder->getEnvironment();
     $dispatcher = $environment->getDispatcher();
     $this->project = $dispatcher->apply('before_build', array($this->project));
     if ((!array_key_exists('action', $_GET) || $_GET['action'] !== 'getPreviewHtml') && $this->project->isShowOnPosts() && !$this->project->isShowAt('popup')) {
         $current = get_post();
         if ($current === null) {
             return '';
         }
         if (!$this->project->isShortCodeShow() && $current->post_type === 'post' && (!$this->project->isShowOnAllPosts() && !$this->project->isShowOnSpecificPost($current->ID)) && !$this->project->showOnSpecificPostType($current->post_type) && !$this->project->isShowOnAllPostTypes()) {
             return '';
         }
         if ($current->post_type === 'page' && (!$this->project->isShowOnAllPages() && !$this->project->isShowOnSpecificPost($current->ID)) && !$this->project->showOnSpecificPostType($current->post_type) && !$this->project->isShowOnAllPostTypes()) {
             return '';
         }
         if (!$this->project->isShowOnAllPosts() && !$this->project->isShowOnAllPages() && !in_array($current->post_type, array('post', 'page'), false) && !$this->project->showOnSpecificPostType($current->post_type) && !$this->project->isShowOnAllPostTypes()) {
             return '';
         }
     }
     if (!$this->project->isShortCodeShow() && !$this->project->isPopupShow() && $this->project->isShowOnHomepage() && !$this->builder->isHomepage()) {
         return '';
     }
     try {
         $composite = $this->builder->getComposite();
     } catch (Exception $e) {
         if (defined('WP_DEBUG') && WP_DEBUG && (function_exists('is_super_admin') && is_super_admin())) {
             return sprintf($this->environment->translate('Failed to build the project: %s.'), $e->getMessage());
         }
         return '';
     }
     $this->project = $dispatcher->apply('after_build', array($this->project));
     $dispatcher->dispatch('before_html_build');
     return $composite->build();
 }
开发者ID:conceptorobledo,项目名称:ecoh,代码行数:39,代码来源:Handler.php

示例4: onepager_enqueue_scripts

function onepager_enqueue_scripts()
{
    if (!onepager()->content()->isOnepage()) {
        return;
    }
    $asset = onepager()->asset();
    // TX namespaced assets to avoid multiple assets loading from other ThemeXpert product
    $asset->style('bootstrap', asset('assets/css/bootstrap.css'));
    $asset->style('animatecss', asset('assets/css/animate.css'));
    $asset->style('fontawesome', asset('assets/css/font-awesome.css'));
    $asset->script('bootstrap', asset('assets/js/bootstrap.js'), ['jquery']);
    $asset->script('wow', asset('assets/js/wow.js'), array('jquery'));
    $asset->script('nicescroll', asset('assets/js/jquery.nicescroll.js'), array('jquery'));
    $asset->script('lithium', asset('assets/lithium.js'), array('jquery'));
    $asset->style('lithium', asset('assets/css/lithium.css'));
    if (onepager()->content()->isBuildMode()) {
        if (function_exists('wp_enqueue_media')) {
            wp_enqueue_media();
            js_wp_editor();
        }
        $asset->style('tx-colorpicker', asset("assets/css/bootstrap-colorpicker.css"));
        $asset->script('tx-bootstrap-select', asset('assets/js/bootstrap-select.js'), ['jquery']);
        $asset->script('tx-iconselector', asset('assets/js/icon-selector-bootstrap.js'), ['jquery']);
        $asset->script('tx-colorpicker', asset('assets/js/bootstrap-colorpicker.js'), ['jquery']);
        $asset->script('tx-bootstrap-switch', asset('assets/js/bootstrap-switch.js'), ['jquery']);
        $asset->script('tx-toastr', asset('assets/js/toastr.js'), ['jquery']);
        $asset->script('onepager', asset('assets/app.bundle.js'), ['jquery']);
        $asset->localizeScript('onepager', onepager_localize_script_data(onepager()->content()->getCurrentPageId()), 'onepager');
    }
    if (is_super_admin()) {
        $asset->style('lithium-ui', asset('assets/css/lithium-builder.css'));
    }
}
开发者ID:elolli,项目名称:DreamItReelProductions-Website,代码行数:33,代码来源:assets.php

示例5: menus

 /**
  * menus()
  *
  * Adds menus to admin area
  */
 function menus()
 {
     if (!is_super_admin()) {
         return;
     }
     add_options_page(__('Courseware Options', 'bpsp'), __('Courseware', 'bpsp'), 'manage_options', 'bp-courseware', array(__CLASS__, "screen"));
 }
开发者ID:adisonc,项目名称:MaineLearning,代码行数:12,代码来源:wordpress.class.php

示例6: can_user

 public static function can_user($capability)
 {
     if (!function_exists('members_check_for_cap')) {
         return current_user_can('manage_options') || is_super_admin();
     }
     return current_user_can($capability);
 }
开发者ID:danaiser,项目名称:hollandLawns,代码行数:7,代码来源:capabilities.php

示例7: __construct

 /**
  * Build The Layout
  */
 function __construct($args = array(), PL_Platform $platform)
 {
     $this->platform = $platform;
     $defaults = array('title' => '', 'callback' => false, 'page_slug' => '', 'config' => array(), 'render' => 'settings');
     $this->set = wp_parse_args($args, $defaults);
     /** Gets the control array */
     $this->config = isset($this->set['callback']) && $this->set['callback'] ? call_user_func($this->set['callback']) : $this->set['config'];
     $this->current_tab_slug = isset($_GET['sel_tab']) ? $_GET['sel_tab'] : 'default';
     $this->settings_tab_slug = isset($_GET['settings_tab']) ? $_GET['settings_tab'] : 'default';
     $tab_default = array('title' => '', 'groups' => false, 'mode' => 'banner');
     $current_tab_info = isset($this->config[$this->current_tab_slug]) ? $this->config[$this->current_tab_slug] : current($this->config);
     $this->current_tab_config = wp_parse_args($current_tab_info, $tab_default);
     $this->current_page = $this->platform->tab();
     // Draw the thing
     $this->build_header();
     // if not logged in and user is a super admin.. show banner to connect account
     if ('account' == $this->current_page && !$this->platform->oauth->is_connected() && is_super_admin()) {
         $this->platform_banner();
     } elseif (has_action('pl_ui_build_body')) {
         do_action('pl_ui_build_body', $this);
     } else {
         $this->build_body();
     }
     $this->build_footer();
 }
开发者ID:voomco,项目名称:WordPress,代码行数:28,代码来源:ui.php

示例8: maybe_display_activation_notice

 /**
  * Display an admin notice, if the Features by WooThemes plugin is present and not activated, or not present.
  * @access  public
  * @since   1.2.1
  * @return  void
  */
 public function maybe_display_activation_notice()
 {
     if ($this->_is_features_plugin_activated()) {
         return;
     }
     if (!current_user_can('manage_options')) {
         return;
     }
     // Don't show the message if the user isn't an administrator.
     if (is_multisite() && !is_super_admin()) {
         return;
     }
     // Don't show the message if on a multisite and the user isn't a super user.
     if (true == get_option('icons_for_features_dismiss_activation_notice', false)) {
         return;
     }
     // Don't show the message if the user dismissed it.
     $slug = 'features-by-woothemes';
     $install_url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . $slug), 'install-plugin_' . $slug);
     $activate_url = 'plugins.php?action=activate&plugin=' . urlencode('features-by-woothemes/woothemes-features.php') . '&plugin_status=all&paged=1&s&_wpnonce=' . urlencode(wp_create_nonce('activate-plugin_features-by-woothemes/woothemes-features.php'));
     if (true == $this->_is_features_plugin_installed()) {
         $text = '<a href="' . esc_url($activate_url) . '">' . __('Activate the Features by WooThemes plugin', 'icons-for-features') . '</a>';
     } else {
         $text = '<a href="' . esc_url($install_url) . '">' . __('Install the Features by WooThemes plugin', 'icons-for-features') . '</a>';
     }
     $text = sprintf(__('%sIcons for Features%s is almost ready. %s to get started.', 'icons-for-features'), '<strong>', '</strong>', $text);
     $dismiss_url = add_query_arg('action', 'icons-for-features-dismiss', add_query_arg('nonce', wp_create_nonce('icons-for-features-dismiss')));
     echo '<div class="updated fade"><p class="alignleft">' . $text . '</p><p class="alignright"><a href="' . esc_url($dismiss_url) . '">' . __('Dismiss', 'icons-for-features') . '</a></p><div class="clear"></div></div>' . "\n";
 }
开发者ID:reisizer,项目名称:icons-for-features,代码行数:35,代码来源:class-icons-for-features-admin.php

示例9: catch_submit

	function catch_submit() {
		if ( isset( $_POST['add_ids'] ) ) {
			$redirect    = 'user-new.php';
			foreach( (array)$_POST['add_ids'] as $user_id ) {
				if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) {
					add_existing_user_to_blog( array( 'user_id' => $user_id, 'role' => $_REQUEST[ 'role' ] ) );
					$users_added[] = (int)$user_id;
				} else {
					$user_details = get_userdata( $user_id );
					$newuser_key = substr( md5( $user_id ), 0, 5 );
					add_option( 'new_user_' . $newuser_key, array( 'user_id' => $user_id, 'email' => $user_details->user_email, 'role' => $_REQUEST[ 'role' ] ) );
					$message = __("Hi,\n\nYou have been invited to join '%s' at\n%s as a %s.\nPlease click the following link to confirm the invite:\n%s\n");
					wp_mail( $user_details->user_email, sprintf( __( '[%s] Joining confirmation' ), get_option( 'blogname' ) ),  sprintf($message, get_option('blogname'), site_url(), $_REQUEST[ 'role' ], site_url("/newbloguser/$newuser_key/")));
					$users_invited[] = (int)$user_id;
				}
			}

			if ( !empty( $users_added ) ) {
				$redirect = add_query_arg( 'users_added', implode( ',', $users_added ), $redirect );
			}

			if ( !empty( $users_invited ) ) {
				$redirect = add_query_arg( 'users_invited', implode( ',', $users_invited ), $redirect );
			}

			unset( $_POST );
			wp_redirect( $redirect );
		}
	}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:29,代码来源:add-user-autocomplete.php

示例10: __construct

 /**
  * Initialize the plugin by loading admin scripts & styles and adding a
  * settings page and menu.
  *
  * @since     1.0.0
  */
 private function __construct()
 {
     /*
      * 
      * - Decomment following lines if the admin class should only be available for super admins
      */
     if (!is_super_admin()) {
         return;
     }
     /*
      * Call $plugin_slug from public plugin class.
      *
      *
      * - Rename "Custom_Post_Type_RSS_Feeds" to the name of your initial plugin class
      *
      */
     $plugin = Custom_Post_Type_RSS_Feeds::get_instance();
     $this->plugin_slug = $plugin->get_plugin_slug();
     // Load admin style sheet and JavaScript.
     //add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) );
     //add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
     // Add the options page and menu item.
     add_action('admin_menu', array($this, 'add_plugin_admin_menu'));
     // Add an action link pointing to the options page.
     $plugin_basename = dirname(dirname(plugin_basename(__FILE__))) . '/' . $this->plugin_slug . '.php';
     add_filter('plugin_action_links_' . $plugin_basename, array($this, 'add_action_links'));
 }
开发者ID:spacedmonkey,项目名称:custom-post-type-rss-feed,代码行数:33,代码来源:class-custom-post-type-rss-feed-admin.php

示例11: create_dwb_menu

function create_dwb_menu()
{
    if (is_super_admin()) {
        return;
    }
    global $wp_admin_bar;
    $current_user = wp_get_current_user();
    $userinfo = $wp_admin_bar->get_node('user-info');
    $userinfo->href = get_permalink(get_id_by_slug("members-dashboard"));
    $avatar = get_avatar($userinfo->ID, 64);
    $userinfo->title = $avatar . $current_user->last_name;
    $array = (array) $userinfo;
    $wp_admin_bar->add_menu($array);
    $logout = $wp_admin_bar->get_node('logout');
    $logout->href = wp_logout_url(get_permalink(get_id_by_slug("members-login")));
    $array = (array) $logout;
    $wp_admin_bar->add_menu($array);
    $sitename = $wp_admin_bar->get_node('site-name');
    $sitename->href = home_url();
    $array = (array) $sitename;
    $wp_admin_bar->add_menu($array);
    $my_account = $wp_admin_bar->get_node('my-account');
    $avatar = get_avatar($userinfo->ID, 28);
    $my_account->title = "Hello, {$current_user->last_name}" . $avatar;
    $array = (array) $my_account;
    $wp_admin_bar->add_menu($array);
    $wp_admin_bar->remove_node('edit-profile');
    $wp_admin_bar->remove_node('wp-logo');
    $wp_admin_bar->remove_node('dashboard');
}
开发者ID:ntnvu,项目名称:tcb_online,代码行数:30,代码来源:functions.php

示例12: prepare_items

 function prepare_items()
 {
     $orderby = 'domain';
     if (array_key_exists('orderby', $_REQUEST) && $_REQUEST['orderby'] != '') {
         $orderby = $_REQUEST['orderby'];
     }
     $order = 'asc';
     if (array_key_exists('order', $_REQUEST) && $_REQUEST['order'] != '') {
         $order = $_REQUEST['order'];
     }
     $domain = null;
     if (array_key_exists('s', $_REQUEST) && $_REQUEST['s'] != '') {
         $domain = "http://%" . $_REQUEST['s'] . "%";
     }
     $per_page = 25;
     $current_page = $this->get_pagenum();
     $offset = ($current_page - 1) * $per_page;
     $limit = $current_page * $per_page;
     $columns = $this->get_columns();
     $hidden = array();
     $sortable = $this->get_sortable_columns();
     $this->_column_headers = array($columns, $hidden, $sortable);
     if (is_super_admin()) {
         $data = Campaign::findAll($orderby, $order, $offset, $limit, $domain);
     } else {
         $user = wp_get_current_user();
         $data = Campaign::findAll($orderby, $order, $offset, $limit, $domain, $user->ID);
     }
     $total_items = $data->count;
     $this->items = $data->itens;
     $this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $per_page, 'total_pages' => ceil($total_items / $per_page)));
     return $this->items;
 }
开发者ID:cabelotaina,项目名称:redelivre,代码行数:33,代码来源:CampaignTable.php

示例13: wcj_shortcode

 /**
  * wcj_shortcode.
  */
 function wcj_shortcode($atts, $content, $shortcode)
 {
     // Init
     if (empty($atts)) {
         $atts = array();
     }
     $global_defaults = array('before' => '', 'after' => '', 'visibility' => '');
     $atts = array_merge($global_defaults, $atts);
     // Check if privileges are ok
     if ('admin' === $atts['visibility'] && !is_super_admin()) {
         return '';
     }
     // Add child class specific atts
     $atts = $this->add_extra_atts($atts);
     // Check for required atts
     if (false === ($atts = $this->init_atts($atts))) {
         return '';
     }
     // Run the shortcode function
     $shortcode_function = $shortcode;
     if ('' !== ($result = $this->{$shortcode_function}($atts, $content))) {
         return $atts['before'] . $result . $atts['after'];
     }
     return '';
 }
开发者ID:sawan34,项目名称:tanzi,代码行数:28,代码来源:class-wcj-shortcodes.php

示例14: beans_updater

/**
 * Retrieve product data from Beans REST API.
 *
 * Data are cached in a 24 hours transients and will be returned if found to avoid long loading time.
 *
 * @ignore
 */
function beans_updater($value)
{
    // Stop here if the current user is not a super admin user.
    if (!is_super_admin()) {
        return;
    }
    $data = get_site_transient('beans_updater');
    $theme = wp_get_theme('tm-beans');
    if (!$theme->exists()) {
        return $value;
    }
    $current_version = $theme->get('Version');
    // Query Beans REST API if the transient is expired.
    if (empty($data)) {
        $response = wp_remote_get('http://www.getbeans.io/rest-api/', array('sslverify' => false));
        // Retrieve data from the body and decode json format.
        $data = json_decode(wp_remote_retrieve_body($response), true);
        // Stop here if the is an error.
        if (is_wp_error($response) || isset($data['error'])) {
            // Set temporary transient.
            set_site_transient('beans_updater', array('version' => $current_version), 30 * MINUTE_IN_SECONDS);
            return $value;
        }
        set_site_transient('beans_updater', $data, 24 * HOUR_IN_SECONDS);
    }
    // Return data if Beans is not up to date.
    if (version_compare($current_version, beans_get('version', $data), '<')) {
        $value->response[$data['path']] = array('slug' => $data['slug'], 'name' => $data['name'], 'url' => $data['changelog_url'], 'package' => $data['download_url'], 'new_version' => $data['version'], 'tested' => $data['tested'], 'requires' => $data['requires']);
        return $value;
    }
    return $value;
}
开发者ID:smcmaverick,项目名称:Beans,代码行数:39,代码来源:updater.php

示例15: __construct

 function __construct($manager_obj)
 {
     if (!is_super_admin() && !current_user_can('restore_roles')) {
         wp_die(__('You do not have permission to restore roles.', 'capsman-enhanced'));
     }
     $this->cm = $manager_obj;
 }
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:7,代码来源:backup-handler.php


注:本文中的is_super_admin函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。