broken-link-checker
Last commit date
app
2 years ago
assets
2 years ago
core
2 years ago
languages
2 years ago
legacy
2 years ago
broken-link-checker.php
2 years ago
readme.txt
2 years ago
uninstall.php
2 years ago
broken-link-checker.php
155 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Broken Link Checker |
| 4 | * |
| 5 | * @link https://wordpress.org/plugins/broken-link-checker/ |
| 6 | * @since 1.0.0 |
| 7 | * @package broken-link-checker |
| 8 | * |
| 9 | * @wordpress-plugin |
| 10 | * Plugin Name: Broken Link Checker |
| 11 | * Plugin URI: https://wordpress.org/plugins/broken-link-checker/ |
| 12 | * Description: Checks your blog for broken links and notifies you on the dashboard if any are found. |
| 13 | * Version: 2.2.4 |
| 14 | * Requires at least: 5.2 |
| 15 | * Requires PHP: 7.4 |
| 16 | * Author: WPMU DEV |
| 17 | * Author URI: https://wpmudev.com/ |
| 18 | * Text Domain: broken-link-checker |
| 19 | * License: GPLv2 or later |
| 20 | * License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 21 | */ |
| 22 | |
| 23 | /* |
| 24 | Broken Link Checker is free software: you can redistribute it and/or modify |
| 25 | it under the terms of the GNU General Public License as published by |
| 26 | the Free Software Foundation, either version 2 of the License, or |
| 27 | any later version. |
| 28 | |
| 29 | Broken Link Checker is distributed in the hope that it will be useful, |
| 30 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 31 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 32 | GNU General Public License for more details. |
| 33 | |
| 34 | You should have received a copy of the GNU General Public License |
| 35 | along with Broken Link Checker. If not, see https://www.gnu.org/licenses/gpl-2.0.html. |
| 36 | */ |
| 37 | |
| 38 | namespace WPMUDEV_BLC; |
| 39 | |
| 40 | // If this file is called directly, abort. |
| 41 | defined( 'WPINC' ) || die; |
| 42 | |
| 43 | // Plugin version. |
| 44 | if ( ! defined( 'WPMUDEV_BLC_VERSION' ) ) { |
| 45 | define( 'WPMUDEV_BLC_VERSION', '2.2.4' ); |
| 46 | } |
| 47 | |
| 48 | // Define WPMUDEV_BLC_PLUGIN_FILE. |
| 49 | if ( ! defined( 'WPMUDEV_BLC_PLUGIN_FILE' ) ) { |
| 50 | define( 'WPMUDEV_BLC_PLUGIN_FILE', __FILE__ ); |
| 51 | } |
| 52 | |
| 53 | // Plugin basename. |
| 54 | if ( ! defined( 'WPMUDEV_BLC_BASENAME' ) ) { |
| 55 | define( 'WPMUDEV_BLC_BASENAME', plugin_basename( __FILE__ ) ); |
| 56 | } |
| 57 | |
| 58 | // Plugin directory. |
| 59 | if ( ! defined( 'WPMUDEV_BLC_DIR' ) ) { |
| 60 | define( 'WPMUDEV_BLC_DIR', plugin_dir_path( __FILE__ ) ); |
| 61 | } |
| 62 | |
| 63 | // Plugin url. |
| 64 | if ( ! defined( 'WPMUDEV_BLC_URL' ) ) { |
| 65 | define( 'WPMUDEV_BLC_URL', plugin_dir_url( __FILE__ ) ); |
| 66 | } |
| 67 | // Assets url. |
| 68 | if ( ! defined( 'WPMUDEV_BLC_ASSETS_URL' ) ) { |
| 69 | define( 'WPMUDEV_BLC_ASSETS_URL', plugin_dir_url( __FILE__ ) . trailingslashit( 'assets' ) ); |
| 70 | } |
| 71 | |
| 72 | // Scripts version. |
| 73 | if ( ! defined( 'WPMUDEV_BLC_SCIPTS_VERSION' ) ) { |
| 74 | define( 'WPMUDEV_BLC_SCIPTS_VERSION', '2.2.4' ); |
| 75 | } |
| 76 | |
| 77 | // SUI version number used in BLC_SHARED_UI_VERSION and enqueues. |
| 78 | if ( ! defined( 'BLC_SHARED_UI_VERSION_NUMBER' ) ) { |
| 79 | define( 'BLC_SHARED_UI_VERSION_NUMBER', '2-12-23' ); |
| 80 | } |
| 81 | |
| 82 | // SUI version used in admin body class. |
| 83 | if ( ! defined( 'BLC_SHARED_UI_VERSION' ) ) { |
| 84 | define( 'BLC_SHARED_UI_VERSION', 'sui-' . BLC_SHARED_UI_VERSION_NUMBER ); |
| 85 | } |
| 86 | |
| 87 | // Path to the plugin's legacy directory. |
| 88 | if ( ! defined( 'BLC_DIRECTORY_LEGACY' ) ) { |
| 89 | define( 'BLC_DIRECTORY_LEGACY', WPMUDEV_BLC_DIR . '/legacy' ); |
| 90 | } |
| 91 | |
| 92 | // Path to legacy file. |
| 93 | if ( ! defined( 'BLC_PLUGIN_FILE_LEGACY' ) ) { |
| 94 | //define( 'BLC_PLUGIN_FILE_LEGACY', BLC_DIRECTORY_LEGACY . '/init.php' ); |
| 95 | define( 'BLC_PLUGIN_FILE_LEGACY', BLC_DIRECTORY_LEGACY . '/init.php' ); |
| 96 | } |
| 97 | |
| 98 | // Autoloader. |
| 99 | require_once plugin_dir_path( __FILE__ ) . 'core/utils/autoloader.php'; |
| 100 | |
| 101 | /** |
| 102 | * Run plugin activation hook to setup plugin. |
| 103 | * |
| 104 | * @since 2.0.0 |
| 105 | */ |
| 106 | |
| 107 | // Make sure wpmudev_blc_instance is not already defined. |
| 108 | if ( ! function_exists( 'wpmudev_blc_instance' ) && ! function_exists( 'WPMUDEV_BLC\wpmudev_blc_instance' ) ) { |
| 109 | /** |
| 110 | * Main instance of plugin. |
| 111 | * |
| 112 | * Returns the main instance of WPMUDEV_BLC to prevent the need to use globals |
| 113 | * and to maintain a single copy of the plugin object. |
| 114 | * You can simply call WPMUDEV_BLC\instance() to access the object. |
| 115 | * |
| 116 | * @since 2.0.0 |
| 117 | * |
| 118 | * @return object WPMUDEV_BLC\Core\Loader |
| 119 | */ |
| 120 | function wpmudev_blc_instance() { |
| 121 | return Core\Loader::instance(); |
| 122 | } |
| 123 | |
| 124 | // Init the plugin and load the plugin instance for the first time. |
| 125 | add_action( 'plugins_loaded', 'WPMUDEV_BLC\\wpmudev_blc_instance' ); |
| 126 | |
| 127 | if ( isset( $_GET['wpmudev-hub'] ) && empty( get_option( 'blc_settings' ) ) ) { |
| 128 | wpmudev_blc_instance(); |
| 129 | do_action( 'wpmudev_blc_plugin_activated' ); |
| 130 | } |
| 131 | |
| 132 | register_activation_hook( |
| 133 | __FILE__, |
| 134 | function() { |
| 135 | Core\Activation::instance(); |
| 136 | } |
| 137 | ); |
| 138 | |
| 139 | register_deactivation_hook( |
| 140 | __FILE__, |
| 141 | function() { |
| 142 | Core\Deactivation::instance(); |
| 143 | } |
| 144 | ); |
| 145 | } |
| 146 | |
| 147 | // Load the legacy plugin. |
| 148 | add_action( |
| 149 | 'plugins_loaded', |
| 150 | function() { |
| 151 | require 'legacy/init.php'; |
| 152 | }, |
| 153 | 11 |
| 154 | ); |
| 155 |