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