예제 #1
0
 /**
  * Gets the plugins directories for a given plugin type.
  */
 public static function getPluginsDirs(IPieCrust $pieCrust, $pluginType, $defaultDir = null)
 {
     $result = array();
     // Add the default/built-in directory, if any.
     if ($defaultDir) {
         $result[] = PieCrustDefaults::APP_DIR . '/' . $defaultDir;
     }
     // Look in the app's plugins directories, and for each, look at the plugins
     // inside, looking for the correct class type.
     $locations = $pieCrust->getPluginsDirs();
     foreach ($locations as $loc) {
         $dirs = new \FilesystemIterator($loc);
         foreach ($dirs as $d) {
             if (!$d->isDir()) {
                 continue;
             }
             $pluginDir = $d->getPathname() . '/src/' . $pluginType;
             if (is_dir($pluginDir)) {
                 $result[] = $pluginDir;
             }
         }
     }
     return $result;
 }