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

305 lines 10.0 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 Facebook Events
4 * Plugin URI: http://xylusthemes.com/plugins/import-facebook-events/
5 * Description: Import Facebook Events allows you to import Facebook ( facebook.com ) events into your WordPress site.
6 * Version: 1.6.0
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 <[email protected]>
16 */
17
18 // If this file is called directly, abort.
19 if ( ! defined( 'ABSPATH' ) ) exit;
20
21 if( ! class_exists( 'Import_Facebook_Events' ) ):
22
23 /**
24 * Main Import Facebook Events class
25 */
26 class Import_Facebook_Events{
27
28 /** Singleton *************************************************************/
29 /**
30 * Import_Facebook_Events The one true Import_Facebook_Events.
31 */
32 private static $instance;
33
34 /**
35 * Main Import Facebook Events Instance.
36 *
37 * Insure that only one instance of Import_Facebook_Events exists in memory at any one time.
38 * Also prevents needing to define globals all over the place.
39 *
40 * @since 1.0.0
41 * @static object $instance
42 * @uses Import_Facebook_Events::setup_constants() Setup the constants needed.
43 * @uses Import_Facebook_Events::includes() Include the required files.
44 * @uses Import_Facebook_Events::laod_textdomain() load the language files.
45 * @see run_import_facebook_events()
46 * @return object| Import Facebook Events the one true Import Facebook Events.
47 */
48 public static function instance() {
49 if( ! isset( self::$instance ) && ! (self::$instance instanceof Import_Facebook_Events ) ) {
50 self::$instance = new Import_Facebook_Events;
51 self::$instance->setup_constants();
52
53 add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) );
54 add_action( 'plugins_loaded', array( self::$instance, 'load_authorize_class' ), 20 );
55 add_action( 'wp_enqueue_scripts', array( self::$instance, 'ife_enqueue_style' ) );
56 add_action( 'wp_enqueue_scripts', array( self::$instance, 'ife_enqueue_script' ) );
57
58 self::$instance->includes();
59 self::$instance->common = new Import_Facebook_Events_Common();
60 self::$instance->cpt = new Import_Facebook_Events_Cpt();
61 self::$instance->facebook = new Import_Facebook_Events_Facebook();
62 self::$instance->ical_parser = new Import_Facebook_Events_Ical_Parser();
63 self::$instance->ical = new Import_Facebook_Events_Ical();
64 self::$instance->admin = new Import_Facebook_Events_Admin();
65 if( ife_is_pro() ){
66 self::$instance->manage_import = new Import_Facebook_Events_Pro_Manage_Import();
67 }else{
68 self::$instance->manage_import = new Import_Facebook_Events_Manage_Import();
69 }
70 self::$instance->ife = new Import_Facebook_Events_IFE();
71 self::$instance->tec = new Import_Facebook_Events_TEC();
72 self::$instance->em = new Import_Facebook_Events_EM();
73 self::$instance->eventon = new Import_Facebook_Events_EventON();
74 self::$instance->event_organizer = new Import_Facebook_Events_Event_Organizer();
75 self::$instance->aioec = new Import_Facebook_Events_Aioec();
76 self::$instance->my_calendar = new Import_Facebook_Events_My_Calendar();
77 self::$instance->ee4 = new Import_Facebook_Events_EE4();
78
79 }
80 return self::$instance;
81 }
82
83 /** Magic Methods *********************************************************/
84
85 /**
86 * A dummy constructor to prevent Import_Facebook_Events from being loaded more than once.
87 *
88 * @since 1.0.0
89 * @see Import_Facebook_Events::instance()
90 * @see run_import_facebook_events()
91 */
92 private function __construct() { /* Do nothing here */ }
93
94 /**
95 * A dummy magic method to prevent Import_Facebook_Events from being cloned.
96 *
97 * @since 1.0.0
98 */
99 public function __clone() { _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'import-facebook-events' ), '1.6.0' ); }
100
101 /**
102 * A dummy magic method to prevent Import_Facebook_Events from being unserialized.
103 *
104 * @since 1.0.0
105 */
106 public function __wakeup() { _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'import-facebook-events' ), '1.6.0' ); }
107
108
109 /**
110 * Setup plugins constants.
111 *
112 * @access private
113 * @since 1.0.0
114 * @return void
115 */
116 private function setup_constants() {
117
118 // Plugin version.
119 if( ! defined( 'IFE_VERSION' ) ){
120 define( 'IFE_VERSION', '1.6.0' );
121 }
122
123 // Minimum Pro plugin version.
124 if( ! defined( 'IFE_MIN_PRO_VERSION' ) ){
125 define( 'IFE_MIN_PRO_VERSION', '1.6.0' );
126 }
127
128 // Plugin folder Path.
129 if( ! defined( 'IFE_PLUGIN_DIR' ) ){
130 define( 'IFE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
131 }
132
133 // Plugin folder URL.
134 if( ! defined( 'IFE_PLUGIN_URL' ) ){
135 define( 'IFE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
136 }
137
138 // Plugin root file.
139 if( ! defined( 'IFE_PLUGIN_FILE' ) ){
140 define( 'IFE_PLUGIN_FILE', __FILE__ );
141 }
142
143 // Options
144 if( ! defined( 'IFE_OPTIONS' ) ){
145 define( 'IFE_OPTIONS', 'ife_facebook_options' );
146 }
147
148 // Pro plugin Buy now Link.
149 if( ! defined( 'IFE_PLUGIN_BUY_NOW_URL' ) ){
150 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' );
151 }
152 }
153
154 /**
155 * Include required files.
156 *
157 * @access private
158 * @since 1.0.0
159 * @return void
160 */
161 private function includes() {
162
163 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-common.php';
164 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-list-table.php';
165 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-admin.php';
166 if( ife_is_pro() ){
167 require_once IFEPRO_PLUGIN_DIR . 'includes/class-import-facebook-events-manage-import.php';
168 }else{
169 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-manage-import.php';
170 }
171 if( !class_exists( 'vcalendar' ) ){
172 require_once IFE_PLUGIN_DIR . 'includes/lib/iCalcreator/iCalcreator.php';
173 }
174
175 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-cpt.php';
176 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-facebook.php';
177 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-ical_parser.php';
178 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-ical.php';
179 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-ife.php';
180 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-tec.php';
181 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-em.php';
182 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-eventon.php';
183 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-event_organizer.php';
184 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-aioec.php';
185 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-my-calendar.php';
186 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-ee4.php';
187
188 }
189
190 /**
191 * Loads the plugin language files.
192 *
193 * @access public
194 * @since 1.0.0
195 * @return void
196 */
197 public function load_textdomain(){
198
199 load_plugin_textdomain(
200 'import-facebook-events',
201 false,
202 basename( dirname( __FILE__ ) ) . '/languages'
203 );
204
205 }
206
207 /**
208 * Loads the facebook authorize class
209 *
210 * @access public
211 * @since 1.5
212 * @return void
213 */
214 public function load_authorize_class(){
215
216 if( !class_exists( 'Import_Facebook_Events_Pro_FB_Authorize', false ) ){
217 include_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-fb-authorize.php';
218 global $ife_events;
219 if( class_exists('Import_Facebook_Events_FB_Authorize', false ) && !empty( $ife_events ) ){
220 $ife_events->fb_authorize = new Import_Facebook_Events_FB_Authorize();
221 }
222 }
223 }
224
225 /**
226 * enqueue style front-end
227 *
228 * @access public
229 * @since 1.0.0
230 * @return void
231 */
232 public function ife_enqueue_style() {
233
234 $css_dir = IFE_PLUGIN_URL . 'assets/css/';
235 wp_enqueue_style('font-awesome', $css_dir . 'font-awesome.min.css', false, "" );
236 wp_enqueue_style('import-facebook-events-front', $css_dir . 'import-facebook-events.css', false, "" );
237 }
238
239 /**
240 * enqueue script front-end
241 *
242 * @access public
243 * @since 1.0.0
244 * @return void
245 */
246 public function ife_enqueue_script() {
247
248 // enqueue script here.
249 }
250
251 }
252
253 endif; // End If class exists check.
254
255 /**
256 * The main function for that returns Import_Facebook_Events
257 *
258 * The main function responsible for returning the one true Import_Facebook_Events
259 * Instance to functions everywhere.
260 *
261 * Use this function like you would a global variable, except without needing
262 * to declare the global.
263 *
264 * Example: <?php $ife_events = run_import_facebook_events(); ?>
265 *
266 * @since 1.0.0
267 * @return object|Import_Facebook_Events The one true Import_Facebook_Events Instance.
268 */
269 function run_import_facebook_events() {
270 return Import_Facebook_Events::instance();
271 }
272
273 /**
274 * Get Import events setting options
275 *
276 * @since 1.0
277 * @return array
278 */
279 function ife_get_import_options( $type = '' ) {
280
281 $ife_options = get_option( IFE_OPTIONS );
282 if ( $type != '' && $type == 'facebook' ) {
283 return $ife_options;
284 //$ife_options = isset( $ife_options[ $type ] ) ? $ife_options[ $type ] : array();
285 }
286 return $ife_options;
287 }
288
289 // Get Import_Facebook_Events Running.
290 global $ife_events, $ife_errors, $ife_success_msg, $ife_warnings, $ife_info_msg;
291 $ife_events = run_import_facebook_events();
292 $ife_errors = $ife_warnings = $ife_success_msg = $ife_info_msg = array();
293
294 /**
295 * The code that runs during plugin activation.
296 *
297 * @since 1.0
298 */
299 function ife_activate_import_facebook_events() {
300 global $ife_events;
301 $ife_events->cpt->register_event_post_type();
302 flush_rewrite_rules();
303 }
304 register_activation_hook( __FILE__, 'ife_activate_import_facebook_events' );
305