getVersion() public static method

Returns VersionPress version as specified in plugin metadata
public static getVersion ( ) : string
return string
Example #1
0
 public static function getAllInfo()
 {
     $output = [];
     $output['summary'] = [];
     $output['git-info'] = self::getGitInfo();
     $output['wordpress-info'] = self::getWordPressInfo();
     $output['php-info'] = self::getPhpInfo();
     $output['permission-info'] = self::getPermissionInfo();
     $output['summary']['wordpress-version'] = $output['wordpress-info']['wp-version'];
     $output['summary']['versionpress-version'] = VersionPress::getVersion();
     $output['summary']['operating-system'] = php_uname();
     $output['summary']['php-version'] = phpversion();
     $output['summary']['php-sapi'] = php_sapi_name();
     $output['summary']['git-version'] = isset($output['git-info']['git-version']) ? $output['git-info']['git-version'] : '';
     $output['summary']['git-full-path'] = isset($output['git-info']['git-full-path']) ? $output['git-info']['git-full-path'] : '';
     return $output;
 }
Example #2
0
 public static function getAllInfo()
 {
     global $versionPressContainer;
     /** @var VersionPressConfig $vpConfig */
     $vpConfig = $versionPressContainer->resolve(VersionPressServices::VP_CONFIGURATION);
     $output = array();
     $output['summary'] = array();
     $output['git-info'] = self::getGitInfo();
     $output['wordpress-info'] = self::getWordPressInfo();
     $output['php-info'] = self::getPhpInfo();
     $output['permission-info'] = self::getPermissionInfo();
     $output['summary']['wordpress-version'] = $output['wordpress-info']['wp-version'];
     $output['summary']['versionpress-version'] = VersionPress::getVersion();
     $output['summary']['operating-system'] = php_uname();
     $output['summary']['php-version'] = phpversion();
     $output['summary']['php-sapi'] = php_sapi_name();
     $output['summary']['custom-vp-config'] = $vpConfig->customConfig;
     $output['summary']['git-version'] = isset($output['git-info']['git-version']) ? $output['git-info']['git-version'] : '';
     $output['summary']['git-full-path'] = isset($output['git-info']['git-full-path']) ? $output['git-info']['git-full-path'] : '';
     return $output;
 }
function vp_enqueue_admin_styles_and_scripts()
{
    $vpVersion = VersionPress::getVersion();
    wp_enqueue_style('versionpress_admin_style', plugins_url('admin/public/css/style.css', VERSIONPRESS_PLUGIN_FILE), [], $vpVersion);
    wp_enqueue_style('versionpress_admin_icons', plugins_url('admin/public/icons/style.css', VERSIONPRESS_PLUGIN_FILE), [], $vpVersion);
    wp_enqueue_script('versionpress_admin_script', plugins_url('admin/public/js/vp-admin.js', VERSIONPRESS_PLUGIN_FILE), [], $vpVersion);
}
Example #4
0
function vp_admin_bar_warning(WP_Admin_Bar $adminBar)
{
    if (!current_user_can('activate_plugins')) {
        return;
    }
    $adminBarText = "<span style=\"color:#FF8800;font-weight:bold\">VersionPress EAP running</span>";
    $popoverTitle = "Note";
    $popoverText = "<p style='margin-top: 5px;'>You are running <strong>VersionPress " . VersionPress::getVersion() . "</strong> which is an <strong style='font-size: 1.15em;'>EAP release</strong>. Please understand that EAP releases are early versions of the software and as such might not fully support certain workflows, 3<sup>rd</sup> party plugins, hosts etc.<br /><br /><strong>We recommend that you keep a safe backup of the site at all times</strong></p>";
    $popoverText .= "<p><a href='http://docs.versionpress.net/en/release-notes' target='_blank'>Learn more about VersionPress releases</a></p>";
    $adminBar->add_node(array('id' => 'vp-running', 'title' => "<a href='#' class='ab-item' id='vp-warning'>{$adminBarText}</a>\n            <script>\n            var warning = jQuery('#vp-warning');\n            var customPopoverClass = \"versionpress-alpha\"; // used to identify the popover later\n\n            warning.webuiPopover({title:\"{$popoverTitle}\", content: \"{$popoverText}\", closeable: true, style: customPopoverClass, width:450});\n            </script>", 'parent' => 'top-secondary'));
}
<?php

use VersionPress\VersionPress;
$apiConfig = ['root' => get_home_url(), 'adminUrl' => get_admin_url(), 'urlPrefix' => rest_get_url_prefix(), 'queryParam' => 'rest_route', 'permalinkStructure' => get_option('permalink_structure'), 'nonce' => wp_create_nonce('wp_rest')];
?>
<script>
    var VP_API_Config = <?php 
echo json_encode($apiConfig);
?>
</script>

<?php 
$vpVersion = VersionPress::getVersion();
wp_enqueue_style('versionpress_gui_style', plugins_url('../public/gui/app.css', __FILE__), [], $vpVersion);
wp_enqueue_script('versionpress_gui_script', plugins_url('../public/gui/app.js', __FILE__), [], $vpVersion);
 private function doInitializationCommit($isUpdate)
 {
     $this->checkTimeout();
     // Since WP-217 the `.active` file contains not the SHA1 of the first commit that VersionPress
     // created but the one before that (which may be an empty string if VersionPress's commit
     // was the first one in the repository).
     $lastCommitHash = $this->repository->getLastCommitHash();
     file_put_contents(VERSIONPRESS_ACTIVATION_FILE, $lastCommitHash);
     $this->reportProgressChange(InitializerStates::CREATING_INITIAL_COMMIT);
     $action = $isUpdate ? 'update' : 'activate';
     $committedFiles = [["type" => "path", "path" => "*"]];
     $changeInfo = $this->changeInfoFactory->createTrackedChangeInfo('versionpress', $action, VersionPress::getVersion(), [], $committedFiles);
     $currentUser = wp_get_current_user();
     /** @noinspection PhpUndefinedFieldInspection */
     $authorName = $currentUser->display_name;
     /** @noinspection PhpUndefinedFieldInspection */
     $authorEmail = $currentUser->user_email;
     if (defined('WP_CLI') && WP_CLI) {
         $authorName = GitConfig::$wpcliUserName;
         $authorEmail = GitConfig::$wpcliUserEmail;
     }
     try {
         $this->adjustGitProcessTimeout();
         $this->repository->stageAll();
         $this->adjustGitProcessTimeout();
         $this->repository->commit($changeInfo->getCommitMessage(), $authorName, $authorEmail);
     } catch (ProcessTimedOutException $ex) {
         $this->abortInitialization();
     }
 }
 /**
  * @param TrackedChangeInfo[] $changeInfoList
  * @param string|null $version
  * @param SortingStrategy $sortingStrategy
  */
 public function __construct($changeInfoList, $version = null, $sortingStrategy = null)
 {
     $this->changeInfoList = $changeInfoList;
     $this->version = $version === null ? VersionPress::getVersion() : $version;
     $this->sortingStrategy = $sortingStrategy === null ? new SortingStrategy() : $sortingStrategy;
 }
 /**
  * @param TrackedChangeInfo[] $changeInfoList
  * @param string|null $version
  * @param string|null $environment
  */
 public function __construct($changeInfoList, $version = null, $environment = null)
 {
     $this->changeInfoList = $changeInfoList;
     $this->version = $version === null ? VersionPress::getVersion() : $version;
     $this->environment = $environment ?: VersionPress::getEnvironment();
 }