PluginProbe
Redirection / 2.7
Redirection v2.7
5.10.0 5.9.0 5.8.1 5.8.0 3.7.2 3.7.3 4.0 4.0.1 4.1 4.1.1 4.2 4.2.1 4.2.2 4.2.3 4.3 4.3.1 4.3.2 4.3.3 4.4 4.4.1 4.4.2 4.5 4.5.1 4.6.2 4.7.1 All 130 releases
redirection / matches / login.php

login.php in Redirection 2.7, at matches/login.php

39 lines 929 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 class Login_Match extends Red_Match {
4 public $user_agent = '';
5
6 function name() {
7 return __( 'URL and login status', 'redirection' );
8 }
9
10 public function save( array $details, $no_target_url = false ) {
11 if ( $no_target_url ) {
12 return null;
13 }
14
15 return array(
16 'logged_in' => isset( $details['action_data_logged_in'] ) ? $this->sanitize_url( $details['action_data_logged_in'] ) : '',
17 'logged_out' => isset( $details['action_data_logged_out'] ) ? $this->sanitize_url( $details['action_data_logged_out'] ) : '',
18 );
19 }
20
21 function initialize( $url ) {
22 $this->url = array( $url, '' );
23 }
24
25 function get_target( $url, $matched_url, $regex ) {
26 if ( is_user_logged_in() === false ) {
27 $target = $this->url_loggedout;
28 } else {
29 $target = $this->url_loggedin;
30 }
31
32 if ( $regex ) {
33 $target = preg_replace( '@'.str_replace( '@', '\\@', $matched_url ).'@', $target, $url );
34 }
35
36 return $target;
37 }
38 }
39