Exemplo n.º 1
1
/**
 * Render the admin bar to the page based on the $wp_admin_bar->menu member var.
 * This is called very late on the footer actions so that it will render after anything else being
 * added to the footer.
 *
 * It includes the action "admin_bar_menu" which should be used to hook in and
 * add new menus to the admin bar. That way you can be sure that you are adding at most optimal point,
 * right before the admin bar is rendered. This also gives you access to the $post global, among others.
 *
 * @since 3.1.0
 */
function wp_admin_bar_render()
{
    global $wp_admin_bar;
    if (!is_admin_bar_showing() || !is_object($wp_admin_bar)) {
        return false;
    }
    /**
     * Load all necessary admin bar items.
     *
     * This is the hook used to add, remove, or manipulate admin bar items.
     *
     * @since 3.1.0
     *
     * @param WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance, passed by reference
     */
    do_action_ref_array('admin_bar_menu', array(&$wp_admin_bar));
    /**
     * Fires before the admin bar is rendered.
     *
     * @since 3.1.0
     */
    do_action('wp_before_admin_bar_render');
    $wp_admin_bar->render();
    /**
     * Fires after the admin bar is rendered.
     *
     * @since 3.1.0
     */
    do_action('wp_after_admin_bar_render');
}
Exemplo n.º 2
0
/**
 * Body Class - Thanks to Theme Hyprid (http://themehybrid.com/)
 */
function stormbringer_body_class($classes = '')
{
    global $wp_query;
    global $current_user;
    // User role
    $current_user->ID;
    $user = new WP_User($current_user->ID);
    // $user->roles
    foreach ($user->roles as $role) {
        $classes[] = 'role-' . $role;
    }
    /* Text direction (which direction does the text flow). */
    $classes[] = 'wordpress';
    $classes[] = get_bloginfo('text_direction');
    $classes[] = get_locale();
    /* Check if the current theme is a parent or child theme. */
    $classes[] = is_child_theme() ? 'child-theme' : 'parent-theme';
    /* Multisite check adds the 'multisite' class and the blog ID. */
    if (is_multisite()) {
        $classes[] = 'multisite';
        $classes[] = 'blog-' . get_current_blog_id();
    }
    /* Date classes. */
    $time = time() + get_option('gmt_offset') * 3600;
    $classes[] = strtolower(gmdate('\\yY \\mm \\dd \\hH l', $time));
    /* Is the current user logged in. */
    $classes[] = is_user_logged_in() ? 'logged-in' : 'logged-out';
    /* WP admin bar. */
    if (is_admin_bar_showing()) {
        $classes[] = 'admin-bar';
    }
    /* Merge base contextual classes with $classes. */
    $classes = array_merge($classes, stormbringer_get_context());
    /* Singular post (post_type) classes. */
    if (is_singular()) {
        /* Get the queried post object. */
        $post = get_queried_object();
        /* Checks for custom template. */
        $template = str_replace(array("{$post->post_type}-template-", "{$post->post_type}-", '.php'), '', get_post_meta(get_queried_object_id(), "_wp_{$post->post_type}_template", true));
        if (!empty($template)) {
            $classes[] = "{$post->post_type}-template-{$template}";
        }
        /* Post format. */
        if (current_theme_supports('post-formats') && post_type_supports($post->post_type, 'post-formats')) {
            $post_format = get_post_format(get_queried_object_id());
            $classes[] = empty($post_format) || is_wp_error($post_format) ? "{$post->post_type}-format-standard" : "{$post->post_type}-format-{$post_format}";
        }
        /* Attachment mime types. */
        if (is_attachment()) {
            foreach (explode('/', get_post_mime_type()) as $type) {
                $classes[] = "attachment-{$type}";
            }
        }
    }
    /* Paged views. */
    if ((($page = $wp_query->get('paged')) || ($page = $wp_query->get('page'))) && $page > 1) {
        $classes[] = 'paged paged-' . intval($page);
    }
    return $classes;
}
Exemplo n.º 3
0
 public static function is_admin_bar_showing()
 {
     if (function_exists('is_admin_bar_showing')) {
         return is_admin_bar_showing();
     }
     return FALSE;
 }
