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


PHP revisr函数代码示例

本文整理汇总了PHP中revisr函数的典型用法代码示例。如果您正苦于以下问题:PHP revisr函数的具体用法?PHP revisr怎么用?PHP revisr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: setUp

 /**
  * Set up the instance so we can run our tests.
  */
 function setUp()
 {
     $this->revisr = revisr();
     $this->revisr->git = new Revisr_Git();
     $this->revisr->db = new Revisr_DB();
     $this->revisr->admin = new Revisr_Admin();
 }
开发者ID:E-2,项目名称:Revisr,代码行数:10,代码来源:test-admin.php

示例2: run_autopull

 /**
  * Processes the "auto-pull" functionality.
  * @access public
  */
 public function run_autopull()
 {
     revisr()->git = new Revisr_Git();
     // If auto-pull isn't enabled, we definitely don't want to do this.
     if (revisr()->git->get_config('revisr', 'auto-pull') !== 'true') {
         wp_die(__('Cheatin’ uh?', 'revisr'));
     }
     // Verify the provided token matches the token stored locally.
     $remote = new Revisr_Remote();
     $remote->check_token();
     // If we're still running at this point, we've successfully authenticated.
     revisr()->git->reset();
     revisr()->git->fetch();
     // Grab the commits that need to be pulled.
     $commits_since = revisr()->git->run('log', array(revisr()->git->branch . '..' . revisr()->git->remote . '/' . revisr()->git->branch, '--pretty=oneline'));
     // Maybe backup the database.
     if (revisr()->git->get_config('revisr', 'import-pulls') === 'true') {
         revisr()->db = new Revisr_DB();
         revisr()->db->backup();
         $undo_hash = revisr()->git->current_commit();
         revisr()->git->set_config('revisr', 'last-db-backup', $undo_hash);
     }
     // Pull the changes or return an error on failure.
     revisr()->git->pull($commits_since);
 }
开发者ID:acchs,项目名称:test,代码行数:29,代码来源:class-revisr-cron.php

示例3: setUp

 /**
  * Sets up the unit tests for this class.
  * @access public
  */
 public function setUp()
 {
     $this->revisr = revisr();
     $this->revisr->git = new Revisr_Git();
     $this->revisr->db = new Revisr_DB();
     $this->import = new Revisr_DB_Import();
 }
开发者ID:rclilly,项目名称:Revisr,代码行数:11,代码来源:test-db-import.php

示例4: setUp

 /**
  * Sets up the unit tests for this class.
  * @access public
  */
 public function setUp()
 {
     $this->revisr = revisr();
     $this->revisr->git = new Revisr_Git();
     $this->revisr->db = new Revisr_DB();
     $this->backup = new Revisr_DB_Backup();
 }
开发者ID:rclilly,项目名称:Revisr,代码行数:11,代码来源:test-db-backup.php

示例5: __construct

 /**
  * Constructs the class.
  * @access public
  */
 public function __construct()
 {
     // Make WPDB available to the class.
     global $wpdb;
     $this->wpdb = $wpdb;
     $this->revisr = revisr();
     $upload_dir = wp_upload_dir();
     $this->backup_dir = $upload_dir['basedir'] . '/revisr-backups/';
     // Set up the "revisr_backups" directory if necessary.
     $this->setup_env();
 }
开发者ID:rebekahford,项目名称:testgcu,代码行数:15,代码来源:class-revisr-db.php

示例6: __construct

 /**
  * Initiate the class and add necessary action hooks.
  * @access public
  */
 public function __construct()
 {
     // Prevent PHP notices from breaking AJAX.
     if (defined('DOING_AJAX') && DOING_AJAX) {
         error_reporting(~E_NOTICE & ~E_STRICT);
     }
     // Grab the instance and load the parent class on the appropriate hook.
     $this->revisr = revisr();
     add_action('load-toplevel_page_revisr', array($this, 'load'));
     add_action('wp_ajax_revisr_get_custom_list', array($this, 'ajax_callback'));
     add_filter('set-screen-option', array($this, 'set_screen_option'), 10, 3);
 }
开发者ID:rebekahford,项目名称:testgcu,代码行数:16,代码来源:class-revisr-list-table.php

