mirror of
https://gh.wpcy.net/https://github.com/elementor/one-click-accessibility.git
synced 2026-04-21 05:27:17 +08:00
* add: client functions * add: site register and site info endpoints * update: add plan data settings * update: add support for 201 response code * update: add plan data key * update: store the plan data on the once the site is registered * update: add filter for client url * add: retry registering in there is any error after connect * update: setting prefix * add: plan data * update: add account details to menu * fix: lint issues
42 lines
1,008 B
PHP
42 lines
1,008 B
PHP
<?php
|
|
namespace EA11y\Classes;
|
|
|
|
use EA11y\Classes\Services\Client;
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit; // Exit if accessed directly.
|
|
}
|
|
|
|
class Utils {
|
|
|
|
public static function get_api_client(): ?Client {
|
|
return Client::get_instance();
|
|
}
|
|
|
|
public static function is_plugin_page(): bool {
|
|
$current_screen = get_current_screen();
|
|
|
|
return str_contains( $current_screen->id, 'ea11y-' );
|
|
}
|
|
public static function user_is_admin(): bool {
|
|
return current_user_can( 'manage_options' );
|
|
}
|
|
public static function is_wp_dashboard_page(): bool {
|
|
$current_screen = get_current_screen();
|
|
|
|
return str_contains( $current_screen->id, 'dashboard' );
|
|
}
|
|
|
|
public static function is_wp_settings_page(): bool {
|
|
$current_screen = get_current_screen();
|
|
|
|
return str_contains( $current_screen->id, 'options-' );
|
|
}
|
|
|
|
public static function is_elementor_installed() :bool {
|
|
$file_path = 'elementor/elementor.php';
|
|
$installed_plugins = get_plugins();
|
|
return isset( $installed_plugins[ $file_path ] );
|
|
}
|
|
|
|
}
|