Exemplo n.º 4
0
 /**
  *
  */
 function miss_options_toolbar($el)
 {
     if (is_admin_bar_showing()) {
         global $wp_admin_bar, $wpdb;
         $el->add_menu(array('id' => 'my-item', 'title' => 'Theme Options', 'href' => home_url() . '/wp-admin/themes.php?page=miss-options', 'meta' => array('title' => __('Theme Options', MISS_TEXTDOMAIN))));
     }
 }
Exemplo n.º 5
0
 static function loads($hook)
 {
     if (!self::$add_feedback) {
         return;
     }
     global $wp_admin_bar;
     /* CHECK FOR ACTIVE PLUGINS */
     $leads_status = FALSE;
     $landing_page_status = FALSE;
     $cta_status = FALSE;
     if (function_exists('is_plugin_active') && is_plugin_active('leads/leads.php')) {
         $leads_status = TRUE;
         $leads_version_number = defined('WPL_CURRENT_VERSION') ? 'v' . WPL_CURRENT_VERSION : '';
     }
     if (function_exists('is_plugin_active') && is_plugin_active('landing-pages/landing-pages.php')) {
         $landing_page_status = TRUE;
         $landing_page_version_number = defined('LANDINGPAGES_CURRENT_VERSION') ? 'v' . LANDINGPAGES_CURRENT_VERSION : '';
     }
     if (function_exists('is_plugin_active') && is_plugin_active('cta/calls-to-action.php')) {
         $cta_status = TRUE;
         $cta_number = defined('WP_CTA_CURRENT_VERSION') ? 'v' . WP_CTA_CURRENT_VERSION : '';
     }
     if ($leads_status == FALSE && $landing_page_status == FALSE && $cta_status == FALSE) {
         return;
         /* end plugin is */
     }
     /* Exit if admin bar not there */
     if (!is_user_logged_in() || !is_admin_bar_showing()) {
         return;
     }
     /** Show these items only if Inbound Now plugin is actually installed */
     if ($leads_status == TRUE || $landing_page_status == TRUE || $cta_status == TRUE) {
     }
 }
 /**
  * Add a 'customize' menu item to the admin bar
  *
  * This function is attached to the 'admin_bar_menu' action hook.
  *
  * @since 1.0.0
  */
 public function admin_bar_menu($wp_admin_bar)
 {
     if (current_user_can('edit_theme_options') && is_admin_bar_showing()) {
         $wp_admin_bar->add_node(array('parent' => 'bavotasan_toolbar', 'id' => 'customize_theme', 'title' => __('Theme Options', 'tonic'), 'href' => esc_url(admin_url('customize.php'))));
         $wp_admin_bar->add_node(array('parent' => 'bavotasan_toolbar', 'id' => 'documentation_faqs', 'title' => __('Documentation & FAQs', 'tonic'), 'href' => 'https://themes.bavotasan.com/documentation', 'meta' => array('target' => '_blank')));
     }
 }
