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


PHP WP_Admin_Bar类代码示例

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


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

示例1: siteorigin_panels_lite_admin_bar_menu

/**
 * Add the Edit Home Page item to the admin bar.
 *
 * @param WP_Admin_Bar $admin_bar
 * @return WP_Admin_Bar
 */
function siteorigin_panels_lite_admin_bar_menu($admin_bar)
{
    if (is_front_page() && current_user_can('edit_theme_options') && !is_page()) {
        $admin_bar->add_node(array('id' => 'edit-home-page', 'title' => __('Edit Home Page', 'clearly'), 'href' => admin_url('themes.php?page=so_panels_home_page')));
    }
    return $admin_bar;
}
开发者ID:GvarimAZA,项目名称:website,代码行数:13,代码来源:panels-lite.php

示例2: admin_bar_ip

/**
 * @param  WP_Admin_Bar  $wp_admin_bar
 */
function admin_bar_ip($wp_admin_bar)
{
    if (!current_user_can('manage_options')) {
        return;
    }
    $wp_admin_bar->add_node(['id' => 'wp-ip', 'title' => sprintf(__('Currently located at <b>%s</b>'), $_SERVER['SERVER_ADDR']), 'parent' => 'top-secondary']);
}
开发者ID:asmbs,项目名称:wp-ip,代码行数:10,代码来源:wp-ip.php

示例3: admin_bar_menu

 /**
  * Add a "Flush Cache" button the admin menu
  * @param WP_Admin_Bar $admin_bar
  * @return void
  */
 public function admin_bar_menu($admin_bar)
 {
     global $gd_system_config;
     $config = $gd_system_config->get_config();
     $gateway_url = isset($config['gateway_url']) ? $config['gateway_url'] : '';
     // Only show to admin users
     if (!current_user_can('activate_plugins')) {
         return;
     }
     switch (true) {
         case gd_is_mt():
             $top_menu_label = __('Media Temple', 'gd_system');
             $top_menu_icon_class = 'media-temple';
             break;
         case gd_is_reseller():
             $top_menu_label = __('Managed WordPress', 'gd_system');
             $top_menu_icon_class = 'admin-generic';
             break;
         default:
             $top_menu_label = __('GoDaddy', 'gd_system');
             $top_menu_icon_class = 'godaddy-alt';
             break;
     }
     $admin_bar->add_menu(['id' => static::ADMIN_MENU_SLUG, 'title' => sprintf('<span class="ab-icon dashicons dashicons-%s"></span><span class="ab-label">%s</span>', $top_menu_icon_class, $top_menu_label)]);
     // Settings menu
     $admin_bar->add_menu(['parent' => static::ADMIN_MENU_SLUG, 'id' => static::ADMIN_MENU_SLUG . '-control-panel', 'title' => sprintf('%s<span class="dashicons dashicons-external"></span>', __('Account Settings', 'gd_system')), 'href' => str_replace('%pl_id%', defined('GD_RESELLER') ? GD_RESELLER : '', $gateway_url), 'meta' => array('target' => '_blank')]);
     // Flush cache menu
     $admin_bar->add_menu(['parent' => static::ADMIN_MENU_SLUG, 'id' => static::ADMIN_MENU_SLUG . '-flush-cache', 'title' => __('Flush Cache', 'gd_system'), 'href' => esc_url(add_query_arg(['GD_COMMAND' => 'FLUSH_CACHE', 'GD_NONCE' => wp_create_nonce('GD_FLUSH_CACHE')]))]);
 }
开发者ID:fritzdenim,项目名称:pangMoves,代码行数:34,代码来源:class-gd-system-plugin-admin-menu.php

示例4: admin_bar

 /**
  * Admin bar
  *
  * @param WP_Admin_Bar $wp_admin_bar
  */
 public function admin_bar($wp_admin_bar)
 {
     if (!current_user_can('manage_options')) {
         return;
     }
     $wp_admin_bar->add_menu(array('id' => 'example-plugin', 'title' => __('Process', 'example-plugin'), 'href' => '#'));
     $wp_admin_bar->add_menu(array('parent' => 'example-plugin', 'id' => 'example-plugin-single', 'title' => __('Single User', 'example-plugin'), 'href' => wp_nonce_url(admin_url('?process=single'), 'process')));
     $wp_admin_bar->add_menu(array('parent' => 'example-plugin', 'id' => 'example-plugin-all', 'title' => __('All Users', 'example-plugin'), 'href' => wp_nonce_url(admin_url('?process=all'), 'process')));
 }
开发者ID:A5hleyRich,项目名称:wp-background-processing-example,代码行数:14,代码来源:example-plugin.php

