PluginProbe
Redirection / 2.9
Redirection v2.9
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
← All changes | fileio/apache.php +11 -9 4.02.9 View file →
@@ -3,14 +3,16 @@
3 3 class Red_Apache_File extends Red_FileIO {
4 4 public function force_download() {
5 5 parent::force_download();
6 6
7 + $filename = 'redirection-'.date_i18n( get_option( 'date_format' ) ).'.htaccess';
8 +
7 9 header( 'Content-Type: application/octet-stream' );
8 - header( 'Content-Disposition: attachment; filename="' . $this->export_filename( 'htaccess' ) . '"' );
10 + header( 'Content-Disposition: attachment; filename="'.$filename.'"' );
9 11 }
10 12
11 13 public function get_data( array $items, array $groups ) {
12 - include_once dirname( dirname( __FILE__ ) ) . '/models/htaccess.php';
14 + include_once dirname( dirname( __FILE__ ) ).'/models/htaccess.php';
13 15
14 16 $htaccess = new Red_Htaccess();
15 17
16 18 foreach ( $items as $item ) {
@@ -16,9 +18,9 @@
16 18 foreach ( $items as $item ) {
17 19 $htaccess->add( $item );
18 20 }
19 21
20 - return $htaccess->get() . PHP_EOL;
22 + return $htaccess->get().PHP_EOL;
21 23 }
22 24
23 25 public function load( $group, $filename, $data ) {
24 26 // Remove any comments
@@ -27,9 +29,9 @@
27 29 // Split it into lines
28 30 $lines = array_filter( explode( "\r", $data ) );
29 31 $count = 0;
30 32
31 - foreach ( (array) $lines as $line ) {
33 + foreach ( (array)$lines as $line ) {
32 34 $item = $this->get_as_item( $line );
33 35
34 36 if ( $item ) {
35 37 $item['group_id'] = $group;
@@ -34,9 +36,9 @@
34 36 if ( $item ) {
35 37 $item['group_id'] = $group;
36 38 $redirect = Red_Item::create( $item );
37 39
38 - if ( ! is_wp_error( $redirect ) ) {
40 + if ( !is_wp_error( $redirect ) ) {
39 41 $count++;
40 42 }
41 43 }
42 44 }
@@ -141,24 +143,24 @@
141 143
142 144 return false;
143 145 }
144 146
145 - private function regex_url( $url ) {
147 + private function regex_url ($url) {
146 148 if ( $this->is_str_regex( $url ) ) {
147 149 $tmp = ltrim( $url, '^' );
148 150 $tmp = rtrim( $tmp, '$' );
149 151
150 152 if ( $this->is_str_regex( $tmp ) === false ) {
151 - return '/' . $this->decode_url( $tmp );
153 + return '/'.$this->decode_url( $tmp );
152 154 }
153 155
154 - return '/' . $this->decode_url( $url );
156 + return '/'.$this->decode_url( $url );
155 157 }
156 158
157 159 return $this->decode_url( $url );
158 160 }
159 161
160 - private function get_code( $code ) {
162 + private function get_code ($code) {
161 163 if ( strpos( $code, '301' ) !== false || stripos( $code, 'permanent' ) !== false ) {
162 164 return 301;
163 165 } elseif ( strpos( $code, '302' ) !== false ) {
164 166 return 302;