PHP 클래스 Vanilla\Addon

파일 보기 프로젝트 열기: vanilla/vanilla 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( string $subdir = '' ) Addon constructor.
__set_state ( array $array ) : Addon Support {@link var_export()} for caching.
check ( boolean $trigger = false ) : array Check the addon for data issues.
checkVersion ( string $version, string $requirement ) Check a version against a version requirement.
comparePriority ( Addon $a, Addon $b ) : integer Compare two addon's by priority so that they can be sorted.
getClassPath ( string $classname, string $relative = self::PATH_FULL ) : string Get the path of a class within this addon.
getClasses ( ) : array Get the classes.
getIcon ( string $relative = self::PATH_ADDON ) : string Get the path to the icon for this addon.
getInfo ( ) : array Get the info.
getInfoValue ( string $key, mixed $default = null ) : mixed Get a single value from the info array.
getKey ( ) : string Get this addon's key.
getName ( ) : string Get this addon's human-readable name.
getPluginClass ( ) : string Get the name of the plugin class for this addon, if any.
getPriority ( ) : integer Get the priority of this addon.
getRawKey ( ) : string Get this addon's raw case-sensitive key.
getRequirements ( ) : array Get the required addons for this addon.
getSpecial ( string $key, mixed $default = null ) : mixed Get an item from the special array.
getSubdir ( ) : string Get the subdir.
getTranslationPaths ( string $locale = '' ) : array Get translation paths.
getType ( ) : string Get the type of addon.
getVersion ( ) : string Get the version number of the addon.
makeFilterCallback ( array $where ) : Closure Return a function that can be used as a callback to filter arrays of {@link Addon} objects.
path ( string $subpath = '', string $relative = self::PATH_FULL ) : string Make a full path from an addon-relative path.
scan ( string $subdir ) Scan a subdirectory and setup this addon.
test ( boolean $throw = true ) : boolean Do a very basic test of this addon.

비공개 메소드들

메소드 설명
canonicalizeLocale ( string $locale ) : string Canonicalize a locale string so different representations of the same locale can be used together.
convertRequire ( array $info, array $keys ) Convert the info array style requirements to the composer-like require format.
glob ( string $pattern ) : array Perform a glob from this addon's subdirectory.
scanClassPaths ( )
scanClasses ( ) : array Scan for all of the classes in this addon.
scanFile ( string $path ) : array Looks what classes and namespaces are defined in a file and returns them.
scanInfo ( ) : array | null Get an addon's meta info.
scanInfoArray ( string $subpath ) : array | null Scan an addon's info array.
scanTranslations ( ) Scan the addon for translation files.
setClasses ( array $classes ) : Addon Set the classes.
setInfo ( array $info ) : Addon Set the info.
setSpecialArray ( array $special ) : Addon Set the special array.
setSubdir ( string $subdir ) : Addon Set the root-relative subdirectory of the addon.
setTranslationPaths ( array $translations ) : Addon Set the translation paths.
splitAuthors ( array $author ) : array[array[string]] Split an author array that may contain multiple authors separated by commas.
splitRequirement ( string $requirement ) : array Split a requirements string into comparisons.
testRequirement ( string $version, array $req ) : boolean Test an individual requirement.

메소드 상세

__construct() 공개 메소드

Addon constructor.
public __construct ( string $subdir = '' )
$subdir string The root-relative subdirectory of the addon.

__set_state() 공개 정적인 메소드

Support {@link var_export()} for caching.
public static __set_state ( array $array ) : Addon
$array array The array to load.
리턴 Addon Returns a new addon with the properties from {@link $array}.

check() 공개 메소드

Check the addon for data issues.
public check ( boolean $trigger = false ) : array
$trigger boolean Whether or not to trigger a notice if there are issues.
리턴 array Returns an array of issues with the addon.

checkVersion() 공개 정적인 메소드

Check a version against a version requirement.
public static checkVersion ( string $version, string $requirement )
$version string The version to check.
$requirement string The version requirement.

comparePriority() 공개 정적인 메소드