示例5: array

 /**
  * Add status menu to the admin bar.
  *
  * Ideally, each status comes with an action to take. The action requires
  * permission. Also ideally, this just hooks into a LivePress status API.
  *
  * @author tddewey
  *
  * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar object.
  *
  * @return void
  */
 function admin_bar_menu($wp_admin_bar)
 {
     if (!current_user_can('manage_options') || !is_admin()) {
         return;
     }
     $class = 'livepress-status-menu';
     $status = self::get_status();
     $wp_admin_bar->add_menu(array('id' => 'livepress-status', 'title' => '<span class="ab-icon"></span><span class="ab-label">' . esc_html__('LivePress', 'livepress') . '</span>', 'href' => '', 'sticky' => true, 'meta' => array('title' => 'connected' == $status ? esc_html__('LivePress connected.', 'livepress') : esc_html__('LivePress connection error.', 'livepress'), 'class' => $class . ' ' . $status)));
 }
开发者ID:humanmade,项目名称:vip-mu-plugins-public,代码行数:21,代码来源:livepress-admin-bar-status-menu.php

示例6: mss_admin_bar_menu

/**
 * Add search field menu item
 *
 * @param WP_Admin_Bar $wp_admin_bar
 * @return void
 */
function mss_admin_bar_menu($wp_admin_bar)
{
    $total_users_sites = count($wp_admin_bar->user->blogs);
    $show_if_gt = apply_filters('mms_show_search_minimum_sites', 10);
    if (!is_user_logged_in() || $total_users_sites < $show_if_gt) {
        return;
    }
    $wp_admin_bar->add_menu(array('parent' => 'my-sites-list', 'id' => 'my-sites-search', 'title' => sprintf('<label for="my-sites-search-text">%s</label><input type="text" id="my-sites-search-text" placeholder="%s" />', esc_html__('Filter My Sites', 'mss'), esc_attr__('Search Sites', 'mss')), 'meta' => array('class' => 'hide-if-no-js')));
}
开发者ID:trepmal,项目名称:my-sites-search,代码行数:15,代码来源:my-sites-search.php

示例7: replace_site_name

 /**
  * Replaces the current site's name with the site's alternative language title, if not empty.
  *
  * @param WP_Admin_Bar $wp_admin_bar
  *
  * @return WP_Admin_Bar
  */
 public function replace_site_name(WP_Admin_Bar $wp_admin_bar)
 {
     $title = $this->get_title();
     if (!$title) {
         return $wp_admin_bar;
     }
     $wp_admin_bar->add_node(array('id' => 'site-name', 'title' => $title));
     return $wp_admin_bar;
 }
开发者ID:luisarn,项目名称:multilingual-press,代码行数:16,代码来源:Mlp_Admin_Bar_Customizer.php

示例8: action_admin_bar_menu

 public function action_admin_bar_menu(WP_Admin_Bar $wp_admin_bar)
 {
     if (!$this->user_can_view()) {
         return;
     }
     $title = __('Query Monitor', 'query-monitor');
     $wp_admin_bar->add_menu(array('id' => 'query-monitor', 'title' => esc_html($title), 'href' => '#qm-overview', 'meta' => array('classname' => 'hide-if-js')));
     $wp_admin_bar->add_menu(array('parent' => 'query-monitor', 'id' => 'query-monitor-placeholder', 'title' => esc_html($title), 'href' => '#qm-overview'));
 }
开发者ID:L0k1slnk,项目名称:weddly,代码行数:9,代码来源:Html.php

示例9: action_admin_bar_menu

 public function action_admin_bar_menu(WP_Admin_Bar $wp_admin_bar)
 {
     if (!$this->qm->user_can_view()) {
         return;
     }
     $class = implode(' ', array('hide-if-js', QM_Util::wpv()));
     $title = __('Query Monitor', 'query-monitor');
     $wp_admin_bar->add_menu(array('id' => 'query-monitor', 'title' => $title, 'href' => '#qm-overview', 'meta' => array('classname' => $class)));
     $wp_admin_bar->add_menu(array('parent' => 'query-monitor', 'id' => 'query-monitor-placeholder', 'title' => $title, 'href' => '#qm-overview'));
 }
开发者ID:jeanpage,项目名称:ca_learn,代码行数:10,代码来源:Html.php

示例10: test_merging_existing_meta_values

 /**
  * @ticket 21117
  */
 function test_merging_existing_meta_values()
 {
     $admin_bar = new WP_Admin_Bar();
     $admin_bar->add_node(array('id' => 'test-node', 'meta' => array('class' => 'test-class')));
     $node = $admin_bar->get_node('test-node');
     $this->assertEquals(array('class' => 'test-class'), $node->meta);
     $admin_bar->add_node(array('id' => 'test-node', 'meta' => array('some-meta' => 'value')));
     $node = $admin_bar->get_node('test-node');
     $this->assertEquals(array('class' => 'test-class', 'some-meta' => 'value'), $node->meta);
 }
