PluginProbe
Popup Box – Easily Create WordPress Popups / 3.2.4
Popup Box – Easily Create WordPress Popups v3.2.4
2.1.1 2.1.2 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 3.0 3.0.1 3.1 3.2 3.2.1 3.2.10 3.2.11 3.2.12 3.2.13 3.2.14 3.2.15 3.2.2 3.2.3 3.2.4 3.2.5 All 37 releases
popup-box / popup-box.php

popup-box.php in Popup Box – Easily Create WordPress Popups 3.2.4, at popup-box.php

196 lines 5.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Popup Box
4 * Plugin URI: https://wordpress.org/plugin/popup-box/
5 * Description: The most powerful creator of popups & flyouts
6 * Version: 3.2.4
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: popup-box
12 * Domain Path: /languages
13 * Item ID: 40434
14 * Store URI: https://wow-estore.com/
15 * Author Email: hey@wow-company.com
16 * Plugin Menu: Popup Box
17 * Rating URI: https://wordpress.org/support/plugin/popup-box/reviews/#new-post
18 * Support URI: https://wordpress.org/support/plugin/popup-box/
19 * Item URI: https://wow-estore.com/item/popup-box-pro/
20 * Documentation: https://wow-estore.com/documentations/popup-box-documentation/
21 * Change URI: https://wordpress.org/plugins/popup-box/#developers
22 *
23 * PHP version 7.4
24 *
25 * @category Wordpress_Plugin
26 * @package Wow_Plugin
27 * @author Dmytro Lobov <dev@wow-company.com>, Wow-Company
28 * @copyright 2024 Dmytro Lobov
29 * @license GPL-2.0+
30 */
31
32 namespace PopupBox;
33
34 use PopupBox\Admin\DBManager;
35 use PopupBox\Update\UpdateDB;
36
37 defined( 'ABSPATH' ) || exit;
38
39 if ( ! class_exists( 'WOWP_Plugin' ) ) :
40
41 final class WOWP_Plugin {
42
43 // Plugin slug
44 public const SLUG = 'popup-box';
45
46 // Plugin prefix
47 public const PREFIX = 'popup_box';
48
49 // Plugin Shortcode
50 public const SHORTCODE = 'Popup-Box';
51
52 private static $instance;
53
54 private WOWP_Admin $admin;
55 private Autoloader $autoloader;
56 private WOWP_Public $public;
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( 'PopupBox' );
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 'change' => 'Change URI',
112 ];
113 $plugin_data = get_file_data( __FILE__, $data, false );
114
115 return $plugin_data[ $show ] ?? '';
116 }
117
118 /**
119 * Include required files.
120 *
121 * @access private
122 * @since 1.0
123 */
124 private function includes(): void {
125 if ( ! class_exists( 'Wow_Company' ) ) {
126 require_once self::dir() . 'includes/class-wow-company.php';
127 }
128
129 require_once self::dir() . 'classes/Autoloader.php';
130 require_once self::dir() . 'admin/class-wowp-admin.php';
131 require_once self::dir() . 'public/class-wowp-public.php';
132 }
133
134 /**
135 * Throw error on object clone.
136 * The whole idea of the singleton design pattern is that there is a single
137 * object therefore, we don't want the object to be cloned.
138 *
139 * @return void
140 * @access protected
141 */
142 public function __clone() {
143 // Cloning instances of the class is forbidden.
144 _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin&#8217; huh?', 'popup-box' ), '1.0' );
145 }
146
147 /**
148 * Disable unserializing of the class.
149 *
150 * @return void
151 * @access protected
152 */
153 public function __wakeup() {
154 // Unserializing instances of the class is forbidden.
155 _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin&#8217; huh?', 'popup-box' ), '1.0' );
156 }
157
158 public function plugin_activate(): void {
159
160 if ( is_plugin_active( 'popup-box-pro/popup-box-pro.php' ) ) {
161 deactivate_plugins( 'popup-box-pro/popup-box-pro.php' );
162 }
163
164 $columns = "
165 id mediumint(9) NOT NULL AUTO_INCREMENT,
166 title VARCHAR(200) DEFAULT '' NOT NULL,
167 param LONGTEXT NOT NULL,
168 status BOOLEAN DEFAULT 0 NOT NULL,
169 mode BOOLEAN DEFAULT 0 NOT NULL,
170 tag TEXT NOT NULL,
171 PRIMARY KEY (id)
172 ";
173 DBManager::create( $columns );
174 }
175
176 /**
177 * Download the folder with languages.
178 *
179 * @access Publisher
180 * @return void
181 */
182 public function loaded(): void {
183 UpdateDB::init();
184 $languages_folder = dirname( plugin_basename( __FILE__ ) ) . '/languages/';
185 load_plugin_textdomain( 'popup-box', false, $languages_folder );
186 }
187 }
188
189 endif;
190
191 function wp_plugin_run(): WOWP_Plugin {
192 return WOWP_Plugin::instance();
193 }
194
195 wp_plugin_run();
196