PluginProbe
Floating Button – Easily Create Sticky, Fixed & Floating Buttons / 6.0.3
Floating Button – Easily Create Sticky, Fixed & Floating Buttons v6.0.3
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 6.0.3, at floating-button.php

190 lines 4.8 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 Generate and manage sticky Floating Buttons.
6 * Version: 6.0.3
7 * Author: Wow-Company
8 * Author URI: https://wow-estore.com/
9 * Author Email: yoda@wow-company.com
10 * Item ID: 25955
11 * Store URI: https://wow-estore.com/
12 * License: GPL-2.0+
13 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
14 * Text Domain: floating-button
15 * Domain Path: /languages
16 *
17 * PHP version 7.4
18 *
19 * @category Wordpress_Plugin
20 * @package Wow_Plugin
21 * @author Wow-Company <yoda@wow-company.com>
22 * @copyright 2019 Wow-Company
23 * @license GNU Public License
24 * @version 1.1
25 */
26
27 // Required set the namespace for plugin.
28 namespace FloatingButton;
29
30 // Exit if accessed directly.
31 use FloatingButton\Dashboard\DBManager;
32 use FloatingButton\Update\UpdateDB;
33
34 defined( 'ABSPATH' ) || exit;
35
36 if ( ! class_exists( 'WOW_Plugin' ) ) :
37
38 final class WOW_Plugin {
39
40 // Plugin slug
41 public const SLUG = 'floating-button';
42
43 // Plugin prefix
44 public const PREFIX = 'wow_fbtnp';
45
46 // Plugin Shortcode
47 public const SHORTCODE = 'Floating-Button';
48
49 private static $instance;
50 /**
51 * @var Autoloader
52 */
53 private $autoloader;
54 /**
55 * @var Wow_Dashboard
56 */
57 private $dashboard;
58 private $public;
59
60 public static function instance(): WOW_Plugin {
61 if ( ! isset( self::$instance ) && ! ( self::$instance instanceof WOW_Plugin ) ) {
62 self::$instance = new self;
63
64 self::$instance->includes();
65 self::$instance->autoloader = new Autoloader( 'FloatingButton' );
66 self::$instance->dashboard = new WOWP_Dashboard();
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' ] );
71 }
72
73
74 return self::$instance;
75 }
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 ];
108 $plugin_data = get_file_data( __FILE__, $data, false );
109
110 return $plugin_data[ $show ] ?? '';
111 }
112
113 /**
114 * Include required files.
115 *
116 * @access private
117 * @since 1.0
118 */
119 private function includes(): void {
120 if ( ! class_exists( 'Wow_Company' ) ) {
121 require_once self::dir() . 'includes/class-wow-company.php';
122 }
123
124 require_once self::dir() . 'classes/Autoloader.php';
125 require_once self::dir() . 'includes/class-wowp-dashboard.php';
126 require_once self::dir() . 'includes/class-wowp-public.php';
127 }
128
129 /**
130 * Throw error on object clone.
131 * The whole idea of the singleton design pattern is that there is a single
132 * object therefore, we don't want the object to be cloned.
133 *
134 * @return void
135 * @access protected
136 */
137 public function __clone() {
138 // Cloning instances of the class is forbidden.
139 _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin&#8217; huh?', 'floating-button' ), '1.0' );
140 }
141
142 /**
143 * Disable unserializing of the class.
144 *
145 * @return void
146 * @access protected
147 */
148 public function __wakeup() {
149 // Unserializing instances of the class is forbidden.
150 _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin&#8217; huh?', 'floating-button' ), '1.0' );
151 }
152
153 public function plugin_activate(): void {
154 $columns = "
155 id mediumint(9) NOT NULL AUTO_INCREMENT,
156 title VARCHAR(200) NOT NULL,
157 param LONGTEXT,
158 status BOOLEAN,
159 mode BOOLEAN,
160 tag TEXT,
161 UNIQUE KEY id (id)
162 ";
163 DBManager::create( $columns );
164
165 include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
166 if ( is_plugin_active( 'floating-button-pro/floating-button-pro.php' ) ) {
167 deactivate_plugins( 'floating-button-pro/floating-button-pro.php' );
168 }
169 }
170
171 /**
172 * Download the folder with languages.
173 *
174 * @access Publisher
175 * @return void
176 */
177 public function loaded(): void {
178 UpdateDB::init();
179 $languages_folder = dirname( plugin_basename( __FILE__ ) ) . '/languages/';
180 load_plugin_textdomain( 'floating-button', false, $languages_folder );
181 }
182 }
183
184 endif;
185
186 function wow_plugin_run() {
187 return WOW_Plugin::instance();
188 }
189
190 wow_plugin_run();