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

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