/** * Add all the hooks */ public function add_hooks() { $hooks = gnt_get_hooks(); $hook_settings = gnt_get_hook_settings(); foreach ($hooks as $hook) { add_action('gnt_hook_' . $hook['slug'], array($this, 'send')); } }
/** * Prepare the items for output * * @return null */ function prepare_items() { $columns = $this->get_columns(); $hidden = array(); $sortable = array(); $this->_column_headers = array($columns, $hidden, $sortable); $this->hook_settings = gnt_get_hook_settings(); $this->items = gnt_get_hooks(); }
/** * Show the Hooks page content * @return null */ function gnt_hooks_page_content() { $hooks = gnt_get_hooks(); $hook_settings = gnt_get_hook_settings(); // Save the settings if (isset($_POST['submit']) && check_admin_referer('gnt_save_hooks')) { gnt_save_hook_settings($_POST); gnt_force_redirect($_POST['_wp_http_referer']); } include_once GET_NOTIFIED_PLUGIN_DIR . 'views/hooks.php'; }
/** * Test to make sure the hooks we get are an array * @return null */ function test_register_hook() { gnt_register_hook('test', array('name' => 'Test Hook')); $hooks = gnt_get_hooks(); $this->assertTrue(array_key_exists('test', $hooks)); }