diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..dd9908c
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,6 @@
+root = true
+[*]
+end_of_line = lf
+insert_final_newline = true
+indent_style = tab
+indent_size = 2
diff --git a/wp-simple-301-redirects.php b/wp-simple-301-redirects.php
index 84840f1..5f72c9a 100644
--- a/wp-simple-301-redirects.php
+++ b/wp-simple-301-redirects.php
@@ -3,59 +3,32 @@
Plugin Name: Simple 301 Redirects
Plugin URI: http://www.scottnelle.com/simple-301-redirects-plugin-for-wordpress/
Description: Create a list of URLs that you would like to 301 redirect to another page or site. Now with wildcard support.
-Version: 1.07a
+Version: 1.08
Author: Scott Nellé
Author URI: http://www.scottnelle.com/
-License: GPLv3
*/
-/* Copyright 2009-2014 Scott Nellé (email : contact@scottnelle.com)
+/* Copyright 2009-2020 Scott Nellé (email : contact@scottnelle.com)
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-//@todo: finish javascript edit functionality
-//@todo: only load js on the appropriate page - http://codex.wordpress.org/Function_Reference/wp_enqueue_script#Link_Scripts_Only_on_a_Plugin_Administration_Screen
-//@todo: notify the bulk upload author that you'll be updating the storage format. maybe even patch his plugin for him. https://wordpress.org/plugins/simple-301-redirects-addon-bulk-uploader/
-
if (!class_exists("Simple301redirects")) {
-
- class Simple301Redirects {
- function initialize_admin() {
- $this->maybe_upgrade_db(); // upgrade the storage format if needed
-
- // load necessary js
- wp_register_script( 's301r-script', plugins_url( '/js/simple-301-redirects.js', __FILE__ ), array('jquery') );
- add_action('admin_enqueue_scripts', array($this,'write_scripts'));
-
- // if submitted, process the data
- if (isset($_POST['301_redirects'])) { $this->save_redirects(); }
- }
+ class Simple301Redirects {
- function write_scripts() {
- wp_enqueue_script( 's301r-script' );
-
- // make ajax_url available to the script
- wp_localize_script( 's301r-script', 's301r_ajax', array(
- 'ajax_url' => admin_url( 'admin-ajax.php' ),
- 'delete_nonce' => wp_create_nonce( 'delete-redirect-nonce' ),
- )
- );
- }
-
/**
* create_menu function
* generate the link to the options page under settings
@@ -63,9 +36,9 @@ function write_scripts() {
* @return void
*/
function create_menu() {
- add_options_page('301 Redirects', '301 Redirects', 'manage_options', '301options', array($this,'options_page'));
+ add_options_page('301 Redirects', '301 Redirects', 'manage_options', '301options', array($this,'options_page'));
}
-
+
/**
* options_page function
* generate the options page in the wordpress admin
@@ -75,74 +48,85 @@ function create_menu() {
function options_page() {
?>
-
+
+
Settings saved
';
}
?>
-
+
Simple 301 Redirects
-
-
-
+
+
Documentation
-
Basic Redirects
-
Basic redirects work similar to the format that Apache uses: the request should be relative to your WordPress root. The destination can be either a full URL to any page on the web, or relative to your WordPress root.
+
Simple Redirects
+
Simple redirects work similar to the format that Apache uses: the request should be relative to your WordPress root. The destination can be either a full URL to any page on the web, or relative to your WordPress root.
Example
Request: /old-page/
Destination: /new-page/
-
-
Wildcard Redirects
-
Wildcard redirects can match more than one URL. They use an asterisk (*) to represent any characters. This is a powerful way to redirect an entire directory of pages with one line.
+
+
Wildcards
+
To use wildcards, put an asterisk (*) after the folder name that you want to redirect.
Example
Request: /old-folder/*
Destination: /redirect-everything-here/
-
+
You can also use the asterisk in the destination to replace whatever it matched in the request if you like. Something like this: