PluginProbe
Floating Button – Easily Create Sticky, Fixed & Floating Buttons / 5.0
Floating Button – Easily Create Sticky, Fixed & Floating Buttons v5.0
trunk 2.0.2 3.0 4.0 4.1.2 4.3 5.0 5.0.1 5.1 5.1.1 5.2 5.3 5.3.1 6.0 6.0.1 6.0.10 6.0.11 6.0.12 6.0.13 6.0.2 6.0.3 6.0.4 6.0.5 6.0.6 6.0.7 All 31 releases
floating-button / floating-button.php

floating-button.php in Floating Button – Easily Create Sticky, Fixed & Floating Buttons 5.0, at floating-button.php

189 lines 5.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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: 5.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 Wow-Company <helper@wow-company.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' => '5.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', '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',
78 ),
79 );
80
81 self::$_instance = new Wow_Plugin;
82
83 register_activation_hook( __FILE__, array( self::$_instance, 'plugin_activate' ) );
84 add_action( 'plugins_loaded', array( self::$_instance, 'text_domain' ) );
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&#8217; 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&#8217; 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 include_once 'admin/class-admin.php';
133 include_once 'public/class-public.php';
134 }
135
136 /**
137 * Activate the plugin.
138 * create the database
139 * create the folder in wp-upload
140 *
141 * @access public
142 * @return void
143 * @since 1.0
144 */
145 public function plugin_activate() {
146 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 );
158
159 deactivate_plugins( 'floating-button-pro/floating-button-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( 'floating-button', false, $languages_folder );
172 }
173
174 }
175
176 endif; // End if class_exists check.
177
178 /**
179 * The main function for that returns Wow_Plugin
180 *
181 * @since 1.0
182 */
183 function Wow_Plugin_run() {
184 return Wow_Plugin::instance();
185 }
186
187 // Get Running.
188 Wow_Plugin_run();
189