| 1 |
<?php |
| 2 |
/* |
| 3 |
Plugin Name: Redirection |
| 4 |
Plugin URI: http://urbangiraffe.com/plugins/redirection/ |
| 5 |
Description: Manage all your 301 redirects and monitor 404 errors |
| 6 |
Version: 2.4 |
| 7 |
Author: John Godley |
| 8 |
Author URI: http://urbangiraffe.com |
| 9 |
============================================================================================================ |
| 10 |
This software is provided "as is" and any express or implied warranties, including, but not limited to, the |
| 11 |
implied warranties of merchantibility and fitness for a particular purpose are disclaimed. In no event shall |
| 12 |
the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or |
| 13 |
consequential damages(including, but not limited to, procurement of substitute goods or services; loss of |
| 14 |
use, data, or profits; or business interruption) however caused and on any theory of liability, whether in |
| 15 |
contract, strict liability, or tort(including negligence or otherwise) arising in any way out of the use of |
| 16 |
this software, even if advised of the possibility of such damage. |
| 17 |
|
| 18 |
For full license details see license.txt |
| 19 |
============================================================================================================ |
| 20 |
*/ |
| 21 |
|
| 22 |
define( 'REDIRECTION_VERSION', '2.3.2' ); // DB schema version. Only change if DB needs changing |
| 23 |
define( 'REDIRECTION_FILE', __FILE__ ); |
| 24 |
|
| 25 |
include dirname( __FILE__ ).'/models/module.php'; |
| 26 |
include dirname( __FILE__ ).'/models/log.php'; |
| 27 |
include dirname( __FILE__ ).'/models/flusher.php'; |
| 28 |
include dirname( __FILE__ ).'/models/match.php'; |
| 29 |
include dirname( __FILE__ ).'/models/action.php'; |
| 30 |
include dirname( __FILE__ ).'/models/redirect.php'; |
| 31 |
|
| 32 |
function red_get_options() { |
| 33 |
$options = get_option( 'redirection_options' ); |
| 34 |
if ( $options === false ) |
| 35 |
$options = array(); |
| 36 |
|
| 37 |
$defaults = apply_filters( 'red_default_options', array( |
| 38 |
'support' => false, |
| 39 |
'token' => md5( uniqid() ), |
| 40 |
'monitor_post' => 0, |
| 41 |
'auto_target' => '', |
| 42 |
'expire_redirect' => 7, |
| 43 |
'expire_404' => 7, |
| 44 |
'modules' => array() |
| 45 |
) ); |
| 46 |
|
| 47 |
foreach ( $defaults AS $key => $value ) { |
| 48 |
if ( !isset( $options[$key] ) ) |
| 49 |
$options[$key] = $value; |
| 50 |
} |
| 51 |
|
| 52 |
$options['lookup'] = apply_filters( 'red_lookup_ip', 'http://urbangiraffe.com/map/?ip=' ); |
| 53 |
return $options; |
| 54 |
} |
| 55 |
|
| 56 |
if ( is_admin() ) |
| 57 |
include dirname( __FILE__ ).'/redirection-admin.php'; |
| 58 |
else |
| 59 |
include dirname( __FILE__ ).'/redirection-front.php'; |
| 60 |
|