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


PHP object::add_node方法代码示例

本文整理汇总了PHP中object::add_node方法的典型用法代码示例。如果您正苦于以下问题:PHP object::add_node方法的具体用法?PHP object::add_node怎么用?PHP object::add_node使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在object的用法示例。


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

示例1:

 /**
  * Add a handy reminder to the toolbar.
  * @param  object $toolbar The toolbar
  * @return null
  */
 function toolbar_menu($toolbar)
 {
     if (!is_admin_bar_showing()) {
         return;
     }
     $toolbar->add_node(array('id' => 'is-dev-site', 'title' => 'Development Site', 'href' => site_url()));
 }
开发者ID:richardmountain,项目名称:wp_is_development,代码行数:12,代码来源:is-dev-site.php

示例2: admin_bar

 /**
  * Adds "WPForm" item to new-content admin bar menu item.
  *
  * @since 1.1.7.2
  * @param object $wp_admin_bar
  */
 public function admin_bar($wp_admin_bar)
 {
     if (!is_admin_bar_showing() || !current_user_can(apply_filters('wpforms_manage_cap', 'manage_options'))) {
         return;
     }
     $args = array('id' => 'wpform', 'title' => 'WPForm', 'href' => admin_url('admin.php?page=wpforms-builder'), 'parent' => 'new-content');
     $wp_admin_bar->add_node($args);
 }
开发者ID:benshez,项目名称:DreamWeddingCeremonies,代码行数:14,代码来源:class-form.php

示例3: wpas_admin_bar_conversion_rate

/**
 * Today's Conversion Rate.
 *
 * Adds today's conversion rate in the admin bar with
 * a direct link to the stats page.
 *
 * @since  1.2.2
 * @param  object $wp_admin_bar The global admin bar object
 * @return void
 */
function wpas_admin_bar_conversion_rate($wp_admin_bar)
{
    /* Get today's conversion rate. */
    $rate = wpbo_today_conversion();
    /* Set the node parameters. */
    $args = array('id' => 'wpbo_today_conversion', 'title' => sprintf(__('Today\'s Conversion: %s', 'betteroptin'), "{$rate}%"), 'href' => admin_url('edit.php?popup=all&period=today&post_type=wpbo-popup&page=wpbo-analytics'), 'meta' => array('class' => 'wpbo-today-conversion'));
    /* Add the new node. */
    $wp_admin_bar->add_node($args);
}
开发者ID:simfatic,项目名称:BetterOptin,代码行数:19,代码来源:functions-misc.php

示例4:

 /**
  * Move the Customizer link from the Adminbar top-level to be a sub-item under the site-menu.
  *
  * @param object $wp_admin_bar The admin bar object. Gets passed by reference.
  */
 function adminbar_no_customizer($wp_admin_bar)
 {
     $node = $wp_admin_bar->get_node('customize');
     // Check if the customizer node exists.
     if ($node) {
         $args = $node;
         $args->parent = 'appearance';
         $wp_admin_bar->add_node($args);
     }
 }
开发者ID:jrfnl,项目名称:WP-adminbar-no-customizer,代码行数:15,代码来源:adminbar-no-customizer.php

示例5: wpas_toolbar_tickets_link

/**
 * Add link to agent's tickets.
 *
 * @since  3.0.0
 *
 * @param  object $wp_admin_bar The WordPress toolbar object
 *
 * @return void
 */
function wpas_toolbar_tickets_link($wp_admin_bar)
{
    if (!current_user_can('edit_ticket')) {
        return;
    }
    $hide = (bool) wpas_get_option('hide_closed');
    $agent_see_all = (bool) wpas_get_option('agent_see_all');
    $admin_see_all = (bool) wpas_get_option('admin_see_all');
    $args = array('post_type' => 'ticket');
    // In case the current user can only see his own tickets
    if (current_user_can('administrator') && false === $admin_see_all || !current_user_can('administrator') && false === $agent_see_all) {
        global $current_user;
        $agent = new WPAS_Member_Agent($current_user->ID);
        $tickets_count = $agent->open_tickets();
    } else {
        $tickets_count = count(wpas_get_tickets('open', $args));
    }
    if (true === $hide) {
        $args['wpas_status'] = 'open';
    }
    $node = array('id' => 'wpas_tickets', 'parent' => null, 'group' => null, 'title' => '<span class="ab-icon"></span> ' . $tickets_count, 'href' => add_query_arg($args, admin_url('edit.php')), 'meta' => array('target' => '_self', 'title' => esc_html__('Open tickets assigned to you', 'awesome-support'), 'class' => 'wpas-my-tickets'));
    $wp_admin_bar->add_node($node);
}
开发者ID:alpha1,项目名称:Awesome-Support,代码行数:32,代码来源:functions-admin-bar.php

