PluginProbe
Bubble Menu – Floating Button Menu with Sticky Navigation / 2.2
Bubble Menu – Floating Button Menu with Sticky Navigation v2.2
trunk 1.3 2.0 2.2 2.2.1 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.1 3.1.1 4.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.1 4.1.1
bubble-menu / bubble-menu.php

bubble-menu.php in Bubble Menu – Floating Button Menu with Sticky Navigation 2.2, at bubble-menu.php

232 lines 6.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Bubble Menu Lite
4 * Plugin URI: https://wordpress.org/plugins/bubble-menu
5 * Description: Creating awesome circle menu with icons.
6 * Version: 2.2
7 * Author: Wow-Company
8 * Author URI: https://wow-estore.com/
9 * License: GPL-2.0+
10 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
11 * Text Domain: bubble-menu
12 * Domain Path: /languages
13 *
14 * PHP version 5.3.0
15 *
16 * @category Wordpress_Plugin
17 * @package Wow_Plugin
18 * @author Dmytro Lobov <i@wpbiker.com>
19 * @copyright 2019 Wow-Company
20 * @license GNU Public License
21 * @version 1.1
22 */
23
24 // Required set the namespace for plugin.
25 namespace bubble_menu_lite;
26
27 if (!defined("ABSPATH")) {
28 exit();
29 }
30
31 if (!class_exists("Wow_Plugin")):
32 /**
33 * Main Wow_Plugin Class.
34 *
35 * @since 1.0
36 */
37 final class Wow_Plugin
38 {
39 private static $_instance;
40
41 // Set the database name.
42 const PREF = "bmp";
43
44 /**
45 * Main Wow_Plugin Instance.
46 *
47 * Insures that only one instance of Wow_Plugin exists in memory at any one
48 * time. Also prevents needing to define globals all over the place.
49 *
50 * @return object|Wow_Plugin The one true Wow_Plugin for Current plugin
51 *
52 * @uses Wow_Plugin::_includes() Include the required files.
53 * @uses Wow_Plugin::text_domain() load the language files.
54 * @since 1.0
55 * @static
56 * @staticvar array $instance
57 */
58 public static function instance()
59 {
60 if (!isset(self::$_instance) && !(self::$_instance instanceof Wow_Plugin)) {
61 $info = [
62 "plugin" => [
63 "name" => esc_attr__("Bubble Menu", "bubble-menu"), // Plugin name
64 "menu" => esc_attr__("Bubble Menu", "bubble-menu"), // Plugin name in menu
65 "author" => "Wow-Company", // Author
66 "prefix" => self::PREF, // Prefix for database
67 "text" => "bubble-menu", // Text domain for translate files
68 "version" => "2.2", // Current version of the plugin
69 "file" => __FILE__, // Main file of the plugin
70 "slug" => dirname(plugin_basename(__FILE__)), // Name of the plugin folder
71 "url" => plugin_dir_url(__FILE__), // filesystem directory path for the plugin
72 "dir" => plugin_dir_path(__FILE__), // URL directory path for the plugin
73 "shortcode" => "Bubble-Menu",
74 ],
75 "url" => [
76 "author" => "https://wow-estore.com/",
77 "home" => "https://wordpress.org/plugins/bubble-menu",
78 "support" => "https://wordpress.org/support/plugin/bubble-menu/",
79 "facebook" => "https://www.facebook.com/wowaffect/",
80 ],
81 "rating" => [
82 "website" => esc_attr__("Wow-Estore", "bubble-menu"), // Name site for rating plugin
83 "url" => "https://wordpress.org/support/plugin/bubble-menu/reviews/#new-post",
84 ],
85 ];
86
87 self::$_instance = new Wow_Plugin();
88
89 register_activation_hook(__FILE__, [self::$_instance, "plugin_activate"]);
90 register_deactivation_hook(__FILE__, [self::$_instance, "plugin_deactivate"]);
91
92 add_action("plugins_loaded", [self::$_instance, "text_domain"]);
93 add_action("admin_init", [self::$_instance, "create_field"]);
94 add_action("admin_init", [self::$_instance, "plugin_updater"]);
95
96 self::$_instance->_includes();
97 self::$_instance->admin = new Wow_Plugin_Admin($info);
98 self::$_instance->public = new Wow_Plugin_Public($info);
99 }
100
101 return self::$_instance;
102 }
103
104 /**
105 * Throw error on object clone.
106 * The whole idea of the singleton design pattern is that there is a single
107 * object therefore, we don't want the object to be cloned.
108 *
109 * @return void
110 * @since 1.0
111 * @access protected
112 */
113 public function __clone()
114 {
115 // Cloning instances of the class is forbidden.
116 _doing_it_wrong(__FUNCTION__, esc_attr__("Cheatin&#8217; huh?", "bubble-menu"), "0.1");
117 }
118
119 /**
120 * Disable unserializing of the class.
121 *
122 * @return void
123 * @since 1.0
124 * @access protected
125 */
126 public function __wakeup()
127 {
128 // Unserializing instances of the class is forbidden.
129 _doing_it_wrong(__FUNCTION__, esc_attr__("Cheatin&#8217; huh?", "bubble-menu"), "0.1");
130 }
131
132 /**
133 * Include required files.
134 *
135 * @access private
136 * @return void
137 * @since 1.0
138 */
139 private function _includes()
140 {
141 if (!class_exists("Wow_Company")) {
142 include_once "includes/class-wow-company.php";
143 }
144
145 include_once "includes/class-db.php";
146 include_once "admin/class-admin.php";
147 include_once "public/class-public.php";
148 }
149
150 /**
151 * Activate the plugin.
152 * create the database
153 * create the folder in wp-upload
154 *
155 * @access public
156 * @return void
157 * @since 1.0
158 */
159 public function plugin_activate()
160 {
161 update_option("wow_" . self::PREF . "_notice_action", "read");
162 self::create_field();
163 include_once "includes/plugin-activation.php";
164 }
165
166 /**
167 * Deactivate the plugin.
168 * delete the plugin folder and files from wp-upload
169 *
170 * @access public
171 * @since 1.0
172 */
173 public function plugin_deactivate()
174 {
175 include_once "includes/plugin-deactivation.php";
176 }
177
178 /**
179 * Create the plugin field in wp-upload.
180 * Create the folder when the plugin update
181 *
182 * @access public
183 * @return void
184 * @since 1.0
185 */
186 public function create_field()
187 {
188 $upload = wp_upload_dir();
189 $field = dirname(plugin_basename(__FILE__));
190 $basedir = $upload["basedir"] . "/" . $field . "/";
191 if (!file_exists($basedir)) {
192 wp_mkdir_p($basedir);
193 }
194 }
195
196 /*
197 * Update the plugin option to version 3.0
198 */
199
200 public function plugin_updater()
201 {
202 include "includes/plugin-updater.php";
203 }
204
205 /**
206 * Download the folder with languages.
207 *
208 * @access public
209 * @return void
210 * @since 1.0
211 */
212 public function text_domain()
213 {
214 $languages_folder = dirname(plugin_basename(__FILE__)) . "/languages/";
215 load_plugin_textdomain("bubble-menu", false, $languages_folder);
216 }
217 }
218 endif; // End if class_exists check.
219
220 /**
221 * The main function for that returns Wow_Plugin
222 *
223 * @since 1.0
224 */
225 function Wow_Plugin_run()
226 {
227 return Wow_Plugin::instance();
228 }
229
230 // Get Running.
231 Wow_Plugin_run();
232