PluginProbe
Redirection / 5.3.8
Redirection v5.3.8
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 5.3.8, at redirection.php

100 lines 3.6 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: 5.3.8
7 Author: John Godley
8 Text Domain: redirection
9 Domain Path: /locale
10 ============================================================================================================
11 This software is provided "as is" and any express or implied warranties, including, but not limited to, the
12 implied warranties of merchantibility and fitness for a particular purpose are disclaimed. In no event shall
13 the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or
14 consequential damages(including, but not limited to, procurement of substitute goods or services; loss of
15 use, data, or profits; or business interruption) however caused and on any theory of liability, whether in
16 contract, strict liability, or tort(including negligence or otherwise) arising in any way out of the use of
17 this software, even if advised of the possibility of such damage.
18
19 For full license details see license.txt
20 ============================================================================================================
21 */
22
23 define( 'REDIRECTION_DB_VERSION', '4.2' ); // DB schema version. Only change if DB needs changing
24 define( 'REDIRECTION_FILE', __FILE__ );
25 define( 'REDIRECTION_DEV_MODE', false );
26
27 if ( ! defined( 'REDIRECTION_FLYING_SOLO' ) ) {
28 define( 'REDIRECTION_FLYING_SOLO', apply_filters( 'redirection_flying_solo', true ) );
29 }
30
31 // This file must support PHP < 5.6 so as not to crash
32 if ( version_compare( phpversion(), '5.6' ) < 0 ) {
33 add_action( 'plugin_action_links_' . basename( dirname( REDIRECTION_FILE ) ) . '/' . basename( REDIRECTION_FILE ), 'red_deprecated_php', 10, 4 );
34
35 function red_deprecated_php( $links ) {
36 /* translators: 1: server PHP version. 2: required PHP version. */
37 array_unshift( $links, '<a href="https://redirection.me/support/problems/php-version/" style="color: red; text-decoration: underline">' . sprintf( __( 'Disabled! Detected PHP %1$s, need PHP %2$s+', 'redirection' ), phpversion(), '5.6' ) . '</a>' );
38 return $links;
39 }
40
41 return;
42 }
43
44 require_once __DIR__ . '/redirection-version.php';
45 require_once __DIR__ . '/redirection-settings.php';
46 require_once __DIR__ . '/models/redirect/redirect.php';
47 require_once __DIR__ . '/models/url/url.php';
48 require_once __DIR__ . '/models/regex.php';
49 require_once __DIR__ . '/models/module.php';
50 require_once __DIR__ . '/models/log/log.php';
51 require_once __DIR__ . '/models/flusher.php';
52 require_once __DIR__ . '/models/match.php';
53 require_once __DIR__ . '/models/action.php';
54 require_once __DIR__ . '/models/request.php';
55 require_once __DIR__ . '/models/header.php';
56
57 function red_is_wpcli() {
58 if ( defined( 'WP_CLI' ) && WP_CLI ) {
59 return true;
60 }
61
62 return false;
63 }
64
65 function red_is_admin() {
66 if ( is_admin() ) {
67 return true;
68 }
69
70 return false;
71 }
72
73 function red_start_rest() {
74 require_once __DIR__ . '/redirection-admin.php';
75 require_once __DIR__ . '/api/api.php';
76
77 Redirection_Api::init();
78 Redirection_Admin::init();
79
80 remove_action( 'rest_api_init', 'red_start_rest' );
81 }
82
83 function redirection_locale() {
84 load_plugin_textdomain( 'redirection', false, dirname( plugin_basename( REDIRECTION_FILE ) ) . '/locale/' );
85 }
86
87 if ( red_is_admin() || red_is_wpcli() ) {
88 require_once __DIR__ . '/redirection-admin.php';
89 require_once __DIR__ . '/api/api.php';
90 } else {
91 require_once __DIR__ . '/redirection-front.php';
92 }
93
94 if ( red_is_wpcli() ) {
95 require_once __DIR__ . '/redirection-cli.php';
96 }
97
98 add_action( 'rest_api_init', 'red_start_rest' );
99 add_action( 'init', 'redirection_locale' );
100