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

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