Bump version to 4.5 - step #1
Renaming all of the clases and updating version numbers.
This commit is contained in:
parent
e4536b4efa
commit
d460807de8
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
if ( !class_exists('Puc_v4_Factory', false) ):
|
||||
|
||||
class Puc_v4_Factory extends Puc_v4p4_Factory { }
|
||||
class Puc_v4_Factory extends Puc_v4p5_Factory { }
|
||||
|
||||
endif;
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
if ( !class_exists('Puc_v4p4_Autoloader', false) ):
|
||||
if ( !class_exists('Puc_v4p5_Autoloader', false) ):
|
||||
|
||||
class Puc_v4p4_Autoloader {
|
||||
class Puc_v4p5_Autoloader {
|
||||
private $prefix = '';
|
||||
private $rootDir = '';
|
||||
private $libraryDir = '';
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
if ( !class_exists('Puc_v4p4_DebugBar_Extension', false) ):
|
||||
if ( !class_exists('Puc_v4p5_DebugBar_Extension', false) ):
|
||||
|
||||
class Puc_v4p4_DebugBar_Extension {
|
||||
class Puc_v4p5_DebugBar_Extension {
|
||||
const RESPONSE_BODY_LENGTH_LIMIT = 4000;
|
||||
|
||||
/** @var Puc_v4p4_UpdateChecker */
|
||||
/** @var Puc_v4p5_UpdateChecker */
|
||||
protected $updateChecker;
|
||||
protected $panelClass = 'Puc_v4p4_DebugBar_Panel';
|
||||
protected $panelClass = 'Puc_v4p5_DebugBar_Panel';
|
||||
|
||||
public function __construct($updateChecker, $panelClass = null) {
|
||||
$this->updateChecker = $updateChecker;
|
||||
|
|
@ -150,11 +150,11 @@ if ( !class_exists('Puc_v4p4_DebugBar_Extension', false) ):
|
|||
$absolutePath = realpath(dirname(__FILE__) . '/../../../' . ltrim($filePath, '/'));
|
||||
|
||||
//Where is the library located inside the WordPress directory structure?
|
||||
$absolutePath = Puc_v4p4_Factory::normalizePath($absolutePath);
|
||||
$absolutePath = Puc_v4p5_Factory::normalizePath($absolutePath);
|
||||
|
||||
$pluginDir = Puc_v4p4_Factory::normalizePath(WP_PLUGIN_DIR);
|
||||
$muPluginDir = Puc_v4p4_Factory::normalizePath(WPMU_PLUGIN_DIR);
|
||||
$themeDir = Puc_v4p4_Factory::normalizePath(get_theme_root());
|
||||
$pluginDir = Puc_v4p5_Factory::normalizePath(WP_PLUGIN_DIR);
|
||||
$muPluginDir = Puc_v4p5_Factory::normalizePath(WPMU_PLUGIN_DIR);
|
||||
$themeDir = Puc_v4p5_Factory::normalizePath(get_theme_root());
|
||||
|
||||
if ( (strpos($absolutePath, $pluginDir) === 0) || (strpos($absolutePath, $muPluginDir) === 0) ) {
|
||||
//It's part of a plugin.
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
if ( !class_exists('Puc_v4p4_DebugBar_Panel', false) && class_exists('Debug_Bar_Panel', false) ):
|
||||
if ( !class_exists('Puc_v4p5_DebugBar_Panel', false) && class_exists('Debug_Bar_Panel', false) ):
|
||||
|
||||
class Puc_v4p4_DebugBar_Panel extends Debug_Bar_Panel {
|
||||
/** @var Puc_v4p4_UpdateChecker */
|
||||
class Puc_v4p5_DebugBar_Panel extends Debug_Bar_Panel {
|
||||
/** @var Puc_v4p5_UpdateChecker */
|
||||
protected $updateChecker;
|
||||
|
||||
private $responseBox = '<div class="puc-ajax-response" style="display: none;"></div>';
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
if ( !class_exists('Puc_v4p4_DebugBar_PluginExtension', false) ):
|
||||
if ( !class_exists('Puc_v4p5_DebugBar_PluginExtension', false) ):
|
||||
|
||||
class Puc_v4p4_DebugBar_PluginExtension extends Puc_v4p4_DebugBar_Extension {
|
||||
/** @var Puc_v4p4_Plugin_UpdateChecker */
|
||||
class Puc_v4p5_DebugBar_PluginExtension extends Puc_v4p5_DebugBar_Extension {
|
||||
/** @var Puc_v4p5_Plugin_UpdateChecker */
|
||||
protected $updateChecker;
|
||||
|
||||
public function __construct($updateChecker) {
|
||||
parent::__construct($updateChecker, 'Puc_v4p4_DebugBar_PluginPanel');
|
||||
parent::__construct($updateChecker, 'Puc_v4p5_DebugBar_PluginPanel');
|
||||
|
||||
add_action('wp_ajax_puc_v4_debug_request_info', array($this, 'ajaxRequestInfo'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
if ( !class_exists('Puc_v4p4_DebugBar_PluginPanel', false) ):
|
||||
if ( !class_exists('Puc_v4p5_DebugBar_PluginPanel', false) ):
|
||||
|
||||
class Puc_v4p4_DebugBar_PluginPanel extends Puc_v4p4_DebugBar_Panel {
|
||||
class Puc_v4p5_DebugBar_PluginPanel extends Puc_v4p5_DebugBar_Panel {
|
||||
/**
|
||||
* @var Puc_v4p4_Plugin_UpdateChecker
|
||||
* @var Puc_v4p5_Plugin_UpdateChecker
|
||||
*/
|
||||
protected $updateChecker;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
if ( !class_exists('Puc_v4p4_DebugBar_ThemePanel', false) ):
|
||||
if ( !class_exists('Puc_v4p5_DebugBar_ThemePanel', false) ):
|
||||
|
||||
class Puc_v4p4_DebugBar_ThemePanel extends Puc_v4p4_DebugBar_Panel {
|
||||
class Puc_v4p5_DebugBar_ThemePanel extends Puc_v4p5_DebugBar_Panel {
|
||||
/**
|
||||
* @var Puc_v4p4_Theme_UpdateChecker
|
||||
* @var Puc_v4p5_Theme_UpdateChecker
|
||||
*/
|
||||
protected $updateChecker;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
if ( !class_exists('Puc_v4p4_Factory', false) ):
|
||||
if ( !class_exists('Puc_v4p5_Factory', false) ):
|
||||
|
||||
/**
|
||||
* A factory that builds update checker instances.
|
||||
|
|
@ -11,7 +11,7 @@ if ( !class_exists('Puc_v4p4_Factory', false) ):
|
|||
* At the moment it can only build instances of the UpdateChecker class. Other classes are
|
||||
* intended mainly for internal use and refer directly to specific implementations.
|
||||
*/
|
||||
class Puc_v4p4_Factory {
|
||||
class Puc_v4p5_Factory {
|
||||
protected static $classVersions = array();
|
||||
protected static $sorted = false;
|
||||
|
||||
|
|
@ -24,7 +24,7 @@ if ( !class_exists('Puc_v4p4_Factory', false) ):
|
|||
* This method automatically detects if you're using it for a plugin or a theme and chooses
|
||||
* the appropriate implementation for your update source (JSON file, GitHub, BitBucket, etc).
|
||||
*
|
||||
* @see Puc_v4p4_UpdateChecker::__construct
|
||||
* @see Puc_v4p5_UpdateChecker::__construct
|
||||
*
|
||||
* @param string $metadataUrl The URL of the metadata file, a GitHub repository, or another supported update source.
|
||||
* @param string $fullPath Full path to the main plugin file or to the theme directory.
|
||||
|
|
@ -32,7 +32,7 @@ if ( !class_exists('Puc_v4p4_Factory', false) ):
|
|||
* @param int $checkPeriod How often to check for updates (in hours).
|
||||
* @param string $optionName Where to store book-keeping info about update checks.
|
||||
* @param string $muPluginFile The plugin filename relative to the mu-plugins directory.
|
||||
* @return Puc_v4p4_Plugin_UpdateChecker|Puc_v4p4_Theme_UpdateChecker|Puc_v4p4_Vcs_BaseChecker
|
||||
* @return Puc_v4p5_Plugin_UpdateChecker|Puc_v4p5_Theme_UpdateChecker|Puc_v4p5_Vcs_BaseChecker
|
||||
*/
|
||||
public static function buildUpdateChecker($metadataUrl, $fullPath, $slug = '', $checkPeriod = 12, $optionName = '', $muPluginFile = '') {
|
||||
$fullPath = self::normalizePath($fullPath);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
if ( !class_exists('Puc_v4p4_InstalledPackage', false) ):
|
||||
if ( !class_exists('Puc_v4p5_InstalledPackage', false) ):
|
||||
|
||||
/**
|
||||
* This class represents a currently installed plugin or theme.
|
||||
|
|
@ -7,9 +7,9 @@ if ( !class_exists('Puc_v4p4_InstalledPackage', false) ):
|
|||
* Not to be confused with the "package" field in WP update API responses that contains
|
||||
* the download URL of a the new version.
|
||||
*/
|
||||
abstract class Puc_v4p4_InstalledPackage {
|
||||
abstract class Puc_v4p5_InstalledPackage {
|
||||
/**
|
||||
* @var Puc_v4p4_UpdateChecker
|
||||
* @var Puc_v4p5_UpdateChecker
|
||||
*/
|
||||
protected $updateChecker;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
if ( !class_exists('Puc_v4p4_Metadata', false) ):
|
||||
if ( !class_exists('Puc_v4p5_Metadata', false) ):
|
||||
|
||||
/**
|
||||
* A base container for holding information about updates and plugin metadata.
|
||||
|
|
@ -8,7 +8,7 @@ if ( !class_exists('Puc_v4p4_Metadata', false) ):
|
|||
* @copyright 2016
|
||||
* @access public
|
||||
*/
|
||||
abstract class Puc_v4p4_Metadata {
|
||||
abstract class Puc_v4p5_Metadata {
|
||||
|
||||
/**
|
||||
* Create an instance of this class from a JSON document.
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
|
||||
if ( !class_exists('Puc_v4p4_OAuthSignature', false) ):
|
||||
if ( !class_exists('Puc_v4p5_OAuthSignature', false) ):
|
||||
|
||||
/**
|
||||
* A basic signature generator for zero-legged OAuth 1.0.
|
||||
*/
|
||||
class Puc_v4p4_OAuthSignature {
|
||||
class Puc_v4p5_OAuthSignature {
|
||||
private $consumerKey = '';
|
||||
private $consumerSecret = '';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
if ( !class_exists('Puc_v4p4_Plugin_Info', false) ):
|
||||
if ( !class_exists('Puc_v4p5_Plugin_Info', false) ):
|
||||
|
||||
/**
|
||||
* A container class for holding and transforming various plugin metadata.
|
||||
|
|
@ -8,7 +8,7 @@ if ( !class_exists('Puc_v4p4_Plugin_Info', false) ):
|
|||
* @copyright 2016
|
||||
* @access public
|
||||
*/
|
||||
class Puc_v4p4_Plugin_Info extends Puc_v4p4_Metadata {
|
||||
class Puc_v4p5_Plugin_Info extends Puc_v4p5_Metadata {
|
||||
//Most fields map directly to the contents of the plugin's info.json file.
|
||||
//See the relevant docs for a description of their meaning.
|
||||
public $name;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
if ( !class_exists('Puc_v4p4_Plugin_Package', false) ):
|
||||
if ( !class_exists('Puc_v4p5_Plugin_Package', false) ):
|
||||
|
||||
class Puc_v4p4_Plugin_Package extends Puc_v4p4_InstalledPackage {
|
||||
class Puc_v4p5_Plugin_Package extends Puc_v4p5_InstalledPackage {
|
||||
/**
|
||||
* @var Puc_v4p4_Plugin_UpdateChecker
|
||||
* @var Puc_v4p5_Plugin_UpdateChecker
|
||||
*/
|
||||
protected $updateChecker;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
<?php
|
||||
if ( !class_exists('Puc_v4p4_Plugin_Ui', false) ):
|
||||
if ( !class_exists('Puc_v4p5_Plugin_Ui', false) ):
|
||||
/**
|
||||
* Additional UI elements for plugins.
|
||||
*/
|
||||
class Puc_v4p4_Plugin_Ui {
|
||||
class Puc_v4p5_Plugin_Ui {
|
||||
private $updateChecker;
|
||||
private $manualCheckErrorTransient = '';
|
||||
|
||||
/**
|
||||
* @param Puc_v4p4_Plugin_UpdateChecker $updateChecker
|
||||
* @param Puc_v4p5_Plugin_UpdateChecker $updateChecker
|
||||
*/
|
||||
public function __construct($updateChecker) {
|
||||
$this->updateChecker = $updateChecker;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
if ( !class_exists('Puc_v4p4_Plugin_Update', false) ):
|
||||
if ( !class_exists('Puc_v4p5_Plugin_Update', false) ):
|
||||
|
||||
/**
|
||||
* A simple container class for holding information about an available update.
|
||||
|
|
@ -8,7 +8,7 @@ if ( !class_exists('Puc_v4p4_Plugin_Update', false) ):
|
|||
* @copyright 2016
|
||||
* @access public
|
||||
*/
|
||||
class Puc_v4p4_Plugin_Update extends Puc_v4p4_Update {
|
||||
class Puc_v4p5_Plugin_Update extends Puc_v4p5_Update {
|
||||
public $id = 0;
|
||||
public $homepage;
|
||||
public $upgrade_notice;
|
||||
|
|
@ -24,13 +24,13 @@ if ( !class_exists('Puc_v4p4_Plugin_Update', false) ):
|
|||
* Create a new instance of PluginUpdate from its JSON-encoded representation.
|
||||
*
|
||||
* @param string $json
|
||||
* @return Puc_v4p4_Plugin_Update|null
|
||||
* @return Puc_v4p5_Plugin_Update|null
|
||||
*/
|
||||
public static function fromJson($json){
|
||||
//Since update-related information is simply a subset of the full plugin info,
|
||||
//we can parse the update JSON as if it was a plugin info string, then copy over
|
||||
//the parts that we care about.
|
||||
$pluginInfo = Puc_v4p4_Plugin_Info::fromJson($json);
|
||||
$pluginInfo = Puc_v4p5_Plugin_Info::fromJson($json);
|
||||
if ( $pluginInfo !== null ) {
|
||||
return self::fromPluginInfo($pluginInfo);
|
||||
} else {
|
||||
|
|
@ -42,8 +42,8 @@ if ( !class_exists('Puc_v4p4_Plugin_Update', false) ):
|
|||
* Create a new instance of PluginUpdate based on an instance of PluginInfo.
|
||||
* Basically, this just copies a subset of fields from one object to another.
|
||||
*
|
||||
* @param Puc_v4p4_Plugin_Info $info
|
||||
* @return Puc_v4p4_Plugin_Update
|
||||
* @param Puc_v4p5_Plugin_Info $info
|
||||
* @return Puc_v4p5_Plugin_Update
|
||||
*/
|
||||
public static function fromPluginInfo($info){
|
||||
return self::fromObject($info);
|
||||
|
|
@ -52,8 +52,8 @@ if ( !class_exists('Puc_v4p4_Plugin_Update', false) ):
|
|||
/**
|
||||
* Create a new instance by copying the necessary fields from another object.
|
||||
*
|
||||
* @param StdClass|Puc_v4p4_Plugin_Info|Puc_v4p4_Plugin_Update $object The source object.
|
||||
* @return Puc_v4p4_Plugin_Update The new copy.
|
||||
* @param StdClass|Puc_v4p5_Plugin_Info|Puc_v4p5_Plugin_Update $object The source object.
|
||||
* @return Puc_v4p5_Plugin_Update The new copy.
|
||||
*/
|
||||
public static function fromObject($object) {
|
||||
$update = new self();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
if ( !class_exists('Puc_v4p4_Plugin_UpdateChecker', false) ):
|
||||
if ( !class_exists('Puc_v4p5_Plugin_UpdateChecker', false) ):
|
||||
|
||||
/**
|
||||
* A custom plugin update checker.
|
||||
|
|
@ -8,7 +8,7 @@ if ( !class_exists('Puc_v4p4_Plugin_UpdateChecker', false) ):
|
|||
* @copyright 2018
|
||||
* @access public
|
||||
*/
|
||||
class Puc_v4p4_Plugin_UpdateChecker extends Puc_v4p4_UpdateChecker {
|
||||
class Puc_v4p5_Plugin_UpdateChecker extends Puc_v4p5_UpdateChecker {
|
||||
protected $updateTransient = 'update_plugins';
|
||||
protected $translationType = 'plugin';
|
||||
|
||||
|
|
@ -17,7 +17,7 @@ if ( !class_exists('Puc_v4p4_Plugin_UpdateChecker', false) ):
|
|||
public $muPluginFile = ''; //For MU plugins, the plugin filename relative to the mu-plugins directory.
|
||||
|
||||
/**
|
||||
* @var Puc_v4p4_Plugin_Package
|
||||
* @var Puc_v4p5_Plugin_Package
|
||||
*/
|
||||
protected $package;
|
||||
|
||||
|
|
@ -68,17 +68,17 @@ if ( !class_exists('Puc_v4p4_Plugin_UpdateChecker', false) ):
|
|||
|
||||
parent::__construct($metadataUrl, dirname($this->pluginFile), $slug, $checkPeriod, $optionName);
|
||||
|
||||
$this->extraUi = new Puc_v4p4_Plugin_Ui($this);
|
||||
$this->extraUi = new Puc_v4p5_Plugin_Ui($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the scheduler.
|
||||
*
|
||||
* @param int $checkPeriod
|
||||
* @return Puc_v4p4_Scheduler
|
||||
* @return Puc_v4p5_Scheduler
|
||||
*/
|
||||
protected function createScheduler($checkPeriod) {
|
||||
$scheduler = new Puc_v4p4_Scheduler($this, $checkPeriod, array('load-plugins.php'));
|
||||
$scheduler = new Puc_v4p5_Scheduler($this, $checkPeriod, array('load-plugins.php'));
|
||||
register_deactivation_hook($this->pluginFile, array($scheduler, 'removeUpdaterCron'));
|
||||
return $scheduler;
|
||||
}
|
||||
|
|
@ -124,13 +124,13 @@ if ( !class_exists('Puc_v4p4_Plugin_UpdateChecker', false) ):
|
|||
* @uses wp_remote_get()
|
||||
*
|
||||
* @param array $queryArgs Additional query arguments to append to the request. Optional.
|
||||
* @return Puc_v4p4_Plugin_Info
|
||||
* @return Puc_v4p5_Plugin_Info
|
||||
*/
|
||||
public function requestInfo($queryArgs = array()) {
|
||||
list($pluginInfo, $result) = $this->requestMetadata('Puc_v4p4_Plugin_Info', 'request_info', $queryArgs);
|
||||
list($pluginInfo, $result) = $this->requestMetadata('Puc_v4p5_Plugin_Info', 'request_info', $queryArgs);
|
||||
|
||||
if ( $pluginInfo !== null ) {
|
||||
/** @var Puc_v4p4_Plugin_Info $pluginInfo */
|
||||
/** @var Puc_v4p5_Plugin_Info $pluginInfo */
|
||||
$pluginInfo->filename = $this->pluginFile;
|
||||
$pluginInfo->slug = $this->slug;
|
||||
}
|
||||
|
|
@ -144,7 +144,7 @@ if ( !class_exists('Puc_v4p4_Plugin_UpdateChecker', false) ):
|
|||
*
|
||||
* @uses PluginUpdateChecker::requestInfo()
|
||||
*
|
||||
* @return Puc_v4p4_Update|null An instance of Plugin_Update, or NULL when no updates are available.
|
||||
* @return Puc_v4p5_Update|null An instance of Plugin_Update, or NULL when no updates are available.
|
||||
*/
|
||||
public function requestUpdate() {
|
||||
//For the sake of simplicity, this function just calls requestInfo()
|
||||
|
|
@ -153,7 +153,7 @@ if ( !class_exists('Puc_v4p4_Plugin_UpdateChecker', false) ):
|
|||
if ( $pluginInfo === null ){
|
||||
return null;
|
||||
}
|
||||
$update = Puc_v4p4_Plugin_Update::fromPluginInfo($pluginInfo);
|
||||
$update = Puc_v4p5_Plugin_Update::fromPluginInfo($pluginInfo);
|
||||
|
||||
$update = $this->filterUpdateResult($update);
|
||||
|
||||
|
|
@ -263,12 +263,12 @@ if ( !class_exists('Puc_v4p4_Plugin_UpdateChecker', false) ):
|
|||
* Uses cached update data. To retrieve update information straight from
|
||||
* the metadata URL, call requestUpdate() instead.
|
||||
*
|
||||
* @return Puc_v4p4_Plugin_Update|null
|
||||
* @return Puc_v4p5_Plugin_Update|null
|
||||
*/
|
||||
public function getUpdate() {
|
||||
$update = parent::getUpdate();
|
||||
if ( isset($update) ) {
|
||||
/** @var Puc_v4p4_Plugin_Update $update */
|
||||
/** @var Puc_v4p5_Plugin_Update $update */
|
||||
$update->filename = $this->pluginFile;
|
||||
}
|
||||
return $update;
|
||||
|
|
@ -373,20 +373,20 @@ if ( !class_exists('Puc_v4p4_Plugin_UpdateChecker', false) ):
|
|||
}
|
||||
|
||||
protected function createDebugBarExtension() {
|
||||
return new Puc_v4p4_DebugBar_PluginExtension($this);
|
||||
return new Puc_v4p5_DebugBar_PluginExtension($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a package instance that represents this plugin or theme.
|
||||
*
|
||||
* @return Puc_v4p4_InstalledPackage
|
||||
* @return Puc_v4p5_InstalledPackage
|
||||
*/
|
||||
protected function createInstalledPackage() {
|
||||
return new Puc_v4p4_Plugin_Package($this->pluginAbsolutePath, $this);
|
||||
return new Puc_v4p5_Plugin_Package($this->pluginAbsolutePath, $this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Puc_v4p4_Plugin_Package
|
||||
* @return Puc_v4p5_Plugin_Package
|
||||
*/
|
||||
public function getInstalledPackage() {
|
||||
return $this->package;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
if ( !class_exists('Puc_v4p4_Scheduler', false) ):
|
||||
if ( !class_exists('Puc_v4p5_Scheduler', false) ):
|
||||
|
||||
/**
|
||||
* The scheduler decides when and how often to check for updates.
|
||||
* It calls @see Puc_v4p4_UpdateChecker::checkForUpdates() to perform the actual checks.
|
||||
* It calls @see Puc_v4p5_UpdateChecker::checkForUpdates() to perform the actual checks.
|
||||
*/
|
||||
class Puc_v4p4_Scheduler {
|
||||
class Puc_v4p5_Scheduler {
|
||||
public $checkPeriod = 12; //How often to check for updates (in hours).
|
||||
public $throttleRedundantChecks = false; //Check less often if we already know that an update is available.
|
||||
public $throttledCheckPeriod = 72;
|
||||
|
|
@ -13,7 +13,7 @@ if ( !class_exists('Puc_v4p4_Scheduler', false) ):
|
|||
protected $hourlyCheckHooks = array('load-update.php');
|
||||
|
||||
/**
|
||||
* @var Puc_v4p4_UpdateChecker
|
||||
* @var Puc_v4p5_UpdateChecker
|
||||
*/
|
||||
protected $updateChecker;
|
||||
|
||||
|
|
@ -22,7 +22,7 @@ if ( !class_exists('Puc_v4p4_Scheduler', false) ):
|
|||
/**
|
||||
* Scheduler constructor.
|
||||
*
|
||||
* @param Puc_v4p4_UpdateChecker $updateChecker
|
||||
* @param Puc_v4p5_UpdateChecker $updateChecker
|
||||
* @param int $checkPeriod How often to check for updates (in hours).
|
||||
* @param array $hourlyHooks
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
if ( !class_exists('Puc_v4p4_StateStore', false) ):
|
||||
if ( !class_exists('Puc_v4p5_StateStore', false) ):
|
||||
|
||||
class Puc_v4p4_StateStore {
|
||||
class Puc_v4p5_StateStore {
|
||||
/**
|
||||
* @var int Last update check timestamp.
|
||||
*/
|
||||
|
|
@ -14,7 +14,7 @@ if ( !class_exists('Puc_v4p4_StateStore', false) ):
|
|||
protected $checkedVersion = '';
|
||||
|
||||
/**
|
||||
* @var Puc_v4p4_Update|null Cached update.
|
||||
* @var Puc_v4p5_Update|null Cached update.
|
||||
*/
|
||||
protected $update = null;
|
||||
|
||||
|
|
@ -65,7 +65,7 @@ if ( !class_exists('Puc_v4p4_StateStore', false) ):
|
|||
}
|
||||
|
||||
/**
|
||||
* @return null|Puc_v4p4_Update
|
||||
* @return null|Puc_v4p5_Update
|
||||
*/
|
||||
public function getUpdate() {
|
||||
$this->lazyLoad();
|
||||
|
|
@ -73,10 +73,10 @@ if ( !class_exists('Puc_v4p4_StateStore', false) ):
|
|||
}
|
||||
|
||||
/**
|
||||
* @param Puc_v4p4_Update|null $update
|
||||
* @param Puc_v4p5_Update|null $update
|
||||
* @return $this
|
||||
*/
|
||||
public function setUpdate(Puc_v4p4_Update $update = null) {
|
||||
public function setUpdate(Puc_v4p5_Update $update = null) {
|
||||
$this->lazyLoad();
|
||||
$this->update = $update;
|
||||
return $this;
|
||||
|
|
@ -138,7 +138,7 @@ if ( !class_exists('Puc_v4p4_StateStore', false) ):
|
|||
$updateClass = get_class($this->update);
|
||||
$state->updateClass = $updateClass;
|
||||
$prefix = $this->getLibPrefix();
|
||||
if ( Puc_v4p4_Utils::startsWith($updateClass, $prefix) ) {
|
||||
if ( Puc_v4p5_Utils::startsWith($updateClass, $prefix) ) {
|
||||
$state->updateBaseClass = substr($updateClass, strlen($prefix));
|
||||
}
|
||||
}
|
||||
|
|
@ -169,8 +169,8 @@ if ( !class_exists('Puc_v4p4_StateStore', false) ):
|
|||
return;
|
||||
}
|
||||
|
||||
$this->lastCheck = intval(Puc_v4p4_Utils::get($state, 'lastCheck', 0));
|
||||
$this->checkedVersion = Puc_v4p4_Utils::get($state, 'checkedVersion', '');
|
||||
$this->lastCheck = intval(Puc_v4p5_Utils::get($state, 'lastCheck', 0));
|
||||
$this->checkedVersion = Puc_v4p5_Utils::get($state, 'checkedVersion', '');
|
||||
$this->update = null;
|
||||
|
||||
if ( isset($state->update) ) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
if ( !class_exists('Puc_v4p4_Theme_Package', false) ):
|
||||
if ( !class_exists('Puc_v4p5_Theme_Package', false) ):
|
||||
|
||||
class Puc_v4p4_Theme_Package extends Puc_v4p4_InstalledPackage {
|
||||
class Puc_v4p5_Theme_Package extends Puc_v4p5_InstalledPackage {
|
||||
/**
|
||||
* @var string Theme directory name.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
if ( !class_exists('Puc_v4p4_Theme_Update', false) ):
|
||||
if ( !class_exists('Puc_v4p5_Theme_Update', false) ):
|
||||
|
||||
class Puc_v4p4_Theme_Update extends Puc_v4p4_Update {
|
||||
class Puc_v4p5_Theme_Update extends Puc_v4p5_Update {
|
||||
public $details_url = '';
|
||||
|
||||
protected static $extraFields = array('details_url');
|
||||
|
|
@ -44,8 +44,8 @@ if ( !class_exists('Puc_v4p4_Theme_Update', false) ):
|
|||
/**
|
||||
* Create a new instance by copying the necessary fields from another object.
|
||||
*
|
||||
* @param StdClass|Puc_v4p4_Theme_Update $object The source object.
|
||||
* @return Puc_v4p4_Theme_Update The new copy.
|
||||
* @param StdClass|Puc_v4p5_Theme_Update $object The source object.
|
||||
* @return Puc_v4p5_Theme_Update The new copy.
|
||||
*/
|
||||
public static function fromObject($object) {
|
||||
$update = new self();
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
if ( !class_exists('Puc_v4p4_Theme_UpdateChecker', false) ):
|
||||
if ( !class_exists('Puc_v4p5_Theme_UpdateChecker', false) ):
|
||||
|
||||
class Puc_v4p4_Theme_UpdateChecker extends Puc_v4p4_UpdateChecker {
|
||||
class Puc_v4p5_Theme_UpdateChecker extends Puc_v4p5_UpdateChecker {
|
||||
protected $filterSuffix = 'theme';
|
||||
protected $updateTransient = 'update_themes';
|
||||
protected $translationType = 'theme';
|
||||
|
|
@ -39,13 +39,13 @@ if ( !class_exists('Puc_v4p4_Theme_UpdateChecker', false) ):
|
|||
/**
|
||||
* Retrieve the latest update (if any) from the configured API endpoint.
|
||||
*
|
||||
* @return Puc_v4p4_Update|null An instance of Update, or NULL when no updates are available.
|
||||
* @return Puc_v4p5_Update|null An instance of Update, or NULL when no updates are available.
|
||||
*/
|
||||
public function requestUpdate() {
|
||||
list($themeUpdate, $result) = $this->requestMetadata('Puc_v4p4_Theme_Update', 'request_update');
|
||||
list($themeUpdate, $result) = $this->requestMetadata('Puc_v4p5_Theme_Update', 'request_update');
|
||||
|
||||
if ( $themeUpdate !== null ) {
|
||||
/** @var Puc_v4p4_Theme_Update $themeUpdate */
|
||||
/** @var Puc_v4p5_Theme_Update $themeUpdate */
|
||||
$themeUpdate->slug = $this->slug;
|
||||
}
|
||||
|
||||
|
|
@ -61,10 +61,10 @@ if ( !class_exists('Puc_v4p4_Theme_UpdateChecker', false) ):
|
|||
* Create an instance of the scheduler.
|
||||
*
|
||||
* @param int $checkPeriod
|
||||
* @return Puc_v4p4_Scheduler
|
||||
* @return Puc_v4p5_Scheduler
|
||||
*/
|
||||
protected function createScheduler($checkPeriod) {
|
||||
return new Puc_v4p4_Scheduler($this, $checkPeriod, array('load-themes.php'));
|
||||
return new Puc_v4p5_Scheduler($this, $checkPeriod, array('load-themes.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -78,7 +78,7 @@ if ( !class_exists('Puc_v4p4_Theme_UpdateChecker', false) ):
|
|||
}
|
||||
|
||||
protected function createDebugBarExtension() {
|
||||
return new Puc_v4p4_DebugBar_Extension($this, 'Puc_v4p4_DebugBar_ThemePanel');
|
||||
return new Puc_v4p5_DebugBar_Extension($this, 'Puc_v4p5_DebugBar_ThemePanel');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -132,10 +132,10 @@ if ( !class_exists('Puc_v4p4_Theme_UpdateChecker', false) ):
|
|||
/**
|
||||
* Create a package instance that represents this plugin or theme.
|
||||
*
|
||||
* @return Puc_v4p4_InstalledPackage
|
||||
* @return Puc_v4p5_InstalledPackage
|
||||
*/
|
||||
protected function createInstalledPackage() {
|
||||
return new Puc_v4p4_Theme_Package($this->stylesheet, $this);
|
||||
return new Puc_v4p5_Theme_Package($this->stylesheet, $this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
if ( !class_exists('Puc_v4p4_Update', false) ):
|
||||
if ( !class_exists('Puc_v4p5_Update', false) ):
|
||||
|
||||
/**
|
||||
* A simple container class for holding information about an available update.
|
||||
|
|
@ -7,7 +7,7 @@ if ( !class_exists('Puc_v4p4_Update', false) ):
|
|||
* @author Janis Elsts
|
||||
* @access public
|
||||
*/
|
||||
abstract class Puc_v4p4_Update extends Puc_v4p4_Metadata {
|
||||
abstract class Puc_v4p5_Update extends Puc_v4p5_Metadata {
|
||||
public $slug;
|
||||
public $version;
|
||||
public $download_url;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
if ( !class_exists('Puc_v4p4_UpdateChecker', false) ):
|
||||
if ( !class_exists('Puc_v4p5_UpdateChecker', false) ):
|
||||
|
||||
abstract class Puc_v4p4_UpdateChecker {
|
||||
abstract class Puc_v4p5_UpdateChecker {
|
||||
protected $filterSuffix = '';
|
||||
protected $updateTransient = '';
|
||||
protected $translationType = ''; //"plugin" or "theme".
|
||||
|
|
@ -36,22 +36,22 @@ if ( !class_exists('Puc_v4p4_UpdateChecker', false) ):
|
|||
public $slug = '';
|
||||
|
||||
/**
|
||||
* @var Puc_v4p4_InstalledPackage
|
||||
* @var Puc_v4p5_InstalledPackage
|
||||
*/
|
||||
protected $package;
|
||||
|
||||
/**
|
||||
* @var Puc_v4p4_Scheduler
|
||||
* @var Puc_v4p5_Scheduler
|
||||
*/
|
||||
public $scheduler;
|
||||
|
||||
/**
|
||||
* @var Puc_v4p4_UpgraderStatus
|
||||
* @var Puc_v4p5_UpgraderStatus
|
||||
*/
|
||||
protected $upgraderStatus;
|
||||
|
||||
/**
|
||||
* @var Puc_v4p4_StateStore
|
||||
* @var Puc_v4p5_StateStore
|
||||
*/
|
||||
protected $updateState;
|
||||
|
||||
|
|
@ -79,8 +79,8 @@ if ( !class_exists('Puc_v4p4_UpdateChecker', false) ):
|
|||
|
||||
$this->package = $this->createInstalledPackage();
|
||||
$this->scheduler = $this->createScheduler($checkPeriod);
|
||||
$this->upgraderStatus = new Puc_v4p4_UpgraderStatus();
|
||||
$this->updateState = new Puc_v4p4_StateStore($this->optionName);
|
||||
$this->upgraderStatus = new Puc_v4p5_UpgraderStatus();
|
||||
$this->updateState = new Puc_v4p5_StateStore($this->optionName);
|
||||
|
||||
if ( did_action('init') ) {
|
||||
$this->loadTextDomain();
|
||||
|
|
@ -201,12 +201,12 @@ if ( !class_exists('Puc_v4p4_UpdateChecker', false) ):
|
|||
/**
|
||||
* Create a package instance that represents this plugin or theme.
|
||||
*
|
||||
* @return Puc_v4p4_InstalledPackage
|
||||
* @return Puc_v4p5_InstalledPackage
|
||||
*/
|
||||
abstract protected function createInstalledPackage();
|
||||
|
||||
/**
|
||||
* @return Puc_v4p4_InstalledPackage
|
||||
* @return Puc_v4p5_InstalledPackage
|
||||
*/
|
||||
public function getInstalledPackage() {
|
||||
return $this->package;
|
||||
|
|
@ -219,14 +219,14 @@ if ( !class_exists('Puc_v4p4_UpdateChecker', false) ):
|
|||
* and substitute their own scheduler.
|
||||
*
|
||||
* @param int $checkPeriod
|
||||
* @return Puc_v4p4_Scheduler
|
||||
* @return Puc_v4p5_Scheduler
|
||||
*/
|
||||
abstract protected function createScheduler($checkPeriod);
|
||||
|
||||
/**
|
||||
* Check for updates. The results are stored in the DB option specified in $optionName.
|
||||
*
|
||||
* @return Puc_v4p4_Update|null
|
||||
* @return Puc_v4p5_Update|null
|
||||
*/
|
||||
public function checkForUpdates() {
|
||||
$installedVersion = $this->getInstalledVersion();
|
||||
|
|
@ -260,7 +260,7 @@ if ( !class_exists('Puc_v4p4_UpdateChecker', false) ):
|
|||
/**
|
||||
* Load the update checker state from the DB.
|
||||
*
|
||||
* @return Puc_v4p4_StateStore
|
||||
* @return Puc_v4p5_StateStore
|
||||
*/
|
||||
public function getUpdateState() {
|
||||
return $this->updateState->lazyLoad();
|
||||
|
|
@ -285,7 +285,7 @@ if ( !class_exists('Puc_v4p4_UpdateChecker', false) ):
|
|||
* Uses cached update data. To retrieve update information straight from
|
||||
* the metadata URL, call requestUpdate() instead.
|
||||
*
|
||||
* @return Puc_v4p4_Update|null
|
||||
* @return Puc_v4p5_Update|null
|
||||
*/
|
||||
public function getUpdate() {
|
||||
$update = $this->updateState->getUpdate();
|
||||
|
|
@ -306,16 +306,16 @@ if ( !class_exists('Puc_v4p4_UpdateChecker', false) ):
|
|||
*
|
||||
* Subclasses should run the update through filterUpdateResult before returning it.
|
||||
*
|
||||
* @return Puc_v4p4_Update An instance of Update, or NULL when no updates are available.
|
||||
* @return Puc_v4p5_Update An instance of Update, or NULL when no updates are available.
|
||||
*/
|
||||
abstract public function requestUpdate();
|
||||
|
||||
/**
|
||||
* Filter the result of a requestUpdate() call.
|
||||
*
|
||||
* @param Puc_v4p4_Update|null $update
|
||||
* @param Puc_v4p5_Update|null $update
|
||||
* @param array|WP_Error|null $httpResult The value returned by wp_remote_get(), if any.
|
||||
* @return Puc_v4p4_Update
|
||||
* @return Puc_v4p5_Update
|
||||
*/
|
||||
protected function filterUpdateResult($update, $httpResult = null) {
|
||||
//Let plugins/themes modify the update.
|
||||
|
|
@ -338,9 +338,9 @@ if ( !class_exists('Puc_v4p4_UpdateChecker', false) ):
|
|||
* "Compatibility: Unknown".
|
||||
* The function mimics how wordpress.org API crafts the "tested" field out of "Tested up to".
|
||||
*
|
||||
* @param Puc_v4p4_Update|null $update
|
||||
* @param Puc_v4p5_Update|null $update
|
||||
*/
|
||||
protected function fixSupportedWordpressVersion(Puc_v4p4_Update $update = null) {
|
||||
protected function fixSupportedWordpressVersion(Puc_v4p5_Update $update = null) {
|
||||
if ( !isset($update->tested) || !preg_match('/^\d++\.\d++$/', $update->tested) ) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -570,7 +570,7 @@ if ( !class_exists('Puc_v4p4_UpdateChecker', false) ):
|
|||
* @param string $metaClass Parse the JSON as an instance of this class. It must have a static fromJson method.
|
||||
* @param string $filterRoot
|
||||
* @param array $queryArgs Additional query arguments.
|
||||
* @return array [Puc_v4p4_Metadata|null, array|WP_Error] A metadata instance and the value returned by wp_remote_get().
|
||||
* @return array [Puc_v4p5_Metadata|null, array|WP_Error] A metadata instance and the value returned by wp_remote_get().
|
||||
*/
|
||||
protected function requestMetadata($metaClass, $filterRoot, $queryArgs = array()) {
|
||||
//Query args to append to the URL. Plugins can add their own by using a filter callback (see addQueryArgFilter()).
|
||||
|
|
@ -909,13 +909,13 @@ if ( !class_exists('Puc_v4p4_UpdateChecker', false) ):
|
|||
}
|
||||
|
||||
protected function createDebugBarExtension() {
|
||||
return new Puc_v4p4_DebugBar_Extension($this);
|
||||
return new Puc_v4p5_DebugBar_Extension($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display additional configuration details in the Debug Bar panel.
|
||||
*
|
||||
* @param Puc_v4p4_DebugBar_Panel $panel
|
||||
* @param Puc_v4p5_DebugBar_Panel $panel
|
||||
*/
|
||||
public function onDisplayConfiguration($panel) {
|
||||
//Do nothing. Subclasses can use this to add additional info to the panel.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
if ( !class_exists('Puc_v4p4_UpgraderStatus', false) ):
|
||||
if ( !class_exists('Puc_v4p5_UpgraderStatus', false) ):
|
||||
|
||||
/**
|
||||
* A utility class that helps figure out which plugin or theme WordPress is upgrading.
|
||||
|
|
@ -8,7 +8,7 @@ if ( !class_exists('Puc_v4p4_UpgraderStatus', false) ):
|
|||
* Core classes like Plugin_Upgrader don't expose the plugin file name during an in-progress update (AFAICT).
|
||||
* This class uses a few workarounds and heuristics to get the file name.
|
||||
*/
|
||||
class Puc_v4p4_UpgraderStatus {
|
||||
class Puc_v4p5_UpgraderStatus {
|
||||
private $currentType = null; //"plugin" or "theme".
|
||||
private $currentId = null; //Plugin basename or theme directory name.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
if ( !class_exists('Puc_v4p4_Utils', false) ):
|
||||
if ( !class_exists('Puc_v4p5_Utils', false) ):
|
||||
|
||||
class Puc_v4p4_Utils {
|
||||
class Puc_v4p5_Utils {
|
||||
/**
|
||||
* Get a value from a nested array or object based on a path.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
if ( !class_exists('Puc_v4p4_Vcs_Api') ):
|
||||
if ( !class_exists('Puc_v4p5_Vcs_Api') ):
|
||||
|
||||
abstract class Puc_v4p4_Vcs_Api {
|
||||
abstract class Puc_v4p5_Vcs_Api {
|
||||
protected $tagNameProperty = 'name';
|
||||
protected $slug = '';
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ if ( !class_exists('Puc_v4p4_Vcs_Api') ):
|
|||
protected $localDirectory = null;
|
||||
|
||||
/**
|
||||
* Puc_v4p4_Vcs_Api constructor.
|
||||
* Puc_v4p5_Vcs_Api constructor.
|
||||
*
|
||||
* @param string $repositoryUrl
|
||||
* @param array|string|null $credentials
|
||||
|
|
@ -48,7 +48,7 @@ if ( !class_exists('Puc_v4p4_Vcs_Api') ):
|
|||
* Figure out which reference (i.e tag or branch) contains the latest version.
|
||||
*
|
||||
* @param string $configBranch Start looking in this branch.
|
||||
* @return null|Puc_v4p4_Vcs_Reference
|
||||
* @return null|Puc_v4p5_Vcs_Reference
|
||||
*/
|
||||
abstract public function chooseReference($configBranch);
|
||||
|
||||
|
|
@ -105,7 +105,7 @@ if ( !class_exists('Puc_v4p4_Vcs_Api') ):
|
|||
* Get a branch.
|
||||
*
|
||||
* @param string $branchName
|
||||
* @return Puc_v4p4_Vcs_Reference|null
|
||||
* @return Puc_v4p5_Vcs_Reference|null
|
||||
*/
|
||||
abstract public function getBranch($branchName);
|
||||
|
||||
|
|
@ -113,7 +113,7 @@ if ( !class_exists('Puc_v4p4_Vcs_Api') ):
|
|||
* Get a specific tag.
|
||||
*
|
||||
* @param string $tagName
|
||||
* @return Puc_v4p4_Vcs_Reference|null
|
||||
* @return Puc_v4p5_Vcs_Reference|null
|
||||
*/
|
||||
abstract public function getTag($tagName);
|
||||
|
||||
|
|
@ -121,7 +121,7 @@ if ( !class_exists('Puc_v4p4_Vcs_Api') ):
|
|||
* Get the tag that looks like the highest version number.
|
||||
* (Implementations should skip pre-release versions if possible.)
|
||||
*
|
||||
* @return Puc_v4p4_Vcs_Reference|null
|
||||
* @return Puc_v4p5_Vcs_Reference|null
|
||||
*/
|
||||
abstract public function getLatestTag();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
if ( !interface_exists('Puc_v4p4_Vcs_BaseChecker', false) ):
|
||||
if ( !interface_exists('Puc_v4p5_Vcs_BaseChecker', false) ):
|
||||
|
||||
interface Puc_v4p4_Vcs_BaseChecker {
|
||||
interface Puc_v4p5_Vcs_BaseChecker {
|
||||
/**
|
||||
* Set the repository branch to use for updates. Defaults to 'master'.
|
||||
*
|
||||
|
|
@ -19,7 +19,7 @@ if ( !interface_exists('Puc_v4p4_Vcs_BaseChecker', false) ):
|
|||
public function setAuthentication($credentials);
|
||||
|
||||
/**
|
||||
* @return Puc_v4p4_Vcs_Api
|
||||
* @return Puc_v4p5_Vcs_Api
|
||||
*/
|
||||
public function getVcsApi();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
if ( !class_exists('Puc_v4p4_Vcs_BitBucketApi', false) ):
|
||||
if ( !class_exists('Puc_v4p5_Vcs_BitBucketApi', false) ):
|
||||
|
||||
class Puc_v4p4_Vcs_BitBucketApi extends Puc_v4p4_Vcs_Api {
|
||||
class Puc_v4p5_Vcs_BitBucketApi extends Puc_v4p5_Vcs_Api {
|
||||
/**
|
||||
* @var Puc_v4p4_OAuthSignature
|
||||
* @var Puc_v4p5_OAuthSignature
|
||||
*/
|
||||
private $oauth = null;
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ if ( !class_exists('Puc_v4p4_Vcs_BitBucketApi', false) ):
|
|||
* Figure out which reference (i.e tag or branch) contains the latest version.
|
||||
*
|
||||
* @param string $configBranch Start looking in this branch.
|
||||
* @return null|Puc_v4p4_Vcs_Reference
|
||||
* @return null|Puc_v4p5_Vcs_Reference
|
||||
*/
|
||||
public function chooseReference($configBranch) {
|
||||
$updateSource = null;
|
||||
|
|
@ -59,7 +59,7 @@ if ( !class_exists('Puc_v4p4_Vcs_BitBucketApi', false) ):
|
|||
return null;
|
||||
}
|
||||
|
||||
return new Puc_v4p4_Vcs_Reference(array(
|
||||
return new Puc_v4p5_Vcs_Reference(array(
|
||||
'name' => $branch->name,
|
||||
'updated' => $branch->target->date,
|
||||
'downloadUrl' => $this->getDownloadUrl($branch->name),
|
||||
|
|
@ -70,7 +70,7 @@ if ( !class_exists('Puc_v4p4_Vcs_BitBucketApi', false) ):
|
|||
* Get a specific tag.
|
||||
*
|
||||
* @param string $tagName
|
||||
* @return Puc_v4p4_Vcs_Reference|null
|
||||
* @return Puc_v4p5_Vcs_Reference|null
|
||||
*/
|
||||
public function getTag($tagName) {
|
||||
$tag = $this->api('/refs/tags/' . $tagName);
|
||||
|
|
@ -78,7 +78,7 @@ if ( !class_exists('Puc_v4p4_Vcs_BitBucketApi', false) ):
|
|||
return null;
|
||||
}
|
||||
|
||||
return new Puc_v4p4_Vcs_Reference(array(
|
||||
return new Puc_v4p5_Vcs_Reference(array(
|
||||
'name' => $tag->name,
|
||||
'version' => ltrim($tag->name, 'v'),
|
||||
'updated' => $tag->target->date,
|
||||
|
|
@ -89,7 +89,7 @@ if ( !class_exists('Puc_v4p4_Vcs_BitBucketApi', false) ):
|
|||
/**
|
||||
* Get the tag that looks like the highest version number.
|
||||
*
|
||||
* @return Puc_v4p4_Vcs_Reference|null
|
||||
* @return Puc_v4p5_Vcs_Reference|null
|
||||
*/
|
||||
public function getLatestTag() {
|
||||
$tags = $this->api('/refs/tags?sort=-target.date');
|
||||
|
|
@ -103,7 +103,7 @@ if ( !class_exists('Puc_v4p4_Vcs_BitBucketApi', false) ):
|
|||
//Return the first result.
|
||||
if ( !empty($versionTags) ) {
|
||||
$tag = $versionTags[0];
|
||||
return new Puc_v4p4_Vcs_Reference(array(
|
||||
return new Puc_v4p5_Vcs_Reference(array(
|
||||
'name' => $tag->name,
|
||||
'version' => ltrim($tag->name, 'v'),
|
||||
'updated' => $tag->target->date,
|
||||
|
|
@ -117,7 +117,7 @@ if ( !class_exists('Puc_v4p4_Vcs_BitBucketApi', false) ):
|
|||
* Get the tag/ref specified by the "Stable tag" header in the readme.txt of a given branch.
|
||||
*
|
||||
* @param string $branch
|
||||
* @return null|Puc_v4p4_Vcs_Reference
|
||||
* @return null|Puc_v4p5_Vcs_Reference
|
||||
*/
|
||||
protected function getStableTag($branch) {
|
||||
$remoteReadme = $this->getRemoteReadme($branch);
|
||||
|
|
@ -233,7 +233,7 @@ if ( !class_exists('Puc_v4p4_Vcs_BitBucketApi', false) ):
|
|||
parent::setAuthentication($credentials);
|
||||
|
||||
if ( !empty($credentials) && !empty($credentials['consumer_key']) ) {
|
||||
$this->oauth = new Puc_v4p4_OAuthSignature(
|
||||
$this->oauth = new Puc_v4p5_OAuthSignature(
|
||||
$credentials['consumer_key'],
|
||||
$credentials['consumer_secret']
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
if ( !class_exists('Puc_v4p4_Vcs_GitHubApi', false) ):
|
||||
if ( !class_exists('Puc_v4p5_Vcs_GitHubApi', false) ):
|
||||
|
||||
class Puc_v4p4_Vcs_GitHubApi extends Puc_v4p4_Vcs_Api {
|
||||
class Puc_v4p5_Vcs_GitHubApi extends Puc_v4p5_Vcs_Api {
|
||||
/**
|
||||
* @var string GitHub username.
|
||||
*/
|
||||
|
|
@ -52,7 +52,7 @@ if ( !class_exists('Puc_v4p4_Vcs_GitHubApi', false) ):
|
|||
/**
|
||||
* Get the latest release from GitHub.
|
||||
*
|
||||
* @return Puc_v4p4_Vcs_Reference|null
|
||||
* @return Puc_v4p5_Vcs_Reference|null
|
||||
*/
|
||||
public function getLatestRelease() {
|
||||
$release = $this->api('/repos/:user/:repo/releases/latest');
|
||||
|
|
@ -60,7 +60,7 @@ if ( !class_exists('Puc_v4p4_Vcs_GitHubApi', false) ):
|
|||
return null;
|
||||
}
|
||||
|
||||
$reference = new Puc_v4p4_Vcs_Reference(array(
|
||||
$reference = new Puc_v4p5_Vcs_Reference(array(
|
||||
'name' => $release->tag_name,
|
||||
'version' => ltrim($release->tag_name, 'v'), //Remove the "v" prefix from "v1.2.3".
|
||||
'downloadUrl' => $this->signDownloadUrl($release->zipball_url),
|
||||
|
|
@ -103,7 +103,7 @@ if ( !class_exists('Puc_v4p4_Vcs_GitHubApi', false) ):
|
|||
/**
|
||||
* Get the tag that looks like the highest version number.
|
||||
*
|
||||
* @return Puc_v4p4_Vcs_Reference|null
|
||||
* @return Puc_v4p5_Vcs_Reference|null
|
||||
*/
|
||||
public function getLatestTag() {
|
||||
$tags = $this->api('/repos/:user/:repo/tags');
|
||||
|
|
@ -118,7 +118,7 @@ if ( !class_exists('Puc_v4p4_Vcs_GitHubApi', false) ):
|
|||
}
|
||||
|
||||
$tag = $versionTags[0];
|
||||
return new Puc_v4p4_Vcs_Reference(array(
|
||||
return new Puc_v4p5_Vcs_Reference(array(
|
||||
'name' => $tag->name,
|
||||
'version' => ltrim($tag->name, 'v'),
|
||||
'downloadUrl' => $this->signDownloadUrl($tag->zipball_url),
|
||||
|
|
@ -130,7 +130,7 @@ if ( !class_exists('Puc_v4p4_Vcs_GitHubApi', false) ):
|
|||
* Get a branch by name.
|
||||
*
|
||||
* @param string $branchName
|
||||
* @return null|Puc_v4p4_Vcs_Reference
|
||||
* @return null|Puc_v4p5_Vcs_Reference
|
||||
*/
|
||||
public function getBranch($branchName) {
|
||||
$branch = $this->api('/repos/:user/:repo/branches/' . $branchName);
|
||||
|
|
@ -138,7 +138,7 @@ if ( !class_exists('Puc_v4p4_Vcs_GitHubApi', false) ):
|
|||
return null;
|
||||
}
|
||||
|
||||
$reference = new Puc_v4p4_Vcs_Reference(array(
|
||||
$reference = new Puc_v4p5_Vcs_Reference(array(
|
||||
'name' => $branch->name,
|
||||
'downloadUrl' => $this->buildArchiveDownloadUrl($branch->name),
|
||||
'apiResponse' => $branch,
|
||||
|
|
@ -290,7 +290,7 @@ if ( !class_exists('Puc_v4p4_Vcs_GitHubApi', false) ):
|
|||
* Get a specific tag.
|
||||
*
|
||||
* @param string $tagName
|
||||
* @return Puc_v4p4_Vcs_Reference|null
|
||||
* @return void
|
||||
*/
|
||||
public function getTag($tagName) {
|
||||
//The current GitHub update checker doesn't use getTag, so I didn't bother to implement it.
|
||||
|
|
@ -306,7 +306,7 @@ if ( !class_exists('Puc_v4p4_Vcs_GitHubApi', false) ):
|
|||
* Figure out which reference (i.e tag or branch) contains the latest version.
|
||||
*
|
||||
* @param string $configBranch Start looking in this branch.
|
||||
* @return null|Puc_v4p4_Vcs_Reference
|
||||
* @return null|Puc_v4p5_Vcs_Reference
|
||||
*/
|
||||
public function chooseReference($configBranch) {
|
||||
$updateSource = null;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
if ( !class_exists('Puc_v4p4_Vcs_GitLabApi', false) ):
|
||||
if ( !class_exists('Puc_v4p5_Vcs_GitLabApi', false) ):
|
||||
|
||||
class Puc_v4p4_Vcs_GitLabApi extends Puc_v4p4_Vcs_Api {
|
||||
class Puc_v4p5_Vcs_GitLabApi extends Puc_v4p5_Vcs_Api {
|
||||
/**
|
||||
* @var string GitLab username.
|
||||
*/
|
||||
|
|
@ -70,7 +70,7 @@ if ( !class_exists('Puc_v4p4_Vcs_GitLabApi', false) ):
|
|||
/**
|
||||
* Get the latest release from GitLab.
|
||||
*
|
||||
* @return Puc_v4p4_Vcs_Reference|null
|
||||
* @return Puc_v4p5_Vcs_Reference|null
|
||||
*/
|
||||
public function getLatestRelease() {
|
||||
return $this->getLatestTag();
|
||||
|
|
@ -79,7 +79,7 @@ if ( !class_exists('Puc_v4p4_Vcs_GitLabApi', false) ):
|
|||
/**
|
||||
* Get the tag that looks like the highest version number.
|
||||
*
|
||||
* @return Puc_v4p4_Vcs_Reference|null
|
||||
* @return Puc_v4p5_Vcs_Reference|null
|
||||
*/
|
||||
public function getLatestTag() {
|
||||
$tags = $this->api('/:id/repository/tags');
|
||||
|
|
@ -93,7 +93,7 @@ if ( !class_exists('Puc_v4p4_Vcs_GitLabApi', false) ):
|
|||
}
|
||||
|
||||
$tag = $versionTags[0];
|
||||
return new Puc_v4p4_Vcs_Reference(array(
|
||||
return new Puc_v4p5_Vcs_Reference(array(
|
||||
'name' => $tag->name,
|
||||
'version' => ltrim($tag->name, 'v'),
|
||||
'downloadUrl' => $this->buildArchiveDownloadUrl($tag->name),
|
||||
|
|
@ -105,7 +105,7 @@ if ( !class_exists('Puc_v4p4_Vcs_GitLabApi', false) ):
|
|||
* Get a branch by name.
|
||||
*
|
||||
* @param string $branchName
|
||||
* @return null|Puc_v4p4_Vcs_Reference
|
||||
* @return null|Puc_v4p5_Vcs_Reference
|
||||
*/
|
||||
public function getBranch($branchName) {
|
||||
$branch = $this->api('/:id/repository/branches/' . $branchName);
|
||||
|
|
@ -113,7 +113,7 @@ if ( !class_exists('Puc_v4p4_Vcs_GitLabApi', false) ):
|
|||
return null;
|
||||
}
|
||||
|
||||
$reference = new Puc_v4p4_Vcs_Reference(array(
|
||||
$reference = new Puc_v4p5_Vcs_Reference(array(
|
||||
'name' => $branch->name,
|
||||
'downloadUrl' => $this->buildArchiveDownloadUrl($branch->name),
|
||||
'apiResponse' => $branch,
|
||||
|
|
@ -251,7 +251,7 @@ if ( !class_exists('Puc_v4p4_Vcs_GitLabApi', false) ):
|
|||
* Get a specific tag.
|
||||
*
|
||||
* @param string $tagName
|
||||
* @return Puc_v4p4_Vcs_Reference|null
|
||||
* @return void
|
||||
*/
|
||||
public function getTag($tagName) {
|
||||
throw new LogicException('The ' . __METHOD__ . ' method is not implemented and should not be used.');
|
||||
|
|
@ -261,7 +261,7 @@ if ( !class_exists('Puc_v4p4_Vcs_GitLabApi', false) ):
|
|||
* Figure out which reference (i.e tag or branch) contains the latest version.
|
||||
*
|
||||
* @param string $configBranch Start looking in this branch.
|
||||
* @return null|Puc_v4p4_Vcs_Reference
|
||||
* @return null|Puc_v4p5_Vcs_Reference
|
||||
*/
|
||||
public function chooseReference($configBranch) {
|
||||
$updateSource = null;
|
||||
|
|
|
|||
|
|
@ -1,21 +1,21 @@
|
|||
<?php
|
||||
if ( !class_exists('Puc_v4p4_Vcs_PluginUpdateChecker') ):
|
||||
if ( !class_exists('Puc_v4p5_Vcs_PluginUpdateChecker') ):
|
||||
|
||||
class Puc_v4p4_Vcs_PluginUpdateChecker extends Puc_v4p4_Plugin_UpdateChecker implements Puc_v4p4_Vcs_BaseChecker {
|
||||
class Puc_v4p5_Vcs_PluginUpdateChecker extends Puc_v4p5_Plugin_UpdateChecker implements Puc_v4p5_Vcs_BaseChecker {
|
||||
/**
|
||||
* @var string The branch where to look for updates. Defaults to "master".
|
||||
*/
|
||||
protected $branch = 'master';
|
||||
|
||||
/**
|
||||
* @var Puc_v4p4_Vcs_Api Repository API client.
|
||||
* @var Puc_v4p5_Vcs_Api Repository API client.
|
||||
*/
|
||||
protected $api = null;
|
||||
|
||||
/**
|
||||
* Puc_v4p4_Vcs_PluginUpdateChecker constructor.
|
||||
* Puc_v4p5_Vcs_PluginUpdateChecker constructor.
|
||||
*
|
||||
* @param Puc_v4p4_Vcs_Api $api
|
||||
* @param Puc_v4p5_Vcs_Api $api
|
||||
* @param string $pluginFile
|
||||
* @param string $slug
|
||||
* @param int $checkPeriod
|
||||
|
|
@ -41,7 +41,7 @@ if ( !class_exists('Puc_v4p4_Vcs_PluginUpdateChecker') ):
|
|||
$api = $this->api;
|
||||
$api->setLocalDirectory($this->package->getAbsoluteDirectoryPath());
|
||||
|
||||
$info = new Puc_v4p4_Plugin_Info();
|
||||
$info = new Puc_v4p5_Plugin_Info();
|
||||
$info->filename = $this->pluginFile;
|
||||
$info->slug = $this->slug;
|
||||
|
||||
|
|
@ -124,7 +124,7 @@ if ( !class_exists('Puc_v4p4_Vcs_PluginUpdateChecker') ):
|
|||
* Copy plugin metadata from a file header to a Plugin Info object.
|
||||
*
|
||||
* @param array $fileHeader
|
||||
* @param Puc_v4p4_Plugin_Info $pluginInfo
|
||||
* @param Puc_v4p5_Plugin_Info $pluginInfo
|
||||
*/
|
||||
protected function setInfoFromHeader($fileHeader, $pluginInfo) {
|
||||
$headerToPropertyMap = array(
|
||||
|
|
@ -155,7 +155,7 @@ if ( !class_exists('Puc_v4p4_Vcs_PluginUpdateChecker') ):
|
|||
* Copy plugin metadata from the remote readme.txt file.
|
||||
*
|
||||
* @param string $ref GitHub tag or branch where to look for the readme.
|
||||
* @param Puc_v4p4_Plugin_Info $pluginInfo
|
||||
* @param Puc_v4p5_Plugin_Info $pluginInfo
|
||||
*/
|
||||
protected function setInfoFromRemoteReadme($ref, $pluginInfo) {
|
||||
$readme = $this->api->getRemoteReadme($ref);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
if ( !class_exists('Puc_v4p4_Vcs_Reference', false) ):
|
||||
if ( !class_exists('Puc_v4p5_Vcs_Reference', false) ):
|
||||
|
||||
/**
|
||||
* This class represents a VCS branch or tag. It's intended as a read only, short-lived container
|
||||
|
|
@ -13,7 +13,7 @@ if ( !class_exists('Puc_v4p4_Vcs_Reference', false) ):
|
|||
* @property string|null $changelog
|
||||
* @property int|null $downloadCount
|
||||
*/
|
||||
class Puc_v4p4_Vcs_Reference {
|
||||
class Puc_v4p5_Vcs_Reference {
|
||||
private $properties = array();
|
||||
|
||||
public function __construct($properties = array()) {
|
||||
|
|
|
|||
|
|
@ -1,22 +1,22 @@
|
|||
<?php
|
||||
|
||||
if ( !class_exists('Puc_v4p4_Vcs_ThemeUpdateChecker', false) ):
|
||||
if ( !class_exists('Puc_v4p5_Vcs_ThemeUpdateChecker', false) ):
|
||||
|
||||
class Puc_v4p4_Vcs_ThemeUpdateChecker extends Puc_v4p4_Theme_UpdateChecker implements Puc_v4p4_Vcs_BaseChecker {
|
||||
class Puc_v4p5_Vcs_ThemeUpdateChecker extends Puc_v4p5_Theme_UpdateChecker implements Puc_v4p5_Vcs_BaseChecker {
|
||||
/**
|
||||
* @var string The branch where to look for updates. Defaults to "master".
|
||||
*/
|
||||
protected $branch = 'master';
|
||||
|
||||
/**
|
||||
* @var Puc_v4p4_Vcs_Api Repository API client.
|
||||
* @var Puc_v4p5_Vcs_Api Repository API client.
|
||||
*/
|
||||
protected $api = null;
|
||||
|
||||
/**
|
||||
* Puc_v4p4_Vcs_ThemeUpdateChecker constructor.
|
||||
* Puc_v4p5_Vcs_ThemeUpdateChecker constructor.
|
||||
*
|
||||
* @param Puc_v4p4_Vcs_Api $api
|
||||
* @param Puc_v4p5_Vcs_Api $api
|
||||
* @param null $stylesheet
|
||||
* @param null $customSlug
|
||||
* @param int $checkPeriod
|
||||
|
|
@ -35,7 +35,7 @@ if ( !class_exists('Puc_v4p4_Vcs_ThemeUpdateChecker', false) ):
|
|||
$api = $this->api;
|
||||
$api->setLocalDirectory($this->package->getAbsoluteDirectoryPath());
|
||||
|
||||
$update = new Puc_v4p4_Theme_Update();
|
||||
$update = new Puc_v4p5_Theme_Update();
|
||||
$update->slug = $this->slug;
|
||||
|
||||
//Figure out which reference (tag or branch) we'll use to get the latest version of the theme.
|
||||
|
|
@ -60,13 +60,13 @@ if ( !class_exists('Puc_v4p4_Vcs_ThemeUpdateChecker', false) ):
|
|||
//Get headers from the main stylesheet in this branch/tag. Its "Version" header and other metadata
|
||||
//are what the WordPress install will actually see after upgrading, so they take precedence over releases/tags.
|
||||
$remoteHeader = $this->package->getFileHeader($api->getRemoteFile('style.css', $ref));
|
||||
$update->version = Puc_v4p4_Utils::findNotEmpty(array(
|
||||
$update->version = Puc_v4p5_Utils::findNotEmpty(array(
|
||||
$remoteHeader['Version'],
|
||||
Puc_v4p4_Utils::get($updateSource, 'version'),
|
||||
Puc_v4p5_Utils::get($updateSource, 'version'),
|
||||
));
|
||||
|
||||
//The details URL defaults to the Theme URI header or the repository URL.
|
||||
$update->details_url = Puc_v4p4_Utils::findNotEmpty(array(
|
||||
$update->details_url = Puc_v4p5_Utils::findNotEmpty(array(
|
||||
$remoteHeader['ThemeURI'],
|
||||
$this->package->getHeaderValue('ThemeURI'),
|
||||
$this->metadataUrl,
|
||||
|
|
|
|||
|
|
@ -236,8 +236,8 @@ BitBucket doesn't have an equivalent to GitHub's releases, so the process is sli
|
|||
);
|
||||
|
||||
//Note: Self-hosted instances of GitLab must be initialized like this:
|
||||
$myUpdateChecker = new Puc_v4p4_Vcs_PluginUpdateChecker(
|
||||
new Puc_v4p4_Vcs_GitLabApi('https://myserver.com/user-name/repo-name/'),
|
||||
$myUpdateChecker = new Puc_v4p5_Vcs_PluginUpdateChecker(
|
||||
new Puc_v4p5_Vcs_GitLabApi('https://myserver.com/user-name/repo-name/'),
|
||||
__FILE__,
|
||||
'unique-plugin-or-theme-slug'
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,24 +1,24 @@
|
|||
<?php
|
||||
/**
|
||||
* Plugin Update Checker Library 4.4
|
||||
* Plugin Update Checker Library 4.5
|
||||
* http://w-shadow.com/
|
||||
*
|
||||
* Copyright 2017 Janis Elsts
|
||||
* Copyright 2019 Janis Elsts
|
||||
* Released under the MIT license. See license.txt for details.
|
||||
*/
|
||||
|
||||
require dirname(__FILE__) . '/Puc/v4p4/Factory.php';
|
||||
require dirname(__FILE__) . '/Puc/v4/Factory.php';
|
||||
require dirname(__FILE__) . '/Puc/v4p4/Autoloader.php';
|
||||
new Puc_v4p4_Autoloader();
|
||||
new Puc_v4p5_Autoloader();
|
||||
|
||||
//Register classes defined in this file with the factory.
|
||||
Puc_v4_Factory::addVersion('Plugin_UpdateChecker', 'Puc_v4p4_Plugin_UpdateChecker', '4.4');
|
||||
Puc_v4_Factory::addVersion('Theme_UpdateChecker', 'Puc_v4p4_Theme_UpdateChecker', '4.4');
|
||||
Puc_v4_Factory::addVersion('Plugin_UpdateChecker', 'Puc_v4p5_Plugin_UpdateChecker', '4.5');
|
||||
Puc_v4_Factory::addVersion('Theme_UpdateChecker', 'Puc_v4p5_Theme_UpdateChecker', '4.5');
|
||||
|
||||
Puc_v4_Factory::addVersion('Vcs_PluginUpdateChecker', 'Puc_v4p4_Vcs_PluginUpdateChecker', '4.4');
|
||||
Puc_v4_Factory::addVersion('Vcs_ThemeUpdateChecker', 'Puc_v4p4_Vcs_ThemeUpdateChecker', '4.4');
|
||||
Puc_v4_Factory::addVersion('Vcs_PluginUpdateChecker', 'Puc_v4p5_Vcs_PluginUpdateChecker', '4.5');
|
||||
Puc_v4_Factory::addVersion('Vcs_ThemeUpdateChecker', 'Puc_v4p5_Vcs_ThemeUpdateChecker', '4.5');
|
||||
|
||||
Puc_v4_Factory::addVersion('GitHubApi', 'Puc_v4p4_Vcs_GitHubApi', '4.4');
|
||||
Puc_v4_Factory::addVersion('BitBucketApi', 'Puc_v4p4_Vcs_BitBucketApi', '4.4');
|
||||
Puc_v4_Factory::addVersion('GitLabApi', 'Puc_v4p4_Vcs_GitLabApi', '4.4');
|
||||
Puc_v4_Factory::addVersion('GitHubApi', 'Puc_v4p5_Vcs_GitHubApi', '4.5');
|
||||
Puc_v4_Factory::addVersion('BitBucketApi', 'Puc_v4p5_Vcs_BitBucketApi', '4.5');
|
||||
Puc_v4_Factory::addVersion('GitLabApi', 'Puc_v4p5_Vcs_GitLabApi', '4.5');
|
||||
Loading…
Reference in New Issue