-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added: check for WordPress Playground
- Loading branch information
1 parent
3e7eb71
commit 86a941c
Showing
3 changed files
with
59 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
/** | ||
* Class file for Plugin Check | ||
* | ||
* @package Accessibility_Checker | ||
*/ | ||
|
||
namespace EDAC; | ||
|
||
class Playground_Check { | ||
|
||
public $should_load = true; | ||
|
||
/** | ||
* Initialize the class and set its properties. | ||
*/ | ||
public function __construct() { | ||
$this->check_site_url_and_maybe_exit(); | ||
} | ||
|
||
/** | ||
* Check the site's URL and set the should_load property accordingly. | ||
*/ | ||
private function check_site_url_and_maybe_exit() { | ||
$site_url = get_site_url(); | ||
|
||
if ( strpos( $site_url, 'playground.wordpress.net' ) !== false ) { | ||
// This is the playground site, show an admin notice. | ||
add_action( 'admin_notices', array( $this, 'show_playground_notice' ) ); | ||
|
||
// Set should_load to false. | ||
$this->should_load = false; | ||
} | ||
} | ||
|
||
/** | ||
* Display an admin notice for the playground site. | ||
*/ | ||
public function show_playground_notice() { | ||
?> | ||
<div class="notice notice-error"> | ||
<p><?php esc_html_e( 'Unable to load live preview. WordPress Playground is not compatible with the Accessibility Checker Plugin.', 'accessibility-checker' ); ?></p> | ||
</div> | ||
<?php | ||
} | ||
} |