PluginProbe
Premmerce / 1.1
Premmerce v1.1
trunk 1.0 1.1 1.2 1.2.1 1.3 1.3.10 1.3.11 1.3.12 1.3.13 1.3.14 1.3.15 1.3.16 1.3.17 1.3.18 1.3.19 1.3.2 1.3.20 1.3.21 1.3.22 1.3.23 1.3.3 1.3.4 1.3.5 1.3.6 All 28 releases
premmerce / src / PremmercePlugin.php

PremmercePlugin.php in Premmerce 1.1, at src/PremmercePlugin.php

85 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php namespace Premmerce\Premmerce;
2
3 use Premmerce\Premmerce\Admin\Admin;
4 use Premmerce\Premmerce\Api\WizardApi;
5 use Premmerce\Premmerce\WordpressSDK\FileManager\FileManager;
6 use Premmerce\Premmerce\WordpressSDK\Plugin\PluginInterface;
7
8 /**
9 * Class PremiumPlugin
10 *
11 * @package Premmerce\Premium
12 */
13 class PremmercePlugin implements PluginInterface{
14
15 const SLUG = 'premmerce';
16
17 const VERSION_OPTION = 'premmerce_version';
18
19 const IS_PREMIUM = true;
20
21 /**
22 * @var FileManager
23 */
24 private $fileManager;
25
26 /**
27 * @var string
28 */
29 private $version = '1.0';
30
31
32 /**
33 * PluginManager constructor.
34 *
35 * @param $mainFile
36 *
37 */
38 public function __construct($mainFile){
39 $this->fileManager = new FileManager($mainFile);
40
41 add_action('init', [$this, 'loadTextDomain']);
42 }
43
44 /**
45 * Run plugin part
46 */
47 public function run(){
48 if(is_admin()){
49 new Admin(new Container($this->fileManager));
50 }
51 }
52
53 /**
54 * Load plugin translations
55 */
56 public function loadTextDomain(){
57 $name = $this->fileManager->getPluginName();
58 load_plugin_textdomain('premmerce', false, $name . '/languages/');
59 }
60
61 /**
62 * Fired when the plugin is activated
63 */
64 public function activate(){
65 update_option(self::VERSION_OPTION, $this->version, true);
66 }
67
68 /**
69 * Fired when the plugin is deactivated
70 */
71 public function deactivate(){
72 }
73
74 /**
75 * Fired during plugin uninstall
76 */
77 public static function uninstall(){
78 delete_option(self::VERSION_OPTION);
79 delete_option(WizardApi::KEY_POSITIONS);
80 delete_option(WizardApi::KEY_STATES);
81 delete_option(WizardApi::KEY_SWITCHER_STATE);
82 }
83
84
85 }