PluginProbe
WP Event Aggregator: Import Eventbrite events, Meetup events, social events and any iCal Events into Event Calendar / trunk
WP Event Aggregator: Import Eventbrite events, Meetup events, social events and any iCal Events into Event Calendar vtrunk
1.9.3 1.9.2 trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.2.4 1.3.0 1.4.0 1.4.1 1.5.0 1.5.1 1.5.10 1.5.11 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 All 53 releases
wp-event-aggregator / wp-event-aggregator.php

wp-event-aggregator.php in WP Event Aggregator: Import Eventbrite events, Meetup events, social events and any iCal Events into Event Calendar trunk, at wp-event-aggregator.php

383 lines 13.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: WP Event Aggregator
4 * Plugin URI: http://xylusthemes.com/plugins/wp-event-aggregator/
5 * Description: Import Events from anywhere - Facebook, Eventbrite, Meetup, iCalendar and ICS into your WordPress site.
6 * Requires at least: 5.0
7 * Requires PHP: 7.4
8 * Version: 1.9.3
9 * Author: Xylus Themes
10 * Author URL: http://xylusthemes.com
11 * License: GPL-2.0+
12 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
13 * Text Domain: wp-event-aggregator
14 * Domain Path: /languages
15 */
16
17 // If this file is called directly, abort.
18 if ( ! defined( 'ABSPATH' ) ) exit;
19
20 if( ! class_exists( 'WP_Event_Aggregator' ) ):
21
22 /**
23 * Main WP Event Aggregator class
24 */
25 class WP_Event_Aggregator{
26
27 /** Singleton *************************************************************/
28 /**
29 * WP_Event_Aggregator The one true WP_Event_Aggregator.
30 */
31 private static $instance;
32 public $common,
33 $cpt,
34 $eventbrite,
35 $meetup,
36 $facebook,
37 $ical_parser,
38 $ical,
39 $admin,
40 $manage_import,
41 $wpea,
42 $tec,
43 $em,
44 $eventon,
45 $event_organizer,
46 $aioec,
47 $ee4,
48 $my_calendar,
49 $common_pro,
50 $facebook_pro,
51 $eventum,
52 $cron,
53 $fb_authorize,
54 $meetup_authorize,
55 $ical_parser_aioec,
56 $eventprime,
57 $ajax,
58 $eventbrite_api,
59 $multi_source,
60 $htmltoblock,
61 $ical_export,
62 $xec;
63
64 /**
65 * Main WP Event Aggregator Instance.
66 *
67 * Insure that only one instance of WP_Event_Aggregator exists in memory at any one time.
68 * Also prevents needing to define globals all over the place.
69 *
70 * @since 1.0.0
71 * @static object $instance
72 * @uses WP_Event_Aggregator::setup_constants() Setup the constants needed.
73 * @uses WP_Event_Aggregator::includes() Include the required files.
74 * @uses WP_Event_Aggregator::laod_textdomain() load the language files.
75 * @see wpea_run_wp_event_aggregator()
76 * @return object| WP Event Aggregator the one true WP Event Aggregator.
77 */
78 public static function instance() {
79 if( ! isset( self::$instance ) && ! (self::$instance instanceof WP_Event_Aggregator ) ) {
80 self::$instance = new WP_Event_Aggregator;
81 self::$instance->setup_constants();
82
83 add_action( 'plugins_loaded', array( self::$instance, 'load_authorize_class' ), 20 );
84 add_action( 'wp_enqueue_scripts', array( self::$instance, 'wpea_enqueue_style' ) );
85 add_action( 'wp_enqueue_scripts', array( self::$instance, 'wpea_enqueue_script' ) );
86 add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), array( self::$instance, 'wpea_setting_doc_links' ) );
87
88 self::$instance->includes();
89 self::$instance->common = new WP_Event_Aggregator_Common();
90 self::$instance->ical_export = new WP_Event_Aggregator_Ical_Export();
91 self::$instance->htmltoblock = new WP_Event_Aggregator_Html_To_Blocks();
92 self::$instance->ajax = new WP_Event_Aggregator_Ajax();
93 self::$instance->cpt = new WP_Event_Aggregator_Cpt();
94 self::$instance->eventbrite = new WP_Event_Aggregator_Eventbrite();
95 self::$instance->meetup = new WP_Event_Aggregator_Meetup();
96 self::$instance->facebook = new WP_Event_Aggregator_Facebook();
97 self::$instance->ical_parser = new WP_Event_Aggregator_Ical_Parser();
98 self::$instance->ical_parser_aioec = new WP_Event_Aggregator_Ical_Parser_AIOEC();
99 self::$instance->ical = new WP_Event_Aggregator_Ical();
100 self::$instance->admin = new WP_Event_Aggregator_Admin();
101 self::$instance->eventbrite_api = new WP_Event_Aggregator_Eventbrite_API();
102 if ( wpea_is_pro() && class_exists( 'WP_Event_Aggregator_Pro_Manage_Import' ) ) {
103 self::$instance->manage_import = new WP_Event_Aggregator_Pro_Manage_Import();
104 }else{
105 self::$instance->manage_import = new WP_Event_Aggregator_Manage_Import();
106 }
107 self::$instance->wpea = new WP_Event_Aggregator_WPEA();
108 self::$instance->tec = new WP_Event_Aggregator_TEC();
109 self::$instance->em = new WP_Event_Aggregator_EM();
110 self::$instance->eventon = new WP_Event_Aggregator_EventON();
111 self::$instance->event_organizer = new WP_Event_Aggregator_Event_Organizer();
112 self::$instance->aioec = new WP_Event_Aggregator_Aioec();
113 self::$instance->ee4 = new WP_Event_Aggregator_EE4();
114 self::$instance->my_calendar = new WP_Event_Aggregator_My_Calendar();
115 self::$instance->eventprime = new WP_Event_Aggregator_EventPrime();
116 self::$instance->xec = new WP_Event_Aggregator_XEC();
117
118 }
119 return self::$instance;
120 }
121
122 /** Magic Methods *********************************************************/
123
124 /**
125 * A dummy constructor to prevent WP_Event_Aggregator from being loaded more than once.
126 *
127 * @since 1.0.0
128 * @see WP_Event_Aggregator::instance()
129 * @see wpea_run_wp_event_aggregator()
130 */
131 private function __construct() { /* Do nothing here */ }
132
133 /**
134 * A dummy magic method to prevent WP_Event_Aggregator from being cloned.
135 *
136 * @since 1.0.0
137 */
138 public function __clone() { _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin&#8217; huh?', 'wp-event-aggregator' ), '1.9.3' ); }
139
140 /**
141 * A dummy magic method to prevent WP_Event_Aggregator from being unserialized.
142 *
143 * @since 1.0.0
144 */
145 public function __wakeup() { _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin&#8217; huh?', 'wp-event-aggregator' ), '1.9.3' ); }
146
147
148 /**
149 * Setup plugins constants.
150 *
151 * @access private
152 * @since 1.0.0
153 * @return void
154 */
155 private function setup_constants() {
156
157 // Plugin version.
158 if( ! defined( 'WPEA_VERSION' ) ){
159 define( 'WPEA_VERSION', '1.9.3' );
160 }
161
162 // Minimum Pro plugin version.
163 if( ! defined( 'WPEA_MIN_PRO_VERSION' ) ){
164 define( 'WPEA_MIN_PRO_VERSION', '1.9.0' );
165 }
166
167 // Plugin folder Path.
168 if( ! defined( 'WPEA_PLUGIN_DIR' ) ){
169 define( 'WPEA_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
170 }
171
172 // Plugin folder URL.
173 if( ! defined( 'WPEA_PLUGIN_URL' ) ){
174 define( 'WPEA_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
175 }
176
177 // Plugin root file.
178 if( ! defined( 'WPEA_PLUGIN_FILE' ) ){
179 define( 'WPEA_PLUGIN_FILE', __FILE__ );
180 }
181
182 // Options
183 if( ! defined( 'WPEA_OPTIONS' ) ){
184 define( 'WPEA_OPTIONS', 'wpea_options' );
185 }
186
187 // Pro plugin Buy now Link.
188 if( ! defined( 'WPEA_PLUGIN_BUY_NOW_URL' ) ){
189 define( 'WPEA_PLUGIN_BUY_NOW_URL', 'http://xylusthemes.com/plugins/wp-event-aggregator/?utm_source=insideplugin&utm_medium=web&utm_content=sidebar&utm_campaign=freeplugin' );
190 }
191 }
192
193 /**
194 * Include required files.
195 *
196 * @access private
197 * @since 1.0.0
198 * @return void
199 */
200 private function includes() {
201
202 require_once WPEA_PLUGIN_DIR . 'includes/class-wp-event-aggregator-common.php';
203 require_once WPEA_PLUGIN_DIR . 'includes/class-wp-event-aggregator-html-to-blocks.php';
204 require_once WPEA_PLUGIN_DIR . 'includes/class-wp-event-aggregator-ajax.php';
205 require_once WPEA_PLUGIN_DIR . 'includes/class-wp-event-aggregator-list-table.php';
206 require_once WPEA_PLUGIN_DIR . 'includes/class-wp-event-aggregator-admin.php';
207 if ( defined( 'WPEAPRO_PLUGIN_DIR' ) && function_exists('wpea_is_pro') && wpea_is_pro() ){
208 require_once WPEAPRO_PLUGIN_DIR . 'includes/class-wp-event-aggregator-manage-import.php';
209 }else{
210 require_once WPEA_PLUGIN_DIR . 'includes/class-wp-event-aggregator-manage-import.php';
211 }
212 if( !class_exists( 'Kigkonsult\Icalcreator\Vcalendar' ) ){
213 require_once WPEA_PLUGIN_DIR . 'includes/lib/icalcreator/autoload.php';
214 }
215 require_once WPEA_PLUGIN_DIR . 'includes/class-wp-event-aggregator-cpt.php';
216
217 require_once WPEA_PLUGIN_DIR . 'includes/class-wp-event-aggregator-eventbrite.php';
218 require_once WPEA_PLUGIN_DIR . 'includes/class-wp-event-aggregator-eventbrite_api.php';
219 require_once WPEA_PLUGIN_DIR . 'includes/class-wp-event-aggregator-meetup.php';
220 require_once WPEA_PLUGIN_DIR . 'includes/class-wp-event-aggregator-facebook.php';
221 require_once WPEA_PLUGIN_DIR . 'includes/class-wp-event-aggregator-ical_parser.php';
222 require_once WPEA_PLUGIN_DIR . 'includes/class-wp-event-aggregator-ical_parser_aioec.php';
223 require_once WPEA_PLUGIN_DIR . 'includes/class-wp-event-aggregator-ical.php';
224
225 require_once WPEA_PLUGIN_DIR . 'includes/class-wp-event-aggregator-wpea.php';
226 require_once WPEA_PLUGIN_DIR . 'includes/class-wp-event-aggregator-tec.php';
227 require_once WPEA_PLUGIN_DIR . 'includes/class-wp-event-aggregator-em.php';
228 require_once WPEA_PLUGIN_DIR . 'includes/class-wp-event-aggregator-eventon.php';
229 require_once WPEA_PLUGIN_DIR . 'includes/class-wp-event-aggregator-event_organizer.php';
230 require_once WPEA_PLUGIN_DIR . 'includes/class-wp-event-aggregator-aioec.php';
231 require_once WPEA_PLUGIN_DIR . 'includes/class-wp-event-aggregator-my-calendar.php';
232 require_once WPEA_PLUGIN_DIR . 'includes/class-wp-event-aggregator-eventprime.php';
233 require_once WPEA_PLUGIN_DIR . 'includes/class-wp-event-aggregator-ee4.php';
234 require_once WPEA_PLUGIN_DIR . 'includes/class-wpea-plugin-deactivation.php';
235 require_once WPEA_PLUGIN_DIR . 'includes/class-wp-event-aggregator-api.php';
236 require_once WPEA_PLUGIN_DIR . 'includes/class-wp-event-aggregator-public-api.php';
237 require_once WPEA_PLUGIN_DIR . 'includes/parsedown.php';
238 require_once WPEA_PLUGIN_DIR . 'includes/wpea-action-scheduler/wpea-image-init.php';
239 require_once WPEA_PLUGIN_DIR . 'includes/class-wp-event-aggregator-ical-export.php';
240 require_once WPEA_PLUGIN_DIR . 'includes/class-wp-event-aggregator-xec.php';
241
242 // Gutenberg Block
243 include_once WPEA_PLUGIN_DIR . 'blocks/wp-events/index.php';
244 }
245
246 /**
247 * WPEA setting And docs link add in plugin page.
248 *
249 * @since 1.0
250 * @return void
251 */
252 public function wpea_setting_doc_links ( $links ) {
253 $wpea_setting_doc_link = array(
254 'wpea-event-setting' => sprintf(
255 '<a href="%s">%s</a>',
256 esc_url( admin_url( 'admin.php?page=import_events&tab=settings' ) ),
257 esc_html__( 'Setting', 'wp-event-aggregator' )
258 ),
259 'wpea-event-docs' => sprintf(
260 '<a target="_blank" href="%s">%s</a>',
261 esc_url( 'https://docs.xylusthemes.com/docs/wp-event-aggregator/' ),
262 esc_html__( 'Docs', 'wp-event-aggregator' )
263 ),
264 );
265 $upgrade_to_pro = array();
266 if( !wpea_is_pro() ){
267 $upgrade_to_pro = array( 'wpea-event-pro-link' => sprintf(
268 '<a href="%s" target="_blank" style="color:#1da867;font-weight: 900;">%s</a>',
269 esc_url( 'https://xylusthemes.com/plugins/wp-event-aggregator/' ),
270 esc_html__( 'Upgrade to Pro', 'wp-event-aggregator' )
271 ) ) ;
272 }
273 return array_merge( $links, $wpea_setting_doc_link, $upgrade_to_pro );
274 }
275
276 /**
277 * Loads the facebook authorize class
278 *
279 * @access public
280 * @since 1.5
281 * @return void
282 */
283 public function load_authorize_class(){
284
285 if( !class_exists( 'WP_Event_Aggregator_Pro_FB_Authorize', false ) ){
286 require_once WPEA_PLUGIN_DIR . 'includes/class-wp-event-aggregator-fb-authorize.php';
287 require_once WPEA_PLUGIN_DIR . 'includes/class-wp-event-aggregator-meetup-authorize.php';
288 global $importevents;
289 if( class_exists('WP_Event_Aggregator_FB_Authorize', false ) && !empty( $importevents ) ){
290 $importevents->fb_authorize = new WP_Event_Aggregator_FB_Authorize();
291 }
292 if( class_exists('WP_Event_Aggregator_Meetup_Authorize', false ) && !empty( $importevents ) ){
293 $importevents->meetup_authorize = new WP_Event_Aggregator_Meetup_Authorize();
294 }
295 }
296 }
297
298 /**
299 * enqueue style front-end
300 *
301 * @access public
302 * @since 1.0.0
303 * @return void
304 */
305 public function wpea_enqueue_style() {
306
307 $css_dir = WPEA_PLUGIN_URL . 'assets/css/';
308 wp_enqueue_style('font-awesome', $css_dir . 'font-awesome.min.css', false, WPEA_VERSION );
309 wp_enqueue_style('wp-event-aggregator-front', $css_dir . 'wp-event-aggregator.css', false, WPEA_VERSION );
310 wp_enqueue_style('wp-event-aggregator-front-style2', $css_dir . 'grid-style2.css', false, WPEA_VERSION );
311 }
312
313 /**
314 * enqueue script front-end
315 *
316 * @access public
317 * @since 1.0.0
318 * @return void
319 */
320 public function wpea_enqueue_script() {
321
322 $js_dir = WPEA_PLUGIN_URL . 'assets/js/';
323 wp_enqueue_script( 'wpea-ajax-pagi', $js_dir . 'wpea-ajax-pagi.js', array( 'jquery' ), WPEA_VERSION, true );
324 wp_localize_script( 'wpea-ajax-pagi', 'wpea_ajax', array(
325 'ajaxurl' => admin_url( 'admin-ajax.php' ),
326 ));
327 }
328
329 }
330
331 endif; // End If class exists check.
332
333 /**
334 * The main function for that returns WP_Event_Aggregator
335 *
336 * The main function responsible for returning the one true WP_Event_Aggregator
337 * Instance to functions everywhere.
338 *
339 * Use this function like you would a global variable, except without needing
340 * to declare the global.
341 *
342 * Example: <?php $importevents = xt_importevents(); ?>
343 *
344 * @since 1.0.0
345 * @return object|WP_Event_Aggregator The one true WP_Event_Aggregator Instance.
346 */
347 function wpea_run_wp_event_aggregator() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound
348 return WP_Event_Aggregator::instance();
349 }
350
351 /**
352 * Get Import events setting options
353 *
354 * @since 1.0
355 * @return void
356 */
357 function wpea_get_import_options( $type = '' ){
358
359 $wpea_options = get_option( WPEA_OPTIONS );
360 if( $type != '' ){
361 $wpea_options = isset( $wpea_options[$type] ) ? $wpea_options[$type] : array();
362 }
363 return $wpea_options;
364 }
365
366 // Get WP_Event_Aggregator Running.
367 global $importevents, $wpea_errors, $wpea_success_msg, $wpea_warnings, $wpea_info_msg;
368 $importevents = wpea_run_wp_event_aggregator(); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
369 $wpea_errors = $wpea_warnings = $wpea_success_msg = $wpea_info_msg = array();
370
371 /**
372 * The code that runs during plugin activation.
373 *
374 * @since 1.1.2
375 */
376 function wpea_activate_wp_event_aggregator() {
377 global $importevents;
378 $importevents->cpt->register_event_post_type();
379 flush_rewrite_rules();
380 add_option( 'wpea_plugin_activated', true );
381 }
382 register_activation_hook( __FILE__, 'wpea_activate_wp_event_aggregator' );
383