Plugin Directory

source: wp-accessibility/trunk/wp-accessibility-settings.php

Last change on this file was 3464593, checked in by joedolson, 5 weeks ago

Add 2.3.2, change stable.

https://github.com/joedolson/wp-accessibility/releases/tag/v2.3.2

File size: 34.2 KB
Line 
, 'wp-accessibility' ); ?>
411                                                        </p>
412                                                </div>
413                                                <p>
414                                                        <a href="https://joedolson.com/donate/"><?php _e( 'Donate to WP Accessibility', 'wp-accessibility' ); ?></a>
415                                                </p>
416                                                <ul class="wpa-flex wpa-social">
417                                                        <li><a href="https://toot.io/@joedolson">
418                                                                <svg aria-hidden="true" width="24" height="24" viewBox="0 0 61 65" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M60.7539 14.3904C59.8143 7.40642 53.7273 1.90257 46.5117 0.836066C45.2943 0.655854 40.6819 0 29.9973 0H29.9175C19.2299 0 16.937 0.655854 15.7196 0.836066C8.70488 1.87302 2.29885 6.81852 0.744617 13.8852C-0.00294988 17.3654 -0.0827298 21.2237 0.0561464 24.7629C0.254119 29.8384 0.292531 34.905 0.753482 39.9598C1.07215 43.3175 1.62806 46.6484 2.41704 49.9276C3.89445 55.9839 9.87499 61.0239 15.7344 63.0801C22.0077 65.2244 28.7542 65.5804 35.2184 64.1082C35.9295 63.9428 36.6318 63.7508 37.3252 63.5321C38.8971 63.0329 40.738 62.4745 42.0913 61.4937C42.1099 61.4799 42.1251 61.4621 42.1358 61.4417C42.1466 61.4212 42.1526 61.3986 42.1534 61.3755V56.4773C42.153 56.4557 42.1479 56.4345 42.1383 56.4151C42.1287 56.3958 42.1149 56.3788 42.0979 56.3655C42.0809 56.3522 42.0611 56.3429 42.04 56.3382C42.019 56.3335 41.9971 56.3336 41.9761 56.3384C37.8345 57.3276 33.5905 57.8234 29.3324 57.8156C22.0045 57.8156 20.0336 54.3384 19.4693 52.8908C19.0156 51.6397 18.7275 50.3346 18.6124 49.0088C18.6112 48.9866 18.6153 48.9643 18.6243 48.9439C18.6333 48.9236 18.647 48.9056 18.6643 48.8915C18.6816 48.8774 18.7019 48.8675 18.7237 48.8628C18.7455 48.858 18.7681 48.8585 18.7897 48.8641C22.8622 49.8465 27.037 50.3423 31.2265 50.3412C32.234 50.3412 33.2387 50.3412 34.2463 50.3146C38.4598 50.1964 42.9009 49.9808 47.0465 49.1713C47.1499 49.1506 47.2534 49.1329 47.342 49.1063C53.881 47.8507 60.1038 43.9097 60.7362 33.9301C60.7598 33.5372 60.8189 29.8148 60.8189 29.4071C60.8218 28.0215 61.2651 19.5781 60.7539 14.3904Z" fill="url(#paint0_linear_89_8)"/><path d="M50.3943 22.237V39.5876H43.5185V22.7481C43.5185 19.2029 42.0411 17.3949 39.036 17.3949C35.7325 17.3949 34.0778 19.5338 34.0778 23.7585V32.9759H27.2434V23.7585C27.2434 19.5338 25.5857 17.3949 22.2822 17.3949C19.2949 17.3949 17.8027 19.2029 17.8027 22.7481V39.5876H10.9298V22.237C10.9298 18.6918 11.835 15.8754 13.6453 13.7877C15.5128 11.7049 17.9623 10.6355 21.0028 10.6355C24.522 10.6355 27.1813 11.9885 28.9542 14.6917L30.665 17.5633L32.3788 14.6917C34.1517 11.9885 36.811 10.6355 40.3243 10.6355C43.3619 10.6355 45.8114 11.7049 47.6847 13.7877C49.4931 15.8734 50.3963 18.6899 50.3943 22.237Z" fill="white"/><defs><linearGradient id="paint0_linear_89_8" x1="30.5" y1="0" x2="30.5" y2="65" gradientUnits="userSpaceOnUse"><stop stop-color="#6364FF"/><stop offset="1" stop-color="#563ACC"/></linearGradient></defs></svg>
419                                                                <span class="screen-reader-text">Mastodon</span></a>
420                                                        </li>
421                                                        <li><a href="https://bsky.app/profile/joedolson.bsky.social">
422                                                                <svg width="24" height="24" viewBox="0 0 568 501" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M123.121 33.6637C188.241 82.5526 258.281 181.681 284 234.873C309.719 181.681 379.759 82.5526 444.879 33.6637C491.866 -1.61183 568 -28.9064 568 57.9464C568 75.2916 558.055 203.659 552.222 224.501C531.947 296.954 458.067 315.434 392.347 304.249C507.222 323.8 536.444 388.56 473.333 453.32C353.473 576.312 301.061 422.461 287.631 383.039C285.169 375.812 284.017 372.431 284 375.306C283.983 372.431 282.831 375.812 280.369 383.039C266.939 422.461 214.527 576.312 94.6667 453.32C31.5556 388.56 60.7778 323.8 175.653 304.249C109.933 315.434 36.0535 296.954 15.7778 224.501C9.94525 203.659 0 75.2916 0 57.9464C0 -28.9064 76.1345 -1.61183 123.121 33.6637Z" fill="#1185fe"/></svg>
423                                                                <span class="screen-reader-text">Bluesky</span></a>
424                                                        </li>
425                                                        <li><a href="https://linkedin.com/in/joedolson">
426                                                                <svg aria-hidden="true" height="24" viewBox="0 0 72 72" width="24" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><path d="M8,72 L64,72 C68.418278,72 72,68.418278 72,64 L72,8 C72,3.581722 68.418278,-8.11624501e-16 64,0 L8,0 C3.581722,8.11624501e-16 -5.41083001e-16,3.581722 0,8 L0,64 C5.41083001e-16,68.418278 3.581722,72 8,72 Z" fill="#007EBB"/><path d="M62,62 L51.315625,62 L51.315625,43.8021149 C51.315625,38.8127542 49.4197917,36.0245323 45.4707031,36.0245323 C41.1746094,36.0245323 38.9300781,38.9261103 38.9300781,43.8021149 L38.9300781,62 L28.6333333,62 L28.6333333,27.3333333 L38.9300781,27.3333333 L38.9300781,32.0029283 C38.9300781,32.0029283 42.0260417,26.2742151 49.3825521,26.2742151 C56.7356771,26.2742151 62,30.7644705 62,40.051212 L62,62 Z M16.349349,22.7940133 C12.8420573,22.7940133 10,19.9296567 10,16.3970067 C10,12.8643566 12.8420573,10 16.349349,10 C19.8566406,10 22.6970052,12.8643566 22.6970052,16.3970067 C22.6970052,19.9296567 19.8566406,22.7940133 16.349349,22.7940133 Z M11.0325521,62 L21.769401,62 L21.769401,27.3333333 L11.0325521,27.3333333 L11.0325521,62 Z" fill="#FFF"/></g></svg>
427                                                                <span class="screen-reader-text">LinkedIn</span></a>
428                                                        </li>
429                                                        <li><a href="https://github.com/joedolson">
430                                                                <svg aria-hidden="true" width="24" height="24" viewBox="0 0 1024 1024" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8C0 11.54 2.29 14.53 5.47 15.59C5.87 15.66 6.02 15.42 6.02 15.21C6.02 15.02 6.01 14.39 6.01 13.72C4 14.09 3.48 13.23 3.32 12.78C3.23 12.55 2.84 11.84 2.5 11.65C2.22 11.5 1.82 11.13 2.49 11.12C3.12 11.11 3.57 11.7 3.72 11.94C4.44 13.15 5.59 12.81 6.05 12.6C6.12 12.08 6.33 11.73 6.56 11.53C4.78 11.33 2.92 10.64 2.92 7.58C2.92 6.71 3.23 5.99 3.74 5.43C3.66 5.23 3.38 4.41 3.82 3.31C3.82 3.31 4.49 3.1 6.02 4.13C6.66 3.95 7.34 3.86 8.02 3.86C8.7 3.86 9.38 3.95 10.02 4.13C11.55 3.09 12.22 3.31 12.22 3.31C12.66 4.41 12.38 5.23 12.3 5.43C12.81 5.99 13.12 6.7 13.12 7.58C13.12 10.65 11.25 11.33 9.47 11.53C9.76 11.78 10.01 12.26 10.01 13.01C10.01 14.08 10 14.94 10 15.21C10 15.42 10.15 15.67 10.55 15.59C13.71 14.53 16 11.53 16 8C16 3.58 12.42 0 8 0Z" transform="scale(64)" fill="#1B1F23"/></svg>
431                                                                <span class="screen-reader-text">GitHub</span></a>
432                                                        </li>
433                                                </ul>
434                                        </div>
435                                </div>
436                                <?php wpa_edac_promotion(); ?>
437                                <?php wpa_linkedin_promotion(); ?>
438
439                                <div class="postbox">
440                                        <h2 class='hndle'><?php _e( 'Accessibility References', 'wp-accessibility' ); ?></h2>
441
442                                        <div class="inside">
443                                                <ul>
444                                                        <li><a href="https://docs.joedolson.com/wp-accessibility/">Plugin Documentation</a></li>
445                                                        <li><a href="http://make.wordpress.org/accessibility/">Make WordPress: Accessibility</a></li>
446                                                        <li><a href="https://make.wordpress.org/themes/handbook/review/accessibility/">WordPress Theme Accessibility Guidelines</a></li>
447                                                        <li><a href="https://www.joedolson.com/tools/color-contrast.php">Color Contrast Testing</a></li>
448                                                        <li><a href="http://wave.webaim.org/">WAVE: Web accessibility evaluation tool</a></li>
449                                                </ul>
450                                        </div>
451                                </div>
452
453                        <?php if ( wpa_accessible_theme() ) { ?>
454                                <div class="postbox">
455                                        <h2 class='hndle'><?php _e( 'Your Theme', 'wp-accessibility' ); ?></h2>
456
457                                        <div class="inside">
458                                                <p>
459                                                <?php _e( "You're using a theme reviewed as <code>accessibility-ready</code> by the WordPress theme review team. Some options have been disabled in WP Accessibility.", 'wp-accessibility' ); ?>
460                                                </p>
461                                                <p>
462                                                <?php
463                                                // Translators: URL to read about the accessibility ready tag requirements.
464                                                printf( __( 'Read more about the <a href="%s">WordPress accessibility-ready tag</a>', 'wp-accessibility' ), 'https://make.wordpress.org/themes/handbook/review/accessibility/' );
465                                                ?>
466                                                </p>
467                                        </div>
468                                </div>
469                        <?php } ?>
470
471                        </div>
472                </div>
473        </div>
474        <?php
475}
476
477/**
478 * Show LinkedIn WordPress Accessibility promotion.
479 */
480function wpa_linkedin_promotion() {
481        // translators: link to linkedin learning course page.
482        $promo_text = sprintf( __( 'Want to learn more about WordPress and Accessibility? Take my <a href="%s">WordPress Accessibility course at LinkedIn Learning</a>!', 'wp-accessibility' ), 'https://www.linkedin.com/learning/wordpress-accessibility-22376834/making-accessible-websites-using-wordpress' );
483        ?>
484        <div class="postbox linkedin-course-promotion promotion">
485                <h2 class='hndle'><?php _e( 'Learn more about WordPress Accessibility', 'wp-accessibility' ); ?></h2>
486
487                <div class="inside">
488                        <div class="wpa-flex">
489                                <img src="<?php echo plugins_url( 'imgs/linkedin.png', __FILE__ ); ?>" alt="LinkedIn" />
490                                <p class="small">
491                                        <?php echo wp_kses_post( $promo_text ); ?>
492                                </p>
493                        </div>
494                        <p class="wpa-affiliate">
495                                <a href="https://www.linkedin.com/learning/wordpress-accessibility-22376834/making-accessible-websites-using-wordpress"><?php _e( 'Try the Course', 'wp-accessibility' ); ?></a>
496                        </p>
497                </div>
498        </div>
499        <?php
500}
501
502/**
503 * Show Equalize Digital Accessibility Checker promotion.
504 *
505 * @param string $type Promo size.
506 */
507function wpa_edac_promotion( $type = 'large' ) {
508        $pro  = false;
509        $edac = false;
510        if ( defined( 'EDAC_VERSION' ) ) {
511                $pro  = is_plugin_active( 'accessibility-checker-pro/accessibility-checker-pro.php' );
512                $edac = true;
513        }
514        if ( ! $pro ) {
515                if ( 'large' === $type ) {
516                        $promo_text = ( $edac ) ? __( 'Finding Accessibility Checker useful? Go Pro for more advanced accessibility testing options!', 'wp-accessibility' ) : __( 'Try Accessibility Checker by Equalize Digital - fast and efficient accessibility testing for your site!', 'wp-accessibility' );
517                        ?>
518                <div class="postbox equalize-digital-promotion promotion">
519                        <h2 class='hndle'><?php _e( 'Ready to fix your site?', 'wp-accessibility' ); ?></h2>
520
521                        <div class="inside">
522                                <div class="wpa-flex">
523                                        <img src="<?php echo plugins_url( 'imgs/Equalize-Digital-Accessibility-Emblem-400x400-1.png', __FILE__ ); ?>" alt="Accessibility Checker" />
524                                        <p class="small">
525                                                <?php echo esc_html( $promo_text ); ?>
526                                        </p>
527                                </div>
528                                <p class="coupon small"><strong><?php _e( 'Use coupon code <code>WPAccessibility</code> for 20% off!', 'wp-accessibility' ); ?></strong></p>
529                                <p class="wpa-affiliate">
530                                        <a href="https://equalizedigital.com/accessibility-checker/pricing/?ref=joedolson&discount=WPAccessibility&campaign=wpaccessibility" aria-describedby="wpa-affiliate-notice"><?php _e( 'Get Accessibility Checker', 'wp-accessibility' ); ?></a>
531                                </p>
532                                <p class="wpa-affiliate-notice" id="wpa-affiliate-notice">
533                                        (<?php _e( 'Affiliate Link', 'wp-accessibility' ); ?>)
534                                </p>
535                        </div>
536                </div>
537                        <?php
538                } else {
539                        ?>
540                <div class="wpad-small-promotion">
541                        <h3>Need help fixing accessibility issues?</h3>
542                        <p class="coupon small"><?php _e( 'Use coupon code <code>WPAccessibility</code> for 20% off <strong>Accessibility Checker Pro</strong> at <a href="https://equalizedigital.com/?ref=joedolson&discount=WPAccessibility&campaign=wpaccessibility" aria-describedby="wpa-affiliate-notice">Equalize Digital</a>!', 'wp-accessibility' ); ?></p>
543                        <div class="wpa-flex">
544                                <p class="wpa-affiliate">
545                                        <a href="https://equalizedigital.com/accessibility-checker/pricing/?ref=joedolson&discount=WPAccessibility&campaign=wpaccessibility" aria-describedby="wpa-affiliate-notice"><?php _e( 'Buy Accessibility Checker', 'wp-accessibility' ); ?></a>
546                                </p>
547                                <p class="wpa-affiliate-notice" id="wpa-affiliate-notice">
548                                        <em><?php _e( 'Affiliate Links', 'wp-accessibility' ); ?></em>
549                                </p>
550                        </div>
551                </div>
552                        <?php
553                }
554        }
555}
556
557// Use Codemirror for Skiplink style fields.
558add_action(
559        'admin_enqueue_scripts',
560        function () {
561                if ( ! function_exists( 'wp_enqueue_code_editor' ) ) {
562                        return;
563                }
564                if ( 'toplevel_page_wp-accessibility' !== get_current_screen()->id ) {
565                        return;
566                }
567
568                // Enqueue code editor and settings for manipulating CSS.
569                $settings = wp_enqueue_code_editor(
570                        array(
571                                'type'       => 'text/css',
572                                'codemirror' => array(
573                                        'autoRefresh' => true,
574                                ),
575                        )
576                );
577
578                // Bail if user disabled CodeMirror or using default styles.
579                if ( false === $settings || 'true' === get_option( 'asl_default_styles' ) ) {
580                        return;
581                }
582                wp_add_inline_script(
583                        'code-editor',
584                        sprintf(
585                                'jQuery( function() { wp.codeEditor.initialize( "asl_styles", %s ); } );',
586                                wp_json_encode( $settings )
587                        )
588                );
589        }
590);
Note: See TracBrowser for help on using the repository browser.