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