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
← All changes | models/file-io.php +10 -23 4.22.7 View file →
@@ -4,21 +4,21 @@
4 4 public static function create( $type ) {
5 5 $exporter = false;
6 6
7 7 if ( $type === 'rss' ) {
8 - include_once dirname( dirname( __FILE__ ) ) . '/fileio/rss.php';
8 + include_once dirname( dirname( __FILE__ ) ).'/fileio/rss.php';
9 9 $exporter = new Red_Rss_File();
10 10 } elseif ( $type === 'csv' ) {
11 - include_once dirname( dirname( __FILE__ ) ) . '/fileio/csv.php';
11 + include_once dirname( dirname( __FILE__ ) ).'/fileio/csv.php';
12 12 $exporter = new Red_Csv_File();
13 13 } elseif ( $type === 'apache' ) {
14 - include_once dirname( dirname( __FILE__ ) ) . '/fileio/apache.php';
14 + include_once dirname( dirname( __FILE__ ) ).'/fileio/apache.php';
15 15 $exporter = new Red_Apache_File();
16 16 } elseif ( $type === 'nginx' ) {
17 - include_once dirname( dirname( __FILE__ ) ) . '/fileio/nginx.php';
17 + include_once dirname( dirname( __FILE__ ) ).'/fileio/nginx.php';
18 18 $exporter = new Red_Nginx_File();
19 19 } elseif ( $type === 'json' ) {
20 - include_once dirname( dirname( __FILE__ ) ) . '/fileio/json.php';
20 + include_once dirname( dirname( __FILE__ ) ).'/fileio/json.php';
21 21 $exporter = new Red_Json_File();
22 22 }
23 23
24 24 return $exporter;
@@ -26,20 +26,19 @@
26 26
27 27 public static function import( $group_id, $file ) {
28 28 $parts = pathinfo( $file['name'] );
29 29 $extension = isset( $parts['extension'] ) ? $parts['extension'] : '';
30 - $extension = strtolower( $extension );
31 30
32 31 if ( $extension === 'csv' ) {
33 - include_once dirname( dirname( __FILE__ ) ) . '/fileio/csv.php';
32 + include_once dirname( dirname( __FILE__ ) ).'/fileio/csv.php';
34 33 $importer = new Red_Csv_File();
35 34 $data = '';
36 - } elseif ( $extension === 'json' ) {
37 - include_once dirname( dirname( __FILE__ ) ) . '/fileio/json.php';
35 + } else if ( $extension === 'json' ) {
36 + include_once dirname( dirname( __FILE__ ) ).'/fileio/json.php';
38 37 $importer = new Red_Json_File();
39 38 $data = @file_get_contents( $file['tmp_name'] );
40 39 } else {
41 - include_once dirname( dirname( __FILE__ ) ) . '/fileio/apache.php';
40 + include_once dirname( dirname( __FILE__ ) ).'/fileio/apache.php';
42 41 $importer = new Red_Apache_File();
43 42 $data = @file_get_contents( $file['tmp_name'] );
44 43 }
45 44
@@ -57,21 +56,9 @@
57 56 header( 'Cache-Control: no-cache, must-revalidate' );
58 57 header( 'Expires: Mon, 26 Jul 1997 05:00:00 GMT' );
59 58 }
60 59
61 - protected function export_filename( $extension ) {
62 - $name = wp_parse_url( home_url(), PHP_URL_HOST );
63 - $name = str_replace( '.', '-', $name );
64 - $date = strtolower( date_i18n( get_option( 'date_format' ) ) );
65 - $date = str_replace( [ ',', ' ', '--' ], '-', $date );
66 -
67 - return 'redirection-' . $name . '-' . $date . '.' . $extension;
68 - }
69 -
70 60 public static function export( $module_name_or_id, $format ) {
71 - $groups = false;
72 - $items = false;
73 -
74 61 if ( $module_name_or_id === 'all' || $module_name_or_id === 0 ) {
75 62 $groups = Red_Group::get_all();
76 63 $items = Red_Item::get_all();
77 64 } else {
@@ -84,9 +71,9 @@
84 71 }
85 72 }
86 73
87 74 $exporter = self::create( $format );
88 - if ( $exporter && $items !== false && $groups !== false ) {
75 + if ( $exporter && $items && $groups ) {
89 76 return array(
90 77 'data' => $exporter->get_data( $items, $groups ),
91 78 'total' => count( $items ),
92 79 'exporter' => $exporter,