/** * Send a request to the API to register this site. * * @param string $email Optional email address for the registration. * @return boolean True if the API key was generated, false otherwise. */ public static function register_site($email = '') { if (!is_string($email) || empty($email)) { $email = self::get_site_email(); } $response = self::api_call_wordpress('POST', array('e' => $email, 's' => self::get_domain(), 'a' => 'register_site'), false); if (self::handle_response($response)) { self::set_plugin_key($response['body']->output->api_key); SucuriScanEvent::schedule_task(); SucuriScanEvent::notify_event('plugin_change', 'Site registered and API key generated'); SucuriScanInterface::info('The API key for your site was successfully generated and saved.'); return true; } return false; }
/** * Initialization code for the plugin. * * The initial variables and information needed by the plugin during the * execution of other functions will be generated. Things like the real IP * address of the client when it has been forwarded or it's behind an external * service like a Proxy. * * @return void */ public static function initialize() { if (SucuriScan::support_reverse_proxy() || SucuriScan::is_behind_cloudproxy()) { $_SERVER['SUCURIREAL_REMOTE_ADDR'] = $_SERVER['REMOTE_ADDR']; $_SERVER['REMOTE_ADDR'] = SucuriScan::get_remote_addr(); } SucuriScanEvent::schedule_task(false); }