PluginProbe
Social Proof Popups & Real-Time Notifications – Herd Effects / 6.1
Social Proof Popups & Real-Time Notifications – Herd Effects v6.1
trunk 2.3 2.3.1 3.3.1 4.0.1 4.1 5.0.2 5.1.2 5.1.3 5.2 5.2.1 5.2.2 5.2.3 5.2.4 5.2.5 5.2.6 5.2.7 6.0 6.1 6.1.1 6.2 6.2.1 6.2.2 6.2.3 6.2.4 All 26 releases
mwp-herd-effect / mwp-herd-effect.php

mwp-herd-effect.php in Social Proof Popups & Real-Time Notifications – Herd Effects 6.1, at mwp-herd-effect.php

197 lines 5.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Herd Effects
4 * Plugin URI: https://wordpress.org/plugins/mwp-herd-effect/
5 * Description: Create and show fake notifications to motivate users to take action on your site!
6 * Version: 6.1
7 * Author: Wow-Company
8 * Author URI: https://wow-estore.com/
9 * License: GPL-2.0+
10 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
11 * Text Domain: mwp-herd-effect
12 * Domain Path: /languages
13 * Item ID: 18
14 * Store URI: https://wow-estore.com/
15 * Author Email: hey@wow-company.com
16 * Plugin Menu: Herd Effects
17 * Rating URI: https://wordpress.org/support/plugin/mwp-herd-effect/reviews/?filter=5#new-post
18 * Support URI: https://wordpress.org/support/plugin/mwp-herd-effect/
19 * Item URI: https://wow-estore.com/item/wow-herd-effects-pro/
20 * Documentation: https://wow-estore.com/documentations/wow-herd-effects-pro-documentation/
21 *
22 * PHP version 7.4
23 *
24 * @category Wordpress_Plugin
25 * @package Wow_Plugin
26 * @author Dmytro Lobov <hey@wow-company.com>, Wow-Company
27 * @copyright 2024 Dmytro Lobov
28 * @license GPL-2.0+
29 */
30
31 namespace HerdEffects;
32
33 use HerdEffects\Admin\DBManager;
34 use HerdEffects\Update\UpdateDB;
35
36 defined( 'ABSPATH' ) || exit;
37
38 if ( ! class_exists( 'WOWP_Plugin' ) ) :
39
40 final class WOWP_Plugin {
41
42 // Plugin slug
43 public const SLUG = 'mwp-herd-effect';
44
45 // Plugin prefix
46 public const PREFIX = 'wow_hep';
47
48 // Plugin Shortcode
49 public const SHORTCODE = 'Herd-Effects';
50
51 private static $instance;
52
53 private WOWP_Admin $admin;
54 private Autoloader $autoloader;
55 private WOWP_Public $public;
56 private WOWP_Plugin_Checker $check;
57
58 public static function instance(): WOWP_Plugin {
59 if ( ! isset( self::$instance ) && ! ( self::$instance instanceof self ) ) {
60 self::$instance = new self;
61
62 self::$instance->includes();
63
64 self::$instance->autoloader = new Autoloader( 'HerdEffects' );
65 self::$instance->admin = new WOWP_Admin();
66 self::$instance->public = new WOWP_Public();
67
68 register_activation_hook( __FILE__, [ self::$instance, 'plugin_activate' ] );
69 add_action( 'plugins_loaded', [ self::$instance, 'loaded' ] );
70 }
71
72
73 return self::$instance;
74 }
75
76 // Plugin Root File.
77 public static function file(): string {
78 return __FILE__;
79 }
80
81 // Plugin Base Name.
82 public static function basename(): string {
83 return plugin_basename( __FILE__ );
84 }
85
86 // Plugin Folder Path.
87 public static function dir(): string {
88 return plugin_dir_path( __FILE__ );
89 }
90
91 // Plugin Folder URL.
92 public static function url(): string {
93 return plugin_dir_url( __FILE__ );
94 }
95
96 // Get Plugin Info
97 public static function info( $show = '' ): string {
98 $data = [
99 'name' => 'Plugin Name',
100 'version' => 'Version',
101 'url' => 'Plugin URI',
102 'author' => 'Author',
103 'email' => 'Author Email',
104 'store' => 'Store URI',
105 'item_id' => 'Item ID',
106 'menu_title' => 'Plugin Menu',
107 'rating' => 'Rating URI',
108 'support' => 'Support URI',
109 'pro' => 'Item URI',
110 'docs' => 'Documentation',
111 ];
112 $plugin_data = get_file_data( __FILE__, $data, false );
113
114 return $plugin_data[ $show ] ?? '';
115 }
116
117 /**
118 * Include required files.
119 *
120 * @access private
121 * @since 1.0
122 */
123 private function includes(): void {
124 if ( ! class_exists( 'Wow_Company' ) ) {
125 require_once self::dir() . 'includes/class-wow-company.php';
126 }
127
128 require_once self::dir() . 'classes/Autoloader.php';
129 require_once self::dir() . 'admin/class-wowp-admin.php';
130 require_once self::dir() . 'public/class-wowp-public.php';
131 }
132
133 /**
134 * Throw error on object clone.
135 * The whole idea of the singleton design pattern is that there is a single
136 * object therefore, we don't want the object to be cloned.
137 *
138 * @return void
139 * @access protected
140 */
141 public function __clone() {
142 // Cloning instances of the class is forbidden.
143 _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin&#8217; huh?', 'mwp-herd-effect' ), '1.0' );
144 }
145
146 /**
147 * Disable unserializing of the class.
148 *
149 * @return void
150 * @access protected
151 */
152 public function __wakeup() {
153 // Unserializing instances of the class is forbidden.
154 _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin&#8217; huh?', 'mwp-herd-effect' ), '1.0' );
155 }
156
157 public function plugin_activate(): void {
158
159 if ( is_plugin_active( 'wow-herd-effects-pro/wow-herd-effects-pro.php' ) ) {
160 deactivate_plugins( 'wow-herd-effects-pro/wow-herd-effects-pro.php' );
161 }
162
163 $columns = "
164 id mediumint(9) NOT NULL AUTO_INCREMENT,
165 title VARCHAR(200) DEFAULT '' NOT NULL,
166 param longtext DEFAULT '' NOT NULL,
167 status boolean DEFAULT 0 NOT NULL,
168 mode boolean DEFAULT 0 NOT NULL,
169 tag text DEFAULT '' NOT NULL,
170 PRIMARY KEY (id)
171 ";
172 DBManager::create( $columns );
173 }
174
175 /**
176 * Download the folder with languages.
177 *
178 * @access Publisher
179 * @return void
180 */
181 public function loaded(): void {
182 UpdateDB::init();
183 $languages_folder = dirname( plugin_basename( __FILE__ ) ) . '/languages/';
184 load_plugin_textdomain( 'mwp-herd-effect', false, $languages_folder );
185 }
186 }
187
188 endif;
189
190 function wp_plugin_run(): WOWP_Plugin {
191 return WOWP_Plugin::instance();
192 }
193
194 wp_plugin_run();
195
196
197