/**
  * Displays the number of files changed in the admin bar.
  * @access public
  */
 public function admin_bar($wp_admin_bar)
 {
     if (Revisr_Git::count_pending() != 0) {
         $untracked = Revisr_Git::count_pending();
         $text = sprintf(_n('%s Untracked File', '%s Untracked Files', $untracked, 'revisr'), $untracked);
         $args = array('id' => 'revisr', 'title' => $text, 'href' => get_admin_url() . 'post-new.php?post_type=revisr_commits', 'meta' => array('class' => 'revisr_commits'));
         $wp_admin_bar->add_node($args);
     }
 }
Example #2
0
wp_localize_script('revisr_dashboard', 'dashboard_vars', array('ajax_nonce' => wp_create_nonce('dashboard_nonce')));
?>
<div class="wrap">
	
	<div id="icon-options-general" class="icon32"></div>
	<h2><?php 
_e('Revisr - Dashboard', 'revisr');
?>
</h2>
	
	<?php 
$error = Revisr::check_compatibility();
if ($error != '') {
    echo "<div id='revisr_error' class='error'>{$error}</div>";
} else {
    $pending = Revisr_Git::count_pending();
    if (isset($_GET['revert_db']) && $_GET['revert_db'] == 'success') {
        $text = "<p>" . __('Successfully reverted the database.', 'revisr') . "</p>";
    } else {
        if (isset($_GET['checkout']) && $_GET['checkout'] == 'success') {
            $text = sprintf(__('<p>Successfully checked out branch <strong>%s</strong>.</p>', 'revisr'), $_GET['branch']);
        } else {
            if (isset($_GET['revert']) && $_GET['revert'] == 'success') {
                $url = get_admin_url() . "post.php?post={$_GET['id']}&action=edit";
                $text = "<p>Successfully reverted to commit <a href='{$url}'><strong>#{$_GET['commit']}</strong></a>.</p>";
            } else {
                if ($pending != 0) {
                    if ($pending == 1) {
                        $text = sprintf(__('<p>There is currently <strong>1</strong> untracked file on branch <strong>%s</strong>.</p>', 'revisr'), Revisr_Git::current_branch());
                    } else {
                        $text = sprintf(__('<p>There are currently <strong>%d</strong> untracked files on branch <strong>%s</strong>.</p>', 'revisr'), $pending, Revisr_Git::current_branch());