-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from bootscore/Update-plugin-checker-5.2
Update plugin checker 5.2
- Loading branch information
Showing
64 changed files
with
1,744 additions
and
2,319 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace YahnisElsts\PluginUpdateChecker\v5; | ||
|
||
if ( !class_exists(PucFactory::class, false) ): | ||
|
||
class PucFactory extends \YahnisElsts\PluginUpdateChecker\v5p2\PucFactory { | ||
} | ||
|
||
endif; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?php | ||
|
||
namespace YahnisElsts\PluginUpdateChecker\v5p2; | ||
|
||
if ( !class_exists(Autoloader::class, false) ): | ||
|
||
class Autoloader { | ||
const DEFAULT_NS_PREFIX = 'YahnisElsts\\PluginUpdateChecker\\'; | ||
|
||
private $prefix; | ||
private $rootDir; | ||
private $libraryDir; | ||
|
||
private $staticMap; | ||
|
||
public function __construct() { | ||
$this->rootDir = dirname(__FILE__) . '/'; | ||
|
||
$namespaceWithSlash = __NAMESPACE__ . '\\'; | ||
$this->prefix = $namespaceWithSlash; | ||
|
||
$this->libraryDir = $this->rootDir . '../..'; | ||
if ( !self::isPhar() ) { | ||
$this->libraryDir = realpath($this->libraryDir); | ||
} | ||
$this->libraryDir = $this->libraryDir . '/'; | ||
|
||
//Usually, dependencies like Parsedown are in the global namespace, | ||
//but if someone adds a custom namespace to the entire library, they | ||
//will be in the same namespace as this class. | ||
$isCustomNamespace = ( | ||
substr($namespaceWithSlash, 0, strlen(self::DEFAULT_NS_PREFIX)) !== self::DEFAULT_NS_PREFIX | ||
); | ||
$libraryPrefix = $isCustomNamespace ? $namespaceWithSlash : ''; | ||
|
||
$this->staticMap = array( | ||
$libraryPrefix . 'PucReadmeParser' => 'vendor/PucReadmeParser.php', | ||
$libraryPrefix . 'Parsedown' => 'vendor/Parsedown.php', | ||
); | ||
|
||
//Add the generic, major-version-only factory class to the static map. | ||
$versionSeparatorPos = strrpos(__NAMESPACE__, '\\v'); | ||
if ( $versionSeparatorPos !== false ) { | ||
$versionSegment = substr(__NAMESPACE__, $versionSeparatorPos + 1); | ||
$pointPos = strpos($versionSegment, 'p'); | ||
if ( ($pointPos !== false) && ($pointPos > 1) ) { | ||
$majorVersionSegment = substr($versionSegment, 0, $pointPos); | ||
$majorVersionNs = __NAMESPACE__ . '\\' . $majorVersionSegment; | ||
$this->staticMap[$majorVersionNs . '\\PucFactory'] = | ||
'Puc/' . $majorVersionSegment . '/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]) ) { | ||
include($this->libraryDir . $this->staticMap[$className]); | ||
return; | ||
} | ||
|
||
if ( strpos($className, $this->prefix) === 0 ) { | ||
$path = substr($className, strlen($this->prefix)); | ||
$path = str_replace(array('_', '\\'), '/', $path); | ||
$path = $this->rootDir . $path . '.php'; | ||
|
||
if ( file_exists($path) ) { | ||
include $path; | ||
} | ||
} | ||
} | ||
} | ||
|
||
endif; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.