PHP 클래스 Habari\Plugins

Provides an interface for the code to access plugins
파일 보기 프로젝트 열기: habari/system 1 사용 예제들

공개 메소드들

메소드 설명
_autoload ( $class ) Autoload function to load plugin file from classname
act ( string $hookname, mixed $param = null ) Call to execute a plugin action
act_id ( string $hookname, mixed $param = null ) Call to execute a plugin action, by id
activate_plugin ( $file ) Activates a plugin file
changed_since_last_activation ( ) : boolean Detects whether the plugins that exist have changed since they were last activated.
check_every_plugin_syntax ( ) : boolean Check the PHP syntax of every plugin available, activated or not.
class_from_filename ( string $file, boolean $check_realpath = false ) : string function class_from_filename returns the class name from a plugin's filename
deactivate_plugin ( string $file, boolean $force = false ) : boolean Deactivates a plugin file
extends_plugin ( $class ) : boolean Get classes that extend Plugin.
filter ( string $hookname, mixed $param ) : mixed Call to execute a plugin filter
filter_id ( string $hookname, string $id, mixed $param ) : mixed Call to execute a plugin filter on a specific plugin, by id
get_active ( ) : array Returns the internally stored references to all loaded plugins
get_by_interface ( string $interface ) : array Get references to plugin objects that implement a specific interface
get_plugin_classes ( )
id_from_file ( string $file ) : string Returns a plugin id for the filename specified.
implemented ( string $hookname, string $searchtype = null ) : array | boolean Determine if a hook of any type is implemented
is_loaded ( string $name, string $version = null ) : boolean Verify if a plugin is loaded.
list_active ( boolean $refresh = false ) : array function list_active Gets a list of active plugin filenames to be included
list_all ( ) : array function list_all Gets a list of all plugin filenames that are available
load ( string $class, boolean $activate = true ) : Plugin Load a pluign into memory by class name
load_active ( ) Instantiate and load all active plugins
load_from_file ( string $file, boolean $activate = true ) : Plugin Initialize all loaded plugins by calling their load() method
load_info ( string $file ) : SimpleXMLElement Return the info XML for a plugin based on a filename
plugin_ui ( string $configure, $configaction ) Produce the UI for a plugin based on the user's selected config option
provided ( null | string $exclude = null, boolean $include_inactive = false, boolean $use_file = false ) : array Get a list of features and the active plugins that provide that feature
register ( Callable $fn, string $type, string $hook, integer $priority = 8 ) function register Registers a plugin action for possible execution
set_present ( ) Stores the list of plugins that are present (not necessarily active) in the Options table for future comparison.
theme ( string $hookname, mixed $param ) : mixed Call to execute a theme function
theme_implemented ( string $hookname ) : boolean Determine if any plugin implements the indicated theme hook
upgrade ( ) Upgrade all loaded plugins
xmlrpc ( string $hookname, mixed $param ) : boolean | mixed Call to execute an XMLRPC function

비공개 메소드들

메소드 설명
__construct ( ) function __construct A private constructor method to prevent this class from being instantiated.

메소드 상세

_autoload() 공개 정적인 메소드

Autoload function to load plugin file from classname
public static _autoload ( $class )

act() 공개 정적인 메소드

Call to execute a plugin action
public static act ( string $hookname, mixed $param = null )
$hookname string The name of the action to execute
$param mixed Optional arguments needed for action

act_id() 공개 정적인 메소드

Call to execute a plugin action, by id
public static act_id ( string $hookname, mixed $param = null )
$hookname string The name of the action to execute
$param mixed Optional arguments needed for action

activate_plugin() 공개 정적인 메소드

Activates a plugin file
public static activate_plugin ( $file )

changed_since_last_activation() 공개 정적인 메소드

Detects whether the plugins that exist have changed since they were last activated.
public static changed_since_last_activation ( ) : boolean
리턴 boolean true if the plugins have changed, false if not.

check_every_plugin_syntax() 공개 정적인 메소드

Check the PHP syntax of every plugin available, activated or not.
또한 보기: Utils::php_check_file_syntax()
public static check_every_plugin_syntax ( ) : boolean
리턴 boolean Returns true if all plugins were valid, return false if a plugin (or more) failed.

class_from_filename() 공개 정적인 메소드

function class_from_filename returns the class name from a plugin's filename
public static class_from_filename ( string $file, boolean $check_realpath = false ) : string
$file string the full path to a plugin file
$check_realpath boolean whether or not to try realpath resolution
리턴 string the class name

deactivate_plugin() 공개 정적인 메소드

Deactivates a plugin file
public static deactivate_plugin ( string $file, boolean $force = false ) : boolean
$file string the Filename of the plugin to deactivate
$force boolean If true, deactivate this plugin regardless of what filters may say about it.
리턴 boolean If true, the plugin was deactivated

extends_plugin() 공개 정적인 메소드

Get classes that extend Plugin.
public static extends_plugin ( $class ) : boolean
$class string A class name
리턴 boolean true if the class extends Plugin

filter() 공개 정적인 메소드

Call to execute a plugin filter
public static filter ( string $hookname, mixed $param ) : mixed
$hookname string The name of the filter to execute
$param mixed The value to filter.
리턴 mixed The result of filtering the first $param value

