| 1 |
<?php |
| 2 |
/** |
| 3 |
* Accessibility Checker Plugin. |
| 4 |
* |
| 5 |
* @package Accessibility_Checker |
| 6 |
* @link https://a11ychecker.com |
| 7 |
* @since 1.0.0 |
| 8 |
* |
| 9 |
* @wordpress-plugin |
| 10 |
* Plugin Name: Accessibility Checker |
| 11 |
* Plugin URI: https://a11ychecker.com |
| 12 |
* Description: Audit and check your website for accessibility before you hit publish. In-post accessibility scanner and guidance. |
| 13 |
* Version: 1.42.1 |
| 14 |
* Requires PHP: 7.4 |
| 15 |
* Author: Equalize Digital |
| 16 |
* Author URI: https://equalizedigital.com |
| 17 |
* License: GPL-2.0+ |
| 18 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 19 |
* Text Domain: accessibility-checker |
| 20 |
* Domain Path: /languages |
| 21 |
*/ |
| 22 |
|
| 23 |
use EDAC\Inc\Plugin; |
| 24 |
|
| 25 |
// If this file is called directly, abort. |
| 26 |
if ( ! defined( 'WPINC' ) ) { |
| 27 |
die; |
| 28 |
} |
| 29 |
|
| 30 |
// Include plugin dependency. |
| 31 |
require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 32 |
|
| 33 |
/** |
| 34 |
* Setup constants. |
| 35 |
*/ |
| 36 |
|
| 37 |
// Current plugin version. |
| 38 |
if ( ! defined( 'EDAC_VERSION' ) ) { |
| 39 |
define( 'EDAC_VERSION', '1.42.1' ); |
| 40 |
} |
| 41 |
|
| 42 |
// Current database version. |
| 43 |
if ( ! defined( 'EDAC_DB_VERSION' ) ) { |
| 44 |
define( 'EDAC_DB_VERSION', '1.0.7' ); |
| 45 |
} |
| 46 |
|
| 47 |
// Plugin Folder Path. |
| 48 |
if ( ! defined( 'EDAC_PLUGIN_DIR' ) ) { |
| 49 |
define( 'EDAC_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
| 50 |
} |
| 51 |
|
| 52 |
// Plugin Folder URL. |
| 53 |
if ( ! defined( 'EDAC_PLUGIN_URL' ) ) { |
| 54 |
define( 'EDAC_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
| 55 |
} |
| 56 |
|
| 57 |
// Plugin Root File. |
| 58 |
if ( ! defined( 'EDAC_PLUGIN_FILE' ) ) { |
| 59 |
define( 'EDAC_PLUGIN_FILE', __FILE__ ); |
| 60 |
} |
| 61 |
|
| 62 |
/** |
| 63 |
* Key Valid. |
| 64 |
*/ |
| 65 |
define( |
| 66 |
'EDAC_KEY_VALID', |
| 67 |
'valid' === get_option( 'edacp_license_status' ) |
| 68 |
); |
| 69 |
|
| 70 |
// Enable EDAC_DEBUG mode. |
| 71 |
if ( ! defined( 'EDAC_DEBUG' ) ) { |
| 72 |
define( 'EDAC_DEBUG', false ); |
| 73 |
} |
| 74 |
|
| 75 |
// Default ref is empty - we don't ref links, but it can be filtered by providers. |
| 76 |
if ( ! defined( 'EDAC_REF_PARAM' ) ) { |
| 77 |
define( 'EDAC_REF_PARAM', '' ); |
| 78 |
} |
| 79 |
|
| 80 |
// SVG Icons. |
| 81 |
define( 'EDAC_SVG_IGNORE_ICON', file_get_contents( __DIR__ . '/assets/images/ignore-icon.svg' ) ); |
| 82 |
|
| 83 |
|
| 84 |
/** |
| 85 |
* Plugin Activation & Deactivation |
| 86 |
*/ |
| 87 |
register_activation_hook( __FILE__, 'edac_activation' ); |
| 88 |
register_deactivation_hook( __FILE__, 'edac_deactivation' ); |
| 89 |
|
| 90 |
/* ***************************** CLASS AUTOLOADING *************************** */ |
| 91 |
if ( file_exists( plugin_dir_path( __FILE__ ) . 'vendor/autoload.php' ) ) { |
| 92 |
include_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php'; |
| 93 |
} |
| 94 |
|
| 95 |
if ( class_exists( 'EDAC\Inc\Plugin' ) ) { |
| 96 |
new Plugin(); |
| 97 |
} |
| 98 |
|
| 99 |
/** |
| 100 |
* Import Resources |
| 101 |
*/ |
| 102 |
require_once plugin_dir_path( __FILE__ ) . 'includes/deprecated/deprecated.php'; |
| 103 |
require_once plugin_dir_path( __FILE__ ) . 'includes/activation.php'; |
| 104 |
require_once plugin_dir_path( __FILE__ ) . 'includes/deactivation.php'; |
| 105 |
require_once plugin_dir_path( __FILE__ ) . 'includes/helper-functions.php'; |
| 106 |
require_once plugin_dir_path( __FILE__ ) . 'includes/options-page.php'; |
| 107 |
|
| 108 |
/** |
| 109 |
* Filters and Actions |
| 110 |
*/ |
| 111 |
add_action( 'admin_menu', 'edac_add_options_page' ); |
| 112 |
add_action( 'admin_init', 'edac_register_setting' ); |
| 113 |
|
| 114 |
/** |
| 115 |
* Gets an array of default filters, |
| 116 |
* and applies the rules `edac_filter_register_rules` filter to it. |
| 117 |
* |
| 118 |
* @return array |
| 119 |
*/ |
| 120 |
function edac_register_rules() { |
| 121 |
|
| 122 |
// Use a static variable to avoid multiple calls to the filesystem. |
| 123 |
static $default_rules = null; |
| 124 |
if ( ! is_null( $default_rules ) ) { |
| 125 |
return $default_rules; |
| 126 |
} |
| 127 |
|
| 128 |
// Use the new class-based rules system. |
| 129 |
$default_rules = \EqualizeDigital\AccessibilityChecker\Rules\RuleRegistry::load_rules(); |
| 130 |
|
| 131 |
/** |
| 132 |
* Filter the default rules. |
| 133 |
* |
| 134 |
* Allows removing or adding rules. If you are adding a rule make |
| 135 |
* sure you have added a function matching the pattern: |
| 136 |
* `edac_rule_{$rule_id}`. |
| 137 |
* |
| 138 |
* @since 1.4.0 |
| 139 |
* |
| 140 |
* @param array $default_rules The default rules. |
| 141 |
*/ |
| 142 |
$default_rules = apply_filters( 'edac_filter_register_rules', $default_rules ); |
| 143 |
|
| 144 |
return $default_rules; |
| 145 |
} |
| 146 |
|