Skip to content

Commit 86a941c

Browse files
committed
Added: check for WordPress Playground
1 parent 3e7eb71 commit 86a941c

3 files changed

Lines changed: 59 additions & 3 deletions

File tree

README.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: equalizedigital, alh0319, stevejonesdev
33
Tags: accessibility, accessible, wcag, ada, WP accessibility, section 508, aoda, a11y, audit, readability, content analysis
44
Requires at least: 5.0.0
55
Tested up to: 6.3.1
6-
Stable tag: 1.6.1
6+
Stable tag: 1.6.2
77
License: GPLv2 or later
88
License URI: http://www.gnu.org/licenses/gpl-2.0.html
99

@@ -171,6 +171,9 @@ No, Accessibility Checker runs completely on your server and does not require yo
171171

172172
== Changelog ==
173173

174+
= 1.6.2 =
175+
Added: check for WordPress Playground
176+
174177
= 1.6.1 =
175178
Updated: passed percentage calculation
176179
Updated: frontend highlighting disable styles to be compatible with optimization plugins

accessibility-checker.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Plugin Name: Accessibility Checker
1111
* Plugin URI: https://a11ychecker.com
1212
* Description: Audit and check your website for accessibility before you hit publish. In-post accessibility scanner and guidance.
13-
* Version: 1.6.1
13+
* Version: 1.6.2
1414
* Author: Equalize Digital
1515
* Author URI: https://equalizedigital.com
1616
* License: GPL-2.0+
@@ -24,6 +24,13 @@
2424
die;
2525
}
2626

27+
// Check for WordPress Playground.
28+
require_once plugin_dir_path( __FILE__ ) . 'includes/classes/class-playground-check.php';
29+
$plugin_check = new EDAC\Playground_Check();
30+
if ( ! $plugin_check->should_load ) {
31+
return;
32+
}
33+
2734
// Include plugin dependency.
2835
require_once ABSPATH . 'wp-admin/includes/plugin.php';
2936

@@ -38,7 +45,7 @@
3845

3946
// Current plugin version.
4047
if ( ! defined( 'EDAC_VERSION' ) ) {
41-
define( 'EDAC_VERSION', '1.6.1' );
48+
define( 'EDAC_VERSION', '1.6.2' );
4249
}
4350

4451
// Current database version.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
/**
3+
* Class file for Plugin Check
4+
*
5+
* @package Accessibility_Checker
6+
*/
7+
8+
namespace EDAC;
9+
10+
class Playground_Check {
11+
12+
public $should_load = true;
13+
14+
/**
15+
* Initialize the class and set its properties.
16+
*/
17+
public function __construct() {
18+
$this->check_site_url_and_maybe_exit();
19+
}
20+
21+
/**
22+
* Check the site's URL and set the should_load property accordingly.
23+
*/
24+
private function check_site_url_and_maybe_exit() {
25+
$site_url = get_site_url();
26+
27+
if ( strpos( $site_url, 'playground.wordpress.net' ) !== false ) {
28+
// This is the playground site, show an admin notice.
29+
add_action( 'admin_notices', array( $this, 'show_playground_notice' ) );
30+
31+
// Set should_load to false.
32+
$this->should_load = false;
33+
}
34+
}
35+
36+
/**
37+
* Display an admin notice for the playground site.
38+
*/
39+
public function show_playground_notice() {
40+
?>
41+
<div class="notice notice-error">
42+
<p><?php esc_html_e( 'Unable to load live preview. WordPress Playground is not compatible with the Accessibility Checker Plugin.', 'accessibility-checker' ); ?></p>
43+
</div>
44+
<?php
45+
}
46+
}

0 commit comments

Comments
 (0)