Version Description
- Export to CSV feature
Download this release
Release Info
Developer | ashdurham |
Plugin | Simple 301 Redirects – Addon – Bulk Uploader |
Version | 1.0.6 |
Comparing to | |
See all releases |
Code changes from version 1.0.5 to 1.0.6
- readme.txt +7 -1
- simple-301-bulk-uploader.php +26 -1
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://durham.net.au/donate/
|
|
4 |
Tags: simple 301 redirects, bulk upload, csv, 301, redirects
|
5 |
Requires at least: 3.0.1
|
6 |
Tested up to: 3.7.1
|
7 |
-
Stable tag: 1.0.
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -68,6 +68,9 @@ Have a question thats not listed? Get support either on the support forums here
|
|
68 |
|
69 |
== Changelog ==
|
70 |
|
|
|
|
|
|
|
71 |
= 1.0.5 =
|
72 |
* Option added to force PHP to auto detect line endings
|
73 |
|
@@ -88,6 +91,9 @@ Have a question thats not listed? Get support either on the support forums here
|
|
88 |
|
89 |
== Upgrade Notice ==
|
90 |
|
|
|
|
|
|
|
91 |
= 1.0.5 =
|
92 |
* Option added to force PHP to auto detect line endings
|
93 |
|
4 |
Tags: simple 301 redirects, bulk upload, csv, 301, redirects
|
5 |
Requires at least: 3.0.1
|
6 |
Tested up to: 3.7.1
|
7 |
+
Stable tag: 1.0.6
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
68 |
|
69 |
== Changelog ==
|
70 |
|
71 |
+
= 1.0.6 =
|
72 |
+
* Export to CSV feature
|
73 |
+
|
74 |
= 1.0.5 =
|
75 |
* Option added to force PHP to auto detect line endings
|
76 |
|
91 |
|
92 |
== Upgrade Notice ==
|
93 |
|
94 |
+
= 1.0.6 =
|
95 |
+
* Export to CSV feature
|
96 |
+
|
97 |
= 1.0.5 =
|
98 |
* Option added to force PHP to auto detect line endings
|
99 |
|
simple-301-bulk-uploader.php
CHANGED
@@ -65,7 +65,7 @@ if (!class_exists("Bulk301Uploader")) {
|
|
65 |
<div class="wrap">
|
66 |
<h2>Simple 301 Redirects - Bulk Upload</h2>
|
67 |
|
68 |
-
<a href="<?= plugins_url( '301-example.csv', __FILE__ ); ?>">Example CSV</a>
|
69 |
|
70 |
<form method="post" action="options-general.php?page=301bulkoptions" enctype="multipart/form-data">
|
71 |
|
@@ -155,6 +155,28 @@ if (!class_exists("Bulk301Uploader")) {
|
|
155 |
|
156 |
return $report;
|
157 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
}
|
159 |
}
|
160 |
|
@@ -165,6 +187,9 @@ if (isset($bulk_redirect_plugin) && $bulk_redirect_plugin->check_for_parent()) {
|
|
165 |
|
166 |
// create the menu
|
167 |
add_action('admin_menu', array($bulk_redirect_plugin,'create_bulk_menu'));
|
|
|
|
|
|
|
168 |
|
169 |
// if submitted, process the data
|
170 |
if (isset($_POST['submit_bulk_301'])) {
|
65 |
<div class="wrap">
|
66 |
<h2>Simple 301 Redirects - Bulk Upload</h2>
|
67 |
|
68 |
+
<a href="<?= plugins_url( '301-example.csv', __FILE__ ); ?>">Example CSV</a> - <a href='<?= admin_url('admin.php?action=bulk301export') ?>'>Export current 301's to CSV</a>
|
69 |
|
70 |
<form method="post" action="options-general.php?page=301bulkoptions" enctype="multipart/form-data">
|
71 |
|
155 |
|
156 |
return $report;
|
157 |
}
|
158 |
+
|
159 |
+
/*
|
160 |
+
Export redirects to CSV
|
161 |
+
*/
|
162 |
+
function export_bulk_redirects() {
|
163 |
+
// Get Current Redirects
|
164 |
+
$current_redirects = get_option('301_redirects');
|
165 |
+
|
166 |
+
header('Content-Type: application/excel');
|
167 |
+
header('Content-Disposition: attachment; filename="301_redirects.csv"');
|
168 |
+
$data = array();
|
169 |
+
|
170 |
+
foreach ($current_redirects as $old_url=>$new_url) {
|
171 |
+
$data[] = array($old_url,$new_url);
|
172 |
+
}
|
173 |
+
|
174 |
+
$fp = fopen('php://output', 'w');
|
175 |
+
foreach ( $data as $line ) {
|
176 |
+
fputcsv($fp, $line);
|
177 |
+
}
|
178 |
+
fclose($fp);
|
179 |
+
}
|
180 |
}
|
181 |
}
|
182 |
|
187 |
|
188 |
// create the menu
|
189 |
add_action('admin_menu', array($bulk_redirect_plugin,'create_bulk_menu'));
|
190 |
+
|
191 |
+
// Create export action
|
192 |
+
add_action( 'admin_action_bulk301export', array($bulk_redirect_plugin,'export_bulk_redirects') );
|
193 |
|
194 |
// if submitted, process the data
|
195 |
if (isset($_POST['submit_bulk_301'])) {
|