filter_id() 공개 정적인 메소드

Call to execute a plugin filter on a specific plugin, by id
public static filter_id ( string $hookname, string $id, mixed $param ) : mixed
$hookname string The name of the filter to execute
$id string The id of the only plugin on which to execute
$param mixed The value to filter.
리턴 mixed The result of filtering the first $param value

get_active() 공개 정적인 메소드

Returns the internally stored references to all loaded plugins
public static get_active ( ) : array
리턴 array An array of plugin objects

get_by_interface() 공개 정적인 메소드

Get references to plugin objects that implement a specific interface
public static get_by_interface ( string $interface ) : array
$interface string The interface to check for
리턴 array An array of matching plugins

get_plugin_classes() 공개 정적인 메소드

public static get_plugin_classes ( )

id_from_file() 공개 정적인 메소드

Used to unify the way plugin ids are generated, rather than spreading the calls internal to this function over several files.
public static id_from_file ( string $file ) : string
$file string The filename to generate an id for
리턴 string A plugin id.

implemented() 공개 정적인 메소드

Determine if a hook of any type is implemented
public static implemented ( string $hookname, string $searchtype = null ) : array | boolean
$hookname string The name of the hook to check for
$searchtype string Optional. The type of hook to check for
리턴 array | boolean An array with the types of hook implemented, or false if not implemented

is_loaded() 공개 정적인 메소드

You may supply an optional argument $version as a minimum version requirement.
public static is_loaded ( string $name, string $version = null ) : boolean
$name string Name or class name of the plugin to find.
$version string Optional minimal version of the plugin.
리턴 boolean Returns true if name is found and version is equal or higher than required.

list_active() 공개 정적인 메소드

function list_active Gets a list of active plugin filenames to be included
public static list_active ( boolean $refresh = false ) : array
$refresh boolean Whether to refresh the cached array. Default false
리턴 array An array of filenames

list_all() 공개 정적인 메소드

function list_all Gets a list of all plugin filenames that are available
public static list_all ( ) : array
리턴 array An array of filenames

load() 공개 정적인 메소드

Load a pluign into memory by class name
public static load ( string $class, boolean $activate = true ) : Plugin
$class string The name of the class of the plugin to load
$activate boolean True to run the load routine of the plugin and add it to the loaded plugins list
리턴 Plugin The instance of the created plugin

load_active() 공개 정적인 메소드

Instantiate and load all active plugins
public static load_active ( )

load_from_file() 공개 정적인 메소드

Initialize all loaded plugins by calling their load() method
public static load_from_file ( string $file, boolean $activate = true ) : Plugin
$file string the class name to load
$activate boolean True if the plugin's load() method should be called
리턴 Plugin The instantiated plugin class

load_info() 공개 정적인 메소드

Return the info XML for a plugin based on a filename
public static load_info ( string $file ) : SimpleXMLElement
$file string The filename of the plugin file
리턴 SimpleXMLElement The info structure for the plugin, or null if no info could be loaded

plugin_ui() 공개 정적인 메소드

Produce the UI for a plugin based on the user's selected config option
public static plugin_ui ( string $configure, $configaction )
$configure string The id of the configured plugin
$configaction

provided() 공개 정적인 메소드

Get a list of features and the active plugins that provide that feature
public static provided ( null | string $exclude = null, boolean $include_inactive = false, boolean $use_file = false ) : array
$exclude null | string A plugin id to exclude from the results
$include_inactive boolean Default false. If true, include inactive plugins in the list.
$use_file boolean If true, return a filename as the depenedency. If false (default), return the name of the plugin.
리턴 array An array with keys of the feature name, values are an array of plugin names providing that feature

register() 공개 정적인 메소드

function register Registers a plugin action for possible execution
public static register ( Callable $fn, string $type, string $hook, integer $priority = 8 )
$fn Callable A reference to the function to register by string or array(object, string)
$type string Usually either 'filter' or 'action' depending on the hook type.
$hook string The plugin hook to register
$priority integer An optional execution priority, from 1-16. The lower the priority, the earlier the function will execute in the chain. Default value = 8.

set_present() 공개 정적인 메소드

Stores the list of plugins that are present (not necessarily active) in the Options table for future comparison.
public static set_present ( )

theme() 공개 정적인 메소드

Call to execute a theme function
public static theme ( string $hookname, mixed $param ) : mixed
$hookname string The name of the filter to execute
$param mixed The value to filter
리턴 mixed The filtered value

theme_implemented() 공개 정적인 메소드

Determine if any plugin implements the indicated theme hook
public static theme_implemented ( string $hookname ) : boolean
$hookname string The name of the hook to check for
리턴 boolean True if the hook is implemented

upgrade() 공개 정적인 메소드

Upgrade all loaded plugins
public static upgrade ( )

xmlrpc() 공개 정적인 메소드

Call to execute an XMLRPC function
public static xmlrpc ( string $hookname, mixed $param ) : boolean | mixed
$hookname string The name of the filter to execute
$param mixed The value to filter.
리턴 boolean | mixed The result of the XMLRPC call