WP Accessibility - Version 1.5.10

Version Description

  • Disable Toolbar on Edge due to page not found bug.
  • Modifications to toolbar JS
  • Remove title attribute settings remove attributes no longer being produced.
  • Some code clean up and restructuring.
Download this release

Release Info

Developer joedolson
Plugin Icon 128x128 WP Accessibility
Version 1.5.10
Comparing to
See all releases

Code changes from version 1.5.9 to 1.5.10

readme.txt CHANGED
@@ -4,7 +4,7 @@ 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
Tested up to: 4.7
7
- Stable tag: 1.5.8
8
Text Domain: wp-accessibility
9
License: GPLv2 or later
10
@@ -60,6 +60,13 @@ Translating my plug-ins is always appreciated. Visit <a href="https://translate.
60
61
[Suggest a change!](https://github.com/joedolson/wp-accessibility/)
62
63
= 1.5.9 =
64
65
* Bug fix: another swapped options check, elsewhere. Sigh.
4
Tags: title, accessibility, accessible, navigation, wcag, a11y, section508, focus, alt text, labels, aria
5
Requires at least: 3.4.2
6
Tested up to: 4.7
7
+ Stable tag: 1.5.10
8
Text Domain: wp-accessibility
9
License: GPLv2 or later
10
60
61
[Suggest a change!](https://github.com/joedolson/wp-accessibility/)
62
63
+ = 1.5.10 =
64
+
65
+ * Disable Toolbar on Edge due to page not found bug.
66
+ * Modifications to toolbar JS
67
+ * Remove title attribute settings remove attributes no longer being produced.
68
+ * Some code clean up and restructuring.
69
+
70
= 1.5.9 =
71
72
* Bug fix: another swapped options check, elsewhere. Sigh.
toolbar/img/sprite.png DELETED
Binary file
toolbar/js/a11y.js CHANGED
@@ -9,8 +9,10 @@ function createCookie(name, value, days) {
9
var date = new Date();
10
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
11
var expires = "; expires=" + date.toGMTString();
12
- } else
13
var expires = "";
14
document.cookie = name + "=" + value + expires + "; path=/";
15
}
16
@@ -22,6 +24,7 @@ function readCookie(name) {
22
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
23
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
24
}
25
return null;
26
}
27
@@ -30,70 +33,67 @@ function eraseCookie(name) {
30
createCookie(name, "");
31
}
32
33
- jQuery(document).ready(function ($) {
34
// Saturation handler
35
if (readCookie('a11y-desaturated')) {
36
$('body').addClass('desaturated');
37
$('#is_normal_color').attr('id', 'is_grayscale').attr('aria-pressed', true).addClass('active');
38
}
39
- ;
40
- $('.toggle-grayscale').on('click', function () {
41
if ($(this).attr('id') == "is_normal_color") {
42
$('body').addClass('desaturated');
43
$(this).attr('id', 'is_grayscale').attr('aria-pressed', true).addClass('active');
44
createCookie('a11y-desaturated', '1');
45
- return false;
46
} else {
47
$('body').removeClass('desaturated');
48
$(this).attr('id', 'is_normal_color').attr('aria-pressed', false).removeClass('active');
49
eraseCookie('a11y-desaturated');
50
- return false;
51
}
52
});
53
- //var a11y_stylesheet_path = $('.a11y_stylesheet_path').html();
54
- // Contrast handler
55
- if (readCookie('a11y-high-contrast')) {
56
- $('body').addClass('contrast');
57
- $('head').append($("<link href='" + a11y_stylesheet_path + "' id='highContrastStylesheet' rel='stylesheet' type='text/css' />"));
58
- $('#is_normal_contrast').attr('id', 'is_high_contrast').attr('aria-pressed', true).addClass('active');
59
- $('.a11y-toolbar ul li a i').addClass('icon-white');
60
- }
61
- ;
62
63
- $('.toggle-contrast').on('click', function () {
64
if ($(this).attr('id') == "is_normal_contrast") {
65
$('head').append($("<link href='" + a11y_stylesheet_path + "' id='highContrastStylesheet' rel='stylesheet' type='text/css' />"));
66
$('body').addClass('contrast');
67
$(this).attr('id', 'is_high_contrast').attr('aria-pressed', true).addClass('active');
68
createCookie('a11y-high-contrast', '1');
69
- return false;
70
} else {
71
$('#highContrastStylesheet').remove();
72
$('body').removeClass('contrast');
73
$(this).attr('id', 'is_normal_contrast').attr('aria-pressed', false).removeClass('active');
74
eraseCookie('a11y-high-contrast');
75
- return false;
76
}
77
});
78
79
- // Fontsize handler
80
- if (readCookie('a11y-larger-fontsize')) {
81
- $('html').addClass('fontsize');
82
- $('#is_normal_fontsize').attr('id', 'is_large_fontsize').attr('aria-pressed', true).addClass('active');
83
- }
84
-
85
- $('.toggle-fontsize').on('click', function () {
86
if ($(this).attr('id') == "is_normal_fontsize") {
87
$('html').addClass('fontsize');
88
$(this).attr('id', 'is_large_fontsize').attr('aria-pressed', true).addClass('active');
89
createCookie('a11y-larger-fontsize', '1');
90
- return false;
91
} else {
92
$('html').removeClass('fontsize');
93
$(this).attr('id', 'is_normal_fontsize').attr('aria-pressed', false).removeClass('active');
94
eraseCookie('a11y-larger-fontsize');
95
- return false;
96
}
97
});
98
99
// Sets a -1 tabindex to ALL sections for .focus()-ing
@@ -112,5 +112,5 @@ jQuery(document).ready(function ($) {
112
$(anchorUponArrival).focus();
113
}, 100);
114
}
115
-
116
- });
9
var date = new Date();
10
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
11
var expires = "; expires=" + date.toGMTString();
12
+ } else {
13
var expires = "";
14
+ }
15
+
16
document.cookie = name + "=" + value + expires + "; path=/";
17
}
18
24
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
25
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
26
}
27
+
28
return null;
29
}
30
33
createCookie(name, "");
34
}
35
36
+ ( function( $ ) {
37
// Saturation handler
38
if (readCookie('a11y-desaturated')) {
39
$('body').addClass('desaturated');
40
$('#is_normal_color').attr('id', 'is_grayscale').attr('aria-pressed', true).addClass('active');
41
}
42
+
43
+ if (readCookie('a11y-high-contrast')) {
44
+ $('body').addClass('contrast');
45
+ $('head').append($("<link href='" + a11y_stylesheet_path + "' id='highContrastStylesheet' rel='stylesheet' type='text/css' />"));
46
+ $('#is_normal_contrast').attr('id', 'is_high_contrast').attr('aria-pressed', true).addClass('active');
47
+ $('.a11y-toolbar ul li a i').addClass('icon-white');
48
+ }
49
+
50
+ if (readCookie('a11y-larger-fontsize')) {
51
+ $('html').addClass('fontsize');
52
+ $('#is_normal_fontsize').attr('id', 'is_large_fontsize').attr('aria-pressed', true).addClass('active');
53
+ }
54
+
55
+ $('.toggle-grayscale').on('click', function (e) {
56
if ($(this).attr('id') == "is_normal_color") {
57
$('body').addClass('desaturated');
58
$(this).attr('id', 'is_grayscale').attr('aria-pressed', true).addClass('active');
59
createCookie('a11y-desaturated', '1');
60
} else {
61
$('body').removeClass('desaturated');
62
$(this).attr('id', 'is_normal_color').attr('aria-pressed', false).removeClass('active');
63
eraseCookie('a11y-desaturated');
64
}
65
+
66
+ return false;
67
});
68
69
+ $('.toggle-contrast').on('click', function (e) {
70
if ($(this).attr('id') == "is_normal_contrast") {
71
$('head').append($("<link href='" + a11y_stylesheet_path + "' id='highContrastStylesheet' rel='stylesheet' type='text/css' />"));
72
$('body').addClass('contrast');
73
$(this).attr('id', 'is_high_contrast').attr('aria-pressed', true).addClass('active');
74
createCookie('a11y-high-contrast', '1');
75
} else {
76
$('#highContrastStylesheet').remove();
77
$('body').removeClass('contrast');
78
$(this).attr('id', 'is_normal_contrast').attr('aria-pressed', false).removeClass('active');
79
eraseCookie('a11y-high-contrast');
80
}
81
+
82
+ return false;
83
});
84
85
+ $('.toggle-fontsize').on('click', function (e) {
86
if ($(this).attr('id') == "is_normal_fontsize") {
87
$('html').addClass('fontsize');
88
$(this).attr('id', 'is_large_fontsize').attr('aria-pressed', true).addClass('active');
89
createCookie('a11y-larger-fontsize', '1');
90
} else {
91
$('html').removeClass('fontsize');
92
$(this).attr('id', 'is_normal_fontsize').attr('aria-pressed', false).removeClass('active');
93
eraseCookie('a11y-larger-fontsize');
94
}
95
+
96
+ return false;
97
});
98
99
// Sets a -1 tabindex to ALL sections for .focus()-ing
112
$(anchorUponArrival).focus();
113
}, 100);
114
}
115
+
116
+ } )( jQuery );
wp-accessibility-settings.php CHANGED
@@ -13,22 +13,9 @@ function wpa_update_settings() {
13
die( "Security check failed" );
14
}
15
if ( isset( $_POST['action'] ) && $_POST['action'] == 'rta' ) {
16
- $rta_from_nav_menu = ( isset( $_POST['rta_from_nav_menu'] ) ) ? 'on' : '';
17
- $rta_from_page_lists = ( isset( $_POST['rta_from_page_lists'] ) ) ? 'on' : '';
18
- $rta_from_category_lists = ( isset( $_POST['rta_from_category_lists'] ) ) ? 'on' : '';
19
- $rta_from_archive_links = ( isset( $_POST['rta_from_archive_links'] ) ) ? 'on' : '';
20
$rta_from_tag_clouds = ( isset( $_POST['rta_from_tag_clouds'] ) ) ? 'on' : '';
21
- $rta_from_category_links = ( isset( $_POST['rta_from_category_links'] ) ) ? 'on' : '';
22
- $rta_from_post_edit_links = ( isset( $_POST['rta_from_post_edit_links'] ) ) ? 'on' : '';
23
- $rta_from_edit_comment_links = ( isset( $_POST['rta_from_edit_comment_links'] ) ) ? 'on' : '';
24
- update_option( 'rta_from_nav_menu', $rta_from_nav_menu );
25
- update_option( 'rta_from_page_lists', $rta_from_page_lists );
26
- update_option( 'rta_from_category_lists', $rta_from_category_lists );
27
- update_option( 'rta_from_archive_links', $rta_from_archive_links );
28
update_option( 'rta_from_tag_clouds', $rta_from_tag_clouds );
29
- update_option( 'rta_from_category_links', $rta_from_category_links );
30
- update_option( 'rta_from_post_edit_links', $rta_from_post_edit_links );
31
- update_option( 'rta_from_edit_comment_links', $rta_from_edit_comment_links );
32
$message = __( "Remove Title Attributes Settings Updated", 'wp-accessibility' );
33
34
return "<div class='updated'><p>" . $message . "</p></div>";
@@ -419,77 +406,17 @@ function wpa_admin_menu() {
419
<h2 class='hndle'><?php _e( 'Remove Title Attributes', 'wp-accessibility' ); ?></h2>
420
421
<div class="inside">
422
- <?php wpa_accessible_theme(); ?>
423
- <p>
424
- <?php _e( 'As of WordPress 4.0, the only globally added title attributes are in the WordPress tag cloud, showing the number of posts with that tag, and on the categories list, if the category has a term description.', 'wp-accessibility' ); ?>
425
- </p>
426
<form method="post"
427
action="<?php echo admin_url( 'options-general.php?page=wp-accessibility/wp-accessibility.php' ); ?>">
428
<fieldset>
429
<legend><?php _e( 'Remove title attributes from:', 'wp-accessibility' ); ?></legend>
430
<ul>
431
- <?php if ( version_compare( get_bloginfo( 'version' ), '3.8', '<' ) ) { ?>
432
- <li>
433
- <input type="checkbox" id="rta_from_nav_menu"
434
- name="rta_from_nav_menu" <?php if ( get_option( 'rta_from_nav_menu' ) == "on" ) {
435
- echo 'checked="checked" ';
436
- } ?>/> <label
437
- for="rta_from_nav_menu"><?php _e( 'Nav menus', 'wp-accessibility' ); ?>
438
- (<?php echo ( version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) ? __( 'Obsolete since WordPress 3.8', 'wp-accessibility' ) : ''; ?>
439
- )</label></li>
440
- <li>
441
- <input type="checkbox" id="rta_from_page_lists"
442
- name="rta_from_page_lists" <?php if ( get_option( 'rta_from_page_lists' ) == "on" ) {
443
- echo 'checked="checked" ';
444
- } ?>/> <label
445
- for="rta_from_page_lists"><?php _e( 'Page lists', 'wp-accessibility' ); ?>
446
- (<?php echo ( version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) ? __( 'Obsolete since WordPress 3.8', 'wp-accessibility' ) : ''; ?>
447
- )</label></li>
448
- <li>
449
- <input type="checkbox" id="rta_from_category_links"
450
- name="rta_from_category_links" <?php if ( get_option( 'rta_from_category_links' ) == "on" ) {
451
- echo 'checked="checked" ';
452
- } ?>/> <label
453
- for="rta_from_category_links"><?php _e( 'Category links', 'wp-accessibility' ); ?>
454
- (<?php echo ( version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) ? __( 'Obsolete since WordPress 3.8', 'wp-accessibility' ) : ''; ?>
455
- )</label></li>
456
- <li>
457
- <input type="checkbox" id="rta_from_post_edit_links"
458
- name="rta_from_post_edit_links" <?php if ( get_option( 'rta_from_post_edit_links' ) == "on" ) {
459
- echo 'checked="checked" ';
460
- } ?>/> <label
461
- for="rta_from_post_edit_links"><?php _e( 'Post edit links', 'wp-accessibility' ); ?>
462
- (<?php echo ( version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) ? __( 'Obsolete since WordPress 3.8', 'wp-accessibility' ) : ''; ?>
463
- )</label></li>
464
- <li>
465
- <input type="checkbox" id="rta_from_edit_comment_links"
466
- name="rta_from_edit_comment_links" <?php if ( get_option( 'rta_from_edit_comment_links' ) == "on" ) {
467
- echo 'checked="checked" ';
468
- } ?>/> <label
469
- for="rta_from_edit_comment_links"><?php _e( 'Edit comment links', 'wp-accessibility' ); ?>
470
- (<?php echo ( version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) ? __( 'Obsolete since WordPress 3.8', 'wp-accessibility' ) : ''; ?>
471
- )</label></li>
472
- <?php } ?>
473
- <?php if ( version_compare( get_bloginfo( 'version' ), '4.0', '<' ) ) { ?>
474
- <li><input type="checkbox" id="rta_from_category_lists"
475
- name="rta_from_category_lists" <?php if ( get_option( 'rta_from_category_lists' ) == "on" ) {
476
- echo 'checked="checked" ';
477
- } ?>/> <label
478
- for="rta_from_category_lists"><?php _e( 'Category lists', 'wp-accessibility' ); ?></label>
479
- </li>
480
-
481
- <?php } ?>
482
<li><input type="checkbox" id="rta_from_tag_clouds"
483
name="rta_from_tag_clouds" <?php if ( get_option( 'rta_from_tag_clouds' ) == "on" ) {
484
echo 'checked="checked" ';
485
} ?>/> <label
486
for="rta_from_tag_clouds"><?php _e( 'Tag clouds', 'wp-accessibility' ); ?></label>
487
- </li>
488
- <li><input type="checkbox" id="rta_from_archive_links"
489
- name="rta_from_archive_links" <?php if ( get_option( 'rta_from_archive_links' ) == "on" ) {
490
- echo 'checked="checked" ';
491
- } ?>/> <label
492
- for="rta_from_archive_links"><?php _e( 'Archive links', 'wp-accessibility' ); ?></label>
493
</li>
494
</ul>
495
</fieldset>
@@ -650,6 +577,7 @@ function wpa_admin_menu() {
650
651
<div class="inside">
652
<ul>
653
<li><a href="http://make.wordpress.org/accessibility/">Make WordPress: Accessibility</a></li>
654
<li><a href="https://make.wordpress.org/themes/handbook/review/accessibility/">WordPress Theme Accessibility Guidelines</a></li>
655
<li><a href="http://make.wordpress.org/support/user-manual/web-publishing/accessibility/">WordPress
13
die( "Security check failed" );
14
}
15
if ( isset( $_POST['action'] ) && $_POST['action'] == 'rta' ) {
16
$rta_from_tag_clouds = ( isset( $_POST['rta_from_tag_clouds'] ) ) ? 'on' : '';
17
update_option( 'rta_from_tag_clouds', $rta_from_tag_clouds );
18
+
19
$message = __( "Remove Title Attributes Settings Updated", 'wp-accessibility' );
20
21
return "<div class='updated'><p>" . $message . "</p></div>";
406
<h2 class='hndle'><?php _e( 'Remove Title Attributes', 'wp-accessibility' ); ?></h2>
407
408
<div class="inside">
409
+ <?php wpa_accessible_theme(); ?>
410
<form method="post"
411
action="<?php echo admin_url( 'options-general.php?page=wp-accessibility/wp-accessibility.php' ); ?>">
412
<fieldset>
413
<legend><?php _e( 'Remove title attributes from:', 'wp-accessibility' ); ?></legend>
414
<ul>
415
<li><input type="checkbox" id="rta_from_tag_clouds"
416
name="rta_from_tag_clouds" <?php if ( get_option( 'rta_from_tag_clouds' ) == "on" ) {
417
echo 'checked="checked" ';
418
} ?>/> <label
419
for="rta_from_tag_clouds"><?php _e( 'Tag clouds', 'wp-accessibility' ); ?></label>
420
</li>
421
</ul>
422
</fieldset>
577
578
<div class="inside">
579
<ul>
580
+ <li><a href="http://make.wordpress.org/accessibility/wp-accessibility-plugin/">Documentation</a></li>
581
<li><a href="http://make.wordpress.org/accessibility/">Make WordPress: Accessibility</a></li>
582
<li><a href="https://make.wordpress.org/themes/handbook/review/accessibility/">WordPress Theme Accessibility Guidelines</a></li>
583
<li><a href="http://make.wordpress.org/support/user-manual/web-publishing/accessibility/">WordPress
wp-accessibility-toolbar.php ADDED
@@ -0,0 +1,76 @@
1
+ <?php
2
+
3
+ add_shortcode( 'wpa_toolbar', 'wpa_toolbar_html' );
4
+ function wpa_toolbar_html() {
5
+ $contrast = __( 'Toggle High Contrast', 'wp-accessibility' );
6
+ $grayscale = __( 'Toggle Grayscale', 'wp-accessibility' );
7
+ $fontsize = __( 'Toggle Font size', 'wp-accessibility' );
8
+ $enable_grayscale = ( get_option( 'wpa_toolbar_gs' ) == 'on' ) ? true : false;
9
+ $enable_contrast = ( get_option( 'wpa_toolbar_ct' ) == 'off' ) ? false : true;
10
+ $enable_fontsize = ( get_option( 'wpa_toolbar_fs' ) == 'off' ) ? false : true;
11
+ $responsive = ( get_option( 'wpa_toolbar_mobile' ) == 'on' ) ? 'a11y-responsive ' : '';
12
+ $toolbar = '
13
+ <!-- a11y toolbar widget -->
14
+ <div class="' . $responsive . 'a11y-toolbar-widget">
15
+ <ul>';
16
+ if ( $enable_contrast ) {
17
+ $toolbar .= '<li><a href="#" class="a11y-toggle-contrast toggle-contrast" id="is_normal_contrast"><span class="offscreen">'.$contrast.'</span><span class="aticon aticon-adjust"></span></a></li>';
18
+ }
19
+ if ( $enable_grayscale ) {
20
+ $toolbar .= '<li><a href="#" class="a11y-toggle-grayscale toggle-grayscale" id="is_normal_color"><span class="offscreen">'.$grayscale.'</span><span class="aticon aticon-tint"></span></a></li>';
21
+ }
22
+ if ( $enable_fontsize ) {
23
+ $toolbar .= '<li><a href="#" class="a11y-toggle-fontsize toggle-fontsize" id="is_normal_fontsize"><span class="offscreen">'.$fontsize.'</span><span class="aticon aticon-font"></span></a></li>';
24
+ }
25
+ $toolbar .= '
26
+ </ul>
27
+ </div>
28
+ <!-- // a11y toolbar widget -->';
29
+
30
+ return $toolbar;
31
+ }
32
+
33
+ function wpa_toolbar_js() {
34
+ // Toolbar does not work on Edge. Disable unless I solve the issue.
35
+ $user_agent = ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ? $_SERVER['HTTP_USER_AGENT'] : '';
36
+ if ( preg_match( '/Edge/i', $user_agent ) ) {
37
+ return;
38
+ }
39
+
40
+ $contrast = __( 'Toggle High Contrast', 'wp-accessibility' );
41
+ $grayscale = __( 'Toggle Grayscale', 'wp-accessibility' );
42
+ $fontsize = __( 'Toggle Font size', 'wp-accessibility' );
43
+ $enable_grayscale = ( get_option( 'wpa_toolbar_gs' ) == 'on' ) ? true : false;
44
+ $enable_fontsize = ( get_option( 'wpa_toolbar_fs' ) == 'off' ) ? false : true;
45
+ $enable_contrast = ( get_option( 'wpa_toolbar_ct' ) == 'off' ) ? false : true;
46
+ $default = ( get_option( 'wpa_toolbar_default' ) != '' ) ? get_option( 'wpa_toolbar_default' ) : 'body';
47
+ $location = apply_filters( 'wpa_move_toolbar', $default );
48
+ $is_rtl = ( is_rtl() ) ? ' rtl' : ' ltr';
49
+ $is_right = ( get_option( 'wpa_toolbar_right' ) == 'on' ) ? ' right' : '';
50
+ $responsive = ( get_option( 'wpa_toolbar_mobile' ) == 'on' ) ? 'a11y-responsive' : '';
51
+ echo
52
+ "
53
+ <script type='text/javascript'>
54
+ //<![CDATA[
55
+ (function( $ ) { 'use strict';
56
+ var insert_a11y_toolbar = '<!-- a11y toolbar -->';
57
+ insert_a11y_toolbar += '<div class=\"$responsive a11y-toolbar$is_rtl$is_right\">';
58
+ insert_a11y_toolbar += '<ul class=\"a11y-toolbar-list\">';";
59
+ if ( get_option( 'wpa_toolbar' ) == 'on' && $enable_contrast ) {
60
+ 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>';";
61
+ }
62
+ if ( get_option( 'wpa_toolbar' ) == 'on' && $enable_grayscale ) {
63
+ 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>';";
64
+ }
65
+ if ( get_option( 'wpa_toolbar' ) == 'on' && $enable_fontsize ) {
66
+ 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>';";
67
+ }
68
+ echo "
69
+ insert_a11y_toolbar += '</ul>';
70
+ insert_a11y_toolbar += '</div>';
71
+ insert_a11y_toolbar += '<!-- // a11y toolbar -->';
72
+ $( document ).find( '$location' ).prepend( insert_a11y_toolbar );
73
+ }(jQuery));
74
+ //]]>
75
+ </script>";
76
+ }
wp-accessibility-widget.php ADDED
@@ -0,0 +1,35 @@
1
+ <?php
2
+
3
+ add_action( 'widgets_init', create_function( '', 'return register_widget("wp_accessibility_toolbar");' ) );
4
+ class wp_accessibility_toolbar extends WP_Widget {
5
+ function __construct() {
6
+ parent::__construct( false, $name = __( 'Accessibility Toolbar', 'wp-accessibility' ), array( 'customize_selective_refresh' => true ) );
7
+ }
8
+
9
+ function widget( $args, $instance ) {
10
+ extract( $args );
11
+
12
+ $title = apply_filters( 'widget_title', ( empty( $instance['title'] ) ? false : $instance['title'] ), $instance, $args );
13
+ echo $before_widget;
14
+ echo ( $title ) ? $before_title . $title . $after_title : '';
15
+ echo wpa_toolbar_html();
16
+ echo $after_widget;
17
+ }
18
+
19
+ function form( $instance ) {
20
+ $title = ( isset( $instance['title'] ) ) ? esc_attr( $instance['title'] ) : '';
21
+ ?>
22
+ <p>
23
+ <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'wp-accessibility' ); ?></label>
24
+ <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php esc_attr_e( $title ); ?>"/>
25
+ </p>
26
+ <?php
27
+ }
28
+
29
+ function update( $new_instance, $old_instance ) {
30
+ $instance = $old_instance;
31
+ $instance['title'] = strip_tags( $new_instance['title'] );
32
+
33
+ return $instance;
34
+ }
35
+ }
wp-accessibility.php CHANGED
@@ -3,13 +3,13 @@
3
Plugin Name: WP Accessibility
4
Plugin URI: http://www.joedolson.com/wp-accessibility/
5
Description: Helps improve accessibility in your WordPress site, like removing title attributes.
6
- Version: 1.5.9
7
Author: Joe Dolson
8
Text Domain: wp-accessibility
9
Domain Path: /lang
10
Author URI: http://www.joedolson.com/
11
12
- Copyright 2012-2016 Joe Dolson (joe@joedolson.com)
13
14
This program is free software; you can redistribute it and/or modify
15
it under the terms of the GNU General Public License as published by
@@ -27,6 +27,8 @@ Author URI: http://www.joedolson.com/
27
*/
28
29
include( dirname( __FILE__ ) . '/wp-accessibility-settings.php' );
30
register_activation_hook( __FILE__, 'wpa_install' );
31
32
// Enable internationalisation
@@ -42,9 +44,26 @@ function add_wpa_admin_menu() {
42
add_options_page( 'WP Accessibility', 'WP Accessibility', 'manage_options', __FILE__, 'wpa_admin_menu' );
43
}
44
45
// ACTIVATION
46
function wpa_install() {
47
- $wpa_version = '1.5.9';
48
if ( get_option( 'wpa_installed' ) != 'true' ) {
49
add_option( 'rta_from_nav_menu', 'on' );
50
add_option( 'rta_from_page_lists', 'on' );
@@ -77,6 +96,7 @@ function wpa_check_version() {
77
}
78
}
79
80
function wpa_plugin_action( $links, $file ) {
81
if ( $file == plugin_basename( dirname( __FILE__ ) . '/wp-accessibility.php' ) ) {
82
$admin_url = admin_url( 'options-general.php?page=wp-accessibility/wp-accessibility.php' );
@@ -86,62 +106,19 @@ function wpa_plugin_action( $links, $file ) {
86
return $links;
87
}
88
89
- //Add Plugin Actions to WordPress
90
- add_filter( 'plugin_action_links', 'wpa_plugin_action', 10, 2 );
91
- add_action( 'wp_enqueue_scripts', 'wpa_register_scripts' );
92
- add_action( 'admin_menu', 'wpa_javascript' );
93
-
94
/**
95
* Enqueue color picker for contrast testing
96
**/
97
- function wpa_javascript() {
98
- if ( isset( $_GET['page'] ) && $_GET['page'] == 'wp-accessibility/wp-accessibility.php' ) {
99
wp_enqueue_script( 'farbtastic' );
100
}
101
}
102
103
- function wpa_admin_stylesheet() {
104
-
105
- if ( file_exists( get_stylesheet_directory() . '/wp-admin.css' ) ) {
106
- $file = get_stylesheet_directory_uri() . '/wp-admin.css';
107
- wp_register_style( 'wp-a11y-css', $file );
108
- wp_enqueue_style( 'wp-a11y-css' );
109
- }
110
-
111
- if ( get_option( 'wpa_row_actions' ) == 'on' ) {
112
- if ( file_exists( get_stylesheet_directory() . '/wp-admin-row-actions.css' ) ) {
113
- $file = get_stylesheet_directory_uri() . '/wp-admin-row-actions.css';
114
- } else {
115
- $file = plugins_url( 'css/wp-admin-row-actions.css', __FILE__ );
116
- }
117
- wp_register_style( 'wp-row-actions', $file );
118
- wp_enqueue_style( 'wp-row-actions' );
119
- }
120
- }
121
-
122
- function wpa_admin_js() {
123
- return;
124
- } // just a placeholder
125
-
126
- add_action( 'admin_head', 'wpa_admin_stylesheet' );
127
- add_action( 'admin_head', 'wpa_admin_js' );
128
-
129
- function wpa_write_js() {
130
- if ( isset( $_GET['page'] ) && $_GET['page'] == 'wp-accessibility/wp-accessibility.php' ) {
131
- ?>
132
- <script>
133
- //<![CDATA[
134
- (function ($) {
135
- 'use strict';
136
- $('#fore').farbtastic('#color1');
137
- $('#back').farbtastic('#color2');
138
- }(jQuery));
139
- //]]>
140
- </script>
141
- <?php
142
- }
143
- }
144
145
function wpa_register_scripts() {
146
// register jQuery scripts;
147
wp_register_script( 'skiplinks.webkit', plugins_url( 'wp-accessibility/js/skiplinks.webkit.js' ) );
@@ -149,17 +126,9 @@ function wpa_register_scripts() {
149
wp_register_script( 'scrollTo', plugins_url( 'wp-accessibility/toolbar/js/jquery.scrollto.min.js' ), array( 'jquery' ), '1.4.5', true );
150
}
151
152
- add_action( 'wp_footer', 'wpa_jquery_asl', 100 );
153
add_action( 'wp_enqueue_scripts', 'wpacc_enqueue_scripts' );
154
- add_action( 'wp_head', 'wpa_css' );
155
- add_action( 'wp_enqueue_scripts', 'wpa_core_scripts' );
156
- add_action( 'wp_enqueue_scripts', 'wpa_stylesheet' );
157
-
158
- function wpa_core_scripts() {
159
- wp_enqueue_script( 'jquery' );
160
- }
161
-
162
function wpacc_enqueue_scripts() {
163
if ( get_option( 'asl_enable' ) == 'on' ) {
164
wp_enqueue_script( 'skiplinks.webkit' );
165
}
@@ -203,109 +172,64 @@ function wpacc_enqueue_scripts() {
203
}
204
}
205
206
- add_action( 'widgets_init', create_function( '', 'return register_widget("wp_accessibility_toolbar");' ) );
207
- class wp_accessibility_toolbar extends WP_Widget {
208
- function __construct() {
209
- parent::__construct( false, $name = __( 'Accessibility Toolbar', 'wp-accessibility' ), array( 'customize_selective_refresh' => true ) );
210
- }
211
-
212
- function widget( $args, $instance ) {
213
- extract( $args );
214
-
215
- $title = apply_filters( 'widget_title', ( empty( $instance['title'] ) ? false : $instance['title'] ), $instance, $args );
216
- echo $before_widget;
217
- echo ( $title ) ? $before_title . $title . $after_title : '';
218
- echo wpa_toolbar_html();
219
- echo $after_widget;
220
- }
221
-
222
- function form( $instance ) {
223
- $title = ( isset( $instance['title'] ) ) ? esc_attr( $instance['title'] ) : '';
224
- ?>
225
- <p>
226
- <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'wp-accessibility' ); ?></label>
227
- <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php esc_attr_e( $title ); ?>"/>
228
- </p>
229
- <?php
230
- }
231
-
232
- function update( $new_instance, $old_instance ) {
233
- $instance = $old_instance;
234
- $instance['title'] = strip_tags( $new_instance['title'] );
235
-
236
- return $instance;
237
- }
238
}
239
-
240
- add_shortcode( 'wpa_toolbar', 'wpa_toolbar_html' );
241
- function wpa_toolbar_html() {
242
- $contrast = __( 'Toggle High Contrast', 'wp-accessibility' );
243
- $grayscale = __( 'Toggle Grayscale', 'wp-accessibility' );
244
- $fontsize = __( 'Toggle Font size', 'wp-accessibility' );
245
- $enable_grayscale = ( get_option( 'wpa_toolbar_gs' ) == 'on' ) ? true : false;
246
- $enable_contrast = ( get_option( 'wpa_toolbar_ct' ) == 'off' ) ? false : true;
247
- $enable_fontsize = ( get_option( 'wpa_toolbar_fs' ) == 'off' ) ? false : true;
248
- $responsive = ( get_option( 'wpa_toolbar_mobile' ) == 'on' ) ? 'a11y-responsive ' : '';
249
- $toolbar = '
250
- <!-- a11y toolbar widget -->
251
- <div class="' . $responsive . 'a11y-toolbar-widget">
252
- <ul>';
253
- if ( $enable_contrast ) {
254
- $toolbar .= '<li><a href="#" class="a11y-toggle-contrast toggle-contrast" id="is_normal_contrast"><span class="offscreen">'.$contrast.'</span><span class="aticon aticon-adjust"></span></a></li>';
255
}
256
- if ( $enable_grayscale ) {
257
- $toolbar .= '<li><a href="#" class="a11y-toggle-grayscale toggle-grayscale" id="is_normal_color"><span class="offscreen">'.$grayscale.'</span><span class="aticon aticon-tint"></span></a></li>';
258
}
259
- if ( $enable_fontsize ) {
260
- $toolbar .= '<li><a href="#" class="a11y-toggle-fontsize toggle-fontsize" id="is_normal_fontsize"><span class="offscreen">'.$fontsize.'</span><span class="aticon aticon-font"></span></a></li>';
261
}
262
- $toolbar .= '
263
- </ul>
264
- </div>
265
- <!-- // a11y toolbar widget -->';
266
-
267
- return $toolbar;
268
}
269
270
- function wpa_toolbar_js() {
271
- $contrast = __( 'Toggle High Contrast', 'wp-accessibility' );
272
- $grayscale = __( 'Toggle Grayscale', 'wp-accessibility' );
273
- $fontsize = __( 'Toggle Font size', 'wp-accessibility' );
274
- $enable_grayscale = ( get_option( 'wpa_toolbar_gs' ) == 'on' ) ? true : false;
275
- $enable_fontsize = ( get_option( 'wpa_toolbar_fs' ) == 'off' ) ? false : true;
276
- $enable_contrast = ( get_option( 'wpa_toolbar_ct' ) == 'off' ) ? false : true;
277
- $default = ( get_option( 'wpa_toolbar_default' ) != '' ) ? get_option( 'wpa_toolbar_default' ) : 'body';
278
- $location = apply_filters( 'wpa_move_toolbar', $default );
279
- $is_rtl = ( is_rtl() ) ? ' rtl' : ' ltr';
280
- $is_right = ( get_option( 'wpa_toolbar_right' ) == 'on' ) ? ' right' : '';
281
- $responsive = ( get_option( 'wpa_toolbar_mobile' ) == 'on' ) ? 'a11y-responsive' : '';
282
- echo
283
- "
284
- <script type='text/javascript'>
285
- //<![CDATA[
286
- (function( $ ) { 'use strict';
287
- var insert_a11y_toolbar = '<!-- a11y toolbar -->';
288
- insert_a11y_toolbar += '<div class=\"$responsive a11y-toolbar$is_rtl$is_right\">';
289
- insert_a11y_toolbar += '<ul class=\"a11y-toolbar-list\">';";
290
- if ( get_option( 'wpa_toolbar' ) == 'on' && $enable_contrast ) {
291
- 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>';";
292
- }
293
- if ( get_option( 'wpa_toolbar' ) == 'on' && $enable_grayscale ) {
294
- 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>';";
295
}
296
- if ( get_option( 'wpa_toolbar' ) == 'on' && $enable_fontsize ) {
297
- 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>';";
298
}
299
- echo "
300
- insert_a11y_toolbar += '</ul>';
301
- insert_a11y_toolbar += '</div>';
302
- insert_a11y_toolbar += '<!-- // a11y toolbar -->';
303
- $( document ).find( '$location' ).prepend( insert_a11y_toolbar );
304
- }(jQuery));
305
- //]]>
306
- </script>";
307
}
308
309
function wpa_css() {
310
$styles = '';
311
if ( get_option( 'asl_enable' ) == 'on' ) {
@@ -351,6 +275,7 @@ function wpa_is_url( $url ) {
351
return preg_match( '|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $url );
352
}
353
354
function wpa_jquery_asl() {
355
$skiplinks_js = $targets = $lang_js = $tabindex = $longdesc = false;
356
$visibility = ( get_option( 'asl_visible' ) == 'on' ) ? 'wpa-visible' : 'wpa-hide';
@@ -424,39 +349,6 @@ function wpa_logout_item( $admin_bar ) {
424
$admin_bar->add_node( $args );
425
}
426
427
- function wpa_stylesheet() {
428
- // Respects SSL, Style.css is relative to the current file
429
- wp_register_style( 'wpa-style', plugins_url( 'css/wpa-style.css', __FILE__ ) );
430
- wp_register_style( 'ui-font.css', plugins_url( 'toolbar/fonts/css/a11y-toolbar.css', __FILE__ ) );
431
- $toolbar = apply_filters( 'wpa_toolbar_css', plugins_url( 'toolbar/css/a11y.css', __FILE__ ) );
432
- wp_register_style( 'ui-a11y.css', $toolbar, array( 'ui-font.css' ) );
433
- $fontsize_stylesheet = ( get_option( 'wpa_alternate_fontsize' ) == 'on' ) ? 'a11y-fontsize-alt' : 'a11y-fontsize';
434
- $fontsize = apply_filters( 'wpa_fontsize_css', plugins_url( 'toolbar/css/'. $fontsize_stylesheet . '.css', __FILE__ ) );
435
- wp_register_style( 'ui-fontsize.css', $fontsize );
436
- // only enable styles when required by options
437
- if ( get_option( 'wpa_toolbar_size' ) && get_option( 'wpa_toolbar' ) == 'on' ) {
438
- echo "
439
- <style type='text/css'>
440
- .a11y-toolbar ul li button {
441
- font-size: " . get_option( 'wpa_toolbar_size' ) . " !important;
442
- }
443
- </style>";
444
- }
445
- if ( get_option( 'wpa_longdesc' ) == 'link' || get_option( 'wpa_longdesc' ) == 'jquery' || get_option( 'asl_enable' ) == 'on' ) {
446
- wp_enqueue_style( 'wpa-style' );
447
- }
448
- if ( get_option( 'wpa_toolbar' ) == 'on' || get_option( 'wpa_widget_toolbar' ) == 'on' && ( $toolbar && $fontsize ) ) {
449
- wp_enqueue_style( 'ui-a11y.css' );
450
- wp_enqueue_style( 'ui-fontsize.css' );
451
- }
452
- if ( current_user_can( 'edit_files' ) && get_option( 'wpa_diagnostics' ) == 'on' ) {
453
- wp_register_style( 'diagnostic', plugins_url( 'css/diagnostic.css', __FILE__ ) );
454
- wp_register_style( 'diagnostic-head', plugins_url( 'css/diagnostic-head.css', __FILE__ ) );
455
- wp_enqueue_style( 'diagnostic' );
456
- wp_enqueue_style( 'diagnostic-head' );
457
- }
458
- }
459
-
460
add_filter( 'mce_css', 'wp_diagnostic_css' );
461
function wp_diagnostic_css( $mce_css ) {
462
if ( get_option( 'wpa_diagnostics' ) == 'on' ) {
@@ -672,31 +564,9 @@ function wpa_admin_styles() {
672
}
673
}
674
675
- // Obsolete with 3.8: (nav menus, page lists, edit post links, edit comment links, category links)
676
- if ( get_option( 'rta_from_nav_menu' ) == 'on' && version_compare( get_bloginfo( 'version' ), '3.8.0', '<' ) ) {
677
- add_filter( 'wp_nav_menu', 'wpa_remove_title_attributes' );
678
- }
679
- if ( get_option( 'rta_from_page_lists' ) == 'on' && version_compare( get_bloginfo( 'version' ), '3.8.0', '<' ) ) {
680
- add_filter( 'wp_list_pages', 'wpa_remove_title_attributes' );
681
- }
682
- if ( get_option( 'rta_from_category_lists' ) == 'on' ) {
683
- add_filter( 'wp_list_categories', 'wpa_remove_title_attributes' );
684
- }
685
- if ( get_option( 'rta_from_archive_links' ) == 'on' ) {
686
- add_filter( 'get_archives_link', 'wpa_remove_title_attributes' );
687
- }
688
if ( get_option( 'rta_from_tag_clouds' ) == 'on' ) {
689
add_filter( 'wp_tag_cloud', 'wpa_remove_title_attributes' );
690
}
691
- if ( get_option( 'rta_from_category_links' && version_compare( get_bloginfo( 'version' ), '3.8.0', '<' ) ) == 'on' ) {
692
- add_filter( 'the_category', 'wpa_remove_title_attributes' );
693
- }
694
- if ( get_option( 'rta_from_post_edit_links' && version_compare( get_bloginfo( 'version' ), '3.8.0', '<' ) ) == 'on' ) {
695
- add_filter( 'edit_post_link', 'wpa_remove_title_attributes' );
696
- }
697
- if ( get_option( 'rta_from_edit_comment_links' && version_compare( get_bloginfo( 'version' ), '3.8.0', '<' ) ) == 'on' ) {
698
- add_filter( 'edit_comment_link', 'wpa_remove_title_attributes' );
699
- }
700
701
function wpa_remove_title_attributes( $output ) {
702
$output = preg_replace( '/\s*title\s*=\s*(["\']).*?\1/', '', $output );
@@ -1077,6 +947,7 @@ function wpa_save_alt_verification( $post, $attachment ) {
1077
} else {
1078
delete_post_meta( $post['ID'], '_no_alt' );
1079
}
1080
return $post;
1081
}
1082
3
Plugin Name: WP Accessibility
4
Plugin URI: http://www.joedolson.com/wp-accessibility/
5
Description: Helps improve accessibility in your WordPress site, like removing title attributes.
6
+ Version: 1.5.10
7
Author: Joe Dolson
8
Text Domain: wp-accessibility
9
Domain Path: /lang
10
Author URI: http://www.joedolson.com/
11
12
+ Copyright 2012-2017 Joe Dolson (joe@joedolson.com)
13
14
This program is free software; you can redistribute it and/or modify
15
it under the terms of the GNU General Public License as published by
27
*/
28
29
include( dirname( __FILE__ ) . '/wp-accessibility-settings.php' );
30
+ include( dirname( __FILE__ ) . '/wp-accessibility-widget.php' );
31
+ include( dirname( __FILE__ ) . '/wp-accessibility-toolbar.php' );
32
register_activation_hook( __FILE__, 'wpa_install' );
33
34
// Enable internationalisation
44
add_options_page( 'WP Accessibility', 'WP Accessibility', 'manage_options', __FILE__, 'wpa_admin_menu' );
45
}
46
47
+ function wpa_write_js() {
48
+ global $current_screen;
49
+ if ( $current_screen->base == 'settings_page_wp-accessibility/wp-accessibility' ) {
50
+ ?>
51
+ <script>
52
+ //<![CDATA[
53
+ (function ($) {
54
+ 'use strict';
55
+ $('#fore').farbtastic('#color1');
56
+ $('#back').farbtastic('#color2');
57
+ }(jQuery));
58
+ //]]>
59
+ </script>
60
+ <?php
61
+ }
62
+ }
63
+
64
// ACTIVATION
65
function wpa_install() {
66
+ $wpa_version = '1.5.10';
67
if ( get_option( 'wpa_installed' ) != 'true' ) {
68
add_option( 'rta_from_nav_menu', 'on' );
69
add_option( 'rta_from_page_lists', 'on' );
96
}
97
}
98
99
+ add_filter( 'plugin_action_links', 'wpa_plugin_action', 10, 2 );
100
function wpa_plugin_action( $links, $file ) {
101
if ( $file == plugin_basename( dirname( __FILE__ ) . '/wp-accessibility.php' ) ) {
102
$admin_url = admin_url( 'options-general.php?page=wp-accessibility/wp-accessibility.php' );
106
return $links;
107
}
108
109
/**
110
* Enqueue color picker for contrast testing
111
**/
112
+ add_action( 'admin_enqueue_scripts', 'wpa_admin_js' );
113
+ function wpa_admin_js() {
114
+ global $current_screen;
115
+ if ( $current_screen->base == 'settings_page_wp-accessibility/wp-accessibility' ) {
116
wp_enqueue_script( 'farbtastic' );
117
}
118
}
119
120
121
+ add_action( 'wp_enqueue_scripts', 'wpa_register_scripts' );
122
function wpa_register_scripts() {
123
// register jQuery scripts;
124
wp_register_script( 'skiplinks.webkit', plugins_url( 'wp-accessibility/js/skiplinks.webkit.js' ) );
126
wp_register_script( 'scrollTo', plugins_url( 'wp-accessibility/toolbar/js/jquery.scrollto.min.js' ), array( 'jquery' ), '1.4.5', true );
127
}
128
129
add_action( 'wp_enqueue_scripts', 'wpacc_enqueue_scripts' );
130
function wpacc_enqueue_scripts() {
131
+ wp_enqueue_script( 'jquery' );
132
if ( get_option( 'asl_enable' ) == 'on' ) {
133
wp_enqueue_script( 'skiplinks.webkit' );
134
}
172
}
173
}
174
175
+ add_action( 'wp_enqueue_scripts', 'wpa_stylesheet' );
176
+ function wpa_stylesheet() {
177
+ // Respects SSL, Style.css is relative to the current file
178
+ wp_register_style( 'wpa-style', plugins_url( 'css/wpa-style.css', __FILE__ ) );
179
+ wp_register_style( 'ui-font.css', plugins_url( 'toolbar/fonts/css/a11y-toolbar.css', __FILE__ ) );
180
+ $toolbar = apply_filters( 'wpa_toolbar_css', plugins_url( 'toolbar/css/a11y.css', __FILE__ ) );
181
+ wp_register_style( 'ui-a11y.css', $toolbar, array( 'ui-font.css' ) );
182
+ $fontsize_stylesheet = ( get_option( 'wpa_alternate_fontsize' ) == 'on' ) ? 'a11y-fontsize-alt' : 'a11y-fontsize';
183
+ $fontsize = apply_filters( 'wpa_fontsize_css', plugins_url( 'toolbar/css/'. $fontsize_stylesheet . '.css', __FILE__ ) );
184
+ wp_register_style( 'ui-fontsize.css', $fontsize );
185
+ // only enable styles when required by options
186
+ if ( get_option( 'wpa_toolbar_size' ) && get_option( 'wpa_toolbar' ) == 'on' ) {
187
+ echo "
188
+ <style type='text/css'>
189
+ .a11y-toolbar ul li button {
190
+ font-size: " . get_option( 'wpa_toolbar_size' ) . " !important;
191
}
192
+ </style>";
193
+ }
194
+ if ( get_option( 'wpa_longdesc' ) == 'link' || get_option( 'wpa_longdesc' ) == 'jquery' || get_option( 'asl_enable' ) == 'on' ) {
195
+ wp_enqueue_style( 'wpa-style' );
196
}
197
+ if ( get_option( 'wpa_toolbar' ) == 'on' || get_option( 'wpa_widget_toolbar' ) == 'on' && ( $toolbar && $fontsize ) ) {
198
+ wp_enqueue_style( 'ui-a11y.css' );
199
+ wp_enqueue_style( 'ui-fontsize.css' );
200
}
201
+ if ( current_user_can( 'edit_files' ) && get_option( 'wpa_diagnostics' ) == 'on' ) {
202
+ wp_register_style( 'diagnostic', plugins_url( 'css/diagnostic.css', __FILE__ ) );
203
+ wp_register_style( 'diagnostic-head', plugins_url( 'css/diagnostic-head.css', __FILE__ ) );
204
+ wp_enqueue_style( 'diagnostic' );
205
+ wp_enqueue_style( 'diagnostic-head' );
206
}
207
}
208
209
+ /**
210
+ * Enqueue admin stylesheets if enabled
211
+ */
212
+ add_action( 'admin_head', 'wpa_admin_stylesheet' );
213
+ function wpa_admin_stylesheet() {
214
+ // Used to provide an admin CSS from plug-in, now only enqueue if custom provided in theme.
215
+ if ( file_exists( get_stylesheet_directory() . '/wp-admin.css' ) ) {
216
+ $file = get_stylesheet_directory_uri() . '/wp-admin.css';
217
+ wp_register_style( 'wp-a11y-css', $file );
218
+ wp_enqueue_style( 'wp-a11y-css' );
219
}
220
+
221
+ if ( get_option( 'wpa_row_actions' ) == 'on' ) {
222
+ if ( file_exists( get_stylesheet_directory() . '/wp-admin-row-actions.css' ) ) {
223
+ $file = get_stylesheet_directory_uri() . '/wp-admin-row-actions.css';
224
+ } else {
225
+ $file = plugins_url( 'css/wp-admin-row-actions.css', __FILE__ );
226
+ }
227
+ wp_register_style( 'wp-row-actions', $file );
228
+ wp_enqueue_style( 'wp-row-actions' );
229
}
230
}
231
232
+ add_action( 'wp_head', 'wpa_css' );
233
function wpa_css() {
234
$styles = '';
235
if ( get_option( 'asl_enable' ) == 'on' ) {
275
return preg_match( '|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $url );
276
}
277
278
+ add_action( 'wp_footer', 'wpa_jquery_asl', 100 );
279
function wpa_jquery_asl() {
280
$skiplinks_js = $targets = $lang_js = $tabindex = $longdesc = false;
281
$visibility = ( get_option( 'asl_visible' ) == 'on' ) ? 'wpa-visible' : 'wpa-hide';
349
$admin_bar->add_node( $args );
350
}
351
352
add_filter( 'mce_css', 'wp_diagnostic_css' );
353
function wp_diagnostic_css( $mce_css ) {
354
if ( get_option( 'wpa_diagnostics' ) == 'on' ) {
564
}
565
}
566
567
if ( get_option( 'rta_from_tag_clouds' ) == 'on' ) {
568
add_filter( 'wp_tag_cloud', 'wpa_remove_title_attributes' );
569
}
570
571
function wpa_remove_title_attributes( $output ) {
572
$output = preg_replace( '/\s*title\s*=\s*(["\']).*?\1/', '', $output );
947
} else {
948
delete_post_meta( $post['ID'], '_no_alt' );
949
}
950
+
951
return $post;
952
}
953