HEX
Server: LiteSpeed
System: Linux s383.bitcommand.com 5.14.0-687.24.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jul 9 18:14:06 EDT 2026 x86_64
User: pclast (1605)
PHP: 8.1.34
Disabled: exec,system,passthru,shell_exec,escapeshellarg,escapeshellcmd,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/pclast/www/wp-content/plugins/zhaket-updater/includes/DependencyChecker.php
<?php

namespace ZhaketUpdater;

use ZhaketUpdater\AdminNotice\AdminNotice;
use ZhaketUpdater\AdminNotice\GenerateNotice;
use ZhaketUpdater\AdminNotice\Message;
use ZhaketUpdater\AdminNotice\NoticeLocation;
use ZhaketUpdater\AdminNotice\NotificationType;
use ZhaketUpdater\HelpersClass\SingleInstance;

final class DependencyChecker
{
    use SingleInstance;
    /**
     * @var true
     */
    private $phpHasError=true;
    /**
     * @var true
     */
    private $ioncubeHasError=true;


    public function __construct(){
        $this->checkDependency();
    }

    /**
     * @return true
     */
    public function ioncubeHasError()
    {
        return $this->ioncubeHasError;
    }

    /**
     * @return void
     */
    private function checkDependency(){
        $this->checkPhpVersion();
        $this->checkIonCubeStatus();
        $this->showNoticeHook();
    }

    /**
     * @return bool
     */
    public function canRunApplication()
    {
        return !$this->phpHasError && !$this->ioncubeHasError;
    }


    /**
     * @return void
     */
    private function showNoticeHook()
    {
        if ($this->ioncubeHasError){
            add_action('admin_notices',function (){
                echo (new GenerateNotice())->make($this->ionCubeErrorMessage());
            });

        }

        if ($this->phpHasError){
            add_action('admin_notices',function (){
                echo (new GenerateNotice())->make($this->phpErrorMessage());
            });
        }
    }

    /**
     * @return void
     */
    protected function checkPhpVersion(){
        $phpVersion=phpversion();
        if(version_compare( $phpVersion, '7.4', '>=') && version_compare( $phpVersion, '8.4', '<')) {
            $this->phpHasError = false;
        }
    }

    /**
     * @return void
     */
    protected function checkIonCubeStatus()
    {
        if (!extension_loaded('ionCube Loader')) return;

        $ioncubeLoaderVersion=ioncube_loader_version();

        if(function_exists('ioncube_loader_version') && version_compare($ioncubeLoaderVersion,'13.0','>='))
            $this->ioncubeHasError=false;
    }


    /**
     * @return array
     */
    public function ionCubeErrorMessage() {
        $content= esc_html__('we detect you do not have ionCube loader or it is too old , please call to your host service to update ionCube loader version to upper than 13.0','zhaket-updater');
        return [
            'title'=>esc_html__('Error in zhaket smart updater','zhaket-updater'),
            'title_color'=>'white',
            'content_color'=>'white',
            'bg_color'=>'#FF6437',
            'content'=>$content,
        ];
    }

    /**
     * @return array
     */
    public function phpErrorMessage(){
        $content = esc_html__('Zhaket updater plugin need php version 7.4 to 8.3.  please call to your host service to update php','zhaket-updater');
        return [
            'title'=>esc_html__('Error in zhaket smart updater','zhaket-updater'),
            'title_color'=>'white',
            'content_color'=>'white',
            'bg_color'=>'#FF6437',
            'content'=>$content,
        ];
    }
}