-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathevent-schema.php
198 lines (172 loc) · 5.89 KB
/
event-schema.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<?php
/**
* Plugin Name: Event Schema
* Plugin URI: http://xylusthemes.com/plugins/event-schema/
* Description: Event Schema is automatically generates Google Rich Snippet Schema for Events.
* Version: 1.1.2
* Author: Xylus Themes
* Author URI: http://xylusthemes.com
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: event-schema
* Domain Path: /languages
*
* @package Event_Schema
* @author Dharmesh Patel <dspatel44@gmail.com>
*/
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) exit;
if( ! class_exists( 'Event_Schema' ) ):
/**
* Main Event Schema class
*/
class Event_Schema{
/** Singleton *************************************************************/
/**
* Event_Schema The one true Event_Schema.
*/
private static $instance;
public $common, $admin, $em, $event_organizer, $aioec, $eventon, $ife, $iee, $ime, $wpea;
/**
* Main Event Schema Instance.
*
* Insure that only one instance of Event_Schema exists in memory at any one time.
* Also prevents needing to define globals all over the place.
*
* @since 1.0.0
* @static object $instance
* @uses Event_Schema::setup_constants() Setup the constants needed.
* @uses Event_Schema::includes() Include the required files.
* @uses Event_Schema::laod_textdomain() load the language files.
* @see run_event_schema()
* @return object| Event Schema the one true Event Schema.
*/
public static function instance() {
if( ! isset( self::$instance ) && ! (self::$instance instanceof Event_Schema ) ) {
self::$instance = new Event_Schema;
self::$instance->setup_constants();
add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) );
self::$instance->includes();
self::$instance->common = new Event_Schema_Common();
self::$instance->admin = new Event_Schema_Admin();
self::$instance->em = new Event_Schema_EM();
self::$instance->event_organizer = new Event_Schema_Event_Organizer();
self::$instance->aioec = new Event_Schema_Aioec();
self::$instance->eventon = new Event_Schema_EventON();
self::$instance->ife = new Event_Schema_IFE();
self::$instance->iee = new Event_Schema_IEE();
self::$instance->ime = new Event_Schema_IME();
self::$instance->wpea = new Event_Schema_WPEA();
}
return self::$instance;
}
/** Magic Methods *********************************************************/
/**
* A dummy constructor to prevent Event_Schema from being loaded more than once.
*
* @since 1.0.0
* @see Event_Schema::instance()
* @see run_event_schema()
*/
private function __construct() { /* Do nothing here */ }
/**
* A dummy magic method to prevent Event_Schema from being cloned.
*
* @since 1.0.0
*/
public function __clone() { _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'event-schema' ), '1.1.2' ); }
/**
* A dummy magic method to prevent Event_Schema from being unserialized.
*
* @since 1.0.0
*/
public function __wakeup() { _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'event-schema' ), '1.1.2' ); }
/**
* Setup plugins constants.
*
* @access private
* @since 1.0.0
* @return void
*/
private function setup_constants() {
// Plugin version.
if( ! defined( 'ES_VERSION' ) ){
define( 'ES_VERSION', '1.1.2' );
}
// Plugin folder Path.
if( ! defined( 'ES_PLUGIN_DIR' ) ){
define( 'ES_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
}
// Plugin folder URL.
if( ! defined( 'ES_PLUGIN_URL' ) ){
define( 'ES_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
}
// Plugin root file.
if( ! defined( 'ES_PLUGIN_FILE' ) ){
define( 'ES_PLUGIN_FILE', __FILE__ );
}
// Options
if( ! defined( 'ES_OPTIONS' ) ){
define( 'ES_OPTIONS', 'event_schema_options' );
}
// Pro plugin Buy now Link.
if( ! defined( 'ES_PLUGIN_BUY_NOW_URL' ) ){
define( 'ES_PLUGIN_BUY_NOW_URL', 'http://xylusthemes.com/plugins/event-schema/?utm_source=insideplugin&utm_medium=web&utm_content=sidebar&utm_campaign=freeplugin' );
}
}
/**
* Include required files.
*
* @access private
* @since 1.0.0
* @return void
*/
private function includes() {
require_once ES_PLUGIN_DIR . 'includes/class-event-schema-common.php';
require_once ES_PLUGIN_DIR . 'includes/class-event-schema-admin.php';
require_once ES_PLUGIN_DIR . 'includes/class-event-schema-em.php';
require_once ES_PLUGIN_DIR . 'includes/class-event-schema-event_organizer.php';
require_once ES_PLUGIN_DIR . 'includes/class-event-schema-aioec.php';
require_once ES_PLUGIN_DIR . 'includes/class-event-schema-eventon.php';
require_once ES_PLUGIN_DIR . 'includes/class-event-schema-ife.php';
require_once ES_PLUGIN_DIR . 'includes/class-event-schema-iee.php';
require_once ES_PLUGIN_DIR . 'includes/class-event-schema-ime.php';
require_once ES_PLUGIN_DIR . 'includes/class-event-schema-wpea.php';
}
/**
* Loads the plugin language files.
*
* @access public
* @since 1.0.0
* @return void
*/
public function load_textdomain(){
load_plugin_textdomain(
'event-schema',
false,
basename( dirname( __FILE__ ) ) . '/languages'
);
}
}
endif; // End If class exists check.
/**
* The main function for that returns Event_Schema
*
* The main function responsible for returning the one true Event_Schema
* Instance to functions everywhere.
*
* Use this function like you would a global variable, except without needing
* to declare the global.
*
* Example: <?php $event_schema = run_event_schema(); ?>
*
* @since 1.0.0
* @return object|Event_Schema The one true Event_Schema Instance.
*/
function run_event_schema() {
return Event_Schema::instance();
}
// Get Event_Schema Running.
global $event_schema, $es_errors, $es_success_msg, $es_warnings, $es_info_msg;
$event_schema = run_event_schema();
$es_errors = $es_warnings = $es_success_msg = $es_info_msg = array();