Skip to content

Commit

Permalink
Merge pull request #937 from 10up/feature/update-plugin-updater
Browse files Browse the repository at this point in the history
Update `yahnis-elsts/plugin-update-checker` from 4.9 to 4.13
# Conflicts:
#	composer.json
#	composer.lock
  • Loading branch information
peterwilsoncc committed Sep 26, 2022
1 parent e0f5410 commit 7e6d0a5
Show file tree
Hide file tree
Showing 81 changed files with 1,669 additions and 378 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
],
"require": {
"php": ">=5.6",
"yahnis-elsts/plugin-update-checker": "4.9",
"yahnis-elsts/plugin-update-checker": "4.13",
"georgestephanis/application-passwords": "0.1.3",
"ext-json": "*"
},
Expand Down
18 changes: 11 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions vendor/yahnis-elsts/plugin-update-checker/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Created by .ignore support plugin (hsz.mobi)
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# The entire IDEA/PhpStorm directory
.idea/

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
if ( !class_exists('Puc_v4_Factory', false) ):

class Puc_v4_Factory extends Puc_v4p9_Factory { }
class Puc_v4_Factory extends Puc_v4p13_Factory { }

endif;
70 changes: 70 additions & 0 deletions vendor/yahnis-elsts/plugin-update-checker/Puc/v4p13/Autoloader.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php

if ( !class_exists('Puc_v4p13_Autoloader', false) ):

class Puc_v4p13_Autoloader {
private $prefix = '';
private $rootDir = '';
private $libraryDir = '';

private $staticMap;

public function __construct() {
$this->rootDir = dirname(__FILE__) . '/';

if ( version_compare(PHP_VERSION, '5.3', '>=') && __NAMESPACE__ ) {
$namespaceWithSlash = __NAMESPACE__ . '\\';
} else {
$namespaceWithSlash = '';
}

$nameParts = explode('_', substr(__CLASS__, strlen($namespaceWithSlash)), 3);
$this->prefix = $namespaceWithSlash . $nameParts[0] . '_' . $nameParts[1] . '_';

$this->libraryDir = $this->rootDir . '../..';
if ( !self::isPhar() ) {
$this->libraryDir = realpath($this->libraryDir);
}
$this->libraryDir = $this->libraryDir . '/';

$this->staticMap = array(
$namespaceWithSlash . 'PucReadmeParser' => 'vendor/PucReadmeParser.php',
$namespaceWithSlash . 'Parsedown' => 'vendor/Parsedown.php',
$namespaceWithSlash . 'Puc_v4_Factory' => 'Puc/v4/Factory.php',
);

spl_autoload_register(array($this, 'autoload'));
}

/**
* Determine if this file is running as part of a Phar archive.
*
* @return bool
*/
private static function isPhar() {
//Check if the current file path starts with "phar://".
static $pharProtocol = 'phar://';
return (substr(__FILE__, 0, strlen($pharProtocol)) === $pharProtocol);
}

public function autoload($className) {
if ( isset($this->staticMap[$className]) && file_exists($this->libraryDir . $this->staticMap[$className]) ) {
/** @noinspection PhpIncludeInspection */
include ($this->libraryDir . $this->staticMap[$className]);
return;
}

if (strpos($className, $this->prefix) === 0) {
$path = substr($className, strlen($this->prefix));
$path = str_replace('_', '/', $path);
$path = $this->rootDir . $path . '.php';

if (file_exists($path)) {
/** @noinspection PhpIncludeInspection */
include $path;
}
}
}
}

endif;
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
<?php
if ( !class_exists('Puc_v4p9_DebugBar_Extension', false) ):
if ( !class_exists('Puc_v4p13_DebugBar_Extension', false) ):

