protected function handleCustomActions() { if (!isset($_GET['custom_action'], $_GET['nonce'], $_GET['post'])) { return; } $strNonce = AmazonAutoLinks_WPUtilities::getTransient('AAL_Nonce_' . $_GET['nonce']); if ($strNonce === false) { add_action('admin_notices', array($this, 'notifyNonceFailed')); return; } AmazonAutoLinks_WPUtilities::deleteTransient('AAL_Nonce_' . $_GET['nonce']); // Currently only the status toggle is supported. if ($_GET['custom_action'] == 'toggle_status' && $_GET['post']) { $arrUnitIDs = get_post_meta($_GET['post'], 'unit_ids', true); if (empty($arrUnitIDs)) { return; } // if this field is empty, the post must be the wrong post type. $fIsEnabled = get_post_meta($_GET['post'], 'status', true); update_post_meta($_GET['post'], 'status', !$fIsEnabled); } }
/** * Deletes the cache of the provided URL. */ public function deleteCache($strURL) { AmazonAutoLinks_WPUtilities::deleteTransient($this->strHTMLCachePrefix . md5($strURL)); }