/** * Rolls back activation procedures when de-activating the plugin * * @since 1.0 */ public function deactivate() { WPBRS_Controller_Cron::unregister_cron_jobs(); WPBRS_Controller_Blocker::filter_referrers_htaccess(true); //remove WP Block Referrer Spam rules WPBRS_Model_Admin_Notices::remove_admin_notices(); flush_rewrite_rules(); }
/** * Download and update Referrer Spam list from URL * * @since 1.0 * @param bool $reset * @return bool */ public static function update_from_URL($reset = false) { $contextOptions = array("ssl" => array("verify_peer" => false, "verify_peer_name" => false)); $new_list = file(self::GIT_LIST_URL, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES, stream_context_create($contextOptions)); $settings = self::get_settings(); if (!$reset && $settings && !empty($new_list)) { if (isset($settings['referrer_spam_list']) && $settings['referrer_spam_list'] != '' && $settings['referrer_spam_list'] != $new_list) { $new_list = array_unique(array_merge($new_list, $settings['referrer_spam_list'])); } } $settings['referrer_spam_list'] = array_merge(array(), $new_list); $result = self::update_settings($settings); WPBRS_Controller_Blocker::filter_referrers_htaccess(); return $result; }