VaultPress::toolbar PHP Method

toolbar() public method

display a security threat notice if one exists
public toolbar ( $wp_admin_bar )
    function toolbar($wp_admin_bar)
    {
        global $wp_version;
        // these new toolbar functions were introduced in 3.3
        // http://codex.wordpress.org/Function_Reference/add_node
        if (version_compare($wp_version, '3.3', '<')) {
            return;
        }
        if (!current_user_can('manage_options')) {
            return;
        }
        $messages = $this->get_messages();
        if (!empty($messages['security_notice_count'])) {
            $count = (int) $messages['security_notice_count'];
            if ($count > 0) {
                $count = number_format($count, 0);
                $wp_admin_bar->add_node(array('id' => 'vp-notice', 'title' => '<span class="ab-icon"></span>' . sprintf(_n('%s Security Threat', '%s Security Threats', $count, 'vaultpress'), $count), 'parent' => 'top-secondary', 'href' => sprintf('https://dashboard.vaultpress.com/%d/security/', $messages['site_id']), 'meta' => array('title' => __('Visit VaultPress Security', 'vaultpress'), 'onclick' => 'window.open( this.href ); return false;', 'class' => 'error')));
            }
        }
    }
VaultPress