| @@ -1,127 +1,187 @@ | ||
| 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.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 | - */ | |
| 12 | - | |
| 13 | -namespace float_menu_free; | |
| 14 | - | |
| 15 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 16 | - exit; | |
| 17 | -} | |
| 18 | - | |
| 19 | - | |
| 20 | -if ( ! class_exists( 'Wow_Plugin_Class' ) ) { | |
| 21 | - | |
| 22 | - final class Wow_Plugin_Class { | |
| 23 | - | |
| 24 | - private static $instance; | |
| 25 | - | |
| 26 | - const PREF = 'fmp'; | |
| 27 | - | |
| 28 | - public static function instance() { | |
| 29 | - | |
| 30 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Wow_Plugin_Class ) ) { | |
| 31 | - | |
| 32 | - $info = array( | |
| 33 | - 'plugin_name' => 'Float Menu', | |
| 34 | - 'plugin_menu' => 'Float Menu', | |
| 35 | - 'plugin_home_url' => 'https://wordpress.org/plugins/float-menu/', | |
| 36 | - 'plugin_version' => '3.1', | |
| 37 | - 'plugin_file' => basename( __FILE__ ), | |
| 38 | - 'plugin_slug' => dirname( plugin_basename( __FILE__ ) ), | |
| 39 | - 'plugin_dir' => plugin_dir_path( __FILE__ ), | |
| 40 | - 'plugin_url' => plugin_dir_url( __FILE__ ), | |
| 41 | - 'plugin_pref' => self::PREF, | |
| 42 | - 'author_url' => 'https://wow-estore.com', | |
| 43 | - 'pro_url' => 'https://wow-estore.com/item/float-menu-pro/', | |
| 44 | - 'shortcode' => 'Float-Menu', | |
| 45 | - 'text_domain' => 'float-menu', | |
| 46 | - 'author' => 'Wow-Company', | |
| 47 | - ); | |
| 48 | - | |
| 49 | - self::$instance = new Wow_Plugin_Class; | |
| 50 | -// delete_option('wow_' . self::PREF .'_notice_action'); | |
| 51 | - | |
| 52 | - register_activation_hook( __FILE__, array( self::$instance, 'plugin_activate' ) ); | |
| 53 | - register_deactivation_hook( __FILE__, array( self::$instance, 'plugin_deactivate' ) ); | |
| 54 | - | |
| 55 | - add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) ); | |
| 56 | - add_action( 'admin_init', array( self::$instance, 'create_field' ) ); | |
| 57 | - | |
| 58 | - self::$instance->includes(); | |
| 59 | - self::$instance->admin = new Wow_Admin_Class( $info ); | |
| 60 | - self::$instance->public = new Wow_Public_Class( $info ); | |
| 61 | - | |
| 62 | - } | |
| 63 | - | |
| 64 | - return self::$instance; | |
| 65 | - } | |
| 66 | - | |
| 67 | - public function __clone() { | |
| 68 | - // Cloning instances of the class is forbidden. | |
| 69 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'float-menu' ), '3.0' ); | |
| 70 | - } | |
| 71 | - | |
| 72 | - public function __wakeup() { | |
| 73 | - // Unserializing instances of the class is forbidden. | |
| 74 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'float-menu' ), '3.0' ); | |
| 75 | - } | |
| 76 | - | |
| 77 | - | |
| 78 | - private function includes() { | |
| 79 | - if ( ! class_exists( 'Wow_Company' ) ) { | |
| 80 | - require_once plugin_dir_path( __FILE__ ) . 'includes/class-wow-company.php'; | |
| 81 | - } | |
| 82 | - require_once plugin_dir_path( __FILE__ ) . 'includes/class-js-packer.php'; | |
| 83 | - require_once plugin_dir_path( __FILE__ ) . 'includes/class-db-update.php'; | |
| 84 | - require_once plugin_dir_path( __FILE__ ) . 'admin/class-admin.php'; | |
| 85 | - require_once plugin_dir_path( __FILE__ ) . 'public/class-public.php'; | |
| 86 | - } | |
| 87 | - | |
| 88 | - public function plugin_activate() { | |
| 89 | - update_option('wow_' . self::PREF .'_notice_action', 'read'); | |
| 90 | - $upload = wp_upload_dir(); | |
| 91 | - $field = dirname( plugin_basename( __FILE__ ) ); | |
| 92 | - $basedir = $upload['basedir'] . '/' . $field . '/'; | |
| 93 | - if ( ! file_exists( $basedir ) ) { | |
| 94 | - wp_mkdir_p( $basedir ); | |
| 95 | - } | |
| 96 | - | |
| 97 | - require_once plugin_dir_path( __FILE__ ) . 'includes/activator.php'; | |
| 98 | - } | |
| 99 | - | |
| 100 | - public function plugin_deactivate() { | |
| 101 | - $upload = wp_upload_dir(); | |
| 102 | - $field = dirname( plugin_basename( __FILE__ ) ); | |
| 103 | - $basedir = $upload['basedir'] . '/' . $field . '/'; | |
| 104 | - require_once plugin_dir_path( __FILE__ ) . 'includes/deactivator.php'; | |
| 105 | - } | |
| 106 | - | |
| 107 | - public function create_field() { | |
| 108 | - $upload = wp_upload_dir(); | |
| 109 | - $field = dirname( plugin_basename( __FILE__ ) ); | |
| 110 | - $basedir = $upload['basedir'] . '/' . $field . '/'; | |
| 111 | - if ( ! file_exists( $basedir ) ) { | |
| 112 | - wp_mkdir_p( $basedir ); | |
| 113 | - } | |
| 114 | - } | |
| 115 | - | |
| 116 | - public function load_textdomain() { | |
| 117 | - load_plugin_textdomain( 'float-menu', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); | |
| 118 | - } | |
| 119 | - | |
| 120 | - } | |
| 121 | -} | |
| 122 | -function wow_plugin_run() { | |
| 123 | - return Wow_Plugin_Class::instance(); | |
| 124 | -} | |
| 125 | - | |
| 126 | -// Get Running. | |
| 127 | -wow_plugin_run(); | |
| 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: 4.3 | |
| 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 | +// Required set the namespace for plugin. | |
| 14 | +namespace float_menu_free; | |
| 15 | + | |
| 16 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 17 | + exit; | |
| 18 | +} | |
| 19 | + | |
| 20 | +if ( ! class_exists( 'Wow_Plugin' ) ) : | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * Main Wow_Plugin Class. | |
| 24 | + * | |
| 25 | + * @since 1.0 | |
| 26 | + */ | |
| 27 | + final class Wow_Plugin { | |
| 28 | + | |
| 29 | + private static $_instance; | |
| 30 | + | |
| 31 | + // Set the database name. | |
| 32 | + const PREF = 'fmp'; | |
| 33 | + | |
| 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() { | |
| 49 | + | |
| 50 | + if ( ! isset( self::$_instance ) && ! ( self::$_instance instanceof Wow_Plugin ) ) { | |
| 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 | + ); | |
| 81 | + | |
| 82 | + self::$_instance = new Wow_Plugin; | |
| 83 | + | |
| 84 | + register_activation_hook( __FILE__, array( self::$_instance, 'plugin_activate' ) ); | |
| 85 | + add_action( 'plugins_loaded', array( self::$_instance, 'text_domain' ) ); | |
| 86 | + | |
| 87 | + self::$_instance->_includes(); | |
| 88 | + self::$_instance->admin = new Wow_Plugin_Admin( $info ); | |
| 89 | + self::$_instance->public = new Wow_Plugin_Public( $info ); | |
| 90 | + } | |
| 91 | + | |
| 92 | + return self::$_instance; | |
| 93 | + } | |
| 94 | + | |
| 95 | + /** | |
| 96 | + * Throw error on object clone. | |
| 97 | + * The whole idea of the singleton design pattern is that there is a single | |
| 98 | + * object therefore, we don't want the object to be cloned. | |
| 99 | + * | |
| 100 | + * @return void | |
| 101 | + * @since 1.0 | |
| 102 | + * @access protected | |
| 103 | + */ | |
| 104 | + public function __clone() { | |
| 105 | + // Cloning instances of the class is forbidden. | |
| 106 | + _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin’ huh?', 'float-menu' ), '0.1' ); | |
| 107 | + } | |
| 108 | + | |
| 109 | + /** | |
| 110 | + * Disable unserializing of the class. | |
| 111 | + * | |
| 112 | + * @return void | |
| 113 | + * @since 1.0 | |
| 114 | + * @access protected | |
| 115 | + */ | |
| 116 | + public function __wakeup() { | |
| 117 | + // Unserializing instances of the class is forbidden. | |
| 118 | + _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin’ huh?', 'float-menu' ), '0.1' ); | |
| 119 | + } | |
| 120 | + | |
| 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'; | |
| 132 | + } | |
| 133 | + include_once 'admin/class-admin.php'; | |
| 134 | + include_once 'public/class-public.php'; | |
| 135 | + } | |
| 136 | + | |
| 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 ); | |
| 158 | + | |
| 159 | + deactivate_plugins( 'float-menu-pro/float-menu-pro.php' ); | |
| 160 | + } | |
| 161 | + | |
| 162 | + /** | |
| 163 | + * Download the folder with languages. | |
| 164 | + * | |
| 165 | + * @access public | |
| 166 | + * @return void | |
| 167 | + * @since 1.0 | |
| 168 | + */ | |
| 169 | + public function text_domain() { | |
| 170 | + $languages_folder = dirname( plugin_basename( __FILE__ ) ) . '/languages/'; | |
| 171 | + load_plugin_textdomain( 'float-menu', false, $languages_folder ); | |
| 172 | + } | |
| 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(); | |