Exemplo n.º 7
0
 /**
  * Creates the prefix for the Nav Menu
  * @return string
  */
 private function build_menu_prefix()
 {
     $html = '';
     //Wrap the whole menu in a container to limit to content width
     if ($this->settings->wrap_in_container) {
         $html .= "<div class='container'>";
     }
     //Main Nav Menu settings here - format and fixed type location
     $html .= "<nav class='navbar {$this->settings->navbar_format} {$this->settings->navbar_fixed_type}'\n                        role='navigation'>";
     //Move the menu top down if the WP admin bar is displayed
     $html .= is_admin_bar_showing() ? $this->fixed_top_spacer_div() : '';
     //Inner Nav div and Container or Container-Fluid
     $html .= "    <div class='navbar-inner'>\n                            <div class='{$this->settings->class_container}'>";
     //Header section for the collapsed button and brand/logo.
     $html .= "<div class='navbar-header'>";
     //3 icon bar button for the collapsed menu only.
     if ($this->settings->display_icon_bar_button) {
         $html .= "<button type='button'\n                            class='navbar-toggle'\n                            data-toggle='collapse'\n                            data-target='#{$this->unique_menu_id}'\n                            aria-expanded='false'>\n                        <span class='sr-only'>Toggle navigation</span>\n                        <span class='icon-bar'></span>\n                        <span class='icon-bar'></span>\n                        <span class='icon-bar'></span>\n                    </button>";
     }
     //Get logo and title visible only for collapsed menu.
     $html .= $this->get_display_logo('visible-xs');
     $html .= $this->get_display_title('visible-xs');
     //close navbar header section
     $html .= "</div> <!-- close navbar-header-->";
     //Collapse menu target and target id
     $html .= "<div class='collapse navbar-collapse'\n                       id='{$this->unique_menu_id}'>";
     //Get logo and title visible only for full menu, includes alignment left/right
     // this is deliberately separated from the navbrand above as gives flexibility for edge case of separate left/right align logo/title
     $html .= $this->get_display_logo('hidden-xs ' . $this->settings->logo_alignment);
     $html .= $this->get_display_title('hidden-xs ' . $this->settings->title_alignment);
     //Nav Menu Walker continues here...
     return $html;
 }
Exemplo n.º 8
0
function ubermenu_update_notifier_bar_menu()
{
    global $uberMenu;
    if (!$uberMenu->getSettings()->op('update-alerts')) {
        return;
    }
    if (!function_exists('simplexml_load_string')) {
        return;
    }
    global $wp_admin_bar, $wpdb;
    if (!is_super_admin() || !is_admin_bar_showing()) {
        return;
    }
    $xml = ubermenu_get_latest_plugin_version(UBERMENU_UPDATE_DELAY);
    //21600); // This tells the function to cache the remote call for 21600 seconds (6 hours)
    $plugin_data = get_plugin_data(WP_PLUGIN_DIR . '/ubermenu/ubermenu.php');
    // Get plugin data (current version is what we want)
    if (!$xml) {
        //we can't retrieve the XML file and parse it properly
        return;
    }
    if (version_compare($plugin_data['Version'], $xml->latest) == -1) {
        $wp_admin_bar->add_menu(array('id' => 'ubermenu_update_notifier', 'title' => '<span> ' . __('UberMenu', 'ubermenu') . ' <span id="ab-updates">' . __('New Updates', 'ubermenu') . '</span></span>', 'href' => get_admin_url() . 'themes.php?page=uber-menu&updates=1'));
    }
}
 /**
  * Add the hooks to display the asset panel in the admin bar
  * @since 0.0.1
  */
 public function admin_bar_init()
 {
     if (!is_super_admin() || !is_admin_bar_showing() || $this->is_wp_login()) {
         return;
     }
     // Add links to the plugin listing on the installed plugins page
     add_filter('plugin_action_links', array($this, 'plugin_action_links'), 10, 2);
     // Don't bother showing the panel in the admin area
     if (is_admin()) {
         return;
     }
     // Enqueue assets for the control panel
     add_action('wp_enqueue_scripts', array($this, 'register_assets'));
     // Store all assets enqueued in the head
     add_action('wp_head', array($this, 'store_head_assets'), 1000);
     // Store any new assets enqueued in the footer
     add_action('wp_footer', array($this, 'store_footer_assets'), 1000);
     // Deregister assets
     add_action('wp_head', array($this, 'deregister_assets'), 7);
     add_action('wp_footer', array($this, 'deregister_assets'));
     // Add the Assets item to the admin bar
     add_action('admin_bar_menu', array($this, 'admin_bar_menu'));
     // Print the assets panel in the footer
     add_action('wp_footer', array($this, 'print_assets_panel'), 1000);
 }
