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