-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhatemile_for_wp.php
More file actions
executable file
·151 lines (144 loc) · 3.93 KB
/
hatemile_for_wp.php
File metadata and controls
executable file
·151 lines (144 loc) · 3.93 KB
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
<?php
/*
Plugin Name: HaTeMiLe for WP
Description: HaTeMiLe for WP is a wordpress plugin that convert the HTML code of pages in a code more accessible.
Version: 1.1
Author: Carlson Santana Cruz
License: Apache License, Version 2.0
License URI: http://www.apache.org/licenses/LICENSE-2.0
*/
const HATEMILE_PLUGIN_DOMAIN = 'hatemile-plugin-domain';
$hatemileOptions = array(
array(
'id' => 'hide_hatemile_changes',
'label' => __(
'Hide visual changes of HaTeMiLe',
HATEMILE_PLUGIN_DOMAIN
),
'default' => 'on'
),
array(
'id' => 'display_all_alternative_text_images',
'label' => __(
'Display the alternative text of all images',
HATEMILE_PLUGIN_DOMAIN
),
'default' => 'on'
),
array(
'id' => 'display_all_cell_headers',
'label' => __(
'Display the headers of each data cell of all tables',
HATEMILE_PLUGIN_DOMAIN
),
'default' => 'on'
),
array(
'id' => 'display_all_languages',
'label' => __(
'Display the language of all elements',
HATEMILE_PLUGIN_DOMAIN
),
'default' => 'on'
),
array(
'id' => 'display_all_links_attributes',
'label' => __(
'Display the attributes of all links',
HATEMILE_PLUGIN_DOMAIN
),
'default' => 'on'
),
array(
'id' => 'display_all_roles',
'label' => __(
'Display the WAI-ARIA roles of all elements',
HATEMILE_PLUGIN_DOMAIN
),
'default' => 'on'
),
array(
'id' => 'display_all_titles',
'label' => __(
'Display the titles of all elements',
HATEMILE_PLUGIN_DOMAIN
),
'default' => 'on'
),
array(
'id' => 'display_all_shortcuts',
'label' => __('Display all shortcuts', HATEMILE_PLUGIN_DOMAIN),
'default' => 'on'
),
array(
'id' => 'display_all_wai_aria_states',
'label' => __(
'Display the WAI-ARIA attributes of all elements',
HATEMILE_PLUGIN_DOMAIN
),
'default' => 'on'
),
array(
'id' => 'provide_navigation_to_all_long_descriptions',
'label' => __(
'Provide links to access the longs descriptions',
HATEMILE_PLUGIN_DOMAIN
),
'default' => 'on'
),
array(
'id' => 'provide_navigation_by_all_headings',
'label' => __('Provide navigation by headings', HATEMILE_PLUGIN_DOMAIN),
'default' => 'on'
),
array(
'id' => 'provide_navigation_by_all_skippers',
'label' => __(
'Provide navigation by content skippers',
HATEMILE_PLUGIN_DOMAIN
),
'default' => 'on'
)
);
/**
* Returns the value of option.
* @param string $optionName The option name.
* @return boolean True if the option is enabled or false if the options is
* disabled.
*/
function isEnableHaTeMiLeOption($optionName) {
global $hatemileOptions;
$option = null;
foreach ($hatemileOptions as $hatemileOption) {
if (('hatemile_' . $hatemileOption['id']) === $optionName) {
$option = $hatemileOption;
break;
}
}
$optionValue = get_option($optionName, $option['default']);
if ((!empty($optionValue)) && ($optionValue === 'on')) {
return true;
} else {
return false;
}
}
/**
* Execute the HaTeMiLe by buffer of PHP.
*/
function executeHatemileByBuffer()
{
require_once join(DIRECTORY_SEPARATOR, array(
plugin_dir_path(__FILE__),
'execute_hatemile.php'
));
ob_start('executeHatemile');
}
if (!is_admin()) {
add_action('init', 'executeHatemileByBuffer');
} else {
require_once join(DIRECTORY_SEPARATOR, array(
plugin_dir_path(__FILE__),
'settings.php'
));
generateHaTeMiLeSettings();
}