示例6: array

 /**
  * Adds the dev menu to the toolbar
  * 
  * @since TabulaRasa 1.11
  * @param object $admin_bar
  */
 function dev_toolbar_items($admin_bar)
 {
     if (current_user_can('manage_options') && WP_DEBUG === true) {
         $admin_bar->add_node(array('id' => 'tr-dev-tools', 'title' => 'TabulaRasa Dev Tools', 'href' => '#', 'meta' => array('title' => __('Dev Tools'))));
         if (!is_admin()) {
             global $wp_query;
             $admin_bar->add_node(array('id' => 'tr-dev-grid-overlay', 'parent' => 'tr-dev-tools', 'title' => __('Grid Overlay'), 'href' => '#', 'meta' => array('title' => __('Show the grid overlay'))));
             $admin_bar->add_node(array('id' => 'tr-dev-current-template', 'parent' => 'tr-dev-tools', 'title' => __('Template') . ': ' . $this->dev['current_template'], 'href' => admin_url('theme-editor.php?file=' . $this->dev['current_template'] . '&amp;theme=' . $this->theme->name), 'meta' => array('title' => __('Edit this template'))));
         }
     }
 }
开发者ID:renaissance-design,项目名称:tabularasa,代码行数:17,代码来源:TabulaRasa.php

示例7: add_toolbar_links

 /**
  * Customize the dropdown under "Dashboard" in admin bar on front-end
  *
  * @see admin_bar_menu
  *
  * @param object $wp_admin_bar admin bar main object.
  */
 public function add_toolbar_links($wp_admin_bar)
 {
     // Abort if we're not on the front-end
     if (is_admin() || !current_user_can('edit_users')) {
         return;
     }
     $plugins = array('parent' => 'site-name', 'id' => 'plugins', 'title' => __('Plugins', 'evans-mu'), 'href' => admin_url('plugins.php'));
     $pages = array('parent' => 'site-name', 'id' => 'pages', 'title' => __('Pages', 'evans-mu'), 'href' => admin_url('edit.php?post_type=page'));
     $posts = array('parent' => 'site-name', 'id' => 'posts', 'title' => __('Posts', 'evans-mu'), 'href' => admin_url('edit.php?post_type=post'));
     // Add our nodes
     $wp_admin_bar->add_node($plugins);
     $wp_admin_bar->add_node($pages);
     $wp_admin_bar->add_node($posts);
     // Remove worthless nodes
     $wp_admin_bar->remove_node('customize');
     $wp_admin_bar->remove_node('widgets');
     $wp_admin_bar->remove_node('themes');
 }
开发者ID:mikeselander,项目名称:travel-blog,代码行数:25,代码来源:class-clean-admin.php

示例8: admin_bar_links

 /**
  * This adds a "Theme Options" link to the WordPress admin bar under the menu
  * with the site name. Is only visible to users who can edit theme options.
  * 
  * @param  object $wp_admin_bar The wp_admin_bar object as supplied by WordPress
  * @return void
  */
 public function admin_bar_links($wp_admin_bar)
 {
     if (current_user_can('edit_theme_options')) {
         $wp_admin_bar->add_node(array('id' => 'theme-options', 'parent' => 'site-name', 'title' => 'Theme Options', 'href' => theme::options_uri()));
     }
 }
开发者ID:nemesiscodex,项目名称:Semantic-UI-WordPress,代码行数:13,代码来源:wp_integrations.php

