Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update yahnis-elsts/plugin-update-checker from 4.9 to 4.13 #937

Merged
merged 1 commit into from
Sep 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
],
"require": {
"php": ">=7.4",
"yahnis-elsts/plugin-update-checker": "4.9",
"yahnis-elsts/plugin-update-checker": "4.13",
"ext-json": "*"
},
"autoload": {
Expand Down
22 changes: 13 additions & 9 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;
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