示例7: send_request

 /**
  * Sends a new HTTP request to the live site.
  * @access public
  */
 public function send_request()
 {
     $body = array('action' => 'revisr_update');
     $args = array('method' => 'POST', 'timeout' => '30', 'redirection' => '5', 'httpversion' => '1.0', 'blocking' => true, 'headers' => array(), 'body' => $body);
     // Get the URL and send the request.
     $get_url = revisr()->git->get_config('revisr', 'webhook-url');
     if ($get_url !== false) {
         $webhook = urldecode($get_url);
         $request = wp_remote_post($webhook, $args);
         if (is_wp_error($request)) {
             Revisr_Admin::log(__('Error contacting webhook URL.', 'revisr'), 'error');
         } else {
             Revisr_Admin::log(__('Sent update request to the webhook.', 'revisr'), 'push');
         }
     }
 }
开发者ID:acchs,项目名称:test,代码行数:20,代码来源:class-revisr-remote.php

示例8: view_status

 /**
  * Processes a view status request.
  * @access public
  */
 public function view_status()
 {
     Revisr_Admin::verify_nonce($_GET['revisr_status_nonce'], 'revisr_view_status');
     $status = revisr()->git->run('status', array());
     if (is_array($status)) {
         echo '<pre>';
         foreach ($status as $line) {
             echo $line . PHP_EOL;
         }
         echo '</pre>';
     } else {
         _e('Error retrieving the status of the repository.', 'revisr');
     }
 }
开发者ID:acchs,项目名称:test,代码行数:18,代码来源:class-revisr-process.php

示例9: _e

</p>
			<input type="checkbox" id="delete_remote_branch" name="delete_remote_branch">
			<label for="delete_remote_branch"><?php 
    _e('Also delete this branch from the remote repository.', 'revisr');
    ?>
</label>
		<?php 
} else {
    ?>
			<p><?php 
    printf(__('Are you sure you want to delete the remote branch <strong>%s</strong>?', 'revisr'), $branch);
    ?>
</p>
			<input type="hidden" name="delete_remote_only" value="true" />
			<?php 
    $branch = substr($branch, strlen(revisr()->git->current_remote()) + 1);
    ?>
		<?php 
}
?>

	</div>

	<div class="revisr-tb-submit">
		<input type="hidden" name="action" value="process_delete_branch">
		<input type="hidden" name="branch" value="<?php 
echo $branch;
?>
">
		<?php 
wp_nonce_field('process_delete_branch', 'revisr_delete_branch_nonce');
开发者ID:acchs,项目名称:test,代码行数:31,代码来源:delete-branch-form.php

示例10: __construct

 /**
  * Initialize the class.
  * @access public
  */
 public function __construct()
 {
     $this->revisr = revisr();
 }
开发者ID:rebekahford,项目名称:testgcu,代码行数:8,代码来源:class-revisr-settings-fields.php

