浏览代码

Various small improvements

Daniel Rudolf 7 年之前
父节点
当前提交
b6468ca215
共有 2 个文件被更改,包括 5 次插入4 次删除
  1. 1 1
      index.php
  2. 4 3
      lib/Pico.php

+ 1 - 1
index.php

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

+ 4 - 3
lib/Pico.php

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