PluginProbe ʕ •ᴥ•ʔ
reSmush.it : The original free image compressor and optimizer plugin / trunk
reSmush.it : The original free image compressor and optimizer plugin vtrunk
1.0.6 trunk 0.1.1 0.1.10 0.1.11 0.1.12 0.1.13 0.1.14 0.1.15 0.1.16 0.1.17 0.1.18 0.1.19 0.1.2 0.1.20 0.1.21 0.1.22 0.1.23 0.1.3 0.1.4 0.1.5 0.1.6 0.1.7 0.1.8 0.1.9 0.2.0 0.2.1 0.2.2 0.2.3 0.2.4 0.2.5 0.3.0 0.3.1 0.3.10 0.3.11 0.3.12 0.3.2 0.3.3 0.3.4 0.3.5 0.3.6 0.3.7 0.3.8 0.3.9 0.4.0 0.4.1 0.4.10 0.4.11 0.4.12 0.4.13 0.4.14 0.4.2 0.4.3 0.4.4 0.4.5 0.4.6 0.4.7 0.4.8 0.4.9 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5
resmushit-image-optimizer / classes / Plugin.php
resmushit-image-optimizer / classes Last commit date
Controller 2 weeks ago Helper 2 years ago Plugin.php 2 years ago plugin.json 2 years ago resmushit.class.php 2 weeks ago resmushitUI.class.php 1 month ago resmushitWPCLI.class.php 2 years ago
Plugin.php
82 lines
1 <?php
2 namespace Resmush;
3
4 use \Resmush\ShortPixelLogger\ShortPixelLogger as Log;
5
6 use \Resmush\Controller\AdminController as AdminController;
7 use \Resmush\Controller\AjaxController as AjaxController;
8 use \Resmush\Controller\CronController as CronController;
9 use \Resmush\Controller\ProcessController as ProcessController;
10
11
12 use Resmush\FileSystem\Controller\FileSystemController as FileSystem;
13
14
15
16 if (! defined('ABSPATH')) {
17 exit; // Exit if accessed directly.
18 }
19
20
21 // One day the basis of it all.
22 class Plugin
23 {
24
25 protected static $instance;
26
27 public function __construct()
28 {
29 // Regulare init after wp is loaded. This is fairly late.
30 add_action('wp_loaded', array($this, 'init'));
31 }
32
33 public static function getInstance()
34 {
35 if (is_null(self::$instance))
36 self::$instance = new Plugin();
37
38 return self::$instance;
39 }
40
41 public function init()
42 {
43 $this->initHooks();
44
45 // All hooks init
46 AjaxController::getInstance();
47 AdminController::getInstance();
48 CronController::getInstance();
49 ProcessController::getInstance();
50 }
51
52
53 public function initHooks()
54 {
55
56 }
57
58 public function fs()
59 {
60 return new FileSystem();
61 }
62
63 public function process()
64 {
65 return ProcessController::getInstance();
66 }
67
68 public static function checkLogger()
69 {
70 $log = Log::getInstance();
71 if (Log::debugIsActive()) // upload dir can be expensive, so only do this when log is actually active.
72 {
73 $uploaddir = wp_upload_dir(null, false, false);
74 if (isset($uploaddir['basedir']))
75 {
76 $log->setLogPath($uploaddir['basedir'] . "/resmushit.log");
77 }
78 }
79 }
80
81 }
82