示例11: get_sysinfo

 /**
  * Returns the system info.
  * @access public
  * @return string
  */
 public static function get_sysinfo()
 {
     global $wpdb;
     $return = '### Begin System Info ###' . "\n\n";
     // Basic site info
     $return .= '-- WordPress Configuration' . "\n\n";
     $return .= 'Site URL:                 ' . site_url() . "\n";
     $return .= 'Home URL:                 ' . home_url() . "\n";
     $return .= 'Multisite:                ' . (is_multisite() ? 'Yes' : 'No') . "\n";
     $return .= 'Version:                  ' . get_bloginfo('version') . "\n";
     $return .= 'Language:                 ' . (defined('WPLANG') && WPLANG ? WPLANG : 'en_US') . "\n";
     $return .= 'Table Prefix:             ' . 'Length: ' . strlen($wpdb->prefix) . "\n";
     $return .= 'WP_DEBUG:                 ' . (defined('WP_DEBUG') ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set') . "\n";
     $return .= 'Memory Limit:             ' . WP_MEMORY_LIMIT . "\n";
     // Revisr Configuration
     $return .= "\n" . '-- Revisr Configuration' . "\n\n";
     $return .= 'Plugin Version:           ' . REVISR_VERSION . "\n";
     if (isset(revisr()->options['automatic_backups']) && 'none' !== revisr()->options['automatic_backups']) {
         $backups = 'Enabled';
     } else {
         $backups = 'Disabled';
     }
     $return .= 'Automatic Backups:        ' . $backups . "\n";
     if (revisr()->git->get_config('revisr', 'auto-push') === 'true') {
         $auto_push = 'Enabled';
     } else {
         $auto_push = 'Disabled';
     }
     $return .= 'Auto-Push:                ' . $auto_push . "\n";
     if (revisr()->git->get_config('revisr', 'auto-pull') === 'true') {
         $auto_pull = 'Enabled';
     } else {
         $auto_pull = 'Disabled';
     }
     $return .= 'Auto-Pull:                ' . $auto_pull . "\n";
     if (revisr()->git->get_config('revisr', 'import-checkouts') === 'true') {
         $import_checkouts = 'Enabled';
     } else {
         $import_checkouts = 'Disabled';
     }
     $return .= 'Import checkouts:         ' . $import_checkouts . "\n";
     if (revisr()->git->get_config('revisr', 'import-pulls') === 'true') {
         $import_pulls = 'Enabled';
     } else {
         $import_pulls = 'Disabled';
     }
     $return .= 'Import pulls:             ' . $import_pulls . "\n";
     $return .= 'Work Tree:                ' . revisr()->git->get_work_tree() . "\n";
     $return .= 'Git Dir:                  ' . revisr()->git->get_git_dir() . "\n";
     if (revisr()->git->is_repo) {
         $detected = 'true';
     } else {
         $detected = 'false';
     }
     $return .= 'Repository Detected:      ' . $detected . "\n";
     if ('true' === $detected) {
         $return .= 'Repository Writable:      ' . Revisr_Compatibility::server_has_permissions(revisr()->git->get_git_dir()) . "\n";
     }
     // Server Configuration
     $return .= "\n" . '-- Server Configuration' . "\n\n";
     $os = Revisr_Compatibility::get_os();
     $return .= 'Operating System:         ' . $os['name'] . "\n";
     $return .= 'PHP Version:              ' . PHP_VERSION . "\n";
     $return .= 'MySQL Version:            ' . $wpdb->db_version() . "\n";
     $return .= 'Git Version:              ' . revisr()->git->version() . "\n";
     $return .= 'Git Install Path:         ' . Revisr_Compatibility::guess_path('git') . "\n";
     $return .= 'MySQL Install Path:       ' . Revisr_Compatibility::guess_path('mysql') . "\n";
     $return .= 'Server Software:          ' . $_SERVER['SERVER_SOFTWARE'] . "\n";
     $return .= 'Server User:              ' . Revisr_Compatibility::get_user() . "\n";
     // PHP configs... now we're getting to the important stuff
     $return .= "\n" . '-- PHP Configuration' . "\n\n";
     $return .= 'Safe Mode:                ' . (ini_get('safe_mode') ? 'Enabled' : 'Disabled' . "\n");
     if (function_exists('exec')) {
         $exec = 'Enabled';
     } else {
         $exec = 'Disabled';
     }
     $return .= 'Exec Enabled:             ' . $exec . "\n";
     $return .= 'Memory Limit:             ' . ini_get('memory_limit') . "\n";
     $return .= 'Upload Max Size:          ' . ini_get('upload_max_filesize') . "\n";
     $return .= 'Post Max Size:            ' . ini_get('post_max_size') . "\n";
     $return .= 'Upload Max Filesize:      ' . ini_get('upload_max_filesize') . "\n";
     $return .= 'Time Limit:               ' . ini_get('max_execution_time') . "\n";
     $return .= 'Max Input Vars:           ' . ini_get('max_input_vars') . "\n";
     $return .= 'Display Errors:           ' . (ini_get('display_errors') ? 'On (' . ini_get('display_errors') . ')' : 'N/A') . "\n";
     // WordPress active plugins
     $return .= "\n" . '-- WordPress Active Plugins' . "\n\n";
     $plugins = get_plugins();
     $active_plugins = get_option('active_plugins', array());
     foreach ($plugins as $plugin_path => $plugin) {
         if (!in_array($plugin_path, $active_plugins)) {
             continue;
         }
         $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n";
     }
//.........这里部分代码省略.........
开发者ID:acchs,项目名称:test,代码行数:101,代码来源:class-revisr-compatibility.php

示例12: save_commit_meta

    /**
     * Displays the "Save Commit" meta box in the sidebar.
     * @access public
     */
    public function save_commit_meta()
    {
        ?>

		<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 
        _e('Pending', 'revisr');
        ?>
</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 revisr()->git->branch;
        ?>
</strong></span>
				</div>

				<div class="misc-pub-section revisr-backup-cb">
					<span><input id="revisr-backup-cb" type="checkbox" name="backup_db" /></span>
					<label for="revisr-backup-cb"><?php 
        _e('Backup database?', 'revisr');
        ?>
</label>
				</div>

				<div class="misc-pub-section revisr-push-cb">
					<?php 
        if (revisr()->git->get_config('revisr', 'auto-push') == 'true') {
            ?>
						<input type="hidden" name="autopush_enabled" value="true" />
						<span><input id="revisr-push-cb" type="checkbox" name="auto_push" checked /></span>
					<?php 
        } else {
            ?>
						<span><input id="revisr-push-cb" type="checkbox" name="auto_push" /></span>
					<?php 
        }
        ?>
					<label for="revisr-push-cb"><?php 
        _e('Push changes?', 'revisr');
        ?>
</label>
				</div>

			</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 
        wp_nonce_field('process_commit', 'revisr_commit_nonce');
        ?>
				<input type="submit" name="publish" id="commit" class="button button-primary button-large" value="<?php 
        _e('Commit Changes', 'revisr');
        ?>
" onclick="commit_files();" accesskey="p">
			</div>
			<div class="clear"></div>
		</div>

		<?php 
    }
开发者ID:acchs,项目名称:test,代码行数:80,代码来源:class-revisr-meta-boxes.php

示例13: sprintf

            break;
        case "delete_fail":
            $msg = sprintf(esc_html__('Failed to delete branch: %s.', 'revisr'), $_GET['branch']);
            echo '<div id="revisr-alert" class="error" style="margin-top:20px;"><p>' . $msg . '</p></div>';
        default:
            // Do nothing.
    }
}
?>

	<div id="col-container" class="revisr-col-container">

		<div id="col-right">
			<form id="revisr-branch-form">
				<?php 
