one-click-accessibility/classes/utils.php
Nirbhay Singh 00a0db3742
[APP-835] add service data (#122)
* 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
2024-12-16 15:32:32 +05:30

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 ] );
}
}