' . esc_html__( 'Two copies of A11yMate are active. Deactivate one of them.', 'a11ymate' ) . '
';
}
);
return;
}
define( 'A11YMATE_VERSION', '1.0.0' );
define( 'A11YMATE_FILE', __FILE__ );
define( 'A11YMATE_DIR', plugin_dir_path( __FILE__ ) );
define( 'A11YMATE_URL', plugin_dir_url( __FILE__ ) );
if ( version_compare( PHP_VERSION, '8.2', '<' ) ) {
add_action(
'admin_notices',
static function () {
echo '' . esc_html__( 'A11yMate needs PHP 8.2 or newer.', 'a11ymate' ) . '
';
}
);
return;
}
/**
* Minimal PSR-4 style autoloader: A11yMate\Foo\Bar => includes/Foo/Bar.php (or Bar__premium_only.php).
*/
spl_autoload_register(
static function ( $class_name ) {
$prefix = 'A11yMate\\';
if ( 0 !== strpos( $class_name, $prefix ) ) {
return;
}
$relative = str_replace( '\\', '/', substr( $class_name, strlen( $prefix ) ) );
$file = A11YMATE_DIR . 'includes/' . $relative . '.php';
if ( is_readable( $file ) ) {
require_once $file;
return;
}
// Pro classes live in Name__premium_only.php (left out of the free build).
$file = A11YMATE_DIR . 'includes/' . $relative . '__premium_only.php';
if ( is_readable( $file ) ) {
require_once $file;
}
}
);
register_activation_hook( __FILE__, array( 'A11yMate\\Plugin', 'activate' ) );
register_deactivation_hook( __FILE__, array( 'A11yMate\\Plugin', 'deactivate' ) );
add_action(
'plugins_loaded',
static function () {
A11yMate\Plugin::instance()->boot();
}
);