PHP Class EP_Modules

Show file Open project: 10up/elasticpress Class Usage Examples

Public Properties

Property Type Description
$registered_modules array Stores all modules that have been properly included (both active and inactive)

Public Methods

Method Description
activate_module ( string $slug ) A convenient function to programmatically activate a module
factory ( ) : object Return singleton instance of class
get_active_modules ( ) : array Returns all active modules
register_module ( string $slug, array $module_args ) : boolean [ep_register_module description]
setup ( ) Initiate class actions
setup_modules ( ) Set up all active modules that are stored in options

Method Details

activate_module() public method

A convenient function to programmatically activate a module
Since: 2.1
public activate_module ( string $slug )
$slug string

factory() public static method

Return singleton instance of class
Since: 2.1
public static factory ( ) : object
return object

get_active_modules() public method

Returns all active modules
Since: 2.1
public get_active_modules ( ) : array
return array Array of slugs mapped to EP_Module objects

register_module() public method

[ep_register_module description]
public register_module ( string $slug, array $module_args ) : boolean
$slug string
$module_args array Supported array parameters: "title" (string) - Pretty title for module "requires_install_reindex" (boolean) - Setting to true will force a reindex after the module is activated "setup_cb" (callback) - Callback to a function to be called on each page load when the module is activated "post_activation_cb" (callback) - Callback to a function to be called after a module is first activated "module_box_summary_cb" (callback) - Callback to a function that outputs HTML module box summary (short description of module) "module_box_long_cb" (callback) - Callback to a function that outputs HTML module box full description "dependencies_met_cb" (callback) - Callback to a function that determines if the modules dependencies are met. True means yes, WP_Error means no. If no, WP_Error message will be printed to the screen.
return boolean

setup() public method

Initiate class actions
Since: 2.1
public setup ( )

setup_modules() public method

Set up all active modules that are stored in options
Since: 2.1
public setup_modules ( )

Property Details

$registered_modules public property

Stores all modules that have been properly included (both active and inactive)
Since: 2.1
public array $registered_modules
return array