-
Notifications
You must be signed in to change notification settings - Fork 8
/
accessibility-checker.php
executable file
·186 lines (161 loc) · 5.18 KB
/
accessibility-checker.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
<?php
/**
* Accessibility Checker Plugin.
*
* @package Accessibility_Checker
* @link https://a11ychecker.com
* @since 1.0.0
*
* @wordpress-plugin
* Plugin Name: Accessibility Checker
* Plugin URI: https://a11ychecker.com
* Description: Audit and check your website for accessibility before you hit publish. In-post accessibility scanner and guidance.
* Version: 1.17.0
* Author: Equalize Digital
* Author URI: https://equalizedigital.com
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: accessibility-checker
* Domain Path: /languages
*/
use EDAC\Inc\Plugin;
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
// Include plugin dependency.
require_once ABSPATH . 'wp-admin/includes/plugin.php';
/**
* Setup constants.
*/
// Current plugin version.
if ( ! defined( 'EDAC_VERSION' ) ) {
define( 'EDAC_VERSION', '1.17.0' );
}
// Current database version.
if ( ! defined( 'EDAC_DB_VERSION' ) ) {
define( 'EDAC_DB_VERSION', '1.0.3' );
}
// Plugin Folder Path.
if ( ! defined( 'EDAC_PLUGIN_DIR' ) ) {
define( 'EDAC_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
}
// Plugin Folder URL.
if ( ! defined( 'EDAC_PLUGIN_URL' ) ) {
define( 'EDAC_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
}
// Plugin Root File.
if ( ! defined( 'EDAC_PLUGIN_FILE' ) ) {
define( 'EDAC_PLUGIN_FILE', __FILE__ );
}
// Accessibility New Window Warning Plugin Active.
if ( ! defined( 'EDAC_ANWW_ACTIVE' ) ) {
define(
'EDAC_ANWW_ACTIVE',
is_plugin_active( 'accessibility-new-window-warnings/accessibility-new-window-warnings.php' )
);
}
/**
* Key Valid.
*/
define(
'EDAC_KEY_VALID',
'valid' === get_option( 'edacp_license_status' )
);
// Enable EDAC_DEBUG mode.
if ( ! defined( 'EDAC_DEBUG' ) ) {
define( 'EDAC_DEBUG', false );
}
// SVG Icons.
define( 'EDAC_SVG_IGNORE_ICON', file_get_contents( __DIR__ . '/assets/images/ignore-icon.svg' ) );
/**
* Plugin Activation & Deactivation
*/
register_activation_hook( __FILE__, 'edac_activation' );
register_deactivation_hook( __FILE__, 'edac_deactivation' );
/* ***************************** CLASS AUTOLOADING *************************** */
if ( file_exists( plugin_dir_path( __FILE__ ) . 'vendor/autoload.php' ) ) {
include_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php';
}
if ( class_exists( 'EDAC\Inc\Plugin' ) ) {
new Plugin();
}
/**
* Add simple dom support (need to over ride max file size, if clashes with another install of simple dom there the max file size will be dependednt upon that installation)
*/
if ( ! defined( 'MAX_FILE_SIZE' ) ) {
define( 'MAX_FILE_SIZE', 6000000 );
}
if ( ! class_exists( 'simple_html_dom' ) ) {
include_once plugin_dir_path( __FILE__ ) . 'includes/simplehtmldom/simple_html_dom.php';
include_once plugin_dir_path( __FILE__ ) . 'includes/classes/class-edac-dom.php';
}
/**
* Import Resources
*/
require_once plugin_dir_path( __FILE__ ) . 'includes/deprecated/deprecated.php';
require_once plugin_dir_path( __FILE__ ) . 'includes/activation.php';
require_once plugin_dir_path( __FILE__ ) . 'includes/deactivation.php';
require_once plugin_dir_path( __FILE__ ) . 'includes/helper-functions.php';
require_once plugin_dir_path( __FILE__ ) . 'includes/options-page.php';
require_once plugin_dir_path( __FILE__ ) . 'includes/validate.php';
/**
* Filters and Actions
*/
add_action( 'admin_menu', 'edac_add_options_page' );
add_action( 'admin_init', 'edac_register_setting' );
add_action( 'admin_head', 'edac_post_on_load' );
add_filter( 'save_post', 'edac_save_post', 10, 3 );
add_action( 'pre_get_posts', 'edac_show_draft_posts' );
if ( is_plugin_active( 'oxygen/functions.php' ) ) {
add_action( 'added_post_meta', 'edac_oxygen_builder_save_post', 10, 4 );
add_action( 'updated_post_meta', 'edac_oxygen_builder_save_post', 10, 4 );
}
/**
* Gets an array of default filters,
* and applies the rules `edac_filter_register_rules` filter to it.
*
* @return array
*/
function edac_register_rules() {
// Use a static variable to avoid multiple calls to the filesystem.
static $default_rules = null;
if ( ! is_null( $default_rules ) ) {
return $default_rules;
}
// If we got this far, this is the 1st time we called this function.
// We need to load the rules from the filesystem, and apply any filters.
$default_rules = include __DIR__ . '/includes/rules.php';
/**
* Filter the default rules.
*
* Allows removing or adding rules. If you are adding a rule make
* sure you have added a function matching the pattern:
* `edac_rule_{$rule_id}`.
*
* @since 1.4.0
*
* @param array $default_rules The default rules.
*/
$default_rules = apply_filters( 'edac_filter_register_rules', $default_rules );
return $default_rules;
}
/**
* Include Rules
*
* @return void
*/
function edac_include_rules_files() {
$rules = edac_register_rules();
if ( ! $rules ) {
return;
}
foreach ( $rules as $rule ) {
if ( ( array_key_exists( 'ruleset', $rule ) && 'php' === $rule['ruleset'] )
|| ( ! array_key_exists( 'ruleset', $rule ) && $rule['slug'] )
) {
require_once plugin_dir_path( __FILE__ ) . 'includes/rules/' . $rule['slug'] . '.php';
}
}
}
add_action( 'init', 'edac_include_rules_files' );