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

228 lines 6.9 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.5
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 public $common, $admin, $em, $event_organizer, $aioec, $eventon, $ife, $iee, $ime, $wpea;
34
35 /**
36 * Main Event Schema Instance.
37 *
38 * Insure that only one instance of Event_Schema exists in memory at any one time.
39 * Also prevents needing to define globals all over the place.
40 *
41 * @since 1.0.0
42 * @static object $instance
43 * @uses Event_Schema::setup_constants() Setup the constants needed.
44 * @uses Event_Schema::includes() Include the required files.
45 * @uses Event_Schema::laod_textdomain() load the language files.
46 * @see run_event_schema()
47 * @return object| Event Schema the one true Event Schema.
48 */
49 public static function instance() {
50 if( ! isset( self::$instance ) && ! (self::$instance instanceof Event_Schema ) ) {
51 self::$instance = new Event_Schema;
52 self::$instance->setup_constants();
53
54 add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) );
55 add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), array( self::$instance, 'wpes_setting_doc_links' ) );
56
57 self::$instance->includes();
58 self::$instance->common = new Event_Schema_Common();
59 self::$instance->admin = new Event_Schema_Admin();
60 self::$instance->em = new Event_Schema_EM();
61 self::$instance->event_organizer = new Event_Schema_Event_Organizer();
62 self::$instance->aioec = new Event_Schema_Aioec();
63 self::$instance->eventon = new Event_Schema_EventON();
64 self::$instance->ife = new Event_Schema_IFE();
65 self::$instance->iee = new Event_Schema_IEE();
66 self::$instance->ime = new Event_Schema_IME();
67 self::$instance->wpea = new Event_Schema_WPEA();
68 }
69 return self::$instance;
70 }
71
72 /** Magic Methods *********************************************************/
73
74 /**
75 * A dummy constructor to prevent Event_Schema from being loaded more than once.
76 *
77 * @since 1.0.0
78 * @see Event_Schema::instance()
79 * @see run_event_schema()
80 */
81 private function __construct() { /* Do nothing here */ }
82
83 /**
84 * A dummy magic method to prevent Event_Schema from being cloned.
85 *
86 * @since 1.0.0
87 */
88 public function __clone() { _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin&#8217; huh?', 'event-schema' ), '1.1.5' ); }
89
90 /**
91 * A dummy magic method to prevent Event_Schema from being unserialized.
92 *
93 * @since 1.0.0
94 */
95 public function __wakeup() { _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin&#8217; huh?', 'event-schema' ), '1.1.5' ); }
96
97
98 /**
99 * Setup plugins constants.
100 *
101 * @access private
102 * @since 1.0.0
103 * @return void
104 */
105 private function setup_constants() {
106
107 // Plugin version.
108 if( ! defined( 'ES_VERSION' ) ){
109 define( 'ES_VERSION', '1.1.5' );
110 }
111
112 // Plugin folder Path.
113 if( ! defined( 'ES_PLUGIN_DIR' ) ){
114 define( 'ES_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
115 }
116
117 // Plugin folder URL.
118 if( ! defined( 'ES_PLUGIN_URL' ) ){
119 define( 'ES_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
120 }
121
122 // Plugin root file.
123 if( ! defined( 'ES_PLUGIN_FILE' ) ){
124 define( 'ES_PLUGIN_FILE', __FILE__ );
125 }
126
127 // Options
128 if( ! defined( 'ES_OPTIONS' ) ){
129 define( 'ES_OPTIONS', 'event_schema_options' );
130 }
131
132 // Pro plugin Buy now Link.
133 if( ! defined( 'ES_PLUGIN_BUY_NOW_URL' ) ){
134 define( 'ES_PLUGIN_BUY_NOW_URL', 'http://xylusthemes.com/plugins/event-schema/?utm_source=insideplugin&utm_medium=web&utm_content=sidebar&utm_campaign=freeplugin' );
135 }
136 }
137
138 /**
139 * Include required files.
140 *
141 * @access private
142 * @since 1.0.0
143 * @return void
144 */
145 private function includes() {
146 require_once ES_PLUGIN_DIR . 'includes/class-event-schema-common.php';
147 require_once ES_PLUGIN_DIR . 'includes/class-event-schema-admin.php';
148 require_once ES_PLUGIN_DIR . 'includes/class-event-schema-em.php';
149 require_once ES_PLUGIN_DIR . 'includes/class-event-schema-event_organizer.php';
150 require_once ES_PLUGIN_DIR . 'includes/class-event-schema-aioec.php';
151 require_once ES_PLUGIN_DIR . 'includes/class-event-schema-eventon.php';
152 require_once ES_PLUGIN_DIR . 'includes/class-event-schema-ife.php';
153 require_once ES_PLUGIN_DIR . 'includes/class-event-schema-iee.php';
154 require_once ES_PLUGIN_DIR . 'includes/class-event-schema-ime.php';
155 require_once ES_PLUGIN_DIR . 'includes/class-event-schema-wpea.php';
156 }
157
158 /**
159 * WPES setting And docs link add in plugin page.
160 *
161 * @since 1.0
162 * @return void
163 */
164 public function wpes_setting_doc_links( $links ) {
165 $iee_setting_doc_link = array(
166 'wpes-event-setting' => sprintf(
167 '<a href="%s">%s</a>',
168 esc_url( admin_url( 'admin.php?page=event_schema&tab=settings' ) ),
169 esc_html__( 'Setting', 'event-schema' )
170 ),
171 'wpes-event-docs' => sprintf(
172 '<a target="_blank" href="%s">%s</a>',
173 esc_url( 'https://docs.xylusthemes.com/docs/event-schema/' ),
174 esc_html__( 'Docs', 'event-schema' )
175 ),
176 'wpes-event-pro-link' => sprintf(
177 '<a href="%s" target="_blank" style="color:#1da867;font-weight: 900;">%s</a>',
178 esc_url( 'https://xylusthemes.com/plugins/event-schema/' ),
179 esc_html__( 'Upgrade to Pro', 'event-schema' )
180 ),
181 );
182
183 return array_merge( $links, $iee_setting_doc_link );
184 }
185
186 /**
187 * Loads the plugin language files.
188 *
189 * @access public
190 * @since 1.0.0
191 * @return void
192 */
193 public function load_textdomain(){
194
195 load_plugin_textdomain(
196 'event-schema',
197 false,
198 basename( dirname( __FILE__ ) ) . '/languages'
199 );
200
201 }
202 }
203
204 endif; // End If class exists check.
205
206 /**
207 * The main function for that returns Event_Schema
208 *
209 * The main function responsible for returning the one true Event_Schema
210 * Instance to functions everywhere.
211 *
212 * Use this function like you would a global variable, except without needing
213 * to declare the global.
214 *
215 * Example: <?php $event_schema = run_event_schema(); ?>
216 *
217 * @since 1.0.0
218 * @return object|Event_Schema The one true Event_Schema Instance.
219 */
220 function run_event_schema() {
221 return Event_Schema::instance();
222 }
223
224 // Get Event_Schema Running.
225 global $event_schema, $es_errors, $es_success_msg, $es_warnings, $es_info_msg;
226 $event_schema = run_event_schema();
227 $es_errors = $es_warnings = $es_success_msg = $es_info_msg = array();
228