| @@ -2,9 +2,9 @@ | ||
| 2 | 2 | /** |
| 3 | 3 | * Plugin Name: Floating Button Lite |
| 4 | 4 | * Plugin URI: https://wordpress.org/plugins/floating-button/ |
| 5 | 5 | * Description: Easily create a floating button |
| 6 | - * Version: 5.1 | |
| 6 | + * Version: 3.0 | |
| 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 |
| @@ -14,9 +14,9 @@ | ||
| 14 | 14 | * PHP version 5.3.0 |
| 15 | 15 | * |
| 16 | 16 | * @category Wordpress_Plugin |
| 17 | 17 | * @package Wow_Plugin |
| 18 | - * @author Wow-Company <helper@wow-company.com> | |
| 18 | + * @author Dmytro Lobov <i@wpbiker.com> | |
| 19 | 19 | * @copyright 2019 Wow-Company |
| 20 | 20 | * @license GNU Public License |
| 21 | 21 | * @version 1.1 |
| 22 | 22 | */ |
| @@ -53,9 +53,9 @@ | ||
| 53 | 53 | 'menu' => esc_attr__( 'Floating Button Lite', 'floating-button' ), // Plugin name in menu |
| 54 | 54 | 'author' => 'Wow-Company', // Author |
| 55 | 55 | 'prefix' => self::PREF, // Prefix for database |
| 56 | 56 | 'text' => 'floating-button', // Text domain for translate files |
| 57 | - 'version' => '5.1', // Current version of the plugin | |
| 57 | + 'version' => '3.0', // Current version of the plugin | |
| 58 | 58 | 'file' => __FILE__, // Main file of the plugin |
| 59 | 59 | 'slug' => dirname( plugin_basename( __FILE__ ) ), // Name of the plugin folder |
| 60 | 60 | 'url' => plugin_dir_url( __FILE__ ), // filesystem directory path for the plugin |
| 61 | 61 | 'dir' => plugin_dir_path( __FILE__ ), // URL directory path for the plugin |
| @@ -69,13 +69,10 @@ | ||
| 69 | 69 | 'pro' => 'https://wow-estore.com/item/floating-button-pro/', |
| 70 | 70 | 'facebook' => 'https://www.facebook.com/wowaffect/', |
| 71 | 71 | ), |
| 72 | 72 | 'rating' => array( |
| 73 | - 'website' => esc_attr__( 'WordPress.org', 'floating-button' ), // Name site for rating plugin | |
| 74 | - 'url' => 'https://wordpress.org/support/plugin/floating-button/reviews/#new-post', | |
| 75 | - 'wp_url' => 'https://wordpress.org/support/plugin/floating-button/reviews/#new-post', | |
| 76 | - 'wp_home' => 'https://wordpress.org/plugins/floating-button/', | |
| 77 | - 'wp_title' => 'Floating Button', | |
| 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', | |
| 78 | 75 | ), |
| 79 | 76 | ); |
| 80 | 77 | |
| 81 | 78 | self::$_instance = new Wow_Plugin; |
| @@ -80,9 +77,12 @@ | ||
| 80 | 77 | |
| 81 | 78 | self::$_instance = new Wow_Plugin; |
| 82 | 79 | |
| 83 | 80 | register_activation_hook( __FILE__, array( self::$_instance, 'plugin_activate' ) ); |
| 81 | + register_deactivation_hook( __FILE__, array( self::$_instance, 'plugin_deactivate' ) ); | |
| 82 | + | |
| 84 | 83 | add_action( 'plugins_loaded', array( self::$_instance, 'text_domain' ) ); |
| 84 | + add_action( 'admin_init', array( self::$_instance, 'create_field' ) ); | |
| 85 | 85 | |
| 86 | 86 | self::$_instance->_includes(); |
| 87 | 87 | self::$_instance->admin = new Wow_Plugin_Admin( $info ); |
| 88 | 88 | self::$_instance->public = new Wow_Plugin_Public( $info ); |
| @@ -128,8 +128,10 @@ | ||
| 128 | 128 | private function _includes() { |
| 129 | 129 | if ( ! class_exists( 'Wow_Company' ) ) { |
| 130 | 130 | include_once 'includes/class-wow-company.php'; |
| 131 | 131 | } |
| 132 | + | |
| 133 | + include_once 'includes/class-db.php'; | |
| 132 | 134 | include_once 'admin/class-admin.php'; |
| 133 | 135 | include_once 'public/class-public.php'; |
| 134 | 136 | } |
| 135 | 137 | |
| @@ -143,21 +145,39 @@ | ||
| 143 | 145 | * @since 1.0 |
| 144 | 146 | */ |
| 145 | 147 | public function plugin_activate() { |
| 146 | 148 | update_option( 'wow_' . self::PREF . '_notice_action', 'read' ); |
| 147 | - global $wpdb; | |
| 148 | - require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); | |
| 149 | - // Create the database for plugin | |
| 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 ); | |
| 149 | + self::create_field(); | |
| 150 | + include_once 'includes/plugin-activation.php'; | |
| 151 | + } | |
| 158 | 152 | |
| 159 | - deactivate_plugins( 'floating-button-pro/floating-button-pro.php' ); | |
| 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 | + } | |
| 160 | 180 | } |
| 161 | 181 | |
| 162 | 182 | /** |
| 163 | 183 | * Download the folder with languages. |