Class GP_Plugin

Description

GlotPress plugin base class. It is supposed to be inherited.

Located in /gp-includes/plugin.php (line 6)


	
			
Variable Summary
$id $id
Method Summary
GP_Plugin __construct ()
void add_action (string $action_name, [array $args = array()])
void add_filter (string $filter_name, [array $args = array()])
mixed get_option (string $key)
void remove_action ( $action_name, [ $args = array()])
void remove_filter ( $filter_name, [ $args = array()])
bool update_option (string $key, mixed $value)
void _call_wp_plugin_api_function ( $wp_function,  $tag, [ $args = array()])
Variables
$id $id (line 11)
  • var: unique id of the plugin. It will be used as a plugin slug in the plugin repository
Methods
Constructor __construct (line 16)

If you override the constructor, always call the parent one.

GP_Plugin __construct ()
add_action (line 66)

Adds a method in this class as an action with the same name.

For example $this->add_action( 'init', ... ) will add $this->init() as an init action

void add_action (string $action_name, [array $args = array()])
  • string $action_name: The name of the action and the method.
  • array $args: Two keys are supported:
      • args => how many arguments the action accepts. Default is 1.
    add_filter (line 82)

    Adds a method in this class as a filter with the same name.

    For example $this->add_filter( 'the_content', ... ) will add $this->the_content() as a the_content filter

    void add_filter (string $filter_name, [array $args = array()])
    • string $filter_name: The name of the filter and the method.
    • array $args: Two keys are supported:
        • args => how many arguments the filter accepts. Default is 1.
      get_option (line 29)

      Retrieve an option, specific to your plugin.

      You don't have to prefix the key or to tie its name to your plugin.

      • return: the value of the option, or null if it wasn't found
      mixed get_option (string $key)
      • string $key
      remove_action (line 93)
      void remove_action ( $action_name, [ $args = array()])
      • $action_name
      • $args
      remove_filter (line 97)
      void remove_filter ( $filter_name, [ $args = array()])
      • $filter_name
      • $args
      update_option (line 50)

      Update an option, specific to your plugin.

      You don't have to prefix the key or to tie its name to your plugin.

      bool update_option (string $key, mixed $value)
      • string $key
      • mixed $value: Can be anything serializable
      _call_wp_plugin_api_function (line 86)
      void _call_wp_plugin_api_function ( $wp_function,  $tag, [ $args = array()])
      • $wp_function
      • $tag
      • $args

      Documentation generated on Fri, 18 May 2012 01:46:04 +0100 by phpDocumentor 1.4.3