/** * Prints a HTML alert in the WordPress admin interface. * * @param string $type The type of alert, it can be either Updated or Error. * @param string $message The message that will be printed in the alert. * @return void */ private static function adminNotice($type = 'updated', $message = '') { $display_notice = true; /** * Do not render notice during user authentication. * * There are some special cases when the error or warning messages should not be * rendered to the end user because it may break the default functionality of * the request handler. For instance, rendering an HTML alert like this when the * user authentication process is executed may cause a "headers already sent" * error. */ if (!empty($_POST) && SucuriScanRequest::post('log') && SucuriScanRequest::post('pwd') && SucuriScanRequest::post('wp-submit')) { $display_notice = false; } // Display the HTML notice to the current user. if ($display_notice === true && !empty($message)) { SucuriScan::throwException($message, $type); echo SucuriScanTemplate::getSection('notification-admin', array('AlertType' => $type, 'AlertUnique' => rand(100, 999), 'AlertMessage' => $message)); } }