PluginProbe
Redirection / 2.6.3
Redirection v2.6.3
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.6.3, at matches/url.php

47 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 class URL_Match extends Red_Match {
4 function name () {
5 return __( 'URL only', 'redirection' );
6 }
7
8 function show() {
9 ?>
10 <?php if ( $this->action->can_perform_action() ) : ?>
11 <tr>
12 <th><a target="_blank" href="<?php echo esc_url( $this->url ) ?>"><?php _e( 'Target URL', 'redirection' ); ?>:</a></th>
13 <td>
14 <input style="width: 95%" type="text" name="target" value="<?php echo esc_attr( $this->url ); ?>"/>
15 </td>
16 </tr>
17 <?php endif; ?>
18 <?php if ( $this->action->can_change_code() ) : ?>
19 <tr class="advanced">
20 <th><?php _e( 'HTTP Code', 'redirection' ); ?>:</th>
21 <td>
22 <select name="action_code">
23 <?php $this->action->display_actions(); ?>
24 </select>
25 </td>
26 </tr>
27 <?php endif;
28 }
29
30 function save( $details ) {
31 if ( ! isset( $details['target'] ) || strlen( $details['target'] ) === 0 )
32 $details['target'] = '/';
33
34 return array( 'url' => $this->sanitize_url( $details['target'] ) );
35 }
36
37 function get_target( $url, $matched_url, $regex ) {
38 $target = $this->url;
39 if ( $regex )
40 $target = preg_replace( '@'.str_replace( '@', '\\@', $matched_url ).'@', $this->url, $url );
41
42 if ( $target === '' )
43 return $matched_url;
44 return $target;
45 }
46 }
47