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

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