| 1 |
<?php |
| 2 |
|
| 3 |
require_once dirname( __FILE__ ) . '/http-header.php'; |
| 4 |
|
| 5 |
/** |
| 6 |
* Check that a cookie value exists |
| 7 |
*/ |
| 8 |
class Cookie_Match extends Header_Match { |
| 9 |
public function name() { |
| 10 |
return __( 'URL and cookie', 'redirection' ); |
| 11 |
} |
| 12 |
|
| 13 |
public function is_match( $url ) { |
| 14 |
if ( $this->regex ) { |
| 15 |
$regex = new Red_Regex( $this->value, true ); |
| 16 |
return $regex->is_match( Redirection_Request::get_cookie( $this->name ) ); |
| 17 |
} |
| 18 |
|
| 19 |
return Redirection_Request::get_cookie( $this->name ) === $this->value; |
| 20 |
} |
| 21 |
} |
| 22 |
|