Simple 301 Redirects – Addon – Bulk Uploader - Version 1.2.5

Version Description

Download this release

Release Info

Developer webcraftic
Plugin Icon 128x128 Simple 301 Redirects – Addon – Bulk Uploader
Version 1.2.5
Comparing to
See all releases

Code changes from version 1.2.3 to 1.2.5

301-example.csv CHANGED
@@ -1 +1 @@
1
- "/EXAMPLE-old-url/","/EXAMPLE-new-url/"
1
+ "/EXAMPLE-old-url/","/EXAMPLE-new-url/"
assets/css/notices.css ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .wbcr-s301bu-notice-wrapper {
2
+ padding: 0 !important;
3
+ border: 0;
4
+ box-shadow: none;
5
+ }
6
+
7
+ .wbcr-s301bu-notice {
8
+ padding-right: 15px;
9
+ box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
10
+ }
11
+
12
+ .wbcr-s301bu-leftcol, .wbcr-s301bu-rightcol {
13
+ -webkit-box-flex: 0;
14
+ -webkit-flex: 0 0 auto;
15
+ -ms-flex: 0 0 auto;
16
+ flex: 0 0 auto;
17
+ }
18
+
19
+ .wbcr-s301bu-leftcol {
20
+ padding-right: 14px;
21
+ }
22
+
23
+ .wbcr-s301bu-description {
24
+ -webkit-box-flex: 1;
25
+ -webkit-flex: 1 1 auto;
26
+ -ms-flex: 1 1 auto;
27
+ flex: 1 1 auto;
28
+ padding-right: 40px;
29
+ color: #6c7961;
30
+ line-height: 1.5;
31
+ font-size: 16px;
32
+ }
33
+
34
+ .wbcr-s301bu-plugin-ico {
35
+ margin: 0 auto;
36
+ display: block;
37
+
38
+ }
39
+
40
+ .wbcr-s301bu-title {
41
+ color: #617055;
42
+ font-size: 20px;
43
+ margin-top: 15px;
44
+ margin-bottom: 16px;
45
+ font-weight: bold;
46
+ }
47
+
48
+ .wbcr-s301bu-install-btn, .wbcr-s301bu-install-btn:hover, .wbcr-s301bu-install-btn:active, .wbcr-s301bu-install-btn:focus {
49
+ display: block;
50
+ background: #74c523;
51
+ color: #ffffff;
52
+ padding: 10px 17px;
53
+ border-bottom: 2px solid #5ea21a;
54
+ border-radius: 3px;
55
+ text-decoration: none;
56
+ outline: none;
57
+ box-shadow: none;
58
+ font-size: 14px;
59
+ -webkit-transition: background 0.3s ease-in-out;
60
+ transition: background 0.3s ease-in-out;
61
+ }
62
+
63
+ .wbcr-s301bu-install-btn:hover {
64
+ background: #5dc007;
65
+ }
66
+
67
+ @media screen and (max-width: 1700px) {
68
+ .wbcr-s301bu-notice {
69
+ padding-bottom: 10px;
70
+ }
71
+ }
72
+
73
+ @media screen and (min-width: 700px) {
74
+ .wbcr-s301bu-text-cols, .wbcr-s301bu-notice {
75
+ display: -webkit-box;
76
+ display: -webkit-flex;
77
+ display: -ms-flexbox;
78
+ display: flex;
79
+ }
80
+ }
assets/img/robin.jpg ADDED
Binary file
includes/admin-notices.php DELETED
@@ -1,460 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Admin Notices class
5
- *
6
- * @package WordPress
7
- * @subpackage Admin Notices
8
- */
9
- class Admin_Notices {
10
-
11
- // Configuration
12
- // ---------------------------------------------------------------------------------------------------
13
-
14
- /**
15
- * Plugin suggestions
16
- */
17
- private $days_dismissing_suggestions = 180; // 6 months reappear
18
- private $suggestions_message;
19
- private $suggestions;
20
-
21
- // Properties
22
- // ---------------------------------------------------------------------------------------------------
23
- /**
24
- * Store missing plugins
25
- */
26
- private $missing;
27
- /**
28
- * Default prefix
29
- * Can be changed by the external initialization.
30
- */
31
- private $prefix = 'wbcr_srabup';
32
- /**
33
- * Caller plugin file
34
- */
35
- private $plugin_file;
36
-
37
- /**
38
- * Single class instance
39
- */
40
- private static $instance;
41
-
42
- // Initialization
43
- // ---------------------------------------------------------------------------------------------------
44
-
45
- /**
46
- * Create or retrieve instance
47
- */
48
- public static function instance($plugin_file = null)
49
- {
50
-
51
- // Avoid direct calls
52
- if( !function_exists('add_action') ) {
53
- die;
54
- }
55
-
56
- // Check instance
57
- if( !isset(self::$instance) ) {
58
- self::$instance = new self($plugin_file);
59
- }
60
-
61
- // Done
62
- return self::$instance;
63
- }
64
-
65
-
66
- /**
67
- * Constructor
68
- */
69
- private function __construct($plugin_file = null)
70
- {
71
- // Main plugin file
72
- $this->plugin_file = isset($plugin_file)
73
- ? $plugin_file
74
- : __FILE__;
75
-
76
- // Uninstall hook endpoint
77
- register_uninstall_hook($this->plugin_file, array(__CLASS__, 'uninstall'));
78
-
79
- $this->suggestions_message = '<b>%plugin% Recomended plugins:</b><br>';
80
-
81
- $this->suggestions = array(
82
- 'disable-admin-notices' => array(
83
- 'name' => 'Disable admin notices',
84
- 'desc' => 'This plugin helps to disable notices, so no annoying updates or nag notices (update to premium, leave a comment, etc.) will bug you anymore. You can hide any particular notice or all at once.',
85
- 'filename' => 'disable-admin-notices.php',
86
- ),
87
- 'gonzales' => array(
88
- 'name' => 'Assets Manager',
89
- 'desc' => 'You can disable unused scripts and styles per page or at all website. It also helps to avoid duplication of similar scripts, fonts and styles.',
90
- 'filename' => 'gonzales.php',
91
- ),
92
- 'hide-login-page' => array(
93
- 'name' => 'Hide login and admin page',
94
- 'desc' => 'This simple plugin safely hides login page and disables access to the WordPress admin page. Plugin doesn’t affect the source code, doesn’t rename files and doesn’t change your server configuration.',
95
- 'filename' => 'hide-login-page.php',
96
- ),
97
- 'clearfy' => array(
98
- 'name' => '<span style="color:#f44336;">Clearfy - base Wordpress optimization in one plugin</span>',
99
- 'desc' => 'This is a free plugin to optimize Wordpress. We recommend that you use it, because it performs complex optimization, improves SEO, improves securety of your site, speeds up your site without replacing the popular optimization plugins, but simply completing them. For example, you can extended YOAST SEO features at 30%, and speed optimization plugins by 15-20%! Clearfy will allow you to get rid of a large number of small plug-ins and reduce the load on your site. Try it, it\'s free!',
100
- 'url' => 'https://clearfy.pro/?utm_source=wordpress.org&utm_campaign=simple-301-redirects-addon-bulk-uploader',
101
- )
102
- );
103
-
104
- // Check notices
105
- if( is_admin() ) {
106
- $this->check_timestamps();
107
- $this->check_suggestions();
108
- }
109
- }
110
-
111
- // Timestamp checks
112
- // ---------------------------------------------------------------------------------------------------
113
-
114
- /**
115
- * Creates the activation timestamp only if it does not exist
116
- */
117
- private function check_timestamps()
118
- {
119
- $timestamp = $this->get_activation_timestamp();
120
- if( empty($timestamp) ) {
121
- $this->update_activation_timestamp();
122
- }
123
- }
124
-
125
- /**
126
- * Check the suggestions dismissed timestamp
127
- */
128
- private function check_suggestions()
129
- {
130
-
131
- // Compare timestamp
132
- $timestamp = $this->get_dismissed_timestamp('suggestions');
133
- if( empty($timestamp) || (time() - $timestamp) > ($this->days_dismissing_suggestions * 86400) ) {
134
-
135
- // Check AJAX submit
136
- if( defined('DOING_AJAX') && DOING_AJAX ) {
137
- add_action('wp_ajax_' . $this->prefix . '_dismiss_suggestions', array(
138
- &$this,
139
- 'dismiss_suggestions'
140
- ));
141
- // Admin area (except install or activate plugins page)
142
- } elseif( !in_array(basename($_SERVER['PHP_SELF']), array(
143
- 'plugins.php',
144
- 'plugin-install.php',
145
- 'update.php'
146
- ))
147
- ) {
148
- add_action('wp_loaded', array(&$this, 'load_notices_suggestions'), PHP_INT_MAX);
149
- }
150
- }
151
- }
152
-
153
- // Loaders
154
- // ---------------------------------------------------------------------------------------------------
155
-
156
- /**
157
- * Check and load the sugestions notices
158
- */
159
- public function load_notices_suggestions()
160
- {
161
- // Check the disable nag constant
162
- if( $this->disable_nag_notices() ) {
163
- return;
164
- }
165
-
166
- // Collect missing plugins
167
- $this->missing = $this->get_missing_plugins();
168
- if( !empty($this->missing) && is_array($this->missing) ) {
169
- add_action('admin_footer', array(&$this, 'admin_footer_suggestions'));
170
- add_action('admin_notices', array(&$this, 'admin_notices_suggestions'));
171
- }
172
- }
173
-
174
- // Admin Notices display
175
- // ---------------------------------------------------------------------------------------------------
176
-
177
- /**
178
- * Suggestions display
179
- */
180
- public function admin_notices_suggestions()
181
- {
182
- $plugin_data = get_plugin_data($this->plugin_file);
183
-
184
- ?>
185
- <div class="<?php echo esc_attr($this->prefix); ?>-dismiss-suggestions notice notice-success is-dismissible" data-nonce="<?php echo esc_attr(wp_create_nonce($this->prefix . '-dismiss-suggestions')); ?>">
186
- <p><?php echo str_replace('%plugin%', $plugin_data['Name'], $this->suggestions_message); ?></p>
187
- <ul><?php foreach($this->missing as $plugin) : ?>
188
-
189
- <li><strong><?php echo $this->suggestions[$plugin]['name']; ?></strong>
190
- <a href="<?php echo esc_url($this->get_install_url($plugin)); ?>">
191
- <?php if( in_array(get_locale(), array(
192
- 'ru_RU',
193
- 'bel',
194
- 'kk',
195
- 'uk',
196
- 'bg',
197
- 'bg_BG',
198
- 'ka_GE'
199
- )) ): ?>
200
- (Установить бесплатно)
201
- <?php else: ?>
202
- (Install for free)
203
- <?php endif ?>
204
- </a><br/><?php echo $this->suggestions[$plugin]['desc']; ?></li>
205
-
206
- <?php endforeach; ?></ul>
207
- </div>
208
- <?php
209
- }
210
-
211
- // AJAX Handlers
212
- // ---------------------------------------------------------------------------------------------------
213
-
214
- /**
215
- * Dismiss suggestions
216
- */
217
- public function dismiss_suggestions()
218
- {
219
- if( !empty($_POST['nonce']) && wp_verify_nonce($_POST['nonce'], $this->prefix . '-dismiss-suggestions') ) {
220
- $this->update_dismissed_timestamp('suggestions');
221
- }
222
- }
223
-
224
-
225
- // Plugins information retrieval
226
- // ---------------------------------------------------------------------------------------------------
227
-
228
- /**
229
- * Retrieve uninstalled plugins
230
- */
231
- private function get_missing_plugins()
232
- {
233
-
234
- // Initialize
235
- $inactive = array();
236
-
237
- // Check plugins directory
238
- $directories = array_merge(self::get_mu_plugins_directories(), self::get_plugins_directories());
239
- if( !empty($directories) ) {
240
- $required = array_keys($this->suggestions);
241
- foreach($required as $plugin) {
242
- if( !in_array($plugin, $directories) ) {
243
- $inactive[] = $plugin;
244
- }
245
- }
246
- }
247
-
248
- // Check inactives
249
- if( empty($inactive) ) {
250
- return false;
251
- }
252
-
253
- // Done
254
- return $inactive;
255
- }
256
-
257
-
258
- /**
259
- * Collects all active plugins
260
- */
261
- private function get_plugins_directories()
262
- {
263
-
264
- // Initialize
265
- $directories = array();
266
-
267
- // Plugins split directory
268
- $split = '/' . basename(WP_CONTENT_DIR) . '/' . basename(WP_PLUGIN_DIR) . '/';
269
-
270
- // Multisite plugins
271
- if( is_multisite() ) {
272
- $ms_plugins = wp_get_active_network_plugins();
273
- if( !empty($ms_plugins) && is_array($ms_plugins) ) {
274
- foreach($ms_plugins as $file) {
275
- $directory = explode($split, $file);
276
- $directory = explode('/', ltrim($directory[1], '/'));
277
- $directory = $directory[0];
278
- if( !in_array($directory, $directories) ) {
279
- $directories[] = $directory;
280
- }
281
- }
282
- }
283
- }
284
-
285
- // Active plugins
286
- $plugins = wp_get_active_and_valid_plugins();
287
- if( !empty($plugins) && is_array($plugins) ) {
288
- foreach($plugins as $file) {
289
- $directory = explode($split, $file);
290
- $directory = explode('/', ltrim($directory[1], '/'));
291
- $directory = $directory[0];
292
- if( !in_array($directory, $directories) ) {
293
- $directories[] = $directory;
294
- }
295
- }
296
- }
297
-
298
- // Done
299
- return $directories;
300
- }
301
-
302
-
303
- /**
304
- * Retrieve mu-plugins directories
305
- */
306
- private function get_mu_plugins_directories()
307
- {
308
-
309
- // Initialize
310
- $directories = array();
311
-
312
- // Dependencies
313
- if( !function_exists('get_plugins') ) {
314
- require_once(ABSPATH . 'wp-admin/includes/plugin.php');
315
- }
316
-
317
- // Retrieve mu-plugins
318
- $plugins = get_plugins('/../mu-plugins');
319
- if( !empty($plugins) && is_array($plugins) ) {
320
- foreach($plugins as $path => $info) {
321
- $directory = dirname($path);
322
- if( !in_array($directory, array('.', '..')) ) {
323
- $directories[] = $directory;
324
- }
325
- }
326
- }
327
-
328
- // Done
329
- return $directories;
330
- }
331
-
332
-
333
- /**
334
- * Plugin install/activate URL
335
- */
336
- private function get_install_url($plugin)
337
- {
338
- if( !isset($this->suggestions[$plugin]['filename']) && isset($this->suggestions[$plugin]['url']) ) {
339
- return $this->suggestions[$plugin]['url'];
340
- }
341
-
342
- // Check existing plugin
343
- $exists = @file_exists(WP_PLUGIN_DIR . '/' . $plugin);
344
-
345
- // Activate
346
- if( $exists ) {
347
-
348
- // Existing plugin
349
- $path = $plugin . '/' . $this->suggestions[$plugin]['filename'];
350
-
351
- return admin_url('plugins.php?action=activate&plugin=' . $path . '&_wpnonce=' . wp_create_nonce('activate-plugin_' . $path));
352
- // Install
353
- } else {
354
-
355
- // New plugin
356
- return admin_url('update.php?action=install-plugin&plugin=' . $plugin . '&_wpnonce=' . wp_create_nonce('install-plugin_' . $plugin));
357
- }
358
- }
359
-
360
- /**
361
- * Determines the admin notices display
362
- */
363
- private function disable_nag_notices()
364
- {
365
- return (defined('DISABLE_NAG_NOTICES') && DISABLE_NAG_NOTICES);
366
- }
367
-
368
- // Plugin related
369
- // ---------------------------------------------------------------------------------------------------
370
-
371
- /**
372
- * Plugin uninstall hook
373
- */
374
- public static function uninstall()
375
- {
376
- $admin_notices = self::instance();
377
- $admin_notices->delete_activation_timestamp();
378
- $admin_notices->delete_dismissed_timestamp('suggestions');
379
- }
380
-
381
-
382
-
383
- // Activation timestamp management
384
- // ---------------------------------------------------------------------------------------------------
385
-
386
- /**
387
- * Retrieves the plugin activation timestamp
388
- */
389
- private function get_activation_timestamp()
390
- {
391
- return (int)get_option($this->prefix . '_activated_on');
392
- }
393
-
394
- /**
395
- * Updates activation timestamp
396
- */
397
- private function update_activation_timestamp()
398
- {
399
- update_option($this->prefix . '_activated_on', time(), true);
400
- }
401
-
402
- /**
403
- * Removes activation timestamp
404
- */
405
- private function delete_activation_timestamp()
406
- {
407
- delete_option($this->prefix . '_activated_on');
408
- }
409
-
410
- // Dismissed timestamp management
411
- // ---------------------------------------------------------------------------------------------------
412
-
413
- /**
414
- * Current timestamp by key
415
- */
416
- private function get_dismissed_timestamp($key)
417
- {
418
- return (int)get_option($this->prefix . '_dismissed_' . $key . '_on');
419
- }
420
-
421
- /**
422
- * Update with the current timestamp
423
- */
424
- private function update_dismissed_timestamp($key)
425
- {
426
- update_option($this->prefix . '_dismissed_' . $key . '_on', time(), true);
427
- }
428
-
429
- /**
430
- * Removes dismissied option
431
- */
432
- private function delete_dismissed_timestamp($key)
433
- {
434
- delete_option($this->prefix . '_dismissed_' . $key . '_on');
435
- }
436
-
437
- // Javascript code
438
- // ---------------------------------------------------------------------------------------------------
439
-
440
- /**
441
- * Footer script for Suggestions
442
- */
443
- public function admin_footer_suggestions()
444
- {
445
- ?>
446
- <script type="text/javascript">
447
- jQuery(function($) {
448
-
449
- $(document).on('click', '.<?php echo $this->prefix; ?>-dismiss-suggestions .notice-dismiss', function() {
450
- $.post(ajaxurl, {
451
- 'action': '<?php echo $this->prefix; ?>_dismiss_suggestions',
452
- 'nonce': $(this).parent().attr('data-nonce')
453
- });
454
- });
455
-
456
- });
457
- </script>
458
- <?php
459
- }
460
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
languages/s301r-bulk-uploader-ru_RU.po CHANGED
@@ -1,110 +1,110 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: clearfy\n"
4
- "POT-Creation-Date: 2018-06-26 21:03+0300\n"
5
- "PO-Revision-Date: 2018-06-26 21:09+0300\n"
6
- "Last-Translator: alex.kovalevv@gmail.com <alex.kovalevv@gmail.com>\n"
7
- "Language-Team: Alex Kovalev <alex.kovalevv@gmail.com>\n"
8
- "Language: ru_RU\n"
9
- "MIME-Version: 1.0\n"
10
- "Content-Type: text/plain; charset=UTF-8\n"
11
- "Content-Transfer-Encoding: 8bit\n"
12
- "X-Generator: Poedit 1.8.8\n"
13
- "X-Poedit-Basepath: ..\n"
14
- "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
15
- "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
16
- "X-Poedit-SourceCharset: UTF-8\n"
17
- "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c\n"
18
- "X-Poedit-SearchPath-0: .\n"
19
- "X-Poedit-SearchPathExcluded-0: libs\n"
20
- "X-Poedit-SearchPathExcluded-1: components\n"
21
- "X-Poedit-SearchPathExcluded-2: cache\n"
22
-
23
- #: simple-301-bulk-uploader.php:81
24
- msgid ""
25
- "301 Bulk Uploader requires the Simple 301 Redirects plugin to be installed "
26
- "and active in order to work."
27
- msgstr ""
28
- "Для работы 301 Bulk Uploader требуется, чтобы плагин Simple 301 Redirects "
29
- "был установлен и активирован."
30
-
31
- #: simple-301-bulk-uploader.php:91
32
- msgid "301 Bulk Redirects"
33
- msgstr ""
34
-
35
- #: simple-301-bulk-uploader.php:105
36
- msgid "Simple 301 Redirects - Bulk Upload"
37
- msgstr "Simple 301 Redirects - массовая загрузка"
38
-
39
- #: simple-301-bulk-uploader.php:106
40
- msgid "Example CSV"
41
- msgstr "Пример CSV"
42
-
43
- #: simple-301-bulk-uploader.php:108
44
- msgid "Export current 301's to CSV"
45
- msgstr ""
46
-
47
- #: simple-301-bulk-uploader.php:110
48
- msgid ""
49
- "Are you sure you want to do this? This will not be able to be retrieved. As "
50
- "a backup, please use the export feature to download a current copy before "
51
- "doing this."
52
- msgstr ""
53
-
54
- #: simple-301-bulk-uploader.php:112
55
- msgid "Clear 301 Redirect List (DO SO WITH CAUTION!)"
56
- msgstr ""
57
-
58
- #: simple-301-bulk-uploader.php:119
59
- msgid "Auto Detect End of Line"
60
- msgstr ""
61
-
62
- #: simple-301-bulk-uploader.php:121
63
- msgid ""
64
- "If you are experiencing unusual results after uploading and/or you are using "
65
- "a Mac and have generated the CSV via excel, it is recommended to use this "
66
- "option to force PHP to detect the end of line automatically. By default, PHP "
67
- "has this turned off. This option changes the "
68
- "<strong>'auto_detect_line_endings'</strong> php.ini option temporarily while "
69
- "uploading and reading your CSV file."
70
- msgstr ""
71
-
72
- #: simple-301-bulk-uploader.php:125
73
- msgid "Upload 301s"
74
- msgstr ""
75
-
76
- #: simple-301-bulk-uploader.php:186
77
- msgid "was added to redirect to"
78
- msgstr ""
79
-
80
- #: simple-301-bulk-uploader.php:188
81
- msgid "is missing a corresponding URL to redirect to"
82
- msgstr ""
83
-
84
- #: simple-301-bulk-uploader.php:189
85
- msgid "already exists and was not added"
86
- msgstr ""
87
-
88
- #: simple-301-bulk-uploader.php:196
89
- msgid ""
90
- "<strong>Invalid file</strong>. Use the below for debugging and when asking "
91
- "for support."
92
- msgstr ""
93
-
94
- #: simple-301-bulk-uploader.php:198
95
- msgid "File"
96
- msgstr ""
97
-
98
- #: simple-301-bulk-uploader.php:200
99
- msgid "Approved Mime Types"
100
- msgstr ""
101
-
102
- #: simple-301-bulk-uploader.php:203
103
- msgid ""
104
- "If you are certain that your filetype should be in this list, please let us "
105
- "know on the"
106
- msgstr ""
107
-
108
- #: simple-301-bulk-uploader.php:203
109
- msgid "forums"
110
- msgstr "форумы"
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: clearfy\n"
4
+ "POT-Creation-Date: 2018-06-26 21:03+0300\n"
5
+ "PO-Revision-Date: 2018-06-26 21:09+0300\n"
6
+ "Last-Translator: alex.kovalevv@gmail.com <alex.kovalevv@gmail.com>\n"
7
+ "Language-Team: Alex Kovalev <alex.kovalevv@gmail.com>\n"
8
+ "Language: ru_RU\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 1.8.8\n"
13
+ "X-Poedit-Basepath: ..\n"
14
+ "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
15
+ "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
16
+ "X-Poedit-SourceCharset: UTF-8\n"
17
+ "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c\n"
18
+ "X-Poedit-SearchPath-0: .\n"
19
+ "X-Poedit-SearchPathExcluded-0: libs\n"
20
+ "X-Poedit-SearchPathExcluded-1: components\n"
21
+ "X-Poedit-SearchPathExcluded-2: cache\n"
22
+
23
+ #: simple-301-bulk-uploader.php:81
24
+ msgid ""
25
+ "301 Bulk Uploader requires the Simple 301 Redirects plugin to be installed "
26
+ "and active in order to work."
27
+ msgstr ""
28
+ "Для работы 301 Bulk Uploader требуется, чтобы плагин Simple 301 Redirects "
29
+ "был установлен и активирован."
30
+
31
+ #: simple-301-bulk-uploader.php:91
32
+ msgid "301 Bulk Redirects"
33
+ msgstr ""
34
+
35
+ #: simple-301-bulk-uploader.php:105
36
+ msgid "Simple 301 Redirects - Bulk Upload"
37
+ msgstr "Simple 301 Redirects - массовая загрузка"
38
+
39
+ #: simple-301-bulk-uploader.php:106
40
+ msgid "Example CSV"
41
+ msgstr "Пример CSV"
42
+
43
+ #: simple-301-bulk-uploader.php:108
44
+ msgid "Export current 301's to CSV"
45
+ msgstr ""
46
+
47
+ #: simple-301-bulk-uploader.php:110
48
+ msgid ""
49
+ "Are you sure you want to do this? This will not be able to be retrieved. As "
50
+ "a backup, please use the export feature to download a current copy before "
51
+ "doing this."
52
+ msgstr ""
53
+
54
+ #: simple-301-bulk-uploader.php:112
55
+ msgid "Clear 301 Redirect List (DO SO WITH CAUTION!)"
56
+ msgstr ""
57
+
58
+ #: simple-301-bulk-uploader.php:119
59
+ msgid "Auto Detect End of Line"
60
+ msgstr ""
61
+
62
+ #: simple-301-bulk-uploader.php:121
63
+ msgid ""
64
+ "If you are experiencing unusual results after uploading and/or you are using "
65
+ "a Mac and have generated the CSV via excel, it is recommended to use this "
66
+ "option to force PHP to detect the end of line automatically. By default, PHP "
67
+ "has this turned off. This option changes the "
68
+ "<strong>'auto_detect_line_endings'</strong> php.ini option temporarily while "
69
+ "uploading and reading your CSV file."
70
+ msgstr ""
71
+
72
+ #: simple-301-bulk-uploader.php:125
73
+ msgid "Upload 301s"
74
+ msgstr ""
75
+
76
+ #: simple-301-bulk-uploader.php:186
77
+ msgid "was added to redirect to"
78
+ msgstr ""
79
+
80
+ #: simple-301-bulk-uploader.php:188
81
+ msgid "is missing a corresponding URL to redirect to"
82
+ msgstr ""
83
+
84
+ #: simple-301-bulk-uploader.php:189
85
+ msgid "already exists and was not added"
86
+ msgstr ""
87
+
88
+ #: simple-301-bulk-uploader.php:196
89
+ msgid ""
90
+ "<strong>Invalid file</strong>. Use the below for debugging and when asking "
91
+ "for support."
92
+ msgstr ""
93
+
94
+ #: simple-301-bulk-uploader.php:198
95
+ msgid "File"
96
+ msgstr ""
97
+
98
+ #: simple-301-bulk-uploader.php:200
99
+ msgid "Approved Mime Types"
100
+ msgstr ""
101
+
102
+ #: simple-301-bulk-uploader.php:203
103
+ msgid ""
104
+ "If you are certain that your filetype should be in this list, please let us "
105
+ "know on the"
106
+ msgstr ""
107
+
108
+ #: simple-301-bulk-uploader.php:203
109
+ msgid "forums"
110
+ msgstr "форумы"
readme.txt CHANGED
@@ -1,133 +1,136 @@
1
- === Simple 301 Redirects - Addon - Bulk Uploader ===
2
- Contributors: webcraftic, ashdurham
3
- Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VDX7JNTQPNPFW
4
- Tags: simple 301 redirects, bulk upload, csv, 301, redirects
5
- Requires at least: 3.0.1
6
- Tested up to: 4.9.6
7
- Stable tag: trunk
8
- License: GPLv2
9
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
-
11
- Adds on the ability to bulk upload 301 redirects via CSV to the Simple 301 Redirects plugin
12
-
13
- == Description ==
14
-
15
- This is an ADDON plugin to give further functionality to the plugin [Simple 301 Redirects](http://wordpress.org/plugins/simple-301-redirects/) plugin.
16
-
17
- [Simple 301 Redirects - Addon - Bulk Uploader](http://kingpro.me/plugins/support-plugins/simple-301-redirects-addon-bulk-uploader/) adds an extra section to the settings tab
18
- to upload a CSV of old and new URL's to input into the Simple 301 Redirects plugin. An example CSV is bundled in with the plugin to get you going quickly.
19
-
20
- The plugin checks for duplicate old URLs and alerts you of these in the summary after your CSV has been processed.
21
-
22
- --
23
-
24
- If you have any suggestions or would like to see a feature in the plugin, please let me know in the support forum.
25
-
26
- Any issues you are having, I'd also love to know, so again, please let me know using the support forum.
27
-
28
- --
29
-
30
- #### BIG THANKS ####
31
- Many thanks to [Ash Durham](http://kingpro.me/), for his great contribution to the development of this plugin.
32
- He has excellent projects, you can find out about them here [@kingproplugins on Twitter](http://twitter.com/kingproplugins), [KingProPlugins on Facebook](http://facebook.com/kingproplugins) or [King Pro Plugins on Google+](https://plus.google.com/b/101488033905569308183/101488033905569308183/about)
33
-
34
- #### Recommended our plugins ####
35
-
36
- We invite you to check out a few other related free plugins that our team has also produced that you may find especially useful:
37
-
38
- * [Clearfy – WordPress optimization plugin and disable ultimate tweaker](https://wordpress.org/plugins/clearfy/)
39
- * [Disable Comments for Any Post Types (Remove Comments)](https://wordpress.org/plugins/comments-plus/)
40
- * [Cyrlitera – transliteration of links and file names](https://wordpress.org/plugins/cyrlitera/)
41
- * [Cyr-to-lat reloaded – transliteration of links and file names](https://wordpress.org/plugins/cyr-and-lat/ "Cyr-to-lat reloaded")
42
- * [Disable admin notices individually](https://wordpress.org/plugins/disable-admin-notices/ "Disable admin notices individually")
43
- * [Hide login page](https://wordpress.org/plugins/hide-login-page/ "Hide login page")
44
- * [Disable updates, Disable automatic updates, Updates manager](https://wordpress.org/plugins/webcraftic-updates-manager/)
45
- * [WordPress Assets manager, dequeue scripts, dequeue styles](https://wordpress.org/plugins/gonzales/ "WordPress Assets manager, dequeue scripts, dequeue styles")
46
-
47
-
48
- == Installation ==
49
-
50
- 1. Download and unzip the zip file onto your computer
51
- 2. Upload the 'simple-301-bulk-uploader' folder into the `/wp-content/plugins/` directory (alternatively, install the plugin from the plugin directory within the admin)
52
- 3. Activate the plugin through the 'Plugins' menu in WordPress
53
- 4. Drag the widget into your sidebar and modify the settings or insert the shortcode into a post or theme template.
54
-
55
- --
56
-
57
- Having Trouble? Get support either on the support forums here or at [@kingproplugins on Twitter](http://twitter.com/kingproplugins), [KingProPlugins on Facebook](http://facebook.com/kingproplugins) or [King Pro Plugins on Google+](https://plus.google.com/b/101488033905569308183/101488033905569308183/about)
58
-
59
- --
60
-
61
- == Frequently Asked Questions ==
62
-
63
- = What is a CSV? =
64
-
65
- A CSV is a Comma-Separated Values file, which put simply, is a spreadsheet saved in a particular format.
66
-
67
- = What can I use to create a CSV? =
68
-
69
- To easily create a CSV file, use a spreadsheet program like Excel or Open Office Spreadsheets. Simple 301 Redirects - Addon - Bulk Uploader is setup to handle a 2 column
70
- CSV with the old URL in the first column and the new URL in the second column.
71
-
72
- --
73
-
74
- Have a question thats not listed? Get support either on the support forums here or at [@kingproplugins on Twitter](http://twitter.com/kingproplugins), [KingProPlugins on Facebook](http://facebook.com/kingproplugins) or [King Pro Plugins on Google+](https://plus.google.com/b/101488033905569308183/101488033905569308183/about)
75
-
76
- --
77
-
78
- == Changelog ==
79
- = 1.2.3 =
80
- * Fix some bugs
81
-
82
- = 1.2.2 =
83
- * Compatible with the latest version of Wordpress
84
- * Bug fixes
85
-
86
- = 1.0.14 =
87
- * Added mime type "plain/text"
88
-
89
- = 1.0.13 =
90
- * Added mime type "application/ms-excel"
91
- * Added mime type "application/x-excel"
92
-
93
- = 1.0.12 =
94
- * Updated permissions to match that of the parent plugin
95
- * Another mime type added
96
- * Added icons for WP4.0
97
-
98
- = 1.0.11 =
99
- * Addition of another mime type
100
- * Addition of some error code to help determine mime type issues
101
-
102
- = 1.0.10 =
103
- * Addition of another mime type found in Firefox
104
-
105
- = 1.0.9 =
106
- * Update to deprecated user levels to the matching role
107
-
108
- = 1.0.8 =
109
- * Added ability to delete 301 redirect list
110
-
111
- = 1.0.7 =
112
- * Update to allowed file type list
113
-
114
- = 1.0.6 =
115
- * Export to CSV feature
116
-
117
- = 1.0.5 =
118
- * Option added to force PHP to auto detect line endings
119
-
120
- = 1.0.4 =
121
- * Adding back a mistakenly removed mime type
122
-
123
- = 1.0.3 =
124
- * Addition of another mime type
125
-
126
- = 1.0.2 =
127
- * Addition of further mime types
128
-
129
- = 1.0.1 =
130
- * Update to uploader to read the file coming from a PC
131
-
132
- = 1.0 =
 
 
 
133
  * Initial
1
+ === Simple 301 Redirects - Addon - Bulk Uploader ===
2
+ Contributors: webcraftic, ashdurham
3
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VDX7JNTQPNPFW
4
+ Tags: simple 301 redirects, bulk upload, csv, 301, redirects
5
+ Requires at least: 3.0.1
6
+ Tested up to: 5.0.0
7
+ Stable tag: trunk
8
+ License: GPLv2
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ Adds on the ability to bulk upload 301 redirects via CSV to the Simple 301 Redirects plugin
12
+
13
+ == Description ==
14
+
15
+ This is an ADDON plugin to give further functionality to the plugin [Simple 301 Redirects](http://wordpress.org/plugins/simple-301-redirects/) plugin.
16
+
17
+ [Simple 301 Redirects - Addon - Bulk Uploader](http://kingpro.me/plugins/support-plugins/simple-301-redirects-addon-bulk-uploader/) adds an extra section to the settings tab
18
+ to upload a CSV of old and new URL's to input into the Simple 301 Redirects plugin. An example CSV is bundled in with the plugin to get you going quickly.
19
+
20
+ The plugin checks for duplicate old URLs and alerts you of these in the summary after your CSV has been processed.
21
+
22
+ --
23
+
24
+ If you have any suggestions or would like to see a feature in the plugin, please let me know in the support forum.
25
+
26
+ Any issues you are having, I'd also love to know, so again, please let me know using the support forum.
27
+
28
+ --
29
+
30
+ #### BIG THANKS ####
31
+ Many thanks to [Ash Durham](http://kingpro.me/), for his great contribution to the development of this plugin.
32
+ He has excellent projects, you can find out about them here [@kingproplugins on Twitter](http://twitter.com/kingproplugins), [KingProPlugins on Facebook](http://facebook.com/kingproplugins) or [King Pro Plugins on Google+](https://plus.google.com/b/101488033905569308183/101488033905569308183/about)
33
+
34
+ #### Recommended our plugins ####
35
+
36
+ We invite you to check out a few other related free plugins that our team has also produced that you may find especially useful:
37
+
38
+ * [Clearfy – WordPress optimization plugin and disable ultimate tweaker](https://wordpress.org/plugins/clearfy/)
39
+ * [Disable Comments for Any Post Types (Remove Comments)](https://wordpress.org/plugins/comments-plus/)
40
+ * [Cyrlitera – transliteration of links and file names](https://wordpress.org/plugins/cyrlitera/)
41
+ * [Cyr-to-lat reloaded – transliteration of links and file names](https://wordpress.org/plugins/cyr-and-lat/ "Cyr-to-lat reloaded")
42
+ * [Disable admin notices individually](https://wordpress.org/plugins/disable-admin-notices/ "Disable admin notices individually")
43
+ * [Hide login page](https://wordpress.org/plugins/hide-login-page/ "Hide login page")
44
+ * [Disable updates, Disable automatic updates, Updates manager](https://wordpress.org/plugins/webcraftic-updates-manager/)
45
+ * [WordPress Assets manager, dequeue scripts, dequeue styles](https://wordpress.org/plugins/gonzales/ "WordPress Assets manager, dequeue scripts, dequeue styles")
46
+ * [Robin image optimizer — save money on image compression](https://wordpress.org/plugins/robin-image-optimizer/ "Robin image optimizer — save money on image compression")
47
+
48
+ == Installation ==
49
+
50
+ 1. Download and unzip the zip file onto your computer
51
+ 2. Upload the 'simple-301-bulk-uploader' folder into the `/wp-content/plugins/` directory (alternatively, install the plugin from the plugin directory within the admin)
52
+ 3. Activate the plugin through the 'Plugins' menu in WordPress
53
+ 4. Drag the widget into your sidebar and modify the settings or insert the shortcode into a post or theme template.
54
+
55
+ --
56
+
57
+ Having Trouble? Get support either on the support forums here or at [@kingproplugins on Twitter](http://twitter.com/kingproplugins), [KingProPlugins on Facebook](http://facebook.com/kingproplugins) or [King Pro Plugins on Google+](https://plus.google.com/b/101488033905569308183/101488033905569308183/about)
58
+
59
+ --
60
+
61
+ == Frequently Asked Questions ==
62
+
63
+ = What is a CSV? =
64
+
65
+ A CSV is a Comma-Separated Values file, which put simply, is a spreadsheet saved in a particular format.
66
+
67
+ = What can I use to create a CSV? =
68
+
69
+ To easily create a CSV file, use a spreadsheet program like Excel or Open Office Spreadsheets. Simple 301 Redirects - Addon - Bulk Uploader is setup to handle a 2 column
70
+ CSV with the old URL in the first column and the new URL in the second column.
71
+
72
+ --
73
+
74
+ Have a question thats not listed? Get support either on the support forums here or at [@kingproplugins on Twitter](http://twitter.com/kingproplugins), [KingProPlugins on Facebook](http://facebook.com/kingproplugins) or [King Pro Plugins on Google+](https://plus.google.com/b/101488033905569308183/101488033905569308183/about)
75
+
76
+ --
77
+
78
+ == Changelog ==
79
+ = 1.2.4 =
80
+ * Compatible with Wordpress 5.0
81
+
82
+ = 1.2.3 =
83
+ * Fix some bugs
84
+
85
+ = 1.2.2 =
86
+ * Compatible with the latest version of Wordpress
87
+ * Bug fixes
88
+
89
+ = 1.0.14 =
90
+ * Added mime type "plain/text"
91
+
92
+ = 1.0.13 =
93
+ * Added mime type "application/ms-excel"
94
+ * Added mime type "application/x-excel"
95
+
96
+ = 1.0.12 =
97
+ * Updated permissions to match that of the parent plugin
98
+ * Another mime type added
99
+ * Added icons for WP4.0
100
+
101
+ = 1.0.11 =
102
+ * Addition of another mime type
103
+ * Addition of some error code to help determine mime type issues
104
+
105
+ = 1.0.10 =
106
+ * Addition of another mime type found in Firefox
107
+
108
+ = 1.0.9 =
109
+ * Update to deprecated user levels to the matching role
110
+
111
+ = 1.0.8 =
112
+ * Added ability to delete 301 redirect list
113
+
114
+ = 1.0.7 =
115
+ * Update to allowed file type list
116
+
117
+ = 1.0.6 =
118
+ * Export to CSV feature
119
+
120
+ = 1.0.5 =
121
+ * Option added to force PHP to auto detect line endings
122
+
123
+ = 1.0.4 =
124
+ * Adding back a mistakenly removed mime type
125
+
126
+ = 1.0.3 =
127
+ * Addition of another mime type
128
+
129
+ = 1.0.2 =
130
+ * Addition of further mime types
131
+
132
+ = 1.0.1 =
133
+ * Update to uploader to read the file coming from a PC
134
+
135
+ = 1.0 =
136
  * Initial
simple-301-bulk-uploader.php CHANGED
@@ -1,268 +1,264 @@
1
- <?php
2
- /**
3
- * Plugin Name: Simple 301 Redirects - Addon - Bulk CSV Uploader
4
- * Plugin URI: https://wordpress.org/support/plugin/simple-301-redirects-addon-bulk-uploader
5
- * Description: Adds the ability to upload a CSV to populate the Simple 301 Redirects plugin
6
- * Author: Webcraftic <wordpress.webraftic@gmail.com>, Ash Durham <plugins@kingpro.me>
7
- * Version: 1.2.3
8
- * Text Domain: s301r-bulk-uploader
9
- * Domain Path: /languages/
10
- * Author URI: https://clearfy.pro
11
- */
12
-
13
- /*
14
- Copyright 2018 Webcraftic (email : wordpress.webraftic@gmail.com)
15
- Copyright 2016 Ash Durham (email : plugins@kingpro.me)
16
-
17
- This program is free software; you can redistribute it and/or modify
18
- it under the terms of the GNU General Public License, version 2, as
19
- published by the Free Software Foundation.
20
-
21
- This program is distributed in the hope that it will be useful,
22
- but WITHOUT ANY WARRANTY; without even the implied warranty of
23
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
- GNU General Public License for more details.
25
-
26
- You should have received a copy of the GNU General Public License
27
- along with this program; if not, write to the Free Software
28
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29
- */
30
-
31
- if( !class_exists("Bulk301Uploader") ) {
32
-
33
- class Bulk301Uploader {
34
-
35
- public function __construct()
36
- {
37
- require_once dirname(__FILE__) . '/includes/admin-notices.php';
38
- Admin_Notices::instance(__FILE__);
39
-
40
- add_filter('plugin_row_meta', array($this, 'setPluginMeta'), 10, 2);
41
- // Localization plugin
42
- load_plugin_textdomain('s301r-bulk-uploader', false, dirname(plugin_basename(__FILE__)) . '/languages/');
43
- }
44
-
45
- /**
46
- * @param $links
47
- * @param $file
48
- * @return array
49
- */
50
- public function setPluginMeta($links, $file)
51
- {
52
- $link_title = 'Speed up your site for one click (100% free)';
53
- $url = 'https://clearfy.pro/?utm_source=wordpress.org&utm_campaign=simple-301-redirects-addon-bulk-uploader';
54
-
55
- if( $file == plugin_basename(__FILE__) ) {
56
- $links[] = '<a href="' . $url . '" style="color: #FF5722;font-weight: bold;" target="_blank">' . $link_title . '</a>';
57
- }
58
-
59
- return $links;
60
- }
61
-
62
- /*
63
- check if Simple 301 Redirects exists and is active
64
- */
65
- public function check_for_parent()
66
- {
67
- include_once(ABSPATH . 'wp-admin/includes/plugin.php');
68
- if( !is_plugin_active('simple-301-redirects/wp-simple-301-redirects.php') ) {
69
- add_action('admin_notices', array($this, 'bulk301_admin_notice'));
70
-
71
- return false;
72
- }
73
-
74
- return true;
75
- }
76
-
77
- public function bulk301_admin_notice()
78
- {
79
- ?>
80
- <div class="error">
81
- <p><?php _e("301 Bulk Uploader requires the Simple 301 Redirects plugin to be installed and active in order to work.", 's301r-bulk-uploader'); ?></p>
82
- </div>
83
- <?php
84
- }
85
-
86
- /*
87
- generate the link to the options page under settings
88
- */
89
- public function create_bulk_menu()
90
- {
91
- add_options_page(__('301 Bulk Redirects', 's301r-bulk-uploader'), __('301 Bulk Redirects', 's301r-bulk-uploader'), 'manage_options', '301bulkoptions', array(
92
- $this,
93
- 'bulk_options_page'
94
- ));
95
- }
96
-
97
- /*
98
- generate the options page in the wordpress admin
99
- */
100
- public function bulk_options_page()
101
- {
102
- global $report;
103
- ?>
104
- <div class="wrap">
105
- <h2><?php _e('Simple 301 Redirects - Bulk Upload', 's301r-bulk-uploader') ?></h2>
106
- <a href="<?= plugins_url('301-example.csv', __FILE__); ?>"><?php _e('Example CSV', 's301r-bulk-uploader') ?></a>
107
- -
108
- <a href='<?= admin_url('admin.php?action=bulk301export') ?>'><?php _e('Export current 301\'s to CSV', 's301r-bulk-uploader') ?></a>
109
- -
110
- <a href="<?= admin_url('admin.php?action=bulk301clearlist') ?>" onclick="if(confirm('<?php _e("Are you sure you want to do this? This will not be able to be retrieved. As a backup, please use the export feature to download a current copy before doing this.", 's301r-bulk-uploader') ?>')) {return true;
111
- }else {return false;
112
- }"><?php _e('Clear 301 Redirect List (DO SO WITH CAUTION!)', 's301r-bulk-uploader') ?></a>
113
-
114
- <form method="post" action="options-general.php?page=301bulkoptions" enctype="multipart/form-data">
115
- <input type="file" name="301_bulk_redirects"/>
116
-
117
- <p>
118
- <input type="hidden" name="auto_detect_end_line" value="0"/>
119
- <input type="checkbox" name="auto_detect_end_line" value="1"/><?php _e('Auto Detect End of Line', 's301r-bulk-uploader') ?>
120
- <br/>
121
- <span style="font-size: 10px;"><?php _e("If you are experiencing unusual results after uploading and/or you are using a Mac and have generated the CSV via excel, it is recommended to use this option to force PHP to detect the end of line automatically. By default, PHP has this turned off. This option changes the <strong>'auto_detect_line_endings'</strong> php.ini option temporarily while uploading and reading your CSV file.", 's301r-bulk-uploader') ?></span>
122
- </p>
123
-
124
- <p class="submit">
125
- <input type="submit" name="submit_bulk_301" class="button-primary" value="<?php _e('Upload 301s', 's301r-bulk-uploader') ?>"/>
126
- </p>
127
- </form>
128
-
129
- <?php if( isset($report) ) : echo $report; endif; ?>
130
- </div>
131
- <?php
132
- } // end of function options_page
133
-
134
- /*
135
- save the redirects from the options page to the database
136
- */
137
- public function save_bulk_redirects($data, $auto_detect = 0)
138
- {
139
- // Get Current Redirects
140
- $current_redirects = get_option('301_redirects');
141
-
142
- // Get CSV File
143
- $allowedExts = array("csv");
144
- $temp = explode(".", $data["name"]);
145
- $extension = end($temp);
146
- $report = '';
147
-
148
- $mime_types = array(
149
- 'application/csv',
150
- 'application/excel',
151
- 'application/ms-excel',
152
- 'application/x-excel',
153
- 'application/vnd.ms-excel',
154
- 'application/vnd.msexcel',
155
- 'application/octet-stream',
156
- 'application/data',
157
- 'application/x-csv',
158
- 'application/txt',
159
- 'plain/text',
160
- 'text/anytext',
161
- 'text/csv',
162
- 'text/x-csv',
163
- 'text/plain',
164
- 'text/comma-separated-values'
165
- );
166
-
167
- if( in_array($data["type"], $mime_types) && ($data["size"] < 10000000) && in_array($extension, $allowedExts) ) {
168
- if( $data["error"] > 0 ) {
169
- $report .= "Return Code: " . $data["error"] . "<br>";
170
- } else {
171
- $report .= "Upload: " . $data["name"] . "<br />";
172
- $report .= "Size: " . ($data["size"] / 1024) . " kB<br /><br />";
173
-
174
- $row = 1;
175
-
176
- if( $auto_detect == 1 ) {
177
- ini_set('auto_detect_line_endings', true);
178
- }
179
-
180
- if( ($handle = fopen($data["tmp_name"], "r")) !== false ) {
181
- while( ($data = fgetcsv($handle, 1000, ",")) !== false ) {
182
- $num = count($data);
183
- $row++;
184
- if( !isset($current_redirects[$data[0]]) && $data[1] !== '' ) {
185
- $current_redirects[$data[0]] = $data[1];
186
- $report .= "<strong>" . $data[0] . "</strong> " . __('was added to redirect to', 's301r-bulk-uploader') . $data[1] . "<br />";
187
- } elseif( !isset($current_redirects[$data[0]]) && $data[1] !== '' ) {
188
- $report .= "<span style='color: red'><strong>" . $data[0] . "</strong> " . __('is missing a corresponding URL to redirect to', 's301r-bulk-uploader') . ".</span><br />";
189
- } else $report .= "<span style='color: red'><strong>" . $data[0] . "</strong> " . __('already exists and was not added', 's301r-bulk-uploader') . ".</span><br />";
190
- }
191
- fclose($handle);
192
- update_option('301_redirects', $current_redirects);
193
- }
194
- }
195
- } else {
196
- $report .= __('<strong>Invalid file</strong>. Use the below for debugging and when asking for support.', 's301r-bulk-uploader') . "<br /><br />";
197
-
198
- $report .= "<strong>" . __('File', 's301r-bulk-uploader') . "</strong>: " . print_r($data, 1);
199
- if( !in_array($data["type"], $mime_types) ) {
200
- $report .= "<br /><br /><strong>" . __('Approved Mime Types', 's301r-bulk-uploader') . "</strong>:<br />";
201
- foreach($mime_types as $mtype)
202
- $report .= $mtype . "<br />";
203
- $report .= "<br />" . __('If you are certain that your filetype should be in this list, please let us know on the', 's301r-bulk-uploader') . " <a href='http://wordpress.org/support/plugin/simple-301-redirects-addon-bulk-uploader' target='_blank'>" . __('forums', 's301r-bulk-uploader') . "</a>.";
204
- }
205
- }
206
-
207
- if( $auto_detect == 1 ) {
208
- ini_set('auto_detect_line_endings', false);
209
- }
210
-
211
- return $report;
212
- }
213
-
214
- /*
215
- Export redirects to CSV
216
- */
217
- public function export_bulk_redirects()
218
- {
219
- // Get Current Redirects
220
- $current_redirects = get_option('301_redirects');
221
-
222
- header('Content-Type: application/excel');
223
- header('Content-Disposition: attachment; filename="301_redirects.csv"');
224
- $data = array();
225
-
226
- foreach($current_redirects as $old_url => $new_url) {
227
- $data[] = array($old_url, $new_url);
228
- }
229
-
230
- $fp = fopen('php://output', 'w');
231
- foreach($data as $line) {
232
- fputcsv($fp, $line);
233
- }
234
- fclose($fp);
235
- }
236
-
237
- /*
238
- Clear 301 Redirects list
239
- */
240
- public function clear_301_redirects()
241
- {
242
- update_option('301_redirects', '');
243
- header("Location: " . $_SERVER['HTTP_REFERER']);
244
- }
245
- }
246
- }
247
-
248
- // instantiate
249
- $bulk_redirect_plugin = new Bulk301Uploader();
250
-
251
- if( isset($bulk_redirect_plugin) && $bulk_redirect_plugin->check_for_parent() ) {
252
-
253
- // create the menu
254
- add_action('admin_menu', array($bulk_redirect_plugin, 'create_bulk_menu'));
255
-
256
- // Create export action
257
- add_action('admin_action_bulk301export', array($bulk_redirect_plugin, 'export_bulk_redirects'));
258
-
259
- // Create clear action
260
- add_action('admin_action_bulk301clearlist', array($bulk_redirect_plugin, 'clear_301_redirects'));
261
-
262
- // if submitted, process the data
263
- if( isset($_POST['submit_bulk_301']) ) {
264
- $report = $bulk_redirect_plugin->save_bulk_redirects($_FILES['301_bulk_redirects'], (int)$_POST['auto_detect_end_line']);
265
- }
266
- }
267
-
268
- ?>
1
+ <?php
2
+ /**
3
+ * Plugin Name: Simple 301 Redirects - Addon - Bulk CSV Uploader
4
+ * Plugin URI: https://wordpress.org/support/plugin/simple-301-redirects-addon-bulk-uploader
5
+ * Description: Adds the ability to upload a CSV to populate the Simple 301 Redirects plugin
6
+ * Author: Webcraftic <wordpress.webraftic@gmail.com>, Ash Durham <plugins@kingpro.me>
7
+ * Version: 1.2.5
8
+ * Text Domain: s301r-bulk-uploader
9
+ * Domain Path: /languages/
10
+ * Author URI: https://clearfy.pro
11
+ */
12
+
13
+ /*
14
+ Copyright 2019 Webcraftic (email : wordpress.webraftic@gmail.com)
15
+ Copyright 2016 Ash Durham (email : plugins@kingpro.me)
16
+
17
+ This program is free software; you can redistribute it and/or modify
18
+ it under the terms of the GNU General Public License, version 2, as
19
+ published by the Free Software Foundation.
20
+
21
+ This program is distributed in the hope that it will be useful,
22
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
23
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
+ GNU General Public License for more details.
25
+
26
+ You should have received a copy of the GNU General Public License
27
+ along with this program; if not, write to the Free Software
28
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29
+ */
30
+
31
+ if ( ! class_exists( "Bulk301Uploader" ) ) {
32
+
33
+ class Bulk301Uploader {
34
+
35
+ public function __construct() {
36
+
37
+ // Localization plugin
38
+ load_plugin_textdomain( 's301r-bulk-uploader', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
39
+ }
40
+
41
+
42
+ /*
43
+ check if Simple 301 Redirects exists and is active
44
+ */
45
+ public function check_for_parent() {
46
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
47
+ if ( ! is_plugin_active( 'simple-301-redirects/wp-simple-301-redirects.php' ) ) {
48
+ add_action( 'admin_notices', array( $this, 'bulk301_admin_notice' ) );
49
+
50
+ return false;
51
+ }
52
+
53
+ return true;
54
+ }
55
+
56
+ public function bulk301_admin_notice() {
57
+ ?>
58
+ <div class="error">
59
+ <p><?php _e( "301 Bulk Uploader requires the Simple 301 Redirects plugin to be installed and active in order to work.", 's301r-bulk-uploader' ); ?></p>
60
+ </div>
61
+ <?php
62
+ }
63
+
64
+ /*
65
+ generate the link to the options page under settings
66
+ */
67
+ public function create_bulk_menu() {
68
+ add_options_page( __( '301 Bulk Redirects', 's301r-bulk-uploader' ), __( '301 Bulk Redirects', 's301r-bulk-uploader' ), 'manage_options', '301bulkoptions', array(
69
+ $this,
70
+ 'bulk_options_page'
71
+ ) );
72
+ }
73
+
74
+ /*
75
+ generate the options page in the wordpress admin
76
+ */
77
+ public function bulk_options_page() {
78
+ global $report;
79
+ ?>
80
+ <div class="wrap">
81
+ <h2><?php _e( 'Simple 301 Redirects - Bulk Upload', 's301r-bulk-uploader' ) ?></h2>
82
+ <a href="<?= plugins_url( '301-example.csv', __FILE__ ); ?>"><?php _e( 'Example CSV', 's301r-bulk-uploader' ) ?></a>
83
+ -
84
+ <a href='<?= admin_url( 'admin.php?action=bulk301export' ) ?>'><?php _e( 'Export current 301\'s to CSV', 's301r-bulk-uploader' ) ?></a>
85
+ -
86
+ <a href="<?= admin_url( 'admin.php?action=bulk301clearlist' ) ?>" onclick="if(confirm('<?php _e( "Are you sure you want to do this? This will not be able to be retrieved. As a backup, please use the export feature to download a current copy before doing this.", 's301r-bulk-uploader' ) ?>')) {return true;
87
+ }else {return false;
88
+ }"><?php _e( 'Clear 301 Redirect List (DO SO WITH CAUTION!)', 's301r-bulk-uploader' ) ?></a>
89
+ <form method="post" action="options-general.php?page=301bulkoptions" enctype="multipart/form-data">
90
+ <input type="file" name="301_bulk_redirects"/>
91
+ <p>
92
+ </p>
93
+ <?php wp_nonce_field('bulk_import_form','wpnonce');?>
94
+ <input type="hidden" name="auto_detect_end_line" value="0"/>
95
+ <input type="checkbox" name="auto_detect_end_line" value="1"/><?php _e( 'Auto Detect End of Line', 's301r-bulk-uploader' ) ?>
96
+ <br/>
97
+ <span style="font-size: 10px;"><?php _e( "If you are experiencing unusual results after uploading and/or you are using a Mac and have generated the CSV via excel, it is recommended to use this option to force PHP to detect the end of line automatically. By default, PHP has this turned off. This option changes the <strong>'auto_detect_line_endings'</strong> php.ini option temporarily while uploading and reading your CSV file.", 's301r-bulk-uploader' ) ?></span>
98
+ </p>
99
+ <p class="submit">
100
+ <input type="submit" name="submit_bulk_301" class="button-primary" value="<?php _e( 'Upload 301s', 's301r-bulk-uploader' ) ?>"/>
101
+ </p>
102
+ </form>
103
+ <?php if ( isset( $report ) ) : echo $report; endif; ?>
104
+ </div>
105
+ <?php
106
+ } // end of function options_page
107
+
108
+ /*
109
+ save the redirects from the options page to the database
110
+ */
111
+ public function save_bulk_redirects( $data, $auto_detect = 0 ) {
112
+ if(!current_user_can('manage_options'))
113
+ return __( 'Access denied', 's301r-bulk-uploader' );
114
+
115
+ // Get Current Redirects
116
+ $current_redirects = get_option( '301_redirects' );
117
+
118
+ // Get CSV File
119
+ $allowedExts = array( "csv" );
120
+ $temp = explode( ".", $data["name"] );
121
+ $extension = end( $temp );
122
+ $report = '';
123
+
124
+ $mime_types = array(
125
+ 'application/csv',
126
+ 'application/excel',
127
+ 'application/ms-excel',
128
+ 'application/x-excel',
129
+ 'application/vnd.ms-excel',
130
+ 'application/vnd.msexcel',
131
+ 'application/octet-stream',
132
+ 'application/data',
133
+ 'application/x-csv',
134
+ 'application/txt',
135
+ 'plain/text',
136
+ 'text/anytext',
137
+ 'text/csv',
138
+ 'text/x-csv',
139
+ 'text/plain',
140
+ 'text/comma-separated-values'
141
+ );
142
+
143
+ if ( in_array( $data["type"], $mime_types ) && ( $data["size"] < 10000000 ) && in_array( $extension, $allowedExts ) ) {
144
+ if ( $data["error"] > 0 ) {
145
+ $report .= "Return Code: " . $data["error"] . "<br>";
146
+ } else {
147
+ $report .= "Upload: " . $data["name"] . "<br />";
148
+ $report .= "Size: " . ( $data["size"] / 1024 ) . " kB<br /><br />";
149
+
150
+ $row = 1;
151
+
152
+ if ( $auto_detect == 1 ) {
153
+ ini_set( 'auto_detect_line_endings', true );
154
+ }
155
+
156
+ if ( ( $handle = fopen( $data["tmp_name"], "r" ) ) !== false ) {
157
+ while( ( $data = fgetcsv( $handle, 1000, "," ) ) !== false ) {
158
+ $num = count( $data );
159
+ $row ++;
160
+ if ( ! isset( $current_redirects[ $data[0] ] ) && $data[1] !== '' ) {
161
+ $current_redirects[ $data[0] ] = $data[1];
162
+ $report .= "<strong>" . $data[0] . "</strong> " . __( 'was added to redirect to', 's301r-bulk-uploader' ) . $data[1] . "<br />";
163
+ } elseif ( ! isset( $current_redirects[ $data[0] ] ) && $data[1] !== '' ) {
164
+ $report .= "<span style='color: red'><strong>" . $data[0] . "</strong> " . __( 'is missing a corresponding URL to redirect to', 's301r-bulk-uploader' ) . ".</span><br />";
165
+ } else {
166
+ $report .= "<span style='color: red'><strong>" . $data[0] . "</strong> " . __( 'already exists and was not added', 's301r-bulk-uploader' ) . ".</span><br />";
167
+ }
168
+ }
169
+ fclose( $handle );
170
+ update_option( '301_redirects', $current_redirects );
171
+ }
172
+ }
173
+ } else {
174
+ $report .= __( '<strong>Invalid file</strong>. Use the below for debugging and when asking for support.', 's301r-bulk-uploader' ) . "<br /><br />";
175
+
176
+ $report .= "<strong>" . __( 'File', 's301r-bulk-uploader' ) . "</strong>: " . print_r( $data, 1 );
177
+ if ( ! in_array( $data["type"], $mime_types ) ) {
178
+ $report .= "<br /><br /><strong>" . __( 'Approved Mime Types', 's301r-bulk-uploader' ) . "</strong>:<br />";
179
+ foreach ( $mime_types as $mtype ) {
180
+ $report .= $mtype . "<br />";
181
+ }
182
+ $report .= "<br />" . __( 'If you are certain that your filetype should be in this list, please let us know on the', 's301r-bulk-uploader' ) . " <a href='http://wordpress.org/support/plugin/simple-301-redirects-addon-bulk-uploader' target='_blank'>" . __( 'forums', 's301r-bulk-uploader' ) . "</a>.";
183
+ }
184
+ }
185
+
186
+ if ( $auto_detect == 1 ) {
187
+ ini_set( 'auto_detect_line_endings', false );
188
+ }
189
+
190
+ return $report;
191
+ }
192
+
193
+ /*
194
+ Export redirects to CSV
195
+ */
196
+ public function export_bulk_redirects() {
197
+ if(current_user_can('manage_options')) {
198
+ // Get Current Redirects
199
+ $current_redirects = get_option( '301_redirects' );
200
+
201
+ header( 'Content-Type: application/excel' );
202
+ header( 'Content-Disposition: attachment; filename="301_redirects.csv"' );
203
+ $data = array();
204
+
205
+ foreach ( $current_redirects as $old_url => $new_url ) {
206
+ $data[] = array( $old_url, $new_url );
207
+ }
208
+
209
+ $fp = fopen( 'php://output', 'w' );
210
+ foreach ( $data as $line ) {
211
+ fputcsv( $fp, $line );
212
+ }
213
+ fclose( $fp );
214
+ }
215
+ else echo __( 'Access denied', 's301r-bulk-uploader' );
216
+
217
+ }
218
+
219
+ /*
220
+ Clear 301 Redirects list
221
+ */
222
+ public function clear_301_redirects() {
223
+ if(current_user_can('manage_options'))
224
+ {
225
+ update_option( '301_redirects', '' );
226
+ header( "Location: " . $_SERVER['HTTP_REFERER'] );
227
+ }
228
+ else echo __( 'Access denied', 's301r-bulk-uploader' );
229
+ }
230
+
231
+ /*
232
+ Check import form
233
+ */
234
+ public function check_post_form()
235
+ {
236
+ // if submitted, process the data
237
+ if(isset($_POST['wpnonce']) && isset( $_POST['submit_bulk_301'] ))
238
+ {
239
+ if ( current_user_can( 'manage_options' ) && wp_verify_nonce( $_POST['wpnonce'], 'bulk_import_form'))
240
+ {
241
+ $report = $this->save_bulk_redirects( $_FILES['301_bulk_redirects'], (int) $_POST['auto_detect_end_line'] );
242
+ }
243
+ }
244
+ }
245
+ }
246
+ }
247
+
248
+ // instantiate
249
+ $bulk_redirect_plugin = new Bulk301Uploader();
250
+
251
+ if ( isset( $bulk_redirect_plugin ) && $bulk_redirect_plugin->check_for_parent() ) {
252
+
253
+ // create the menu
254
+ add_action( 'admin_menu', array( $bulk_redirect_plugin, 'create_bulk_menu' ) );
255
+
256
+ // Create export action
257
+ add_action( 'admin_action_bulk301export', array( $bulk_redirect_plugin, 'export_bulk_redirects' ) );
258
+
259
+ // Create clear action
260
+ add_action( 'admin_action_bulk301clearlist', array( $bulk_redirect_plugin, 'clear_301_redirects' ) );
261
+
262
+ add_action( 'plugins_loaded', array( $bulk_redirect_plugin, 'check_post_form'));
263
+ }
264
+