Exemplo n.º 10
0
function wowslider_admin_bar_menu()
{
    global $wp_admin_bar;
    if (is_super_admin() && is_admin_bar_showing()) {
        $wp_admin_bar->add_menu(array('parent' => 'new-content', 'title' => __('Slider', 'wowslider'), 'href' => admin_url('admin.php?page=wowslider-add-new')));
    }
}
 function ESSBAdminMenuInit3()
 {
     global $essb_adminmenu;
     if (is_admin_bar_showing()) {
         $essb_adminmenu = new ESSBAdminBarMenu3();
     }
 }
function eab_adminbar_menu_init()
{
    //if (!is_super_admin() || !is_admin_bar_showing() )
    if (is_admin_bar_showing()) {
        add_action('admin_bar_menu', 'eab_admin_bar_menu', 1000);
    }
}
Exemplo n.º 13
0
 function init()
 {
     if ($this->show_in_admin_bar() && is_admin_bar_showing()) {
         add_action('admin_bar_menu', array($this, 'dev_admin_menu'));
     }
     add_filter('debug_bar_panels', array($this, 'init_debug_bar_panels'));
     if (self::is_debug_set()) {
         // clear transient with url
         if (isset($_GET['cdt']) && $_GET['cdt']) {
             self::clear_debug_transient();
         }
         $trans = self::get_debug_transient();
         $this->analyze($trans['data'], $trans);
     }
     //add_action( 'admin_notices',	array($this, 'print_persistent_capture' ) );
     add_action('current_screen', array($this, 'get_screen'));
     wp_enqueue_style('dev-debug', "{$this->uri}/assets/dist/dev-debug.min.css");
     wp_enqueue_script('dev-debug', "{$this->uri}/assets/dist/dev-debug.min.js", array('jquery'), false, true);
     foreach ($this->hooks['styles'] as $hook) {
         add_action($hook, array($this, 'print_styles'), 999);
     }
     foreach ($this->hooks['scripts'] as $hook) {
         add_action($hook, array($this, 'print_scripts'), 999);
     }
 }
Exemplo n.º 14
0
 public function admin_bar()
 {
     global $wp_admin_bar;
     if (is_super_admin() && is_admin_bar_showing()) {
         $wp_admin_bar->add_menu(array('parent' => 'new-content', 'id' => 'unoslider', 'title' => __('UnoSlider', 'unoslider'), 'href' => admin_url('admin.php?page=unoslider-new')));
     }
 }
Exemplo n.º 15
0
/**
 * Add css style for the button
 */
function env_name_setup()
{
    if (is_admin_bar_showing()) {
        add_action('wp_head', 'env_name_print_style');
        add_action('admin_head', 'env_name_print_style');
    }
}
Exemplo n.º 16
0
/**
 * Initializes the plugin on the init hook.
 */
function cache_manager_init()
{
    if (!is_admin() && !is_admin_bar_showing()) {
        return;
    }
    SSNepenthe\Metis\Loader::attach(new SSNepenthe\CacheManager\CacheManager());
}
Exemplo n.º 17
0
 function add_node($name, $href = '', $parent = '', $custom_meta = array())
 {
     global $wp_admin_bar;
     if (!is_super_admin() || !is_admin_bar_showing() || !is_object($wp_admin_bar) || !function_exists('is_admin_bar_showing')) {
         return;
     }
     // Generate ID based on the current filename and the name supplied.
     $id = str_replace('.php', '', basename(__FILE__)) . '-' . $name;
     $id = preg_replace('#[^\\w-]#si', '-', $id);
     $id = strtolower($id);
     $id = trim($id, '-');
     $parent = trim($parent);
     // Generate the ID of the parent.
     if (!empty($parent)) {
         $parent = str_replace('.php', '', basename(__FILE__)) . '-' . $parent;
         $parent = preg_replace('#[^\\w-]#si', '-', $parent);
         $parent = strtolower($parent);
         $parent = trim($parent, '-');
     }
     // links from the current host will open in the current window
     $site_url = site_url();
     $meta_default = array();
     $meta_ext = array('target' => '_blank');
     // external links open in new tab/window
     $meta = strpos($href, $site_url) !== false ? $meta_default : $meta_ext;
     $meta = array_merge($meta, $custom_meta);
     $wp_admin_bar->add_node(array('parent' => $parent, 'id' => $id, 'title' => $name, 'href' => $href, 'meta' => $meta));
 }
