PluginProbe
Premmerce / 1.3.12
Premmerce v1.3.12
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.3.12, at src/PremmercePlugin.php

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