/** * This function is called from Ajax class as a wp_ajax_action * */ protected function action() { // check to see if the submitted nonce matches with the // generated nonce we created if (class_exists('wp_verify_nonce')) { if (!wp_verify_nonce(ABH_Classes_Tools::getValue(_ABH_NONCE_ID_), _ABH_NONCE_ID_)) { die('Invalid request!'); } } }
/** * Called when Post action is triggered * * @return void */ public function action() { parent::action(); switch (ABH_Classes_Tools::getValue('action')) { case 'abh_settings_update': if (ABH_Classes_Tools::getValue('data') != '') { parse_str(ABH_Classes_Tools::getValue('data'), $params); $this->saveValues($params); exit; } else { $this->saveValues($_POST); } ABH_Classes_Tools::emptyCache(); break; case 'abh_settings_subscribe': ABH_Classes_Tools::saveOptions('abh_subscribe', 1); break; case 'abh_powered_by': ABH_Classes_Tools::saveOptions('abh_powered_by', ABH_Classes_Tools::getValue('abh_powered_by')); break; } }
/** * Set the header type * @param type $type */ public static function setHeader($type) { if (ABH_Classes_Tools::getValue('abh_debug') == 'on') { return; } switch ($type) { case 'json': header('Content-Type: application/json'); } }