Exemplo n.º 18
0
/**
* Add option to Admin Bar (WP 3.3+)
*
* Add link to YouTube Embed profile options to Admin Bar.
* With help from http://technerdia.com/1140_wordpress-admin-bar.html
*
* @uses     aye_set_general_default     Set default options
*
* @since	2.5
*/
function aye_admin_bar_render_3_3($meta = TRUE)
{
    global $wp_version;
    if ((double) $wp_version >= 3.3) {
        $options = aye_set_general_defaults();
        $profile_access = $options['profile_access'];
        $list_access = $options['list_access'];
        if ($options['admin_bar'] != '') {
            global $wp_admin_bar;
            if (!is_user_logged_in()) {
                return;
            }
            if (!is_admin_bar_showing()) {
                return;
            }
            $wp_admin_bar->add_menu(array('id' => 'aye-menu', 'title' => __('YouTube Embed', 'youtube-embed')));
            if (function_exists('wp_readme_parser')) {
                $wp_admin_bar->add_menu(array('parent' => 'aye-menu', 'id' => 'aye-readme', 'title' => __('Instructions', 'youtube-embed'), 'href' => admin_url('admin.php?page=aye-support-instructions'), 'meta' => array('target' => '_blank')));
            }
            if (current_user_can('delete_plugins')) {
                $wp_admin_bar->add_menu(array('parent' => 'aye-menu', 'id' => 'aye-options', 'title' => __('Options', 'youtube-embed'), 'href' => admin_url('admin.php?page=aye-general-options'), 'meta' => array('target' => '_blank')));
            }
            if (current_user_can($profile_access)) {
                $wp_admin_bar->add_menu(array('parent' => 'aye-menu', 'id' => 'aye-profile', 'title' => __('Profiles', 'youtube-embed'), 'href' => admin_url('admin.php?page=aye-profile-options'), 'meta' => array('target' => '_blank')));
            }
            if (current_user_can($list_access)) {
                $wp_admin_bar->add_menu(array('parent' => 'aye-menu', 'id' => 'aye-lists', 'title' => __('Lists', 'youtube-embed'), 'href' => admin_url('admin.php?page=aye-list-options'), 'meta' => array('target' => '_blank')));
            }
        }
    }
}
Exemplo n.º 19
0
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'));
        }
    }
}
Exemplo n.º 20
0
function wowslider_admin_bar_menu()
{
    global $wp_admin_bar;
    if (current_user_can('level_7') && is_admin_bar_showing()) {
        $wp_admin_bar->add_menu(array('parent' => 'new-content', 'title' => __('Slider', 'wowslider'), 'href' => admin_url('admin.php?page=wowslider-add-new'), 'id' => 'wowslider'));
    }
}
Exemplo n.º 21
0
function check_show_admin_bar()
{
    if (is_admin_bar_showing() and !current_user_can('manage_options')) {
        $user_id = get_current_user_id();
        update_user_meta($user_id, 'show_admin_bar_front', 'false');
    }
}
Exemplo n.º 22
0
function adjust_admin_bar()
{
    /* Global */
    global $wp_admin_bar;
    /* Aktiv und Admin? */
    if (!is_admin_bar_showing() or !is_admin()) {
        return;
    }
    /* Einträge löschen */
    $wp_admin_bar->remove_menu('view');
    $wp_admin_bar->remove_menu('updates');
    $wp_admin_bar->remove_menu('wp-logo');
    $wp_admin_bar->remove_menu('comments');
    $wp_admin_bar->remove_menu('appearance');
    $wp_admin_bar->remove_menu('view-site');
    $wp_admin_bar->remove_menu('new-content');
    $wp_admin_bar->remove_menu('my-account');
    /* Suche definieren */
    $form = '<form action="' . esc_url(admin_url('edit.php')) . '" method="get" id="adminbarsearch">';
    $form .= '<input class="adminbar-input" name="s" tabindex="1" type="text" value="" maxlength="50" />';
    $form .= '<input type="submit" class="adminbar-button" value="' . __('Search') . '"/>';
    $form .= '</form>';
    /* Suche einbinden */
    $wp_admin_bar->add_menu(array('parent' => 'top-secondary', 'id' => 'search', 'title' => $form, 'meta' => array('class' => 'admin-bar-search')));
}
Exemplo n.º 23
0
 function wp_native_dashboard_langswitcher($plugin_url, $as_head, $as_admin_bar)
 {
     global $text_direction;
     if ($text_direction == 'rtl') {
         wp_enqueue_style('wp-native-dashboard-css-rtl', $plugin_url . '/css/style-rtl.css');
     } else {
         wp_enqueue_style('wp-native-dashboard-css', $plugin_url . '/css/style.css');
     }
     add_action('admin_head', array(&$this, 'on_admin_head'));
     add_action('wp_ajax_wp_native_dashboard_change_language', array(&$this, 'on_ajax_wp_native_dashboard_change_language'));
     add_action('wp_ajax_wp_native_dashboard_refresh_switcher', array(&$this, 'on_ajax_wp_native_dashboard_refresh_switcher'));
     $this->as_head = $as_head;
     $this->as_admin_bar = $as_admin_bar;
     global $wp_admin_bar;
     if (function_exists('is_admin_bar_showing') && is_admin_bar_showing() && $this->as_admin_bar) {
         $langs = wp_native_dashboard_collect_installed_languages();
         $loc = get_locale();
         $wp_admin_bar->add_menu(array('id' => 'wpnd-lang-cur', 'title' => '<span class="csp-' . $loc . '">' . wp_native_dashboard_get_name_of($loc) . '</span>', 'href' => '#', 'meta' => array('class' => 'csp-langoption')));
         if (count($langs) > 1) {
             foreach ($langs as $lang) {
                 if ($lang != $loc) {
                     $wp_admin_bar->add_menu(array('parent' => 'wpnd-lang-cur', 'id' => 'wpnd-lang-' . $lang, 'title' => '<span class="csp-' . $lang . '" hreflang="' . $lang . '">' . wp_native_dashboard_get_name_of($lang) . '</span>', 'href' => '#', 'meta' => array('class' => 'csp-langoption csp-langoption-adminbar')));
                 }
             }
         }
     }
     if (function_exists("admin_url")) {
         $this->admin_url = rtrim(admin_url(), '/');
     } else {
         $this->admin_url = rtrim(get_option('siteurl') . '/wp-admin/', '/');
     }
     add_action('bp_adminbar_menus', array(&$this, 'bp_adminbar_switcher_menu'), 1);
     global $wp_version;
     $this->no_dashboard_headline = version_compare($wp_version, '3.0', '>=');
 }
