PHP Class Habari\Pluggable

Afficher le fichier Open project: habari/system

Méthodes publiques

Свойство Type Description
$info
$plugin_id

Protected Properties

Свойство Type Description
$_added_templates

Méthodes publiques

Méthode Description
__construct ( ) Pluggable constructor.
_configure_plugin_config ( array $actions, string $plugin_id ) : array Registered to the plugin_config hook to supply a config via a plugin's configure() method
_configure_plugin_ui ( string $plugin_id, string $action ) Registered to the plugin_ui hook to supply a config via a plugin's configure() method
_filter_rewrite_rules ( array $rules ) : array Add the rewrite rules queued by add_rule() to the full rule set
_help_plugin_config ( array $actions, string $plugin_id ) : array Registered to the plugin_config hook to supply help via a plugin's help() method
_help_plugin_ui ( string $plugin_id, string $action ) Registered to the plugin_ui hook to supply help via a plugin's help() method
_plugin_available_templates ( array $list ) : array Add plugin templates to the list of templates that are present in the current theme
_plugin_include_template_file ( string $file, string $name ) : string Potentially serve a different file for the requested template name
add_rule ( mixed $rule, string $hook, Callback $fn = null ) Add a rewrite rule that dispatches entirely to a plugin hook
get_db_schema ( ) : string Gets a database schema associated with this pluggable
get_file ( ) : string Gets the filename that contains this pluggable class
get_url ( boolean | string $trail = false ) : string Get a fully-qualified URL directory that contains this pluggable class
get_version ( ) : string Provide a method to return the version number from a pluggable's info
get_xml_text ( string $filename, SimpleXMLElement $node ) : mixed | string Get the text associated to an info xml node, possibly using an href parameter
load ( ) Called when a pluggable is loaded to register its actions and filters.
load_hooks ( mixed $object ) Registers all of this class' action_ and filter_ functions with the Plugins dispatcher Registers xmlrpc_ functions with the Plugins dispatcher, and turns '__' into '.' for the purposes of matching dotted XMLRPC requests.
load_text_domain ( string $domain ) : boolean Load a translation domain/file for this pluggable
plugin_id ( ) : string Returns a unique id for this pluggable
upgrade ( ) Execute the upgrade action on any pluggable that has a version number change Update the version number of the pluggable in the database to what is installed

Méthodes protégées

Méthode Description
add_rest_rule ( string $hook, Pluggable $object, Callable $fn ) Adds a RewriteRule to the REST handler for the rule provided
add_template ( string $name, string $filename, boolean $override = false ) Adds a template to the default theme that is stored in a specified path.

Method Details

__construct() public méthode

This function creates some internal structures that are required for plugin processing Plugins should not define their own constructors, because they are instantiated to extract plugin info. Instead, include a sink for a "init" hook which is executed immediately after the plugin is loaded during normal execution.
public __construct ( )

_configure_plugin_config() public méthode

Registered to the plugin_config hook to supply a config via a plugin's configure() method
public _configure_plugin_config ( array $actions, string $plugin_id ) : array
$actions array An array of actions applicable to this plugin
$plugin_id string The plugin id to which the actions belong
Résultat array The modified array of actions

_configure_plugin_ui() public méthode

Registered to the plugin_ui hook to supply a config via a plugin's configure() method
public _configure_plugin_ui ( string $plugin_id, string $action )
$plugin_id string The id of the plugin whose action was triggered
$action string The action triggered

_filter_rewrite_rules() public méthode

Add the rewrite rules queued by add_rule() to the full rule set
public _filter_rewrite_rules ( array $rules ) : array
$rules array The array of current RewriteRules
Résultat array The appended array of RewriteRules

_help_plugin_config() public méthode

Registered to the plugin_config hook to supply help via a plugin's help() method
public _help_plugin_config ( array $actions, string $plugin_id ) : array
$actions array An array of actions applicable to this plugin
$plugin_id string The plugin id to which the actions belong
Résultat array The modified array of actions

_help_plugin_ui() public méthode

Registered to the plugin_ui hook to supply help via a plugin's help() method
public _help_plugin_ui ( string $plugin_id, string $action )
$plugin_id string The id of the plugin whose action was triggered
$action string The action triggered

_plugin_available_templates() public méthode

Add plugin templates to the list of templates that are present in the current theme
public _plugin_available_templates ( array $list ) : array
$list array List of template names in the current theme
Résultat array The modified list of template names

_plugin_include_template_file() public méthode

Potentially serve a different file for the requested template name
public _plugin_include_template_file ( string $file, string $name ) : string
$file string The filename of the template the theme will display
$name string The name of the template requested
Résultat string The potentially modified filename to use for the requested template.

add_rest_rule() protected static méthode

Adds a RewriteRule to the REST handler for the rule provided
protected static add_rest_rule ( string $hook, Pluggable $object, Callable $fn )
$hook string The hook name to add a RewriteRule for
$object Pluggable The pluggable object holding the hook
$fn Callable The hook function to use to dispatch the request

add_rule() public méthode

Add a rewrite rule that dispatches entirely to a plugin hook
public add_rule ( mixed $rule, string $hook, Callback $fn = null )
$rule mixed An old-style rewrite rule string, where quoted segments are literals and unquoted segments are variable names, OR a RewriteRule object
$hook string The suffix of the hook function: action_plugin_act_{$suffix}
$fn Callback A potential function/method to register directly to the newly created hook

add_template() protected méthode

Use this function as a shortcut to make available additional templates to a theme from within the plugin directory.
protected add_template ( string $name, string $filename, boolean $override = false )
$name string The name of the template that will be displayed, sans extension
$filename string The full path of the template file used for the specified name
$override boolean If false, allow a template with the same name in the active theme directory to override this one. If true, always override the active theme's template with this one.

get_db_schema() final public méthode

Gets a database schema associated with this pluggable
final public get_db_schema ( ) : string
Résultat string The database schema

get_file() final public méthode

Gets the filename that contains this pluggable class
final public get_file ( ) : string
Résultat string The filename of the file that contains the pluggable class.

get_url() public méthode

Get a fully-qualified URL directory that contains this pluggable class
public get_url ( boolean | string $trail = false ) : string
$trail boolean | string If true, include a trailing slash. If string, append this to the requested url. Default: Add nothing.
Résultat string URL

get_version() abstract public méthode

Provide a method to return the version number from a pluggable's info
abstract public get_version ( ) : string
Résultat string The version of the pluggable

get_xml_text() public static méthode

Get the text associated to an info xml node, possibly using an href parameter
public static get_xml_text ( string $filename, SimpleXMLElement $node ) : mixed | string
$filename string The filename of the xml file
$node SimpleXMLElement The text node with value children to sift through
Résultat mixed | string The result text

load() public méthode

Called when a pluggable is loaded to register its actions and filters.
public load ( )

load_hooks() public static méthode

If the class is an instance of Pluggable, registers the hooks with a plugin id also.
public static load_hooks ( mixed $object )
$object mixed The object or class name to register the hooks of

load_text_domain() public méthode

Load a translation domain/file for this pluggable
public load_text_domain ( string $domain ) : boolean
$domain string The name of the domain to load
Résultat boolean true if data was successfully loaded, false otherwise

plugin_id() final public méthode

Returns a unique id for this pluggable
final public plugin_id ( ) : string
Résultat string A plugin id

upgrade() public méthode

Execute the upgrade action on any pluggable that has a version number change Update the version number of the pluggable in the database to what is installed
public upgrade ( )

Property Details

$_added_templates protected_oe property

protected $_added_templates

$info public_oe property

public $info

$plugin_id public_oe property

public $plugin_id