示例9: admin_bar_menu

 /**
  * Adds the page builder button to the WordPress admin bar.
  *
  * @since 1.0
  * @param object $wp_admin_bar An instance of the WordPress admin bar.
  * @return void
  */
 public static function admin_bar_menu($wp_admin_bar)
 {
     global $wp_the_query;
     if (FLBuilderModel::is_post_editable()) {
         $wp_admin_bar->add_node(array('id' => 'fl-builder-frontend-edit-link', 'title' => '<style> #wp-admin-bar-fl-builder-frontend-edit-link .ab-icon:before { content: "\\f116" !important; top: 2px; margin-right: 3px; } </style><span class="ab-icon"></span>' . FLBuilderModel::get_branding(), 'href' => FLBuilderModel::get_edit_url($wp_the_query->post->ID)));
     }
 }
开发者ID:komcdo,项目名称:iSSNA-WordPress,代码行数:14,代码来源:class-fl-builder.php

示例10: schema_test

 /**
  * Adds the `test schema` link to the admin toolbar
  *
  * @param object $wp_admin_bar the current admin bar
  */
 public function schema_test($wp_admin_bar)
 {
     // No link on admin panel
     if (is_admin()) {
         return;
     }
     // only load on singles
     if (!is_singular()) {
         return;
     }
     //get some variables
     global $post;
     $link = get_permalink($post->ID);
     // set args for tab
     global $wp_admin_bar;
     $args = array('parent' => 'top-secondary', 'id' => 'schema-test', 'title' => _x('Test Schema', 'test the schema button title', 'schema'), 'href' => esc_url(__('http://www.google.com/webmasters/tools/richsnippets', 'schema') . '?q=' . urlencode($link)), 'meta' => array('class' => 'schema-test', 'target' => '_blank'));
     $wp_admin_bar->add_node($args);
 }
开发者ID:cleaningexec,项目名称:schema-creator,代码行数:23,代码来源:schema-creator.php

示例11: add_admin_bar_menu

 /**
  * Add Template menu to Admin Bar.
  * 
  * @since 1.0.0
  * @access public
  * @param object $wp_admin_bar 
  */
 public function add_admin_bar_menu($wp_admin_bar)
 {
     if (!TF_Model::is_tf_editor_active()) {
         return;
     }
     $args = array(array('id' => 'tf_template_admin_menu', 'title' => __('TF Template', 'themify-flow'), 'href' => '#'), array('id' => 'tf_template_admin_menu_options', 'parent' => 'tf_template_admin_menu', 'title' => __('Template Options', 'themify-flow'), 'href' => '#', 'meta' => array('class' => 'tf_template_admin_menu_options')), array('id' => 'tf_template_admin_menu_global_styling', 'parent' => 'tf_template_admin_menu', 'title' => __('Global Styling', 'themify-flow'), 'href' => '#', 'meta' => array('class' => 'tf_load_global_styling')), array('id' => 'tf_template_admin_menu_export', 'parent' => 'tf_template_admin_menu', 'title' => __('Export', 'themify-flow'), 'href' => '#', 'meta' => array('class' => 'tf_template_admin_menu_export')), array('id' => 'tf_template_admin_menu_import', 'parent' => 'tf_template_admin_menu', 'title' => __('Replace (Import)', 'themify-flow'), 'href' => '#', 'meta' => array('class' => 'tf_template_admin_menu_import')));
     if (TF_Model::is_tf_styling_active()) {
         unset($args[1]);
         unset($args[3]);
         unset($args[4]);
     } else {
         if (!is_singular($this->post_type)) {
             $args = array();
         }
     }
     foreach ($args as $arg) {
         $wp_admin_bar->add_node($arg);
     }
 }
开发者ID:jhostetter,项目名称:wp_intern_themes,代码行数:26,代码来源:class-tf-template.php