class Puc_v4p9_DebugBar_Extension {
class Puc_v4p13_DebugBar_Extension {
const RESPONSE_BODY_LENGTH_LIMIT = 4000;

/** @var Puc_v4p9_UpdateChecker */
/** @var Puc_v4p13_UpdateChecker */
protected $updateChecker;
protected $panelClass = 'Puc_v4p9_DebugBar_Panel';
protected $panelClass = 'Puc_v4p13_DebugBar_Panel';

public function __construct($updateChecker, $panelClass = null) {
$this->updateChecker = $updateChecker;
if ( isset($panelClass) ) {
$this->panelClass = $panelClass;
}

if ( version_compare(PHP_VERSION, '5.3', '>=') && (strpos($this->panelClass, '\\') === false) ) {
$this->panelClass = __NAMESPACE__ . '\\' . $this->panelClass;
}

add_filter('debug_bar_panels', array($this, 'addDebugBarPanel'));
add_action('debug_bar_enqueue_scripts', array($this, 'enqueuePanelDependencies'));

Expand Down Expand Up @@ -48,7 +52,7 @@ public function enqueuePanelDependencies() {
'puc-debug-bar-js-v4',
$this->getLibraryUrl("/js/debug-bar.js"),
array('jquery'),
'20170516'
'20201209'
);
}

Expand Down Expand Up @@ -142,6 +146,15 @@ protected function preAjaxRequest() {
@ini_set('display_errors', 'On');
}

/**
* Remove hooks that were added by this extension.
*/
public function removeHooks() {
remove_filter('debug_bar_panels', array($this, 'addDebugBarPanel'));
remove_action('debug_bar_enqueue_scripts', array($this, 'enqueuePanelDependencies'));
remove_action('wp_ajax_puc_v4_debug_check_now', array($this, 'ajaxCheckNow'));
}

/**
* @param string $filePath
* @return string
Expand All @@ -150,11 +163,11 @@ private function getLibraryUrl($filePath) {
$absolutePath = realpath(dirname(__FILE__) . '/../../../' . ltrim($filePath, '/'));

//Where is the library located inside the WordPress directory structure?
$absolutePath = Puc_v4p9_Factory::normalizePath($absolutePath);
$absolutePath = Puc_v4p13_Factory::normalizePath($absolutePath);

$pluginDir = Puc_v4p9_Factory::normalizePath(WP_PLUGIN_DIR);
$muPluginDir = Puc_v4p9_Factory::normalizePath(WPMU_PLUGIN_DIR);
$themeDir = Puc_v4p9_Factory::normalizePath(get_theme_root());
$pluginDir = Puc_v4p13_Factory::normalizePath(WP_PLUGIN_DIR);
$muPluginDir = Puc_v4p13_Factory::normalizePath(WPMU_PLUGIN_DIR);
$themeDir = Puc_v4p13_Factory::normalizePath(get_theme_root());

if ( (strpos($absolutePath, $pluginDir) === 0) || (strpos($absolutePath, $muPluginDir) === 0) ) {
//It's part of a plugin.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

if ( !class_exists('Puc_v4p9_DebugBar_Panel', false) && class_exists('Debug_Bar_Panel', false) ):
if ( !class_exists('Puc_v4p13_DebugBar_Panel', false) && class_exists('Debug_Bar_Panel', false) ):

class Puc_v4p9_DebugBar_Panel extends Debug_Bar_Panel {
/** @var Puc_v4p9_UpdateChecker */
class Puc_v4p13_DebugBar_Panel extends Debug_Bar_Panel {
/** @var Puc_v4p13_UpdateChecker */
protected $updateChecker;

private $responseBox = '<div class="puc-ajax-response" style="display: none;"></div>';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php
if ( !class_exists('Puc_v4p9_DebugBar_PluginExtension', false) ):
if ( !class_exists('Puc_v4p13_DebugBar_PluginExtension', false) ):

class Puc_v4p9_DebugBar_PluginExtension extends Puc_v4p9_DebugBar_Extension {
/** @var Puc_v4p9_Plugin_UpdateChecker */
class Puc_v4p13_DebugBar_PluginExtension extends Puc_v4p13_DebugBar_Extension {
/** @var Puc_v4p13_Plugin_UpdateChecker */
protected $updateChecker;

public function __construct($updateChecker) {
parent::__construct($updateChecker, 'Puc_v4p9_DebugBar_PluginPanel');
parent::__construct($updateChecker, 'Puc_v4p13_DebugBar_PluginPanel');

add_action('wp_ajax_puc_v4_debug_request_info', array($this, 'ajaxRequestInfo'));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

if ( !class_exists('Puc_v4p9_DebugBar_PluginPanel', false) ):
if ( !class_exists('Puc_v4p13_DebugBar_PluginPanel', false) ):

class Puc_v4p9_DebugBar_PluginPanel extends Puc_v4p9_DebugBar_Panel {
class Puc_v4p13_DebugBar_PluginPanel extends Puc_v4p13_DebugBar_Panel {
/**
* @var Puc_v4p9_Plugin_UpdateChecker
* @var Puc_v4p13_Plugin_UpdateChecker
*/
protected $updateChecker;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

if ( !class_exists('Puc_v4p9_DebugBar_ThemePanel', false) ):
if ( !class_exists('Puc_v4p13_DebugBar_ThemePanel', false) ):

class Puc_v4p9_DebugBar_ThemePanel extends Puc_v4p9_DebugBar_Panel {
class Puc_v4p13_DebugBar_ThemePanel extends Puc_v4p13_DebugBar_Panel {
/**
* @var Puc_v4p9_Theme_UpdateChecker
* @var Puc_v4p13_Theme_UpdateChecker
*/
protected $updateChecker;

Expand Down
Loading

0 comments on commit 7e6d0a5

Please sign in to comment.