PluginProbe
Bubble Menu – Floating Button Menu with Sticky Navigation / 3.1
Bubble Menu – Floating Button Menu with Sticky Navigation v3.1
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 3.1, at bubble-menu.php

188 lines 5.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: 3.1
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 Wow-Company <yoda@wow-company.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 private static $_instance;
39
40 // Set the database name.
41 const PREF = "bmp";
42
43 /**
44 * Main Wow_Plugin Instance.
45 *
46 * Insures that only one instance of Wow_Plugin exists in memory at any one
47 * time. Also prevents needing to define globals all over the place.
48 *
49 * @return object|Wow_Plugin The one true Wow_Plugin for Current plugin
50 *
51 * @uses Wow_Plugin::_includes() Include the required files.
52 * @uses Wow_Plugin::text_domain() load the language files.
53 * @since 1.0
54 * @static
55 * @staticvar array $instance
56 */
57 public static function instance() {
58 if ( ! isset( self::$_instance ) && ! ( self::$_instance instanceof Wow_Plugin ) ) {
59 $info = [
60 "plugin" => [
61 "name" => esc_attr__( "Bubble Menu", "bubble-menu" ), // Plugin name
62 "menu" => esc_attr__( "Bubble Menu", "bubble-menu" ), // Plugin name in menu
63 "author" => "Wow-Company", // Author
64 "prefix" => self::PREF, // Prefix for database
65 "text" => "bubble-menu", // Text domain for translate files
66 "version" => "3.1", // Current version of the plugin
67 "file" => __FILE__, // Main file of the plugin
68 "slug" => dirname( plugin_basename( __FILE__ ) ), // Name of the plugin folder
69 "url" => plugin_dir_url( __FILE__ ), // filesystem directory path for the plugin
70 "dir" => plugin_dir_path( __FILE__ ), // URL directory path for the plugin
71 "shortcode" => "Bubble-Menu",
72 ],
73 "url" => [
74 "author" => "https://wow-estore.com/",
75 "home" => "https://wordpress.org/plugins/bubble-menu",
76 "support" => "https://wordpress.org/support/plugin/bubble-menu/",
77 "facebook" => "https://www.facebook.com/wowaffect/",
78 ],
79 "rating" => [
80 "website" => esc_attr__( "WordPress.org", "bubble-menu" ), // Name site for rating plugin
81 "url" => "https://wordpress.org/support/plugin/bubble-menu/reviews/#new-post",
82 ],
83 ];
84
85 self::$_instance = new Wow_Plugin();
86
87 register_activation_hook( __FILE__, [ self::$_instance, "plugin_activate" ] );
88 add_action( "plugins_loaded", [ self::$_instance, "text_domain" ] );
89
90 self::$_instance->_includes();
91 self::$_instance->admin = new Wow_Plugin_Admin( $info );
92 self::$_instance->public = new Wow_Plugin_Public( $info );
93 }
94
95 return self::$_instance;
96 }
97
98 /**
99 * Throw error on object clone.
100 * The whole idea of the singleton design pattern is that there is a single
101 * object therefore, we don't want the object to be cloned.
102 *
103 * @return void
104 * @since 1.0
105 * @access protected
106 */
107 public function __clone() {
108 // Cloning instances of the class is forbidden.
109 _doing_it_wrong( __FUNCTION__, esc_attr__( "Cheatin&#8217; huh?", "bubble-menu" ), "0.1" );
110 }
111
112 /**
113 * Disable unserializing of the class.
114 *
115 * @return void
116 * @since 1.0
117 * @access protected
118 */
119 public function __wakeup() {
120 // Unserializing instances of the class is forbidden.
121 _doing_it_wrong( __FUNCTION__, esc_attr__( "Cheatin&#8217; huh?", "bubble-menu" ), "0.1" );
122 }
123
124 /**
125 * Include required files.
126 *
127 * @access private
128 * @return void
129 * @since 1.0
130 */
131 private function _includes() {
132 if ( ! class_exists( "Wow_Company" ) ) {
133 include_once "includes/class-wow-company.php";
134 }
135 include_once "admin/class-admin.php";
136 include_once "public/class-public.php";
137 }
138
139 /**
140 * Activate the plugin.
141 * create the database
142 * create the folder in wp-upload
143 *
144 * @access public
145 * @return void
146 * @since 1.0
147 */
148 public function plugin_activate() {
149 global $wpdb;
150 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
151 // Create the database for plugin
152 $table = $wpdb->prefix . 'wow_' . self::PREF;
153 $sql = "CREATE TABLE " . $table . " (
154 id mediumint(9) NOT NULL AUTO_INCREMENT,
155 title VARCHAR(200) NOT NULL,
156 param TEXT,
157 UNIQUE KEY id (id)
158 ) DEFAULT CHARSET=utf8;";
159 dbDelta( $sql );
160 deactivate_plugins( 'bubble-menu-pro/bubble-menu-pro.php' );
161 }
162
163 /**
164 * Download the folder with languages.
165 *
166 * @access public
167 * @return void
168 * @since 1.0
169 */
170 public function text_domain() {
171 $languages_folder = dirname( plugin_basename( __FILE__ ) ) . "/languages/";
172 load_plugin_textdomain( "bubble-menu", false, $languages_folder );
173 }
174 }
175 endif; // End if class_exists check.
176
177 /**
178 * The main function for that returns Wow_Plugin
179 *
180 * @since 1.0
181 */
182 function Wow_Plugin_run() {
183 return Wow_Plugin::instance();
184 }
185
186 // Get Running.
187 Wow_Plugin_run();
188