SILENT KILLERPanel

Current Path: > home > codekrsu > > cuddlebuds.lk > wp-content > plugins > image-optimization > > > classes


Operation   : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software     : Apache
Server IP    : 162.0.232.56 | Your IP: 216.73.216.111
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: /home/codekrsu//cuddlebuds.lk/wp-content/plugins/image-optimization///classes

NameTypeSizeLast ModifiedActions
async-operation Directory - -
client Directory - -
exceptions Directory - -
file-system Directory - -
image Directory - -
migration Directory - -
rest Directory - -
basic-enum.php File 699 bytes February 06 2024 19:05:42.
error_log File 250 bytes June 22 2025 18:29:39.
file-utils.php File 2592 bytes February 06 2024 19:05:42.
locale.php File 577 bytes February 06 2024 19:05:42.
logger.php File 877 bytes February 06 2024 19:05:42.
module-base.php File 7270 bytes March 05 2024 17:32:40.
route.php File 11330 bytes February 06 2024 19:05:42.
utils.php File 3207 bytes October 01 2024 15:04:24.

Reading File: /home/codekrsu//cuddlebuds.lk/wp-content/plugins/image-optimization///classes/utils.php

<?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' );
	}
}

SILENT KILLER Tool