示例12: admin_bar_menu_users

 /**
  * Add admin bar menu users items
  *
  * @since   1.5
  * @access  public
  * @see     'vaa_admin_bar_menu' action
  * @param   object  $admin_bar
  * @return  void
  */
 public function admin_bar_menu_users($admin_bar)
 {
     if ($this->get_users() && 0 < count($this->get_users())) {
         $admin_bar->add_group(array('id' => 'users', 'parent' => 'view-as', 'meta' => array('class' => 'ab-sub-secondary')));
         $admin_bar->add_node(array('id' => 'users-title', 'parent' => 'users', 'title' => self::do_icon('dashicons-admin-users') . __('Users', 'view-admin-as'), 'href' => false, 'meta' => array('class' => 'vaa-has-icon ab-vaa-title ab-vaa-toggle active')));
         /**
          * Add items at the beginning of the users group
          * @see     'admin_bar_menu' action
          * @link    https://codex.wordpress.org/Class_Reference/WP_Admin_Bar
          */
         do_action('vaa_admin_bar_users_before', $admin_bar);
         if (true === $this->searchUsers) {
             $admin_bar->add_node(array('id' => 'searchuser', 'parent' => 'users', 'title' => '<input id="search" name="vaa-search" placeholder="' . esc_attr__('Search', 'view-admin-as') . ' (' . strtolower(__('Username', 'view-admin-as')) . ')" />', 'href' => false, 'meta' => array('class' => 'ab-vaa-search search-users', 'html' => '<ul id="vaa-searchuser-results" class="ab-sub-secondary ab-submenu"></ul>')));
         }
         // Add the users
         foreach ($this->get_users() as $user_key => $user) {
             $href = '#';
             $title = $user->data->display_name;
             $class = 'vaa-user-item';
             // Check if this user is the current view
             if ($this->get_viewAs('user') && $this->get_viewAs('user') == $user->data->ID) {
                 $class .= ' current';
                 $href = false;
             }
             $parent = 'users';
             if (true === $this->groupUserRoles) {
                 // Users grouped under roles
                 foreach ($user->roles as $role) {
                     $parent = 'role-' . $role;
                     $admin_bar->add_node(array('id' => 'user-' . $user->data->ID . '-' . $role, 'parent' => $parent, 'title' => $title, 'href' => $href, 'meta' => array('title' => esc_attr__('View as', 'view-admin-as') . ' ' . $user->data->display_name, 'class' => $class, 'rel' => $user->data->ID)));
                 }
             } else {
                 // Users displayed as normal
                 $all_roles = $this->get_roles();
                 $user_roles = array();
                 // Add the roles of this user in the name
                 foreach ($user->roles as $role) {
                     $user_roles[] = translate_user_role($all_roles[$role]->name);
                 }
                 $title = $title . ' &nbsp; <span class="user-role">(' . implode(', ', $user_roles) . ')</span>';
                 $admin_bar->add_node(array('id' => 'user-' . $user->data->ID, 'parent' => $parent, 'title' => $title, 'href' => $href, 'meta' => array('title' => esc_attr__('View as', 'view-admin-as') . ' ' . $user->data->display_name, 'class' => $class, 'rel' => $user->data->ID)));
             }
         }
         /**
          * Add items at the end of the users group
          * @see     'admin_bar_menu' action
          * @link    https://codex.wordpress.org/Class_Reference/WP_Admin_Bar
          */
         do_action('vaa_admin_bar_users_after', $admin_bar);
     }
 }
开发者ID:JoryHogeveen,项目名称:view-admin-as,代码行数:60,代码来源:class-admin-bar.php

