PluginProbe
Disable Comments & Delete All Comments / 1.0.9
Disable Comments & Delete All Comments v1.0.9
1.3.3 1.3.2 trunk 1.0.0 1.0.4 1.0.5 1.0.8 1.0.9 1.1.1 1.1.3 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.3.0 1.3.1
comments-plus / includes / class.plugin.php

class.plugin.php in Disable Comments & Delete All Comments 1.0.9, at includes/class.plugin.php

133 lines 3.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Hide my wp core class
4 * @author Webcraftic <wordpress.webraftic@gmail.com>
5 * @copyright (c) 19.02.2018, Webcraftic
6 * @version 1.0
7 */
8
9 // Exit if accessed directly
10 if( !defined('ABSPATH') ) {
11 exit;
12 }
13
14 if( !class_exists('WCM_Plugin') ) {
15
16 if( !class_exists('WCM_PluginFactory') ) {
17 if( defined('LOADING_COMMENTS_PLUS_AS_ADDON') ) {
18 class WCM_PluginFactory {
19
20 }
21 } else {
22 class WCM_PluginFactory extends Wbcr_Factory400_Plugin {
23
24 }
25 }
26 }
27
28 class WCM_Plugin extends WCM_PluginFactory {
29
30 /**
31 * @var Wbcr_Factory400_Plugin
32 */
33 private static $app;
34
35 /**
36 * @var bool
37 */
38 private $as_addon;
39
40 /**
41 * @param string $plugin_path
42 * @param array $data
43 * @throws Exception
44 */
45 public function __construct($plugin_path, $data)
46 {
47 $this->as_addon = isset($data['as_addon']);
48
49 if( $this->as_addon ) {
50 $plugin_parent = isset($data['plugin_parent'])
51 ? $data['plugin_parent']
52 : null;
53
54 if( !($plugin_parent instanceof Wbcr_Factory400_Plugin) ) {
55 throw new Exception('An invalid instance of the class was passed.');
56 }
57
58 self::$app = $plugin_parent;
59 } else {
60 self::$app = $this;
61 }
62
63 if( !$this->as_addon ) {
64 parent::__construct($plugin_path, $data);
65 }
66
67 $this->setTextDomain();
68 $this->setModules();
69
70 $this->globalScripts();
71
72 if( is_admin() ) {
73 $this->adminScripts();
74 }
75 //add_action('plugins_loaded', array($this, 'pluginsLoaded'));
76 }
77
78 /**
79 * @return Wbcr_Factory400_Plugin
80 */
81 public static function app()
82 {
83 return self::$app;
84 }
85
86 protected function setTextDomain()
87 {
88 // Localization plugin
89 load_plugin_textdomain('comments-plus', false, dirname(WCM_PLUGIN_BASE) . '/languages/');
90 }
91
92 protected function setModules()
93 {
94 if( !$this->as_addon ) {
95 self::app()->load(array(
96 array('libs/factory/bootstrap', 'factory_bootstrap_400', 'admin'),
97 array('libs/factory/forms', 'factory_forms_400', 'admin'),
98 array('libs/factory/pages', 'factory_pages_401', 'admin'),
99 array('libs/factory/clearfy', 'factory_clearfy_200', 'all')
100 ));
101 }
102 }
103
104 private function registerPages()
105 {
106
107 $admin_path = WCM_PLUGIN_DIR . '/admin/pages';
108
109 self::app()->registerPage('WbcrCmp_CommentsPage', $admin_path . '/comments.php');
110 self::app()->registerPage('WbcrCmp_DeleteCommentsPage', $admin_path . '/delete-comments.php');
111
112 if( !$this->as_addon ) {
113 self::app()->registerPage('WbcrCmp_MoreFeaturesPage', $admin_path . '/more-features.php');
114 }
115 }
116
117 private function adminScripts()
118 {
119 require(WCM_PLUGIN_DIR . '/admin/boot.php');
120 $this->registerPages();
121 }
122
123 private function globalScripts()
124 {
125 require(WCM_PLUGIN_DIR . '/includes/classes/class.configurate-comments.php');
126 new WbcrCmp_ConfigComments(self::$app);
127 }
128 /*public function pluginsLoaded()
129 {
130
131 }*/
132 }
133 }