Vanilla\Addon::getClassPath PHP Method

getClassPath() public method

This is a case insensitive lookup.
public getClassPath ( string $classname, string $relative = self::PATH_FULL ) : string
$classname string The name of the class.
$relative string One of the **Addon::PATH*** constants.
return string Returns the path or an empty string of the class isn't found.
    public function getClassPath($classname, $relative = self::PATH_FULL)
    {
        $key = strtolower($classname);
        if (array_key_exists($key, $this->classes)) {
            $path = $this->path($this->classes[$key][1], $relative);
            return $path;
        }
        return '';
    }

Usage Example

Ejemplo n.º 1
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;
     }
 }