Пример #1
0
/**
 * revert-form.php
 *
 * Displays the form to revert to a specific commit.
 *
 * @package 	Revisr
 * @license 	GPLv3
 * @link 		https://revisr.io
 * @copyright 	Expanded Fronts, LLC
 */
// Disallow direct access.
if (!defined('ABSPATH')) {
    exit;
}
$commit = Revisr_Git::get_commit_details($_GET['commit']);
$styles_url = REVISR_URL . 'assets/css/thickbox.css?v=' . REVISR_VERSION;
?>

	<link href="<?php 
echo $styles_url;
?>
" rel="stylesheet" type="text/css">

	<form action="<?php 
echo get_admin_url() . 'admin-post.php';
?>
" method="post">

		<div class="revisr-tb-description">
Пример #2
0
 * view-commit.php
 *
 * Displays details on an existing commit.
 *
 * @package 	Revisr
 * @license 	GPLv3
 * @link		https://revisr.io
 * @copyright 	Expanded Fronts, LLC
 */
// Prevent direct access.
if (!defined('ABSPATH')) {
    exit;
}
// Get details about the commit.
$commit_hash = isset($_GET['commit']) ? esc_attr($_GET['commit']) : '';
$commit = Revisr_Git::get_commit_details($commit_hash);
$subject = esc_attr($commit['subject']);
?>

<div class="wrap">

    <h1><?php 
_e('View Commit', 'revisr');
?>
 <a href="<?php 
echo get_admin_url();
?>
admin.php?page=revisr_new_commit" class="page-title-action"><?php 
_e('Add New', 'revisr');
?>
</a></h1>
Пример #3
0
    /**
     * Displays the "Commit Details" meta box on a previous commit.
     * @access public
     */
    public function view_commit_meta()
    {
        // Get details about the commit.
        $commit_hash = isset($_GET['commit']) ? esc_attr($_GET['commit']) : '';
        $commit = Revisr_Git::get_commit_details($commit_hash);
        $revert_url = get_admin_url() . 'admin-post.php?action=revisr_revert_form&commit=' . $commit_hash . '&TB_iframe=true&width=350&height=200';
        $time_format = __('M j, Y @ G:i');
        $timestamp = sprintf(__('Committed on: <strong>%s</strong>', 'revisr'), date_i18n($time_format, $commit['time']));
        if (false === $commit['status']) {
            $commit['status'] = __('Error', 'revisr');
            $revert_btn = '<a class="button button-primary disabled" href="#">' . __('Revert to this Commit', 'revisr') . '</a>';
        } else {
            $revert_btn = '<a class="button button-primary thickbox" href="' . $revert_url . '" title="' . __('Revert', 'revisr') . '">' . __('Revert to this Commit', 'revisr') . '</a>';
        }
        ?>
		<div id="minor-publishing">
			<div id="misc-publishing-actions">

				<div class="misc-pub-section revisr-pub-status">
					<label for="post_status"><?php 
        _e('Status:', 'revisr');
        ?>
</label>
					<span><strong><?php 
        echo $commit['status'];
        ?>
</strong></span>
				</div>

				<div class="misc-pub-section revisr-pub-branch">
					<label for="revisr-branch" class="revisr-octicon-label"><?php 
        _e('Branch:', 'revisr');
        ?>
</label>
					<span><strong><?php 
        echo $commit['branch'];
        ?>
</strong></span>
				</div>

				<div class="misc-pub-section curtime misc-pub-curtime">
					<span id="timestamp" class="revisr-timestamp"><?php 
        echo $timestamp;
        ?>
</span>
				</div>

				<?php 
        if ($commit['tag'] !== '') {
            ?>
				<div class="misc-pub-section revisr-git-tag">
					<label for="revisr-tag" class="revisr-octicon-label"><?php 
            _e('Tagged:', 'revisr');
            ?>
</label>
					<span><strong><?php 
            echo $commit['tag'];
            ?>
</strong></span>
				</div>
				<?php 
        }
        ?>

			</div><!-- /#misc-publishing-actions -->
		</div>

		<div id="major-publishing-actions">
			<div id="delete-action"></div>
			<div id="publishing-action">
				<span id="revisr-spinner" class="spinner"></span>
				<?php 
        echo $revert_btn;
        ?>
			</div>
			<div class="clear"></div>
		</div>
		<?php 
    }
Пример #4
0
 /**
  * Tests the Revisr_Git::get_commit_details() method.
  */
 function test_get_commit_details()
 {
     $commit = Revisr_Git::get_commit_details('abc1234');
     $this->assertArrayHasKey('hash', $commit);
     $this->assertArrayHasKey('branch', $commit);
     $this->assertArrayHasKey('author', $commit);
     $this->assertArrayHasKey('subject', $commit);
     $this->assertArrayHasKey('time', $commit);
     $this->assertArrayHasKey('files_changed', $commit);
     $this->assertArrayHasKey('committed_files', $commit);
     $this->assertArrayHasKey('tag', $commit);
     $this->assertArrayHasKey('status', $commit);
 }