PluginProbe
Button Generator – Easily Create Custom Buttons with Icons and Analytics / 2.3.5
Button Generator – Easily Create Custom Buttons with Icons and Analytics v2.3.5
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 2.3.5, at button-generation.php

191 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: Button Generator
4 * Plugin URI: https://wordpress.org/plugins/button-generation/
5 * Description: Easy generation of custom buttons.
6 * Version: 2.3.5
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_generator
12 * Domain Path: /languages
13 *
14 * PHP version 5.3.0
15 *
16 * @category Wordpress_Plugin
17 * @package Wow_Plugin
18 * @author Wow-Company <yoda@wow-company.com>
19 * @copyright 2019 Wow-Company
20 * @license GNU Public License
21 * @version 1.0
22 */
23
24 // Required set the namespace for plugin.
25 namespace button_generator;
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 final class Wow_Plugin {
40
41 private static $_instance;
42
43 // Set the database name.
44 const PREF = 'button_generator';
45
46 /**
47 * Main Wow_Plugin Instance.
48 *
49 * Insures that only one instance of Wow_Plugin exists in memory at any one
50 * time. Also prevents needing to define globals all over the place.
51 *
52 * @return object|Wow_Plugin The one true Wow_Plugin for Current plugin
53 *
54 * @uses Wow_Plugin::_includes() Include the required files.
55 * @uses Wow_Plugin::text_domain() load the language files.
56 * @since 1.0
57 * @static
58 * @staticvar array $instance
59 */
60 public static function instance() {
61
62 if ( ! isset( self::$_instance ) && ! ( self::$_instance instanceof Wow_Plugin ) ) {
63
64 $info = array(
65 'plugin' => array(
66 'name' => esc_attr__( 'Button Generator', 'button_generator' ), // Plugin name
67 'menu' => esc_attr__( 'Button Generator', 'button_generator' ), // Plugin name in menu
68 'author' => 'Wow-Company', // Author
69 'prefix' => self::PREF, // Prefix for database
70 'text' => 'button_generator', // Text domain for translate files
71 'version' => '2.3.5', // Current version of the plugin
72 'file' => __FILE__, // Main file of the plugin
73 'slug' => dirname( plugin_basename( __FILE__ ) ), // Name of the plugin folder
74 'url' => plugin_dir_url( __FILE__ ), // filesystem directory path for the plugin
75 'dir' => plugin_dir_path( __FILE__ ), // URL directory path for the plugin
76 'shortcode' => 'Button',
77
78 ),
79 'url' => array(
80 'author' => 'https://wow-estore.com/',
81 'pro' => 'https://wow-estore.com/item/button-generator-pro/',
82 'home' => 'https://wordpress.org/plugins/button-generation/',
83 'support' => 'https://wordpress.org/support/plugin/button-generation/',
84 'facebook' => 'https://www.facebook.com/wowaffect/',
85 ),
86 'rating' => array(
87 'website' => esc_attr__( 'WordPress', 'button_generator' ), // Name site for rating plugin
88 'url' => 'https://wordpress.org/support/plugin/button-generation/reviews/?filter=5',
89 'wp_url' => 'https://wordpress.org/support/plugin/button-generation/reviews/#new-post',
90 'wp_home' => 'https://wordpress.org/plugins/button-generation/',
91 'wp_title' => 'Button Generator – easily Button Builder',
92 ),
93 );
94
95 self::$_instance = new Wow_Plugin;
96
97 register_activation_hook( __FILE__, array( self::$_instance, 'plugin_activate' ) );
98 add_action( 'plugins_loaded', array( self::$_instance, 'text_domain' ) );
99
100 self::$_instance->_includes();
101 self::$_instance->admin = new Wow_Plugin_Admin( $info );
102 self::$_instance->public = new Wow_Plugin_Public( $info );
103 }
104
105 return self::$_instance;
106 }
107
108 /**
109 * Throw error on object clone.
110 * The whole idea of the singleton design pattern is that there is a single
111 * object therefore, we don't want the object to be cloned.
112 *
113 * @return void
114 * @since 1.0
115 * @access protected
116 */
117 public function __clone() {
118 // Cloning instances of the class is forbidden.
119 _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin&#8217; huh?', 'button_generator' ), '0.1' );
120 }
121
122 /**
123 * Disable unserializing of the class.
124 *
125 * @return void
126 * @since 1.0
127 * @access protected
128 */
129 public function __wakeup() {
130 // Unserializing instances of the class is forbidden.
131 _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin&#8217; huh?', 'button_generator' ), '0.1' );
132 }
133
134
135 /**
136 * Include required files.
137 *
138 * @access private
139 * @return void
140 * @since 1.0
141 */
142 private function _includes() {
143 if ( ! class_exists( 'Wow_Company' ) ) {
144 include_once 'includes/class-wow-company.php';
145 }
146 include_once 'includes/class-db.php';
147 include_once 'admin/class-admin.php';
148 include_once 'public/class-public.php';
149 }
150
151 /**
152 * Activate the plugin.
153 * create the database
154 * create the folder in wp-upload
155 *
156 * @access public
157 * @return void
158 * @since 1.0
159 */
160 public function plugin_activate() {
161 update_option( 'wow_' . self::PREF . '_notice_action', 'read' );
162 include_once 'includes/plugin-activation.php';
163 }
164
165 /**
166 * Download the folder with languages.
167 *
168 * @access public
169 * @return void
170 * @since 1.0
171 */
172 public function text_domain() {
173 $languages_folder = dirname( plugin_basename( __FILE__ ) ) . '/languages/';
174 load_plugin_textdomain( 'button_generator', false, $languages_folder );
175 }
176 }
177
178 endif; // End if class_exists check.
179
180 /**
181 * The main function for that returns Wow_Plugin
182 *
183 * @since 1.0
184 */
185 function Wow_Plugin_run() {
186 return Wow_Plugin::instance();
187 }
188
189 // Get Running.
190 Wow_Plugin_run();
191