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

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