PluginProbe
Import Social Events / 1.8.9
Import Social Events v1.8.9
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.9, at import-facebook-events.php

362 lines 12.8 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.9
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, $htmltblock;
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 self::$instance->htmltblock = new Import_Facebook_Events_Html_To_Blocks();
71
72 self::$instance->ical_parser = new Import_Facebook_Events_Ical_Parser();
73 self::$instance->ical_parser_aioec = new Import_Facebook_Events_Ical_Parser_AIOEC();
74 self::$instance->ical = new Import_Facebook_Events_Ical();
75 if ( ife_is_pro() ) {
76 self::$instance->manage_import = new Import_Facebook_Events_Pro_Manage_Import();
77 } else {
78 self::$instance->manage_import = new Import_Facebook_Events_Manage_Import();
79 }
80 self::$instance->ife = new Import_Facebook_Events_IFE();
81 self::$instance->tec = new Import_Facebook_Events_TEC();
82 self::$instance->em = new Import_Facebook_Events_EM();
83 self::$instance->eventon = new Import_Facebook_Events_EventON();
84 self::$instance->event_organizer = new Import_Facebook_Events_Event_Organizer();
85 self::$instance->aioec = new Import_Facebook_Events_Aioec();
86 self::$instance->my_calendar = new Import_Facebook_Events_My_Calendar();
87 self::$instance->ee4 = new Import_Facebook_Events_EE4();
88 self::$instance->eventprime = new Import_Facebook_Events_EventPrime();
89 }
90 return self::$instance;
91 }
92
93 /** Magic Methods *********************************************************/
94
95 /**
96 * A dummy constructor to prevent Import_Facebook_Events from being loaded more than once.
97 *
98 * @since 1.0.0
99 * @see Import_Facebook_Events::instance()
100 * @see run_import_facebook_events()
101 */
102 private function __construct() {
103 /* Do nothing here */ }
104
105 /**
106 * A dummy magic method to prevent Import_Facebook_Events from being cloned.
107 *
108 * @since 1.0.0
109 */
110 public function __clone() {
111 _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin&#8217; huh?', 'import-facebook-events' ), '1.8.9' ); }
112
113 /**
114 * A dummy magic method to prevent Import_Facebook_Events from being unserialized.
115 *
116 * @since 1.0.0
117 */
118 public function __wakeup() {
119 _doing_it_wrong( __FUNCTION__, esc_attr__( 'Cheatin&#8217; huh?', 'import-facebook-events' ), '1.8.9' ); }
120
121
122 /**
123 * Setup plugins constants.
124 *
125 * @access private
126 * @since 1.0.0
127 * @return void
128 */
129 private function setup_constants() {
130
131 // Plugin version.
132 if ( ! defined( 'IFE_VERSION' ) ) {
133 define( 'IFE_VERSION', '1.8.9' );
134 }
135
136 // Minimum Pro plugin version.
137 if ( ! defined( 'IFE_MIN_PRO_VERSION' ) ) {
138 define( 'IFE_MIN_PRO_VERSION', '1.7.9' );
139 }
140
141 // Plugin folder Path.
142 if ( ! defined( 'IFE_PLUGIN_DIR' ) ) {
143 define( 'IFE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
144 }
145
146 // Plugin folder URL.
147 if ( ! defined( 'IFE_PLUGIN_URL' ) ) {
148 define( 'IFE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
149 }
150
151 // Plugin root file.
152 if ( ! defined( 'IFE_PLUGIN_FILE' ) ) {
153 define( 'IFE_PLUGIN_FILE', __FILE__ );
154 }
155
156 // Options.
157 if ( ! defined( 'IFE_OPTIONS' ) ) {
158 define( 'IFE_OPTIONS', 'ife_facebook_options' );
159 }
160
161 // Pro plugin Buy now Link.
162 if ( ! defined( 'IFE_PLUGIN_BUY_NOW_URL' ) ) {
163 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' );
164 }
165 }
166
167 /**
168 * Include required files.
169 *
170 * @access private
171 * @since 1.0.0
172 * @return void
173 */
174 private function includes() {
175
176 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-common.php';
177 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-ajax.php';
178 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-list-table.php';
179 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-admin.php';
180 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-html-to-blocks.php';
181 if ( ife_is_pro() ) {
182 require_once IFEPRO_PLUGIN_DIR . 'includes/class-import-facebook-events-manage-import.php';
183 } else {
184 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-manage-import.php';
185 }
186
187 if( !class_exists( 'Kigkonsult\Icalcreator\Vcalendar' ) ){
188 require_once IFE_PLUGIN_DIR . 'includes/lib/icalcreator/autoload.php';
189 }
190 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-ical_parser.php';
191 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-ical_parser_aioec.php';
192 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-ical.php';
193 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-cpt.php';
194 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-facebook.php';
195 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-ife.php';
196 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-tec.php';
197 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-em.php';
198 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-eventon.php';
199 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-event-organizer.php';
200 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-aioec.php';
201 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-my-calendar.php';
202 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-ee4.php';
203 require_once IFE_PLUGIN_DIR . 'includes/class-ife-plugin-deactivation.php';
204 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-eventprime.php';
205 // Gutenberg Block.
206 require_once IFE_PLUGIN_DIR . 'blocks/facebook-events/index.php';
207 }
208
209 /**
210 * Loads the plugin language files.
211 *
212 * @access public
213 * @since 1.0.0
214 * @return void
215 */
216 public function load_textdomain() {
217
218 load_plugin_textdomain(
219 'import-facebook-events',
220 false,
221 basename( dirname( __FILE__ ) ) . '/languages'
222 );
223
224 }
225
226 /**
227 * IFE setting And docs link add in plugin page.
228 *
229 * @since 1.0
230 * @return void
231 */
232 public function ife_setting_doc_links ( $links ) {
233 $upgrate_to_pro = '';
234 if( !ife_is_pro() ){
235 $upgrate_to_pro = sprintf(
236 '<a href="%s" target="_blank" style="color:#1da867;font-weight: 900;">%s</a>',
237 esc_url( 'https://xylusthemes.com/plugins/import-facebook-events/' ),
238 esc_html__( 'Upgrade to Pro', 'import-facebook-events' )
239 );
240 }
241
242 $ife_setting_doc_link = array(
243 'ife-event-setting' => sprintf(
244 '<a href="%s">%s</a>',
245 esc_url( admin_url( 'admin.php?page=facebook_import&tab=settings' ) ),
246 esc_html__( 'Setting', 'import-facebook-events' )
247 ),
248 'ife-event-docs' => sprintf(
249 '<a target="_blank" href="%s">%s</a>',
250 esc_url( 'https://docs.xylusthemes.com/docs/import-facebook-events/' ),
251 esc_html__( 'Docs', 'import-facebook-events' )
252 ),
253 'ife-event-pro-link' => $upgrate_to_pro,
254 );
255 return array_merge( $links, $ife_setting_doc_link );
256 }
257
258 /**
259 * Loads the facebook authorize class
260 *
261 * @access public
262 * @since 1.5
263 * @return void
264 */
265 public function load_authorize_class() {
266
267 if ( ! class_exists( 'Import_Facebook_Events_Pro_FB_Authorize', false ) ) {
268 include_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-fb-authorize.php';
269 global $ife_events;
270 if ( class_exists( 'Import_Facebook_Events_FB_Authorize', false ) && ! empty( $ife_events ) ) {
271 $ife_events->fb_authorize = new Import_Facebook_Events_FB_Authorize();
272 }
273 }
274 }
275
276 /**
277 * Enqueue style front-end
278 *
279 * @access public
280 * @since 1.0.0
281 * @return void
282 */
283 public function ife_enqueue_style() {
284
285 $css_dir = IFE_PLUGIN_URL . 'assets/css/';
286 wp_enqueue_style( 'font-awesome', $css_dir . 'font-awesome.min.css', false, IFE_VERSION );
287 wp_enqueue_style( 'import-facebook-events-front', $css_dir . 'import-facebook-events.css', false, IFE_VERSION );
288 wp_enqueue_style( 'import-facebook-events-front-style2', $css_dir . 'grid-style2.css', false, IFE_VERSION );
289 }
290
291 /**
292 * Enqueue script front-end
293 *
294 * @access public
295 * @since 1.0.0
296 * @return void
297 */
298 public function ife_enqueue_script() {
299
300 // Enqueue script here.
301 $js_dir = IFE_PLUGIN_URL . 'assets/js/';
302 wp_enqueue_script( 'ife-ajax-pagi', $js_dir . 'ife-ajax-pagi.js', array( 'jquery' ), IFE_VERSION, true );
303 wp_localize_script( 'ife-ajax-pagi', 'ife_ajax', array(
304 'ajaxurl' => admin_url( 'admin-ajax.php' ),
305 ));
306 }
307
308 }
309
310 endif; // End If class exists check.
311
312 /**
313 * The main function for that returns Import_Facebook_Events
314 *
315 * The main function responsible for returning the one true Import_Facebook_Events
316 * Instance to functions everywhere.
317 *
318 * Use this function like you would a global variable, except without needing
319 * to declare the global.
320 *
321 * Example: <?php $ife_events = run_import_facebook_events(); ?>
322 *
323 * @since 1.0.0
324 * @return object|Import_Facebook_Events The one true Import_Facebook_Events Instance.
325 */
326 function run_import_facebook_events() {
327 return Import_Facebook_Events::instance();
328 }
329
330 /**
331 * Get Import events setting options
332 *
333 * @since 1.0
334 * @param string $type origin for requested options.
335 * @return array
336 */
337 function ife_get_import_options( $type = '' ) {
338 $ife_options = get_option( IFE_OPTIONS );
339 return $ife_options;
340 }
341
342 // Get Import_Facebook_Events Running.
343 global $ife_events, $ife_errors, $ife_success_msg, $ife_warnings, $ife_info_msg;
344 $ife_errors = array();
345 $ife_warnings = array();
346 $ife_success_msg = array();
347 $ife_info_msg = array();
348 $ife_events = run_import_facebook_events();
349
350 /**
351 * The code that runs during plugin activation.
352 *
353 * @since 1.0
354 */
355 function ife_activate_import_facebook_events() {
356 global $ife_events;
357 $ife_events->cpt->register_event_post_type();
358 flush_rewrite_rules();
359 add_option( 'ife_plugin_activated', true );
360 }
361 register_activation_hook( __FILE__, 'ife_activate_import_facebook_events' );
362