Various small improvements

This commit is contained in:
Daniel Rudolf 2017-10-08 00:36:29 +02:00
parent 9a9872fe8e
commit b6468ca215
No known key found for this signature in database
GPG Key ID: A061F02CD8DE4538
2 changed files with 5 additions and 4 deletions

View File

@ -8,7 +8,7 @@ if (is_file(__DIR__ . '/vendor/autoload.php')) {
// composer dependency package // composer dependency package
require_once(__DIR__ . '/../../../vendor/autoload.php'); require_once(__DIR__ . '/../../../vendor/autoload.php');
} else { } else {
die("Cannot find `vendor/autoload.php`. Run `composer install`."); die("Cannot find 'vendor/autoload.php'. Run `composer install`.");
} }
// instance Pico // instance Pico

View File

@ -131,7 +131,7 @@ class Pico
/** /**
* List of loaded plugins using the current API version * List of loaded plugins using the current API version
* *
* @var object[] * @var PicoPluginInterface[]
*/ */
protected $nativePlugins = array(); protected $nativePlugins = array();
@ -661,6 +661,7 @@ class Pico
} }
$className = get_class($plugin); $className = get_class($plugin);
if (!($plugin instanceof PicoPluginInterface)) { if (!($plugin instanceof PicoPluginInterface)) {
throw new RuntimeException( throw new RuntimeException(
"Unable to load plugin '" . $className . "': " "Unable to load plugin '" . $className . "': "
@ -676,7 +677,7 @@ class Pico
// trigger onPluginManuallyLoaded event // trigger onPluginManuallyLoaded event
// the event is also called on the newly loaded plugin, allowing you to distinguish manual and auto loading // the event is also called on the newly loaded plugin, allowing you to distinguish manual and auto loading
$this->triggerEvent('onPluginManuallyLoaded', array($this->plugins[$className])); $this->triggerEvent('onPluginManuallyLoaded', array($plugin));
return $plugin; return $plugin;
} }
@ -2192,7 +2193,7 @@ class Pico
public function getAbsolutePath($path) public function getAbsolutePath($path)
{ {
if (DIRECTORY_SEPARATOR === '\\') { if (DIRECTORY_SEPARATOR === '\\') {
if (preg_match('/^([a-zA-Z]:\\\\|\\\\\\\\)/', $path) !== 1) { if (preg_match('/^(?>[a-zA-Z]:\\\\|\\\\\\\\)/', $path) !== 1) {
$path = $this->getRootDir() . $path; $path = $this->getRootDir() . $path;
} }
} else { } else {