PluginProbe
Event SEO: Event Schema / Structured Data: Google Rich Snippet Schema for Event / 1.1.1
Event SEO: Event Schema / Structured Data: Google Rich Snippet Schema for Event v1.1.1
trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6
event-schema / event-schema.php

event-schema.php in Event SEO: Event Schema / Structured Data: Google Rich Snippet Schema for Event 1.1.1, at event-schema.php

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