@@ -118,40 +118,40 @@ |
||
118 | 118 | * @return EE_Template_Config |
119 | 119 | */ |
120 | 120 | public static function update_template_settings(EE_Template_Config $CFG, $REQ ) { |
121 | - if(! $CFG->EED_Event_Single instanceof EE_Event_Single_Config){ |
|
122 | - $CFG->EED_Event_Single = new EE_Event_Single_Config(); |
|
123 | - } |
|
124 | - $display_order_event = $CFG->EED_Event_Single->display_order_event !== null |
|
125 | - ? $CFG->EED_Event_Single->display_order_event |
|
126 | - : EED_Event_Single::EVENT_DETAILS_PRIORITY; |
|
121 | + if(! $CFG->EED_Event_Single instanceof EE_Event_Single_Config){ |
|
122 | + $CFG->EED_Event_Single = new EE_Event_Single_Config(); |
|
123 | + } |
|
124 | + $display_order_event = $CFG->EED_Event_Single->display_order_event !== null |
|
125 | + ? $CFG->EED_Event_Single->display_order_event |
|
126 | + : EED_Event_Single::EVENT_DETAILS_PRIORITY; |
|
127 | 127 | $display_order_datetimes = $CFG->EED_Event_Single->display_order_datetimes !== null |
128 | - ? $CFG->EED_Event_Single->display_order_datetimes |
|
129 | - : EED_Event_Single::EVENT_DATETIMES_PRIORITY; |
|
130 | - $display_order_tickets = $CFG->EED_Event_Single->display_order_tickets !== null |
|
131 | - ? $CFG->EED_Event_Single->display_order_tickets |
|
132 | - : EED_Event_Single::EVENT_TICKETS_PRIORITY; |
|
128 | + ? $CFG->EED_Event_Single->display_order_datetimes |
|
129 | + : EED_Event_Single::EVENT_DATETIMES_PRIORITY; |
|
130 | + $display_order_tickets = $CFG->EED_Event_Single->display_order_tickets !== null |
|
131 | + ? $CFG->EED_Event_Single->display_order_tickets |
|
132 | + : EED_Event_Single::EVENT_TICKETS_PRIORITY; |
|
133 | 133 | $display_order_venue = $CFG->EED_Event_Single->display_order_venue !== null |
134 | - ? $CFG->EED_Event_Single->display_order_venue |
|
135 | - : EED_Event_Single::EVENT_VENUES_PRIORITY; |
|
134 | + ? $CFG->EED_Event_Single->display_order_venue |
|
135 | + : EED_Event_Single::EVENT_VENUES_PRIORITY; |
|
136 | 136 | $CFG->EED_Event_Single = new EE_Event_Single_Config(); |
137 | 137 | $CFG->EED_Event_Single->display_status_banner_single = ! empty( $REQ['display_status_banner_single'] ) |
138 | - && $REQ['display_status_banner_single']; |
|
138 | + && $REQ['display_status_banner_single']; |
|
139 | 139 | $CFG->EED_Event_Single->display_venue = ! empty( $REQ['display_venue'] ) && $REQ['display_venue']; |
140 | 140 | $CFG->EED_Event_Single->use_sortable_display_order = ! empty( $REQ[ 'EED_Events_Single_use_sortable_display_order' ] ) |
141 | - ? absint( $REQ[ 'EED_Events_Single_use_sortable_display_order' ] ) |
|
142 | - : 0; |
|
141 | + ? absint( $REQ[ 'EED_Events_Single_use_sortable_display_order' ] ) |
|
142 | + : 0; |
|
143 | 143 | $CFG->EED_Event_Single->display_order_event = $CFG->EED_Event_Single->use_sortable_display_order |
144 | - ? $display_order_event |
|
145 | - : EED_Event_Single::EVENT_DETAILS_PRIORITY; |
|
144 | + ? $display_order_event |
|
145 | + : EED_Event_Single::EVENT_DETAILS_PRIORITY; |
|
146 | 146 | $CFG->EED_Event_Single->display_order_datetimes = $CFG->EED_Event_Single->use_sortable_display_order |
147 | - ? $display_order_datetimes |
|
148 | - : EED_Event_Single::EVENT_DATETIMES_PRIORITY; |
|
147 | + ? $display_order_datetimes |
|
148 | + : EED_Event_Single::EVENT_DATETIMES_PRIORITY; |
|
149 | 149 | $CFG->EED_Event_Single->display_order_tickets = $CFG->EED_Event_Single->use_sortable_display_order |
150 | - ? $display_order_tickets |
|
151 | - : EED_Event_Single::EVENT_TICKETS_PRIORITY; |
|
150 | + ? $display_order_tickets |
|
151 | + : EED_Event_Single::EVENT_TICKETS_PRIORITY; |
|
152 | 152 | $CFG->EED_Event_Single->display_order_venue = $CFG->EED_Event_Single->use_sortable_display_order |
153 | - ? $display_order_venue |
|
154 | - : EED_Event_Single::EVENT_VENUES_PRIORITY; |
|
153 | + ? $display_order_venue |
|
154 | + : EED_Event_Single::EVENT_VENUES_PRIORITY; |
|
155 | 155 | do_action( 'AHEE__EED_Event_Single__update_template_settings__after_update', $CFG, $REQ ); |
156 | 156 | return $CFG; |
157 | 157 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @return EED_Event_Single_Caff |
30 | 30 | */ |
31 | 31 | public static function instance() { |
32 | - return parent::get_instance( __CLASS__ ); |
|
32 | + return parent::get_instance(__CLASS__); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -50,34 +50,34 @@ discard block |
||
50 | 50 | * @return void |
51 | 51 | */ |
52 | 52 | public static function set_hooks_admin() { |
53 | - define( 'EVENT_SINGLE_CAFF_TEMPLATES_PATH', plugin_dir_path( __FILE__ ) . 'templates' . DS ); |
|
54 | - define( 'EVENT_SINGLE_CAFF_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
53 | + define('EVENT_SINGLE_CAFF_TEMPLATES_PATH', plugin_dir_path(__FILE__).'templates'.DS); |
|
54 | + define('EVENT_SINGLE_CAFF_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
55 | 55 | add_action( |
56 | 56 | 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__espresso_events__template_settings', |
57 | - array( 'EED_Event_Single_Caff', 'load_scripts_styles' ), |
|
57 | + array('EED_Event_Single_Caff', 'load_scripts_styles'), |
|
58 | 58 | 10 |
59 | 59 | ); |
60 | - add_action( 'AHEE__template_settings__template__before_settings_form', array( 'EED_Event_Single_Caff', 'template_settings_form' ), 10 ); |
|
61 | - add_filter( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', array( 'EED_Event_Single_Caff', 'update_template_settings' ), 10, 2 ); |
|
60 | + add_action('AHEE__template_settings__template__before_settings_form', array('EED_Event_Single_Caff', 'template_settings_form'), 10); |
|
61 | + add_filter('FHEE__General_Settings_Admin_Page__update_template_settings__data', array('EED_Event_Single_Caff', 'update_template_settings'), 10, 2); |
|
62 | 62 | // AJAX |
63 | - add_action( 'wp_ajax_espresso_update_event_single_order', array( 'EED_Event_Single_Caff', 'update_event_single_order' ) ); |
|
64 | - add_action( 'wp_ajax_nopriv_espresso_update_event_single_order', array( 'EED_Event_Single_Caff', 'update_event_single_order' ) ); |
|
63 | + add_action('wp_ajax_espresso_update_event_single_order', array('EED_Event_Single_Caff', 'update_event_single_order')); |
|
64 | + add_action('wp_ajax_nopriv_espresso_update_event_single_order', array('EED_Event_Single_Caff', 'update_event_single_order')); |
|
65 | 65 | |
66 | 66 | } |
67 | 67 | |
68 | 68 | |
69 | 69 | |
70 | 70 | public static function load_scripts_styles() { |
71 | - add_action( 'admin_enqueue_scripts', array( 'EED_Event_Single_Caff', 'enqueue_scripts_styles' ), 10 ); |
|
71 | + add_action('admin_enqueue_scripts', array('EED_Event_Single_Caff', 'enqueue_scripts_styles'), 10); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
75 | 75 | |
76 | 76 | public static function enqueue_scripts_styles() { |
77 | - wp_register_style( 'eed-event-single-sortable', EVENT_SINGLE_CAFF_ASSETS_URL . 'eed_event_single_sortable.css', array(), EVENT_ESPRESSO_VERSION ); |
|
78 | - wp_enqueue_style( 'eed-event-single-sortable' ); |
|
79 | - wp_register_script( 'eed-event-single-sortable', EVENT_SINGLE_CAFF_ASSETS_URL . 'eed_event_single_sortable.js', array( 'jquery-ui-sortable' ), EVENT_ESPRESSO_VERSION, true ); |
|
80 | - wp_enqueue_script( 'eed-event-single-sortable' ); |
|
77 | + wp_register_style('eed-event-single-sortable', EVENT_SINGLE_CAFF_ASSETS_URL.'eed_event_single_sortable.css', array(), EVENT_ESPRESSO_VERSION); |
|
78 | + wp_enqueue_style('eed-event-single-sortable'); |
|
79 | + wp_register_script('eed-event-single-sortable', EVENT_SINGLE_CAFF_ASSETS_URL.'eed_event_single_sortable.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, true); |
|
80 | + wp_enqueue_script('eed-event-single-sortable'); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -91,21 +91,21 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public static function template_settings_form() { |
93 | 93 | $config = EE_Registry::instance()->CFG->template_settings; |
94 | - $config = isset( $config->EED_Event_Single ) && $config->EED_Event_Single instanceof EE_Event_Single_Config ? $config->EED_Event_Single : new EE_Event_Single_Config(); |
|
95 | - $config->use_sortable_display_order = isset( $config->use_sortable_display_order ) ? $config->use_sortable_display_order : false; |
|
96 | - $config = apply_filters( 'FHEE__EED_Event_Single__template_settings_form__event_list_config', $config ); |
|
94 | + $config = isset($config->EED_Event_Single) && $config->EED_Event_Single instanceof EE_Event_Single_Config ? $config->EED_Event_Single : new EE_Event_Single_Config(); |
|
95 | + $config->use_sortable_display_order = isset($config->use_sortable_display_order) ? $config->use_sortable_display_order : false; |
|
96 | + $config = apply_filters('FHEE__EED_Event_Single__template_settings_form__event_list_config', $config); |
|
97 | 97 | |
98 | 98 | $event_single_order_array = array(); |
99 | - $event_single_order_array[ $config->display_order_tickets ] = 'tickets'; |
|
100 | - $event_single_order_array[ $config->display_order_datetimes ] = 'datetimes'; |
|
101 | - $event_single_order_array[ $config->display_order_event ] = 'event'; |
|
102 | - $event_single_order_array[ $config->display_order_venue ] = 'venue'; |
|
99 | + $event_single_order_array[$config->display_order_tickets] = 'tickets'; |
|
100 | + $event_single_order_array[$config->display_order_datetimes] = 'datetimes'; |
|
101 | + $event_single_order_array[$config->display_order_event] = 'event'; |
|
102 | + $event_single_order_array[$config->display_order_venue] = 'venue'; |
|
103 | 103 | // get template parts |
104 | - $template_parts = EED_Event_Single::instance()->initialize_template_parts( $config ); |
|
104 | + $template_parts = EED_Event_Single::instance()->initialize_template_parts($config); |
|
105 | 105 | // convert to array so that we can add more properties |
106 | - $config = get_object_vars( $config ); |
|
107 | - $config[ 'event_single_display_order' ] = $template_parts->generate_sortable_list_of_template_parts( 'event-single-sortable-js', '', 'single-sortable-li single-sortable-js' ); |
|
108 | - EEH_Template::display_template( EVENT_SINGLE_CAFF_TEMPLATES_PATH . 'admin-event-single-settings.template.php', $config ); |
|
106 | + $config = get_object_vars($config); |
|
107 | + $config['event_single_display_order'] = $template_parts->generate_sortable_list_of_template_parts('event-single-sortable-js', '', 'single-sortable-li single-sortable-js'); |
|
108 | + EEH_Template::display_template(EVENT_SINGLE_CAFF_TEMPLATES_PATH.'admin-event-single-settings.template.php', $config); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | * @param array $REQ |
118 | 118 | * @return EE_Template_Config |
119 | 119 | */ |
120 | - public static function update_template_settings(EE_Template_Config $CFG, $REQ ) { |
|
121 | - if(! $CFG->EED_Event_Single instanceof EE_Event_Single_Config){ |
|
120 | + public static function update_template_settings(EE_Template_Config $CFG, $REQ) { |
|
121 | + if ( ! $CFG->EED_Event_Single instanceof EE_Event_Single_Config) { |
|
122 | 122 | $CFG->EED_Event_Single = new EE_Event_Single_Config(); |
123 | 123 | } |
124 | 124 | $display_order_event = $CFG->EED_Event_Single->display_order_event !== null |
@@ -134,11 +134,11 @@ discard block |
||
134 | 134 | ? $CFG->EED_Event_Single->display_order_venue |
135 | 135 | : EED_Event_Single::EVENT_VENUES_PRIORITY; |
136 | 136 | $CFG->EED_Event_Single = new EE_Event_Single_Config(); |
137 | - $CFG->EED_Event_Single->display_status_banner_single = ! empty( $REQ['display_status_banner_single'] ) |
|
137 | + $CFG->EED_Event_Single->display_status_banner_single = ! empty($REQ['display_status_banner_single']) |
|
138 | 138 | && $REQ['display_status_banner_single']; |
139 | - $CFG->EED_Event_Single->display_venue = ! empty( $REQ['display_venue'] ) && $REQ['display_venue']; |
|
140 | - $CFG->EED_Event_Single->use_sortable_display_order = ! empty( $REQ[ 'EED_Events_Single_use_sortable_display_order' ] ) |
|
141 | - ? absint( $REQ[ 'EED_Events_Single_use_sortable_display_order' ] ) |
|
139 | + $CFG->EED_Event_Single->display_venue = ! empty($REQ['display_venue']) && $REQ['display_venue']; |
|
140 | + $CFG->EED_Event_Single->use_sortable_display_order = ! empty($REQ['EED_Events_Single_use_sortable_display_order']) |
|
141 | + ? absint($REQ['EED_Events_Single_use_sortable_display_order']) |
|
142 | 142 | : 0; |
143 | 143 | $CFG->EED_Event_Single->display_order_event = $CFG->EED_Event_Single->use_sortable_display_order |
144 | 144 | ? $display_order_event |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | $CFG->EED_Event_Single->display_order_venue = $CFG->EED_Event_Single->use_sortable_display_order |
153 | 153 | ? $display_order_venue |
154 | 154 | : EED_Event_Single::EVENT_VENUES_PRIORITY; |
155 | - do_action( 'AHEE__EED_Event_Single__update_template_settings__after_update', $CFG, $REQ ); |
|
155 | + do_action('AHEE__EED_Event_Single__update_template_settings__after_update', $CFG, $REQ); |
|
156 | 156 | return $CFG; |
157 | 157 | } |
158 | 158 | |
@@ -166,23 +166,23 @@ discard block |
||
166 | 166 | */ |
167 | 167 | public static function update_event_single_order() { |
168 | 168 | $config_saved = false; |
169 | - $template_parts = sanitize_text_field( $_POST[ 'elements' ] ); |
|
170 | - if ( ! empty( $template_parts ) ) { |
|
171 | - $template_parts = explode( ',', trim( $template_parts, ',' ) ); |
|
172 | - foreach ( $template_parts as $key => $template_part ) { |
|
169 | + $template_parts = sanitize_text_field($_POST['elements']); |
|
170 | + if ( ! empty($template_parts)) { |
|
171 | + $template_parts = explode(',', trim($template_parts, ',')); |
|
172 | + foreach ($template_parts as $key => $template_part) { |
|
173 | 173 | $template_part = "display_order_$template_part"; |
174 | - $priority = ( $key * 10 ) + EED_Event_Single::EVENT_DETAILS_PRIORITY; |
|
174 | + $priority = ($key * 10) + EED_Event_Single::EVENT_DETAILS_PRIORITY; |
|
175 | 175 | EE_Registry::instance()->CFG->template_settings->EED_Event_Single->{$template_part} = $priority; |
176 | - do_action( "AHEE__EED_Event_Single__update_event_single_order__$template_part", $priority ); |
|
176 | + do_action("AHEE__EED_Event_Single__update_event_single_order__$template_part", $priority); |
|
177 | 177 | } |
178 | - $config_saved = EE_Registry::instance()->CFG->update_espresso_config( false, false ); |
|
178 | + $config_saved = EE_Registry::instance()->CFG->update_espresso_config(false, false); |
|
179 | 179 | } |
180 | - if ( $config_saved ) { |
|
181 | - EE_Error::add_success( __( 'Display Order has been successfully updated.', 'event_espresso' ) ); |
|
180 | + if ($config_saved) { |
|
181 | + EE_Error::add_success(__('Display Order has been successfully updated.', 'event_espresso')); |
|
182 | 182 | } else { |
183 | - EE_Error::add_error( __( 'Display Order was not updated.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
183 | + EE_Error::add_error(__('Display Order was not updated.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
184 | 184 | } |
185 | - echo wp_json_encode( EE_Error::get_notices( false )); |
|
185 | + echo wp_json_encode(EE_Error::get_notices(false)); |
|
186 | 186 | exit(); |
187 | 187 | } |
188 | 188 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * @param WP $WP |
196 | 196 | * @return void |
197 | 197 | */ |
198 | - public function run( $WP ) { |
|
198 | + public function run($WP) { |
|
199 | 199 | } |
200 | 200 | |
201 | 201 |
@@ -18,132 +18,132 @@ |
||
18 | 18 | abstract class DomainBase |
19 | 19 | { |
20 | 20 | |
21 | - /** |
|
22 | - * Equivalent to `__FILE__` for main plugin file. |
|
23 | - * |
|
24 | - * @var string |
|
25 | - */ |
|
26 | - private static $plugin_file = ''; |
|
27 | - |
|
28 | - /** |
|
29 | - * String indicating version for plugin |
|
30 | - * |
|
31 | - * @var string |
|
32 | - */ |
|
33 | - private static $version = ''; |
|
34 | - |
|
35 | - /** |
|
36 | - * @var string $plugin_basename |
|
37 | - */ |
|
38 | - private static $plugin_basename = ''; |
|
39 | - |
|
40 | - /** |
|
41 | - * @var string $plugin_path |
|
42 | - */ |
|
43 | - private static $plugin_path = ''; |
|
44 | - |
|
45 | - /** |
|
46 | - * @var string $plugin_url |
|
47 | - */ |
|
48 | - private static $plugin_url = ''; |
|
49 | - |
|
50 | - |
|
51 | - |
|
52 | - /** |
|
53 | - * Initializes internal static properties. |
|
54 | - * |
|
55 | - * @param string $plugin_file |
|
56 | - * @param string $version |
|
57 | - */ |
|
58 | - public static function init($plugin_file, $version) |
|
59 | - { |
|
60 | - self::$plugin_file = $plugin_file; |
|
61 | - self::$version = $version; |
|
62 | - self::$plugin_basename = plugin_basename($plugin_file); |
|
63 | - self::$plugin_path = plugin_dir_path($plugin_file); |
|
64 | - self::$plugin_url = plugin_dir_url($plugin_file); |
|
65 | - } |
|
66 | - |
|
67 | - |
|
68 | - |
|
69 | - /** |
|
70 | - * @return string |
|
71 | - * @throws DomainException |
|
72 | - */ |
|
73 | - public static function pluginFile() |
|
74 | - { |
|
75 | - self::verifyInitialized(__METHOD__); |
|
76 | - return self::$plugin_file; |
|
77 | - } |
|
78 | - |
|
79 | - |
|
80 | - |
|
81 | - /** |
|
82 | - * @return string |
|
83 | - * @throws DomainException |
|
84 | - */ |
|
85 | - public static function pluginBasename() |
|
86 | - { |
|
87 | - self::verifyInitialized(__METHOD__); |
|
88 | - return self::$plugin_basename; |
|
89 | - } |
|
90 | - |
|
91 | - |
|
92 | - |
|
93 | - /** |
|
94 | - * @return string |
|
95 | - * @throws DomainException |
|
96 | - */ |
|
97 | - public static function pluginPath() |
|
98 | - { |
|
99 | - self::verifyInitialized(__METHOD__); |
|
100 | - return self::$plugin_path; |
|
101 | - } |
|
102 | - |
|
103 | - |
|
104 | - |
|
105 | - /** |
|
106 | - * @return string |
|
107 | - * @throws DomainException |
|
108 | - */ |
|
109 | - public static function pluginUrl() |
|
110 | - { |
|
111 | - self::verifyInitialized(__METHOD__); |
|
112 | - return self::$plugin_url; |
|
113 | - } |
|
114 | - |
|
115 | - |
|
116 | - |
|
117 | - /** |
|
118 | - * @return string |
|
119 | - * @throws DomainException |
|
120 | - */ |
|
121 | - public static function version() |
|
122 | - { |
|
123 | - self::verifyInitialized(__METHOD__); |
|
124 | - return self::$version; |
|
125 | - } |
|
126 | - |
|
127 | - |
|
128 | - |
|
129 | - /** |
|
130 | - * @param string $method |
|
131 | - * @throws DomainException |
|
132 | - */ |
|
133 | - private static function verifyInitialized($method) |
|
134 | - { |
|
135 | - if (self::$plugin_file === '') { |
|
136 | - throw new DomainException( |
|
137 | - sprintf( |
|
138 | - esc_html__( |
|
139 | - '%1$s needs to be called before %2$s can return a value.', |
|
140 | - 'event_espresso' |
|
141 | - ), |
|
142 | - get_called_class() . '::init()', |
|
143 | - "{$method}()" |
|
144 | - ) |
|
145 | - ); |
|
146 | - } |
|
147 | - } |
|
21 | + /** |
|
22 | + * Equivalent to `__FILE__` for main plugin file. |
|
23 | + * |
|
24 | + * @var string |
|
25 | + */ |
|
26 | + private static $plugin_file = ''; |
|
27 | + |
|
28 | + /** |
|
29 | + * String indicating version for plugin |
|
30 | + * |
|
31 | + * @var string |
|
32 | + */ |
|
33 | + private static $version = ''; |
|
34 | + |
|
35 | + /** |
|
36 | + * @var string $plugin_basename |
|
37 | + */ |
|
38 | + private static $plugin_basename = ''; |
|
39 | + |
|
40 | + /** |
|
41 | + * @var string $plugin_path |
|
42 | + */ |
|
43 | + private static $plugin_path = ''; |
|
44 | + |
|
45 | + /** |
|
46 | + * @var string $plugin_url |
|
47 | + */ |
|
48 | + private static $plugin_url = ''; |
|
49 | + |
|
50 | + |
|
51 | + |
|
52 | + /** |
|
53 | + * Initializes internal static properties. |
|
54 | + * |
|
55 | + * @param string $plugin_file |
|
56 | + * @param string $version |
|
57 | + */ |
|
58 | + public static function init($plugin_file, $version) |
|
59 | + { |
|
60 | + self::$plugin_file = $plugin_file; |
|
61 | + self::$version = $version; |
|
62 | + self::$plugin_basename = plugin_basename($plugin_file); |
|
63 | + self::$plugin_path = plugin_dir_path($plugin_file); |
|
64 | + self::$plugin_url = plugin_dir_url($plugin_file); |
|
65 | + } |
|
66 | + |
|
67 | + |
|
68 | + |
|
69 | + /** |
|
70 | + * @return string |
|
71 | + * @throws DomainException |
|
72 | + */ |
|
73 | + public static function pluginFile() |
|
74 | + { |
|
75 | + self::verifyInitialized(__METHOD__); |
|
76 | + return self::$plugin_file; |
|
77 | + } |
|
78 | + |
|
79 | + |
|
80 | + |
|
81 | + /** |
|
82 | + * @return string |
|
83 | + * @throws DomainException |
|
84 | + */ |
|
85 | + public static function pluginBasename() |
|
86 | + { |
|
87 | + self::verifyInitialized(__METHOD__); |
|
88 | + return self::$plugin_basename; |
|
89 | + } |
|
90 | + |
|
91 | + |
|
92 | + |
|
93 | + /** |
|
94 | + * @return string |
|
95 | + * @throws DomainException |
|
96 | + */ |
|
97 | + public static function pluginPath() |
|
98 | + { |
|
99 | + self::verifyInitialized(__METHOD__); |
|
100 | + return self::$plugin_path; |
|
101 | + } |
|
102 | + |
|
103 | + |
|
104 | + |
|
105 | + /** |
|
106 | + * @return string |
|
107 | + * @throws DomainException |
|
108 | + */ |
|
109 | + public static function pluginUrl() |
|
110 | + { |
|
111 | + self::verifyInitialized(__METHOD__); |
|
112 | + return self::$plugin_url; |
|
113 | + } |
|
114 | + |
|
115 | + |
|
116 | + |
|
117 | + /** |
|
118 | + * @return string |
|
119 | + * @throws DomainException |
|
120 | + */ |
|
121 | + public static function version() |
|
122 | + { |
|
123 | + self::verifyInitialized(__METHOD__); |
|
124 | + return self::$version; |
|
125 | + } |
|
126 | + |
|
127 | + |
|
128 | + |
|
129 | + /** |
|
130 | + * @param string $method |
|
131 | + * @throws DomainException |
|
132 | + */ |
|
133 | + private static function verifyInitialized($method) |
|
134 | + { |
|
135 | + if (self::$plugin_file === '') { |
|
136 | + throw new DomainException( |
|
137 | + sprintf( |
|
138 | + esc_html__( |
|
139 | + '%1$s needs to be called before %2$s can return a value.', |
|
140 | + 'event_espresso' |
|
141 | + ), |
|
142 | + get_called_class() . '::init()', |
|
143 | + "{$method}()" |
|
144 | + ) |
|
145 | + ); |
|
146 | + } |
|
147 | + } |
|
148 | 148 | |
149 | 149 | } |
@@ -139,7 +139,7 @@ |
||
139 | 139 | '%1$s needs to be called before %2$s can return a value.', |
140 | 140 | 'event_espresso' |
141 | 141 | ), |
142 | - get_called_class() . '::init()', |
|
142 | + get_called_class().'::init()', |
|
143 | 143 | "{$method}()" |
144 | 144 | ) |
145 | 145 | ); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if ( ! defined('ABSPATH')) { |
2 | - exit('No direct script access allowed'); |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /* |
5 | 5 | Plugin Name: Event Espresso |
@@ -40,243 +40,243 @@ discard block |
||
40 | 40 | * @since 4.0 |
41 | 41 | */ |
42 | 42 | if (function_exists('espresso_version')) { |
43 | - /** |
|
44 | - * espresso_duplicate_plugin_error |
|
45 | - * displays if more than one version of EE is activated at the same time |
|
46 | - */ |
|
47 | - function espresso_duplicate_plugin_error() |
|
48 | - { |
|
49 | - ?> |
|
43 | + /** |
|
44 | + * espresso_duplicate_plugin_error |
|
45 | + * displays if more than one version of EE is activated at the same time |
|
46 | + */ |
|
47 | + function espresso_duplicate_plugin_error() |
|
48 | + { |
|
49 | + ?> |
|
50 | 50 | <div class="error"> |
51 | 51 | <p> |
52 | 52 | <?php echo esc_html__( |
53 | - 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | - 'event_espresso' |
|
55 | - ); ?> |
|
53 | + 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | + 'event_espresso' |
|
55 | + ); ?> |
|
56 | 56 | </p> |
57 | 57 | </div> |
58 | 58 | <?php |
59 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | - } |
|
59 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | + } |
|
61 | 61 | |
62 | - add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
62 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
63 | 63 | } else { |
64 | - define('EE_MIN_PHP_VER_REQUIRED', '5.3.9'); |
|
65 | - if ( ! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | - /** |
|
67 | - * espresso_minimum_php_version_error |
|
68 | - * |
|
69 | - * @return void |
|
70 | - */ |
|
71 | - function espresso_minimum_php_version_error() |
|
72 | - { |
|
73 | - ?> |
|
64 | + define('EE_MIN_PHP_VER_REQUIRED', '5.3.9'); |
|
65 | + if ( ! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | + /** |
|
67 | + * espresso_minimum_php_version_error |
|
68 | + * |
|
69 | + * @return void |
|
70 | + */ |
|
71 | + function espresso_minimum_php_version_error() |
|
72 | + { |
|
73 | + ?> |
|
74 | 74 | <div class="error"> |
75 | 75 | <p> |
76 | 76 | <?php |
77 | - printf( |
|
78 | - esc_html__( |
|
79 | - 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | - 'event_espresso' |
|
81 | - ), |
|
82 | - EE_MIN_PHP_VER_REQUIRED, |
|
83 | - PHP_VERSION, |
|
84 | - '<br/>', |
|
85 | - '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | - ); |
|
87 | - ?> |
|
77 | + printf( |
|
78 | + esc_html__( |
|
79 | + 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | + 'event_espresso' |
|
81 | + ), |
|
82 | + EE_MIN_PHP_VER_REQUIRED, |
|
83 | + PHP_VERSION, |
|
84 | + '<br/>', |
|
85 | + '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | + ); |
|
87 | + ?> |
|
88 | 88 | </p> |
89 | 89 | </div> |
90 | 90 | <?php |
91 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | - } |
|
91 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | + } |
|
93 | 93 | |
94 | - add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | - } else { |
|
96 | - /** |
|
97 | - * espresso_version |
|
98 | - * Returns the plugin version |
|
99 | - * |
|
100 | - * @return string |
|
101 | - */ |
|
102 | - function espresso_version() |
|
103 | - { |
|
104 | - return apply_filters('FHEE__espresso__espresso_version', '4.9.44.rc.003'); |
|
105 | - } |
|
94 | + add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | + } else { |
|
96 | + /** |
|
97 | + * espresso_version |
|
98 | + * Returns the plugin version |
|
99 | + * |
|
100 | + * @return string |
|
101 | + */ |
|
102 | + function espresso_version() |
|
103 | + { |
|
104 | + return apply_filters('FHEE__espresso__espresso_version', '4.9.44.rc.003'); |
|
105 | + } |
|
106 | 106 | |
107 | - // define versions |
|
108 | - define('EVENT_ESPRESSO_VERSION', espresso_version()); |
|
109 | - define('EE_MIN_WP_VER_REQUIRED', '4.1'); |
|
110 | - define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2'); |
|
111 | - define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44'); |
|
112 | - define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
113 | - //used to be DIRECTORY_SEPARATOR, but that caused issues on windows |
|
114 | - if ( ! defined('DS')) { |
|
115 | - define('DS', '/'); |
|
116 | - } |
|
117 | - if ( ! defined('PS')) { |
|
118 | - define('PS', PATH_SEPARATOR); |
|
119 | - } |
|
120 | - if ( ! defined('SP')) { |
|
121 | - define('SP', ' '); |
|
122 | - } |
|
123 | - if ( ! defined('EENL')) { |
|
124 | - define('EENL', "\n"); |
|
125 | - } |
|
126 | - define('EE_SUPPORT_EMAIL', '[email protected]'); |
|
127 | - // define the plugin directory and URL |
|
128 | - define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE)); |
|
129 | - define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE)); |
|
130 | - define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE)); |
|
131 | - // main root folder paths |
|
132 | - define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS); |
|
133 | - define('EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS); |
|
134 | - define('EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS); |
|
135 | - define('EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS); |
|
136 | - define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS); |
|
137 | - define('EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS); |
|
138 | - define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS); |
|
139 | - define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS); |
|
140 | - // core system paths |
|
141 | - define('EE_ADMIN', EE_CORE . 'admin' . DS); |
|
142 | - define('EE_CPTS', EE_CORE . 'CPTs' . DS); |
|
143 | - define('EE_CLASSES', EE_CORE . 'db_classes' . DS); |
|
144 | - define('EE_INTERFACES', EE_CORE . 'interfaces' . DS); |
|
145 | - define('EE_BUSINESS', EE_CORE . 'business' . DS); |
|
146 | - define('EE_MODELS', EE_CORE . 'db_models' . DS); |
|
147 | - define('EE_HELPERS', EE_CORE . 'helpers' . DS); |
|
148 | - define('EE_LIBRARIES', EE_CORE . 'libraries' . DS); |
|
149 | - define('EE_TEMPLATES', EE_CORE . 'templates' . DS); |
|
150 | - define('EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS); |
|
151 | - define('EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS); |
|
152 | - define('EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS); |
|
153 | - // gateways |
|
154 | - define('EE_GATEWAYS', EE_MODULES . 'gateways' . DS); |
|
155 | - define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS); |
|
156 | - // asset URL paths |
|
157 | - define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS); |
|
158 | - define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS); |
|
159 | - define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS); |
|
160 | - define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS); |
|
161 | - define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/'); |
|
162 | - define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/'); |
|
163 | - // define upload paths |
|
164 | - $uploads = wp_upload_dir(); |
|
165 | - // define the uploads directory and URL |
|
166 | - define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'] . DS . 'espresso' . DS); |
|
167 | - define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'] . DS . 'espresso' . DS); |
|
168 | - // define the templates directory and URL |
|
169 | - define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'templates' . DS); |
|
170 | - define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'templates' . DS); |
|
171 | - // define the gateway directory and URL |
|
172 | - define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'gateways' . DS); |
|
173 | - define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'gateways' . DS); |
|
174 | - // languages folder/path |
|
175 | - define('EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS); |
|
176 | - define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS); |
|
177 | - //check for dompdf fonts in uploads |
|
178 | - if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS)) { |
|
179 | - define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS); |
|
180 | - } |
|
181 | - //ajax constants |
|
182 | - define( |
|
183 | - 'EE_FRONT_AJAX', |
|
184 | - isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false |
|
185 | - ); |
|
186 | - define( |
|
187 | - 'EE_ADMIN_AJAX', |
|
188 | - isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false |
|
189 | - ); |
|
190 | - //just a handy constant occasionally needed for finding values representing infinity in the DB |
|
191 | - //you're better to use this than its straight value (currently -1) in case you ever |
|
192 | - //want to change its default value! or find when -1 means infinity |
|
193 | - define('EE_INF_IN_DB', -1); |
|
194 | - define('EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX); |
|
195 | - define('EE_DEBUG', false); |
|
196 | - // for older WP versions |
|
197 | - if ( ! defined('MONTH_IN_SECONDS')) { |
|
198 | - define('MONTH_IN_SECONDS', DAY_IN_SECONDS * 30); |
|
199 | - } |
|
200 | - /** |
|
201 | - * espresso_plugin_activation |
|
202 | - * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
203 | - */ |
|
204 | - function espresso_plugin_activation() |
|
205 | - { |
|
206 | - update_option('ee_espresso_activation', true); |
|
207 | - } |
|
107 | + // define versions |
|
108 | + define('EVENT_ESPRESSO_VERSION', espresso_version()); |
|
109 | + define('EE_MIN_WP_VER_REQUIRED', '4.1'); |
|
110 | + define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2'); |
|
111 | + define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44'); |
|
112 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
113 | + //used to be DIRECTORY_SEPARATOR, but that caused issues on windows |
|
114 | + if ( ! defined('DS')) { |
|
115 | + define('DS', '/'); |
|
116 | + } |
|
117 | + if ( ! defined('PS')) { |
|
118 | + define('PS', PATH_SEPARATOR); |
|
119 | + } |
|
120 | + if ( ! defined('SP')) { |
|
121 | + define('SP', ' '); |
|
122 | + } |
|
123 | + if ( ! defined('EENL')) { |
|
124 | + define('EENL', "\n"); |
|
125 | + } |
|
126 | + define('EE_SUPPORT_EMAIL', '[email protected]'); |
|
127 | + // define the plugin directory and URL |
|
128 | + define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE)); |
|
129 | + define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE)); |
|
130 | + define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE)); |
|
131 | + // main root folder paths |
|
132 | + define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS); |
|
133 | + define('EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS); |
|
134 | + define('EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS); |
|
135 | + define('EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS); |
|
136 | + define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS); |
|
137 | + define('EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS); |
|
138 | + define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS); |
|
139 | + define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS); |
|
140 | + // core system paths |
|
141 | + define('EE_ADMIN', EE_CORE . 'admin' . DS); |
|
142 | + define('EE_CPTS', EE_CORE . 'CPTs' . DS); |
|
143 | + define('EE_CLASSES', EE_CORE . 'db_classes' . DS); |
|
144 | + define('EE_INTERFACES', EE_CORE . 'interfaces' . DS); |
|
145 | + define('EE_BUSINESS', EE_CORE . 'business' . DS); |
|
146 | + define('EE_MODELS', EE_CORE . 'db_models' . DS); |
|
147 | + define('EE_HELPERS', EE_CORE . 'helpers' . DS); |
|
148 | + define('EE_LIBRARIES', EE_CORE . 'libraries' . DS); |
|
149 | + define('EE_TEMPLATES', EE_CORE . 'templates' . DS); |
|
150 | + define('EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS); |
|
151 | + define('EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS); |
|
152 | + define('EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS); |
|
153 | + // gateways |
|
154 | + define('EE_GATEWAYS', EE_MODULES . 'gateways' . DS); |
|
155 | + define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS); |
|
156 | + // asset URL paths |
|
157 | + define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS); |
|
158 | + define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS); |
|
159 | + define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS); |
|
160 | + define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS); |
|
161 | + define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/'); |
|
162 | + define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/'); |
|
163 | + // define upload paths |
|
164 | + $uploads = wp_upload_dir(); |
|
165 | + // define the uploads directory and URL |
|
166 | + define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'] . DS . 'espresso' . DS); |
|
167 | + define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'] . DS . 'espresso' . DS); |
|
168 | + // define the templates directory and URL |
|
169 | + define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'templates' . DS); |
|
170 | + define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'templates' . DS); |
|
171 | + // define the gateway directory and URL |
|
172 | + define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'gateways' . DS); |
|
173 | + define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'gateways' . DS); |
|
174 | + // languages folder/path |
|
175 | + define('EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS); |
|
176 | + define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS); |
|
177 | + //check for dompdf fonts in uploads |
|
178 | + if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS)) { |
|
179 | + define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS); |
|
180 | + } |
|
181 | + //ajax constants |
|
182 | + define( |
|
183 | + 'EE_FRONT_AJAX', |
|
184 | + isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false |
|
185 | + ); |
|
186 | + define( |
|
187 | + 'EE_ADMIN_AJAX', |
|
188 | + isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false |
|
189 | + ); |
|
190 | + //just a handy constant occasionally needed for finding values representing infinity in the DB |
|
191 | + //you're better to use this than its straight value (currently -1) in case you ever |
|
192 | + //want to change its default value! or find when -1 means infinity |
|
193 | + define('EE_INF_IN_DB', -1); |
|
194 | + define('EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX); |
|
195 | + define('EE_DEBUG', false); |
|
196 | + // for older WP versions |
|
197 | + if ( ! defined('MONTH_IN_SECONDS')) { |
|
198 | + define('MONTH_IN_SECONDS', DAY_IN_SECONDS * 30); |
|
199 | + } |
|
200 | + /** |
|
201 | + * espresso_plugin_activation |
|
202 | + * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
203 | + */ |
|
204 | + function espresso_plugin_activation() |
|
205 | + { |
|
206 | + update_option('ee_espresso_activation', true); |
|
207 | + } |
|
208 | 208 | |
209 | - register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
210 | - /** |
|
211 | - * espresso_load_error_handling |
|
212 | - * this function loads EE's class for handling exceptions and errors |
|
213 | - */ |
|
214 | - function espresso_load_error_handling() |
|
215 | - { |
|
216 | - // load debugging tools |
|
217 | - if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) { |
|
218 | - require_once(EE_HELPERS . 'EEH_Debug_Tools.helper.php'); |
|
219 | - EEH_Debug_Tools::instance(); |
|
220 | - } |
|
221 | - // load error handling |
|
222 | - if (is_readable(EE_CORE . 'EE_Error.core.php')) { |
|
223 | - require_once(EE_CORE . 'EE_Error.core.php'); |
|
224 | - } else { |
|
225 | - wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
226 | - } |
|
227 | - } |
|
209 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
210 | + /** |
|
211 | + * espresso_load_error_handling |
|
212 | + * this function loads EE's class for handling exceptions and errors |
|
213 | + */ |
|
214 | + function espresso_load_error_handling() |
|
215 | + { |
|
216 | + // load debugging tools |
|
217 | + if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) { |
|
218 | + require_once(EE_HELPERS . 'EEH_Debug_Tools.helper.php'); |
|
219 | + EEH_Debug_Tools::instance(); |
|
220 | + } |
|
221 | + // load error handling |
|
222 | + if (is_readable(EE_CORE . 'EE_Error.core.php')) { |
|
223 | + require_once(EE_CORE . 'EE_Error.core.php'); |
|
224 | + } else { |
|
225 | + wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
226 | + } |
|
227 | + } |
|
228 | 228 | |
229 | - /** |
|
230 | - * espresso_load_required |
|
231 | - * given a class name and path, this function will load that file or throw an exception |
|
232 | - * |
|
233 | - * @param string $classname |
|
234 | - * @param string $full_path_to_file |
|
235 | - * @throws EE_Error |
|
236 | - */ |
|
237 | - function espresso_load_required($classname, $full_path_to_file) |
|
238 | - { |
|
239 | - static $error_handling_loaded = false; |
|
240 | - if ( ! $error_handling_loaded) { |
|
241 | - espresso_load_error_handling(); |
|
242 | - $error_handling_loaded = true; |
|
243 | - } |
|
244 | - if (is_readable($full_path_to_file)) { |
|
245 | - require_once($full_path_to_file); |
|
246 | - } else { |
|
247 | - throw new EE_Error ( |
|
248 | - sprintf( |
|
249 | - esc_html__( |
|
250 | - 'The %s class file could not be located or is not readable due to file permissions.', |
|
251 | - 'event_espresso' |
|
252 | - ), |
|
253 | - $classname |
|
254 | - ) |
|
255 | - ); |
|
256 | - } |
|
257 | - } |
|
229 | + /** |
|
230 | + * espresso_load_required |
|
231 | + * given a class name and path, this function will load that file or throw an exception |
|
232 | + * |
|
233 | + * @param string $classname |
|
234 | + * @param string $full_path_to_file |
|
235 | + * @throws EE_Error |
|
236 | + */ |
|
237 | + function espresso_load_required($classname, $full_path_to_file) |
|
238 | + { |
|
239 | + static $error_handling_loaded = false; |
|
240 | + if ( ! $error_handling_loaded) { |
|
241 | + espresso_load_error_handling(); |
|
242 | + $error_handling_loaded = true; |
|
243 | + } |
|
244 | + if (is_readable($full_path_to_file)) { |
|
245 | + require_once($full_path_to_file); |
|
246 | + } else { |
|
247 | + throw new EE_Error ( |
|
248 | + sprintf( |
|
249 | + esc_html__( |
|
250 | + 'The %s class file could not be located or is not readable due to file permissions.', |
|
251 | + 'event_espresso' |
|
252 | + ), |
|
253 | + $classname |
|
254 | + ) |
|
255 | + ); |
|
256 | + } |
|
257 | + } |
|
258 | 258 | |
259 | - espresso_load_required('EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php'); |
|
260 | - espresso_load_required('EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php'); |
|
261 | - espresso_load_required('EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php'); |
|
262 | - new EE_Bootstrap(); |
|
263 | - } |
|
259 | + espresso_load_required('EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php'); |
|
260 | + espresso_load_required('EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php'); |
|
261 | + espresso_load_required('EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php'); |
|
262 | + new EE_Bootstrap(); |
|
263 | + } |
|
264 | 264 | } |
265 | 265 | if ( ! function_exists('espresso_deactivate_plugin')) { |
266 | - /** |
|
267 | - * deactivate_plugin |
|
268 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
269 | - * |
|
270 | - * @access public |
|
271 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
272 | - * @return void |
|
273 | - */ |
|
274 | - function espresso_deactivate_plugin($plugin_basename = '') |
|
275 | - { |
|
276 | - if ( ! function_exists('deactivate_plugins')) { |
|
277 | - require_once(ABSPATH . 'wp-admin/includes/plugin.php'); |
|
278 | - } |
|
279 | - unset($_GET['activate'], $_REQUEST['activate']); |
|
280 | - deactivate_plugins($plugin_basename); |
|
281 | - } |
|
266 | + /** |
|
267 | + * deactivate_plugin |
|
268 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
269 | + * |
|
270 | + * @access public |
|
271 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
272 | + * @return void |
|
273 | + */ |
|
274 | + function espresso_deactivate_plugin($plugin_basename = '') |
|
275 | + { |
|
276 | + if ( ! function_exists('deactivate_plugins')) { |
|
277 | + require_once(ABSPATH . 'wp-admin/includes/plugin.php'); |
|
278 | + } |
|
279 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
280 | + deactivate_plugins($plugin_basename); |
|
281 | + } |
|
282 | 282 | } |
283 | 283 | \ No newline at end of file |