Ejemplo n.º 1
0
 /**
  * Get the enabled application folders.
  *
  * This is a temporary refactor of the the {@link enabledApplicationFolders()} method and will be removed once
  * support for application prefixes has been removed from the site. Please leave this method as private and don't
  * call it unless you know what you're doing.
  *
  * @return array An array of application folders.
  */
 private function getEnabledApplicationFolders()
 {
     if (!isset($this->enabledApplicationFolders)) {
         $addons = $this->addonManager->getEnabled();
         $applications = array_filter($addons, Addon::makeFilterCallback(['oldType' => 'application']));
         $result = ['dashboard'];
         /* @var Addon $application */
         foreach ($applications as $application) {
             $result[] = $application->getKey();
         }
         $this->enabledApplicationFolders = array_unique($result);
     }
     return $this->enabledApplicationFolders;
 }
Ejemplo n.º 2
0
 /**
  * Get an list of enabled application folders.
  *
  * @return array Returns an array of all of the enabled application folders.
  * @deprecated
  */
 public function enabledApplicationFolders()
 {
     deprecated('Gdn_ApplicationManager->enabledApplicationFolders()');
     $addons = $this->addonManager->getEnabled();
     $applications = array_filter($addons, Addon::makeFilterCallback(['oldType' => 'application']));
     $result = ['dashboard'];
     /* @var Addon $application */
     foreach ($applications as $application) {
         $result[] = $application->getKey();
     }
     return array_unique($result);
 }
Ejemplo n.º 3
0
 /**
  * Deprecated.
  *
  * @param string $path Deprecated.
  * @return string|false Deprecated.
  */
 public function findPluginFile($path)
 {
     deprecated('Gdn_PluginManager->findPluginFile()');
     try {
         $addon = new Addon($path);
         if ($pluginClass = $addon->getPluginClass()) {
             return $addon->getClassPath($pluginClass, Addon::PATH_FULL);
         }
         return false;
     } catch (\Exception $ex) {
         return false;
     }
 }
Ejemplo n.º 4
0
 /**
  * Compare two addon's by priority so that they can be sorted.
  *
  * @param Addon $a The first addon to compare.
  * @param Addon $b The second addon to compare.
  * @return int Returns -1, 0, or 1.
  */
 public static function comparePriority(Addon $a, Addon $b)
 {
     if ($a->getPriority() > $b->getPriority()) {
         return -1;
     } elseif ($a->getPriority() < $b->getPriority()) {
         return 1;
     } else {
         return 0;
     }
 }