HEX
Server: Apache/2.4.65 (Debian)
System: Linux web6 5.10.0-36-amd64 #1 SMP Debian 5.10.244-1 (2025-09-29) x86_64
User: innocamp (1028)
PHP: 7.4.33
Disabled: 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_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /home/innocamp/public_html/wp-content/plugins/superfly-menu/includes/Activator.php
<?php

class LA_Supefly_App_Activator
{
    protected static $plugin;
    protected static $errors = array();

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

    /**
     * Define static variables
     *
     * @param $plugin
     */
    protected function define_static_vars($plugin)
    {
        foreach ($plugin as $key => $value) {
            self::$plugin[$key] = $value;
        }
    }

    /**
     * Display error message after activation fail
     */
    public static function admin_message()
    {
        foreach (self::$errors as $k => $v){
            echo "<div class='error'> <p>{$v}</p></div>";
        }
    }

    /**
     * Activate plugin if PHP version compatible
     */
    public static function activate()
    {
        if (!self::compatible()) {
            add_action('admin_notices', 'LA_Supefly_App_Activator::admin_message');
            deactivate_plugins(self::$plugin['name']);
        } else {

            if( !get_option('sf_options') ) {
// todo maybe assign defaults here
            }

        }
    }

    /**
     * Compare PHP versions
     *
     * @return bool
     */
    public static function compatible_version()
    {
        if (version_compare(PHP_VERSION, self::$plugin['require_php']) == -1) {
            self::$errors['php'] = sprintf(
	            esc_html__('Plugin <b>%1$s</b> require PHP version %2$s or higher.'),
                self::$plugin['label'],
                self::$plugin['require_php']
            );
        }
    }

    /**
     * Check PHP extensions
     *
     * @return bool
     */
    public static function compatible_extensions()
    {
        if (!isset(self::$plugin['require_ext'])) return;
        foreach (self::$plugin['require_ext'] as $ext) {
            if (!extension_loaded($ext)) {
                self::$errors[$ext] = sprintf(
	                esc_html__('Plugin <b>%1$s</b> requires PHP %2$s extension enabled.'),
                    self::$plugin['label'],
                    strtoupper($ext)
                );
            }
        }
    }

    public static function compatible()
    {
        self::compatible_version();
        self::compatible_extensions();
        if(count(self::$errors) > 0){
            return false;
        }
        return true;
    }

    /**
     * If plugin already enabled in some way
     *
     * Check PHP version to prevent WP admin crash and deactivate plugin
     */
    public static function check()
    {
        if (!self::compatible()) {
            $plugin = self::$plugin['name'] . '/main.php';
            if (is_plugin_active($plugin)) {
                deactivate_plugins($plugin);
            }
            add_action('admin_notices', 'LA_Supefly_App_Activator::admin_message');
            if (isset($_GET['activate'])) {
                unset($_GET['activate']);
            }
        }
    }
}