| Server IP : 69.39.225.240 / Your IP : 216.73.216.138 Web Server : Apache System : Linux bronze7.serverhost.net 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64 User : reademotions ( 1074) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/reademotions/www/wp-content/plugins/wp-smushit/core/modules/ |
Upload File : |
<?php
/**
* Abstract module class: Abstract_Module
*
* @since 3.0
* @package Smush\Core\Modules
*/
namespace Smush\Core\Modules;
use Smush\Core\Settings;
use WP_Smush;
if ( ! defined( 'WPINC' ) ) {
die;
}
/**
* Class Abstract_Module
*
* @since 3.0
*/
abstract class Abstract_Module {
/**
* Module slug.
*
* @var string
*/
protected $slug;
/**
* Whether module is pro or not.
*
* @var string
*/
protected $is_pro = false;
/**
* Settings instance.
*
* @since 3.0
* @var Settings
*/
protected $settings;
/**
* Abstract_Module constructor.
*
* @since 3.0
*/
public function __construct() {
$this->settings = Settings::get_instance();
$this->init();
}
/**
* Initialize the module.
*
* Do not use __construct in modules, instead use init().
*
* @since 3.0
*/
protected function init() {}
/**
* Return true if the module is activated.
*
* @return boolean
*/
public function is_active() {
if ( $this->slug ) {
if ( ! $this->is_pro ) {
return (bool) $this->settings->get( $this->slug );
} else {
return WP_Smush::is_pro() && $this->settings->get( $this->slug );
}
}
return true;
}
/**
* Return module slug.
*
* @return string.
*/
public function get_slug() {
return $this->slug;
}
}