PluginProbe
WP Events Manager / trunk
WP Events Manager vtrunk
trunk 2.1.11 2.1.4 2.1.6 2.1.7 2.1.7.1 2.1.7.2 2.1.7.3 2.1.7.4 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5
wp-events-manager / wp-events-manager.php

wp-events-manager.php in WP Events Manager trunk, at wp-events-manager.php

172 lines 4.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 Plugin Name: WP Events Manager
4 Plugin URI: http://thimpress.com/
5 Description: A complete plugin for Events management and online booking system
6 Author: ThimPress
7 Version: 2.1.10
8 Author URI: http://thimpress.com
9 */
10
11 if ( ! defined( 'ABSPATH' ) ) {
12 exit();
13 }
14
15 /**
16 * WPEMS class
17 */
18 if ( ! class_exists( 'WPEMS' ) ) {
19
20 final class WPEMS {
21
22 private static $_instance = null;
23
24 public $_session = null;
25
26 /**
27 * WPEMS constructor.
28 */
29 public function __construct() {
30 $this->define_constants();
31 $this->includes();
32 $this->init_hooks();
33 }
34
35 /**
36 * Define Plugins Constants
37 */
38 public function define_constants() {
39 $this->set_define( 'WPEMS_PATH', plugin_dir_path( __FILE__ ) );
40 $this->set_define( 'WPEMS_URI', plugin_dir_url( __FILE__ ) );
41 $this->set_define( 'WPEMS_INC', WPEMS_PATH . 'inc/' );
42 $this->set_define( 'WPEMS_INC_URI', WPEMS_URI . 'inc/' );
43 $this->set_define( 'WPEMS_ASSETS_URI', WPEMS_URI . 'assets/' );
44 $this->set_define( 'WPEMS_LIB_URI', WPEMS_INC_URI . 'libraries/' );
45 $this->set_define( 'WPEMS_VER', '2.1.8' );
46 $this->set_define( 'WPEMS_MAIN_FILE', __FILE__ );
47 }
48
49 public function set_define( $name = '', $value = '' ) {
50 if ( $name && ! defined( $name ) ) {
51 define( $name, $value );
52 }
53 }
54
55 /**
56 * Init hooks plugins
57 * @since 2.0
58 */
59 public function init_hooks() {
60 // plugin loaded
61 add_action( 'plugins_loaded', array( $this, 'loaded' ) );
62 }
63
64 /**
65 * Load components when plugin loaded
66 */
67 public function loaded() {
68 // load text domain
69 $this->text_domain();
70 $this->_session = new WPEMS_Session();
71
72 do_action( 'wpems_init', $this );
73 }
74
75 /**
76 * Include files.
77 */
78 public function includes() {
79
80 $this->_include( 'inc/wpems-core-functions.php' );
81 $this->_include( 'inc/class-wpems-autoloader.php' );
82 $this->_include( 'inc/class-wpems-assets.php' );
83 $this->_include( 'inc/class-wpems-ajax.php' );
84 $this->_include( 'inc/class-wpems-post-types.php' );
85 $this->_include( 'inc/emails/class-wpems-register-event.php' );
86 $this->_include( 'inc/class-wpems-payment-gateways.php' );
87 $this->_include( 'inc/class-wpems-install.php' );
88 $this->_include( 'inc/class-wpems-settings.php' );
89 $this->_include( 'inc/class-wpems-session.php' );
90 $this->_include( 'inc/class-wpems-booking.php' );
91 $this->_include( 'inc/class-wpems-event.php' );
92 $this->settings = WPEMS_Settings::instance();
93
94 if ( is_admin() ) {
95 $this->_include( 'inc/admin/class-wpems-admin.php' );
96 } else {
97 $this->_include( 'inc/class-wpems-template.php' );
98 $this->_include( 'inc/class-wpems-frontend-assets.php' );
99 $this->_include( 'inc/class-wpems-user-process.php' );
100 $this->_include( 'inc/class-wpems-shortcodes.php' );
101 }
102
103 $this->_include( 'inc/class-wpems-gdpr.php' );
104
105 }
106
107 /**
108 * Include single file
109 *
110 * @param $file
111 */
112 public function _include( $file = null ) {
113 if ( is_array( $file ) ) {
114 foreach ( $file as $key => $f ) {
115 if ( file_exists( WPEMS_PATH . $f ) ) {
116 require_once WPEMS_PATH . $f;
117 }
118 }
119 } else {
120 if ( file_exists( WPEMS_PATH . $file ) ) {
121 require_once WPEMS_PATH . $file;
122 } elseif ( file_exists( $file ) ) {
123 require_once $file;
124 }
125 }
126 }
127
128 /**
129 * load text domain
130 * @return null
131 */
132 public function text_domain() {
133 // Get mo file
134 $text_domain = 'wp-events-manager';
135 $locale = apply_filters( 'plugin_locale', get_locale(), $text_domain );
136 $mo_file = $text_domain . '-' . $locale . '.mo';
137 // Check mo file global
138 $mo_global = WP_LANG_DIR . '/plugins/' . $mo_file;
139 // Load translate file
140 if ( file_exists( $mo_global ) ) {
141 load_textdomain( $text_domain, $mo_global );
142 } else {
143 load_textdomain( $text_domain, WPEMS_PATH . '/languages/' . $mo_file );
144 }
145 }
146
147 /**
148 * get instance class
149 * @return WPEMS
150 */
151 public static function instance() {
152 if ( ! empty( self::$_instance ) ) {
153 return self::$_instance;
154 }
155
156 return self::$_instance = new self();
157 }
158
159 }
160
161 if ( ! function_exists( 'WPEMS' ) ) {
162
163 function WPEMS() {
164 return WPEMS::instance();
165 }
166
167 }
168 WPEMS();
169 }
170
171
172 $GLOBALS['WPEMS'] = WPEMS();