aria-accessibility-toolkit
Last commit date
assets
1 month ago
frontend
1 month ago
includes
1 month ago
aria-accessibility-toolkit.php
1 month ago
index.php
1 month ago
readme.txt
1 month ago
aria-accessibility-toolkit.php
135 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Plugin Name: Web Accessibility Toolkit - ARIA Labels & Roles for WCAG & ADA Compliance |
| 4 | * Description: Scan your site for accessibility issues and apply fixes to help comply with Web Content Accessibility Guidelines. |
| 5 | * Author: WCAGforWP |
| 6 | * Author URI: https://wcagforwp.com |
| 7 | * Version: 1.6.5 |
| 8 | * Text Domain: aria-accessibility-toolkit |
| 9 | * License: GPL2 or later |
| 10 | */ |
| 11 | |
| 12 | // Exit if accessed directly. |
| 13 | if ( ! defined( 'ABSPATH' ) ) exit; |
| 14 | |
| 15 | |
| 16 | final class ARIAAT_Main { |
| 17 | |
| 18 | /** |
| 19 | * @var The one true instance |
| 20 | * @since 1.0.0 |
| 21 | */ |
| 22 | protected static $_instance = null; |
| 23 | |
| 24 | public $version = '1.6.5'; |
| 25 | |
| 26 | /** |
| 27 | * Main Instance. |
| 28 | */ |
| 29 | public static function instance() { |
| 30 | if ( is_null( self::$_instance ) ) { |
| 31 | self::$_instance = new self(); |
| 32 | } |
| 33 | return self::$_instance; |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * Throw error on object clone. |
| 38 | * |
| 39 | * @since 1.0.0 |
| 40 | * @access protected |
| 41 | * @return void |
| 42 | */ |
| 43 | public function __clone() { |
| 44 | _doing_it_wrong( __FUNCTION__, 'Cheatin’ huh?', '1.0.0' ); |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Disable unserializing of the class. |
| 49 | * @since 1.0.0 |
| 50 | */ |
| 51 | public function __wakeup() { |
| 52 | _doing_it_wrong( __FUNCTION__, 'Cheatin’ huh?', '1.0.0' ); |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * |
| 57 | * @since 1.0.0 |
| 58 | */ |
| 59 | public function __construct() { |
| 60 | $this->define_constants(); |
| 61 | $this->hooks(); |
| 62 | $this->includes(); |
| 63 | |
| 64 | do_action( 'ariaat_loaded' ); |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Define Constants. |
| 69 | * @since 1.0.0 |
| 70 | */ |
| 71 | private function define_constants() { |
| 72 | $this->define( 'ARIAATDIR',plugin_dir_path( __FILE__ ) ); |
| 73 | $this->define( 'ARIAATURL',plugin_dir_url( __FILE__ ) ); |
| 74 | $this->define( 'ARIAATBASENAME', plugin_basename( __FILE__ ) ); |
| 75 | $this->define( 'ARIAATVERSION', $this->version ); |
| 76 | //$this->define( 'ARIAATVERSION', time() ); |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * Define hooks. |
| 81 | * @since 1.0.0 |
| 82 | */ |
| 83 | private function hooks() { |
| 84 | $plugin_file = ARIAATBASENAME; |
| 85 | add_filter( "plugin_action_links_{$plugin_file}", array( $this, 'plugin_action_links' ), 10, 4 ); |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * Define constant if not already set. |
| 90 | * @since 1.0.0 |
| 91 | */ |
| 92 | private function define( $name, $value ) { |
| 93 | if ( ! defined( $name ) ) { |
| 94 | define( $name, $value ); |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | /** |
| 99 | * Include required files. |
| 100 | * @since 1.0.0 |
| 101 | */ |
| 102 | public function includes() { |
| 103 | include_once ( ARIAATDIR . 'includes/class-admin.php' ); |
| 104 | include_once ( ARIAATDIR . 'includes/class-menu-aria-labels.php' ); |
| 105 | include_once ( ARIAATDIR . 'frontend/class-frontend.php' ); |
| 106 | include_once ( ARIAATDIR . 'frontend/class-frontend-checker.php' ); |
| 107 | include_once ( ARIAATDIR . 'includes/class-review-notice.php' ); |
| 108 | } |
| 109 | |
| 110 | /** |
| 111 | * Adds items to the plugin's action links on the Plugins listing screen. |
| 112 | * |
| 113 | * @param array<string,string> $actions Array of action links. |
| 114 | * @param string $plugin_file Path to the plugin file relative to the plugins directory. |
| 115 | * @param mixed[] $plugin_data An array of plugin data. |
| 116 | * @param string $context The plugin context. |
| 117 | * @return array<string,string> Array of action links. |
| 118 | */ |
| 119 | function plugin_action_links( $actions, $plugin_file, $plugin_data, $context ) { |
| 120 | $new = array( |
| 121 | 'settings' => sprintf( |
| 122 | '<a href="%s">%s</a>', |
| 123 | esc_url( admin_url( 'admin.php?page=ariaat&tab=general' ) ), |
| 124 | esc_html__( 'Settings', 'aria-accessibility-toolkit' ) |
| 125 | ), |
| 126 | ); |
| 127 | |
| 128 | return array_merge( $new, $actions ); |
| 129 | } |
| 130 | |
| 131 | |
| 132 | } |
| 133 | |
| 134 | new ARIAAT_Main(); |
| 135 |