コード例 #1
0
ファイル: sucuri.php プロジェクト: sirhair/SH_WP_PluginRepo
 /**
  * Respond to the browser according to the data received.
  *
  * @param  array  $response  Response received.
  * @param  array  $data      Data received from the beat.
  * @param  string $screen_id Identifier of the screen the heartbeat occurred on.
  * @return array             Response with new data.
  */
 public static function respond_to_received($response = array(), $data = array(), $screen_id = '')
 {
     $interval = SucuriScanOption::get_option(':heartbeat_interval');
     if ($interval == 'slow' || $interval == 'fast' || $interval == 'standard') {
         $response['heartbeat_interval'] = $interval;
     } else {
         SucuriScanOption::delete_option(':heartbeat_interval');
     }
     return $response;
 }
コード例 #2
0
 public static function timeoutPage($nonce)
 {
     $params = array();
     // Update the SiteCheck timeout.
     if ($nonce) {
         $timeout = (int) SucuriScanRequest::post(':sitecheck_timeout', '[0-9]+');
         if ($timeout > 0) {
             if ($timeout <= SUCURISCAN_MAX_SITECHECK_TIMEOUT) {
                 $message = 'SiteCheck timeout set to <code>' . $timeout . '</code> seconds.';
                 SucuriScanOption::update_option(':sitecheck_timeout', $timeout);
                 SucuriScanEvent::report_info_event($message);
                 SucuriScanEvent::notify_event('plugin_change', $message);
                 SucuriScanInterface::info($message);
             } else {
                 SucuriScanInterface::error('SiteCheck timeout in seconds is too high.');
             }
         }
     }
     $params['MaxRequestTimeout'] = SUCURISCAN_MAX_SITECHECK_TIMEOUT;
     $params['RequestTimeout'] = SucuriScanOption::get_option(':sitecheck_timeout') . ' seconds';
     return SucuriScanTemplate::getSection('settings-sitecheck-timeout', $params);
 }