Server IP : 172.67.157.199 / Your IP : 3.137.172.195 [ Web Server : Apache System : Linux b70eb322-3aee-0c53-7c82-0db91281f2c6.secureserver.net 6.1.90-1.el9.elrepo.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 2 12:09:22 EDT 2024 x86_64 User : root ( 0) PHP Version : 8.0.30.2 Disable Function : NONE Domains : 0 Domains MySQL : ON | cURL : ON | WGET : ON | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/wp-content/mu-plugins/vendor/wpsec/wp-captcha-plugin/src/utils/ |
Upload File : |
<?php namespace Wpsec\captcha\utils; use Wpsec\captcha\constants\LoggingConstants; class Logger { /** * Logs message into captcha plugin log. * * @param string $message * @param array $data * * @return void */ public static function log( $message, $data = array() ) { try { if ( ! self::should_log() ) { return; } if ( is_array( $data ) || is_object( $data ) ) { $data = wp_json_encode( $data ); if ( empty( $data ) ) { return; } } $log_filename = WP_CONTENT_DIR . '/captcha-plugin-log'; if ( ! file_exists( $log_filename ) ) { mkdir( $log_filename, 0755, true ); } $log_file_data = $log_filename . '/log_' . gmdate( 'Y-m-d' ) . '.log'; $message_to_log = '[' . gmdate( 'Y-m-d H:i:s' ) . '] - ' . $message . ' - ' . $data; file_put_contents( $log_file_data, $message_to_log . "\n", FILE_APPEND ); } catch ( \Throwable $e ) { // catch error silently } } /** * Is logging for captcha plugin enabled. * * @return bool */ private static function should_log() { return get_option( LoggingConstants::CAPTCHA_LOG_ENABLED, 'disabled' ) === 'enabled'; } }