PluginProbe
Event SEO: Event Schema / Structured Data: Google Rich Snippet Schema for Event / 1.0.0
Event SEO: Event Schema / Structured Data: Google Rich Snippet Schema for Event v1.0.0
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.0.0, at event-schema.php

190 lines 5.3 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 allows you to import Facebook ( facebook.com ) events into your WordPress site.
6 * Version: 1.0.0
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 }
63 return self::$instance;
64 }
65
66 /** Magic Methods *********************************************************/
67
68 /**
69 * A dummy constructor to prevent Event_Schema from being loaded more than once.
70 *
71 * @since 1.0.0
72 * @see Event_Schema::instance()
73 * @see run_event_schema()
74 */
75 private function __construct() { /* Do nothing here */ }
76
77 /**
78 * A dummy magic method to prevent Event_Schema from being cloned.
79 *
80 * @since 1.0.0
81 */
82 public function __clone() { _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'event-schema' ), '1.0.0' ); }
83
84 /**
85 * A dummy magic method to prevent Event_Schema from being unserialized.
86 *
87 * @since 1.0.0
88 */
89 public function __wakeup() { _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'event-schema' ), '1.0.0' ); }
90
91
92 /**
93 * Setup plugins constants.
94 *
95 * @access private
96 * @since 1.0.0
97 * @return void
98 */
99 private function setup_constants() {
100
101 // Plugin version.
102 if( ! defined( 'ES_VERSION' ) ){
103 define( 'ES_VERSION', '1.0.0' );
104 }
105
106 // Plugin folder Path.
107 if( ! defined( 'ES_PLUGIN_DIR' ) ){
108 define( 'ES_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
109 }
110
111 // Plugin folder URL.
112 if( ! defined( 'ES_PLUGIN_URL' ) ){
113 define( 'ES_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
114 }
115
116 // Plugin root file.
117 if( ! defined( 'ES_PLUGIN_FILE' ) ){
118 define( 'ES_PLUGIN_FILE', __FILE__ );
119 }
120
121 // Options
122 if( ! defined( 'ES_OPTIONS' ) ){
123 define( 'ES_OPTIONS', 'event_schema_options' );
124 }
125
126 // Pro plugin Buy now Link.
127 if( ! defined( 'ES_PLUGIN_BUY_NOW_URL' ) ){
128 define( 'ES_PLUGIN_BUY_NOW_URL', 'http://xylusthemes.com/plugins/event-schema/?utm_source=insideplugin&utm_medium=web&utm_content=sidebar&utm_campaign=freeplugin' );
129 }
130 }
131
132 /**
133 * Include required files.
134 *
135 * @access private
136 * @since 1.0.0
137 * @return void
138 */
139 private function includes() {
140 require_once ES_PLUGIN_DIR . 'includes/class-event-schema-common.php';
141 require_once ES_PLUGIN_DIR . 'includes/class-event-schema-admin.php';
142 require_once ES_PLUGIN_DIR . 'includes/class-event-schema-em.php';
143 require_once ES_PLUGIN_DIR . 'includes/class-event-schema-event_organizer.php';
144 require_once ES_PLUGIN_DIR . 'includes/class-event-schema-aioec.php';
145 require_once ES_PLUGIN_DIR . 'includes/class-event-schema-eventon.php';
146 }
147
148 /**
149 * Loads the plugin language files.
150 *
151 * @access public
152 * @since 1.0.0
153 * @return void
154 */
155 public function load_textdomain(){
156
157 load_plugin_textdomain(
158 'event-schema',
159 false,
160 ES_PLUGIN_DIR . '/languages/'
161 );
162
163 }
164 }
165
166 endif; // End If class exists check.
167
168 /**
169 * The main function for that returns Event_Schema
170 *
171 * The main function responsible for returning the one true Event_Schema
172 * Instance to functions everywhere.
173 *
174 * Use this function like you would a global variable, except without needing
175 * to declare the global.
176 *
177 * Example: <?php $event_schema = run_event_schema(); ?>
178 *
179 * @since 1.0.0
180 * @return object|Event_Schema The one true Event_Schema Instance.
181 */
182 function run_event_schema() {
183 return Event_Schema::instance();
184 }
185
186 // Get Event_Schema Running.
187 global $event_schema, $es_errors, $es_success_msg, $es_warnings, $es_info_msg;
188 $event_schema = run_event_schema();
189 $es_errors = $es_warnings = $es_success_msg = $es_info_msg = array();
190