| Server IP : 37.27.51.148 / Your IP : 216.73.217.84 Web Server : nginx/1.14.1 System : Linux libra 4.18.0-553.51.1.el8_10.x86_64 #1 SMP Wed Apr 30 20:24:04 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.3.31 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/html/wp-content/plugins/redirection/models/redirect/ |
Upload File : |
<?php
/**
* Options for a redirect source URL
*
* @phpstan-type SourceOptionsJson array{
* log_exclude?: bool
* }
*/
class Red_Source_Options {
/**
* Exclude this from logging.
*
* @var boolean
*/
private $log_exclude = false;
/**
* Constructor
*
* @param SourceOptionsJson|null $options Options.
*/
public function __construct( $options = null ) {
if ( $options !== null ) {
$this->set_options( $options );
}
}
/**
* Set options
*
* @param SourceOptionsJson $options Options.
* @return void
*/
public function set_options( $options ) {
if ( isset( $options['log_exclude'] ) && $options['log_exclude'] === true ) {
$this->log_exclude = true;
}
}
/**
* Can this source be logged?
*
* @return boolean
*/
public function can_log() {
$options = Red_Options::get();
if ( $options['expire_redirect'] !== -1 ) {
return ! $this->log_exclude;
}
return false;
}
/**
* Get options as JSON
*
* @return SourceOptionsJson
*/
public function get_json() {
return array_filter(
[
'log_exclude' => $this->log_exclude,
]
);
}
}