Compare two addon's by priority so that they can be sorted.
public static comparePriority ( Addon $a, Addon $b ) : integer
$a Addon The first addon to compare.
$b Addon The second addon to compare.
리턴 integer Returns -1, 0, or 1.

getClassPath() 공개 메소드

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.
리턴 string Returns the path or an empty string of the class isn't found.

getClasses() 공개 메소드

Get the classes.
public getClasses ( ) : array
리턴 array Returns the classes.

getIcon() 공개 메소드

Get the path to the icon for this addon.
public getIcon ( string $relative = self::PATH_ADDON ) : string
$relative string One of the **Addon::PATH_*** constants.
리턴 string Returns the path of the icon relative to {@link $relative} or an empty string if there is no icon.

getInfo() 공개 메소드

Get the info.
public getInfo ( ) : array
리턴 array Returns the info.

getInfoValue() 공개 메소드

Get a single value from the info array.
public getInfoValue ( string $key, mixed $default = null ) : mixed
$key string The key in the info array.
$default mixed The default value to return if there is no item.
리턴 mixed Returns the info value or {@link $default}.

getKey() 공개 메소드

Get this addon's key.
public getKey ( ) : string
리턴 string Returns the key as a string.

getName() 공개 메소드

Get this addon's human-readable name.
public getName ( ) : string
리턴 string Returns the name of the addon or its key if it has no name.

getPluginClass() 공개 메소드

Get the name of the plugin class for this addon, if any.
public getPluginClass ( ) : string
리턴 string Returns the name of the class or an empty string if it doesn't have one.

getPriority() 공개 메소드

An addon's priority determines the order of things like translations, autoloading, and event firing. Addons with higher priorities will generally override addons with lower priority.
public getPriority ( ) : integer
리턴 integer Returns the priority.

getRawKey() 공개 메소드

Addon's have a lowercase key, but some places still require the uppercase one.
public getRawKey ( ) : string
리턴 string Returns the key as a string.

getRequirements() 공개 메소드

Get the required addons for this addon.
public getRequirements ( ) : array
리턴 array Returns an array in the form addonKey => version.

getSpecial() 공개 메소드

Get an item from the special array.
public getSpecial ( string $key, mixed $default = null ) : mixed
$key string The key in the special array.
$default mixed The default if the key isn't set.
리턴 mixed Returns the special item or {@link $default}.

getSubdir() 공개 메소드

Get the subdir.
public getSubdir ( ) : string
리턴 string Returns the subdir.

getTranslationPaths() 공개 메소드

Get translation paths.
public getTranslationPaths ( string $locale = '' ) : array
$locale string If passed then only the translation paths for this locale will be returned.
리턴 array Returns an array of translation paths or an array of locale codes pointing to translation paths.

getType() 공개 메소드

Get the type of addon.
public getType ( ) : string
리턴 string Returns one of the **Addon::TYPE_*** constants.

getVersion() 공개 메소드

This is just a convenience method for grabbing the version number from the info array.
public getVersion ( ) : string
리턴 string Returns a version number or an empty string if there isn't one.

makeFilterCallback() 공개 정적인 메소드

Return a function that can be used as a callback to filter arrays of {@link Addon} objects.
public static makeFilterCallback ( array $where ) : Closure
$where array A where array that filters the info array.
리턴 Closure Returns a new closure.

path() 공개 메소드

Make a full path from an addon-relative path.
public path ( string $subpath = '', string $relative = self::PATH_FULL ) : string
$subpath string The subpath to base the path on, starting with a "/".
$relative string One of the **Addon::PATH_*** constants.
리턴 string Returns a full path.

scan() 공개 메소드

Scan a subdirectory and setup this addon.
public scan ( string $subdir )
$subdir string The root-relative subdirectory to scan.

test() 공개 메소드

The test includes some of the files on this addon which will throw an exception if there are any major issues.
public test ( boolean $throw = true ) : boolean
$throw boolean Whether or not to throw an exception.
리턴 boolean Returns **true** if the addon was successfully tested or **false** otherwise.