| Server IP : 63.32.33.223 / Your IP : 172.31.12.34 Web Server : Apache/2.4.68 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/3.0.2 System : Linux ip-172-31-10-208.eu-west-1.compute.internal 6.8.0-1044-aws #46~22.04.1-Ubuntu SMP Tue Dec 2 12:52:18 UTC 2025 x86_64 User : kazang ( 1006) PHP Version : 8.2.31 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,exec,system,passthru,shell_exec,proc_open,popen MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/kazang/web/kazang.com/public_html/wp-content/plugins/redirection/matches/ |
Upload File : |
<?php
/**
* @phpstan-type PageMap array{
* page?: string,
* url?: string
* }
* @phpstan-type PageResult array{
* page: string,
* url?: string
* }
* @phpstan-type PageData array{
* page: string,
* url: string
* }
*
* Match the WordPress page type
*
* @phpstan-extends Red_Match<PageMap, PageResult>
*/
class Page_Match extends Red_Match {
use FromUrl_Match;
/**
* Page type
*
* @var string
*/
public $page = '404';
public function name() {
return __( 'URL and WordPress page type', 'redirection' );
}
/**
* Save data to an array, ready for serializing.
*
* @param PageMap $details New match data.
* @param bool $no_target_url Does the action have a target URL.
* @return PageResult
*/
public function save( array $details, $no_target_url = false ) {
$data = array( 'page' => isset( $details['page'] ) ? $this->sanitize_page( $details['page'] ) : '404' );
$result = $this->save_data( $details, $no_target_url, $data );
return $result; // @phpstan-ignore-line
}
/**
* @param string $page
* @return string
*/
private function sanitize_page( $page ) {
return '404';
}
public function is_match( $url ) {
return is_404();
}
/**
* Get the match data for persistence.
*
* @return PageData
*/
public function get_data() {
return array_merge(
array(
'page' => $this->page,
),
$this->get_from_data()
);
}
/**
* Load the match data into this instance.
*
* @param string|PageMap $values Match values, as read from the database (plain text, serialized PHP, or parsed array).
* @return void
*/
public function load( $values ) {
$data = $this->load_data( $values );
$this->page = isset( $data['page'] ) ? $data['page'] : '404'; // @phpstan-ignore-line
}
}