示例13: admin_bar_menu

    /**
     * Add admin bar menu's
     *
     *
     * @since   1.4
     * @since   1.5.2   Changed hook to vaa_admin_bar_settings_after (previous: 'vaa_admin_bar_roles_before')
     * @access  public
     * @see     'vaa_admin_bar_settings_after' action
     *
     * @param   object  $admin_bar
     * @return  void
     */
    public function admin_bar_menu($admin_bar)
    {
        $admin_bar->add_node(array('id' => 'role-defaults', 'parent' => 'view-as', 'title' => VAA_View_Admin_As_Admin_Bar::do_icon('dashicons-id-alt') . __('Role defaults', 'view-admin-as'), 'href' => false, 'meta' => array('class' => 'vaa-has-icon')));
        $role_select_options = '';
        foreach ($this->get_roles() as $role_key => $role) {
            $role_select_options .= '<option value="' . esc_attr($role_key) . '">' . translate_user_role($role->name) . '</option>';
        }
        $admin_bar->add_node(array('id' => 'role-defaults-setting-register-enable', 'parent' => 'role-defaults', 'title' => '<input class="checkbox" value="1" id="vaa_role_defaults_register_enable" name="vaa_role_defaults_register_enable" type="checkbox" ' . checked($this->get_optionData('apply_defaults_on_register'), true, false) . '>
							<label for="vaa_role_defaults_register_enable">' . __('Automatically apply defaults to new users', 'view-admin-as') . '</label>', 'href' => false, 'meta' => array('class' => 'auto-height')));
        $admin_bar->add_node(array('id' => 'role-defaults-setting-disable-user-screen-options', 'parent' => 'role-defaults', 'title' => '<input class="checkbox" value="1" id="vaa_role_defaults_disable_user_screen_options" name="vaa_role_defaults_disable_user_screen_options" type="checkbox" ' . checked($this->get_optionData('disable_user_screen_options'), true, false) . '>
							<label for="vaa_role_defaults_disable_user_screen_options">' . __('Disable screen options', 'view-admin-as') . '</label>
							<p class="description ab-item">' . __("Hide the screen options for all users who can't access role defaults", 'view-admin-as') . '</p>', 'href' => false, 'meta' => array('class' => 'auto-height')));
        $admin_bar->add_node(array('id' => 'role-defaults-setting-lock-meta-boxes', 'parent' => 'role-defaults', 'title' => '<input class="checkbox" value="1" id="vaa_role_defaults_lock_meta_boxes" name="vaa_role_defaults_lock_meta_boxes" type="checkbox" ' . checked($this->get_optionData('lock_meta_boxes'), true, false) . '>
							<label for="vaa_role_defaults_lock_meta_boxes">' . __('Lock meta boxes', 'view-admin-as') . '</label>
							<p class="description ab-item">' . __("Lock meta box order and locations for all users who can't access role defaults", 'view-admin-as') . '</p>', 'href' => false, 'meta' => array('class' => 'auto-height')));
        /**
         * Bulk actions
         */
        if ($this->get_users()) {
            // Users select
            $admin_bar->add_group(array('id' => 'role-defaults-bulk-users', 'parent' => 'role-defaults', 'meta' => array('class' => 'ab-sub-secondary')));
            $admin_bar->add_node(array('id' => 'role-defaults-bulk-users-title', 'parent' => 'role-defaults-bulk-users', 'title' => __('Apply defaults to users', 'view-admin-as'), 'href' => false, 'meta' => array('class' => 'ab-bold ab-vaa-toggle')));
            $admin_bar->add_node(array('id' => 'role-defaults-bulk-users-filter', 'parent' => 'role-defaults-bulk-users', 'title' => '<input id="role-defaults-bulk-users-filter" name="vaa-filter" placeholder="' . esc_attr__('Filter', 'view-admin-as') . ' (' . strtolower(__('Username')) . ')" />', 'href' => false, 'meta' => array('class' => 'ab-vaa-filter')));
            $bulk_users_select_content = '';
            foreach ($this->get_users() as $user) {
                foreach ($user->roles as $role) {
                    if ($role_data = $this->get_roles($role)) {
                        $role_name = translate_user_role($role_data->name);
                        $bulk_users_select_content .= '<div class="ab-item vaa-item">
								<input class="checkbox" value="' . $user->ID . '|' . $role . '" id="role-defaults-bulk-users-select-' . $user->ID . '" name="role-defaults-bulk-users-select[]" type="checkbox">
								<label for="role-defaults-bulk-users-select-' . $user->ID . '"><span class="user-name">' . $user->display_name . '</span> &nbsp; <span class="user-role">(' . $role_name . ')</span></label>
							</div>';
                    }
                }
            }
            $admin_bar->add_node(array('id' => 'role-defaults-bulk-users-select', 'parent' => 'role-defaults-bulk-users', 'title' => $bulk_users_select_content, 'href' => false, 'meta' => array('class' => 'ab-vaa-multipleselect max-height')));
            $admin_bar->add_node(array('id' => 'role-defaults-bulk-users-apply', 'parent' => 'role-defaults-bulk-users', 'title' => '<button id="role-defaults-bulk-users-apply" class="button button-primary" name="role-defaults-bulk-users-apply">' . __('Apply', 'view-admin-as') . '</button>', 'href' => false, 'meta' => array('class' => 'vaa-button-container', 'html' => '')));
        }
        if ($this->get_users() && $this->get_roles()) {
            // Roles select
            $admin_bar->add_group(array('id' => 'role-defaults-bulk-roles', 'parent' => 'role-defaults', 'meta' => array('class' => 'ab-sub-secondary')));
            $admin_bar->add_node(array('id' => 'role-defaults-bulk-roles-title', 'parent' => 'role-defaults-bulk-roles', 'title' => __('Apply defaults to users by role', 'view-admin-as'), 'href' => false, 'meta' => array('class' => 'ab-bold ab-vaa-toggle')));
            $admin_bar->add_node(array('id' => 'role-defaults-bulk-roles-select', 'parent' => 'role-defaults-bulk-roles', 'title' => '<select id="role-defaults-bulk-roles-select" name="role-defaults-bulk-roles-select"><option value=""> --- </option><option value="all">' . __('All roles', 'view-admin-as') . '</option>' . $role_select_options . '</select>', 'href' => false, 'meta' => array('class' => 'ab-vaa-select select-role', 'html' => '')));
            $admin_bar->add_node(array('id' => 'role-defaults-bulk-roles-apply', 'parent' => 'role-defaults-bulk-roles', 'title' => '<button id="role-defaults-bulk-roles-apply" class="button button-primary" name="role-defaults-bulk-roles-apply">' . __('Apply', 'view-admin-as') . '</button>', 'href' => false, 'meta' => array('class' => 'vaa-button-container', 'html' => '')));
        }
        if ($this->get_roles()) {
            /* Export actions */
            $admin_bar->add_group(array('id' => 'role-defaults-export', 'parent' => 'role-defaults', 'meta' => array('class' => 'ab-sub-secondary')));
            $admin_bar->add_node(array('id' => 'role-defaults-export-roles', 'parent' => 'role-defaults-export', 'title' => __('Export defaults for role', 'view-admin-as'), 'href' => false, 'meta' => array('class' => 'ab-bold ab-vaa-toggle')));
            $admin_bar->add_node(array('id' => 'role-defaults-export-roles-select', 'parent' => 'role-defaults-export', 'title' => '<select id="role-defaults-export-roles-select" name="role-defaults-export-roles-select"><option value="all">' . __('All roles', 'view-admin-as') . '</option>' . $role_select_options . '</select>', 'href' => false, 'meta' => array('class' => 'ab-vaa-select select-role', 'html' => '')));
            $admin_bar->add_node(array('id' => 'role-defaults-export-roles-export', 'parent' => 'role-defaults-export', 'title' => '<button id="role-defaults-export-roles-export" class="button button-secondary" name="role-defaults-export-roles-export">' . __('Export', 'view-admin-as') . '</button>', 'href' => false, 'meta' => array('class' => 'vaa-button-container', 'html' => '')));
            /* Import actions */
            $admin_bar->add_group(array('id' => 'role-defaults-import', 'parent' => 'role-defaults', 'meta' => array('class' => 'ab-sub-secondary')));
            $admin_bar->add_node(array('id' => 'role-defaults-import-roles', 'parent' => 'role-defaults-import', 'title' => __('Import defaults for role', 'view-admin-as'), 'href' => false, 'meta' => array('class' => 'ab-bold ab-vaa-toggle')));
            $admin_bar->add_node(array('id' => 'role-defaults-import-roles-input', 'parent' => 'role-defaults-import', 'title' => '<textarea id="role-defaults-import-roles-input" name="role-defaults-import-roles-input" placeholder="' . esc_attr__('Paste code here', 'view-admin-as') . '"></textarea>', 'href' => false, 'meta' => array('class' => 'ab-vaa-textarea input-role', 'html' => '')));
            $admin_bar->add_node(array('id' => 'role-defaults-import-roles-import', 'parent' => 'role-defaults-import', 'title' => '<button id="role-defaults-import-roles-import" class="button button-secondary" name="role-defaults-import-roles-import">' . __('Import', 'view-admin-as') . '</button>', 'href' => false, 'meta' => array('class' => 'vaa-button-container', 'html' => '')));
            /* Clear actions */
            $admin_bar->add_group(array('id' => 'role-defaults-clear', 'parent' => 'role-defaults', 'meta' => array('class' => 'ab-sub-secondary vaa-sub-transparent')));
            $admin_bar->add_node(array('id' => 'role-defaults-clear-roles', 'parent' => 'role-defaults-clear', 'title' => __('Remove defaults for role', 'view-admin-as'), 'href' => false, 'meta' => array('class' => 'ab-bold ab-vaa-toggle')));
            $admin_bar->add_node(array('id' => 'role-defaults-clear-roles-select', 'parent' => 'role-defaults-clear', 'title' => '<select id="role-defaults-clear-roles-select" name="role-defaults-clear-roles-select"><option value=""> --- </option><option value="all">' . __('All roles', 'view-admin-as') . '</option>' . $role_select_options . '</select>', 'href' => false, 'meta' => array('class' => 'ab-vaa-select select-role', 'html' => '')));
            $admin_bar->add_node(array('id' => 'role-defaults-clear-roles-apply', 'parent' => 'role-defaults-clear', 'title' => '<button id="role-defaults-clear-roles-apply" class="button button-secondary" name="role-defaults-clear-roles-apply">' . __('Apply', 'view-admin-as') . '</button>', 'href' => false, 'meta' => array('class' => 'vaa-button-container', 'html' => '')));
        }
    }
开发者ID:JoryHogeveen,项目名称:view-admin-as,代码行数:75,代码来源:class-role-defaults.php

示例14:

 /**
  * adds a new subnode to the basenode.
  *
  * will return a reference to it for further processing.
  *
  * @access   public
  * @param    string    $nodename     name of the new node
  * @param    string    $id           id of the new node
  * @return   object
  */
 function &add_node($nodename, $id = '')
 {
     return $this->basenode->add_node($nodename, $id);
 }
开发者ID:edmarmoretti,项目名称:i3geo,代码行数:14,代码来源:cpaint2.inc.php

示例15: admin_toolbar_menu

 /**
  * Add a menu to the WP admin toolbar
  *
  * @since 1.7
  * @param object $wp_admin_bar
  */
 public function admin_toolbar_menu($wp_admin_bar)
 {
     // Only display VFB toolbar if on a page with the shortcode
     if (!is_admin() && current_user_can('vfb_edit_forms')) {
         global $post;
         // If no post, exit
         if (!$post) {
             return;
         }
         $post_to_check = get_post(get_the_ID());
         // Finds content with the vfb shortcode
         if (stripos($post_to_check->post_content, '[vfb') !== false) {
             preg_match_all('/id=[\'"]?(\\d+)[\'"]?/', $post_to_check->post_content, $matches);
             // If more than one form, display a new toolbar item with dropdown
             if (count($matches[1]) > 1) {
                 global $wpdb;
                 $wp_admin_bar->add_node(array('id' => 'vfb_admin_toolbar_edit_main', 'title' => 'Edit Forms', 'parent' => false, 'href' => admin_url('admin.php?page=visual-form-builder-pro')));
                 // Loop through the forms
                 foreach ($matches[1] as $form_id) {
                     $name = $wpdb->get_var($wpdb->prepare("SELECT form_title FROM {$this->form_table_name} WHERE form_id = %d", $form_id));
                     $wp_admin_bar->add_node(array('id' => 'vfb_admin_toolbar_edit_' . $form_id, 'title' => 'Edit ' . stripslashes($name), 'parent' => 'vfb_admin_toolbar_edit_main', 'href' => admin_url('admin.php?page=visual-form-builder-pro&amp;action=edit&amp;form=' . $form_id)));
                 }
             } else {
                 // A new toolbar item
                 $wp_admin_bar->add_node(array('id' => 'vfb_admin_toolbar_edit_main', 'title' => 'Edit Form', 'parent' => false, 'href' => admin_url('admin.php?page=visual-form-builder-pro&amp;action=edit&amp;form=' . $matches[1][0])));
                 // An item added to the main VFB Pro menu
                 $wp_admin_bar->add_node(array('id' => 'vfb_admin_toolbar_edit', 'title' => 'Edit Form', 'parent' => 'vfb_admin_toolbar', 'href' => admin_url('admin.php?page=visual-form-builder-pro&amp;action=edit&amp;form=' . $matches[1][0])));
             }
         }
     }
     // Entire menu will be hidden if user does not have vfb_edit_forms cap
     if (isset($_REQUEST['page']) && in_array($_REQUEST['page'], array('visual-form-builder-pro')) && isset($_REQUEST['form']) && current_user_can('vfb_edit_forms')) {
         $wp_admin_bar->add_node(array('id' => 'vfb_admin_toolbar_preview_form', 'title' => 'Preview Form', 'parent' => false, 'href' => esc_url(add_query_arg(array('form' => $_REQUEST['form'], 'preview' => 1), plugins_url('visual-form-builder-pro/form-preview.php'))), 'meta' => array('target' => '_blank')));
     }
     // Entire menu will be hidden if user does not have vfb_edit_forms cap
     if (current_user_can('vfb_edit_forms')) {
         $wp_admin_bar->add_node(array('id' => 'vfb_admin_toolbar', 'title' => 'VFB Pro', 'parent' => false, 'href' => admin_url('admin.php?page=visual-form-builder-pro')));
     }
     // Add New Form
     if (current_user_can('vfb_create_forms')) {
         $wp_admin_bar->add_node(array('id' => 'vfb_admin_toolbar_add', 'title' => __('Add New Form', 'visual-form-builder-pro'), 'parent' => 'vfb_admin_toolbar', 'href' => admin_url('admin.php?page=vfb-add-new')));
     }
     // Entries
     if (current_user_can('vfb_view_entries')) {
         $wp_admin_bar->add_node(array('id' => 'vfb_admin_toolbar_entries', 'title' => __('Entries', 'visual-form-builder-pro'), 'parent' => 'vfb_admin_toolbar', 'href' => admin_url('admin.php?page=vfb-entries')));
     }
     // Email Design
     if (current_user_can('vfb_edit_email_design')) {
         $wp_admin_bar->add_node(array('id' => 'vfb_admin_toolbar_email', 'title' => __('Email Design', 'visual-form-builder-pro'), 'parent' => 'vfb_admin_toolbar', 'href' => admin_url('admin.php?page=vfb-email-design')));
     }
     // Analytics
     if (current_user_can('vfb_view_analytics')) {
         $wp_admin_bar->add_node(array('id' => 'vfb_admin_toolbar_analytics', 'title' => __('Analytics', 'visual-form-builder-pro'), 'parent' => 'vfb_admin_toolbar', 'href' => admin_url('admin.php?page=vfb-reports')));
     }
     // Import
     if (current_user_can('vfb_import_forms')) {
         $wp_admin_bar->add_node(array('id' => 'vfb_admin_toolbar_import', 'title' => __('Import', 'visual-form-builder-pro'), 'parent' => 'vfb_admin_toolbar', 'href' => admin_url('admin.php?page=vfb-import')));
     }
     // Export
     if (current_user_can('vfb_export_forms')) {
         $wp_admin_bar->add_node(array('id' => 'vfb_admin_toolbar_export', 'title' => __('Export', 'visual-form-builder-pro'), 'parent' => 'vfb_admin_toolbar', 'href' => admin_url('admin.php?page=vfb-export')));
     }
     // Settings
     if (current_user_can('vfb_edit_settings')) {
         $wp_admin_bar->add_node(array('id' => 'vfb_admin_toolbar_settings', 'title' => __('Settings', 'visual-form-builder-pro'), 'parent' => 'vfb_admin_toolbar', 'href' => admin_url('admin.php?page=vfb-settings')));
     }
     // Payments
     if (class_exists('VFB_Pro_Payments') && current_user_can('vfb_edit_forms')) {
         $wp_admin_bar->add_node(array('id' => 'vfb_admin_toolbar_payments', 'title' => __('Payments', 'visual-form-builder-pro'), 'parent' => 'vfb_admin_toolbar', 'href' => admin_url('admin.php?page=vfb-payments')));
     }
     // Display Entries
     if (class_exists('VFB_Pro_Display_Entries') && current_user_can('vfb_edit_entries')) {
         $wp_admin_bar->add_node(array('id' => 'vfb_admin_toolbar_display_entries', 'title' => __('Display Entries', 'visual-form-builder-pro'), 'parent' => 'vfb_admin_toolbar', 'href' => admin_url('admin.php?page=vfb-addon-display-entries')));
     }
     // Form Designer
     if (class_exists('VFB_Pro_Form_Designer') && current_user_can('vfb_edit_email_design')) {
         $wp_admin_bar->add_node(array('id' => 'vfb_admin_toolbar_form_designer', 'title' => __('Form Design', 'visual-form-builder-pro'), 'parent' => 'vfb_admin_toolbar', 'href' => admin_url('admin.php?page=vfb-addon-form-design')));
     }
 }
开发者ID:adrianjonmiller,项目名称:animalhealth,代码行数:85,代码来源:visual-form-builder-pro.php


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