????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.216.55 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,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, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/www.astacus.se/wp-content/plugins/superfly-menu-R8UHIP/includes/ |
Upload File : |
<?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']);
}
}
/**
* Compare PHP versions
*
* @return bool
*/
public static function compatible_version()
{
if (version_compare(PHP_VERSION, self::$plugin['require_php']) == -1) {
self::$errors['php'] = sprintf(
__('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()
{
foreach (self::$plugin['require_ext'] as $ext) {
if (!extension_loaded($ext)) {
self::$errors[$ext] = sprintf(
__('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']);
}
}
}
}