PluginProbe
Float menu – awesome floating side menu / 6.1
Float menu – awesome floating side menu v6.1
7.2.5 trunk 2.1 2.2 3.0.1 3.1 3.2.2 3.3.1 3.5 3.5.1 3.5.2 3.5.3. 3.5.4 4.0 4.1 4.1.1 4.2 4.3 4.3.1 4.3.2 5.0 5.0.1 5.0.2 5.0.3 5.1 All 57 releases
← All changes | float-menu.php +132 -122 4.36.1 View file →
@@ -1,110 +1,149 @@
1 1 <?php
2 2 /**
3 3 * Plugin Name: Float Menu Lite
4 - * Plugin URI: https://wordpress.org/plugins/float-menu/
4 + * Plugin URI: https://wow-estore.com/item/float-menu-pro/
5 5 * Description: Easily create floating menus of varying complexity
6 - * Version: 4.3
6 + * Version: 6.1
7 7 * Author: Wow-Company
8 8 * Author URI: https://wow-estore.com
9 9 * License: GPL-2.0+
10 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 + *
11 30 */
12 31
13 -// Required set the namespace for plugin.
14 -namespace float_menu_free;
32 +namespace FloatMenuLite;
15 33
16 -if ( ! defined( 'ABSPATH' ) ) {
17 - exit;
18 -}
34 +use FloatMenuLite\Admin\DBManager;
35 +use FloatMenuLite\Update\UpdateDB;
19 36
20 -if ( ! class_exists( 'Wow_Plugin' ) ) :
37 +defined( 'ABSPATH' ) || exit;
21 38
22 - /**
23 - * Main Wow_Plugin Class.
24 - *
25 - * @since 1.0
26 - */
27 - final class Wow_Plugin {
39 +if ( ! class_exists( 'WOWP_Plugin' ) ) :
28 40
29 - private static $_instance;
41 + final class WOWP_Plugin {
30 42
31 - // Set the database name.
32 - const PREF = 'fmp';
43 + // Plugin slug
44 + public const SLUG = 'float-menu';
33 45
34 - /**
35 - * Main Wow_Plugin Instance.
36 - *
37 - * Insures that only one instance of Wow_Plugin exists in memory at any one
38 - * time. Also prevents needing to define globals all over the place.
39 - *
40 - * @return object|Wow_Plugin The one true Wow_Plugin for Current plugin
41 - *
42 - * @uses Wow_Plugin::_includes() Include the required files.
43 - * @uses Wow_Plugin::text_domain() load the language files.
44 - * @since 1.0
45 - * @static
46 - * @staticvar array $instance
47 - */
48 - public static function instance() {
46 + // Plugin prefix
47 + public const PREFIX = 'wow_fmp';
49 48
50 - if ( ! isset( self::$_instance ) && ! ( self::$_instance instanceof Wow_Plugin ) ) {
49 + // Plugin Shortcode
50 + public const SHORTCODE = 'Float-Menu';
51 51
52 - $info = array(
53 - 'plugin' => array(
54 - 'name' => esc_attr( 'Float Menu Lite' ), // Plugin name
55 - 'menu' => esc_attr( 'Float Menu Lite' ), // Plugin name in menu
56 - 'author' => 'Wow-Company', // Author
57 - 'prefix' => self::PREF, // Prefix for database
58 - 'text' => 'float-menu', // Text domain for translate files
59 - 'version' => '4.3', // Current version of the plugin
60 - 'file' => __FILE__, // Main file of the plugin
61 - 'slug' => dirname( plugin_basename( __FILE__ ) ), // Name of the plugin folder
62 - 'url' => plugin_dir_url( __FILE__ ), // filesystem directory path for the plugin
63 - 'dir' => plugin_dir_path( __FILE__ ), // URL directory path for the plugin
64 - 'shortcode' => 'Float-Menu',
65 - ),
66 - 'url' => array(
67 - 'author' => 'https://wow-estore.com/',
68 - 'home' => 'https://wordpress.org/plugins/float-menu/',
69 - 'support' => 'https://wordpress.org/support/plugin/float-menu/',
70 - 'pro' => 'https://wow-estore.com/item/float-menu-pro/',
71 - 'facebook' => 'https://www.facebook.com/wowaffect/',
72 - ),
73 - 'rating' => array(
74 - 'website' => esc_attr__( 'WordPress.org' ), // Name site for rating plugin
75 - 'url' => 'https://wordpress.org/support/plugin/float-menu/reviews/#new-post',
76 - 'wp_url' => 'https://wordpress.org/support/plugin/float-menu/reviews/#new-post',
77 - 'wp_home' => 'https://wordpress.org/plugins/float-menu/',
78 - 'wp_title' => 'Float menu – awesome floating side menu',
79 - ),
80 - );
52 + private static $instance;
81 53
82 - self::$_instance = new Wow_Plugin;
54 + private WOWP_Admin $admin;
55 + private Autoloader $autoloader;
56 + private WOWP_Public $public;
57 + private WOWP_Plugin_Checker $check;
83 58
84 - register_activation_hook( __FILE__, array( self::$_instance, 'plugin_activate' ) );
85 - add_action( 'plugins_loaded', array( self::$_instance, 'text_domain' ) );
59 + public static function instance(): WOWP_Plugin {
60 + if ( ! isset( self::$instance ) && ! ( self::$instance instanceof self ) ) {
61 + self::$instance = new self;
86 62
87 - self::$_instance->_includes();
88 - self::$_instance->admin = new Wow_Plugin_Admin( $info );
89 - self::$_instance->public = new Wow_Plugin_Public( $info );
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' ] );
90 71 }
91 72
92 - return self::$_instance;
73 +
74 + return self::$instance;
93 75 }
94 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 +
95 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 + /**
96 136 * Throw error on object clone.
97 137 * The whole idea of the singleton design pattern is that there is a single
98 138 * object therefore, we don't want the object to be cloned.
99 139 *
100 140 * @return void
101 - * @since 1.0
102 141 * @access protected
103 142 */
104 143 public function __clone() {
105 144 // Cloning instances of the class is forbidden.
106 - _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin&#8217; huh?', 'float-menu' ), '0.1' );
145 + _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin&#8217; huh?', 'float-menu' ), '1.0' );
107 146 }
108 147
109 148 /**
110 149 * Disable unserializing of the class.
@@ -109,79 +148,50 @@
109 148 /**
110 149 * Disable unserializing of the class.
111 150 *
112 151 * @return void
113 - * @since 1.0
114 152 * @access protected
115 153 */
116 154 public function __wakeup() {
117 155 // Unserializing instances of the class is forbidden.
118 - _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin&#8217; huh?', 'float-menu' ), '0.1' );
156 + _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin&#8217; huh?', 'float-menu' ), '1.0' );
119 157 }
120 158
121 -
122 - /**
123 - * Include required files.
124 - *
125 - * @access private
126 - * @return void
127 - * @since 1.0
128 - */
129 - private function _includes() {
130 - if ( ! class_exists( 'Wow_Company' ) ) {
131 - include_once 'includes/class-wow-company.php';
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' );
132 162 }
133 - include_once 'admin/class-admin.php';
134 - include_once 'public/class-public.php';
135 - }
136 163
137 - /**
138 - * Activate the plugin.
139 - * create the database
140 - * create the folder in wp-upload
141 - *
142 - * @access public
143 - * @return void
144 - * @since 1.0
145 - */
146 - public function plugin_activate() {
147 - update_option( 'wow_' . self::PREF . '_notice_action', 'read' );
148 - global $wpdb;
149 - require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
150 - $table = $wpdb->prefix . 'wow_' . self::PREF;
151 - $sql = "CREATE TABLE " . $table . " (
152 - id mediumint(9) NOT NULL AUTO_INCREMENT,
153 - title VARCHAR(200) NOT NULL,
154 - param TEXT,
155 - UNIQUE KEY id (id)
156 - ) DEFAULT CHARSET=utf8;";
157 - dbDelta( $sql );
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 );
158 174
159 - deactivate_plugins( 'float-menu-pro/float-menu-pro.php' );
175 + update_site_option( self::PREFIX . '_db_version', '6.0' );
160 176 }
161 177
162 178 /**
163 179 * Download the folder with languages.
164 180 *
165 - * @access public
181 + * @access Publisher
166 182 * @return void
167 - * @since 1.0
168 183 */
169 - public function text_domain() {
184 + public function loaded(): void {
185 + UpdateDB::init();
170 186 $languages_folder = dirname( plugin_basename( __FILE__ ) ) . '/languages/';
171 187 load_plugin_textdomain( 'float-menu', false, $languages_folder );
172 188 }
173 189 }
174 190
175 -endif; // End if class_exists check.
191 +endif;
176 192
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();
193 +function wp_plugin_run(): WOWP_Plugin {
194 + return WOWP_Plugin::instance();
184 195 }
185 196
186 -// Get Running.
187 -Wow_Plugin_run();
197 +wp_plugin_run();