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

274 lines 8.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 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.5.2
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' ) ) 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( 'wp_enqueue_scripts', array( self::$instance, 'ife_enqueue_style' ) );
55 add_action( 'wp_enqueue_scripts', array( self::$instance, 'ife_enqueue_script' ) );
56
57 self::$instance->includes();
58 self::$instance->common = new Import_Facebook_Events_Common();
59 self::$instance->cpt = new Import_Facebook_Events_Cpt();
60 self::$instance->facebook = new Import_Facebook_Events_Facebook();
61 self::$instance->admin = new Import_Facebook_Events_Admin();
62 if( ife_is_pro() ){
63 self::$instance->manage_import = new Import_Facebook_Events_Pro_Manage_Import();
64 }else{
65 self::$instance->manage_import = new Import_Facebook_Events_Manage_Import();
66 }
67 self::$instance->ife = new Import_Facebook_Events_IFE();
68 self::$instance->tec = new Import_Facebook_Events_TEC();
69 self::$instance->em = new Import_Facebook_Events_EM();
70 self::$instance->eventon = new Import_Facebook_Events_EventON();
71 self::$instance->event_organizer = new Import_Facebook_Events_Event_Organizer();
72 self::$instance->aioec = new Import_Facebook_Events_Aioec();
73 self::$instance->my_calendar = new Import_Facebook_Events_My_Calendar();
74 self::$instance->ee4 = new Import_Facebook_Events_EE4();
75
76 }
77 return self::$instance;
78 }
79
80 /** Magic Methods *********************************************************/
81
82 /**
83 * A dummy constructor to prevent Import_Facebook_Events from being loaded more than once.
84 *
85 * @since 1.0.0
86 * @see Import_Facebook_Events::instance()
87 * @see run_import_facebook_events()
88 */
89 private function __construct() { /* Do nothing here */ }
90
91 /**
92 * A dummy magic method to prevent Import_Facebook_Events from being cloned.
93 *
94 * @since 1.0.0
95 */
96 public function __clone() { _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'import-facebook-events' ), '1.5.2' ); }
97
98 /**
99 * A dummy magic method to prevent Import_Facebook_Events from being unserialized.
100 *
101 * @since 1.0.0
102 */
103 public function __wakeup() { _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'import-facebook-events' ), '1.5.2' ); }
104
105
106 /**
107 * Setup plugins constants.
108 *
109 * @access private
110 * @since 1.0.0
111 * @return void
112 */
113 private function setup_constants() {
114
115 // Plugin version.
116 if( ! defined( 'IFE_VERSION' ) ){
117 define( 'IFE_VERSION', '1.5.2' );
118 }
119
120 // Plugin folder Path.
121 if( ! defined( 'IFE_PLUGIN_DIR' ) ){
122 define( 'IFE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
123 }
124
125 // Plugin folder URL.
126 if( ! defined( 'IFE_PLUGIN_URL' ) ){
127 define( 'IFE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
128 }
129
130 // Plugin root file.
131 if( ! defined( 'IFE_PLUGIN_FILE' ) ){
132 define( 'IFE_PLUGIN_FILE', __FILE__ );
133 }
134
135 // Options
136 if( ! defined( 'IFE_OPTIONS' ) ){
137 define( 'IFE_OPTIONS', 'ife_facebook_options' );
138 }
139
140 // Pro plugin Buy now Link.
141 if( ! defined( 'IFE_PLUGIN_BUY_NOW_URL' ) ){
142 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' );
143 }
144 }
145
146 /**
147 * Include required files.
148 *
149 * @access private
150 * @since 1.0.0
151 * @return void
152 */
153 private function includes() {
154
155 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-common.php';
156 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-list-table.php';
157 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-admin.php';
158 if( ife_is_pro() ){
159 require_once IFEPRO_PLUGIN_DIR . 'includes/class-import-facebook-events-manage-import.php';
160 }else{
161 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-manage-import.php';
162 }
163
164 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-cpt.php';
165 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-facebook.php';
166 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-ife.php';
167 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-tec.php';
168 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-em.php';
169 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-eventon.php';
170 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-event_organizer.php';
171 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-aioec.php';
172 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-my-calendar.php';
173 require_once IFE_PLUGIN_DIR . 'includes/class-import-facebook-events-ee4.php';
174
175 }
176
177 /**
178 * Loads the plugin language files.
179 *
180 * @access public
181 * @since 1.0.0
182 * @return void
183 */
184 public function load_textdomain(){
185
186 load_plugin_textdomain(
187 'import-facebook-events',
188 false,
189 basename( dirname( __FILE__ ) ) . '/languages'
190 );
191
192 }
193
194 /**
195 * enqueue style front-end
196 *
197 * @access public
198 * @since 1.0.0
199 * @return void
200 */
201 public function ife_enqueue_style() {
202
203 $css_dir = IFE_PLUGIN_URL . 'assets/css/';
204 wp_enqueue_style('font-awesome', $css_dir . 'font-awesome.min.css', false, "" );
205 wp_enqueue_style('import-facebook-events-front', $css_dir . 'import-facebook-events.css', false, "" );
206 }
207
208 /**
209 * enqueue script front-end
210 *
211 * @access public
212 * @since 1.0.0
213 * @return void
214 */
215 public function ife_enqueue_script() {
216
217 // enqueue script here.
218 }
219
220 }
221
222 endif; // End If class exists check.
223
224 /**
225 * The main function for that returns Import_Facebook_Events
226 *
227 * The main function responsible for returning the one true Import_Facebook_Events
228 * Instance to functions everywhere.
229 *
230 * Use this function like you would a global variable, except without needing
231 * to declare the global.
232 *
233 * Example: <?php $ife_events = run_import_facebook_events(); ?>
234 *
235 * @since 1.0.0
236 * @return object|Import_Facebook_Events The one true Import_Facebook_Events Instance.
237 */
238 function run_import_facebook_events() {
239 return Import_Facebook_Events::instance();
240 }
241
242 /**
243 * Get Import events setting options
244 *
245 * @since 1.0
246 * @return array
247 */
248 function ife_get_import_options( $type = '' ) {
249
250 $ife_options = get_option( IFE_OPTIONS );
251 if ( $type != '' && $type == 'facebook' ) {
252 return $ife_options;
253 //$ife_options = isset( $ife_options[ $type ] ) ? $ife_options[ $type ] : array();
254 }
255 return $ife_options;
256 }
257
258 // Get Import_Facebook_Events Running.
259 global $ife_events, $ife_errors, $ife_success_msg, $ife_warnings, $ife_info_msg;
260 $ife_events = run_import_facebook_events();
261 $ife_errors = $ife_warnings = $ife_success_msg = $ife_info_msg = array();
262
263 /**
264 * The code that runs during plugin activation.
265 *
266 * @since 1.0
267 */
268 function ife_activate_import_facebook_events() {
269 global $ife_events;
270 $ife_events->cpt->register_event_post_type();
271 flush_rewrite_rules();
272 }
273 register_activation_hook( __FILE__, 'ife_activate_import_facebook_events' );
274