PluginProbe
Button Generator – Easily Create Custom Buttons with Icons and Analytics / 3.2.6
Button Generator – Easily Create Custom Buttons with Icons and Analytics v3.2.6
trunk 1.1.1 2.0 2.1 2.2 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.3.8 2.3.9 3.0 3.0.1 3.0.2 3.0.3 3.1 3.1.1 3.1.2 3.1.3 3.2 3.2.1 3.2.2 3.2.3 All 28 releases
button-generation / button-generation.php

button-generation.php in Button Generator – Easily Create Custom Buttons with Icons and Analytics 3.2.6, at button-generation.php

195 lines 5.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Button Generator
4 * Plugin URI: https://wordpress.org/plugins/button-generation/
5 * Description: Easy generation of custom buttons.
6 * Version: 3.2.6
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: button-generation
12 * Domain Path: /languages
13 * Store URI: https://wow-estore.com/
14 * Author Email: hey@wow-company.com
15 * Plugin Menu: Button Generator
16 * Rating URI: https://wordpress.org/support/plugin/button-generation/reviews/#new-post
17 * Support URI: https://wordpress.org/support/plugin/button-generation/
18 * Item URI: https://wow-estore.com/item/button-generator-pro/
19 * Change URI: https://wordpress.org/plugins/button-generation/#developers
20 * Documentation: https://wow-estore.com/documentations/float-menu-lite/
21 *
22 * PHP version 7.4
23 *
24 * @category Wordpress_Plugin
25 * @package Wow_Plugin
26 * @author Dmytro Lobov <dev@wow-company.com>, Wow-Company
27 * @copyright 2024 Dmytro Lobov
28 * @license GPL-2.0+
29 */
30
31 namespace ButtonGenerator;
32
33 use ButtonGenerator\Admin\DBManager;
34 use ButtonGenerator\Update\UpdateDB;
35
36 defined( 'ABSPATH' ) || exit;
37
38 if ( ! class_exists( 'WOWP_Plugin' ) ) :
39
40 final class WOWP_Plugin {
41
42 // Plugin slug
43 public const SLUG = 'button-generation';
44
45 // Plugin prefix
46 public const PREFIX = 'wow_button_generator';
47
48 // Plugin Shortcode
49 public const SHORTCODE = 'Button';
50
51 private static $instance;
52
53 private WOWP_Admin $admin;
54 private Autoloader $autoloader;
55 private WOWP_Public $public;
56 private WOWP_Plugin_Checker $check;
57
58 public static function instance(): WOWP_Plugin {
59 if ( ! isset( self::$instance ) && ! ( self::$instance instanceof self ) ) {
60 self::$instance = new self;
61
62 self::$instance->includes();
63
64 self::$instance->autoloader = new Autoloader( 'ButtonGenerator' );
65 self::$instance->admin = new WOWP_Admin();
66 self::$instance->public = new WOWP_Public();
67
68 register_activation_hook( __FILE__, [ self::$instance, 'plugin_activate' ] );
69 add_action( 'plugins_loaded', [ self::$instance, 'loaded' ] );
70 }
71
72
73 return self::$instance;
74 }
75
76 // Plugin Root File.
77 public static function file(): string {
78 return __FILE__;
79 }
80
81 // Plugin Base Name.
82 public static function basename(): string {
83 return plugin_basename( __FILE__ );
84 }
85
86 // Plugin Folder Path.
87 public static function dir(): string {
88 return plugin_dir_path( __FILE__ );
89 }
90
91 // Plugin Folder URL.
92 public static function url(): string {
93 return plugin_dir_url( __FILE__ );
94 }
95
96 // Get Plugin Info
97 public static function info( $show = '' ): string {
98 $data = [
99 'name' => 'Plugin Name',
100 'version' => 'Version',
101 'url' => 'Plugin URI',
102 'author' => 'Author',
103 'email' => 'Author Email',
104 'store' => 'Store URI',
105 'menu_title' => 'Plugin Menu',
106 'rating' => 'Rating URI',
107 'support' => 'Support URI',
108 'pro' => 'Item URI',
109 'change' => 'Change URI',
110 'docs' => 'Documentation',
111 ];
112 $plugin_data = get_file_data( __FILE__, $data, false );
113
114 return $plugin_data[ $show ] ?? '';
115 }
116
117 /**
118 * Include required files.
119 *
120 * @access private
121 * @since 1.0
122 */
123 private function includes(): void {
124 if ( ! class_exists( 'Wow_Company' ) ) {
125 require_once self::dir() . 'includes/class-wow-company.php';
126 }
127
128 require_once self::dir() . 'classes/Autoloader.php';
129 require_once self::dir() . 'admin/class-wowp-admin.php';
130 require_once self::dir() . 'public/class-wowp-public.php';
131 }
132
133 /**
134 * Throw error on object clone.
135 * The whole idea of the singleton design pattern is that there is a single
136 * object therefore, we don't want the object to be cloned.
137 *
138 * @return void
139 * @access protected
140 */
141 public function __clone() {
142 // Cloning instances of the class is forbidden.
143 _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin&#8217; huh?', 'button-generation' ), '1.0' );
144 }
145
146 /**
147 * Disable unserializing of the class.
148 *
149 * @return void
150 * @access protected
151 */
152 public function __wakeup() {
153 // Unserializing instances of the class is forbidden.
154 _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin&#8217; huh?', 'button-generation' ), '1.0' );
155 }
156
157 public function plugin_activate(): void {
158
159 if ( is_plugin_active( 'button-generator-pro/button-generator.php' ) ) {
160 deactivate_plugins( 'button-generator-pro/button-generator.php' );
161 }
162
163 $columns = "
164 id mediumint(9) NOT NULL AUTO_INCREMENT,
165 title VARCHAR(200) DEFAULT '' NOT NULL,
166 param longtext,
167 status boolean DEFAULT 0 NOT NULL,
168 mode boolean DEFAULT 0 NOT NULL,
169 tag text,
170 PRIMARY KEY (id)
171 ";
172 DBManager::create( $columns );
173
174 update_site_option( self::PREFIX . '_db_version', '6.0' );
175 }
176
177 /**
178 * Download the folder with languages.
179 *
180 * @access Publisher
181 * @return void
182 */
183 public function loaded(): void {
184 UpdateDB::init();
185 }
186 }
187
188 endif;
189
190 function wp_plugin_run(): WOWP_Plugin {
191 return WOWP_Plugin::instance();
192 }
193
194 wp_plugin_run();
195