PluginProbe
Redirection / 2.3.13
Redirection v2.3.13
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 / url.php

url.php in Redirection 2.3.13, at matches/url.php

67 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Redirection
4 *
5 * @package Redirection
6 * @author John Godley
7 * @copyright Copyright (C) John Godley
8 **/
9
10 /*
11 ============================================================================================================
12 This software is provided "as is" and any express or implied warranties, including, but not limited to, the
13 implied warranties of merchantibility and fitness for a particular purpose are disclaimed. In no event shall
14 the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or
15 consequential damages (including, but not limited to, procurement of substitute goods or services; loss of
16 use, data, or profits; or business interruption) however caused and on any theory of liability, whether in
17 contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of
18 this software, even if advised of the possibility of such damage.
19
20 For full license details see license.txt
21 ============================================================================================================ */
22
23 class URL_Match extends Red_Match {
24 function name () {
25 return __( 'URL only', 'redirection' );
26 }
27
28 function show() {
29 ?>
30 <?php if ( $this->action->can_perform_action() ) : ?>
31 <tr>
32 <th><a target="_blank" href="<?php echo esc_url( $this->url ) ?>"><?php _e( 'Target URL', 'redirection' ); ?>:</a></th>
33 <td>
34 <input style="width: 95%" type="text" name="target" value="<?php echo esc_attr( $this->url ); ?>"/>
35 </td>
36 </tr>
37 <?php endif; ?>
38 <?php if ( $this->action->can_change_code() ) : ?>
39 <tr class="advanced">
40 <th><?php _e( 'HTTP Code', 'redirection' ); ?>:</th>
41 <td>
42 <select name="action_code">
43 <?php $this->action->display_actions(); ?>
44 </select>
45 </td>
46 </tr>
47 <?php endif;
48 }
49
50 function save( $details ) {
51 if ( !isset( $details['target'] ) || strlen( $details['target'] ) == 0 )
52 $details['target'] = '/';
53
54 return array( 'url' => $details['target'] );
55 }
56
57 function get_target( $url, $matched_url, $regex ) {
58 $target = $this->url;
59 if ( $regex )
60 $target = preg_replace( '@'.str_replace( '@', '\\@', $matched_url ).'@', $this->url, $url );
61
62 if ( $target == '' )
63 return $matched_url;
64 return $target;
65 }
66 }
67