Exemplo n.º 24
0
/**
 * Add a nice red to the admin bar when we're in development mode
 */
function hm_dev_colorize()
{
    ?>
<style>
	
	<?php 
    if (is_admin_bar_showing()) {
        ?>
		html { 
			padding-top: 5px; 
		}
	<?php 
    }
    ?>

	#wpadminbar {
		border-top: 5px solid rgba(193, 39, 45, 1);
		-moz-box-sizing: content-box !important;
		box-sizing: content-box !important;
	}

	#wp-admin-bar-site-name > a {
		background-color: rgba(193, 39, 45, 1);
		color: #f1f1f1;
	}

</style>
<?php 
}
/**
 * Remove the comments links from the admin bar
 */
function seventeen_filter_admin_bar()
{
    if (is_admin_bar_showing()) {
        remove_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60);
        // WP 3.3
    }
}
Exemplo n.º 26
0
function theme_review_bar_scripts()
{
    if (is_admin_bar_showing()) {
        wp_enqueue_style('theme-review-dropdown-style', plugins_url('/dropdownstyle.css', __FILE__));
        wp_enqueue_script('theme-review-dropdown', plugins_url('/js/dropdown.js', __FILE__), array('jquery'));
    }
}
Exemplo n.º 27
0
function moby6_enqueue_adminbar_styles()
{
    if (is_admin_bar_showing()) {
        $modtime = filemtime(plugin_dir_path(__FILE__) . 'css/admin-bar.css');
        wp_enqueue_style('moby6-admin-bar', plugins_url('css/admin-bar.css', __FILE__), false, $modtime);
    }
}
   public static function init($toolbar)
   {
       if (is_admin() || !apply_filters('rwt_user_level', is_super_admin()) || !is_admin_bar_showing() || !class_exists('Roots\\Sage\\Wrapper\\SageWrapping')) {
           return;
       }
       // Use is_super_admin for network support.
       global $template;
       $main_template = Roots\Sage\Wrapper\SageWrapping::$main_template;
       // Chosen by the WordPress template hierarchy.
       $base_template = $template;
       // Base file selected by the Roots Wrapper.
       self::$parent = 'rwtb-templates';
       // The id for the dropdown group.
       $top = array('id' => 'rwtb', 'title' => __('Roots Wrapper', 'roots'), 'meta' => array('class' => 'roots-toolbar'));
       $group = array('parent' => 'rwtb', 'id' => 'rwtb-templates', 'meta' => array('class' => 'roots-templates'));
       $main = array('parent' => self::$parent, 'id' => 'rwtb-main', 'title' => __('Main: ', 'roots') . basename($main_template), 'meta' => array('class' => 'roots-template-main', 'title' => esc_url($main_template)));
       $base = array('parent' => self::$parent, 'id' => 'rwtb-base', 'title' => __('Base: ', 'roots') . basename($base_template), 'meta' => array('class' => 'roots-template-base', 'title' => esc_url($base_template)));
       ?>
 <style>
   #wp-admin-bar-rwtb > div:first-child:before { content: "\f115"; top: 2px; }
 </style>
 <?php 
       $toolbar->add_node($top);
       // Add the top level, group and template nodes to the toolbar.
       $toolbar->add_group($group);
       $toolbar->add_node($main);
       $toolbar->add_node($base);
   }
