Version Description
- Different JS for aria-current; previous version could only work on a single element, not a collection.
Download this release
Release Info
Developer | joedolson |
Plugin | WP Accessibility |
Version | 1.6.9 |
Comparing to | |
See all releases |
Code changes from version 1.6.7 to 1.6.9
- js/current-menu-item.js +1 -1
- readme.txt +13 -2
- wp-accessibility-alt.php +8 -8
- wp-accessibility-contrast.php +8 -8
- wp-accessibility-longdesc.php +3 -3
- wp-accessibility-settings.php +14 -20
- wp-accessibility-toolbar.php +17 -17
- wp-accessibility.php +52 -54
js/current-menu-item.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
(function ($) {
|
2 |
$(function() {
|
3 |
-
$( '.current-menu-item a, .current_page_item a' ).attr( 'aria-current', '
|
4 |
});
|
5 |
}(jQuery));
|
1 |
(function ($) {
|
2 |
$(function() {
|
3 |
+
$( '.current-menu-item a, .current_page_item a' ).attr( 'aria-current', 'page' ).append( "<span class='screen-reader-text'>(current)</span>" );
|
4 |
});
|
5 |
}(jQuery));
|
readme.txt
CHANGED
@@ -4,8 +4,8 @@ Donate link: http://www.joedolson.com/donate/
|
|
4 |
Tags: title, accessibility, accessible, navigation, wcag, a11y, section508, focus, alt text, labels, aria
|
5 |
Requires at least: 3.4.2
|
6 |
Requires PHP: 5.3
|
7 |
-
Tested up to: 5.
|
8 |
-
Stable tag: 1.6.
|
9 |
Text Domain: wp-accessibility
|
10 |
License: GPLv2 or later
|
11 |
|
@@ -65,6 +65,17 @@ The plug-in is intended to help with deficiencies commonly found in themes and t
|
|
65 |
[Suggest a change!](https://github.com/joedolson/wp-accessibility/issues/)
|
66 |
* Conflict with NextGen gallery to explore
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
= 1.6.7 =
|
69 |
|
70 |
* Bug fix: error in generated CSS for skiplinks
|
4 |
Tags: title, accessibility, accessible, navigation, wcag, a11y, section508, focus, alt text, labels, aria
|
5 |
Requires at least: 3.4.2
|
6 |
Requires PHP: 5.3
|
7 |
+
Tested up to: 5.2
|
8 |
+
Stable tag: 1.6.9
|
9 |
Text Domain: wp-accessibility
|
10 |
License: GPLv2 or later
|
11 |
|
65 |
[Suggest a change!](https://github.com/joedolson/wp-accessibility/issues/)
|
66 |
* Conflict with NextGen gallery to explore
|
67 |
|
68 |
+
= 1.6.9 =
|
69 |
+
|
70 |
+
* Different JS for aria-current; previous version could only work on a single element, not a collection.
|
71 |
+
|
72 |
+
= 1.6.8 =
|
73 |
+
|
74 |
+
* Update to RegEx filtering title attributes to avoid data-title attributes. Thanks to @nextendweb
|
75 |
+
* Update PHP test suite to eliminate PHP 5.3 tests.
|
76 |
+
* Higher min/max sizes for toolbar buttons
|
77 |
+
* Remove setting for aria-current; now always enabled.
|
78 |
+
|
79 |
= 1.6.7 =
|
80 |
|
81 |
* Bug fix: error in generated CSS for skiplinks
|
wp-accessibility-alt.php
CHANGED
@@ -37,18 +37,18 @@ function wpa_media_columns( $columns ) {
|
|
37 |
* @return String alt attribute status for this object.
|
38 |
*/
|
39 |
function wpa_media_value( $column, $id ) {
|
40 |
-
if ( 'wpa_data'
|
41 |
$mime = get_post_mime_type( $id );
|
42 |
switch ( $mime ) {
|
43 |
case 'image/jpeg':
|
44 |
case 'image/png':
|
45 |
case 'image/gif':
|
46 |
$alt = get_post_meta( $id, '_wp_attachment_image_alt', true );
|
47 |
-
$no_alt = get_post_meta( $id, '_no_alt', true );
|
48 |
if ( ! $alt && ! $no_alt ) {
|
49 |
echo '<span class="missing"><span class="dashicons dashicons-no" aria-hidden="true"></span> <a href="' . get_edit_post_link( $id ) . '#attachment_alt">' . __( 'Add <code>alt</code> text', 'wp-accessibility' ) . '</a></span>';
|
50 |
} else {
|
51 |
-
if (
|
52 |
echo '<span class="ok"><span class="dashicons dashicons-yes" aria-hidden="true"></span> ' . __( 'Decorative', 'wp-accessibility' ) . '</span>';
|
53 |
} else {
|
54 |
echo '<span class="ok"><span class="dashicons dashicons-yes" aria-hidden="true"></span> ' . __( 'Has <code>alt</code>', 'wp-accessibility' ) . '</span>';
|
@@ -74,7 +74,7 @@ add_filter( 'attachment_fields_to_edit', 'wpa_insert_alt_verification', 10, 2 );
|
|
74 |
*/
|
75 |
function wpa_insert_alt_verification( $form_fields, $post ) {
|
76 |
$mime = get_post_mime_type( $post->ID );
|
77 |
-
if ( 'image/jpeg'
|
78 |
$no_alt = get_post_meta( $post->ID, '_no_alt', true );
|
79 |
$alt = get_post_meta( $post->ID, '_wp_attachment_image_alt', true );
|
80 |
$checked = checked( $no_alt, 1, false );
|
@@ -124,15 +124,15 @@ add_filter( 'image_send_to_editor', 'wpa_alt_attribute', 10, 8 );
|
|
124 |
*/
|
125 |
function wpa_alt_attribute( $html, $id, $caption, $title, $align, $url, $size, $alt ) {
|
126 |
// Get data for the image attachment.
|
127 |
-
$noalt = get_post_meta( $id, '_no_alt', true );
|
128 |
// Get the original title to compare to alt.
|
129 |
$title = get_the_title( $id );
|
130 |
$warning = false;
|
131 |
-
if (
|
132 |
$html = str_replace( 'alt="' . $alt . '"', 'alt=""', $html );
|
133 |
}
|
134 |
-
if ( ( ''
|
135 |
-
if ( $alt
|
136 |
$warning = __( 'The alt text for this image is the same as the title. In most cases, that means that the alt attribute has been automatically provided from the image file name.', 'wp-accessibility' );
|
137 |
$image = 'alt-same.png';
|
138 |
} else {
|
37 |
* @return String alt attribute status for this object.
|
38 |
*/
|
39 |
function wpa_media_value( $column, $id ) {
|
40 |
+
if ( 'wpa_data' === $column ) {
|
41 |
$mime = get_post_mime_type( $id );
|
42 |
switch ( $mime ) {
|
43 |
case 'image/jpeg':
|
44 |
case 'image/png':
|
45 |
case 'image/gif':
|
46 |
$alt = get_post_meta( $id, '_wp_attachment_image_alt', true );
|
47 |
+
$no_alt = (bool) get_post_meta( $id, '_no_alt', true );
|
48 |
if ( ! $alt && ! $no_alt ) {
|
49 |
echo '<span class="missing"><span class="dashicons dashicons-no" aria-hidden="true"></span> <a href="' . get_edit_post_link( $id ) . '#attachment_alt">' . __( 'Add <code>alt</code> text', 'wp-accessibility' ) . '</a></span>';
|
50 |
} else {
|
51 |
+
if ( true === $no_alt ) {
|
52 |
echo '<span class="ok"><span class="dashicons dashicons-yes" aria-hidden="true"></span> ' . __( 'Decorative', 'wp-accessibility' ) . '</span>';
|
53 |
} else {
|
54 |
echo '<span class="ok"><span class="dashicons dashicons-yes" aria-hidden="true"></span> ' . __( 'Has <code>alt</code>', 'wp-accessibility' ) . '</span>';
|
74 |
*/
|
75 |
function wpa_insert_alt_verification( $form_fields, $post ) {
|
76 |
$mime = get_post_mime_type( $post->ID );
|
77 |
+
if ( 'image/jpeg' === $mime || 'image/png' === $mime || 'image/gif' === $mime ) {
|
78 |
$no_alt = get_post_meta( $post->ID, '_no_alt', true );
|
79 |
$alt = get_post_meta( $post->ID, '_wp_attachment_image_alt', true );
|
80 |
$checked = checked( $no_alt, 1, false );
|
124 |
*/
|
125 |
function wpa_alt_attribute( $html, $id, $caption, $title, $align, $url, $size, $alt ) {
|
126 |
// Get data for the image attachment.
|
127 |
+
$noalt = (bool) get_post_meta( $id, '_no_alt', true );
|
128 |
// Get the original title to compare to alt.
|
129 |
$title = get_the_title( $id );
|
130 |
$warning = false;
|
131 |
+
if ( true === $noalt ) {
|
132 |
$html = str_replace( 'alt="' . $alt . '"', 'alt=""', $html );
|
133 |
}
|
134 |
+
if ( ( '' === $alt || $alt === $title ) && true !== $noalt ) {
|
135 |
+
if ( $alt === $title ) {
|
136 |
$warning = __( 'The alt text for this image is the same as the title. In most cases, that means that the alt attribute has been automatically provided from the image file name.', 'wp-accessibility' );
|
137 |
$image = 'alt-same.png';
|
138 |
} else {
|
wp-accessibility-contrast.php
CHANGED
@@ -62,7 +62,7 @@ function wpa_luminosity( $r, $r2, $g, $g2, $b, $b2 ) {
|
|
62 |
* @return Hexadecimal color equivalent.
|
63 |
*/
|
64 |
function wpa_rgb2hex( $r, $g = - 1, $b = - 1 ) {
|
65 |
-
if ( is_array( $r ) && sizeof( $r )
|
66 |
list( $r, $g, $b ) = $r;
|
67 |
}
|
68 |
$r = intval( $r );
|
@@ -89,7 +89,7 @@ function wpa_rgb2hex( $r, $g = - 1, $b = - 1 ) {
|
|
89 |
*/
|
90 |
function wpa_hex2rgb( $color ) {
|
91 |
$color = str_replace( '#', '', $color );
|
92 |
-
if ( strlen( $color )
|
93 |
return array( 0, 0, 0 );
|
94 |
}
|
95 |
$rgb = array();
|
@@ -109,12 +109,12 @@ function wpa_contrast() {
|
|
109 |
if ( ! wp_verify_nonce( $nonce, 'wpa-nonce' ) ) {
|
110 |
die( 'Security check failed' );
|
111 |
}
|
112 |
-
if ( isset( $_POST['color'] ) && ''
|
113 |
$fore_color = $_POST['color'];
|
114 |
-
if ( '#'
|
115 |
$fore_color = str_replace( '#', '', $fore_color );
|
116 |
}
|
117 |
-
if ( 3
|
118 |
$color6char = $fore_color[0] . $fore_color[0];
|
119 |
$color6char .= $fore_color[1] . $fore_color[1];
|
120 |
$color6char .= $fore_color[2] . $fore_color[2];
|
@@ -125,12 +125,12 @@ function wpa_contrast() {
|
|
125 |
} else {
|
126 |
$echo_hex_fore = 'FFFFFF';
|
127 |
}
|
128 |
-
if ( isset( $_POST['color2'] ) && ''
|
129 |
$back_color = $_POST['color2'];
|
130 |
-
if ( '#'
|
131 |
$back_color = str_replace( '#', '', $back_color );
|
132 |
}
|
133 |
-
if ( 3
|
134 |
$color6char = $back_color[0] . $back_color[0];
|
135 |
$color6char .= $back_color[1] . $back_color[1];
|
136 |
$color6char .= $back_color[2] . $back_color[2];
|
62 |
* @return Hexadecimal color equivalent.
|
63 |
*/
|
64 |
function wpa_rgb2hex( $r, $g = - 1, $b = - 1 ) {
|
65 |
+
if ( is_array( $r ) && sizeof( $r ) === 3 ) {
|
66 |
list( $r, $g, $b ) = $r;
|
67 |
}
|
68 |
$r = intval( $r );
|
89 |
*/
|
90 |
function wpa_hex2rgb( $color ) {
|
91 |
$color = str_replace( '#', '', $color );
|
92 |
+
if ( strlen( $color ) !== 6 ) {
|
93 |
return array( 0, 0, 0 );
|
94 |
}
|
95 |
$rgb = array();
|
109 |
if ( ! wp_verify_nonce( $nonce, 'wpa-nonce' ) ) {
|
110 |
die( 'Security check failed' );
|
111 |
}
|
112 |
+
if ( isset( $_POST['color'] ) && '' !== $_POST['color'] ) {
|
113 |
$fore_color = $_POST['color'];
|
114 |
+
if ( '#' === $fore_color[0] ) {
|
115 |
$fore_color = str_replace( '#', '', $fore_color );
|
116 |
}
|
117 |
+
if ( 3 === strlen( $fore_color ) ) {
|
118 |
$color6char = $fore_color[0] . $fore_color[0];
|
119 |
$color6char .= $fore_color[1] . $fore_color[1];
|
120 |
$color6char .= $fore_color[2] . $fore_color[2];
|
125 |
} else {
|
126 |
$echo_hex_fore = 'FFFFFF';
|
127 |
}
|
128 |
+
if ( isset( $_POST['color2'] ) && '' !== $_POST['color2'] ) {
|
129 |
$back_color = $_POST['color2'];
|
130 |
+
if ( '#' === $back_color[0] ) {
|
131 |
$back_color = str_replace( '#', '', $back_color );
|
132 |
}
|
133 |
+
if ( 3 === strlen( $back_color ) ) {
|
134 |
$color6char = $back_color[0] . $back_color[0];
|
135 |
$color6char .= $back_color[1] . $back_color[1];
|
136 |
$color6char .= $back_color[2] . $back_color[2];
|
wp-accessibility-longdesc.php
CHANGED
@@ -24,9 +24,9 @@ add_filter( 'wp_get_attachment_image_attributes', 'wpa_featured_longdesc', 10, 3
|
|
24 |
* @return New attributes array.
|
25 |
*/
|
26 |
function wpa_featured_longdesc( $attr, $attachment, $size ) {
|
27 |
-
if ( 'on'
|
28 |
$attachment_id = $attachment->ID;
|
29 |
-
if (
|
30 |
$args = array( 'longdesc' => $attachment_id );
|
31 |
// The referrer is the post that the image is inserted into.
|
32 |
if ( isset( $_REQUEST['post_id'] ) || get_the_ID() ) {
|
@@ -160,7 +160,7 @@ function wpa_longdesc_add_attr( $html, $id, $caption, $title, $align, $url, $siz
|
|
160 |
$id = ( isset( $_REQUEST['post_id'] ) ) ? $_REQUEST['post_id'] : get_the_ID();
|
161 |
$args['referrer'] = intval( $id );
|
162 |
}
|
163 |
-
if (
|
164 |
$search = '<img ';
|
165 |
$replace = '<img tabindex="-1" id="' . esc_attr( wpa_longdesc_return_anchor( $image->ID ) ) . '" longdesc="' . esc_url( add_query_arg( $args, home_url() ) ) . '" ';
|
166 |
$html = str_replace( $search, $replace, $html );
|
24 |
* @return New attributes array.
|
25 |
*/
|
26 |
function wpa_featured_longdesc( $attr, $attachment, $size ) {
|
27 |
+
if ( 'on' === get_option( 'wpa_longdesc_featured' ) ) {
|
28 |
$attachment_id = $attachment->ID;
|
29 |
+
if ( false !== (bool) strip_tags( $attachment->post_content ) ) {
|
30 |
$args = array( 'longdesc' => $attachment_id );
|
31 |
// The referrer is the post that the image is inserted into.
|
32 |
if ( isset( $_REQUEST['post_id'] ) || get_the_ID() ) {
|
160 |
$id = ( isset( $_REQUEST['post_id'] ) ) ? $_REQUEST['post_id'] : get_the_ID();
|
161 |
$args['referrer'] = intval( $id );
|
162 |
}
|
163 |
+
if ( false !== (bool) strip_tags( $image->post_content ) ) {
|
164 |
$search = '<img ';
|
165 |
$replace = '<img tabindex="-1" id="' . esc_attr( wpa_longdesc_return_anchor( $image->ID ) ) . '" longdesc="' . esc_url( add_query_arg( $args, home_url() ) ) . '" ';
|
166 |
$html = str_replace( $search, $replace, $html );
|
wp-accessibility-settings.php
CHANGED
@@ -18,7 +18,7 @@ add_action( 'admin_head', 'wpa_admin_styles' );
|
|
18 |
* Enqueue admin stylesheets.
|
19 |
*/
|
20 |
function wpa_admin_styles() {
|
21 |
-
if ( isset( $_GET['page'] ) && ( 'wp-accessibility/wp-accessibility.php'
|
22 |
wp_enqueue_style( 'farbtastic' );
|
23 |
echo '<link type="text/css" rel="stylesheet" href="' . plugins_url( 'css/wpa-styles.css', __FILE__ ) . '" />';
|
24 |
}
|
@@ -29,7 +29,7 @@ function wpa_admin_styles() {
|
|
29 |
*/
|
30 |
function wpa_write_js() {
|
31 |
global $current_screen;
|
32 |
-
if ( 'settings_page_wp-accessibility/wp-accessibility'
|
33 |
?>
|
34 |
<script>
|
35 |
//<![CDATA[
|
@@ -50,7 +50,7 @@ add_action( 'admin_enqueue_scripts', 'wpa_admin_js' );
|
|
50 |
**/
|
51 |
function wpa_admin_js() {
|
52 |
global $current_screen;
|
53 |
-
if ( 'settings_page_wp-accessibility/wp-accessibility'
|
54 |
wp_enqueue_script( 'farbtastic' );
|
55 |
}
|
56 |
}
|
@@ -67,7 +67,7 @@ function wpa_update_settings() {
|
|
67 |
if ( ! wp_verify_nonce( $nonce, 'wpa-nonce' ) ) {
|
68 |
die( 'Security check failed' );
|
69 |
}
|
70 |
-
if ( isset( $_POST['action'] ) && 'rta'
|
71 |
$rta_from_tag_clouds = ( isset( $_POST['rta_from_tag_clouds'] ) ) ? 'on' : '';
|
72 |
update_option( 'rta_from_tag_clouds', $rta_from_tag_clouds );
|
73 |
|
@@ -75,7 +75,7 @@ function wpa_update_settings() {
|
|
75 |
|
76 |
return "<div class='updated'><p>" . $message . '</p></div>';
|
77 |
}
|
78 |
-
if ( isset( $_POST['action'] ) && 'asl'
|
79 |
$asl_enable = ( isset( $_POST['asl_enable'] ) ) ? 'on' : '';
|
80 |
$asl_content = ( isset( $_POST['asl_content'] ) ) ? $_POST['asl_content'] : '';
|
81 |
$asl_navigation = ( isset( $_POST['asl_navigation'] ) ) ? $_POST['asl_navigation'] : '';
|
@@ -92,7 +92,7 @@ function wpa_update_settings() {
|
|
92 |
update_option( 'asl_extra_target', $asl_extra_target );
|
93 |
update_option( 'asl_extra_text', $asl_extra_text );
|
94 |
update_option( 'asl_visible', $asl_visible );
|
95 |
-
$notice = ( 'asl'
|
96 |
|
97 |
update_option( 'asl_styles_focus', $asl_styles_focus );
|
98 |
update_option( 'asl_styles_passive', $asl_styles_passive );
|
@@ -100,7 +100,7 @@ function wpa_update_settings() {
|
|
100 |
|
101 |
return "<div class='updated'><p>" . $message . "</p>$notice</div>";
|
102 |
}
|
103 |
-
if ( isset( $_POST['action'] ) && 'misc'
|
104 |
$wpa_lang = ( isset( $_POST['wpa_lang'] ) ) ? 'on' : '';
|
105 |
$wpa_target = ( isset( $_POST['wpa_target'] ) ) ? 'on' : '';
|
106 |
$wpa_labels = ( isset( $_POST['wpa_labels'] ) ) ? 'on' : '';
|
@@ -108,7 +108,6 @@ function wpa_update_settings() {
|
|
108 |
$wpa_tabindex = ( isset( $_POST['wpa_tabindex'] ) ) ? 'on' : '';
|
109 |
$wpa_underline = ( isset( $_POST['wpa_underline'] ) ) ? 'on' : '';
|
110 |
$wpa_longdesc = ( isset( $_POST['wpa_longdesc'] ) ) ? esc_attr( $_POST['wpa_longdesc'] ) : 'false';
|
111 |
-
$wpa_current_menu = ( isset( $_POST['wpa_current_menu'] ) ) ? 'on' : '';
|
112 |
$wpa_longdesc_featured = ( isset( $_POST['wpa_longdesc_featured'] ) ) ? esc_attr( $_POST['wpa_longdesc_featured'] ) : 'false';
|
113 |
$wpa_image_titles = ( isset( $_POST['wpa_image_titles'] ) ) ? 'on' : '';
|
114 |
$wpa_more = ( isset( $_POST['wpa_more'] ) ) ? 'on' : '';
|
@@ -126,7 +125,6 @@ function wpa_update_settings() {
|
|
126 |
update_option( 'wpa_tabindex', $wpa_tabindex );
|
127 |
update_option( 'wpa_underline', $wpa_underline );
|
128 |
update_option( 'wpa_longdesc', $wpa_longdesc );
|
129 |
-
update_option( 'wpa_current_menu', $wpa_current_menu );
|
130 |
update_option( 'wpa_longdesc_featured', $wpa_longdesc_featured );
|
131 |
update_option( 'wpa_image_titles', $wpa_image_titles );
|
132 |
update_option( 'wpa_more', $wpa_more );
|
@@ -142,7 +140,7 @@ function wpa_update_settings() {
|
|
142 |
return "<div class='updated'><p>" . $message . '</p></div>';
|
143 |
}
|
144 |
|
145 |
-
if ( isset( $_POST['action'] ) && 'toolbar'
|
146 |
$wpa_toolbar = ( isset( $_POST['wpa_toolbar'] ) ) ? 'on' : '';
|
147 |
$wpa_toolbar_size = ( isset( $_POST['wpa_toolbar_size'] ) ) ? $_POST['wpa_toolbar_size'] : '';
|
148 |
$wpa_alternate_fontsize = ( isset( $_POST['wpa_alternate_fontsize'] ) ) ? 'on' : '';
|
@@ -189,7 +187,7 @@ function wpa_admin_settings() {
|
|
189 |
|
190 |
<div class="inside">
|
191 |
<?php
|
192 |
-
if ( wpa_accessible_theme() && 'on'
|
193 |
?>
|
194 |
<p>
|
195 |
<?php _e( 'Your <code>accessibility-ready</code> theme has skip links built in.', 'wp-accessibility' ); ?>
|
@@ -234,7 +232,7 @@ function wpa_admin_settings() {
|
|
234 |
<textarea name='asl_styles_focus' id='asl_styles_focus' cols='60' rows='4'><?php echo esc_attr( stripslashes( get_option( 'asl_styles_focus' ) ) ); ?></textarea>
|
235 |
</li>
|
236 |
<?php
|
237 |
-
if ( 'on'
|
238 |
$disabled = " disabled='disabled' style='background: #eee;'";
|
239 |
$note = ' ' . __( '(Not currently visible)', 'wp-accessibility' );
|
240 |
} else {
|
@@ -293,17 +291,17 @@ function wpa_admin_settings() {
|
|
293 |
<input type="text" id="wpa_toolbar_default" name="wpa_toolbar_default" value="<?php echo esc_attr( get_option( 'wpa_toolbar_default' ) ); ?>" />
|
294 |
</li>
|
295 |
<?php
|
296 |
-
$size = get_option( 'wpa_toolbar_size' );
|
297 |
?>
|
298 |
<li>
|
299 |
<label for="wpa_toolbar_size"><?php _e( 'Toolbar font size', 'wp-accessibility' ); ?></label>
|
300 |
<select name='wpa_toolbar_size' id='wpa_toolbar_size'>
|
301 |
<option value=''><?php _e( 'Default size', 'wp-accessibility' ); ?></option>
|
302 |
<?php
|
303 |
-
for ( $i = 1; $i <=
|
304 |
$val = ( $i * 10 ) + 2;
|
305 |
$current = $val;
|
306 |
-
$selected_size = ( $current
|
307 |
echo "<option value='$val'$selected_size>$val px</option>";
|
308 |
$i = $i + .1;
|
309 |
}
|
@@ -402,7 +400,7 @@ function wpa_admin_settings() {
|
|
402 |
</li>
|
403 |
<li>
|
404 |
<input type="checkbox" id="wpa_row_actions" name="wpa_row_actions" <?php checked( get_option( 'wpa_row_actions' ), 'on' ); ?>/>
|
405 |
-
<label for="wpa_row_actions"><?php _e( 'Make row actions always visible', 'wp-accessibility' ); ?></label>
|
406 |
</li>
|
407 |
<li>
|
408 |
<input type="checkbox" id="wpa_image_titles" name="wpa_image_titles" <?php checked( get_option( 'wpa_image_titles' ), 'on' ); ?>/>
|
@@ -417,10 +415,6 @@ function wpa_admin_settings() {
|
|
417 |
<label for="wpa_focus"><?php _e( 'Add outline to elements on keyboard focus', 'wp-accessibility' ); ?></label>
|
418 |
<label for="wpa_focus_color"><?php _e( 'Outline color (hexadecimal, optional)', 'wp-accessibility' ); ?></label>
|
419 |
<input type="text" id="wpa_focus_color" name="wpa_focus_color" value="#<?php echo esc_attr( get_option( 'wpa_focus_color' ) ); ?>"/></li>
|
420 |
-
<li>
|
421 |
-
<input type="checkbox" id="wpa_current_menu" name="wpa_current_menu" <?php checked( get_option( 'wpa_current_menu' ), 'on' ); ?>/>
|
422 |
-
<label for="wpa_current_menu"><?php _e( 'Non-visually identify currently active menu item', 'wp-accessibility' ); ?></label>
|
423 |
-
</li>
|
424 |
</ul>
|
425 |
<p>
|
426 |
<input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'wpa-nonce' ); ?>"/>
|
18 |
* Enqueue admin stylesheets.
|
19 |
*/
|
20 |
function wpa_admin_styles() {
|
21 |
+
if ( isset( $_GET['page'] ) && ( 'wp-accessibility/wp-accessibility.php' === $_GET['page'] ) ) {
|
22 |
wp_enqueue_style( 'farbtastic' );
|
23 |
echo '<link type="text/css" rel="stylesheet" href="' . plugins_url( 'css/wpa-styles.css', __FILE__ ) . '" />';
|
24 |
}
|
29 |
*/
|
30 |
function wpa_write_js() {
|
31 |
global $current_screen;
|
32 |
+
if ( 'settings_page_wp-accessibility/wp-accessibility' === $current_screen->base ) {
|
33 |
?>
|
34 |
<script>
|
35 |
//<![CDATA[
|
50 |
**/
|
51 |
function wpa_admin_js() {
|
52 |
global $current_screen;
|
53 |
+
if ( 'settings_page_wp-accessibility/wp-accessibility' === $current_screen->base ) {
|
54 |
wp_enqueue_script( 'farbtastic' );
|
55 |
}
|
56 |
}
|
67 |
if ( ! wp_verify_nonce( $nonce, 'wpa-nonce' ) ) {
|
68 |
die( 'Security check failed' );
|
69 |
}
|
70 |
+
if ( isset( $_POST['action'] ) && 'rta' === $_POST['action'] ) {
|
71 |
$rta_from_tag_clouds = ( isset( $_POST['rta_from_tag_clouds'] ) ) ? 'on' : '';
|
72 |
update_option( 'rta_from_tag_clouds', $rta_from_tag_clouds );
|
73 |
|
75 |
|
76 |
return "<div class='updated'><p>" . $message . '</p></div>';
|
77 |
}
|
78 |
+
if ( isset( $_POST['action'] ) && 'asl' === $_POST['action'] ) {
|
79 |
$asl_enable = ( isset( $_POST['asl_enable'] ) ) ? 'on' : '';
|
80 |
$asl_content = ( isset( $_POST['asl_content'] ) ) ? $_POST['asl_content'] : '';
|
81 |
$asl_navigation = ( isset( $_POST['asl_navigation'] ) ) ? $_POST['asl_navigation'] : '';
|
92 |
update_option( 'asl_extra_target', $asl_extra_target );
|
93 |
update_option( 'asl_extra_text', $asl_extra_text );
|
94 |
update_option( 'asl_visible', $asl_visible );
|
95 |
+
$notice = ( 'asl' === $asl_visible ) ? '<p>' . __( 'WP Accessibility does not provide any styles for visible skiplinks. You can still set the look of the links using the textareas provided, but all other layout must be assigned in your theme.', 'wp-accessibility' ) . '</p>' : '';
|
96 |
|
97 |
update_option( 'asl_styles_focus', $asl_styles_focus );
|
98 |
update_option( 'asl_styles_passive', $asl_styles_passive );
|
100 |
|
101 |
return "<div class='updated'><p>" . $message . "</p>$notice</div>";
|
102 |
}
|
103 |
+
if ( isset( $_POST['action'] ) && 'misc' === $_POST['action'] ) {
|
104 |
$wpa_lang = ( isset( $_POST['wpa_lang'] ) ) ? 'on' : '';
|
105 |
$wpa_target = ( isset( $_POST['wpa_target'] ) ) ? 'on' : '';
|
106 |
$wpa_labels = ( isset( $_POST['wpa_labels'] ) ) ? 'on' : '';
|
108 |
$wpa_tabindex = ( isset( $_POST['wpa_tabindex'] ) ) ? 'on' : '';
|
109 |
$wpa_underline = ( isset( $_POST['wpa_underline'] ) ) ? 'on' : '';
|
110 |
$wpa_longdesc = ( isset( $_POST['wpa_longdesc'] ) ) ? esc_attr( $_POST['wpa_longdesc'] ) : 'false';
|
|
|
111 |
$wpa_longdesc_featured = ( isset( $_POST['wpa_longdesc_featured'] ) ) ? esc_attr( $_POST['wpa_longdesc_featured'] ) : 'false';
|
112 |
$wpa_image_titles = ( isset( $_POST['wpa_image_titles'] ) ) ? 'on' : '';
|
113 |
$wpa_more = ( isset( $_POST['wpa_more'] ) ) ? 'on' : '';
|
125 |
update_option( 'wpa_tabindex', $wpa_tabindex );
|
126 |
update_option( 'wpa_underline', $wpa_underline );
|
127 |
update_option( 'wpa_longdesc', $wpa_longdesc );
|
|
|
128 |
update_option( 'wpa_longdesc_featured', $wpa_longdesc_featured );
|
129 |
update_option( 'wpa_image_titles', $wpa_image_titles );
|
130 |
update_option( 'wpa_more', $wpa_more );
|
140 |
return "<div class='updated'><p>" . $message . '</p></div>';
|
141 |
}
|
142 |
|
143 |
+
if ( isset( $_POST['action'] ) && 'toolbar' === $_POST['action'] ) {
|
144 |
$wpa_toolbar = ( isset( $_POST['wpa_toolbar'] ) ) ? 'on' : '';
|
145 |
$wpa_toolbar_size = ( isset( $_POST['wpa_toolbar_size'] ) ) ? $_POST['wpa_toolbar_size'] : '';
|
146 |
$wpa_alternate_fontsize = ( isset( $_POST['wpa_alternate_fontsize'] ) ) ? 'on' : '';
|
187 |
|
188 |
<div class="inside">
|
189 |
<?php
|
190 |
+
if ( wpa_accessible_theme() && 'on' !== get_option( 'asl_enable' ) ) {
|
191 |
?>
|
192 |
<p>
|
193 |
<?php _e( 'Your <code>accessibility-ready</code> theme has skip links built in.', 'wp-accessibility' ); ?>
|
232 |
<textarea name='asl_styles_focus' id='asl_styles_focus' cols='60' rows='4'><?php echo esc_attr( stripslashes( get_option( 'asl_styles_focus' ) ) ); ?></textarea>
|
233 |
</li>
|
234 |
<?php
|
235 |
+
if ( 'on' !== get_option( 'asl_visible' ) ) {
|
236 |
$disabled = " disabled='disabled' style='background: #eee;'";
|
237 |
$note = ' ' . __( '(Not currently visible)', 'wp-accessibility' );
|
238 |
} else {
|
291 |
<input type="text" id="wpa_toolbar_default" name="wpa_toolbar_default" value="<?php echo esc_attr( get_option( 'wpa_toolbar_default' ) ); ?>" />
|
292 |
</li>
|
293 |
<?php
|
294 |
+
$size = absint( get_option( 'wpa_toolbar_size' ) );
|
295 |
?>
|
296 |
<li>
|
297 |
<label for="wpa_toolbar_size"><?php _e( 'Toolbar font size', 'wp-accessibility' ); ?></label>
|
298 |
<select name='wpa_toolbar_size' id='wpa_toolbar_size'>
|
299 |
<option value=''><?php _e( 'Default size', 'wp-accessibility' ); ?></option>
|
300 |
<?php
|
301 |
+
for ( $i = 1.2; $i <= 3.8; ) {
|
302 |
$val = ( $i * 10 ) + 2;
|
303 |
$current = $val;
|
304 |
+
$selected_size = ( $current === $size ) ? ' selected="selected"' : '';
|
305 |
echo "<option value='$val'$selected_size>$val px</option>";
|
306 |
$i = $i + .1;
|
307 |
}
|
400 |
</li>
|
401 |
<li>
|
402 |
<input type="checkbox" id="wpa_row_actions" name="wpa_row_actions" <?php checked( get_option( 'wpa_row_actions' ), 'on' ); ?>/>
|
403 |
+
<label for="wpa_row_actions"><?php _e( 'Make admin row actions always visible', 'wp-accessibility' ); ?></label>
|
404 |
</li>
|
405 |
<li>
|
406 |
<input type="checkbox" id="wpa_image_titles" name="wpa_image_titles" <?php checked( get_option( 'wpa_image_titles' ), 'on' ); ?>/>
|
415 |
<label for="wpa_focus"><?php _e( 'Add outline to elements on keyboard focus', 'wp-accessibility' ); ?></label>
|
416 |
<label for="wpa_focus_color"><?php _e( 'Outline color (hexadecimal, optional)', 'wp-accessibility' ); ?></label>
|
417 |
<input type="text" id="wpa_focus_color" name="wpa_focus_color" value="#<?php echo esc_attr( get_option( 'wpa_focus_color' ) ); ?>"/></li>
|
|
|
|
|
|
|
|
|
418 |
</ul>
|
419 |
<p>
|
420 |
<input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'wpa-nonce' ); ?>"/>
|
wp-accessibility-toolbar.php
CHANGED
@@ -43,15 +43,15 @@ function wpa_toolbar_html( $type = 'widget', $control = 'button' ) {
|
|
43 |
$contrast = __( 'Toggle High Contrast', 'wp-accessibility' );
|
44 |
$grayscale = __( 'Toggle Grayscale', 'wp-accessibility' );
|
45 |
$fontsize = __( 'Toggle Font size', 'wp-accessibility' );
|
46 |
-
$enable_grayscale = ( 'on'
|
47 |
-
$enable_contrast = ( 'off'
|
48 |
-
$enable_fontsize = ( 'off'
|
49 |
-
$responsive = ( 'on'
|
50 |
$is_rtl = ( is_rtl() ) ? ' rtl' : ' ltr';
|
51 |
-
$is_right = ( 'on'
|
52 |
-
$toolbar_type = ( 'widget'
|
53 |
-
$control_type = ( 'button'
|
54 |
-
$closure = ( 'button'
|
55 |
$toolbar = '
|
56 |
<!-- a11y toolbar widget -->
|
57 |
<div class="' . $responsive . ' ' . $is_rtl . ' ' . $is_right . ' ' . $toolbar_type . '">
|
@@ -78,12 +78,12 @@ function wpa_toolbar_html( $type = 'widget', $control = 'button' ) {
|
|
78 |
*/
|
79 |
function wpa_toolbar_js() {
|
80 |
// Toolbar does not work on Edge. Disable unless I solve the issue.
|
81 |
-
$default = (
|
82 |
$location = apply_filters( 'wpa_move_toolbar', $default );
|
83 |
$user_agent = ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ? $_SERVER['HTTP_USER_AGENT'] : '';
|
84 |
$is_rtl = ( is_rtl() ) ? ' rtl' : ' ltr';
|
85 |
-
$is_right = ( 'on'
|
86 |
-
$responsive = ( 'on'
|
87 |
|
88 |
if ( preg_match( '/Edge/i', $user_agent ) ) {
|
89 |
echo wpa_toolbar_html( 'js', 'a' );
|
@@ -101,9 +101,9 @@ function wpa_toolbar_js() {
|
|
101 |
$contrast = __( 'Toggle High Contrast', 'wp-accessibility' );
|
102 |
$grayscale = __( 'Toggle Grayscale', 'wp-accessibility' );
|
103 |
$fontsize = __( 'Toggle Font size', 'wp-accessibility' );
|
104 |
-
$enable_grayscale = ( 'on'
|
105 |
-
$enable_fontsize = ( 'off'
|
106 |
-
$enable_contrast = ( 'off'
|
107 |
|
108 |
echo
|
109 |
"
|
@@ -113,13 +113,13 @@ function wpa_toolbar_js() {
|
|
113 |
var insert_a11y_toolbar = '<!-- a11y toolbar -->';
|
114 |
insert_a11y_toolbar += '<div class=\"" . $responsive . "a11y-toolbar$is_rtl$is_right\">';
|
115 |
insert_a11y_toolbar += '<ul class=\"a11y-toolbar-list\">';";
|
116 |
-
if ( get_option( 'wpa_toolbar' )
|
117 |
echo "insert_a11y_toolbar += '<li class=\"a11y-toolbar-list-item\"><button type=\"button\" class=\"a11y-toggle-contrast toggle-contrast\" id=\"is_normal_contrast\" aria-pressed=\"false\"><span class=\"offscreen\">$contrast</span><span class=\"aticon aticon-adjust\" aria-hidden=\"true\"></span></button></li>';";
|
118 |
}
|
119 |
-
if ( get_option( 'wpa_toolbar' )
|
120 |
echo "insert_a11y_toolbar += '<li class=\"a11y-toolbar-list-item\"><button type=\"button\" class=\"a11y-toggle-grayscale toggle-grayscale\" id=\"is_normal_color\" aria-pressed=\"false\"><span class=\"offscreen\">$grayscale</span><span class=\"aticon aticon-tint\" aria-hidden=\"true\"></span></button></li>';";
|
121 |
}
|
122 |
-
if ( get_option( 'wpa_toolbar' )
|
123 |
echo "insert_a11y_toolbar += '<li class=\"a11y-toolbar-list-item\"><button type=\"button\" class=\"a11y-toggle-fontsize toggle-fontsize\" id=\"is_normal_fontsize\" aria-pressed=\"false\"><span class=\"offscreen\">$fontsize</span><span class=\"aticon aticon-font\" aria-hidden=\"true\"></span></button></li>';";
|
124 |
}
|
125 |
echo "
|
43 |
$contrast = __( 'Toggle High Contrast', 'wp-accessibility' );
|
44 |
$grayscale = __( 'Toggle Grayscale', 'wp-accessibility' );
|
45 |
$fontsize = __( 'Toggle Font size', 'wp-accessibility' );
|
46 |
+
$enable_grayscale = ( 'on' === get_option( 'wpa_toolbar_gs' ) && current_user_can( 'manage_options' ) ) ? true : false;
|
47 |
+
$enable_contrast = ( 'off' === get_option( 'wpa_toolbar_ct' ) ) ? false : true;
|
48 |
+
$enable_fontsize = ( 'off' === get_option( 'wpa_toolbar_fs' ) ) ? false : true;
|
49 |
+
$responsive = ( 'on' === get_option( 'wpa_toolbar_mobile' ) ) ? 'a11y-responsive ' : '';
|
50 |
$is_rtl = ( is_rtl() ) ? ' rtl' : ' ltr';
|
51 |
+
$is_right = ( 'on' === get_option( 'wpa_toolbar_right' ) ) ? ' right' : ' left';
|
52 |
+
$toolbar_type = ( 'widget' === $type ) ? 'a11y-toolbar-widget' : 'a11y-toolbar';
|
53 |
+
$control_type = ( 'button' !== $control ) ? 'a href="#" role="button"' : 'button type="button"'; // button control does not work in Edge.
|
54 |
+
$closure = ( 'button' !== $control ) ? 'a' : 'button'; // button control does not work in Edge.
|
55 |
$toolbar = '
|
56 |
<!-- a11y toolbar widget -->
|
57 |
<div class="' . $responsive . ' ' . $is_rtl . ' ' . $is_right . ' ' . $toolbar_type . '">
|
78 |
*/
|
79 |
function wpa_toolbar_js() {
|
80 |
// Toolbar does not work on Edge. Disable unless I solve the issue.
|
81 |
+
$default = ( false !== (bool) get_option( 'wpa_toolbar_default' ) ) ? get_option( 'wpa_toolbar_default' ) : 'body';
|
82 |
$location = apply_filters( 'wpa_move_toolbar', $default );
|
83 |
$user_agent = ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ? $_SERVER['HTTP_USER_AGENT'] : '';
|
84 |
$is_rtl = ( is_rtl() ) ? ' rtl' : ' ltr';
|
85 |
+
$is_right = ( 'on' === get_option( 'wpa_toolbar_right' ) ) ? ' right' : ' left';
|
86 |
+
$responsive = ( 'on' === get_option( 'wpa_toolbar_mobile' ) ) ? 'a11y-responsive ' : 'a11y-non-responsive ';
|
87 |
|
88 |
if ( preg_match( '/Edge/i', $user_agent ) ) {
|
89 |
echo wpa_toolbar_html( 'js', 'a' );
|
101 |
$contrast = __( 'Toggle High Contrast', 'wp-accessibility' );
|
102 |
$grayscale = __( 'Toggle Grayscale', 'wp-accessibility' );
|
103 |
$fontsize = __( 'Toggle Font size', 'wp-accessibility' );
|
104 |
+
$enable_grayscale = ( 'on' === get_option( 'wpa_toolbar_gs' ) && current_user_can( 'manage_options' ) ) ? true : false;
|
105 |
+
$enable_fontsize = ( 'off' === get_option( 'wpa_toolbar_fs' ) ) ? false : true;
|
106 |
+
$enable_contrast = ( 'off' === get_option( 'wpa_toolbar_ct' ) ) ? false : true;
|
107 |
|
108 |
echo
|
109 |
"
|
113 |
var insert_a11y_toolbar = '<!-- a11y toolbar -->';
|
114 |
insert_a11y_toolbar += '<div class=\"" . $responsive . "a11y-toolbar$is_rtl$is_right\">';
|
115 |
insert_a11y_toolbar += '<ul class=\"a11y-toolbar-list\">';";
|
116 |
+
if ( get_option( 'wpa_toolbar' ) === 'on' && $enable_contrast ) {
|
117 |
echo "insert_a11y_toolbar += '<li class=\"a11y-toolbar-list-item\"><button type=\"button\" class=\"a11y-toggle-contrast toggle-contrast\" id=\"is_normal_contrast\" aria-pressed=\"false\"><span class=\"offscreen\">$contrast</span><span class=\"aticon aticon-adjust\" aria-hidden=\"true\"></span></button></li>';";
|
118 |
}
|
119 |
+
if ( get_option( 'wpa_toolbar' ) === 'on' && $enable_grayscale ) {
|
120 |
echo "insert_a11y_toolbar += '<li class=\"a11y-toolbar-list-item\"><button type=\"button\" class=\"a11y-toggle-grayscale toggle-grayscale\" id=\"is_normal_color\" aria-pressed=\"false\"><span class=\"offscreen\">$grayscale</span><span class=\"aticon aticon-tint\" aria-hidden=\"true\"></span></button></li>';";
|
121 |
}
|
122 |
+
if ( get_option( 'wpa_toolbar' ) === 'on' && $enable_fontsize ) {
|
123 |
echo "insert_a11y_toolbar += '<li class=\"a11y-toolbar-list-item\"><button type=\"button\" class=\"a11y-toggle-fontsize toggle-fontsize\" id=\"is_normal_fontsize\" aria-pressed=\"false\"><span class=\"offscreen\">$fontsize</span><span class=\"aticon aticon-font\" aria-hidden=\"true\"></span></button></li>';";
|
124 |
}
|
125 |
echo "
|
wp-accessibility.php
CHANGED
@@ -17,7 +17,7 @@
|
|
17 |
* Domain Path: /lang
|
18 |
* License: GPL-2.0+
|
19 |
* License URI: http://www.gnu.org/license/gpl-2.0.txt
|
20 |
-
* Version: 1.6.
|
21 |
*/
|
22 |
|
23 |
/*
|
@@ -68,8 +68,8 @@ function wpa_admin_menu() {
|
|
68 |
* Install on activation.
|
69 |
*/
|
70 |
function wpa_install() {
|
71 |
-
$wpa_version = '1.6.
|
72 |
-
if ( 'true'
|
73 |
add_option( 'rta_from_nav_menu', 'on' );
|
74 |
add_option( 'rta_from_page_lists', 'on' );
|
75 |
add_option( 'rta_from_category_lists', 'on' );
|
@@ -112,7 +112,7 @@ add_filter( 'plugin_action_links', 'wpa_plugin_action', 10, 2 );
|
|
112 |
* @param string $file File name.
|
113 |
*/
|
114 |
function wpa_plugin_action( $links, $file ) {
|
115 |
-
if ( plugin_basename( dirname( __FILE__ ) . '/wp-accessibility.php' )
|
116 |
$admin_url = admin_url( 'options-general.php?page=wp-accessibility/wp-accessibility.php' );
|
117 |
$links[] = "<a href='$admin_url'>" . __( 'Accessibility Settings', 'wp-accessibility' ) . '</a>';
|
118 |
}
|
@@ -135,10 +135,10 @@ add_action( 'wp_enqueue_scripts', 'wpacc_enqueue_scripts' );
|
|
135 |
*/
|
136 |
function wpacc_enqueue_scripts() {
|
137 |
wp_enqueue_script( 'jquery' );
|
138 |
-
if ( 'on'
|
139 |
wp_enqueue_script( 'skiplinks.webkit' );
|
140 |
}
|
141 |
-
if ( 'on'
|
142 |
wp_enqueue_script( 'ui-a11y.js' );
|
143 |
$plugin_path = plugins_url( 'wp-accessibility/toolbar/css/a11y-contrast.css' );
|
144 |
if ( file_exists( get_stylesheet_directory() . '/a11y-contrast.css' ) ) {
|
@@ -146,7 +146,7 @@ function wpacc_enqueue_scripts() {
|
|
146 |
}
|
147 |
wp_localize_script( 'ui-a11y.js', 'a11y_stylesheet_path', $plugin_path );
|
148 |
}
|
149 |
-
if ( 'on'
|
150 |
wp_enqueue_script( 'wpa-complementary', plugins_url( 'js/roles.jquery.js', __FILE__ ), array( 'jquery' ), '1.0', true );
|
151 |
if ( get_option( 'wpa_complementary_container' ) ) {
|
152 |
$wpa_comp = get_option( 'wpa_complementary_container' );
|
@@ -155,7 +155,7 @@ function wpacc_enqueue_scripts() {
|
|
155 |
}
|
156 |
wp_localize_script( 'wpa-complementary', 'wpaComplementary', $wpa_comp );
|
157 |
}
|
158 |
-
if ( 'on'
|
159 |
wp_enqueue_script( 'wpa-labels', plugins_url( 'js/wpa.labels.js', __FILE__ ), array( 'jquery' ), '1.0', true );
|
160 |
$labels = array(
|
161 |
's' => __( 'Search', 'wp-accessibility' ),
|
@@ -166,18 +166,16 @@ function wpacc_enqueue_scripts() {
|
|
166 |
);
|
167 |
wp_localize_script( 'wpa-labels', 'wpalabels', $labels );
|
168 |
}
|
169 |
-
if ( 'on'
|
170 |
add_action( 'wp_footer', 'wpa_toolbar_js' );
|
171 |
}
|
172 |
-
if ( 'link'
|
173 |
wp_enqueue_script( 'longdesc.link', plugins_url( 'js/longdesc.link.js', __FILE__ ), array( 'jquery' ), '1.0', true );
|
174 |
}
|
175 |
-
if ( 'jquery'
|
176 |
wp_enqueue_script( 'longdesc.button', plugins_url( 'js/longdesc.button.js', __FILE__ ), array( 'jquery' ), '1.0', true );
|
177 |
}
|
178 |
-
|
179 |
-
wp_enqueue_script( 'current.menu', plugins_url( 'js/current-menu-item.js', __FILE__ ), array( 'jquery' ), '1.0', true );
|
180 |
-
}
|
181 |
}
|
182 |
|
183 |
add_action( 'wp_enqueue_scripts', 'wpa_stylesheet' );
|
@@ -190,13 +188,13 @@ function wpa_stylesheet() {
|
|
190 |
wp_register_style( 'ui-font.css', plugins_url( 'toolbar/fonts/css/a11y-toolbar.css', __FILE__ ) );
|
191 |
$toolbar = apply_filters( 'wpa_toolbar_css', plugins_url( 'toolbar/css/a11y.css', __FILE__ ) );
|
192 |
wp_register_style( 'ui-a11y.css', $toolbar, array( 'ui-font.css' ) );
|
193 |
-
$fontsize_stylesheet = ( 'on'
|
194 |
$fontsize = apply_filters( 'wpa_fontsize_css', plugins_url( 'toolbar/css/' . $fontsize_stylesheet . '.css', __FILE__ ) );
|
195 |
wp_register_style( 'ui-fontsize.css', $fontsize );
|
196 |
$toolbar_size = get_option( 'wpa_toolbar_size' );
|
197 |
$toolbar_size = ( false === stripos( $toolbar_size, 'em' ) ) ? $toolbar_size . 'px' : $toolbar_size;
|
198 |
// Only enable styles when required by options.
|
199 |
-
if ( get_option( 'wpa_toolbar_size' ) && 'on'
|
200 |
echo "
|
201 |
<style type='text/css'>
|
202 |
.a11y-toolbar ul li button {
|
@@ -204,14 +202,14 @@ function wpa_stylesheet() {
|
|
204 |
}
|
205 |
</style>';
|
206 |
}
|
207 |
-
if ( 'link'
|
208 |
wp_enqueue_style( 'wpa-style' );
|
209 |
}
|
210 |
-
if ( 'on'
|
211 |
wp_enqueue_style( 'ui-a11y.css' );
|
212 |
wp_enqueue_style( 'ui-fontsize.css' );
|
213 |
}
|
214 |
-
if ( current_user_can( 'edit_files' ) && 'on'
|
215 |
wp_register_style( 'diagnostic', plugins_url( 'css/diagnostic.css', __FILE__ ) );
|
216 |
wp_register_style( 'diagnostic-head', plugins_url( 'css/diagnostic-head.css', __FILE__ ) );
|
217 |
wp_enqueue_style( 'diagnostic' );
|
@@ -231,7 +229,7 @@ function wpa_admin_stylesheet() {
|
|
231 |
wp_enqueue_style( 'wp-a11y-css' );
|
232 |
}
|
233 |
|
234 |
-
if ( 'on'
|
235 |
if ( file_exists( get_stylesheet_directory() . '/wp-admin-row-actions.css' ) ) {
|
236 |
$file = get_stylesheet_directory_uri() . '/wp-admin-row-actions.css';
|
237 |
} else {
|
@@ -248,7 +246,7 @@ add_action( 'wp_head', 'wpa_css' );
|
|
248 |
*/
|
249 |
function wpa_css() {
|
250 |
$styles = '';
|
251 |
-
if ( get_option( 'asl_enable' )
|
252 |
$focus = get_option( 'asl_styles_focus' );
|
253 |
// these styles are derived from the WordPress skip link defaults.
|
254 |
$top = '7px';
|
@@ -268,11 +266,11 @@ function wpa_css() {
|
|
268 |
$vis = '';
|
269 |
$invis = '';
|
270 |
|
271 |
-
$visibility = ( 'on'
|
272 |
$is_rtl = ( is_rtl() ) ? '-rtl' : '-ltr';
|
273 |
$class = '.' . $visibility . $is_rtl;
|
274 |
// If links are visible, "hover" is a focus style, otherwise, it's a passive style.
|
275 |
-
if ( 'on'
|
276 |
$vis = $class . '#skiplinks a:hover,';
|
277 |
$passive = $default_passive . $passive;
|
278 |
} else {
|
@@ -284,13 +282,13 @@ function wpa_css() {
|
|
284 |
$class#skiplinks a:active, $vis $class#skiplinks a:focus { $focus }
|
285 |
";
|
286 |
}
|
287 |
-
if ( 'on'
|
288 |
-
$color = (
|
289 |
$styles .= "
|
290 |
:focus { outline: 1px solid$color!important; }
|
291 |
";
|
292 |
}
|
293 |
-
if ( ''
|
294 |
echo "
|
295 |
<style type='text/css'>
|
296 |
$styles
|
@@ -319,42 +317,42 @@ function wpa_jquery_asl() {
|
|
319 |
$lang_js = false;
|
320 |
$tabindex = false;
|
321 |
$longdesc = false;
|
322 |
-
$visibility = ( 'on'
|
323 |
-
if ( 'on'
|
324 |
$html = '';
|
325 |
// set up skiplinks.
|
326 |
-
$extra = get_option( 'asl_extra_target' );
|
327 |
$extra = ( wpa_is_url( $extra ) ) ? esc_url( $extra ) : str_replace( '#', '', esc_attr( $extra ) );
|
328 |
-
if ( ''
|
329 |
$extra = "#$extra";
|
330 |
}
|
331 |
-
$extra_text = stripslashes( get_option( 'asl_extra_text' ) );
|
332 |
$content = str_replace( '#', '', esc_attr( get_option( 'asl_content' ) ) );
|
333 |
$nav = str_replace( '#', '', esc_attr( get_option( 'asl_navigation' ) ) );
|
334 |
$sitemap = esc_url( get_option( 'asl_sitemap' ) );
|
335 |
-
$html .= ( ''
|
336 |
-
$html .= ( ''
|
337 |
-
$html .= ( ''
|
338 |
-
$html .= ( ''
|
339 |
$is_rtl = ( is_rtl() ) ? '-rtl' : '-ltr';
|
340 |
$skiplinks = __( 'Skip links', 'wp-accessibility' );
|
341 |
-
$output = ( ''
|
342 |
// Attach skiplinks HTML; set tab index on #content area to -1.
|
343 |
-
$focusable = ( ''
|
344 |
-
$focusable .= ( ''
|
345 |
$skiplinks_js = ( $output ) ? "$('body').prepend('$output'); $focusable" : '';
|
346 |
}
|
347 |
// Attach language to html element.
|
348 |
-
if ( 'on'
|
349 |
$lang = get_bloginfo( 'language' );
|
350 |
$dir = ( is_rtl() ) ? 'rtl' : 'ltr';
|
351 |
$lang_js = "$('html').attr( 'lang','$lang' ); $('html').attr( 'dir','$dir' )";
|
352 |
}
|
353 |
// Force links to open in the same window.
|
354 |
$underline_target = apply_filters( 'wpa_underline_target', 'a' );
|
355 |
-
$targets = ( 'on'
|
356 |
-
$tabindex = ( 'on'
|
357 |
-
$underlines = ( 'on'
|
358 |
|
359 |
$display = ( $skiplinks_js || $targets || $lang_js || $tabindex || $longdesc ) ? true : false;
|
360 |
if ( $display ) {
|
@@ -404,14 +402,14 @@ add_filter( 'mce_css', 'wpa_diagnostic_css' );
|
|
404 |
* @return full string css.
|
405 |
*/
|
406 |
function wpa_diagnostic_css( $mce_css ) {
|
407 |
-
if ( get_option( 'wpa_diagnostics' )
|
408 |
$mce_css .= ', ' . plugins_url( 'css/diagnostic.css', __FILE__ );
|
409 |
}
|
410 |
|
411 |
return $mce_css;
|
412 |
}
|
413 |
|
414 |
-
if ( 'on'
|
415 |
add_filter( 'pre_get_posts', 'wpa_filter' );
|
416 |
}
|
417 |
|
@@ -424,7 +422,7 @@ if ( 'on' == get_option( 'wpa_search' ) ) {
|
|
424 |
*/
|
425 |
function wpa_filter( $query ) {
|
426 |
if ( ! is_admin() ) {
|
427 |
-
if ( isset( $_GET['s'] ) &&
|
428 |
$query->query_vars['s'] = ' ';
|
429 |
$query->set( 'is_search', 1 );
|
430 |
add_action( 'template_include', 'wpa_search_error' );
|
@@ -450,7 +448,7 @@ function wpa_search_error( $template ) {
|
|
450 |
return $template;
|
451 |
}
|
452 |
|
453 |
-
if ( 'on'
|
454 |
add_filter( 'the_content', 'wpa_image_titles', 100 );
|
455 |
add_filter( 'post_thumbnail_html', 'wpa_image_titles', 100 );
|
456 |
add_filter( 'wp_get_attachment_image', 'wpa_image_titles', 100 );
|
@@ -465,7 +463,7 @@ if ( 'on' == get_option( 'wpa_image_titles' ) ) {
|
|
465 |
*/
|
466 |
function wpa_image_titles( $content ) {
|
467 |
$results = array();
|
468 |
-
preg_match_all( '|title="[^"]*"|U', $content, $results );
|
469 |
foreach ( $results[0] as $img ) {
|
470 |
$content = str_replace( $img, '', $content );
|
471 |
}
|
@@ -473,7 +471,7 @@ function wpa_image_titles( $content ) {
|
|
473 |
return $content;
|
474 |
}
|
475 |
|
476 |
-
if ( 'on'
|
477 |
add_filter( 'get_the_excerpt', 'wpa_custom_excerpt_more', 100 );
|
478 |
add_filter( 'excerpt_more', 'wpa_excerpt_more', 100 );
|
479 |
add_filter( 'the_content_more_link', 'wpa_content_more', 100 );
|
@@ -528,7 +526,7 @@ function wpa_custom_excerpt_more( $output ) {
|
|
528 |
return $output;
|
529 |
}
|
530 |
|
531 |
-
if ( 'on'
|
532 |
add_filter( 'wp_tag_cloud', 'wpa_remove_title_attributes' );
|
533 |
}
|
534 |
|
@@ -614,13 +612,13 @@ $plugins_string
|
|
614 |
die( 'Security check failed' );
|
615 |
}
|
616 |
$request = ( ! empty( $_POST['support_request'] ) ) ? stripslashes( $_POST['support_request'] ) : false;
|
617 |
-
$has_donated = ( 'on'
|
618 |
-
$has_read_faq = ( 'on'
|
619 |
$subject = "WP Accessibility support request. $has_donated";
|
620 |
$message = $request . "\n\n" . $data;
|
621 |
// Get the site domain and get rid of www. from pluggable.php.
|
622 |
$sitename = strtolower( $_SERVER['SERVER_NAME'] );
|
623 |
-
if ( 'www.'
|
624 |
$sitename = substr( $sitename, 4 );
|
625 |
}
|
626 |
$from_email = 'wordpress@' . $sitename;
|
@@ -632,7 +630,7 @@ $plugins_string
|
|
632 |
echo "<div class='message error'><p>" . __( 'Please describe your problem.', 'wp-accessibility' ) . '</p></div>';
|
633 |
} else {
|
634 |
wp_mail( 'plugins@joedolson.com', $subject, $message, $from );
|
635 |
-
if ( 'Donor'
|
636 |
echo "<div class='message updated'><p>" . __( 'Thank you for supporting the continuing development of this plug-in! I\'ll get back to you as soon as I can.', 'wp-accessibility' ) . '</p></div>';
|
637 |
} else {
|
638 |
echo "<div class='message updated'><p>" . __( 'I cannot provide support, but will treat your request as a bug report, and will incorporate any permanent solutions I discover into the plug-in.', 'wp-accessibility' ) . '</p></div>';
|
@@ -679,7 +677,7 @@ $plugins_string
|
|
679 |
function wpa_accessible_theme() {
|
680 |
$theme = wp_get_theme();
|
681 |
$tags = $theme->get( 'Tags' );
|
682 |
-
if ( is_array( $tags ) && in_array( 'accessibility-ready', $tags ) ) {
|
683 |
return true;
|
684 |
}
|
685 |
return false;
|
17 |
* Domain Path: /lang
|
18 |
* License: GPL-2.0+
|
19 |
* License URI: http://www.gnu.org/license/gpl-2.0.txt
|
20 |
+
* Version: 1.6.9
|
21 |
*/
|
22 |
|
23 |
/*
|
68 |
* Install on activation.
|
69 |
*/
|
70 |
function wpa_install() {
|
71 |
+
$wpa_version = '1.6.9';
|
72 |
+
if ( 'true' !== get_option( 'wpa_installed' ) ) {
|
73 |
add_option( 'rta_from_nav_menu', 'on' );
|
74 |
add_option( 'rta_from_page_lists', 'on' );
|
75 |
add_option( 'rta_from_category_lists', 'on' );
|
112 |
* @param string $file File name.
|
113 |
*/
|
114 |
function wpa_plugin_action( $links, $file ) {
|
115 |
+
if ( plugin_basename( dirname( __FILE__ ) . '/wp-accessibility.php' ) === $file ) {
|
116 |
$admin_url = admin_url( 'options-general.php?page=wp-accessibility/wp-accessibility.php' );
|
117 |
$links[] = "<a href='$admin_url'>" . __( 'Accessibility Settings', 'wp-accessibility' ) . '</a>';
|
118 |
}
|
135 |
*/
|
136 |
function wpacc_enqueue_scripts() {
|
137 |
wp_enqueue_script( 'jquery' );
|
138 |
+
if ( 'on' === get_option( 'asl_enable' ) ) {
|
139 |
wp_enqueue_script( 'skiplinks.webkit' );
|
140 |
}
|
141 |
+
if ( 'on' === get_option( 'wpa_toolbar' ) || 'on' === get_option( 'wpa_widget_toolbar' ) ) {
|
142 |
wp_enqueue_script( 'ui-a11y.js' );
|
143 |
$plugin_path = plugins_url( 'wp-accessibility/toolbar/css/a11y-contrast.css' );
|
144 |
if ( file_exists( get_stylesheet_directory() . '/a11y-contrast.css' ) ) {
|
146 |
}
|
147 |
wp_localize_script( 'ui-a11y.js', 'a11y_stylesheet_path', $plugin_path );
|
148 |
}
|
149 |
+
if ( 'on' === get_option( 'wpa_insert_roles' ) ) {
|
150 |
wp_enqueue_script( 'wpa-complementary', plugins_url( 'js/roles.jquery.js', __FILE__ ), array( 'jquery' ), '1.0', true );
|
151 |
if ( get_option( 'wpa_complementary_container' ) ) {
|
152 |
$wpa_comp = get_option( 'wpa_complementary_container' );
|
155 |
}
|
156 |
wp_localize_script( 'wpa-complementary', 'wpaComplementary', $wpa_comp );
|
157 |
}
|
158 |
+
if ( 'on' === get_option( 'wpa_labels' ) ) {
|
159 |
wp_enqueue_script( 'wpa-labels', plugins_url( 'js/wpa.labels.js', __FILE__ ), array( 'jquery' ), '1.0', true );
|
160 |
$labels = array(
|
161 |
's' => __( 'Search', 'wp-accessibility' ),
|
166 |
);
|
167 |
wp_localize_script( 'wpa-labels', 'wpalabels', $labels );
|
168 |
}
|
169 |
+
if ( 'on' === get_option( 'wpa_toolbar' ) ) {
|
170 |
add_action( 'wp_footer', 'wpa_toolbar_js' );
|
171 |
}
|
172 |
+
if ( 'link' === get_option( 'wpa_longdesc' ) ) {
|
173 |
wp_enqueue_script( 'longdesc.link', plugins_url( 'js/longdesc.link.js', __FILE__ ), array( 'jquery' ), '1.0', true );
|
174 |
}
|
175 |
+
if ( 'jquery' === get_option( 'wpa_longdesc' ) ) {
|
176 |
wp_enqueue_script( 'longdesc.button', plugins_url( 'js/longdesc.button.js', __FILE__ ), array( 'jquery' ), '1.0', true );
|
177 |
}
|
178 |
+
wp_enqueue_script( 'current.menu', plugins_url( 'js/current-menu-item.js', __FILE__ ), array( 'jquery' ), '1.0', true );
|
|
|
|
|
179 |
}
|
180 |
|
181 |
add_action( 'wp_enqueue_scripts', 'wpa_stylesheet' );
|
188 |
wp_register_style( 'ui-font.css', plugins_url( 'toolbar/fonts/css/a11y-toolbar.css', __FILE__ ) );
|
189 |
$toolbar = apply_filters( 'wpa_toolbar_css', plugins_url( 'toolbar/css/a11y.css', __FILE__ ) );
|
190 |
wp_register_style( 'ui-a11y.css', $toolbar, array( 'ui-font.css' ) );
|
191 |
+
$fontsize_stylesheet = ( 'on' === get_option( 'wpa_alternate_fontsize' ) ) ? 'a11y-fontsize-alt' : 'a11y-fontsize';
|
192 |
$fontsize = apply_filters( 'wpa_fontsize_css', plugins_url( 'toolbar/css/' . $fontsize_stylesheet . '.css', __FILE__ ) );
|
193 |
wp_register_style( 'ui-fontsize.css', $fontsize );
|
194 |
$toolbar_size = get_option( 'wpa_toolbar_size' );
|
195 |
$toolbar_size = ( false === stripos( $toolbar_size, 'em' ) ) ? $toolbar_size . 'px' : $toolbar_size;
|
196 |
// Only enable styles when required by options.
|
197 |
+
if ( get_option( 'wpa_toolbar_size' ) && 'on' === get_option( 'wpa_toolbar' ) ) {
|
198 |
echo "
|
199 |
<style type='text/css'>
|
200 |
.a11y-toolbar ul li button {
|
202 |
}
|
203 |
</style>';
|
204 |
}
|
205 |
+
if ( 'link' === get_option( 'wpa_longdesc' ) || 'jquery' === get_option( 'wpa_longdesc' ) || 'on' === get_option( 'asl_enable' ) ) {
|
206 |
wp_enqueue_style( 'wpa-style' );
|
207 |
}
|
208 |
+
if ( 'on' === get_option( 'wpa_toolbar' ) || 'on' === get_option( 'wpa_widget_toolbar' ) && ( $toolbar && $fontsize ) ) {
|
209 |
wp_enqueue_style( 'ui-a11y.css' );
|
210 |
wp_enqueue_style( 'ui-fontsize.css' );
|
211 |
}
|
212 |
+
if ( current_user_can( 'edit_files' ) && 'on' === get_option( 'wpa_diagnostics' ) ) {
|
213 |
wp_register_style( 'diagnostic', plugins_url( 'css/diagnostic.css', __FILE__ ) );
|
214 |
wp_register_style( 'diagnostic-head', plugins_url( 'css/diagnostic-head.css', __FILE__ ) );
|
215 |
wp_enqueue_style( 'diagnostic' );
|
229 |
wp_enqueue_style( 'wp-a11y-css' );
|
230 |
}
|
231 |
|
232 |
+
if ( 'on' === get_option( 'wpa_row_actions' ) ) {
|
233 |
if ( file_exists( get_stylesheet_directory() . '/wp-admin-row-actions.css' ) ) {
|
234 |
$file = get_stylesheet_directory_uri() . '/wp-admin-row-actions.css';
|
235 |
} else {
|
246 |
*/
|
247 |
function wpa_css() {
|
248 |
$styles = '';
|
249 |
+
if ( get_option( 'asl_enable' ) === 'on' ) {
|
250 |
$focus = get_option( 'asl_styles_focus' );
|
251 |
// these styles are derived from the WordPress skip link defaults.
|
252 |
$top = '7px';
|
266 |
$vis = '';
|
267 |
$invis = '';
|
268 |
|
269 |
+
$visibility = ( 'on' === get_option( 'asl_visible' ) ) ? 'wpa-visible' : 'wpa-hide';
|
270 |
$is_rtl = ( is_rtl() ) ? '-rtl' : '-ltr';
|
271 |
$class = '.' . $visibility . $is_rtl;
|
272 |
// If links are visible, "hover" is a focus style, otherwise, it's a passive style.
|
273 |
+
if ( 'on' === get_option( 'asl_visible' ) ) {
|
274 |
$vis = $class . '#skiplinks a:hover,';
|
275 |
$passive = $default_passive . $passive;
|
276 |
} else {
|
282 |
$class#skiplinks a:active, $vis $class#skiplinks a:focus { $focus }
|
283 |
";
|
284 |
}
|
285 |
+
if ( 'on' === get_option( 'wpa_focus' ) ) {
|
286 |
+
$color = ( false !== (bool) get_option( 'wpa_focus_color' ) ) ? ' #' . get_option( 'wpa_focus_color' ) : '';
|
287 |
$styles .= "
|
288 |
:focus { outline: 1px solid$color!important; }
|
289 |
";
|
290 |
}
|
291 |
+
if ( '' !== $styles ) {
|
292 |
echo "
|
293 |
<style type='text/css'>
|
294 |
$styles
|
317 |
$lang_js = false;
|
318 |
$tabindex = false;
|
319 |
$longdesc = false;
|
320 |
+
$visibility = ( 'on' === get_option( 'asl_visible' ) ) ? 'wpa-visible' : 'wpa-hide';
|
321 |
+
if ( 'on' === get_option( 'asl_enable' ) ) {
|
322 |
$html = '';
|
323 |
// set up skiplinks.
|
324 |
+
$extra = (string) get_option( 'asl_extra_target' );
|
325 |
$extra = ( wpa_is_url( $extra ) ) ? esc_url( $extra ) : str_replace( '#', '', esc_attr( $extra ) );
|
326 |
+
if ( '' !== $extra && ! wpa_is_url( $extra ) ) {
|
327 |
$extra = "#$extra";
|
328 |
}
|
329 |
+
$extra_text = (string) stripslashes( get_option( 'asl_extra_text' ) );
|
330 |
$content = str_replace( '#', '', esc_attr( get_option( 'asl_content' ) ) );
|
331 |
$nav = str_replace( '#', '', esc_attr( get_option( 'asl_navigation' ) ) );
|
332 |
$sitemap = esc_url( get_option( 'asl_sitemap' ) );
|
333 |
+
$html .= ( '' !== $content ) ? "<a href=\"#$content\">" . __( 'Skip to content', 'wp-accessibility' ) . '</a> ' : '';
|
334 |
+
$html .= ( '' !== $nav ) ? "<a href=\"#$nav\">" . __( 'Skip to navigation', 'wp-accessibility' ) . '</a> ' : '';
|
335 |
+
$html .= ( '' !== $sitemap ) ? "<a href=\"$sitemap\">" . __( 'Site map', 'wp-accessibility' ) . '</a> ' : '';
|
336 |
+
$html .= ( '' !== $extra && '' !== $extra_text ) ? "<a href=\"$extra\">$extra_text</a> " : '';
|
337 |
$is_rtl = ( is_rtl() ) ? '-rtl' : '-ltr';
|
338 |
$skiplinks = __( 'Skip links', 'wp-accessibility' );
|
339 |
+
$output = ( '' !== $html ) ? "<div class=\"$visibility$is_rtl\" id=\"skiplinks\" role=\"navigation\" aria-label=\"$skiplinks\">$html</div>" : '';
|
340 |
// Attach skiplinks HTML; set tab index on #content area to -1.
|
341 |
+
$focusable = ( '' !== $content ) ? "$('#$content').attr('tabindex','-1');" : '';
|
342 |
+
$focusable .= ( '' !== $nav ) ? "$('#$nav').attr('tabindex','-1');" : '';
|
343 |
$skiplinks_js = ( $output ) ? "$('body').prepend('$output'); $focusable" : '';
|
344 |
}
|
345 |
// Attach language to html element.
|
346 |
+
if ( 'on' === get_option( 'wpa_lang' ) ) {
|
347 |
$lang = get_bloginfo( 'language' );
|
348 |
$dir = ( is_rtl() ) ? 'rtl' : 'ltr';
|
349 |
$lang_js = "$('html').attr( 'lang','$lang' ); $('html').attr( 'dir','$dir' )";
|
350 |
}
|
351 |
// Force links to open in the same window.
|
352 |
$underline_target = apply_filters( 'wpa_underline_target', 'a' );
|
353 |
+
$targets = ( 'on' === get_option( 'wpa_target' ) ) ? "$('a').removeAttr('target');" : '';
|
354 |
+
$tabindex = ( 'on' === get_option( 'wpa_tabindex' ) ) ? "$('input,a,select,textarea,button').removeAttr('tabindex');" : '';
|
355 |
+
$underlines = ( 'on' === get_option( 'wpa_underline' ) ) ? "$('$underline_target').css( 'text-decoration','underline' );$('$underline_target').on( 'focusin mouseenter', function() { $(this).css( 'text-decoration','none' ); });$('$underline_target').on( 'focusout mouseleave', function() { $(this).css( 'text-decoration','underline' ); } );" : '';
|
356 |
|
357 |
$display = ( $skiplinks_js || $targets || $lang_js || $tabindex || $longdesc ) ? true : false;
|
358 |
if ( $display ) {
|
402 |
* @return full string css.
|
403 |
*/
|
404 |
function wpa_diagnostic_css( $mce_css ) {
|
405 |
+
if ( get_option( 'wpa_diagnostics' ) === 'on' ) {
|
406 |
$mce_css .= ', ' . plugins_url( 'css/diagnostic.css', __FILE__ );
|
407 |
}
|
408 |
|
409 |
return $mce_css;
|
410 |
}
|
411 |
|
412 |
+
if ( 'on' === get_option( 'wpa_search' ) ) {
|
413 |
add_filter( 'pre_get_posts', 'wpa_filter' );
|
414 |
}
|
415 |
|
422 |
*/
|
423 |
function wpa_filter( $query ) {
|
424 |
if ( ! is_admin() ) {
|
425 |
+
if ( isset( $_GET['s'] ) && '' === trim( $_GET['s'] ) && ( $query->is_main_query() ) ) {
|
426 |
$query->query_vars['s'] = ' ';
|
427 |
$query->set( 'is_search', 1 );
|
428 |
add_action( 'template_include', 'wpa_search_error' );
|
448 |
return $template;
|
449 |
}
|
450 |
|
451 |
+
if ( 'on' === get_option( 'wpa_image_titles' ) ) {
|
452 |
add_filter( 'the_content', 'wpa_image_titles', 100 );
|
453 |
add_filter( 'post_thumbnail_html', 'wpa_image_titles', 100 );
|
454 |
add_filter( 'wp_get_attachment_image', 'wpa_image_titles', 100 );
|
463 |
*/
|
464 |
function wpa_image_titles( $content ) {
|
465 |
$results = array();
|
466 |
+
preg_match_all( '|[\s]title="[^"]*"|U', $content, $results );
|
467 |
foreach ( $results[0] as $img ) {
|
468 |
$content = str_replace( $img, '', $content );
|
469 |
}
|
471 |
return $content;
|
472 |
}
|
473 |
|
474 |
+
if ( 'on' === get_option( 'wpa_more' ) ) {
|
475 |
add_filter( 'get_the_excerpt', 'wpa_custom_excerpt_more', 100 );
|
476 |
add_filter( 'excerpt_more', 'wpa_excerpt_more', 100 );
|
477 |
add_filter( 'the_content_more_link', 'wpa_content_more', 100 );
|
526 |
return $output;
|
527 |
}
|
528 |
|
529 |
+
if ( 'on' === get_option( 'rta_from_tag_clouds' ) ) {
|
530 |
add_filter( 'wp_tag_cloud', 'wpa_remove_title_attributes' );
|
531 |
}
|
532 |
|
612 |
die( 'Security check failed' );
|
613 |
}
|
614 |
$request = ( ! empty( $_POST['support_request'] ) ) ? stripslashes( $_POST['support_request'] ) : false;
|
615 |
+
$has_donated = ( 'on' === $_POST['has_donated'] ) ? 'Donor' : 'No donation';
|
616 |
+
$has_read_faq = ( 'on' === $_POST['has_read_faq'] ) ? 'Read FAQ' : false;
|
617 |
$subject = "WP Accessibility support request. $has_donated";
|
618 |
$message = $request . "\n\n" . $data;
|
619 |
// Get the site domain and get rid of www. from pluggable.php.
|
620 |
$sitename = strtolower( $_SERVER['SERVER_NAME'] );
|
621 |
+
if ( 'www.' === substr( $sitename, 0, 4 ) ) {
|
622 |
$sitename = substr( $sitename, 4 );
|
623 |
}
|
624 |
$from_email = 'wordpress@' . $sitename;
|
630 |
echo "<div class='message error'><p>" . __( 'Please describe your problem.', 'wp-accessibility' ) . '</p></div>';
|
631 |
} else {
|
632 |
wp_mail( 'plugins@joedolson.com', $subject, $message, $from );
|
633 |
+
if ( 'Donor' === $has_donated ) {
|
634 |
echo "<div class='message updated'><p>" . __( 'Thank you for supporting the continuing development of this plug-in! I\'ll get back to you as soon as I can.', 'wp-accessibility' ) . '</p></div>';
|
635 |
} else {
|
636 |
echo "<div class='message updated'><p>" . __( 'I cannot provide support, but will treat your request as a bug report, and will incorporate any permanent solutions I discover into the plug-in.', 'wp-accessibility' ) . '</p></div>';
|
677 |
function wpa_accessible_theme() {
|
678 |
$theme = wp_get_theme();
|
679 |
$tags = $theme->get( 'Tags' );
|
680 |
+
if ( is_array( $tags ) && in_array( 'accessibility-ready', $tags, true ) ) {
|
681 |
return true;
|
682 |
}
|
683 |
return false;
|