For example, borrowing from Wordpress, we can divide our API into:
- Actions
- Filters
Actions are the functions that are called at specific points during execution, or when specific events occur. The plugin can specify that one or more of its PHP functions are executed at these points, using the Action API.
For example, a plugin can register its function by:
Code: Select all
phpbb::register_action('remove_post', array('my_plugin', 'remove_row_from_my_table'));
2. Filters
Filters are functions that modify the data passed to them.
For example, a plugin can register its filter by:
Code: Select all
phpbb::register_filter('post_date', array('my_plugin','format_date'));