Skip to content

Commit

Permalink
Bump version number to 2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
YahnisElsts committed Jul 28, 2015
1 parent 70011db commit 155eff7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 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_1', false) ):
if ( !class_exists('PucGitHubChecker_2_2', false) ):

class PucGitHubChecker_2_1 extends PluginUpdateChecker_2_1 {
class PucGitHubChecker_2_2 extends PluginUpdateChecker_2_2 {
/**
* @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_1();
$info = new PluginInfo_2_2();
$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_1 $pluginInfo
* @param PluginInfo_2_2 $pluginInfo
*/
protected function setInfoFromHeader($fileHeader, $pluginInfo) {
$headerToPropertyMap = array(
Expand Down
42 changes: 21 additions & 21 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.1.0
* Plugin Update Checker Library 2.2.0
* http://w-shadow.com/
*
* Copyright 2015 Janis Elsts
* Released under the MIT license. See license.txt for details.
*/

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

/**
* A custom plugin update checker.
*
* @author Janis Elsts
* @copyright 2015
* @version 2.1
* @version 2.2
* @access public
*/
class PluginUpdateChecker_2_1 {
class PluginUpdateChecker_2_2 {
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 @@ -230,7 +230,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_1::fromJson($result['body'], $this->debugMode);
$pluginInfo = PluginInfo_2_2::fromJson($result['body'], $this->debugMode);
$pluginInfo->filename = $this->pluginFile;
$pluginInfo->slug = $this->slug;
} else if ( $this->debugMode ) {
Expand Down Expand Up @@ -263,7 +263,7 @@ public function requestUpdate(){
if ( $pluginInfo == null ){
return null;
}
return PluginUpdate_2_1::fromPluginInfo($pluginInfo);
return PluginUpdate_2_2::fromPluginInfo($pluginInfo);
}

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

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

endif;

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

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

endif;

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

/**
* A simple container class for holding information about an available update.
*
* @author Janis Elsts
* @copyright 2015
* @version 2.1
* @version 2.2
* @access public
*/
class PluginUpdate_2_1 {
class PluginUpdate_2_2 {
public $id = 0;
public $slug;
public $version;
Expand All @@ -1050,7 +1050,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_1::fromJson($json, $triggerErrors);
$pluginInfo = PluginInfo_2_2::fromJson($json, $triggerErrors);
if ( $pluginInfo != null ) {
return self::fromPluginInfo($pluginInfo);
} else {
Expand Down Expand Up @@ -1226,23 +1226,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_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');
PucFactory::addVersion('PluginUpdateChecker', 'PluginUpdateChecker_2_2', '2.2');
PucFactory::addVersion('PluginUpdate', 'PluginUpdate_2_2', '2.2');
PucFactory::addVersion('PluginInfo', 'PluginInfo_2_2', '2.2');
PucFactory::addVersion('PucGitHubChecker', 'PucGitHubChecker_2_2', '2.2');

/**
* 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_1 { }
class PluginUpdateChecker extends PluginUpdateChecker_2_2 { }
}

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

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

0 comments on commit 155eff7

Please sign in to comment.