Skip to content

Commit

Permalink
Bump all version numbers to 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
YahnisElsts committed Jun 26, 2015
1 parent f4b013c commit fd5fedd
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
8 changes: 4 additions & 4 deletions github-checker.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

if ( !class_exists('PucGitHubChecker_2_0', false) ):
if ( !class_exists('PucGitHubChecker_2_1', false) ):

class PucGitHubChecker_2_0 extends PluginUpdateChecker_2_0 {
class PucGitHubChecker_2_1 extends PluginUpdateChecker_2_1 {
/**
* @var string GitHub username.
*/
Expand Down Expand Up @@ -57,7 +57,7 @@ public function __construct(
* @return PluginInfo
*/
public function requestInfo($unusedQueryArgs = array()) {
$info = new PluginInfo_2_0();
$info = new PluginInfo_2_1();
$info->filename = $this->pluginFile;
$info->slug = $this->slug;
$info->sections = array();
Expand Down Expand Up @@ -375,7 +375,7 @@ protected function getFileHeader($content) {
* Copy plugin metadata from a file header to a PluginInfo object.
*
* @param array $fileHeader
* @param PluginInfo_2_0 $pluginInfo
* @param PluginInfo_2_1 $pluginInfo
*/
protected function setInfoFromHeader($fileHeader, $pluginInfo) {
$headerToPropertyMap = array(
Expand Down
44 changes: 22 additions & 22 deletions plugin-update-checker.php
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<?php
/**
* Plugin Update Checker Library 2.0.0
* Plugin Update Checker Library 2.1.0
* http://w-shadow.com/
*
* Copyright 2015 Janis Elsts
* Released under the MIT license. See license.txt for details.
* Released under the MIT license. See license.txt for details.
*/

if ( !class_exists('PluginUpdateChecker_2_0', false) ):
if ( !class_exists('PluginUpdateChecker_2_1', false) ):

/**
* A custom plugin update checker.
*
* @author Janis Elsts
* @copyright 2015
* @version 2.0
* @version 2.1
* @access public
*/
class PluginUpdateChecker_2_0 {
class PluginUpdateChecker_2_1 {
public $metadataUrl = ''; //The URL of the plugin's metadata file.
public $pluginAbsolutePath = ''; //Full path of the main plugin file.
public $pluginFile = ''; //Plugin filename relative to the plugins directory. Many WP APIs use this to identify plugins.
Expand Down Expand Up @@ -223,7 +223,7 @@ public function requestInfo($queryArgs = array()){
//Try to parse the response
$pluginInfo = null;
if ( !is_wp_error($result) && isset($result['response']['code']) && ($result['response']['code'] == 200) && !empty($result['body']) ){
$pluginInfo = PluginInfo_2_0::fromJson($result['body'], $this->debugMode);
$pluginInfo = PluginInfo_2_1::fromJson($result['body'], $this->debugMode);
$pluginInfo->filename = $this->pluginFile;
$pluginInfo->slug = $this->slug;
} else if ( $this->debugMode ) {
Expand Down Expand Up @@ -256,7 +256,7 @@ public function requestUpdate(){
if ( $pluginInfo == null ){
return null;
}
return PluginUpdate_2_0::fromPluginInfo($pluginInfo);
return PluginUpdate_2_1::fromPluginInfo($pluginInfo);
}

/**
Expand Down Expand Up @@ -419,7 +419,7 @@ public function getUpdateState() {
}

if ( !empty($state) && isset($state->update) && is_object($state->update) ){
$state->update = PluginUpdate_2_0::fromObject($state->update);
$state->update = PluginUpdate_2_1::fromObject($state->update);
}
return $state;
}
Expand Down Expand Up @@ -854,17 +854,17 @@ public function initDebugBarPanel() {

endif;

if ( !class_exists('PluginInfo_2_0', false) ):
if ( !class_exists('PluginInfo_2_1', false) ):

/**
* A container class for holding and transforming various plugin metadata.
*
* @author Janis Elsts
* @copyright 2015
* @version 2.0
* @version 2.1
* @access public
*/
class PluginInfo_2_0 {
class PluginInfo_2_1 {
//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;
Expand Down Expand Up @@ -985,17 +985,17 @@ public function toWpFormat(){

endif;

if ( !class_exists('PluginUpdate_2_0', false) ):
if ( !class_exists('PluginUpdate_2_1', false) ):

/**
* A simple container class for holding information about an available update.
*
* @author Janis Elsts
* @copyright 2015
* @version 2.0
* @version 2.1
* @access public
*/
class PluginUpdate_2_0 {
class PluginUpdate_2_1 {
public $id = 0;
public $slug;
public $version;
Expand All @@ -1017,7 +1017,7 @@ public static function fromJson($json, $triggerErrors = false){
//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 = PluginInfo_2_0::fromJson($json, $triggerErrors);
$pluginInfo = PluginInfo_2_1::fromJson($json, $triggerErrors);
if ( $pluginInfo != null ) {
return self::fromPluginInfo($pluginInfo);
} else {
Expand Down Expand Up @@ -1193,23 +1193,23 @@ public static function addVersion($generalClass, $versionedClass, $version) {
require_once(dirname(__FILE__) . '/github-checker.php');

//Register classes defined in this file with the factory.
PucFactory::addVersion('PluginUpdateChecker', 'PluginUpdateChecker_2_0', '2.0');
PucFactory::addVersion('PluginUpdate', 'PluginUpdate_2_0', '2.0');
PucFactory::addVersion('PluginInfo', 'PluginInfo_2_0', '2.0');
PucFactory::addVersion('PucGitHubChecker', 'PucGitHubChecker_2_0', '2.0');
PucFactory::addVersion('PluginUpdateChecker', 'PluginUpdateChecker_2_1', '2.1');
PucFactory::addVersion('PluginUpdate', 'PluginUpdate_2_1', '2.1');
PucFactory::addVersion('PluginInfo', 'PluginInfo_2_1', '2.1');
PucFactory::addVersion('PucGitHubChecker', 'PucGitHubChecker_2_1', '2.1');

/**
* Create non-versioned variants of the update checker classes. This allows for backwards
* compatibility with versions that did not use a factory, and it simplifies doc-comments.
*/
if ( !class_exists('PluginUpdateChecker', false) ) {
class PluginUpdateChecker extends PluginUpdateChecker_2_0 { }
class PluginUpdateChecker extends PluginUpdateChecker_2_1 { }
}

if ( !class_exists('PluginUpdate', false) ) {
class PluginUpdate extends PluginUpdate_2_0 {}
class PluginUpdate extends PluginUpdate_2_1 {}
}

if ( !class_exists('PluginInfo', false) ) {
class PluginInfo extends PluginInfo_2_0 {}
class PluginInfo extends PluginInfo_2_1 {}
}

0 comments on commit fd5fedd

Please sign in to comment.