| @@ -1,198 +1,231 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Plugin Name: Bubble Menu | |
| 4 | - * Plugin URI: https://wordpress.org/plugin/bubble-menu | |
| 5 | - * Description: Creating awesome circle menu with icons. | |
| 6 | - * Version: 4.0.7 | |
| 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: bubble-menu | |
| 12 | - * Domain Path: /languages | |
| 13 | - * Item ID: 3778 | |
| 14 | - * Store URI: https://wow-estore.com/ | |
| 15 | - * Author Email: hey@wow-company.com | |
| 16 | - * Plugin Menu: Bubble Menu | |
| 17 | - * Rating URI: https://wordpress.org/support/plugin/bubble-menu/reviews/#new-post | |
| 18 | - * Support URI: https://wordpress.org/support/plugin/bubble-menu/ | |
| 19 | - * Item URI: https://wow-estore.com/item/bubble-menu/ | |
| 20 | - * Documentation: https://wow-estore.com/documentations/bubble-menu-lite/ | |
| 21 | - * Change URI: https://wordpress.org/plugins/bubble-menu/#developers | |
| 22 | - * Demo URI: https://demo.wow-estore.com/bubble-menu-pro/ | |
| 23 | - * | |
| 24 | - * PHP version 7.4 | |
| 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 | |
| 25 | 13 | * |
| 14 | + * PHP version 5.3.0 | |
| 15 | + * | |
| 26 | 16 | * @category Wordpress_Plugin |
| 27 | 17 | * @package Wow_Plugin |
| 28 | - * @author Dmytro Lobov <hey@wow-company.com>, Wow-Company | |
| 29 | - * @copyright 2024 Dmytro Lobov | |
| 30 | - * @license GPL-2.0+ | |
| 18 | + * @author Dmytro Lobov <i@wpbiker.com> | |
| 19 | + * @copyright 2019 Wow-Company | |
| 20 | + * @license GNU Public License | |
| 21 | + * @version 1.1 | |
| 31 | 22 | */ |
| 32 | 23 | |
| 33 | -namespace BubbleMenu; | |
| 24 | +// Required set the namespace for plugin. | |
| 25 | +namespace bubble_menu_lite; | |
| 34 | 26 | |
| 35 | -use BubbleMenu\Admin\DBManager; | |
| 36 | -use BubbleMenu\Update\UpdateDB; | |
| 27 | +if (!defined("ABSPATH")) { | |
| 28 | + exit(); | |
| 29 | +} | |
| 37 | 30 | |
| 38 | -defined( 'ABSPATH' ) || exit; | |
| 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; | |
| 39 | 40 | |
| 40 | -if ( ! class_exists( 'WOWP_Plugin' ) ) : | |
| 41 | + // Set the database name. | |
| 42 | + const PREF = "bmp"; | |
| 41 | 43 | |
| 42 | - final class WOWP_Plugin { | |
| 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 | + ]; | |
| 43 | 86 | |
| 44 | - // Plugin slug | |
| 45 | - public const SLUG = 'bubble-menu'; | |
| 87 | + self::$_instance = new Wow_Plugin(); | |
| 46 | 88 | |
| 47 | - // Plugin prefix | |
| 48 | - public const PREFIX = 'wow_bmp'; | |
| 89 | + register_activation_hook(__FILE__, [self::$_instance, "plugin_activate"]); | |
| 90 | + register_deactivation_hook(__FILE__, [self::$_instance, "plugin_deactivate"]); | |
| 49 | 91 | |
| 50 | - // Plugin Shortcode | |
| 51 | - public const SHORTCODE = 'Bubble-Menu'; | |
| 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"]); | |
| 52 | 95 | |
| 53 | - private static $instance; | |
| 96 | + self::$_instance->_includes(); | |
| 97 | + self::$_instance->admin = new Wow_Plugin_Admin($info); | |
| 98 | + self::$_instance->public = new Wow_Plugin_Public($info); | |
| 99 | + } | |
| 54 | 100 | |
| 55 | - private WOWP_Admin $admin; | |
| 56 | - private Autoloader $autoloader; | |
| 57 | - private WOWP_Public $public; | |
| 58 | - private WOWP_Plugin_Checker $check; | |
| 101 | + return self::$_instance; | |
| 102 | + } | |
| 59 | 103 | |
| 60 | - public static function instance(): WOWP_Plugin { | |
| 61 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof self ) ) { | |
| 62 | - self::$instance = new self; | |
| 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’ huh?", "bubble-menu"), "0.1"); | |
| 117 | + } | |
| 63 | 118 | |
| 64 | - self::$instance->includes(); | |
| 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’ huh?", "bubble-menu"), "0.1"); | |
| 130 | + } | |
| 65 | 131 | |
| 66 | - self::$instance->autoloader = new Autoloader( 'BubbleMenu' ); | |
| 67 | - self::$instance->admin = new WOWP_Admin(); | |
| 68 | - self::$instance->public = new WOWP_Public(); | |
| 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 | + } | |
| 69 | 144 | |
| 70 | - register_activation_hook( __FILE__, [ self::$instance, 'plugin_activate' ] ); | |
| 71 | - add_action( 'plugins_loaded', [ self::$instance, 'loaded' ] ); | |
| 72 | - } | |
| 145 | + include_once "includes/class-db.php"; | |
| 146 | + include_once "admin/class-admin.php"; | |
| 147 | + include_once "public/class-public.php"; | |
| 148 | + } | |
| 73 | 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 | + } | |
| 74 | 165 | |
| 75 | - return self::$instance; | |
| 76 | - } | |
| 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 | + } | |
| 77 | 177 | |
| 78 | - // Plugin Root File. | |
| 79 | - public static function file(): string { | |
| 80 | - return __FILE__; | |
| 81 | - } | |
| 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 | + } | |
| 82 | 195 | |
| 83 | - // Plugin Base Name. | |
| 84 | - public static function basename(): string { | |
| 85 | - return plugin_basename( __FILE__ ); | |
| 86 | - } | |
| 196 | + /* | |
| 197 | + * Update the plugin option to version 3.0 | |
| 198 | + */ | |
| 87 | 199 | |
| 88 | - // Plugin Folder Path. | |
| 89 | - public static function dir(): string { | |
| 90 | - return plugin_dir_path( __FILE__ ); | |
| 91 | - } | |
| 200 | + public function plugin_updater() | |
| 201 | + { | |
| 202 | + include "includes/plugin-updater.php"; | |
| 203 | + } | |
| 92 | 204 | |
| 93 | - // Plugin Folder URL. | |
| 94 | - public static function url(): string { | |
| 95 | - return plugin_dir_url( __FILE__ ); | |
| 96 | - } | |
| 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. | |
| 97 | 219 | |
| 98 | - // Get Plugin Info | |
| 99 | - public static function info( $show = '' ): string { | |
| 100 | - $data = [ | |
| 101 | - 'name' => 'Plugin Name', | |
| 102 | - 'version' => 'Version', | |
| 103 | - 'url' => 'Plugin URI', | |
| 104 | - 'author' => 'Author', | |
| 105 | - 'email' => 'Author Email', | |
| 106 | - 'store' => 'Store URI', | |
| 107 | - 'item_id' => 'Item ID', | |
| 108 | - 'menu_title' => 'Plugin Menu', | |
| 109 | - 'rating' => 'Rating URI', | |
| 110 | - 'support' => 'Support URI', | |
| 111 | - 'pro' => 'Item URI', | |
| 112 | - 'docs' => 'Documentation', | |
| 113 | - 'change' => 'Change URI', | |
| 114 | - 'demo' => 'Demo URI', | |
| 115 | - ]; | |
| 116 | - $plugin_data = get_file_data( __FILE__, $data, false ); | |
| 117 | - | |
| 118 | - return $plugin_data[ $show ] ?? ''; | |
| 119 | - } | |
| 120 | - | |
| 121 | - /** | |
| 122 | - * Include required files. | |
| 123 | - * | |
| 124 | - * @access private | |
| 125 | - * @since 1.0 | |
| 126 | - */ | |
| 127 | - private function includes(): void { | |
| 128 | - if ( ! class_exists( 'Wow_Company' ) ) { | |
| 129 | - require_once self::dir() . 'includes/class-wow-company.php'; | |
| 130 | - } | |
| 131 | - | |
| 132 | - require_once self::dir() . 'classes/Autoloader.php'; | |
| 133 | - require_once self::dir() . 'admin/class-wowp-admin.php'; | |
| 134 | - require_once self::dir() . 'public/class-wowp-public.php'; | |
| 135 | - } | |
| 136 | - | |
| 137 | - /** | |
| 138 | - * Throw error on object clone. | |
| 139 | - * The whole idea of the singleton design pattern is that there is a single | |
| 140 | - * object therefore, we don't want the object to be cloned. | |
| 141 | - * | |
| 142 | - * @return void | |
| 143 | - * @access protected | |
| 144 | - */ | |
| 145 | - public function __clone() { | |
| 146 | - // Cloning instances of the class is forbidden. | |
| 147 | - _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin’ huh?', 'bubble-menu' ), '1.0' ); | |
| 148 | - } | |
| 149 | - | |
| 150 | - /** | |
| 151 | - * Disable unserializing of the class. | |
| 152 | - * | |
| 153 | - * @return void | |
| 154 | - * @access protected | |
| 155 | - */ | |
| 156 | - public function __wakeup() { | |
| 157 | - // Unserializing instances of the class is forbidden. | |
| 158 | - _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin’ huh?', 'bubble-menu' ), '1.0' ); | |
| 159 | - } | |
| 160 | - | |
| 161 | - public function plugin_activate(): void { | |
| 162 | - | |
| 163 | - if ( is_plugin_active( 'bubble-menu-pro/bubble-menu-pro.php' ) ) { | |
| 164 | - deactivate_plugins( 'bubble-menu-pro/bubble-menu-pro.php' ); | |
| 165 | - } | |
| 166 | - | |
| 167 | - $columns = " | |
| 168 | - id mediumint(9) NOT NULL AUTO_INCREMENT, | |
| 169 | - title VARCHAR(200), | |
| 170 | - param longtext, | |
| 171 | - status boolean DEFAULT 0 NOT NULL, | |
| 172 | - mode boolean DEFAULT 0 NOT NULL, | |
| 173 | - tag text, | |
| 174 | - PRIMARY KEY (id) | |
| 175 | - "; | |
| 176 | - DBManager::create( $columns ); | |
| 177 | - } | |
| 178 | - | |
| 179 | - /** | |
| 180 | - * Download the folder with languages. | |
| 181 | - * | |
| 182 | - * @access Publisher | |
| 183 | - * @return void | |
| 184 | - */ | |
| 185 | - public function loaded(): void { | |
| 186 | - UpdateDB::init(); | |
| 187 | - $languages_folder = dirname( plugin_basename( __FILE__ ) ) . '/languages/'; | |
| 188 | - load_plugin_textdomain( 'bubble-menu', false, $languages_folder ); | |
| 189 | - } | |
| 190 | - } | |
| 191 | - | |
| 192 | -endif; | |
| 193 | - | |
| 194 | -function wp_plugin_run(): WOWP_Plugin { | |
| 195 | - return WOWP_Plugin::instance(); | |
| 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(); | |
| 196 | 228 | } |
| 197 | 229 | |
| 198 | -wp_plugin_run(); | |
| 230 | +// Get Running. | |
| 231 | +Wow_Plugin_run(); | |