PluginProbe
Modal Window – create popup modal window / 5.3.8
Modal Window – create popup modal window v5.3.8
6.3 trunk 2.5 3.1.1 3.1.2 3.2.2 4.0.1 4.0.3 5.0.6 5.1.1 5.2 5.2.1 5.2.2 5.2.3 5.3 5.3.1 5.3.10 5.3.2 5.3.3 5.3.4 5.3.5 5.3.6 5.3.7 5.3.8 5.3.9 All 45 releases
modal-window / modal-window.php

modal-window.php in Modal Window – create popup modal window 5.3.8, at modal-window.php

216 lines 6.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: Modal Window
4 * Plugin URI: https://wordpress.org/plugins/modal-window/
5 * Description: Create popups. Insert any content. Trigger on anything.
6 * Version: 5.3.8
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: modal-window
12 */
13
14 namespace modal_window;
15
16 if ( ! defined( 'ABSPATH' ) ) {
17 exit;
18 }
19
20 if ( ! defined( 'ABSPATH' ) ) {
21 exit;
22 }
23
24 if ( ! class_exists( 'Wow_Plugin' ) ) :
25
26 /**
27 * Main Wow_Plugin Class.
28 *
29 * @since 1.0
30 */
31 final class Wow_Plugin {
32
33 private static $_instance;
34 /**
35 * @var Wow_Plugin_Admin
36 */
37 private $admin;
38 /**
39 * @var Wow_Plugin_Public
40 */
41 private $public;
42
43 /**
44 * Wow Plugin information
45 *
46 * All information which need for correctly plugin working
47 *
48 * @return array
49 * @static
50 */
51 public static function information() {
52 $info = array(
53 'plugin' => array(
54 'name' => esc_attr__( 'Modal Window', 'modal-window' ), // Plugin name
55 'menu' => esc_attr__( 'Modal Window', 'modal-window' ), // Plugin name in menu
56 'author' => 'Wow-Company', // Author
57 'prefix' => 'mwp', // Prefix for database
58 'text' => 'modal-window', // Text domain for translate files
59 'version' => '5.3.8', // Current version of the plugin
60 'file' => __FILE__, // Main file of the plugin
61 'slug' => dirname( plugin_basename( __FILE__ ) ), // Name of the plugin folder
62 'url' => plugin_dir_url( __FILE__ ), // filesystem directory path for the plugin
63 'dir' => plugin_dir_path( __FILE__ ), // URL directory path for the plugin
64 'shortcode' => 'Modal-Window',
65 ),
66 'url' => array(
67 'author' => 'https://wow-estore.com/',
68 'home' => 'https://wordpress.org/plugins/modal-window/',
69 'support' => 'https://wordpress.org/support/plugin/modal-window/',
70 'facebook' => 'https://www.facebook.com/wowaffect/',
71 ),
72 'rating' => array(
73 'website' => 'WordPress.org', // Name site for rating plugin
74 'url' => 'https://wordpress.org/support/plugin/modal-window/reviews/#new-post',
75 'wp_url' => 'https://wordpress.org/support/plugin/modal-window/reviews/#new-post',
76 'wp_home' => 'https://wordpress.org/plugins/modal-window/',
77 'wp_title' => 'Modal Window – create popup modal window',
78 ),
79 );
80
81 return $info;
82 }
83
84 /**
85 * Main Wow_Plugin Instance.
86 *
87 * Insures that only one instance of Wow_Plugin exists in memory at any one
88 * time. Also prevents needing to define globals all over the place.
89 *
90 * @return object|Wow_Plugin The one true Wow_Plugin for Current plugin
91 *
92 * @uses Wow_Plugin::_includes() Include the required files.
93 * @uses Wow_Plugin::text_domain() load the language files.
94 * @since 1.0
95 * @static
96 * @staticvar array $_instance
97 */
98 public static function instance() {
99 if ( ! isset( self::$_instance ) && ! ( self::$_instance instanceof Wow_Plugin ) ) {
100 $info = self::information();
101
102 self::$_instance = new Wow_Plugin;
103
104 register_activation_hook( __FILE__, array( self::$_instance, 'plugin_activate' ) );
105 add_action( 'plugins_loaded', array( self::$_instance, 'text_domain' ) );
106
107 if ( get_option( 'wow_' . $info['plugin']['prefix'] . '_updater_5.0' ) === false ) {
108 add_action( 'admin_init', array( self::$_instance, 'plugin_updater' ) );
109 }
110 self::$_instance->_includes( $info );
111 self::$_instance->admin = new Wow_Plugin_Admin( $info );
112 self::$_instance->public = new Wow_Plugin_Public( $info );
113 }
114
115 return self::$_instance;
116 }
117
118 /**
119 * Throw error on object clone.
120 * The whole idea of the singleton design pattern is that there is a single
121 * object therefore, we don't want the object to be cloned.
122 *
123 * @return void
124 * @since 1.0
125 * @access protected
126 */
127 public function __clone() {
128 $info = self::information();
129 $text = $info['plugin']['text'];
130 // Cloning instances of the class is forbidden.
131 _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin&#8217; huh?', 'modal-window' ), '0.1' );
132 }
133
134 /**
135 * Disable unserializing of the class.
136 *
137 * @return void
138 * @since 1.0
139 * @access protected
140 */
141 public function __wakeup() {
142 $info = self::information();
143 $text = $info['plugin']['text'];
144 // Unserializing instances of the class is forbidden.
145 _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin&#8217; huh?', 'modal-window' ), '0.1' );
146 }
147
148
149 /**
150 * Include required files.
151 *
152 * @access private
153 * @return void
154 * @since 1.0
155 */
156 private function _includes( $info ) {
157 if ( ! class_exists( 'Wow_Company' ) ) {
158 require_once plugin_dir_path( __FILE__ ) . 'includes/class-wow-company.php';
159 }
160 require_once plugin_dir_path( __FILE__ ) . 'admin/class-admin.php';
161 require_once plugin_dir_path( __FILE__ ) . 'public/class-public.php';
162 }
163
164 /**
165 * Activate the plugin.
166 * create the database
167 * create the folder in wp-upload
168 *
169 * @access public
170 * @return void
171 * @since 1.0
172 */
173 public function plugin_activate() {
174 $info = self::information();
175 $prefix = $info['plugin']['prefix'];
176 include_once 'includes/plugin-activation.php';
177 }
178
179 /**
180 * Download the folder with languages.
181 *
182 * @access public
183 * @return void
184 * @since 1.0
185 */
186 public function text_domain() {
187 $info = self::information();
188 $text = $info['plugin']['text'];
189 $languages_folder = dirname( plugin_basename( __FILE__ ) ) . '/languages/';
190 load_plugin_textdomain( 'modal-window', false, $languages_folder );
191 }
192
193 /*
194 * Update the plugin option to version 4.0
195 */
196
197 public function plugin_updater() {
198 include 'includes/plugin-updater.php';
199 }
200
201 }
202
203 endif; // End if class_exists check.
204
205 /**
206 * The main function for that returns Wow_Plugin
207 *
208 * @since 1.0
209 */
210 function Wow_Plugin_run() {
211 return Wow_Plugin::instance();
212 }
213
214 // Get Running.
215 Wow_Plugin_run();
216