Exemplo n.º 29
0
/**
 * Adds an update notification to the WordPress 3.1+ Admin Bar
 */
function update_notifier_bar_menu()
{
    if (function_exists('simplexml_load_string')) {
        //Stop if simplexml_load_string funtion isn't available
        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;
        }
        global $wp_admin_bar, $wpdb;
        $xml = get_latest_theme_version(NOTIFIER_CACHE_INTERVAL);
        //Get the latest remote XML file on our server
        //support for nested point releases (such as v1.0.1) - works for versions of up to 9.9
        $latestVersion = sanitize_title(str_replace('.', '', $xml->latest));
        //1.0.1 => 101
        $latestVersion = substr($latestVersion, 0, 1) . '.' . substr($latestVersion, 1);
        //101 => 1.01
        $installedVersion = sanitize_title(str_replace('.', '', WM_THEME_VERSION));
        //1.0.1 => 101
        $installedVersion = substr($installedVersion, 0, 1) . '.' . substr($installedVersion, 1);
        //101 => 1.01
        if ((double) $latestVersion > (double) $installedVersion) {
            //Compare current theme version with the remote XML version
            $adminURL = get_admin_url() . 'themes.php?page=theme-update-notifier';
            if (class_exists('Envato_WP_Toolkit') && !isset($xml->noenvato)) {
                $adminURL = network_admin_url('admin.php?page=envato-wordpress-toolkit');
            }
            $wp_admin_bar->add_menu(array('id' => 'update_notifier', 'title' => sprintf(__('%s update', 'wm_domain'), WM_THEME_NAME) . ' <span id="ab-updates">1</span>', 'href' => $adminURL));
        }
    }
}
Exemplo n.º 30
0
function ld_more_html_classes($classes)
{
    if (is_admin_bar_showing()) {
        $classes[] = 'admin-bar';
    }
    return $classes;
}