revisr()->branch_table->display();
?>
			</form>
		</div><!-- /#col-right -->

		<div id="col-left">
			
			<div id="revisr-add-branch-box" class="postbox">
				<h3><?php 
_e('Add New Branch', 'revisr');
?>
</h3>
				<div class="inside">
					<form id="revisr-add-branch-form" method="post" action="<?php 
echo get_admin_url() . 'admin-post.php';
?>
开发者ID:acchs,项目名称:test,代码行数:31,代码来源:branches.php

示例14: admin_bar

 /**
  * Displays the number of files changed in the admin bar.
  * @access public
  */
 public function admin_bar($wp_admin_bar)
 {
     if (revisr()->git->is_repo) {
         $untracked = revisr()->git->count_untracked();
         if ($untracked != 0) {
             $text = sprintf(_n('%d Untracked File', '%d Untracked Files', $untracked, 'revisr'), $untracked);
             $args = array('id' => 'revisr', 'title' => $text, 'href' => get_admin_url() . 'admin.php?page=revisr_new_commit', 'meta' => array('class' => 'revisr_commits'));
             $wp_admin_bar->add_node($args);
         }
         $wp_admin_bar->add_menu(array('id' => 'revisr-new-commit', 'title' => __('Commit', 'revisr'), 'parent' => 'new-content', 'href' => get_admin_url() . 'admin.php?page=revisr_new_commit'));
     }
 }
开发者ID:acchs,项目名称:test,代码行数:16,代码来源:class-revisr-admin-pages.php

示例15: esc_sql

    {
        global $wpdb;
        return esc_sql($wpdb->prefix . 'revisr');
    }
    /**
     * Installs the database table.
     * @access public
     */
    public static function install()
    {
        $table_name = Revisr::get_table_name();
        $sql = "CREATE TABLE {$table_name} (\n\t\t\tid mediumint(9) NOT NULL AUTO_INCREMENT,\n\t\t\ttime datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,\n\t\t\tmessage TEXT,\n\t\t\tevent VARCHAR(42) NOT NULL,\n\t\t\tuser VARCHAR(60),\n\t\t\tUNIQUE KEY id (id)\n\t\t\t);";
        require_once ABSPATH . 'wp-admin/includes/upgrade.php';
        dbDelta($sql);
        update_option('revisr_db_version', '2.0');
    }
}
/**
 * Returns a single instance of the Revisr plugin.
 *
 * @since 	1.8.2
 * @return 	object
 */
function revisr()
{
    return Revisr::get_instance();
}
// Let's go!
revisr();
// Register the activation hook.
register_activation_hook(__FILE__, array('Revisr', 'install'));
开发者ID:acchs,项目名称:test,代码行数:31,代码来源:revisr.php


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