开发者ID:boonebgorges,项目名称:wp,代码行数:13,代码来源:adminbar.php

示例11: test_merging_existing_meta_values

 /**
  * @ticket 21117
  */
 function test_merging_existing_meta_values()
 {
     wp_set_current_user(self::$editor_id);
     $admin_bar = new WP_Admin_Bar();
     $admin_bar->add_node(array('id' => 'test-node', 'meta' => array('class' => 'test-class')));
     $node1 = $admin_bar->get_node('test-node');
     $this->assertEquals(array('class' => 'test-class'), $node1->meta);
     $admin_bar->add_node(array('id' => 'test-node', 'meta' => array('some-meta' => 'value')));
     $node2 = $admin_bar->get_node('test-node');
     $this->assertEquals(array('class' => 'test-class', 'some-meta' => 'value'), $node2->meta);
 }
开发者ID:boonebgorges,项目名称:develop.wordpress,代码行数:14,代码来源:adminbar.php

示例12: admin_bar_menu

 /**
  * @hook
  *
  * @priority 999
  */
 public function admin_bar_menu(\WP_Admin_Bar $wp_admin_bar)
 {
     if (empty($this->nodes)) {
         return;
     }
     foreach ($this->nodes as $id => $args) {
         if (call_user_func($args['display_cb'])) {
             $wp_admin_bar->add_node($args);
         }
     }
 }
开发者ID:ssnepenthe,项目名称:metis,代码行数:16,代码来源:Toolbar.php

示例13: test_merging_existing_meta_values

 /**
  * @ticket 21117
  */
 function test_merging_existing_meta_values()
 {
     wp_set_current_user($this->factory->user->create(array('role' => 'editor')));
     $admin_bar = new WP_Admin_Bar();
     $admin_bar->add_node(array('id' => 'test-node', 'meta' => array('class' => 'test-class')));
     $node = $admin_bar->get_node('test-node');
     $this->assertEquals(array('class' => 'test-class'), $node->meta);
     $admin_bar->add_node(array('id' => 'test-node', 'meta' => array('some-meta' => 'value')));
     $node = $admin_bar->get_node('test-node');
     $this->assertEquals(array('class' => 'test-class', 'some-meta' => 'value'), $node->meta);
 }
开发者ID:plis197715,项目名称:wordpress-develop,代码行数:14,代码来源:adminbar.php

示例14: wl_admin_bar

/**
 * Adds WordLift to the Admin bar.
 * @param WP_Admin_Bar $wp_admin_bar The existing admin bar.
 */
function wl_admin_bar($wp_admin_bar)
{
    if (!is_super_admin() || !is_admin_bar_showing()) {
        return;
    }
    $defaults = array('href' => false, 'parent' => false, 'id' => 'wordlift', 'title' => '');
    $wp_admin_bar->add_menu($defaults);
    // Add a link to the WordLift settings page.
    $wp_admin_bar->add_menu(array('parent' => 'wordlift', 'id' => 'wordlift-settings', 'title' => 'Settings', 'href' => get_admin_url(null, 'admin.php?page=wl_configuration_admin_menu')));
    // Add a link to the WordLift web site.
    $wp_admin_bar->add_menu(array('parent' => 'wordlift', 'id' => 'wordlift-about', 'title' => 'About WordLift', 'href' => 'http://wordlift.it'));
}
开发者ID:efueger,项目名称:wordlift-plugin,代码行数:16,代码来源:wordlift_admin_bar.php

示例15: admin_network_menu_bar

 /**
  * Adds 'Duplicate' entry to network admin-bar
  * @since 0.2.0
  * @param  WP_Admin_Bar $wp_admin_bar
  */
 public static function admin_network_menu_bar($wp_admin_bar)
 {
     if (current_user_can('manage_sites')) {
         $wp_admin_bar->add_menu(array('parent' => 'network-admin', 'id' => 'network-admin-duplicate', 'title' => MUCD_NETWORK_MENU_DUPLICATION, 'href' => network_admin_url('sites.php?page=' . MUCD_SLUG_NETWORK_ACTION)));
         foreach ((array) $wp_admin_bar->user->blogs as $blog) {
             if (MUCD_Functions::is_duplicable($blog->userblog_id)) {
                 $menu_id = 'blog-' . $blog->userblog_id;
                 $wp_admin_bar->add_menu(array('parent' => $menu_id, 'id' => $menu_id . '-duplicate', 'title' => MUCD_NETWORK_MENU_DUPLICATE, 'href' => network_admin_url('sites.php?page=' . MUCD_SLUG_NETWORK_ACTION . '&amp;id=' . $blog->userblog_id)));
             }
         }
     }
 }
开发者ID:pmatheus,项目名称:participacao-sitebase,代码行数:17,代码来源:admin.php


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