Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes

Pluggable Class Reference

Inheritance diagram for Pluggable:

List of all members.

Public Member Functions

 __construct ()
 get_file ()
 get_db_schema ()
 get_url ($trail=false)
 plugin_id ()
 load_text_domain ($domain)
 load ()
 _help_plugin_config ($actions, $plugin_id)
 _help_plugin_ui ($plugin_id, $action)
 _configure_plugin_config ($actions, $plugin_id)
 _configure_plugin_ui ($plugin_id, $action)
 add_rule ($rule, $hook, $fn=null)
 _filter_rewrite_rules ($rules)
 _plugin_available_templates ($list)
 _plugin_include_template_file ($file, $name)
 get_version ()
 upgrade ()

Static Public Member Functions

static load_hooks ($object)
static get_xml_text ($filename,\SimpleXMLElement $node)

Public Attributes

 $info
 $plugin_id

Protected Member Functions

 add_template ($name, $filename, $override=false)

Static Protected Member Functions

static add_rest_rule ($hook, Pluggable $object, $fn)

Protected Attributes

 $_added_templates = array()

Detailed Description

Pluggable class Implements methods that allow descendant classes to register functions to plugin hooks

Version:
$Id$ 2008

Definition at line 16 of file pluggable.php.


Constructor & Destructor Documentation

Pluggable::__construct (  ) 

Pluggable constructor. 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.

Reimplemented in Plugin.

Definition at line 31 of file pluggable.php.


Member Function Documentation

Pluggable::_configure_plugin_config ( actions,
plugin_id 
)

Registered to the plugin_config hook to supply a config via a plugin's configure() method

Parameters:
array $actions An array of actions applicable to this plugin
string $plugin_id The plugin id to which the actions belong
Returns:
array The modified array of actions

Definition at line 288 of file pluggable.php.

Pluggable::_configure_plugin_ui ( plugin_id,
action 
)

Registered to the plugin_ui hook to supply a config via a plugin's configure() method

Parameters:
string $plugin_id The id of the plugin whose action was triggered
string $action The action triggered

Definition at line 302 of file pluggable.php.

Pluggable::_filter_rewrite_rules ( rules  ) 

Add the rewrite rules queued by add_rule() to the full rule set

Parameters:
array $rules The array of current RewriteRules
Returns:
array The appended array of RewriteRules

Definition at line 345 of file pluggable.php.

Pluggable::_help_plugin_config ( actions,
plugin_id 
)

Registered to the plugin_config hook to supply help via a plugin's help() method

Parameters:
array $actions An array of actions applicable to this plugin
string $plugin_id The plugin id to which the actions belong
Returns:
array The modified array of actions

Definition at line 253 of file pluggable.php.

Pluggable::_help_plugin_ui ( plugin_id,
action 
)

Registered to the plugin_ui hook to supply help via a plugin's help() method

Parameters:
string $plugin_id The id of the plugin whose action was triggered
string $action The action triggered

Definition at line 268 of file pluggable.php.

Pluggable::_plugin_available_templates ( list  ) 

Add plugin templates to the list of templates that are present in the current theme

Parameters:
array $list List of template names in the current theme
Returns:
array The modified list of template names

Definition at line 377 of file pluggable.php.

Pluggable::_plugin_include_template_file ( file,
name 
)

Potentially serve a different file for the requested template name

Parameters:
string $file The filename of the template the theme will display
string $name The name of the template requested
Returns:
string The potentially modified filename to use for the requested template.

Definition at line 390 of file pluggable.php.

static Pluggable::add_rest_rule ( hook,
Pluggable object,
fn 
) [static, protected]

Adds a RewriteRule to the REST handler for the rule provided

Parameters:
string $hook The hook name to add a RewriteRule for
Pluggable $object The pluggable object holding the hook
Callable $fn The hook function to use to dispatch the request

Definition at line 179 of file pluggable.php.

Referenced by load_hooks().

Pluggable::add_rule ( rule,
hook,
fn = null 
)

Add a rewrite rule that dispatches entirely to a plugin hook

Parameters:
mixed $rule An old-style rewrite rule string, where quoted segments are literals and unquoted segments are variable names, OR a RewriteRule object
string $hook The suffix of the hook function: action_plugin_act_{$suffix}
Callback $fn A potential function/method to register directly to the newly created hook

Definition at line 323 of file pluggable.php.

Referenced by add_rest_rule().

Pluggable::add_template ( name,
filename,
override = false 
) [protected]

Adds a template to the default theme that is stored in a specified path. Use this function as a shortcut to make available additional templates to a theme from within the plugin directory.

Parameters:
string $name The name of the template that will be displayed, sans extension
string $filename The full path of the template file used for the specified name
boolean $override 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.

Reimplemented in Theme.

Definition at line 361 of file pluggable.php.

Referenced by Menus::action_init(), CoreDashModules::action_init(), and CoreBlocks::action_init().

Pluggable::get_db_schema (  )  [final]

Gets a database schema associated with this pluggable

Returns:
string The database schema

Definition at line 60 of file pluggable.php.

Pluggable::get_file (  )  [final]

Gets the filename that contains this pluggable class

Returns:
string The filename of the file that contains the pluggable class.

Definition at line 41 of file pluggable.php.

Referenced by get_db_schema(), get_url(), Plugin::info(), load_text_domain(), plugin_id(), and HabariSilo::silo_get().

Pluggable::get_url ( trail = false  ) 

Get a fully-qualified URL directory that contains this pluggable class

Parameters:
bool|string $trail If true, include a trailing slash. If string, append this to the requested url. Default: Add nothing.
Returns:
string URL

Definition at line 73 of file pluggable.php.

Referenced by Menus::action_admin_header(), CoreDashModules::action_admin_header(), CoreBlocks::action_block_content_meta_links(), HabariSilo::action_init(), and HabariSilo::silo_get().

Pluggable::get_version (  )  [abstract]

Provide a method to return the version number from a pluggable's info

Returns:
string The version of the pluggable

Reimplemented in Plugin, and Theme.

Referenced by upgrade().

static Pluggable::get_xml_text ( filename,
\SimpleXMLElement $  node 
) [static]

Get the text associated to an info xml node, possibly using an href parameter

Parameters:
string $filename The filename of the xml file
\SimpleXMLElement $node The text node with value children to sift through
Returns:
mixed|string The result text

Definition at line 437 of file pluggable.php.

Pluggable::load (  ) 

Called when a pluggable is loaded to register its actions and filters.

Definition at line 231 of file pluggable.php.

Referenced by Theme::__construct(), and Menus::action_admin_theme_get_menu_iframe().

static Pluggable::load_hooks ( object  )  [static]

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. If the class is an instance of Pluggable, registers the hooks with a plugin id also.

Parameters:
mixed $object The object or class name to register the hooks of

Definition at line 110 of file pluggable.php.

Referenced by Post::__static(), Posts::__static(), Comment::__static(), load(), and Stack::load_stackitems().

Pluggable::load_text_domain ( domain  ) 

Load a translation domain/file for this pluggable

Parameters:
string $domain The name of the domain to load
Returns:
boolean true if data was successfully loaded, false otherwise

Definition at line 96 of file pluggable.php.

Pluggable::plugin_id (  )  [final]
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

Definition at line 410 of file pluggable.php.


The documentation for this class was generated from the following file: