PluginProbe
Redirection / 3.6
Redirection v3.6
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
redirection / redirection.php

redirection.php in Redirection 3.6, at redirection.php

90 lines 3.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 Plugin Name: Redirection
4 Plugin URI: https://redirection.me/
5 Description: Manage all your 301 redirects and monitor 404 errors
6 Version: 3.6
7 Author: John Godley
8 Author URI: https://johngodley.com
9 Text Domain: redirection
10 Domain Path: /locale
11 ============================================================================================================
12 This software is provided "as is" and any express or implied warranties, including, but not limited to, the
13 implied warranties of merchantibility and fitness for a particular purpose are disclaimed. In no event shall
14 the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or
15 consequential damages(including, but not limited to, procurement of substitute goods or services; loss of
16 use, data, or profits; or business interruption) however caused and on any theory of liability, whether in
17 contract, strict liability, or tort(including negligence or otherwise) arising in any way out of the use of
18 this software, even if advised of the possibility of such damage.
19
20 For full license details see license.txt
21 ============================================================================================================
22 */
23
24 define( 'REDIRECTION_DB_VERSION', '2.4' ); // DB schema version. Only change if DB needs changing
25 define( 'REDIRECTION_FILE', __FILE__ );
26 define( 'REDIRECTION_DEV_MODE', false );
27
28 if ( ! defined( 'REDIRECTION_FLYING_SOLO' ) ) {
29 define( 'REDIRECTION_FLYING_SOLO', apply_filters( 'redirection_flying_solo', true ) );
30 }
31
32 include dirname( __FILE__ ) . '/redirection-version.php';
33 include dirname( __FILE__ ) . '/redirection-settings.php';
34 include dirname( __FILE__ ) . '/models/redirect.php';
35 include dirname( __FILE__ ) . '/models/module.php';
36 include dirname( __FILE__ ) . '/models/log.php';
37 include dirname( __FILE__ ) . '/models/flusher.php';
38
39 if ( version_compare( phpversion(), '5.4' ) < 0 ) {
40 include dirname( __FILE__ ) . '/models/match-deprecated.php';
41 } else {
42 include dirname( __FILE__ ) . '/models/match.php';
43 }
44
45 include dirname( __FILE__ ) . '/models/action.php';
46 include dirname( __FILE__ ) . '/models/request.php';
47
48 function red_is_wpcli() {
49 if ( defined( 'WP_CLI' ) && WP_CLI ) {
50 return true;
51 }
52
53 return false;
54 }
55
56 function red_is_admin() {
57 if ( is_admin() ) {
58 return true;
59 }
60
61 return false;
62 }
63
64 function red_start_rest() {
65 include_once dirname( __FILE__ ) . '/redirection-admin.php';
66 include_once dirname( __FILE__ ) . '/redirection-api.php';
67
68 Redirection_Api::init();
69
70 remove_action( 'rest_api_init', 'red_start_rest' );
71 }
72
73 function redirection_locale() {
74 load_plugin_textdomain( 'redirection', false, dirname( plugin_basename( REDIRECTION_FILE ) ) . '/locale/' );
75 }
76
77 if ( red_is_admin() || red_is_wpcli() ) {
78 include_once dirname( __FILE__ ) . '/redirection-admin.php';
79 include_once dirname( __FILE__ ) . '/redirection-api.php';
80 } else {
81 include_once dirname( __FILE__ ) . '/redirection-front.php';
82 }
83
84 if ( red_is_wpcli() ) {
85 include_once dirname( __FILE__ ) . '/redirection-cli.php';
86 }
87
88 add_action( 'rest_api_init', 'red_start_rest' );
89 add_action( 'init', 'redirection_locale' );
90