PluginProbe
Import Social Events / 1.8.8
Import Social Events v1.8.8
1.9.1 1.9.0 trunk 1.0.0 1.0.1 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.2.0 1.3.0 1.4.0 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.6.0 1.6.1 1.6.10 1.6.11 1.6.12 All 61 releases
import-facebook-events / import-facebook-events.php

import-facebook-events.php in Import Social Events 1.8.8, at import-facebook-events.php

360 lines 12.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Import Social Events
4 * Plugin URI: http://xylusthemes.com/plugins/import-facebook-events/
5 * Description: Import Social Events allows you to import Facebook ( facebook.com ) events into your WordPress site.
6 * Version: 1.8.8
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: import-facebook-events
12 * Domain Path: /languages
13 *
14 * @package Import_Facebook_Events
15 * @author Dharmesh Patel <dspatel44@gmail.com>
16 */
17
18 // If this file is called directly, abort.
19 if ( ! defined( 'ABSPATH' ) ) {
20 exit;
21 }
22
23 if ( ! class_exists( 'Import_Facebook_Events' ) ) :
24
25 /**
26 * Main Import Facebook Events class
27 */
28 class Import_Facebook_Events {
29
30 /** Singleton *************************************************************/
31 /**
32 * Import_Facebook_Events The one true Import_Facebook_Events.
33 *
34 * @var object Instance of Import_Facebook_Events
35 */
36 private static $instance;
37 public $common, $cpt, $facebook, $admin, $manage_import, $ife, $tec, $em, $eventon, $event_organizer, $aioec, $my_calendar, $ee4, $ical_parser, $ical, $fb_authorize, $common_pro, $facebook_pro, $cron, $ical_parser_aioec, $eventprime, $ajax;
38
39 /**
40 * Main Import Facebook Events Instance.
41 *
42 * Insure that only one instance of Import_Facebook_Events exists in memory at any one time.
43 * Also prevents needing to define globals all over the place.
44 *
45 * @since 1.0.0
46 * @static object $instance
47 * @uses Import_Facebook_Events::setup_constants() Setup the constants needed.
48 * @uses Import_Facebook_Events::includes() Include the required files.
49 * @uses Import_Facebook_Events::laod_textdomain() load the language files.
50 * @see run_import_facebook_events()
51 * @return object| Import Facebook Events the one true Import Facebook Events.
52 */
53 public static function instance() {
54 if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Import_Facebook_Events ) ) {
55 self::$instance = new Import_Facebook_Events();
56 self::$instance->setup_constants();
57
58 add_action( 'init', array( self::$instance, 'load_textdomain' ) );
59 add_action( 'plugins_loaded', array( self::$instance, 'load_authorize_class' ), 20 );
60 add_action( 'wp_enqueue_scripts', array( self::$instance, 'ife_enqueue_style' ) );
61 add_action( 'wp_enqueue_scripts', array( self::$instance, 'ife_enqueue_script' ) );
62 add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), array( self::$instance, 'ife_setting_doc_links' ) );
63
64 self::$instance->includes();
65 self::$instance->common = new Import_Facebook_Events_Common();
66 self::$instance->ajax = new Import_Facebook_Events_Ajax();
67 self::$instance->cpt = new Import_Facebook_Events_Cpt();
68 self::$instance->facebook = new Import_Facebook_Events_Facebook();
69 self::$instance->admin = new Import_Facebook_Events_Admin();
70
71 self::$instance->ical_parser = new Import_Facebook_Events_Ical_Parser();
72 self::$instance->ical_parser_aioec = new Import_Facebook_Events_Ical_Parser_AIOEC();
73 self::$instance->ical = new Import_Facebook_Events_Ical();
74 if ( ife_is_pro() ) {
75 self::$instance->manage_import = new Import_Facebook_Events_Pro_Manage_Import();
76 } else {
77 self::$instance->manage_import = new Import_Facebook_Events_Manage_Import();
78 }
79 self::$instance->ife = new Import_Facebook_Events_IFE();
80 self::$instance->tec = new Import_Facebook_Events_TEC();
81 self::$instance->em = new Import_Facebook_Events_EM();
82 self::$instance->eventon = new Import_Facebook_Events_EventON();
83 self::$instance->event_organizer = new Import_Facebook_Events_Event_Organizer();
84 self::$instance->aioec = new Import_Facebook_Events_Aioec();
85 self::$instance->my_calendar = new Import_Facebook_Events_My_Calendar();
86 self::$instance->ee4 = new Import_Facebook_Events_EE4();
87 self::$instance->eventprime = new Import_Facebook_Events_EventPrime();
88 }
89 return self::$instance;
90 }
91
92 /** Magic Methods *********************************************************/
93
94 /**
95 * A dummy constructor to prevent Import_Facebook_Events from being loaded more than once.
96 *
97 * @since 1.0.0
98 * @see Import_Facebook_Events::instance()
99 * @see run_import_facebook_events()
100 */
101 private function __construct() {
102 /* Do nothing here */ }
103
104 /**
105 * A dummy magic method to prevent Import_Facebook_Events from being cloned.
106 *
107 * @since 1.0.0
108 */
109 public function __clone() {
110 _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin&#8217; huh?', 'import-facebook-events' ), '1.8.8' ); }
111
112 /**
113 * A dummy magic method to prevent Import_Facebook_Events from being unserialized.
114 *
115 * @since 1.0.0
116 */
117 public function __wakeup() {
118 _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin&#8217; huh?', 'import-facebook-events' ), '1.8.8' ); }
119
120
121 /**
122 * Setup plugins constants.
123 *
124 * @access private
125 * @since 1.0.0
126 * @return void
127 */
128 private function setup_constants() {
129
130 // Plugin version.
131 if ( ! defined( 'IFE_VERSION' ) ) {
132 define( 'IFE_VERSION', '1.8.8' );
133 }
134
135 // Minimum Pro plugin version.
136 if ( ! defined( 'IFE_MIN_PRO_VERSION' ) ) {
137 define( 'IFE_MIN_PRO_VERSION', '1.7.9' );
138 }
139
140 // Plugin folder Path.
141 if ( ! defined( 'IFE_PLUGIN_DIR' ) ) {
142 define( 'IFE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
143 }
144
145 // Plugin folder URL.
146 if ( ! defined( 'IFE_PLUGIN_URL' ) ) {
147 define( 'IFE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
148 }
149
150 // Plugin root file.
151 if ( ! defined( 'IFE_PLUGIN_FILE' ) ) {
152 define( 'IFE_PLUGIN_FILE', __FILE__ );
153 }
154
155 // Options.
156 if ( ! defined( 'IFE_OPTIONS' ) ) {
157 define( 'IFE_OPTIONS', 'ife_facebook_options' );
158 }
159
160 // Pro plugin Buy now Link.
161 if ( ! defined( 'IFE_PLUGIN_BUY_NOW_URL' ) ) {
162 define( 'IFE_PLUGIN_BUY_NOW_URL', 'http://xylusthemes.com/plugins/import-facebook-events/?utm_source=insideplugin&utm_medium=web&utm_content=sidebar&utm_campaign=freeplugin' );
163 }
164 }
165
166 /**
167 * Include required files.
168 *
169 * @access private
170 * @since 1.0.0
171 * @return void
172 */
173 private function includes() {
174
175 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-common.php';
176 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-ajax.php';
177 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-list-table.php';
178 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-admin.php';
179 if ( ife_is_pro() ) {
180 require_once IFEPRO_PLUGIN_DIR . 'includes/class-import-facebook-events-manage-import.php';
181 } else {
182 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-manage-import.php';
183 }
184
185 if( !class_exists( 'Kigkonsult\Icalcreator\Vcalendar' ) ){
186 require_once IFE_PLUGIN_DIR . 'includes/lib/icalcreator/autoload.php';
187 }
188 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-ical_parser.php';
189 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-ical_parser_aioec.php';
190 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-ical.php';
191 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-cpt.php';
192 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-facebook.php';
193 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-ife.php';
194 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-tec.php';
195 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-em.php';
196 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-eventon.php';
197 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-event-organizer.php';
198 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-aioec.php';
199 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-my-calendar.php';
200 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-ee4.php';
201 require_once IFE_PLUGIN_DIR . 'includes/class-ife-plugin-deactivation.php';
202 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-eventprime.php';
203 // Gutenberg Block.
204 require_once IFE_PLUGIN_DIR . 'blocks/facebook-events/index.php';
205 }
206
207 /**
208 * Loads the plugin language files.
209 *
210 * @access public
211 * @since 1.0.0
212 * @return void
213 */
214 public function load_textdomain() {
215
216 load_plugin_textdomain(
217 'import-facebook-events',
218 false,
219 basename( dirname( __FILE__ ) ) . '/languages'
220 );
221
222 }
223
224 /**
225 * IFE setting And docs link add in plugin page.
226 *
227 * @since 1.0
228 * @return void
229 */
230 public function ife_setting_doc_links ( $links ) {
231 $upgrate_to_pro = '';
232 if( !ife_is_pro() ){
233 $upgrate_to_pro = sprintf(
234 '<a href="%s" target="_blank" style="color:#1da867;font-weight: 900;">%s</a>',
235 esc_url( 'https://xylusthemes.com/plugins/import-facebook-events/' ),
236 esc_html__( 'Upgrade to Pro', 'import-facebook-events' )
237 );
238 }
239
240 $ife_setting_doc_link = array(
241 'ife-event-setting' => sprintf(
242 '<a href="%s">%s</a>',
243 esc_url( admin_url( 'admin.php?page=facebook_import&tab=settings' ) ),
244 esc_html__( 'Setting', 'import-facebook-events' )
245 ),
246 'ife-event-docs' => sprintf(
247 '<a target="_blank" href="%s">%s</a>',
248 esc_url( 'https://docs.xylusthemes.com/docs/import-facebook-events/' ),
249 esc_html__( 'Docs', 'import-facebook-events' )
250 ),
251 'ife-event-pro-link' => $upgrate_to_pro,
252 );
253 return array_merge( $links, $ife_setting_doc_link );
254 }
255
256 /**
257 * Loads the facebook authorize class
258 *
259 * @access public
260 * @since 1.5
261 * @return void
262 */
263 public function load_authorize_class() {
264
265 if ( ! class_exists( 'Import_Facebook_Events_Pro_FB_Authorize', false ) ) {
266 include_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-fb-authorize.php';
267 global $ife_events;
268 if ( class_exists( 'Import_Facebook_Events_FB_Authorize', false ) && ! empty( $ife_events ) ) {
269 $ife_events->fb_authorize = new Import_Facebook_Events_FB_Authorize();
270 }
271 }
272 }
273
274 /**
275 * Enqueue style front-end
276 *
277 * @access public
278 * @since 1.0.0
279 * @return void
280 */
281 public function ife_enqueue_style() {
282
283 $css_dir = IFE_PLUGIN_URL . 'assets/css/';
284 wp_enqueue_style( 'font-awesome', $css_dir . 'font-awesome.min.css', false, IFE_VERSION );
285 wp_enqueue_style( 'import-facebook-events-front', $css_dir . 'import-facebook-events.css', false, IFE_VERSION );
286 wp_enqueue_style( 'import-facebook-events-front-style2', $css_dir . 'grid-style2.css', false, IFE_VERSION );
287 }
288
289 /**
290 * Enqueue script front-end
291 *
292 * @access public
293 * @since 1.0.0
294 * @return void
295 */
296 public function ife_enqueue_script() {
297
298 // Enqueue script here.
299 $js_dir = IFE_PLUGIN_URL . 'assets/js/';
300 wp_enqueue_script( 'ife-ajax-pagi', $js_dir . 'ife-ajax-pagi.js', array( 'jquery' ), IFE_VERSION, true );
301 wp_localize_script( 'ife-ajax-pagi', 'ife_ajax', array(
302 'ajaxurl' => admin_url( 'admin-ajax.php' ),
303 ));
304 }
305
306 }
307
308 endif; // End If class exists check.
309
310 /**
311 * The main function for that returns Import_Facebook_Events
312 *
313 * The main function responsible for returning the one true Import_Facebook_Events
314 * Instance to functions everywhere.
315 *
316 * Use this function like you would a global variable, except without needing
317 * to declare the global.
318 *
319 * Example: <?php $ife_events = run_import_facebook_events(); ?>
320 *
321 * @since 1.0.0
322 * @return object|Import_Facebook_Events The one true Import_Facebook_Events Instance.
323 */
324 function run_import_facebook_events() {
325 return Import_Facebook_Events::instance();
326 }
327
328 /**
329 * Get Import events setting options
330 *
331 * @since 1.0
332 * @param string $type origin for requested options.
333 * @return array
334 */
335 function ife_get_import_options( $type = '' ) {
336 $ife_options = get_option( IFE_OPTIONS );
337 return $ife_options;
338 }
339
340 // Get Import_Facebook_Events Running.
341 global $ife_events, $ife_errors, $ife_success_msg, $ife_warnings, $ife_info_msg;
342 $ife_errors = array();
343 $ife_warnings = array();
344 $ife_success_msg = array();
345 $ife_info_msg = array();
346 $ife_events = run_import_facebook_events();
347
348 /**
349 * The code that runs during plugin activation.
350 *
351 * @since 1.0
352 */
353 function ife_activate_import_facebook_events() {
354 global $ife_events;
355 $ife_events->cpt->register_event_post_type();
356 flush_rewrite_rules();
357 add_option( 'ife_plugin_activated', true );
358 }
359 register_activation_hook( __FILE__, 'ife_activate_import_facebook_events' );
360