@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' )) { exit( 'No direct script access allowed' ); } |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
2 | 2 | /** |
3 | 3 | * Class EE_Country_Select_Input |
4 | 4 | * |
@@ -11,23 +11,23 @@ discard block |
||
11 | 11 | * @since $VID:$ |
12 | 12 | * |
13 | 13 | */ |
14 | -class EE_Country_Select_Input extends EE_Select_Input{ |
|
14 | +class EE_Country_Select_Input extends EE_Select_Input { |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * @param array $country_options |
18 | 18 | * @param array $input_settings |
19 | 19 | * @return EE_Country_Select_Input |
20 | 20 | */ |
21 | - public function __construct( $country_options = NULL, $input_settings = array() ){ |
|
21 | + public function __construct($country_options = NULL, $input_settings = array()) { |
|
22 | 22 | $country_options = apply_filters( |
23 | 23 | 'FHEE__EE_Country_Select_Input____construct__country_options', |
24 | - $this->get_country_answer_options( $country_options ), |
|
24 | + $this->get_country_answer_options($country_options), |
|
25 | 25 | $this |
26 | 26 | ); |
27 | - $input_settings['html_class'] = isset( $input_settings['html_class'] ) |
|
28 | - ? $input_settings['html_class'] . ' ee-country-select-js' |
|
27 | + $input_settings['html_class'] = isset($input_settings['html_class']) |
|
28 | + ? $input_settings['html_class'].' ee-country-select-js' |
|
29 | 29 | : 'ee-country-select-js'; |
30 | - parent::__construct( $country_options, $input_settings ); |
|
30 | + parent::__construct($country_options, $input_settings); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | |
@@ -38,16 +38,16 @@ discard block |
||
38 | 38 | * @param array $country_options |
39 | 39 | * @return array |
40 | 40 | */ |
41 | - public function get_country_answer_options( $country_options = NULL ){ |
|
41 | + public function get_country_answer_options($country_options = NULL) { |
|
42 | 42 | // if passed something that is NOT an array |
43 | - if ( ! is_array( $country_options )) { |
|
43 | + if ( ! is_array($country_options)) { |
|
44 | 44 | // get possibly cached list of countries |
45 | 45 | $countries = EEM_Country::instance()->get_all_active_countries(); |
46 | - if ( ! empty( $countries )) { |
|
47 | - $country_options[ '' ] = ''; |
|
48 | - foreach( $countries as $country ){ |
|
49 | - if ( $country instanceof EE_Country ) { |
|
50 | - $country_options[ $country->ID() ] = $country->name(); |
|
46 | + if ( ! empty($countries)) { |
|
47 | + $country_options[''] = ''; |
|
48 | + foreach ($countries as $country) { |
|
49 | + if ($country instanceof EE_Country) { |
|
50 | + $country_options[$country->ID()] = $country->name(); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | } else { |
@@ -6,22 +6,22 @@ discard block |
||
6 | 6 | * @subpackage |
7 | 7 | * @author Mike Nelson |
8 | 8 | */ |
9 | -class EE_State_Select_Input extends EE_Select_Input{ |
|
9 | +class EE_State_Select_Input extends EE_Select_Input { |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * @param array $state_options |
13 | 13 | * @param array $input_settings |
14 | 14 | */ |
15 | - function __construct( $state_options, $input_settings = array() ){ |
|
15 | + function __construct($state_options, $input_settings = array()) { |
|
16 | 16 | $state_options = apply_filters( |
17 | 17 | 'FHEE__EE_State_Select_Input____construct__state_options', |
18 | - $this->get_state_answer_options( $state_options ), |
|
18 | + $this->get_state_answer_options($state_options), |
|
19 | 19 | $this |
20 | 20 | ); |
21 | - $input_settings['html_class'] = isset( $input_settings['html_class'] ) |
|
22 | - ? $input_settings['html_class'] . ' ee-state-select-js' |
|
21 | + $input_settings['html_class'] = isset($input_settings['html_class']) |
|
22 | + ? $input_settings['html_class'].' ee-state-select-js' |
|
23 | 23 | : 'ee-state-select-js'; |
24 | - parent::__construct( $state_options, $input_settings ); |
|
24 | + parent::__construct($state_options, $input_settings); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | |
@@ -32,17 +32,17 @@ discard block |
||
32 | 32 | * @param array $state_options |
33 | 33 | * @return array |
34 | 34 | */ |
35 | - public function get_state_answer_options( $state_options = NULL ){ |
|
35 | + public function get_state_answer_options($state_options = NULL) { |
|
36 | 36 | // if passed something that is NOT an array |
37 | - if ( ! is_array( $state_options )) { |
|
37 | + if ( ! is_array($state_options)) { |
|
38 | 38 | // get possibly cached list of states |
39 | 39 | $states = EEM_State::instance()->get_all_active_states(); |
40 | - if ( ! empty( $states )) { |
|
40 | + if ( ! empty($states)) { |
|
41 | 41 | //set the default |
42 | 42 | $state_options[''][''] = ''; |
43 | - foreach( $states as $state ){ |
|
44 | - if ( $state instanceof EE_State ) { |
|
45 | - $state_options[ $state->country()->name() ][ $state->ID() ] = $state->name(); |
|
43 | + foreach ($states as $state) { |
|
44 | + if ($state instanceof EE_State) { |
|
45 | + $state_options[$state->country()->name()][$state->ID()] = $state->name(); |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 | } else { |
@@ -15,9 +15,9 @@ discard block |
||
15 | 15 | //does question have any answers? cause if it does then we have to disable type |
16 | 16 | $has_answers = $question->has_answers(); |
17 | 17 | |
18 | -if ( $QST_system === 'country' ) { |
|
18 | +if ($QST_system === 'country') { |
|
19 | 19 | echo EEH_HTML::div( |
20 | - EEH_HTML::h4( '<span class="dashicons dashicons-info"></span>' . esc_html__( 'Did you know...', 'event_espresso' ) ) . |
|
20 | + EEH_HTML::h4('<span class="dashicons dashicons-info"></span>'.esc_html__('Did you know...', 'event_espresso')). |
|
21 | 21 | EEH_HTML::p( |
22 | 22 | esc_html__( |
23 | 23 | 'If you add a State/Province Select input immediately after this Country Select input when building your registration form, then the State/Province Select input options will change to correspond with the choice made in this input. So for example, choosing "United States" in this Country Select input will populate the State/Province Select input with just the state options for the United States.', |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | <tbody> |
35 | 35 | <tr> |
36 | 36 | <th> |
37 | - <label for="QST_display_text"><?php echo $fields['QST_display_text']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_text_info');?> |
|
37 | + <label for="QST_display_text"><?php echo $fields['QST_display_text']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_text_info'); ?> |
|
38 | 38 | </th> |
39 | 39 | <td> |
40 | 40 | <input type="text" class="regular-text" id="QST_display_text" name="QST_display_text" value="<?php $question->f('QST_display_text')?>"/> |
@@ -44,23 +44,23 @@ discard block |
||
44 | 44 | |
45 | 45 | <tr> |
46 | 46 | <th> |
47 | - <label for="QST_admin_label"><?php echo $fields['QST_admin_label']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_label_info');?> |
|
47 | + <label for="QST_admin_label"><?php echo $fields['QST_admin_label']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_label_info'); ?> |
|
48 | 48 | </th> |
49 | 49 | <td> |
50 | 50 | <?php |
51 | - $disabled = ! empty( $QST_system ) ? ' disabled="disabled"' : ''; |
|
52 | - $id = ! empty( $QST_system ) ? '_disabled' : ''; |
|
51 | + $disabled = ! empty($QST_system) ? ' disabled="disabled"' : ''; |
|
52 | + $id = ! empty($QST_system) ? '_disabled' : ''; |
|
53 | 53 | ?> |
54 | 54 | <input type="text" class="regular-text" id="QST_admin_label<?php echo $id?>" name="QST_admin_label<?php echo $id?>" value="<?php $question->f('QST_admin_label')?>"<?php echo $disabled?>/> |
55 | 55 | <input class="QST_order" type="hidden" id="QST_order<?php echo $id; ?>" name = "QST_order<?php echo $id; ?>" value="<?php echo $question->get('QST_order'); ?>" /> |
56 | - <?php if ( ! empty( $QST_system )) { ?> |
|
56 | + <?php if ( ! empty($QST_system)) { ?> |
|
57 | 57 | <input type="hidden" id="QST_admin_label" name="QST_admin_label" value="<?php echo $question->admin_label()?>"/> |
58 | 58 | <?php } ?> |
59 | 59 | <br/> |
60 | 60 | <p class="description"> |
61 | - <?php if ( ! empty( $QST_system )) { ?> |
|
61 | + <?php if ( ! empty($QST_system)) { ?> |
|
62 | 62 | <span class="description" style="color:#D54E21;"> |
63 | - <?php esc_html_e('System question! This field cannot be changed.','event_espresso')?> |
|
63 | + <?php esc_html_e('System question! This field cannot be changed.', 'event_espresso')?> |
|
64 | 64 | </span> |
65 | 65 | <?php } ?> |
66 | 66 | |
@@ -70,21 +70,21 @@ discard block |
||
70 | 70 | |
71 | 71 | <tr> |
72 | 72 | <th> |
73 | - <label for="QST_admin_only"><?php echo $fields['QST_admin_only']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_admin_only_info');?> |
|
73 | + <label for="QST_admin_only"><?php echo $fields['QST_admin_only']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_admin_only_info'); ?> |
|
74 | 74 | </th> |
75 | 75 | <td> |
76 | 76 | <?php |
77 | - $disabled = ! empty( $QST_system ) ? ' disabled="disabled"' : ''; |
|
78 | - $id = ! empty( $QST_system ) ? '_disabled' : ''; |
|
77 | + $disabled = ! empty($QST_system) ? ' disabled="disabled"' : ''; |
|
78 | + $id = ! empty($QST_system) ? '_disabled' : ''; |
|
79 | 79 | $admin_only = $question->get('QST_admin_only'); |
80 | - $checked = !empty( $admin_only ) ? ' checked="checked"' : ''; |
|
80 | + $checked = ! empty($admin_only) ? ' checked="checked"' : ''; |
|
81 | 81 | ?> |
82 | 82 | <input class="QST_admin_only" type="checkbox" id="QST_admin_only<?php echo $id; ?>" name = "QST_admin_only<?php echo $id; ?>" value="1"<?php echo $disabled; echo $checked; ?>/> |
83 | 83 | <br/> |
84 | 84 | <p class="description"> |
85 | - <?php if ( ! empty( $QST_system )) { ?> |
|
85 | + <?php if ( ! empty($QST_system)) { ?> |
|
86 | 86 | <span class="description" style="color:#D54E21;"> |
87 | - <?php esc_html_e('System question! This field cannot be changed.','event_espresso')?> |
|
87 | + <?php esc_html_e('System question! This field cannot be changed.', 'event_espresso')?> |
|
88 | 88 | </span> |
89 | 89 | <?php } ?> |
90 | 90 | |
@@ -94,21 +94,21 @@ discard block |
||
94 | 94 | |
95 | 95 | <tr> |
96 | 96 | <th> |
97 | - <label for="QST_type"><?php echo $fields['QST_type']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_type_info');?> |
|
97 | + <label for="QST_type"><?php echo $fields['QST_type']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_type_info'); ?> |
|
98 | 98 | </th> |
99 | 99 | <td> |
100 | 100 | <?php |
101 | - $disabled = ! empty( $QST_system ) ? ' disabled="disabled"' : ''; |
|
102 | - $id = ! empty( $QST_system ) ? '_disabled' : ''; |
|
103 | - echo EEH_Form_Fields::select_input( 'QST_type' . $id, $question_types, $question->type(), 'id="QST_type' . $id . '"' . $disabled ); |
|
104 | - if( ! empty( $QST_system ) ) { ?> |
|
101 | + $disabled = ! empty($QST_system) ? ' disabled="disabled"' : ''; |
|
102 | + $id = ! empty($QST_system) ? '_disabled' : ''; |
|
103 | + echo EEH_Form_Fields::select_input('QST_type'.$id, $question_types, $question->type(), 'id="QST_type'.$id.'"'.$disabled); |
|
104 | + if ( ! empty($QST_system)) { ?> |
|
105 | 105 | <input type="hidden" id="QST_type" name="QST_type" value="<?php echo $question->type()?>"/> |
106 | 106 | <?php |
107 | - $explanatory_text = esc_html__('System question! This field cannot be changed.','event_espresso'); |
|
108 | - }else{ |
|
109 | - $explanatory_text = esc_html__('Because there are currently answers for this question in the database, your options to change the question type have been limited to similar question-types.','event_espresso'); |
|
107 | + $explanatory_text = esc_html__('System question! This field cannot be changed.', 'event_espresso'); |
|
108 | + } else { |
|
109 | + $explanatory_text = esc_html__('Because there are currently answers for this question in the database, your options to change the question type have been limited to similar question-types.', 'event_espresso'); |
|
110 | 110 | } |
111 | - if ( ! empty( $QST_system ) || $has_answers ) { ?> |
|
111 | + if ( ! empty($QST_system) || $has_answers) { ?> |
|
112 | 112 | <p><span class="description" style="color:#D54E21;"> |
113 | 113 | <?php echo $explanatory_text; ?> |
114 | 114 | </span></p> |
@@ -121,22 +121,22 @@ discard block |
||
121 | 121 | <tr id="text_input_question_options"> |
122 | 122 | <th> |
123 | 123 | <label> |
124 | - <?php esc_html_e( 'Maximum Allowed Response Size', 'event_espresso' );?> |
|
124 | + <?php esc_html_e('Maximum Allowed Response Size', 'event_espresso'); ?> |
|
125 | 125 | </label> |
126 | 126 | </th> |
127 | 127 | <td> |
128 | - <input id="QST_max" name="QST_max" type="number" <?php echo $max_max === EE_INF ? '' : "max='$max_max'";?> value="<?php $question->f( 'QST_max' );?>" min="1"> |
|
128 | + <input id="QST_max" name="QST_max" type="number" <?php echo $max_max === EE_INF ? '' : "max='$max_max'"; ?> value="<?php $question->f('QST_max'); ?>" min="1"> |
|
129 | 129 | <p> |
130 | 130 | <span class="description"> |
131 | - <?php esc_html_e( 'Maximum number of characters allowed when answering this question', 'event_espresso' );?> |
|
131 | + <?php esc_html_e('Maximum number of characters allowed when answering this question', 'event_espresso'); ?> |
|
132 | 132 | </span> |
133 | 133 | </p> |
134 | - <?php if ( $QST_system ) { ?> |
|
134 | + <?php if ($QST_system) { ?> |
|
135 | 135 | <p> |
136 | 136 | <span class="description" style="color:#D54E21;"> |
137 | 137 | <?php printf( |
138 | - esc_html__( 'System question! The maximum number of characters that can be used for this question is %1$s', 'event_espresso' ), |
|
139 | - $max_max );?> |
|
138 | + esc_html__('System question! The maximum number of characters that can be used for this question is %1$s', 'event_espresso'), |
|
139 | + $max_max ); ?> |
|
140 | 140 | </span> |
141 | 141 | </p> |
142 | 142 | <?php } ?> |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | <tr id="question_options"> |
146 | 146 | <th> |
147 | 147 | <label> |
148 | - <?php esc_html_e('Answer Options','event_espresso')?> |
|
148 | + <?php esc_html_e('Answer Options', 'event_espresso')?> |
|
149 | 149 | </label> |
150 | 150 | </th> |
151 | 151 | <td> |
@@ -154,10 +154,10 @@ discard block |
||
154 | 154 | <thead> |
155 | 155 | <tr> |
156 | 156 | <th class="option-value-header"> |
157 | - <?php esc_html_e('Value','event_espresso')?> |
|
157 | + <?php esc_html_e('Value', 'event_espresso')?> |
|
158 | 158 | </th> |
159 | 159 | <th class="option-desc-header"> |
160 | - <?php esc_html_e('Description (optional, only shown on registration form)','event_espresso')?> |
|
160 | + <?php esc_html_e('Description (optional, only shown on registration form)', 'event_espresso')?> |
|
161 | 161 | </th> |
162 | 162 | <th> |
163 | 163 | </th> |
@@ -180,17 +180,17 @@ discard block |
||
180 | 180 | </tr> |
181 | 181 | |
182 | 182 | <?php |
183 | - $count=0; |
|
183 | + $count = 0; |
|
184 | 184 | $question_options = $question->options(); |
185 | - if ( ! empty( $question_options )) { |
|
186 | - foreach( $question_options as $option_id => $option ) { |
|
187 | - $disabled = $has_answers || $option->get('QSO_system') ? ' disabled="disabled"' : ''; |
|
185 | + if ( ! empty($question_options)) { |
|
186 | + foreach ($question_options as $option_id => $option) { |
|
187 | + $disabled = $has_answers || $option->get('QSO_system') ? ' disabled="disabled"' : ''; |
|
188 | 188 | ?> |
189 | 189 | <tr class="question-option ee-options-sortable"> |
190 | 190 | <td class="option-value-cell"> |
191 | 191 | <input type="hidden" class="QSO_order" name="question_options[<?php echo $count; ?>][QSO_order]" value="<?php echo $count; ?>"> |
192 | 192 | <input type="text" class="option-value regular-text" name="question_options[<?php echo $count?>][QSO_value]" value="<?php $option->f('QSO_value')?>"<?php echo $disabled; ?>> |
193 | - <?php if ( $has_answers ) : ?> |
|
193 | + <?php if ($has_answers) : ?> |
|
194 | 194 | <input type="hidden" name="question_options[<?php echo $count; ?>][QSO_value]" value="<?php echo $option->f('QSO_value'); ?>" > |
195 | 195 | <?php endif; ?> |
196 | 196 | </td> |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | <input type="text" class="option-desc regular-text" name="question_options[<?php echo $count?>][QSO_desc]" value="<?php $option->f('QSO_desc')?>"> |
199 | 199 | </td> |
200 | 200 | <td> |
201 | - <?php if ( ! $option->system() ) { ?> |
|
201 | + <?php if ( ! $option->system()) { ?> |
|
202 | 202 | <span class="dashicons clickable dashicons-post-trash ee-icon-size-18 remove-option remove-item"></span> |
203 | 203 | <?php } ?> |
204 | 204 | <span class="dashicons dashicons-image-flip-vertical sortable-drag-handle ee-icon-size-18"></span> |
@@ -237,13 +237,13 @@ discard block |
||
237 | 237 | </table> |
238 | 238 | |
239 | 239 | <a id="new-question-option" class="button" style="margin:0 0 1em 3px;"> |
240 | - <?php esc_html_e('Add Another Answer Option','event_espresso')?> |
|
240 | + <?php esc_html_e('Add Another Answer Option', 'event_espresso')?> |
|
241 | 241 | </a><br/> |
242 | 242 | |
243 | 243 | <p class="description"> |
244 | - <?php esc_html_e('Answer Options are the choices that you give people to select from for RADIO_BTN, CHECKBOX or DROPDOWN questions. The Value is a simple key that will be saved to the database and the description is optional. Note that values CANNOT contain any HTML, but descriptions can.','event_espresso')?> |
|
244 | + <?php esc_html_e('Answer Options are the choices that you give people to select from for RADIO_BTN, CHECKBOX or DROPDOWN questions. The Value is a simple key that will be saved to the database and the description is optional. Note that values CANNOT contain any HTML, but descriptions can.', 'event_espresso')?> |
|
245 | 245 | </p> |
246 | - <?php if ( $has_answers ) : ?> |
|
246 | + <?php if ($has_answers) : ?> |
|
247 | 247 | <p class="description" style="color:#D54E21;"> |
248 | 248 | <?php esc_html_e('Answer values that are uneditable are this way because there are registrations in the database that have answers for this question. If you need to correct a mistake, or edit an existing option value, then trash the existing one and create a new option with the changes. This will ensure that the existing registrations that chose the original answer will preserve that answer.', 'event_espresso'); ?> |
249 | 249 | </p> |
@@ -254,32 +254,32 @@ discard block |
||
254 | 254 | |
255 | 255 | <tr> |
256 | 256 | <th> |
257 | - <label for="QST_required"><?php echo $fields['QST_required']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('required_question_info');?> |
|
257 | + <label for="QST_required"><?php echo $fields['QST_required']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('required_question_info'); ?> |
|
258 | 258 | </th> |
259 | 259 | <td> |
260 | 260 | <?php |
261 | - $system_required = array( 'fname', 'email' ); |
|
262 | - $disabled = in_array( $QST_system, $system_required ) ? ' disabled="disabled"' : ''; |
|
261 | + $system_required = array('fname', 'email'); |
|
262 | + $disabled = in_array($QST_system, $system_required) ? ' disabled="disabled"' : ''; |
|
263 | 263 | $required_on = $question->get('QST_admin_only'); |
264 | 264 | $show_required_msg = $required_on ? '' : ' display:none;'; |
265 | - $disabled = $required_on || ! empty( $disabled ) ? ' disabled="disabled"' : ''; |
|
266 | - $id = ! empty( $disabled ) && in_array( $QST_system, $system_required) ? '_disabled' : ''; |
|
267 | - $requiredOptions=array( |
|
268 | - array( 'text'=> esc_html__( 'Optional', 'event_espresso' ), 'id'=>0 ), |
|
269 | - array( 'text'=> esc_html__( 'Required', 'event_espresso' ), 'id'=>1 ) |
|
265 | + $disabled = $required_on || ! empty($disabled) ? ' disabled="disabled"' : ''; |
|
266 | + $id = ! empty($disabled) && in_array($QST_system, $system_required) ? '_disabled' : ''; |
|
267 | + $requiredOptions = array( |
|
268 | + array('text'=> esc_html__('Optional', 'event_espresso'), 'id'=>0), |
|
269 | + array('text'=> esc_html__('Required', 'event_espresso'), 'id'=>1) |
|
270 | 270 | ); |
271 | - echo EEH_Form_Fields::select_input('QST_required' . $id, $requiredOptions, $question->required(), 'id="QST_required' . $id . '"' . $disabled ); |
|
271 | + echo EEH_Form_Fields::select_input('QST_required'.$id, $requiredOptions, $question->required(), 'id="QST_required'.$id.'"'.$disabled); |
|
272 | 272 | ?> |
273 | 273 | <p><span id="required_toggled_on" class="description" style="color:#D54E21;<?php echo $show_required_msg; ?>"> |
274 | - <?php esc_html_e('Required is set to optional, and this field is disabled, because the question is Admin-Only.','event_espresso')?> |
|
274 | + <?php esc_html_e('Required is set to optional, and this field is disabled, because the question is Admin-Only.', 'event_espresso')?> |
|
275 | 275 | </span></p> |
276 | 276 | <p><span id="required_toggled_off" class="description" style="color:#D54E21; display: none;"> |
277 | - <?php esc_html_e('Required option field is no longer disabled because the question is not Admin-Only','event_espresso')?> |
|
277 | + <?php esc_html_e('Required option field is no longer disabled because the question is not Admin-Only', 'event_espresso')?> |
|
278 | 278 | </span></p> |
279 | - <?php if ( ! empty( $disabled ) && in_array( $QST_system, $system_required ) ) { ?> |
|
279 | + <?php if ( ! empty($disabled) && in_array($QST_system, $system_required)) { ?> |
|
280 | 280 | <input type="hidden" id="QST_required" name="QST_required" value="1"/> |
281 | 281 | <p><span class="description" style="color:#D54E21;"> |
282 | - <?php esc_html_e('System question! This field cannot be changed.','event_espresso')?> |
|
282 | + <?php esc_html_e('System question! This field cannot be changed.', 'event_espresso')?> |
|
283 | 283 | </span></p> |
284 | 284 | <?php } ?> |
285 | 285 | |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | |
289 | 289 | <tr> |
290 | 290 | <th> |
291 | - <label for="QST_required_text"><?php esc_html_e('Required Text', 'event_espresso'); ?></label> <?php echo EEH_Template::get_help_tab_link('required_text_info');?> |
|
291 | + <label for="QST_required_text"><?php esc_html_e('Required Text', 'event_espresso'); ?></label> <?php echo EEH_Template::get_help_tab_link('required_text_info'); ?> |
|
292 | 292 | </th> |
293 | 293 | <td> |
294 | 294 | <input type="text" maxlength="100" class="regular-text" id="QST_required_text" name="QST_required_text" value="<?php $question->f('QST_required_text')?>"/> |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -38,21 +38,21 @@ discard block |
||
38 | 38 | * @return float total taxes to apply to ticket. |
39 | 39 | * @throws \EE_Error |
40 | 40 | */ |
41 | - public static function get_total_taxes_for_admin( EE_Ticket $ticket ) { |
|
41 | + public static function get_total_taxes_for_admin(EE_Ticket $ticket) { |
|
42 | 42 | $tax = 0; |
43 | 43 | $total_tax = 0; |
44 | 44 | //This first checks to see if the given ticket is taxable. |
45 | - if ( ! $ticket->get( 'TKT_taxable' ) ) { |
|
45 | + if ( ! $ticket->get('TKT_taxable')) { |
|
46 | 46 | return $tax; |
47 | 47 | } |
48 | 48 | //get subtotal (notice we're only retrieving a subtotal if there isn't one given) |
49 | - $subtotal = self::get_subtotal_for_admin( $ticket ); |
|
49 | + $subtotal = self::get_subtotal_for_admin($ticket); |
|
50 | 50 | //get taxes |
51 | 51 | $taxes = self::get_taxes_for_admin(); |
52 | 52 | //apply taxes to subtotal |
53 | - foreach ( $taxes as $tax ) { |
|
53 | + foreach ($taxes as $tax) { |
|
54 | 54 | //assuming taxes are not cumulative |
55 | - $total_tax += $subtotal * $tax->get( 'PRC_amount' ) / 100; |
|
55 | + $total_tax += $subtotal * $tax->get('PRC_amount') / 100; |
|
56 | 56 | } |
57 | 57 | return $total_tax; |
58 | 58 | } |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public static function get_total_taxes_percentage() { |
70 | 70 | $total_tax_percent = 0; |
71 | - foreach ( self::get_taxes_for_admin() as $tax_price ) { |
|
72 | - $total_tax_percent += $tax_price->get( 'PRC_amount' ); |
|
71 | + foreach (self::get_taxes_for_admin() as $tax_price) { |
|
72 | + $total_tax_percent += $tax_price->get('PRC_amount'); |
|
73 | 73 | } |
74 | 74 | return $total_tax_percent; |
75 | 75 | } |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | * @return float |
82 | 82 | * @throws \EE_Error |
83 | 83 | */ |
84 | - public static function get_subtotal_for_admin( EE_Ticket $ticket ) { |
|
84 | + public static function get_subtotal_for_admin(EE_Ticket $ticket) { |
|
85 | 85 | $TKT_ID = $ticket->ID(); |
86 | - return isset( self::$_subtotal[ $TKT_ID ] ) |
|
87 | - ? self::$_subtotal[ $TKT_ID ] |
|
88 | - : self::_get_subtotal_for_admin( $ticket ); |
|
86 | + return isset(self::$_subtotal[$TKT_ID]) |
|
87 | + ? self::$_subtotal[$TKT_ID] |
|
88 | + : self::_get_subtotal_for_admin($ticket); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | |
@@ -97,37 +97,37 @@ discard block |
||
97 | 97 | * @return float subtotal calculated from all EE_Price[] on Ticket. |
98 | 98 | * @throws \EE_Error |
99 | 99 | */ |
100 | - private static function _get_subtotal_for_admin( EE_Ticket $ticket ) { |
|
100 | + private static function _get_subtotal_for_admin(EE_Ticket $ticket) { |
|
101 | 101 | $subtotal = 0; |
102 | 102 | //get all prices |
103 | 103 | $prices = $ticket->get_many_related( |
104 | 104 | 'Price', |
105 | 105 | array( |
106 | 106 | 'default_where_conditions' => 'none', |
107 | - 'order_by' => array( 'PRC_order' => 'ASC' ), |
|
107 | + 'order_by' => array('PRC_order' => 'ASC'), |
|
108 | 108 | ) |
109 | 109 | ); |
110 | 110 | //let's loop through them (base price is always the first item) |
111 | - foreach ( $prices as $price ) { |
|
112 | - if ( $price instanceof EE_Price ) { |
|
111 | + foreach ($prices as $price) { |
|
112 | + if ($price instanceof EE_Price) { |
|
113 | 113 | $price_type = $price->type_obj(); |
114 | - if ( $price_type instanceof EE_Price_Type ) { |
|
115 | - switch ( $price->type_obj()->base_type() ) { |
|
114 | + if ($price_type instanceof EE_Price_Type) { |
|
115 | + switch ($price->type_obj()->base_type()) { |
|
116 | 116 | case 1: // base price |
117 | 117 | case 3: // surcharges |
118 | - $subtotal += $price->is_percent() ? $subtotal * $price->get( 'PRC_amount' ) / 100 |
|
119 | - : $price->get( 'PRC_amount' ); |
|
118 | + $subtotal += $price->is_percent() ? $subtotal * $price->get('PRC_amount') / 100 |
|
119 | + : $price->get('PRC_amount'); |
|
120 | 120 | break; |
121 | 121 | case 2: // discounts |
122 | - $subtotal -= $price->is_percent() ? $subtotal * $price->get( 'PRC_amount' ) / 100 |
|
123 | - : $price->get( 'PRC_amount' ); |
|
122 | + $subtotal -= $price->is_percent() ? $subtotal * $price->get('PRC_amount') / 100 |
|
123 | + : $price->get('PRC_amount'); |
|
124 | 124 | break; |
125 | 125 | } |
126 | 126 | } |
127 | 127 | } |
128 | 128 | } |
129 | 129 | $TKT_ID = $ticket->ID(); |
130 | - self::$_subtotal = array( $TKT_ID => $subtotal ); |
|
130 | + self::$_subtotal = array($TKT_ID => $subtotal); |
|
131 | 131 | return $subtotal; |
132 | 132 | } |
133 | 133 | |
@@ -140,9 +140,9 @@ discard block |
||
140 | 140 | * @throws \EE_Error |
141 | 141 | */ |
142 | 142 | public static function get_taxes_for_admin() { |
143 | - if ( empty( self::$_default_taxes ) ) { |
|
144 | - self::$_default_taxes = EE_Registry::instance()->load_model( 'Price' )->get_all( |
|
145 | - array( array( 'Price_Type.PBT_ID' => 4 ) ) |
|
143 | + if (empty(self::$_default_taxes)) { |
|
144 | + self::$_default_taxes = EE_Registry::instance()->load_model('Price')->get_all( |
|
145 | + array(array('Price_Type.PBT_ID' => 4)) |
|
146 | 146 | ); |
147 | 147 | } |
148 | 148 | return self::$_default_taxes; |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | * |
484 | 484 | * @final |
485 | 485 | * @access protected |
486 | - * @return void |
|
486 | + * @return false|null |
|
487 | 487 | */ |
488 | 488 | final protected function _page_setup() { |
489 | 489 | |
@@ -757,7 +757,7 @@ discard block |
||
757 | 757 | * All this method does is verify the incoming request and make sure that routes exist for it. We do this early so we know if we need to drop out. |
758 | 758 | * |
759 | 759 | * @access protected |
760 | - * @return void |
|
760 | + * @return false|null |
|
761 | 761 | */ |
762 | 762 | protected function _verify_routes() { |
763 | 763 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -819,7 +819,7 @@ discard block |
||
819 | 819 | /** |
820 | 820 | * this method simply verifies a given route and makes sure its an actual route available for the loaded page |
821 | 821 | * @param string $route the route name we're verifying |
822 | - * @return mixed (bool|Exception) we'll throw an exception if this isn't a valid route. |
|
822 | + * @return boolean (bool|Exception) we'll throw an exception if this isn't a valid route. |
|
823 | 823 | */ |
824 | 824 | protected function _verify_route( $route ) { |
825 | 825 | if ( array_key_exists( $this->_req_action, $this->_page_routes )) { |
@@ -3411,7 +3411,7 @@ discard block |
||
3411 | 3411 | |
3412 | 3412 | |
3413 | 3413 | /** |
3414 | - * @return mixed |
|
3414 | + * @return string[] |
|
3415 | 3415 | */ |
3416 | 3416 | public function default_espresso_metaboxes() { |
3417 | 3417 | return $this->_default_espresso_metaboxes; |
@@ -3429,7 +3429,7 @@ discard block |
||
3429 | 3429 | |
3430 | 3430 | |
3431 | 3431 | /** |
3432 | - * @return mixed |
|
3432 | + * @return string |
|
3433 | 3433 | */ |
3434 | 3434 | public function wp_page_slug() { |
3435 | 3435 | return $this->_wp_page_slug; |
@@ -2193,7 +2193,7 @@ discard block |
||
2193 | 2193 | $table_analysis = EE_Registry::instance()->create( 'TableAnalysis', array(), true ); |
2194 | 2194 | // get country code from organization settings or use default |
2195 | 2195 | $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) |
2196 | - && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
|
2196 | + && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
|
2197 | 2197 | ? EE_Registry::instance()->CFG->organization->CNT_ISO |
2198 | 2198 | : ''; |
2199 | 2199 | // but override if requested |
@@ -2907,8 +2907,8 @@ discard block |
||
2907 | 2907 | */ |
2908 | 2908 | public function max_input_vars_limit_check( $input_count = 0 ) { |
2909 | 2909 | if ( ! empty( $this->php->max_input_vars ) |
2910 | - && ( $input_count >= $this->php->max_input_vars ) |
|
2911 | - && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2910 | + && ( $input_count >= $this->php->max_input_vars ) |
|
2911 | + && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2912 | 2912 | ) { |
2913 | 2913 | return sprintf( |
2914 | 2914 | __( |
@@ -2952,22 +2952,22 @@ discard block |
||
2952 | 2952 | class EE_Tax_Config extends EE_Config_Base |
2953 | 2953 | { |
2954 | 2954 | |
2955 | - /* |
|
2955 | + /* |
|
2956 | 2956 | * flag to indicate whether or not to display ticket prices with the taxes included |
2957 | 2957 | * |
2958 | 2958 | * @var boolean $prices_displayed_including_taxes |
2959 | 2959 | */ |
2960 | - public $prices_displayed_including_taxes; |
|
2960 | + public $prices_displayed_including_taxes; |
|
2961 | 2961 | |
2962 | 2962 | |
2963 | 2963 | |
2964 | - /** |
|
2965 | - * class constructor |
|
2966 | - */ |
|
2967 | - public function __construct() |
|
2968 | - { |
|
2969 | - $this->prices_displayed_including_taxes = true; |
|
2970 | - } |
|
2964 | + /** |
|
2965 | + * class constructor |
|
2966 | + */ |
|
2967 | + public function __construct() |
|
2968 | + { |
|
2969 | + $this->prices_displayed_including_taxes = true; |
|
2970 | + } |
|
2971 | 2971 | } |
2972 | 2972 | |
2973 | 2973 |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | public static function instance() { |
130 | 130 | // check if class object is instantiated, and instantiated properly |
131 | - if ( ! self::$_instance instanceof EE_Config ) { |
|
131 | + if ( ! self::$_instance instanceof EE_Config) { |
|
132 | 132 | self::$_instance = new self(); |
133 | 133 | } |
134 | 134 | return self::$_instance; |
@@ -148,20 +148,20 @@ discard block |
||
148 | 148 | * site was put into maintenance mode) |
149 | 149 | * @return EE_Config |
150 | 150 | */ |
151 | - public static function reset( $hard_reset = false, $reinstantiate = true ) { |
|
152 | - if ( $hard_reset ) { |
|
151 | + public static function reset($hard_reset = false, $reinstantiate = true) { |
|
152 | + if ($hard_reset) { |
|
153 | 153 | self::$_instance->_addon_option_names = array(); |
154 | 154 | self::$_instance->_initialize_config(); |
155 | 155 | self::$_instance->update_espresso_config(); |
156 | 156 | } |
157 | - if ( self::$_instance instanceof EE_Config ) { |
|
157 | + if (self::$_instance instanceof EE_Config) { |
|
158 | 158 | self::$_instance->update_addon_option_names(); |
159 | 159 | } |
160 | 160 | self::$_instance = null; |
161 | 161 | //we don't need to reset the static properties imo because those should |
162 | 162 | //only change when a module is added or removed. Currently we don't |
163 | 163 | //support removing a module during a request when it previously existed |
164 | - if ( $reinstantiate ) { |
|
164 | + if ($reinstantiate) { |
|
165 | 165 | return self::instance(); |
166 | 166 | } else { |
167 | 167 | return null; |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | * @access private |
177 | 177 | */ |
178 | 178 | private function __construct() { |
179 | - do_action( 'AHEE__EE_Config__construct__begin', $this ); |
|
179 | + do_action('AHEE__EE_Config__construct__begin', $this); |
|
180 | 180 | // setup empty config classes |
181 | 181 | $this->_initialize_config(); |
182 | 182 | // load existing EE site settings |
@@ -186,17 +186,17 @@ discard block |
||
186 | 186 | // register shortcodes and modules |
187 | 187 | add_action( |
188 | 188 | 'AHEE__EE_System__register_shortcodes_modules_and_widgets', |
189 | - array( $this, 'register_shortcodes_and_modules' ), |
|
189 | + array($this, 'register_shortcodes_and_modules'), |
|
190 | 190 | 999 |
191 | 191 | ); |
192 | 192 | // initialize shortcodes and modules |
193 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' ) ); |
|
193 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules')); |
|
194 | 194 | // register widgets |
195 | - add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 ); |
|
195 | + add_action('widgets_init', array($this, 'widgets_init'), 10); |
|
196 | 196 | // shutdown |
197 | - add_action( 'shutdown', array( $this, 'shutdown' ), 10 ); |
|
197 | + add_action('shutdown', array($this, 'shutdown'), 10); |
|
198 | 198 | // construct__end hook |
199 | - do_action( 'AHEE__EE_Config__construct__end', $this ); |
|
199 | + do_action('AHEE__EE_Config__construct__end', $this); |
|
200 | 200 | // hardcoded hack |
201 | 201 | $this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014'; |
202 | 202 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * @return string current theme set. |
210 | 210 | */ |
211 | 211 | public static function get_current_theme() { |
212 | - return isset( self::$_instance->template_settings->current_espresso_theme ) |
|
212 | + return isset(self::$_instance->template_settings->current_espresso_theme) |
|
213 | 213 | ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
214 | 214 | } |
215 | 215 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | private function _initialize_config() { |
225 | 225 | EE_Config::trim_log(); |
226 | 226 | //set defaults |
227 | - $this->_addon_option_names = get_option( EE_Config::ADDON_OPTION_NAMES, array() ); |
|
227 | + $this->_addon_option_names = get_option(EE_Config::ADDON_OPTION_NAMES, array()); |
|
228 | 228 | $this->addons = new stdClass(); |
229 | 229 | // set _module_route_map |
230 | 230 | EE_Config::$_module_route_map = array(); |
@@ -244,9 +244,9 @@ discard block |
||
244 | 244 | */ |
245 | 245 | private function _load_core_config() { |
246 | 246 | // load_core_config__start hook |
247 | - do_action( 'AHEE__EE_Config___load_core_config__start', $this ); |
|
247 | + do_action('AHEE__EE_Config___load_core_config__start', $this); |
|
248 | 248 | $espresso_config = $this->get_espresso_config(); |
249 | - foreach ( $espresso_config as $config => $settings ) { |
|
249 | + foreach ($espresso_config as $config => $settings) { |
|
250 | 250 | // load_core_config__start hook |
251 | 251 | $settings = apply_filters( |
252 | 252 | 'FHEE__EE_Config___load_core_config__config_settings', |
@@ -254,22 +254,22 @@ discard block |
||
254 | 254 | $config, |
255 | 255 | $this |
256 | 256 | ); |
257 | - if ( is_object( $settings ) && property_exists( $this, $config ) ) { |
|
258 | - $this->{$config} = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings ); |
|
257 | + if (is_object($settings) && property_exists($this, $config)) { |
|
258 | + $this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings); |
|
259 | 259 | //call configs populate method to ensure any defaults are set for empty values. |
260 | - if ( method_exists( $settings, 'populate' ) ) { |
|
260 | + if (method_exists($settings, 'populate')) { |
|
261 | 261 | $this->{$config}->populate(); |
262 | 262 | } |
263 | - if ( method_exists( $settings, 'do_hooks' ) ) { |
|
263 | + if (method_exists($settings, 'do_hooks')) { |
|
264 | 264 | $this->{$config}->do_hooks(); |
265 | 265 | } |
266 | 266 | } |
267 | 267 | } |
268 | - if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', false ) ) { |
|
268 | + if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', false)) { |
|
269 | 269 | $this->update_espresso_config(); |
270 | 270 | } |
271 | 271 | // load_core_config__end hook |
272 | - do_action( 'AHEE__EE_Config___load_core_config__end', $this ); |
|
272 | + do_action('AHEE__EE_Config___load_core_config__end', $this); |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | |
@@ -284,23 +284,23 @@ discard block |
||
284 | 284 | $this->core = $this->core instanceof EE_Core_Config |
285 | 285 | ? $this->core |
286 | 286 | : new EE_Core_Config(); |
287 | - $this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core ); |
|
287 | + $this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core); |
|
288 | 288 | $this->organization = $this->organization instanceof EE_Organization_Config |
289 | 289 | ? $this->organization |
290 | 290 | : new EE_Organization_Config(); |
291 | - $this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization ); |
|
291 | + $this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization); |
|
292 | 292 | $this->currency = $this->currency instanceof EE_Currency_Config |
293 | 293 | ? $this->currency |
294 | 294 | : new EE_Currency_Config(); |
295 | - $this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency ); |
|
295 | + $this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency); |
|
296 | 296 | $this->registration = $this->registration instanceof EE_Registration_Config |
297 | 297 | ? $this->registration |
298 | 298 | : new EE_Registration_Config(); |
299 | - $this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration ); |
|
299 | + $this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration); |
|
300 | 300 | $this->admin = $this->admin instanceof EE_Admin_Config |
301 | 301 | ? $this->admin |
302 | 302 | : new EE_Admin_Config(); |
303 | - $this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin ); |
|
303 | + $this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin); |
|
304 | 304 | $this->template_settings = $this->template_settings instanceof EE_Template_Config |
305 | 305 | ? $this->template_settings |
306 | 306 | : new EE_Template_Config(); |
@@ -311,19 +311,19 @@ discard block |
||
311 | 311 | $this->map_settings = $this->map_settings instanceof EE_Map_Config |
312 | 312 | ? $this->map_settings |
313 | 313 | : new EE_Map_Config(); |
314 | - $this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings ); |
|
314 | + $this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings); |
|
315 | 315 | $this->environment = $this->environment instanceof EE_Environment_Config |
316 | 316 | ? $this->environment |
317 | 317 | : new EE_Environment_Config(); |
318 | - $this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment ); |
|
318 | + $this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment); |
|
319 | 319 | $this->tax_settings = $this->tax_settings instanceof EE_Tax_Config |
320 | 320 | ? $this->tax_settings |
321 | 321 | : new EE_Tax_Config(); |
322 | - $this->tax_settings = apply_filters( 'FHEE__EE_Config___initialize_config__tax_settings', $this->tax_settings ); |
|
322 | + $this->tax_settings = apply_filters('FHEE__EE_Config___initialize_config__tax_settings', $this->tax_settings); |
|
323 | 323 | $this->gateway = $this->gateway instanceof EE_Gateway_Config |
324 | 324 | ? $this->gateway |
325 | 325 | : new EE_Gateway_Config(); |
326 | - $this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway ); |
|
326 | + $this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway); |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | // grab espresso configuration |
339 | 339 | return apply_filters( |
340 | 340 | 'FHEE__EE_Config__get_espresso_config__CFG', |
341 | - get_option( EE_Config::OPTION_NAME, array() ) |
|
341 | + get_option(EE_Config::OPTION_NAME, array()) |
|
342 | 342 | ); |
343 | 343 | } |
344 | 344 | |
@@ -352,12 +352,12 @@ discard block |
||
352 | 352 | * @param $old_value |
353 | 353 | * @param $value |
354 | 354 | */ |
355 | - public function double_check_config_comparison( $option = '', $old_value, $value ) { |
|
355 | + public function double_check_config_comparison($option = '', $old_value, $value) { |
|
356 | 356 | // make sure we're checking the ee config |
357 | - if ( $option === EE_Config::OPTION_NAME ) { |
|
357 | + if ($option === EE_Config::OPTION_NAME) { |
|
358 | 358 | // run a loose comparison of the old value against the new value for type and properties, |
359 | 359 | // but NOT exact instance like WP update_option does (ie: NOT type safe comparison) |
360 | - if ( $value != $old_value ) { |
|
360 | + if ($value != $old_value) { |
|
361 | 361 | // if they are NOT the same, then remove the hook, |
362 | 362 | // which means the subsequent update results will be based solely on the update query results |
363 | 363 | // the reason we do this is because, as stated above, |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | // the string it sees in the db looks the same as the new one it has been passed!!! |
373 | 373 | // This results in the query returning an "affected rows" value of ZERO, |
374 | 374 | // which gets returned immediately by WP update_option and looks like an error. |
375 | - remove_action( 'update_option', array( $this, 'check_config_updated' ) ); |
|
375 | + remove_action('update_option', array($this, 'check_config_updated')); |
|
376 | 376 | } |
377 | 377 | } |
378 | 378 | } |
@@ -386,11 +386,11 @@ discard block |
||
386 | 386 | */ |
387 | 387 | protected function _reset_espresso_addon_config() { |
388 | 388 | $this->_addon_option_names = array(); |
389 | - foreach ( $this->addons as $addon_name => $addon_config_obj ) { |
|
390 | - $addon_config_obj = maybe_unserialize( $addon_config_obj ); |
|
391 | - $config_class = get_class( $addon_config_obj ); |
|
392 | - if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) { |
|
393 | - $this->update_config( 'addons', $addon_name, $addon_config_obj, false ); |
|
389 | + foreach ($this->addons as $addon_name => $addon_config_obj) { |
|
390 | + $addon_config_obj = maybe_unserialize($addon_config_obj); |
|
391 | + $config_class = get_class($addon_config_obj); |
|
392 | + if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) { |
|
393 | + $this->update_config('addons', $addon_name, $addon_config_obj, false); |
|
394 | 394 | } |
395 | 395 | $this->addons->{$addon_name} = null; |
396 | 396 | } |
@@ -406,22 +406,22 @@ discard block |
||
406 | 406 | * @param bool $add_error |
407 | 407 | * @return bool |
408 | 408 | */ |
409 | - public function update_espresso_config( $add_success = false, $add_error = true ) { |
|
409 | + public function update_espresso_config($add_success = false, $add_error = true) { |
|
410 | 410 | // don't allow config updates during WP heartbeats |
411 | - if ( \EE_Registry::instance()->REQ->get( 'action', '' ) === 'heartbeat' ) { |
|
411 | + if (\EE_Registry::instance()->REQ->get('action', '') === 'heartbeat') { |
|
412 | 412 | return false; |
413 | 413 | } |
414 | 414 | // commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197 |
415 | 415 | //$clone = clone( self::$_instance ); |
416 | 416 | //self::$_instance = NULL; |
417 | - do_action( 'AHEE__EE_Config__update_espresso_config__begin', $this ); |
|
417 | + do_action('AHEE__EE_Config__update_espresso_config__begin', $this); |
|
418 | 418 | $this->_reset_espresso_addon_config(); |
419 | 419 | // hook into update_option because that happens AFTER the ( $value === $old_value ) conditional |
420 | 420 | // but BEFORE the actual update occurs |
421 | - add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 ); |
|
421 | + add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3); |
|
422 | 422 | // now update "ee_config" |
423 | - $saved = update_option( EE_Config::OPTION_NAME, $this ); |
|
424 | - EE_Config::log( EE_Config::OPTION_NAME ); |
|
423 | + $saved = update_option(EE_Config::OPTION_NAME, $this); |
|
424 | + EE_Config::log(EE_Config::OPTION_NAME); |
|
425 | 425 | // if not saved... check if the hook we just added still exists; |
426 | 426 | // if it does, it means one of two things: |
427 | 427 | // that update_option bailed at the ( $value === $old_value ) conditional, |
@@ -432,17 +432,17 @@ discard block |
||
432 | 432 | // but just means no update occurred, so don't display an error to the user. |
433 | 433 | // BUT... if update_option returns FALSE, AND the hook is missing, |
434 | 434 | // then it means that something truly went wrong |
435 | - $saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' ) ) : $saved; |
|
435 | + $saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved; |
|
436 | 436 | // remove our action since we don't want it in the system anymore |
437 | - remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 ); |
|
438 | - do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved ); |
|
437 | + remove_action('update_option', array($this, 'double_check_config_comparison'), 1); |
|
438 | + do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved); |
|
439 | 439 | //self::$_instance = $clone; |
440 | 440 | //unset( $clone ); |
441 | 441 | // if config remains the same or was updated successfully |
442 | - if ( $saved ) { |
|
443 | - if ( $add_success ) { |
|
442 | + if ($saved) { |
|
443 | + if ($add_success) { |
|
444 | 444 | EE_Error::add_success( |
445 | - __( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ), |
|
445 | + __('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'), |
|
446 | 446 | __FILE__, |
447 | 447 | __FUNCTION__, |
448 | 448 | __LINE__ |
@@ -450,9 +450,9 @@ discard block |
||
450 | 450 | } |
451 | 451 | return true; |
452 | 452 | } else { |
453 | - if ( $add_error ) { |
|
453 | + if ($add_error) { |
|
454 | 454 | EE_Error::add_error( |
455 | - __( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ), |
|
455 | + __('The Event Espresso Configuration Settings were not updated.', 'event_espresso'), |
|
456 | 456 | __FILE__, |
457 | 457 | __FUNCTION__, |
458 | 458 | __LINE__ |
@@ -481,16 +481,16 @@ discard block |
||
481 | 481 | $name = '', |
482 | 482 | $config_class = '', |
483 | 483 | $config_obj = null, |
484 | - $tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ), |
|
484 | + $tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8), |
|
485 | 485 | $display_errors = true |
486 | 486 | ) { |
487 | 487 | try { |
488 | - foreach ( $tests_to_run as $test ) { |
|
489 | - switch ( $test ) { |
|
488 | + foreach ($tests_to_run as $test) { |
|
489 | + switch ($test) { |
|
490 | 490 | // TEST #1 : check that section was set |
491 | 491 | case 1 : |
492 | - if ( empty( $section ) ) { |
|
493 | - if ( $display_errors ) { |
|
492 | + if (empty($section)) { |
|
493 | + if ($display_errors) { |
|
494 | 494 | throw new EE_Error( |
495 | 495 | sprintf( |
496 | 496 | __( |
@@ -506,11 +506,11 @@ discard block |
||
506 | 506 | break; |
507 | 507 | // TEST #2 : check that settings section exists |
508 | 508 | case 2 : |
509 | - if ( ! isset( $this->{$section} ) ) { |
|
510 | - if ( $display_errors ) { |
|
509 | + if ( ! isset($this->{$section} )) { |
|
510 | + if ($display_errors) { |
|
511 | 511 | throw new EE_Error( |
512 | 512 | sprintf( |
513 | - __( 'The "%s" configuration section does not exist.', 'event_espresso' ), |
|
513 | + __('The "%s" configuration section does not exist.', 'event_espresso'), |
|
514 | 514 | $section |
515 | 515 | ) |
516 | 516 | ); |
@@ -521,9 +521,9 @@ discard block |
||
521 | 521 | // TEST #3 : check that section is the proper format |
522 | 522 | case 3 : |
523 | 523 | if ( |
524 | - ! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass ) |
|
524 | + ! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass) |
|
525 | 525 | ) { |
526 | - if ( $display_errors ) { |
|
526 | + if ($display_errors) { |
|
527 | 527 | throw new EE_Error( |
528 | 528 | sprintf( |
529 | 529 | __( |
@@ -539,8 +539,8 @@ discard block |
||
539 | 539 | break; |
540 | 540 | // TEST #4 : check that config section name has been set |
541 | 541 | case 4 : |
542 | - if ( empty( $name ) ) { |
|
543 | - if ( $display_errors ) { |
|
542 | + if (empty($name)) { |
|
543 | + if ($display_errors) { |
|
544 | 544 | throw new EE_Error( |
545 | 545 | __( |
546 | 546 | 'No name has been provided for the specific configuration section.', |
@@ -553,8 +553,8 @@ discard block |
||
553 | 553 | break; |
554 | 554 | // TEST #5 : check that a config class name has been set |
555 | 555 | case 5 : |
556 | - if ( empty( $config_class ) ) { |
|
557 | - if ( $display_errors ) { |
|
556 | + if (empty($config_class)) { |
|
557 | + if ($display_errors) { |
|
558 | 558 | throw new EE_Error( |
559 | 559 | __( |
560 | 560 | 'No class name has been provided for the specific configuration section.', |
@@ -567,8 +567,8 @@ discard block |
||
567 | 567 | break; |
568 | 568 | // TEST #6 : verify config class is accessible |
569 | 569 | case 6 : |
570 | - if ( ! class_exists( $config_class ) ) { |
|
571 | - if ( $display_errors ) { |
|
570 | + if ( ! class_exists($config_class)) { |
|
571 | + if ($display_errors) { |
|
572 | 572 | throw new EE_Error( |
573 | 573 | sprintf( |
574 | 574 | __( |
@@ -584,11 +584,11 @@ discard block |
||
584 | 584 | break; |
585 | 585 | // TEST #7 : check that config has even been set |
586 | 586 | case 7 : |
587 | - if ( ! isset( $this->{$section}->{$name} ) ) { |
|
588 | - if ( $display_errors ) { |
|
587 | + if ( ! isset($this->{$section}->{$name} )) { |
|
588 | + if ($display_errors) { |
|
589 | 589 | throw new EE_Error( |
590 | 590 | sprintf( |
591 | - __( 'No configuration has been set for "%1$s->%2$s".', 'event_espresso' ), |
|
591 | + __('No configuration has been set for "%1$s->%2$s".', 'event_espresso'), |
|
592 | 592 | $section, |
593 | 593 | $name |
594 | 594 | ) |
@@ -597,13 +597,13 @@ discard block |
||
597 | 597 | return false; |
598 | 598 | } else { |
599 | 599 | // and make sure it's not serialized |
600 | - $this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} ); |
|
600 | + $this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} ); |
|
601 | 601 | } |
602 | 602 | break; |
603 | 603 | // TEST #8 : check that config is the requested type |
604 | 604 | case 8 : |
605 | - if ( ! $this->{$section}->{$name} instanceof $config_class ) { |
|
606 | - if ( $display_errors ) { |
|
605 | + if ( ! $this->{$section}->{$name} instanceof $config_class) { |
|
606 | + if ($display_errors) { |
|
607 | 607 | throw new EE_Error( |
608 | 608 | sprintf( |
609 | 609 | __( |
@@ -621,12 +621,12 @@ discard block |
||
621 | 621 | break; |
622 | 622 | // TEST #9 : verify config object |
623 | 623 | case 9 : |
624 | - if ( ! $config_obj instanceof EE_Config_Base ) { |
|
625 | - if ( $display_errors ) { |
|
624 | + if ( ! $config_obj instanceof EE_Config_Base) { |
|
625 | + if ($display_errors) { |
|
626 | 626 | throw new EE_Error( |
627 | 627 | sprintf( |
628 | - __( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ), |
|
629 | - print_r( $config_obj, true ) |
|
628 | + __('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'), |
|
629 | + print_r($config_obj, true) |
|
630 | 630 | ) |
631 | 631 | ); |
632 | 632 | } |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | break; |
636 | 636 | } |
637 | 637 | } |
638 | - } catch ( EE_Error $e ) { |
|
638 | + } catch (EE_Error $e) { |
|
639 | 639 | $e->get_error(); |
640 | 640 | } |
641 | 641 | // you have successfully run the gauntlet |
@@ -652,8 +652,8 @@ discard block |
||
652 | 652 | * @param string $name |
653 | 653 | * @return string |
654 | 654 | */ |
655 | - private function _generate_config_option_name( $section = '', $name = '' ) { |
|
656 | - return 'ee_config-' . strtolower( $section . '-' . str_replace( array( 'EE_', 'EED_' ), '', $name ) ); |
|
655 | + private function _generate_config_option_name($section = '', $name = '') { |
|
656 | + return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name)); |
|
657 | 657 | } |
658 | 658 | |
659 | 659 | |
@@ -667,10 +667,10 @@ discard block |
||
667 | 667 | * @param string $name |
668 | 668 | * @return string |
669 | 669 | */ |
670 | - private function _set_config_class( $config_class = '', $name = '' ) { |
|
671 | - return ! empty( $config_class ) |
|
670 | + private function _set_config_class($config_class = '', $name = '') { |
|
671 | + return ! empty($config_class) |
|
672 | 672 | ? $config_class |
673 | - : str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ) ) ) . '_Config'; |
|
673 | + : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config'; |
|
674 | 674 | } |
675 | 675 | |
676 | 676 | |
@@ -685,36 +685,36 @@ discard block |
||
685 | 685 | * @param EE_Config_Base $config_obj |
686 | 686 | * @return EE_Config_Base |
687 | 687 | */ |
688 | - public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null ) { |
|
688 | + public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) { |
|
689 | 689 | // ensure config class is set to something |
690 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
690 | + $config_class = $this->_set_config_class($config_class, $name); |
|
691 | 691 | // run tests 1-4, 6, and 7 to verify all config params are set and valid |
692 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) { |
|
692 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
693 | 693 | return null; |
694 | 694 | } |
695 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
695 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
696 | 696 | // if the config option name hasn't been added yet to the list of option names we're tracking, then do so now |
697 | - if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) { |
|
698 | - $this->_addon_option_names[ $config_option_name ] = $config_class; |
|
697 | + if ( ! isset($this->_addon_option_names[$config_option_name])) { |
|
698 | + $this->_addon_option_names[$config_option_name] = $config_class; |
|
699 | 699 | $this->update_addon_option_names(); |
700 | 700 | } |
701 | 701 | // verify the incoming config object but suppress errors |
702 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) { |
|
702 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
703 | 703 | $config_obj = new $config_class(); |
704 | 704 | } |
705 | - if ( get_option( $config_option_name ) ) { |
|
706 | - EE_Config::log( $config_option_name ); |
|
707 | - update_option( $config_option_name, $config_obj ); |
|
705 | + if (get_option($config_option_name)) { |
|
706 | + EE_Config::log($config_option_name); |
|
707 | + update_option($config_option_name, $config_obj); |
|
708 | 708 | $this->{$section}->{$name} = $config_obj; |
709 | 709 | return $this->{$section}->{$name}; |
710 | 710 | } else { |
711 | 711 | // create a wp-option for this config |
712 | - if ( add_option( $config_option_name, $config_obj, '', 'no' ) ) { |
|
713 | - $this->{$section}->{$name} = maybe_unserialize( $config_obj ); |
|
712 | + if (add_option($config_option_name, $config_obj, '', 'no')) { |
|
713 | + $this->{$section}->{$name} = maybe_unserialize($config_obj); |
|
714 | 714 | return $this->{$section}->{$name}; |
715 | 715 | } else { |
716 | 716 | EE_Error::add_error( |
717 | - sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ), |
|
717 | + sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class), |
|
718 | 718 | __FILE__, |
719 | 719 | __FUNCTION__, |
720 | 720 | __LINE__ |
@@ -737,46 +737,46 @@ discard block |
||
737 | 737 | * @param bool $throw_errors |
738 | 738 | * @return bool |
739 | 739 | */ |
740 | - public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = true ) { |
|
740 | + public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) { |
|
741 | 741 | // don't allow config updates during WP heartbeats |
742 | - if ( \EE_Registry::instance()->REQ->get( 'action', '' ) === 'heartbeat' ) { |
|
742 | + if (\EE_Registry::instance()->REQ->get('action', '') === 'heartbeat') { |
|
743 | 743 | return false; |
744 | 744 | } |
745 | - $config_obj = maybe_unserialize( $config_obj ); |
|
745 | + $config_obj = maybe_unserialize($config_obj); |
|
746 | 746 | // get class name of the incoming object |
747 | - $config_class = get_class( $config_obj ); |
|
747 | + $config_class = get_class($config_obj); |
|
748 | 748 | // run tests 1-5 and 9 to verify config |
749 | 749 | if ( ! $this->_verify_config_params( |
750 | 750 | $section, |
751 | 751 | $name, |
752 | 752 | $config_class, |
753 | 753 | $config_obj, |
754 | - array( 1, 2, 3, 4, 7, 9 ) |
|
754 | + array(1, 2, 3, 4, 7, 9) |
|
755 | 755 | ) |
756 | 756 | ) { |
757 | 757 | return false; |
758 | 758 | } |
759 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
759 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
760 | 760 | // check if config object has been added to db by seeing if config option name is in $this->_addon_option_names array |
761 | - if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) { |
|
761 | + if ( ! isset($this->_addon_option_names[$config_option_name])) { |
|
762 | 762 | // save new config to db |
763 | - if( $this->set_config( $section, $name, $config_class, $config_obj ) ) { |
|
763 | + if ($this->set_config($section, $name, $config_class, $config_obj)) { |
|
764 | 764 | return true; |
765 | 765 | } |
766 | 766 | } else { |
767 | 767 | // first check if the record already exists |
768 | - $existing_config = get_option( $config_option_name ); |
|
769 | - $config_obj = serialize( $config_obj ); |
|
768 | + $existing_config = get_option($config_option_name); |
|
769 | + $config_obj = serialize($config_obj); |
|
770 | 770 | // just return if db record is already up to date (NOT type safe comparison) |
771 | - if ( $existing_config == $config_obj ) { |
|
771 | + if ($existing_config == $config_obj) { |
|
772 | 772 | $this->{$section}->{$name} = $config_obj; |
773 | 773 | return true; |
774 | - } else if ( update_option( $config_option_name, $config_obj ) ) { |
|
775 | - EE_Config::log( $config_option_name ); |
|
774 | + } else if (update_option($config_option_name, $config_obj)) { |
|
775 | + EE_Config::log($config_option_name); |
|
776 | 776 | // update wp-option for this config class |
777 | 777 | $this->{$section}->{$name} = $config_obj; |
778 | 778 | return true; |
779 | - } elseif ( $throw_errors ) { |
|
779 | + } elseif ($throw_errors) { |
|
780 | 780 | EE_Error::add_error( |
781 | 781 | sprintf( |
782 | 782 | __( |
@@ -784,7 +784,7 @@ discard block |
||
784 | 784 | 'event_espresso' |
785 | 785 | ), |
786 | 786 | $config_class, |
787 | - 'EE_Config->' . $section . '->' . $name |
|
787 | + 'EE_Config->'.$section.'->'.$name |
|
788 | 788 | ), |
789 | 789 | __FILE__, |
790 | 790 | __FUNCTION__, |
@@ -806,34 +806,34 @@ discard block |
||
806 | 806 | * @param string $config_class |
807 | 807 | * @return mixed EE_Config_Base | NULL |
808 | 808 | */ |
809 | - public function get_config( $section = '', $name = '', $config_class = '' ) { |
|
809 | + public function get_config($section = '', $name = '', $config_class = '') { |
|
810 | 810 | // ensure config class is set to something |
811 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
811 | + $config_class = $this->_set_config_class($config_class, $name); |
|
812 | 812 | // run tests 1-4, 6 and 7 to verify that all params have been set |
813 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) { |
|
813 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
814 | 814 | return null; |
815 | 815 | } |
816 | 816 | // now test if the requested config object exists, but suppress errors |
817 | - if ( $this->_verify_config_params( $section, $name, $config_class, null, array( 7, 8 ), false ) ) { |
|
817 | + if ($this->_verify_config_params($section, $name, $config_class, null, array(7, 8), false)) { |
|
818 | 818 | // config already exists, so pass it back |
819 | 819 | return $this->{$section}->{$name}; |
820 | 820 | } |
821 | 821 | // load config option from db if it exists |
822 | - $config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name ) ); |
|
822 | + $config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name)); |
|
823 | 823 | // verify the newly retrieved config object, but suppress errors |
824 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) { |
|
824 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
825 | 825 | // config is good, so set it and pass it back |
826 | 826 | $this->{$section}->{$name} = $config_obj; |
827 | 827 | return $this->{$section}->{$name}; |
828 | 828 | } |
829 | 829 | // oops! $config_obj is not already set and does not exist in the db, so create a new one |
830 | - $config_obj = $this->set_config( $section, $name, $config_class ); |
|
830 | + $config_obj = $this->set_config($section, $name, $config_class); |
|
831 | 831 | // verify the newly created config object |
832 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ) ) ) { |
|
832 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) { |
|
833 | 833 | return $this->{$section}->{$name}; |
834 | 834 | } else { |
835 | 835 | EE_Error::add_error( |
836 | - sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ), |
|
836 | + sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class), |
|
837 | 837 | __FILE__, |
838 | 838 | __FUNCTION__, |
839 | 839 | __LINE__ |
@@ -851,11 +851,11 @@ discard block |
||
851 | 851 | * @param string $config_option_name |
852 | 852 | * @return mixed EE_Config_Base | FALSE |
853 | 853 | */ |
854 | - public function get_config_option( $config_option_name = '' ) { |
|
854 | + public function get_config_option($config_option_name = '') { |
|
855 | 855 | // retrieve the wp-option for this config class. |
856 | - $config_option = maybe_unserialize( get_option( $config_option_name, array() ) ); |
|
857 | - if ( empty( $config_option ) ) { |
|
858 | - EE_Config::log( $config_option_name . '-NOT-FOUND' ); |
|
856 | + $config_option = maybe_unserialize(get_option($config_option_name, array())); |
|
857 | + if (empty($config_option)) { |
|
858 | + EE_Config::log($config_option_name.'-NOT-FOUND'); |
|
859 | 859 | } |
860 | 860 | return $config_option; |
861 | 861 | } |
@@ -867,17 +867,17 @@ discard block |
||
867 | 867 | * |
868 | 868 | * @param string $config_option_name |
869 | 869 | */ |
870 | - public static function log( $config_option_name = '' ) { |
|
871 | - if ( ! empty( $config_option_name ) ) { |
|
872 | - $config_log = get_option( EE_Config::LOG_NAME, array() ); |
|
870 | + public static function log($config_option_name = '') { |
|
871 | + if ( ! empty($config_option_name)) { |
|
872 | + $config_log = get_option(EE_Config::LOG_NAME, array()); |
|
873 | 873 | //copy incoming $_REQUEST and sanitize it so we can save it |
874 | 874 | $_request = $_REQUEST; |
875 | - array_walk_recursive( $_request, 'sanitize_text_field' ); |
|
876 | - $config_log[ (string) microtime( true ) ] = array( |
|
875 | + array_walk_recursive($_request, 'sanitize_text_field'); |
|
876 | + $config_log[(string) microtime(true)] = array( |
|
877 | 877 | 'config_name' => $config_option_name, |
878 | 878 | 'request' => $_request, |
879 | 879 | ); |
880 | - update_option( EE_Config::LOG_NAME, $config_log ); |
|
880 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
881 | 881 | } |
882 | 882 | } |
883 | 883 | |
@@ -888,12 +888,12 @@ discard block |
||
888 | 888 | * reduces the size of the config log to the length specified by EE_Config::LOG_LENGTH |
889 | 889 | */ |
890 | 890 | public static function trim_log() { |
891 | - $config_log = get_option( EE_Config::LOG_NAME, array() ); |
|
892 | - $log_length = count( $config_log ); |
|
893 | - if ( $log_length > EE_Config::LOG_LENGTH ) { |
|
894 | - ksort( $config_log ); |
|
895 | - $config_log = array_slice( $config_log, $log_length - EE_Config::LOG_LENGTH, null, true ); |
|
896 | - update_option( EE_Config::LOG_NAME, $config_log ); |
|
891 | + $config_log = get_option(EE_Config::LOG_NAME, array()); |
|
892 | + $log_length = count($config_log); |
|
893 | + if ($log_length > EE_Config::LOG_LENGTH) { |
|
894 | + ksort($config_log); |
|
895 | + $config_log = array_slice($config_log, $log_length - EE_Config::LOG_LENGTH, null, true); |
|
896 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
897 | 897 | } |
898 | 898 | } |
899 | 899 | |
@@ -908,14 +908,14 @@ discard block |
||
908 | 908 | * @return string |
909 | 909 | */ |
910 | 910 | public static function get_page_for_posts() { |
911 | - $page_for_posts = get_option( 'page_for_posts' ); |
|
912 | - if ( ! $page_for_posts ) { |
|
911 | + $page_for_posts = get_option('page_for_posts'); |
|
912 | + if ( ! $page_for_posts) { |
|
913 | 913 | return 'posts'; |
914 | 914 | } |
915 | 915 | /** @type WPDB $wpdb */ |
916 | 916 | global $wpdb; |
917 | 917 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d"; |
918 | - return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts ) ); |
|
918 | + return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts)); |
|
919 | 919 | } |
920 | 920 | |
921 | 921 | |
@@ -971,17 +971,17 @@ discard block |
||
971 | 971 | ) |
972 | 972 | ) { |
973 | 973 | // grab list of installed widgets |
974 | - $widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR ); |
|
974 | + $widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR); |
|
975 | 975 | // filter list of modules to register |
976 | 976 | $widgets_to_register = apply_filters( |
977 | 977 | 'FHEE__EE_Config__register_widgets__widgets_to_register', |
978 | 978 | $widgets_to_register |
979 | 979 | ); |
980 | - if ( ! empty( $widgets_to_register ) ) { |
|
980 | + if ( ! empty($widgets_to_register)) { |
|
981 | 981 | // cycle thru widget folders |
982 | - foreach ( $widgets_to_register as $widget_path ) { |
|
982 | + foreach ($widgets_to_register as $widget_path) { |
|
983 | 983 | // add to list of installed widget modules |
984 | - EE_Config::register_ee_widget( $widget_path ); |
|
984 | + EE_Config::register_ee_widget($widget_path); |
|
985 | 985 | } |
986 | 986 | } |
987 | 987 | // filter list of installed modules |
@@ -1001,57 +1001,57 @@ discard block |
||
1001 | 1001 | * @param string $widget_path - full path up to and including widget folder |
1002 | 1002 | * @return void |
1003 | 1003 | */ |
1004 | - public static function register_ee_widget( $widget_path = null ) { |
|
1005 | - do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path ); |
|
1004 | + public static function register_ee_widget($widget_path = null) { |
|
1005 | + do_action('AHEE__EE_Config__register_widget__begin', $widget_path); |
|
1006 | 1006 | $widget_ext = '.widget.php'; |
1007 | 1007 | // make all separators match |
1008 | - $widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS ); |
|
1008 | + $widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS); |
|
1009 | 1009 | // does the file path INCLUDE the actual file name as part of the path ? |
1010 | - if ( strpos( $widget_path, $widget_ext ) !== false ) { |
|
1010 | + if (strpos($widget_path, $widget_ext) !== false) { |
|
1011 | 1011 | // grab and shortcode file name from directory name and break apart at dots |
1012 | - $file_name = explode( '.', basename( $widget_path ) ); |
|
1012 | + $file_name = explode('.', basename($widget_path)); |
|
1013 | 1013 | // take first segment from file name pieces and remove class prefix if it exists |
1014 | - $widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0]; |
|
1014 | + $widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0]; |
|
1015 | 1015 | // sanitize shortcode directory name |
1016 | - $widget = sanitize_key( $widget ); |
|
1016 | + $widget = sanitize_key($widget); |
|
1017 | 1017 | // now we need to rebuild the shortcode path |
1018 | - $widget_path = explode( DS, $widget_path ); |
|
1018 | + $widget_path = explode(DS, $widget_path); |
|
1019 | 1019 | // remove last segment |
1020 | - array_pop( $widget_path ); |
|
1020 | + array_pop($widget_path); |
|
1021 | 1021 | // glue it back together |
1022 | - $widget_path = implode( DS, $widget_path ); |
|
1022 | + $widget_path = implode(DS, $widget_path); |
|
1023 | 1023 | } else { |
1024 | 1024 | // grab and sanitize widget directory name |
1025 | - $widget = sanitize_key( basename( $widget_path ) ); |
|
1025 | + $widget = sanitize_key(basename($widget_path)); |
|
1026 | 1026 | } |
1027 | 1027 | // create classname from widget directory name |
1028 | - $widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget ) ) ); |
|
1028 | + $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget))); |
|
1029 | 1029 | // add class prefix |
1030 | - $widget_class = 'EEW_' . $widget; |
|
1030 | + $widget_class = 'EEW_'.$widget; |
|
1031 | 1031 | // does the widget exist ? |
1032 | - if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext ) ) { |
|
1032 | + if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) { |
|
1033 | 1033 | $msg = sprintf( |
1034 | 1034 | __( |
1035 | 1035 | 'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', |
1036 | 1036 | 'event_espresso' |
1037 | 1037 | ), |
1038 | 1038 | $widget_class, |
1039 | - $widget_path . DS . $widget_class . $widget_ext |
|
1039 | + $widget_path.DS.$widget_class.$widget_ext |
|
1040 | 1040 | ); |
1041 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1041 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1042 | 1042 | return; |
1043 | 1043 | } |
1044 | 1044 | // load the widget class file |
1045 | - require_once( $widget_path . DS . $widget_class . $widget_ext ); |
|
1045 | + require_once($widget_path.DS.$widget_class.$widget_ext); |
|
1046 | 1046 | // verify that class exists |
1047 | - if ( ! class_exists( $widget_class ) ) { |
|
1048 | - $msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class ); |
|
1049 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1047 | + if ( ! class_exists($widget_class)) { |
|
1048 | + $msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class); |
|
1049 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1050 | 1050 | return; |
1051 | 1051 | } |
1052 | - register_widget( $widget_class ); |
|
1052 | + register_widget($widget_class); |
|
1053 | 1053 | // add to array of registered widgets |
1054 | - EE_Registry::instance()->widgets->{$widget_class} = $widget_path . DS . $widget_class . $widget_ext; |
|
1054 | + EE_Registry::instance()->widgets->{$widget_class} = $widget_path.DS.$widget_class.$widget_ext; |
|
1055 | 1055 | } |
1056 | 1056 | |
1057 | 1057 | |
@@ -1064,17 +1064,17 @@ discard block |
||
1064 | 1064 | */ |
1065 | 1065 | private function _register_shortcodes() { |
1066 | 1066 | // grab list of installed shortcodes |
1067 | - $shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR ); |
|
1067 | + $shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR); |
|
1068 | 1068 | // filter list of modules to register |
1069 | 1069 | $shortcodes_to_register = apply_filters( |
1070 | 1070 | 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', |
1071 | 1071 | $shortcodes_to_register |
1072 | 1072 | ); |
1073 | - if ( ! empty( $shortcodes_to_register ) ) { |
|
1073 | + if ( ! empty($shortcodes_to_register)) { |
|
1074 | 1074 | // cycle thru shortcode folders |
1075 | - foreach ( $shortcodes_to_register as $shortcode_path ) { |
|
1075 | + foreach ($shortcodes_to_register as $shortcode_path) { |
|
1076 | 1076 | // add to list of installed shortcode modules |
1077 | - EE_Config::register_shortcode( $shortcode_path ); |
|
1077 | + EE_Config::register_shortcode($shortcode_path); |
|
1078 | 1078 | } |
1079 | 1079 | } |
1080 | 1080 | // filter list of installed modules |
@@ -1093,64 +1093,64 @@ discard block |
||
1093 | 1093 | * @param string $shortcode_path - full path up to and including shortcode folder |
1094 | 1094 | * @return bool |
1095 | 1095 | */ |
1096 | - public static function register_shortcode( $shortcode_path = null ) { |
|
1097 | - do_action( 'AHEE__EE_Config__register_shortcode__begin', $shortcode_path ); |
|
1096 | + public static function register_shortcode($shortcode_path = null) { |
|
1097 | + do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path); |
|
1098 | 1098 | $shortcode_ext = '.shortcode.php'; |
1099 | 1099 | // make all separators match |
1100 | - $shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path ); |
|
1100 | + $shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path); |
|
1101 | 1101 | // does the file path INCLUDE the actual file name as part of the path ? |
1102 | - if ( strpos( $shortcode_path, $shortcode_ext ) !== false ) { |
|
1102 | + if (strpos($shortcode_path, $shortcode_ext) !== false) { |
|
1103 | 1103 | // grab shortcode file name from directory name and break apart at dots |
1104 | - $shortcode_file = explode( '.', basename( $shortcode_path ) ); |
|
1104 | + $shortcode_file = explode('.', basename($shortcode_path)); |
|
1105 | 1105 | // take first segment from file name pieces and remove class prefix if it exists |
1106 | - $shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 |
|
1107 | - ? substr( $shortcode_file[0], 4 ) |
|
1106 | + $shortcode = strpos($shortcode_file[0], 'EES_') === 0 |
|
1107 | + ? substr($shortcode_file[0], 4) |
|
1108 | 1108 | : $shortcode_file[0]; |
1109 | 1109 | // sanitize shortcode directory name |
1110 | - $shortcode = sanitize_key( $shortcode ); |
|
1110 | + $shortcode = sanitize_key($shortcode); |
|
1111 | 1111 | // now we need to rebuild the shortcode path |
1112 | - $shortcode_path = explode( DS, $shortcode_path ); |
|
1112 | + $shortcode_path = explode(DS, $shortcode_path); |
|
1113 | 1113 | // remove last segment |
1114 | - array_pop( $shortcode_path ); |
|
1114 | + array_pop($shortcode_path); |
|
1115 | 1115 | // glue it back together |
1116 | - $shortcode_path = implode( DS, $shortcode_path ) . DS; |
|
1116 | + $shortcode_path = implode(DS, $shortcode_path).DS; |
|
1117 | 1117 | } else { |
1118 | 1118 | // we need to generate the filename based off of the folder name |
1119 | 1119 | // grab and sanitize shortcode directory name |
1120 | - $shortcode = sanitize_key( basename( $shortcode_path ) ); |
|
1121 | - $shortcode_path = rtrim( $shortcode_path, DS ) . DS; |
|
1120 | + $shortcode = sanitize_key(basename($shortcode_path)); |
|
1121 | + $shortcode_path = rtrim($shortcode_path, DS).DS; |
|
1122 | 1122 | } |
1123 | 1123 | // create classname from shortcode directory or file name |
1124 | - $shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode ) ) ); |
|
1124 | + $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode))); |
|
1125 | 1125 | // add class prefix |
1126 | - $shortcode_class = 'EES_' . $shortcode; |
|
1126 | + $shortcode_class = 'EES_'.$shortcode; |
|
1127 | 1127 | // does the shortcode exist ? |
1128 | - if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext ) ) { |
|
1128 | + if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) { |
|
1129 | 1129 | $msg = sprintf( |
1130 | 1130 | __( |
1131 | 1131 | 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', |
1132 | 1132 | 'event_espresso' |
1133 | 1133 | ), |
1134 | 1134 | $shortcode_class, |
1135 | - $shortcode_path . DS . $shortcode_class . $shortcode_ext |
|
1135 | + $shortcode_path.DS.$shortcode_class.$shortcode_ext |
|
1136 | 1136 | ); |
1137 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1137 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1138 | 1138 | return false; |
1139 | 1139 | } |
1140 | 1140 | // load the shortcode class file |
1141 | - require_once( $shortcode_path . $shortcode_class . $shortcode_ext ); |
|
1141 | + require_once($shortcode_path.$shortcode_class.$shortcode_ext); |
|
1142 | 1142 | // verify that class exists |
1143 | - if ( ! class_exists( $shortcode_class ) ) { |
|
1143 | + if ( ! class_exists($shortcode_class)) { |
|
1144 | 1144 | $msg = sprintf( |
1145 | - __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), |
|
1145 | + __('The requested %s shortcode class does not exist.', 'event_espresso'), |
|
1146 | 1146 | $shortcode_class |
1147 | 1147 | ); |
1148 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1148 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1149 | 1149 | return false; |
1150 | 1150 | } |
1151 | - $shortcode = strtoupper( $shortcode ); |
|
1151 | + $shortcode = strtoupper($shortcode); |
|
1152 | 1152 | // add to array of registered shortcodes |
1153 | - EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext; |
|
1153 | + EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path.$shortcode_class.$shortcode_ext; |
|
1154 | 1154 | return true; |
1155 | 1155 | } |
1156 | 1156 | |
@@ -1164,22 +1164,22 @@ discard block |
||
1164 | 1164 | */ |
1165 | 1165 | private function _register_modules() { |
1166 | 1166 | // grab list of installed modules |
1167 | - $modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR ); |
|
1167 | + $modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR); |
|
1168 | 1168 | // filter list of modules to register |
1169 | 1169 | $modules_to_register = apply_filters( |
1170 | 1170 | 'FHEE__EE_Config__register_modules__modules_to_register', |
1171 | 1171 | $modules_to_register |
1172 | 1172 | ); |
1173 | - if ( ! empty( $modules_to_register ) ) { |
|
1173 | + if ( ! empty($modules_to_register)) { |
|
1174 | 1174 | // loop through folders |
1175 | - foreach ( $modules_to_register as $module_path ) { |
|
1175 | + foreach ($modules_to_register as $module_path) { |
|
1176 | 1176 | /**TEMPORARILY EXCLUDE gateways from modules for time being**/ |
1177 | 1177 | if ( |
1178 | - $module_path !== EE_MODULES . 'zzz-copy-this-module-template' |
|
1179 | - && $module_path !== EE_MODULES . 'gateways' |
|
1178 | + $module_path !== EE_MODULES.'zzz-copy-this-module-template' |
|
1179 | + && $module_path !== EE_MODULES.'gateways' |
|
1180 | 1180 | ) { |
1181 | 1181 | // add to list of installed modules |
1182 | - EE_Config::register_module( $module_path ); |
|
1182 | + EE_Config::register_module($module_path); |
|
1183 | 1183 | } |
1184 | 1184 | } |
1185 | 1185 | } |
@@ -1199,39 +1199,39 @@ discard block |
||
1199 | 1199 | * @param string $module_path - full path up to and including module folder |
1200 | 1200 | * @return bool |
1201 | 1201 | */ |
1202 | - public static function register_module( $module_path = null ) { |
|
1203 | - do_action( 'AHEE__EE_Config__register_module__begin', $module_path ); |
|
1202 | + public static function register_module($module_path = null) { |
|
1203 | + do_action('AHEE__EE_Config__register_module__begin', $module_path); |
|
1204 | 1204 | $module_ext = '.module.php'; |
1205 | 1205 | // make all separators match |
1206 | - $module_path = str_replace( array( '\\', '/' ), DS, $module_path ); |
|
1206 | + $module_path = str_replace(array('\\', '/'), DS, $module_path); |
|
1207 | 1207 | // does the file path INCLUDE the actual file name as part of the path ? |
1208 | - if ( strpos( $module_path, $module_ext ) !== false ) { |
|
1208 | + if (strpos($module_path, $module_ext) !== false) { |
|
1209 | 1209 | // grab and shortcode file name from directory name and break apart at dots |
1210 | - $module_file = explode( '.', basename( $module_path ) ); |
|
1210 | + $module_file = explode('.', basename($module_path)); |
|
1211 | 1211 | // now we need to rebuild the shortcode path |
1212 | - $module_path = explode( DS, $module_path ); |
|
1212 | + $module_path = explode(DS, $module_path); |
|
1213 | 1213 | // remove last segment |
1214 | - array_pop( $module_path ); |
|
1214 | + array_pop($module_path); |
|
1215 | 1215 | // glue it back together |
1216 | - $module_path = implode( DS, $module_path ) . DS; |
|
1216 | + $module_path = implode(DS, $module_path).DS; |
|
1217 | 1217 | // take first segment from file name pieces and sanitize it |
1218 | - $module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] ); |
|
1218 | + $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]); |
|
1219 | 1219 | // ensure class prefix is added |
1220 | - $module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module; |
|
1220 | + $module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module; |
|
1221 | 1221 | } else { |
1222 | 1222 | // we need to generate the filename based off of the folder name |
1223 | 1223 | // grab and sanitize module name |
1224 | - $module = strtolower( basename( $module_path ) ); |
|
1225 | - $module = preg_replace( '/[^a-z0-9_\-]/', '', $module ); |
|
1224 | + $module = strtolower(basename($module_path)); |
|
1225 | + $module = preg_replace('/[^a-z0-9_\-]/', '', $module); |
|
1226 | 1226 | // like trailingslashit() |
1227 | - $module_path = rtrim( $module_path, DS ) . DS; |
|
1227 | + $module_path = rtrim($module_path, DS).DS; |
|
1228 | 1228 | // create classname from module directory name |
1229 | - $module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module ) ) ); |
|
1229 | + $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module))); |
|
1230 | 1230 | // add class prefix |
1231 | - $module_class = 'EED_' . $module; |
|
1231 | + $module_class = 'EED_'.$module; |
|
1232 | 1232 | } |
1233 | 1233 | // does the module exist ? |
1234 | - if ( ! is_readable( $module_path . DS . $module_class . $module_ext ) ) { |
|
1234 | + if ( ! is_readable($module_path.DS.$module_class.$module_ext)) { |
|
1235 | 1235 | $msg = sprintf( |
1236 | 1236 | __( |
1237 | 1237 | 'The requested %s module file could not be found or is not readable due to file permissions.', |
@@ -1239,19 +1239,19 @@ discard block |
||
1239 | 1239 | ), |
1240 | 1240 | $module |
1241 | 1241 | ); |
1242 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1242 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1243 | 1243 | return false; |
1244 | 1244 | } |
1245 | 1245 | // load the module class file |
1246 | - require_once( $module_path . $module_class . $module_ext ); |
|
1246 | + require_once($module_path.$module_class.$module_ext); |
|
1247 | 1247 | // verify that class exists |
1248 | - if ( ! class_exists( $module_class ) ) { |
|
1249 | - $msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class ); |
|
1250 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1248 | + if ( ! class_exists($module_class)) { |
|
1249 | + $msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class); |
|
1250 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1251 | 1251 | return false; |
1252 | 1252 | } |
1253 | 1253 | // add to array of registered modules |
1254 | - EE_Registry::instance()->modules->{$module_class} = $module_path . $module_class . $module_ext; |
|
1254 | + EE_Registry::instance()->modules->{$module_class} = $module_path.$module_class.$module_ext; |
|
1255 | 1255 | do_action( |
1256 | 1256 | 'AHEE__EE_Config__register_module__complete', |
1257 | 1257 | $module_class, |
@@ -1271,26 +1271,26 @@ discard block |
||
1271 | 1271 | */ |
1272 | 1272 | private function _initialize_shortcodes() { |
1273 | 1273 | // cycle thru shortcode folders |
1274 | - foreach ( EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path ) { |
|
1274 | + foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) { |
|
1275 | 1275 | // add class prefix |
1276 | - $shortcode_class = 'EES_' . $shortcode; |
|
1276 | + $shortcode_class = 'EES_'.$shortcode; |
|
1277 | 1277 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1278 | 1278 | // which set hooks ? |
1279 | - if ( is_admin() ) { |
|
1279 | + if (is_admin()) { |
|
1280 | 1280 | // fire immediately |
1281 | - call_user_func( array( $shortcode_class, 'set_hooks_admin' ) ); |
|
1281 | + call_user_func(array($shortcode_class, 'set_hooks_admin')); |
|
1282 | 1282 | } else { |
1283 | 1283 | // delay until other systems are online |
1284 | 1284 | add_action( |
1285 | 1285 | 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
1286 | - array( $shortcode_class, 'set_hooks' ) |
|
1286 | + array($shortcode_class, 'set_hooks') |
|
1287 | 1287 | ); |
1288 | 1288 | // convert classname to UPPERCASE and create WP shortcode. |
1289 | - $shortcode_tag = strtoupper( $shortcode ); |
|
1289 | + $shortcode_tag = strtoupper($shortcode); |
|
1290 | 1290 | // but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor' |
1291 | - if ( ! shortcode_exists( $shortcode_tag ) ) { |
|
1291 | + if ( ! shortcode_exists($shortcode_tag)) { |
|
1292 | 1292 | // NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes() |
1293 | - add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' ) ); |
|
1293 | + add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor')); |
|
1294 | 1294 | } |
1295 | 1295 | } |
1296 | 1296 | } |
@@ -1307,17 +1307,17 @@ discard block |
||
1307 | 1307 | */ |
1308 | 1308 | private function _initialize_modules() { |
1309 | 1309 | // cycle thru shortcode folders |
1310 | - foreach ( EE_Registry::instance()->modules as $module_class => $module_path ) { |
|
1310 | + foreach (EE_Registry::instance()->modules as $module_class => $module_path) { |
|
1311 | 1311 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1312 | 1312 | // which set hooks ? |
1313 | - if ( is_admin() ) { |
|
1313 | + if (is_admin()) { |
|
1314 | 1314 | // fire immediately |
1315 | - call_user_func( array( $module_class, 'set_hooks_admin' ) ); |
|
1315 | + call_user_func(array($module_class, 'set_hooks_admin')); |
|
1316 | 1316 | } else { |
1317 | 1317 | // delay until other systems are online |
1318 | 1318 | add_action( |
1319 | 1319 | 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
1320 | - array( $module_class, 'set_hooks' ) |
|
1320 | + array($module_class, 'set_hooks') |
|
1321 | 1321 | ); |
1322 | 1322 | } |
1323 | 1323 | } |
@@ -1335,29 +1335,29 @@ discard block |
||
1335 | 1335 | * @param string $key - url param key indicating a route is being called |
1336 | 1336 | * @return bool |
1337 | 1337 | */ |
1338 | - public static function register_route( $route = null, $module = null, $method_name = null, $key = 'ee' ) { |
|
1339 | - do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name ); |
|
1340 | - $module = str_replace( 'EED_', '', $module ); |
|
1341 | - $module_class = 'EED_' . $module; |
|
1342 | - if ( ! isset( EE_Registry::instance()->modules->{$module_class} ) ) { |
|
1343 | - $msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module ); |
|
1344 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1338 | + public static function register_route($route = null, $module = null, $method_name = null, $key = 'ee') { |
|
1339 | + do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name); |
|
1340 | + $module = str_replace('EED_', '', $module); |
|
1341 | + $module_class = 'EED_'.$module; |
|
1342 | + if ( ! isset(EE_Registry::instance()->modules->{$module_class} )) { |
|
1343 | + $msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module); |
|
1344 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1345 | 1345 | return false; |
1346 | 1346 | } |
1347 | - if ( empty( $route ) ) { |
|
1348 | - $msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route ); |
|
1349 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1347 | + if (empty($route)) { |
|
1348 | + $msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route); |
|
1349 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1350 | 1350 | return false; |
1351 | 1351 | } |
1352 | - if ( ! method_exists( 'EED_' . $module, $method_name ) ) { |
|
1352 | + if ( ! method_exists('EED_'.$module, $method_name)) { |
|
1353 | 1353 | $msg = sprintf( |
1354 | - __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), |
|
1354 | + __('A valid class method for the %s route has not been supplied.', 'event_espresso'), |
|
1355 | 1355 | $route |
1356 | 1356 | ); |
1357 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1357 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1358 | 1358 | return false; |
1359 | 1359 | } |
1360 | - EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name ); |
|
1360 | + EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name); |
|
1361 | 1361 | return true; |
1362 | 1362 | } |
1363 | 1363 | |
@@ -1371,11 +1371,11 @@ discard block |
||
1371 | 1371 | * @param string $key - url param key indicating a route is being called |
1372 | 1372 | * @return string |
1373 | 1373 | */ |
1374 | - public static function get_route( $route = null, $key = 'ee' ) { |
|
1375 | - do_action( 'AHEE__EE_Config__get_route__begin', $route ); |
|
1376 | - $route = (string) apply_filters( 'FHEE__EE_Config__get_route', $route ); |
|
1377 | - if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] ) ) { |
|
1378 | - return EE_Config::$_module_route_map[ $key ][ $route ]; |
|
1374 | + public static function get_route($route = null, $key = 'ee') { |
|
1375 | + do_action('AHEE__EE_Config__get_route__begin', $route); |
|
1376 | + $route = (string) apply_filters('FHEE__EE_Config__get_route', $route); |
|
1377 | + if (isset(EE_Config::$_module_route_map[$key][$route])) { |
|
1378 | + return EE_Config::$_module_route_map[$key][$route]; |
|
1379 | 1379 | } |
1380 | 1380 | return null; |
1381 | 1381 | } |
@@ -1405,49 +1405,49 @@ discard block |
||
1405 | 1405 | * @param string $key - url param key indicating a route is being called |
1406 | 1406 | * @return bool |
1407 | 1407 | */ |
1408 | - public static function register_forward( $route = null, $status = 0, $forward = null, $key = 'ee' ) { |
|
1409 | - do_action( 'AHEE__EE_Config__register_forward', $route, $status, $forward ); |
|
1410 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) { |
|
1408 | + public static function register_forward($route = null, $status = 0, $forward = null, $key = 'ee') { |
|
1409 | + do_action('AHEE__EE_Config__register_forward', $route, $status, $forward); |
|
1410 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1411 | 1411 | $msg = sprintf( |
1412 | - __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), |
|
1412 | + __('The module route %s for this forward has not been registered.', 'event_espresso'), |
|
1413 | 1413 | $route |
1414 | 1414 | ); |
1415 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1415 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1416 | 1416 | return false; |
1417 | 1417 | } |
1418 | - if ( empty( $forward ) ) { |
|
1419 | - $msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route ); |
|
1420 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1418 | + if (empty($forward)) { |
|
1419 | + $msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route); |
|
1420 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1421 | 1421 | return false; |
1422 | 1422 | } |
1423 | - if ( is_array( $forward ) ) { |
|
1424 | - if ( ! isset( $forward[1] ) ) { |
|
1423 | + if (is_array($forward)) { |
|
1424 | + if ( ! isset($forward[1])) { |
|
1425 | 1425 | $msg = sprintf( |
1426 | - __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), |
|
1426 | + __('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), |
|
1427 | 1427 | $route |
1428 | 1428 | ); |
1429 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1429 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1430 | 1430 | return false; |
1431 | 1431 | } |
1432 | - if ( ! method_exists( $forward[0], $forward[1] ) ) { |
|
1432 | + if ( ! method_exists($forward[0], $forward[1])) { |
|
1433 | 1433 | $msg = sprintf( |
1434 | - __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), |
|
1434 | + __('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1435 | 1435 | $forward[1], |
1436 | 1436 | $route |
1437 | 1437 | ); |
1438 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1438 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1439 | 1439 | return false; |
1440 | 1440 | } |
1441 | - } else if ( ! function_exists( $forward ) ) { |
|
1441 | + } else if ( ! function_exists($forward)) { |
|
1442 | 1442 | $msg = sprintf( |
1443 | - __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), |
|
1443 | + __('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1444 | 1444 | $forward, |
1445 | 1445 | $route |
1446 | 1446 | ); |
1447 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1447 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1448 | 1448 | return false; |
1449 | 1449 | } |
1450 | - EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward; |
|
1450 | + EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward; |
|
1451 | 1451 | return true; |
1452 | 1452 | } |
1453 | 1453 | |
@@ -1463,12 +1463,12 @@ discard block |
||
1463 | 1463 | * @param string $key - url param key indicating a route is being called |
1464 | 1464 | * @return string |
1465 | 1465 | */ |
1466 | - public static function get_forward( $route = null, $status = 0, $key = 'ee' ) { |
|
1467 | - do_action( 'AHEE__EE_Config__get_forward__begin', $route, $status ); |
|
1468 | - if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] ) ) { |
|
1466 | + public static function get_forward($route = null, $status = 0, $key = 'ee') { |
|
1467 | + do_action('AHEE__EE_Config__get_forward__begin', $route, $status); |
|
1468 | + if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) { |
|
1469 | 1469 | return apply_filters( |
1470 | 1470 | 'FHEE__EE_Config__get_forward', |
1471 | - EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], |
|
1471 | + EE_Config::$_module_forward_map[$key][$route][$status], |
|
1472 | 1472 | $route, |
1473 | 1473 | $status |
1474 | 1474 | ); |
@@ -1490,17 +1490,17 @@ discard block |
||
1490 | 1490 | * @param string $key - url param key indicating a route is being called |
1491 | 1491 | * @return bool |
1492 | 1492 | */ |
1493 | - public static function register_view( $route = null, $status = 0, $view = null, $key = 'ee' ) { |
|
1494 | - do_action( 'AHEE__EE_Config__register_view__begin', $route, $status, $view ); |
|
1495 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) { |
|
1493 | + public static function register_view($route = null, $status = 0, $view = null, $key = 'ee') { |
|
1494 | + do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view); |
|
1495 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1496 | 1496 | $msg = sprintf( |
1497 | - __( 'The module route %s for this view has not been registered.', 'event_espresso' ), |
|
1497 | + __('The module route %s for this view has not been registered.', 'event_espresso'), |
|
1498 | 1498 | $route |
1499 | 1499 | ); |
1500 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1500 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1501 | 1501 | return false; |
1502 | 1502 | } |
1503 | - if ( ! is_readable( $view ) ) { |
|
1503 | + if ( ! is_readable($view)) { |
|
1504 | 1504 | $msg = sprintf( |
1505 | 1505 | __( |
1506 | 1506 | 'The %s view file could not be found or is not readable due to file permissions.', |
@@ -1508,10 +1508,10 @@ discard block |
||
1508 | 1508 | ), |
1509 | 1509 | $view |
1510 | 1510 | ); |
1511 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1511 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1512 | 1512 | return false; |
1513 | 1513 | } |
1514 | - EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view; |
|
1514 | + EE_Config::$_module_view_map[$key][$route][absint($status)] = $view; |
|
1515 | 1515 | return true; |
1516 | 1516 | } |
1517 | 1517 | |
@@ -1527,12 +1527,12 @@ discard block |
||
1527 | 1527 | * @param string $key - url param key indicating a route is being called |
1528 | 1528 | * @return string |
1529 | 1529 | */ |
1530 | - public static function get_view( $route = null, $status = 0, $key = 'ee' ) { |
|
1531 | - do_action( 'AHEE__EE_Config__get_view__begin', $route, $status ); |
|
1532 | - if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] ) ) { |
|
1530 | + public static function get_view($route = null, $status = 0, $key = 'ee') { |
|
1531 | + do_action('AHEE__EE_Config__get_view__begin', $route, $status); |
|
1532 | + if (isset(EE_Config::$_module_view_map[$key][$route][$status])) { |
|
1533 | 1533 | return apply_filters( |
1534 | 1534 | 'FHEE__EE_Config__get_view', |
1535 | - EE_Config::$_module_view_map[ $key ][ $route ][ $status ], |
|
1535 | + EE_Config::$_module_view_map[$key][$route][$status], |
|
1536 | 1536 | $route, |
1537 | 1537 | $status |
1538 | 1538 | ); |
@@ -1543,7 +1543,7 @@ discard block |
||
1543 | 1543 | |
1544 | 1544 | |
1545 | 1545 | public function update_addon_option_names() { |
1546 | - update_option( EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names ); |
|
1546 | + update_option(EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names); |
|
1547 | 1547 | } |
1548 | 1548 | |
1549 | 1549 | |
@@ -1571,22 +1571,22 @@ discard block |
||
1571 | 1571 | * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned. |
1572 | 1572 | * @throws \EE_Error |
1573 | 1573 | */ |
1574 | - public function get_pretty( $property ) { |
|
1575 | - if ( ! property_exists( $this, $property ) ) { |
|
1574 | + public function get_pretty($property) { |
|
1575 | + if ( ! property_exists($this, $property)) { |
|
1576 | 1576 | throw new EE_Error( |
1577 | 1577 | sprintf( |
1578 | 1578 | __( |
1579 | 1579 | '%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', |
1580 | 1580 | 'event_espresso' |
1581 | 1581 | ), |
1582 | - get_class( $this ), |
|
1582 | + get_class($this), |
|
1583 | 1583 | $property |
1584 | 1584 | ) |
1585 | 1585 | ); |
1586 | 1586 | } |
1587 | 1587 | //just handling escaping of strings for now. |
1588 | - if ( is_string( $this->{$property} ) ) { |
|
1589 | - return stripslashes( $this->{$property} ); |
|
1588 | + if (is_string($this->{$property} )) { |
|
1589 | + return stripslashes($this->{$property} ); |
|
1590 | 1590 | } |
1591 | 1591 | return $this->{$property}; |
1592 | 1592 | } |
@@ -1595,17 +1595,17 @@ discard block |
||
1595 | 1595 | |
1596 | 1596 | public function populate() { |
1597 | 1597 | //grab defaults via a new instance of this class. |
1598 | - $class_name = get_class( $this ); |
|
1598 | + $class_name = get_class($this); |
|
1599 | 1599 | $defaults = new $class_name; |
1600 | 1600 | //loop through the properties for this class and see if they are set. If they are NOT, then grab the |
1601 | 1601 | //default from our $defaults object. |
1602 | - foreach ( get_object_vars( $defaults ) as $property => $value ) { |
|
1603 | - if ( $this->{$property} === null ) { |
|
1602 | + foreach (get_object_vars($defaults) as $property => $value) { |
|
1603 | + if ($this->{$property} === null) { |
|
1604 | 1604 | $this->{$property} = $value; |
1605 | 1605 | } |
1606 | 1606 | } |
1607 | 1607 | //cleanup |
1608 | - unset( $defaults ); |
|
1608 | + unset($defaults); |
|
1609 | 1609 | } |
1610 | 1610 | |
1611 | 1611 | |
@@ -1621,7 +1621,7 @@ discard block |
||
1621 | 1621 | * @param $a |
1622 | 1622 | * @return bool |
1623 | 1623 | */ |
1624 | - public function __isset( $a ) { |
|
1624 | + public function __isset($a) { |
|
1625 | 1625 | return false; |
1626 | 1626 | } |
1627 | 1627 | |
@@ -1633,7 +1633,7 @@ discard block |
||
1633 | 1633 | * @param $a |
1634 | 1634 | * @return bool |
1635 | 1635 | */ |
1636 | - public function __unset( $a ) { |
|
1636 | + public function __unset($a) { |
|
1637 | 1637 | return false; |
1638 | 1638 | } |
1639 | 1639 | |
@@ -1743,7 +1743,7 @@ discard block |
||
1743 | 1743 | $this->current_blog_id = get_current_blog_id(); |
1744 | 1744 | $this->current_blog_id = $this->current_blog_id === NULL ? 1 : $this->current_blog_id; |
1745 | 1745 | $this->ee_ueip_optin = $this->_get_main_ee_ueip_optin(); |
1746 | - $this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', false ) : true; |
|
1746 | + $this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', false) : true; |
|
1747 | 1747 | $this->post_shortcodes = array(); |
1748 | 1748 | $this->module_route_map = array(); |
1749 | 1749 | $this->module_forward_map = array(); |
@@ -1759,9 +1759,9 @@ discard block |
||
1759 | 1759 | $this->thank_you_page_url = ''; |
1760 | 1760 | $this->cancel_page_url = ''; |
1761 | 1761 | //cpt slugs |
1762 | - $this->event_cpt_slug = __( 'events', 'event_espresso' ); |
|
1762 | + $this->event_cpt_slug = __('events', 'event_espresso'); |
|
1763 | 1763 | //ueip constant check |
1764 | - if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) { |
|
1764 | + if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) { |
|
1765 | 1765 | $this->ee_ueip_optin = false; |
1766 | 1766 | $this->ee_ueip_has_notified = true; |
1767 | 1767 | } |
@@ -1804,11 +1804,11 @@ discard block |
||
1804 | 1804 | * @return string |
1805 | 1805 | */ |
1806 | 1806 | public function reg_page_url() { |
1807 | - if ( ! $this->reg_page_url ) { |
|
1807 | + if ( ! $this->reg_page_url) { |
|
1808 | 1808 | $this->reg_page_url = add_query_arg( |
1809 | - array( 'uts' => time() ), |
|
1810 | - get_permalink( $this->reg_page_id ) |
|
1811 | - ) . '#checkout'; |
|
1809 | + array('uts' => time()), |
|
1810 | + get_permalink($this->reg_page_id) |
|
1811 | + ).'#checkout'; |
|
1812 | 1812 | } |
1813 | 1813 | return $this->reg_page_url; |
1814 | 1814 | } |
@@ -1823,12 +1823,12 @@ discard block |
||
1823 | 1823 | * @access public |
1824 | 1824 | * @return string |
1825 | 1825 | */ |
1826 | - public function txn_page_url( $query_args = array() ) { |
|
1827 | - if ( ! $this->txn_page_url ) { |
|
1828 | - $this->txn_page_url = get_permalink( $this->txn_page_id ); |
|
1826 | + public function txn_page_url($query_args = array()) { |
|
1827 | + if ( ! $this->txn_page_url) { |
|
1828 | + $this->txn_page_url = get_permalink($this->txn_page_id); |
|
1829 | 1829 | } |
1830 | - if ( $query_args ) { |
|
1831 | - return add_query_arg( $query_args, $this->txn_page_url ); |
|
1830 | + if ($query_args) { |
|
1831 | + return add_query_arg($query_args, $this->txn_page_url); |
|
1832 | 1832 | } else { |
1833 | 1833 | return $this->txn_page_url; |
1834 | 1834 | } |
@@ -1844,12 +1844,12 @@ discard block |
||
1844 | 1844 | * @access public |
1845 | 1845 | * @return string |
1846 | 1846 | */ |
1847 | - public function thank_you_page_url( $query_args = array() ) { |
|
1848 | - if ( ! $this->thank_you_page_url ) { |
|
1849 | - $this->thank_you_page_url = get_permalink( $this->thank_you_page_id ); |
|
1847 | + public function thank_you_page_url($query_args = array()) { |
|
1848 | + if ( ! $this->thank_you_page_url) { |
|
1849 | + $this->thank_you_page_url = get_permalink($this->thank_you_page_id); |
|
1850 | 1850 | } |
1851 | - if ( $query_args ) { |
|
1852 | - return add_query_arg( $query_args, $this->thank_you_page_url ); |
|
1851 | + if ($query_args) { |
|
1852 | + return add_query_arg($query_args, $this->thank_you_page_url); |
|
1853 | 1853 | } else { |
1854 | 1854 | return $this->thank_you_page_url; |
1855 | 1855 | } |
@@ -1864,8 +1864,8 @@ discard block |
||
1864 | 1864 | * @return string |
1865 | 1865 | */ |
1866 | 1866 | public function cancel_page_url() { |
1867 | - if ( ! $this->cancel_page_url ) { |
|
1868 | - $this->cancel_page_url = get_permalink( $this->cancel_page_id ); |
|
1867 | + if ( ! $this->cancel_page_url) { |
|
1868 | + $this->cancel_page_url = get_permalink($this->cancel_page_id); |
|
1869 | 1869 | } |
1870 | 1870 | return $this->cancel_page_url; |
1871 | 1871 | } |
@@ -1894,22 +1894,22 @@ discard block |
||
1894 | 1894 | */ |
1895 | 1895 | protected function _get_main_ee_ueip_optin() { |
1896 | 1896 | //if this is the main site then we can just bypass our direct query. |
1897 | - if ( is_main_site() ) { |
|
1898 | - return get_option( 'ee_ueip_optin', false ); |
|
1897 | + if (is_main_site()) { |
|
1898 | + return get_option('ee_ueip_optin', false); |
|
1899 | 1899 | } |
1900 | 1900 | |
1901 | 1901 | //is this already cached for this request? If so use it. |
1902 | - if ( ! empty( EE_Core_Config::$ee_ueip_option ) ) { |
|
1902 | + if ( ! empty(EE_Core_Config::$ee_ueip_option)) { |
|
1903 | 1903 | return EE_Core_Config::$ee_ueip_option; |
1904 | 1904 | } |
1905 | 1905 | |
1906 | 1906 | global $wpdb; |
1907 | 1907 | $current_network_main_site = is_multisite() ? get_current_site() : null; |
1908 | - $current_main_site_id = ! empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1; |
|
1908 | + $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1; |
|
1909 | 1909 | $option = 'ee_ueip_optin'; |
1910 | 1910 | |
1911 | 1911 | //set correct table for query |
1912 | - $table_name = $wpdb->get_blog_prefix( $current_main_site_id ) . 'options'; |
|
1912 | + $table_name = $wpdb->get_blog_prefix($current_main_site_id).'options'; |
|
1913 | 1913 | |
1914 | 1914 | |
1915 | 1915 | //rather than getting blog option for the $current_main_site_id, we do a direct $wpdb query because |
@@ -1917,20 +1917,20 @@ discard block |
||
1917 | 1917 | //re-constructed on the blog switch. Note, we are still executing any core wp filters on this option retrieval. |
1918 | 1918 | //this bit of code is basically a direct copy of get_option without any caching because we are NOT switched to the blog |
1919 | 1919 | //for the purpose of caching. |
1920 | - $pre = apply_filters( 'pre_option_' . $option, false, $option ); |
|
1921 | - if ( false !== $pre ) { |
|
1920 | + $pre = apply_filters('pre_option_'.$option, false, $option); |
|
1921 | + if (false !== $pre) { |
|
1922 | 1922 | EE_Core_Config::$ee_ueip_option = $pre; |
1923 | 1923 | return EE_Core_Config::$ee_ueip_option; |
1924 | 1924 | } |
1925 | 1925 | |
1926 | - $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", $option ) ); |
|
1927 | - if ( is_object( $row ) ) { |
|
1926 | + $row = $wpdb->get_row($wpdb->prepare("SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", $option)); |
|
1927 | + if (is_object($row)) { |
|
1928 | 1928 | $value = $row->option_value; |
1929 | 1929 | } else { //option does not exist so use default. |
1930 | - return apply_filters( 'default_option_' . $option, false, $option ); |
|
1930 | + return apply_filters('default_option_'.$option, false, $option); |
|
1931 | 1931 | } |
1932 | 1932 | |
1933 | - EE_Core_Config::$ee_ueip_option = apply_filters( 'option_' . $option, maybe_unserialize( $value ), $option ); |
|
1933 | + EE_Core_Config::$ee_ueip_option = apply_filters('option_'.$option, maybe_unserialize($value), $option); |
|
1934 | 1934 | return EE_Core_Config::$ee_ueip_option; |
1935 | 1935 | } |
1936 | 1936 | |
@@ -1946,7 +1946,7 @@ discard block |
||
1946 | 1946 | //reset all url properties |
1947 | 1947 | $this->_reset_urls(); |
1948 | 1948 | //return what to save to db |
1949 | - return array_keys( get_object_vars( $this ) ); |
|
1949 | + return array_keys(get_object_vars($this)); |
|
1950 | 1950 | } |
1951 | 1951 | |
1952 | 1952 | } |
@@ -2093,14 +2093,14 @@ discard block |
||
2093 | 2093 | */ |
2094 | 2094 | public function __construct() { |
2095 | 2095 | // set default organization settings |
2096 | - $this->name = get_bloginfo( 'name' ); |
|
2096 | + $this->name = get_bloginfo('name'); |
|
2097 | 2097 | $this->address_1 = '123 Onna Road'; |
2098 | 2098 | $this->address_2 = 'PO Box 123'; |
2099 | 2099 | $this->city = 'Inna City'; |
2100 | 2100 | $this->STA_ID = 4; |
2101 | 2101 | $this->CNT_ISO = 'US'; |
2102 | 2102 | $this->zip = '12345'; |
2103 | - $this->email = get_bloginfo( 'admin_email' ); |
|
2103 | + $this->email = get_bloginfo('admin_email'); |
|
2104 | 2104 | $this->phone = ''; |
2105 | 2105 | $this->vat = '123456789'; |
2106 | 2106 | $this->logo_url = ''; |
@@ -2188,46 +2188,46 @@ discard block |
||
2188 | 2188 | * @param string $CNT_ISO |
2189 | 2189 | * @throws \EE_Error |
2190 | 2190 | */ |
2191 | - public function __construct( $CNT_ISO = '' ) { |
|
2191 | + public function __construct($CNT_ISO = '') { |
|
2192 | 2192 | /** @var \EventEspresso\core\services\database\TableAnalysis $table_analysis */ |
2193 | - $table_analysis = EE_Registry::instance()->create( 'TableAnalysis', array(), true ); |
|
2193 | + $table_analysis = EE_Registry::instance()->create('TableAnalysis', array(), true); |
|
2194 | 2194 | // get country code from organization settings or use default |
2195 | - $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) |
|
2195 | + $ORG_CNT = isset(EE_Registry::instance()->CFG->organization) |
|
2196 | 2196 | && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
2197 | 2197 | ? EE_Registry::instance()->CFG->organization->CNT_ISO |
2198 | 2198 | : ''; |
2199 | 2199 | // but override if requested |
2200 | - $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT; |
|
2200 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT; |
|
2201 | 2201 | // so if that all went well, and we are not in M-Mode (cuz you can't query the db in M-Mode) and double-check the countries table exists |
2202 | 2202 | if ( |
2203 | - ! empty( $CNT_ISO ) |
|
2203 | + ! empty($CNT_ISO) |
|
2204 | 2204 | && EE_Maintenance_Mode::instance()->models_can_query() |
2205 | - && $table_analysis->tableExists( EE_Registry::instance()->load_model( 'Country' )->table() ) |
|
2205 | + && $table_analysis->tableExists(EE_Registry::instance()->load_model('Country')->table()) |
|
2206 | 2206 | ) { |
2207 | 2207 | // retrieve the country settings from the db, just in case they have been customized |
2208 | - $country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO ); |
|
2209 | - if ( $country instanceof EE_Country ) { |
|
2210 | - $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
2211 | - $this->name = $country->currency_name_single(); // Dollar |
|
2212 | - $this->plural = $country->currency_name_plural(); // Dollars |
|
2213 | - $this->sign = $country->currency_sign(); // currency sign: $ |
|
2214 | - $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
2215 | - $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
2216 | - $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2217 | - $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2208 | + $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO); |
|
2209 | + if ($country instanceof EE_Country) { |
|
2210 | + $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
2211 | + $this->name = $country->currency_name_single(); // Dollar |
|
2212 | + $this->plural = $country->currency_name_plural(); // Dollars |
|
2213 | + $this->sign = $country->currency_sign(); // currency sign: $ |
|
2214 | + $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
2215 | + $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
2216 | + $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2217 | + $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2218 | 2218 | } |
2219 | 2219 | } |
2220 | 2220 | // fallback to hardcoded defaults, in case the above failed |
2221 | - if ( empty( $this->code ) ) { |
|
2221 | + if (empty($this->code)) { |
|
2222 | 2222 | // set default currency settings |
2223 | - $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
2224 | - $this->name = __( 'Dollar', 'event_espresso' ); // Dollar |
|
2225 | - $this->plural = __( 'Dollars', 'event_espresso' ); // Dollars |
|
2226 | - $this->sign = '$'; // currency sign: $ |
|
2227 | - $this->sign_b4 = true; // currency sign before or after: $TRUE or FALSE$ |
|
2228 | - $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
2229 | - $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2230 | - $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2223 | + $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
2224 | + $this->name = __('Dollar', 'event_espresso'); // Dollar |
|
2225 | + $this->plural = __('Dollars', 'event_espresso'); // Dollars |
|
2226 | + $this->sign = '$'; // currency sign: $ |
|
2227 | + $this->sign_b4 = true; // currency sign before or after: $TRUE or FALSE$ |
|
2228 | + $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
2229 | + $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2230 | + $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2231 | 2231 | } |
2232 | 2232 | } |
2233 | 2233 | } |
@@ -2389,7 +2389,7 @@ discard block |
||
2389 | 2389 | * @since 4.8.8.rc.019 |
2390 | 2390 | */ |
2391 | 2391 | public function do_hooks() { |
2392 | - add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' ) ); |
|
2392 | + add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event')); |
|
2393 | 2393 | } |
2394 | 2394 | |
2395 | 2395 | |
@@ -2398,7 +2398,7 @@ discard block |
||
2398 | 2398 | * @return void |
2399 | 2399 | */ |
2400 | 2400 | public function set_default_reg_status_on_EEM_Event() { |
2401 | - EEM_Event::set_default_reg_status( $this->default_STS_ID ); |
|
2401 | + EEM_Event::set_default_reg_status($this->default_STS_ID); |
|
2402 | 2402 | } |
2403 | 2403 | |
2404 | 2404 | |
@@ -2502,10 +2502,10 @@ discard block |
||
2502 | 2502 | * @param bool $reset |
2503 | 2503 | * @return string |
2504 | 2504 | */ |
2505 | - public function log_file_name( $reset = false ) { |
|
2506 | - if ( empty( $this->log_file_name ) || $reset ) { |
|
2507 | - $this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', true ) ) ) . '.txt'; |
|
2508 | - EE_Config::instance()->update_espresso_config( false, false ); |
|
2505 | + public function log_file_name($reset = false) { |
|
2506 | + if (empty($this->log_file_name) || $reset) { |
|
2507 | + $this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', true))).'.txt'; |
|
2508 | + EE_Config::instance()->update_espresso_config(false, false); |
|
2509 | 2509 | } |
2510 | 2510 | return $this->log_file_name; |
2511 | 2511 | } |
@@ -2516,10 +2516,10 @@ discard block |
||
2516 | 2516 | * @param bool $reset |
2517 | 2517 | * @return string |
2518 | 2518 | */ |
2519 | - public function debug_file_name( $reset = false ) { |
|
2520 | - if ( empty( $this->debug_file_name ) || $reset ) { |
|
2521 | - $this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', true ) ) ) . '.txt'; |
|
2522 | - EE_Config::instance()->update_espresso_config( false, false ); |
|
2519 | + public function debug_file_name($reset = false) { |
|
2520 | + if (empty($this->debug_file_name) || $reset) { |
|
2521 | + $this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', true))).'.txt'; |
|
2522 | + EE_Config::instance()->update_espresso_config(false, false); |
|
2523 | 2523 | } |
2524 | 2524 | return $this->debug_file_name; |
2525 | 2525 | } |
@@ -2530,7 +2530,7 @@ discard block |
||
2530 | 2530 | * @return string |
2531 | 2531 | */ |
2532 | 2532 | public function affiliate_id() { |
2533 | - return ! empty( $this->affiliate_id ) ? $this->affiliate_id : 'default'; |
|
2533 | + return ! empty($this->affiliate_id) ? $this->affiliate_id : 'default'; |
|
2534 | 2534 | } |
2535 | 2535 | |
2536 | 2536 | |
@@ -2710,21 +2710,21 @@ discard block |
||
2710 | 2710 | $this->use_google_maps = true; |
2711 | 2711 | $this->google_map_api_key = ''; |
2712 | 2712 | // for event details pages (reg page) |
2713 | - $this->event_details_map_width = 585; // ee_map_width_single |
|
2714 | - $this->event_details_map_height = 362; // ee_map_height_single |
|
2715 | - $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2716 | - $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2717 | - $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2718 | - $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2719 | - $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2713 | + $this->event_details_map_width = 585; // ee_map_width_single |
|
2714 | + $this->event_details_map_height = 362; // ee_map_height_single |
|
2715 | + $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2716 | + $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2717 | + $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2718 | + $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2719 | + $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2720 | 2720 | // for event list pages |
2721 | - $this->event_list_map_width = 300; // ee_map_width |
|
2722 | - $this->event_list_map_height = 185; // ee_map_height |
|
2723 | - $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2724 | - $this->event_list_display_nav = false; // ee_map_nav_display |
|
2725 | - $this->event_list_nav_size = true; // ee_map_nav_size |
|
2726 | - $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2727 | - $this->event_list_map_align = 'center'; // ee_map_align |
|
2721 | + $this->event_list_map_width = 300; // ee_map_width |
|
2722 | + $this->event_list_map_height = 185; // ee_map_height |
|
2723 | + $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2724 | + $this->event_list_display_nav = false; // ee_map_nav_display |
|
2725 | + $this->event_list_nav_size = true; // ee_map_nav_size |
|
2726 | + $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2727 | + $this->event_list_map_align = 'center'; // ee_map_align |
|
2728 | 2728 | } |
2729 | 2729 | |
2730 | 2730 | } |
@@ -2886,7 +2886,7 @@ discard block |
||
2886 | 2886 | * @return void |
2887 | 2887 | */ |
2888 | 2888 | protected function _set_php_values() { |
2889 | - $this->php->max_input_vars = ini_get( 'max_input_vars' ); |
|
2889 | + $this->php->max_input_vars = ini_get('max_input_vars'); |
|
2890 | 2890 | $this->php->version = phpversion(); |
2891 | 2891 | } |
2892 | 2892 | |
@@ -2905,10 +2905,10 @@ discard block |
||
2905 | 2905 | * @type string $msg Any message to be displayed. |
2906 | 2906 | * } |
2907 | 2907 | */ |
2908 | - public function max_input_vars_limit_check( $input_count = 0 ) { |
|
2909 | - if ( ! empty( $this->php->max_input_vars ) |
|
2910 | - && ( $input_count >= $this->php->max_input_vars ) |
|
2911 | - && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2908 | + public function max_input_vars_limit_check($input_count = 0) { |
|
2909 | + if ( ! empty($this->php->max_input_vars) |
|
2910 | + && ($input_count >= $this->php->max_input_vars) |
|
2911 | + && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9) |
|
2912 | 2912 | ) { |
2913 | 2913 | return sprintf( |
2914 | 2914 | __( |
@@ -3004,7 +3004,7 @@ discard block |
||
3004 | 3004 | */ |
3005 | 3005 | public function __construct() { |
3006 | 3006 | $this->payment_settings = array(); |
3007 | - $this->active_gateways = array( 'Invoice' => false ); |
|
3007 | + $this->active_gateways = array('Invoice' => false); |
|
3008 | 3008 | } |
3009 | 3009 | } |
3010 | 3010 |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_Default_Line_Item_Display_Strategy |
|
5 | - * |
|
6 | - * Description |
|
7 | - * |
|
8 | - * @package Event Espresso |
|
9 | - * @subpackage core |
|
10 | - * @author Brent Christensen |
|
11 | - * @since $VID:$ |
|
12 | - * |
|
13 | - */ |
|
3 | + * |
|
4 | + * Class EE_Default_Line_Item_Display_Strategy |
|
5 | + * |
|
6 | + * Description |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage core |
|
10 | + * @author Brent Christensen |
|
11 | + * @since $VID:$ |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | |
15 | 15 | class EE_Default_Line_Item_Display_Strategy implements EEI_Line_Item_Display { |
16 | 16 | |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | // quantity td |
165 | 165 | $html .= EEH_HTML::td( $line_item->quantity(), '', 'item_l jst-rght' ); |
166 | 166 | $tax_rate = $line_item->is_taxable() |
167 | - && EE_Registry::instance()->CFG->tax_settings->prices_displayed_including_taxes |
|
167 | + && EE_Registry::instance()->CFG->tax_settings->prices_displayed_including_taxes |
|
168 | 168 | ? 1 + ( $this->_tax_rate / 100 ) |
169 | 169 | : 1; |
170 | 170 | // price td |
@@ -57,29 +57,29 @@ discard block |
||
57 | 57 | * @param array $options |
58 | 58 | * @return mixed |
59 | 59 | */ |
60 | - public function display_line_item( EE_Line_Item $line_item, $options = array() ) { |
|
60 | + public function display_line_item(EE_Line_Item $line_item, $options = array()) { |
|
61 | 61 | |
62 | 62 | $html = ''; |
63 | 63 | // set some default options and merge with incoming |
64 | 64 | $default_options = array( |
65 | - 'show_desc' => TRUE, // TRUE FALSE |
|
65 | + 'show_desc' => TRUE, // TRUE FALSE |
|
66 | 66 | 'odd' => FALSE |
67 | 67 | ); |
68 | - $options = array_merge( $default_options, (array)$options ); |
|
68 | + $options = array_merge($default_options, (array) $options); |
|
69 | 69 | |
70 | - switch( $line_item->type() ) { |
|
70 | + switch ($line_item->type()) { |
|
71 | 71 | |
72 | 72 | case EEM_Line_Item::type_line_item: |
73 | 73 | // item row |
74 | - $html .= $this->_item_row( $line_item, $options ); |
|
74 | + $html .= $this->_item_row($line_item, $options); |
|
75 | 75 | // got any kids? |
76 | - foreach ( $line_item->children() as $child_line_item ) { |
|
77 | - $this->display_line_item( $child_line_item, $options ); |
|
76 | + foreach ($line_item->children() as $child_line_item) { |
|
77 | + $this->display_line_item($child_line_item, $options); |
|
78 | 78 | } |
79 | 79 | break; |
80 | 80 | |
81 | 81 | case EEM_Line_Item::type_sub_line_item: |
82 | - $html .= $this->_sub_item_row( $line_item, $options ); |
|
82 | + $html .= $this->_sub_item_row($line_item, $options); |
|
83 | 83 | break; |
84 | 84 | |
85 | 85 | case EEM_Line_Item::type_sub_total: |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | break; |
91 | 91 | |
92 | 92 | case EEM_Line_Item::type_tax_sub_total: |
93 | - foreach ( $line_item->children() as $child_line_item ) { |
|
94 | - if ( $child_line_item->type() == EEM_Line_Item::type_tax ) { |
|
93 | + foreach ($line_item->children() as $child_line_item) { |
|
94 | + if ($child_line_item->type() == EEM_Line_Item::type_tax) { |
|
95 | 95 | // recursively feed children back into this method |
96 | - $this->display_line_item( $child_line_item, $options ); |
|
96 | + $this->display_line_item($child_line_item, $options); |
|
97 | 97 | } |
98 | 98 | } |
99 | 99 | break; |
@@ -101,20 +101,20 @@ discard block |
||
101 | 101 | case EEM_Line_Item::type_total: |
102 | 102 | // get all child line items |
103 | 103 | $children = $line_item->children(); |
104 | - if ( $options[ 'set_tax_rate' ] === true ) { |
|
104 | + if ($options['set_tax_rate'] === true) { |
|
105 | 105 | // loop thru tax child line items just to determine tax rate |
106 | - foreach ( $children as $child_line_item ) { |
|
107 | - if ( $child_line_item->type() == EEM_Line_Item::type_tax_sub_total ) { |
|
106 | + foreach ($children as $child_line_item) { |
|
107 | + if ($child_line_item->type() == EEM_Line_Item::type_tax_sub_total) { |
|
108 | 108 | // recursively feed children back into this method |
109 | - $this->display_line_item( $child_line_item, $options ); |
|
109 | + $this->display_line_item($child_line_item, $options); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | } else { |
113 | 113 | // now loop thru all non-tax child line items |
114 | - foreach ( $children as $child_line_item ) { |
|
115 | - if ( $child_line_item->type() != EEM_Line_Item::type_tax_sub_total ) { |
|
114 | + foreach ($children as $child_line_item) { |
|
115 | + if ($child_line_item->type() != EEM_Line_Item::type_tax_sub_total) { |
|
116 | 116 | // recursively feed children back into this method |
117 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
117 | + $html .= $this->display_line_item($child_line_item, $options); |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | } |
@@ -134,10 +134,10 @@ discard block |
||
134 | 134 | * @param array $options |
135 | 135 | * @return mixed |
136 | 136 | */ |
137 | - private function _item_row( EE_Line_Item $line_item, $options = array() ) { |
|
137 | + private function _item_row(EE_Line_Item $line_item, $options = array()) { |
|
138 | 138 | // start of row |
139 | 139 | $row_class = $options['odd'] ? 'item odd' : 'item'; |
140 | - $html = EEH_HTML::tr( '', '', $row_class ); |
|
140 | + $html = EEH_HTML::tr('', '', $row_class); |
|
141 | 141 | // name && desc |
142 | 142 | $name_and_desc = apply_filters( |
143 | 143 | 'FHEE__EE_Default_Line_Item_Display_Strategy__item_row__name', |
@@ -146,33 +146,33 @@ discard block |
||
146 | 146 | ); |
147 | 147 | $name_and_desc .= apply_filters( |
148 | 148 | 'FHEE__EE_Default_Line_Item_Display_Strategy__item_row__desc', |
149 | - ( $options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '' ), |
|
149 | + ($options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''), |
|
150 | 150 | $line_item, |
151 | 151 | $options |
152 | 152 | ); |
153 | - if ( $line_item->is_taxable() ) { |
|
153 | + if ($line_item->is_taxable()) { |
|
154 | 154 | $ticket_price_includes_taxes = EE_Registry::instance()->CFG->tax_settings->prices_displayed_including_taxes |
155 | - ? __( '* price includes taxes', 'event_espresso' ) |
|
156 | - : __( '* price does not include taxes', 'event_espresso' ); |
|
155 | + ? __('* price includes taxes', 'event_espresso') |
|
156 | + : __('* price does not include taxes', 'event_espresso'); |
|
157 | 157 | $name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">' |
158 | 158 | . $ticket_price_includes_taxes |
159 | 159 | . '</span>'; |
160 | 160 | } |
161 | 161 | |
162 | 162 | // name td |
163 | - $html .= EEH_HTML::td( $name_and_desc, '', 'item_l' ); |
|
163 | + $html .= EEH_HTML::td($name_and_desc, '', 'item_l'); |
|
164 | 164 | // quantity td |
165 | - $html .= EEH_HTML::td( $line_item->quantity(), '', 'item_l jst-rght' ); |
|
165 | + $html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght'); |
|
166 | 166 | $tax_rate = $line_item->is_taxable() |
167 | 167 | && EE_Registry::instance()->CFG->tax_settings->prices_displayed_including_taxes |
168 | - ? 1 + ( $this->_tax_rate / 100 ) |
|
168 | + ? 1 + ($this->_tax_rate / 100) |
|
169 | 169 | : 1; |
170 | 170 | // price td |
171 | - $unit_price = EEH_Template::format_currency( $line_item->unit_price() * $tax_rate, false, false ); |
|
172 | - $html .= EEH_HTML::td( $unit_price, '', 'item_c jst-rght' ); |
|
171 | + $unit_price = EEH_Template::format_currency($line_item->unit_price() * $tax_rate, false, false); |
|
172 | + $html .= EEH_HTML::td($unit_price, '', 'item_c jst-rght'); |
|
173 | 173 | // total td |
174 | - $total = EEH_Template::format_currency( $line_item->unit_price() * $line_item->quantity() * $tax_rate, false, false ); |
|
175 | - $html .= EEH_HTML::td( $total, '', 'item_r jst-rght' ); |
|
174 | + $total = EEH_Template::format_currency($line_item->unit_price() * $line_item->quantity() * $tax_rate, false, false); |
|
175 | + $html .= EEH_HTML::td($total, '', 'item_r jst-rght'); |
|
176 | 176 | // end of row |
177 | 177 | $html .= EEH_HTML::trx(); |
178 | 178 | |
@@ -188,22 +188,22 @@ discard block |
||
188 | 188 | * @param array $options |
189 | 189 | * @return mixed |
190 | 190 | */ |
191 | - private function _sub_item_row( EE_Line_Item $line_item, $options = array() ) { |
|
191 | + private function _sub_item_row(EE_Line_Item $line_item, $options = array()) { |
|
192 | 192 | // start of row |
193 | - $html = EEH_HTML::tr( '', 'item sub-item-row' ); |
|
193 | + $html = EEH_HTML::tr('', 'item sub-item-row'); |
|
194 | 194 | // name && desc |
195 | 195 | $name_and_desc = $line_item->name(); |
196 | - $name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : ''; |
|
196 | + $name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''; |
|
197 | 197 | // name td |
198 | - $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' ); |
|
198 | + $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' ); |
|
199 | 199 | // discount/surcharge td |
200 | - if ( $line_item->is_percent() ) { |
|
201 | - $html .= EEH_HTML::td( $line_item->percent() . '%', '', 'item_c' ); |
|
200 | + if ($line_item->is_percent()) { |
|
201 | + $html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c'); |
|
202 | 202 | } else { |
203 | - $html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'item_c jst-rght' ); |
|
203 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght'); |
|
204 | 204 | } |
205 | 205 | // total td |
206 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'item_r jst-rght' ); |
|
206 | + $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'item_r jst-rght'); |
|
207 | 207 | // end of row |
208 | 208 | $html .= EEH_HTML::trx(); |
209 | 209 | return $html; |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | |
79 | 79 | /** |
80 | 80 | * an array for storing request actions and their corresponding methods |
81 | - * @access private |
|
82 | - * @return void |
|
83 | - */ |
|
81 | + * @access private |
|
82 | + * @return void |
|
83 | + */ |
|
84 | 84 | protected function _set_page_routes() { |
85 | 85 | $prc_id = ! empty( $this->_req_data['PRC_ID'] ) && ! is_array( $this->_req_data['PRC_ID'] ) ? $this->_req_data['PRC_ID'] : 0; |
86 | 86 | $prt_id = ! empty( $this->_req_data['PRT_ID'] ) && ! is_array( $this->_req_data['PRT_ID'] ) ? $this->_req_data['PRT_ID'] : 0; |
@@ -185,16 +185,16 @@ discard block |
||
185 | 185 | 'capability' => 'ee_delete_default_price_type', |
186 | 186 | 'obj_id' => $prt_id |
187 | 187 | ), |
188 | - 'tax_settings' => array( |
|
189 | - 'func' => '_tax_settings', |
|
190 | - 'capability' => 'manage_options' |
|
191 | - ), |
|
192 | - 'update_tax_settings' => array( |
|
193 | - 'func' => '_update_tax_settings', |
|
194 | - 'capability' => 'manage_options', |
|
195 | - 'noheader' => true |
|
196 | - ), |
|
197 | - ); |
|
188 | + 'tax_settings' => array( |
|
189 | + 'func' => '_tax_settings', |
|
190 | + 'capability' => 'manage_options' |
|
191 | + ), |
|
192 | + 'update_tax_settings' => array( |
|
193 | + 'func' => '_update_tax_settings', |
|
194 | + 'capability' => 'manage_options', |
|
195 | + 'noheader' => true |
|
196 | + ), |
|
197 | + ); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | 'order' => 10 |
210 | 210 | ), |
211 | 211 | 'list_table' => 'Prices_List_Table', |
212 | - 'help_tabs' => array( |
|
212 | + 'help_tabs' => array( |
|
213 | 213 | 'pricing_default_pricing_help_tab' => array( |
214 | 214 | 'title' => __('Default Pricing', 'event_espresso'), |
215 | 215 | 'filename' => 'pricing_default_pricing' |
@@ -232,13 +232,13 @@ discard block |
||
232 | 232 | 'order' => 20, |
233 | 233 | 'persistent' => FALSE |
234 | 234 | ), |
235 | - 'help_tabs' => array( |
|
235 | + 'help_tabs' => array( |
|
236 | 236 | 'add_new_default_price_help_tab' => array( |
237 | 237 | 'title' => __('Add New Default Price', 'event_espresso'), |
238 | 238 | 'filename' => 'pricing_add_new_default_price' |
239 | 239 | ) |
240 | 240 | ), |
241 | - 'help_tour' => array('Pricing_Add_New_Default_Price_Help_Tour'), |
|
241 | + 'help_tour' => array('Pricing_Add_New_Default_Price_Help_Tour'), |
|
242 | 242 | 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
243 | 243 | 'require_nonce' => FALSE |
244 | 244 | ), |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | 'persistent' => FALSE |
251 | 251 | ), |
252 | 252 | 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
253 | - 'help_tabs' => array( |
|
253 | + 'help_tabs' => array( |
|
254 | 254 | 'edit_default_price_help_tab' => array( |
255 | 255 | 'title' => __('Edit Default Price', 'event_espresso'), |
256 | 256 | 'filename' => 'pricing_edit_default_price' |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | 'order' => 30 |
266 | 266 | ), |
267 | 267 | 'list_table' => 'Price_Types_List_Table', |
268 | - 'help_tabs' => array( |
|
268 | + 'help_tabs' => array( |
|
269 | 269 | 'pricing_price_types_help_tab' => array( |
270 | 270 | 'title' => __('Price Types', 'event_espresso'), |
271 | 271 | 'filename' => 'pricing_price_types' |
@@ -289,13 +289,13 @@ discard block |
||
289 | 289 | 'order' => 40, |
290 | 290 | 'persistent' => FALSE |
291 | 291 | ), |
292 | - 'help_tabs' => array( |
|
292 | + 'help_tabs' => array( |
|
293 | 293 | 'add_new_price_type_help_tab' => array( |
294 | 294 | 'title' => __('Add New Price Type', 'event_espresso'), |
295 | 295 | 'filename' => 'pricing_add_new_price_type' |
296 | 296 | ) |
297 | 297 | ), |
298 | - 'help_tour' => array( 'Pricing_Add_New_Price_Type_Help_Tour' ), |
|
298 | + 'help_tour' => array( 'Pricing_Add_New_Price_Type_Help_Tour' ), |
|
299 | 299 | 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
300 | 300 | 'require_nonce' => FALSE |
301 | 301 | ), |
@@ -305,36 +305,36 @@ discard block |
||
305 | 305 | 'order' => 40, |
306 | 306 | 'persistent' => FALSE |
307 | 307 | ), |
308 | - 'help_tabs' => array( |
|
308 | + 'help_tabs' => array( |
|
309 | 309 | 'edit_price_type_help_tab' => array( |
310 | 310 | 'title' => __('Edit Price Type', 'event_espresso'), |
311 | 311 | 'filename' => 'pricing_edit_price_type' |
312 | 312 | ) |
313 | 313 | ), |
314 | - 'help_tour' => array( 'Pricing_Edit_Price_Type_Help_Tour' ), |
|
314 | + 'help_tour' => array( 'Pricing_Edit_Price_Type_Help_Tour' ), |
|
315 | 315 | 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
316 | 316 | |
317 | 317 | 'require_nonce' => FALSE |
318 | 318 | ), |
319 | - 'tax_settings' => array( |
|
320 | - 'nav' => array( |
|
321 | - 'label' => esc_html__('Tax Settings', 'event_espresso'), |
|
322 | - 'order' => 40 |
|
323 | - ), |
|
324 | - 'labels' => array( |
|
325 | - 'publishbox' => esc_html__('Update Tax Settings', 'event_espresso') |
|
326 | - ), |
|
327 | - 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
328 | - // 'help_tabs' => array( |
|
329 | - // 'registration_form_reg_form_settings_help_tab' => array( |
|
330 | - // 'title' => esc_html__('Registration Form Settings', 'event_espresso'), |
|
331 | - // 'filename' => 'registration_form_reg_form_settings' |
|
332 | - // ), |
|
333 | - // ), |
|
334 | - // 'help_tour' => array('Registration_Form_Settings_Help_Tour'), |
|
335 | - 'require_nonce' => true |
|
336 | - ) |
|
337 | - ); |
|
319 | + 'tax_settings' => array( |
|
320 | + 'nav' => array( |
|
321 | + 'label' => esc_html__('Tax Settings', 'event_espresso'), |
|
322 | + 'order' => 40 |
|
323 | + ), |
|
324 | + 'labels' => array( |
|
325 | + 'publishbox' => esc_html__('Update Tax Settings', 'event_espresso') |
|
326 | + ), |
|
327 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
328 | + // 'help_tabs' => array( |
|
329 | + // 'registration_form_reg_form_settings_help_tab' => array( |
|
330 | + // 'title' => esc_html__('Registration Form Settings', 'event_espresso'), |
|
331 | + // 'filename' => 'registration_form_reg_form_settings' |
|
332 | + // ), |
|
333 | + // ), |
|
334 | + // 'help_tour' => array('Registration_Form_Settings_Help_Tour'), |
|
335 | + 'require_nonce' => true |
|
336 | + ) |
|
337 | + ); |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | |
@@ -460,16 +460,16 @@ discard block |
||
460 | 460 | |
461 | 461 | /** |
462 | 462 | * generates HTML for main Prices Admin page |
463 | - * @access protected |
|
464 | - * @return void |
|
465 | - */ |
|
463 | + * @access protected |
|
464 | + * @return void |
|
465 | + */ |
|
466 | 466 | protected function _price_overview_list_table() { |
467 | 467 | $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
468 | - 'add_new_price', |
|
469 | - 'add', |
|
470 | - array(), |
|
471 | - 'add-new-h2' |
|
472 | - ); |
|
468 | + 'add_new_price', |
|
469 | + 'add', |
|
470 | + array(), |
|
471 | + 'add-new-h2' |
|
472 | + ); |
|
473 | 473 | $this->admin_page_title .= $this->_learn_more_about_pricing_link(); |
474 | 474 | $this->_search_btn_label = __('Default Prices', 'event_espresso'); |
475 | 475 | $this->display_admin_list_table_page_with_no_sidebar(); |
@@ -481,13 +481,13 @@ discard block |
||
481 | 481 | |
482 | 482 | |
483 | 483 | /** |
484 | - * retrieve data for Prices List table |
|
485 | - * @access public |
|
486 | - * @param int $per_page how many prices displayed per page |
|
487 | - * @param boolean $count return the count or objects |
|
488 | - * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
|
489 | - * @return mixed (int|array) int = count || array of price objects |
|
490 | - */ |
|
484 | + * retrieve data for Prices List table |
|
485 | + * @access public |
|
486 | + * @param int $per_page how many prices displayed per page |
|
487 | + * @param boolean $count return the count or objects |
|
488 | + * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
|
489 | + * @return mixed (int|array) int = count || array of price objects |
|
490 | + */ |
|
491 | 491 | public function get_prices_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
492 | 492 | |
493 | 493 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -557,9 +557,9 @@ discard block |
||
557 | 557 | |
558 | 558 | /** |
559 | 559 | * _price_details |
560 | - * @access protected |
|
561 | - * @return void |
|
562 | - */ |
|
560 | + * @access protected |
|
561 | + * @return void |
|
562 | + */ |
|
563 | 563 | protected function _edit_price_details() { |
564 | 564 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
565 | 565 | // grab price ID |
@@ -628,9 +628,9 @@ discard block |
||
628 | 628 | |
629 | 629 | /** |
630 | 630 | * declare price details page metaboxes |
631 | - * @access protected |
|
632 | - * @return void |
|
633 | - */ |
|
631 | + * @access protected |
|
632 | + * @return void |
|
633 | + */ |
|
634 | 634 | protected function _price_details_meta_boxes() { |
635 | 635 | add_meta_box( 'edit-price-details-mbox', __( 'Default Price Details', 'event_espresso' ), array( $this, '_edit_price_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
636 | 636 | } |
@@ -642,9 +642,9 @@ discard block |
||
642 | 642 | |
643 | 643 | /** |
644 | 644 | * _edit_price_details_meta_box |
645 | - * @access public |
|
646 | - * @return void |
|
647 | - */ |
|
645 | + * @access public |
|
646 | + * @return void |
|
647 | + */ |
|
648 | 648 | public function _edit_price_details_meta_box() { |
649 | 649 | echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
650 | 650 | } |
@@ -655,9 +655,9 @@ discard block |
||
655 | 655 | |
656 | 656 | /** |
657 | 657 | * set_price_column_values |
658 | - * @access protected |
|
659 | - * @return array |
|
660 | - */ |
|
658 | + * @access protected |
|
659 | + * @return array |
|
660 | + */ |
|
661 | 661 | protected function set_price_column_values() { |
662 | 662 | |
663 | 663 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -684,10 +684,10 @@ discard block |
||
684 | 684 | |
685 | 685 | /** |
686 | 686 | * insert_or_update_price |
687 | - * @param boolean $insert - whether to insert or update |
|
688 | - * @access protected |
|
689 | - * @return void |
|
690 | - */ |
|
687 | + * @param boolean $insert - whether to insert or update |
|
688 | + * @access protected |
|
689 | + * @return void |
|
690 | + */ |
|
691 | 691 | protected function _insert_or_update_price( $insert = FALSE ) { |
692 | 692 | |
693 | 693 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -760,10 +760,10 @@ discard block |
||
760 | 760 | |
761 | 761 | /** |
762 | 762 | * _trash_or_restore_price |
763 | - * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
764 | - * @access protected |
|
765 | - * @return void |
|
766 | - */ |
|
763 | + * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
764 | + * @access protected |
|
765 | + * @return void |
|
766 | + */ |
|
767 | 767 | protected function _trash_or_restore_price( $trash = TRUE ) { |
768 | 768 | |
769 | 769 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -843,9 +843,9 @@ discard block |
||
843 | 843 | |
844 | 844 | /** |
845 | 845 | * _delete_price |
846 | - * @access protected |
|
847 | - * @return void |
|
848 | - */ |
|
846 | + * @access protected |
|
847 | + * @return void |
|
848 | + */ |
|
849 | 849 | protected function _delete_price() { |
850 | 850 | |
851 | 851 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -922,16 +922,16 @@ discard block |
||
922 | 922 | |
923 | 923 | /** |
924 | 924 | * generates HTML for main Prices Admin page |
925 | - * @access protected |
|
926 | - * @return void |
|
927 | - */ |
|
925 | + * @access protected |
|
926 | + * @return void |
|
927 | + */ |
|
928 | 928 | protected function _price_types_overview_list_table() { |
929 | 929 | $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
930 | - 'add_new_price_type', |
|
931 | - 'add_type', |
|
932 | - array(), |
|
933 | - 'add-new-h2' |
|
934 | - ); |
|
930 | + 'add_new_price_type', |
|
931 | + 'add_type', |
|
932 | + array(), |
|
933 | + 'add-new-h2' |
|
934 | + ); |
|
935 | 935 | $this->admin_page_title .= $this->_learn_more_about_pricing_link(); |
936 | 936 | $this->_search_btn_label = __('Price Types', 'event_espresso'); |
937 | 937 | $this->display_admin_list_table_page_with_no_sidebar(); |
@@ -943,13 +943,13 @@ discard block |
||
943 | 943 | |
944 | 944 | |
945 | 945 | /** |
946 | - * retrieve data for Price Types List table |
|
947 | - * @access public |
|
948 | - * @param int $per_page how many prices displayed per page |
|
949 | - * @param boolean $count return the count or objects |
|
950 | - * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
|
951 | - * @return mixed (int|array) int = count || array of price objects |
|
952 | - */ |
|
946 | + * retrieve data for Price Types List table |
|
947 | + * @access public |
|
948 | + * @param int $per_page how many prices displayed per page |
|
949 | + * @param boolean $count return the count or objects |
|
950 | + * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
|
951 | + * @return mixed (int|array) int = count || array of price objects |
|
952 | + */ |
|
953 | 953 | public function get_price_types_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
954 | 954 | |
955 | 955 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -1004,9 +1004,9 @@ discard block |
||
1004 | 1004 | |
1005 | 1005 | /** |
1006 | 1006 | * _edit_price_type_details |
1007 | - * @access protected |
|
1008 | - * @return void |
|
1009 | - */ |
|
1007 | + * @access protected |
|
1008 | + * @return void |
|
1009 | + */ |
|
1010 | 1010 | protected function _edit_price_type_details() { |
1011 | 1011 | |
1012 | 1012 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -1070,9 +1070,9 @@ discard block |
||
1070 | 1070 | |
1071 | 1071 | /** |
1072 | 1072 | * declare price type details page metaboxes |
1073 | - * @access protected |
|
1074 | - * @return void |
|
1075 | - */ |
|
1073 | + * @access protected |
|
1074 | + * @return void |
|
1075 | + */ |
|
1076 | 1076 | protected function _price_type_details_meta_boxes() { |
1077 | 1077 | add_meta_box( 'edit-price-details-mbox', __( 'Price Type Details', 'event_espresso' ), array( $this, '_edit_price_type_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
1078 | 1078 | } |
@@ -1083,9 +1083,9 @@ discard block |
||
1083 | 1083 | |
1084 | 1084 | /** |
1085 | 1085 | * _edit_price_type_details_meta_box |
1086 | - * @access public |
|
1087 | - * @return void |
|
1088 | - */ |
|
1086 | + * @access public |
|
1087 | + * @return void |
|
1088 | + */ |
|
1089 | 1089 | public function _edit_price_type_details_meta_box() { |
1090 | 1090 | echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
1091 | 1091 | } |
@@ -1095,9 +1095,9 @@ discard block |
||
1095 | 1095 | |
1096 | 1096 | /** |
1097 | 1097 | * set_price_type_column_values |
1098 | - * @access protected |
|
1099 | - * @return void |
|
1100 | - */ |
|
1098 | + * @access protected |
|
1099 | + * @return void |
|
1100 | + */ |
|
1101 | 1101 | protected function set_price_type_column_values() { |
1102 | 1102 | |
1103 | 1103 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -1145,10 +1145,10 @@ discard block |
||
1145 | 1145 | |
1146 | 1146 | /** |
1147 | 1147 | * _insert_or_update_price_type |
1148 | - * @param boolean $new_price_type - whether to insert or update |
|
1149 | - * @access protected |
|
1150 | - * @return void |
|
1151 | - */ |
|
1148 | + * @param boolean $new_price_type - whether to insert or update |
|
1149 | + * @access protected |
|
1150 | + * @return void |
|
1151 | + */ |
|
1152 | 1152 | protected function _insert_or_update_price_type( $new_price_type = FALSE ) { |
1153 | 1153 | |
1154 | 1154 | // echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -1189,10 +1189,10 @@ discard block |
||
1189 | 1189 | |
1190 | 1190 | /** |
1191 | 1191 | * _trash_or_restore_price_type |
1192 | - * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
1193 | - * @access protected |
|
1194 | - * @return void |
|
1195 | - */ |
|
1192 | + * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
1193 | + * @access protected |
|
1194 | + * @return void |
|
1195 | + */ |
|
1196 | 1196 | protected function _trash_or_restore_price_type( $trash = TRUE ) { |
1197 | 1197 | |
1198 | 1198 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -1246,9 +1246,9 @@ discard block |
||
1246 | 1246 | |
1247 | 1247 | /** |
1248 | 1248 | * _delete_price_type |
1249 | - * @access protected |
|
1250 | - * @return void |
|
1251 | - */ |
|
1249 | + * @access protected |
|
1250 | + * @return void |
|
1251 | + */ |
|
1252 | 1252 | protected function _delete_price_type() { |
1253 | 1253 | |
1254 | 1254 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -1285,76 +1285,76 @@ discard block |
||
1285 | 1285 | |
1286 | 1286 | /** |
1287 | 1287 | * _learn_more_about_pricing_link |
1288 | - * @access protected |
|
1289 | - * @return string |
|
1290 | - */ |
|
1288 | + * @access protected |
|
1289 | + * @return string |
|
1290 | + */ |
|
1291 | 1291 | protected function _learn_more_about_pricing_link() { |
1292 | 1292 | return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how pricing works', 'event_espresso') . '</a>'; |
1293 | 1293 | } |
1294 | 1294 | |
1295 | 1295 | |
1296 | 1296 | |
1297 | - protected function _tax_settings() { |
|
1298 | - $this->_set_add_edit_form_tags('update_tax_settings'); |
|
1299 | - $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
1300 | - $this->_template_args['admin_page_content'] = $this->tax_settings_form()->get_html(); |
|
1301 | - $this->display_admin_page_with_sidebar(); |
|
1302 | - } |
|
1303 | - |
|
1304 | - |
|
1305 | - |
|
1306 | - /** |
|
1307 | - * @return \EE_Form_Section_Proper |
|
1308 | - * @throws \EE_Error |
|
1309 | - */ |
|
1310 | - protected function tax_settings_form() { |
|
1311 | - return new EE_Form_Section_Proper( |
|
1312 | - array( |
|
1313 | - 'name' => 'tax_settings_form', |
|
1314 | - 'html_id' => 'tax_settings_form', |
|
1315 | - 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
|
1316 | - 'subsections' => apply_filters( |
|
1317 | - 'FHEE__Pricing_Admin_Page__tax_settings_form__form_subsections', |
|
1318 | - array( |
|
1319 | - 'tax_settings' => new EE_Form_Section_Proper( |
|
1320 | - array( |
|
1321 | - 'name' => 'tax_settings_tbl', |
|
1322 | - 'html_id' => 'tax_settings_tbl', |
|
1323 | - 'html_class' => 'form-table', |
|
1324 | - 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
|
1325 | - 'subsections' => array( |
|
1326 | - 'prices_displayed_including_taxes' => new EE_Yes_No_Input( |
|
1327 | - array( |
|
1328 | - 'html_label_text' => __( |
|
1329 | - "Show Prices With Taxes Included?", |
|
1330 | - 'event_espresso' |
|
1331 | - ), |
|
1332 | - 'html_help_text' => __( |
|
1333 | - 'Indicates whether or not to display prices with the taxes included', |
|
1334 | - 'event_espresso' |
|
1335 | - ), |
|
1336 | - 'default' => isset( |
|
1337 | - EE_Registry::instance() |
|
1338 | - ->CFG |
|
1339 | - ->tax_settings |
|
1340 | - ->prices_displayed_including_taxes |
|
1341 | - ) |
|
1342 | - ? EE_Registry::instance() |
|
1343 | - ->CFG |
|
1344 | - ->tax_settings |
|
1345 | - ->prices_displayed_including_taxes |
|
1346 | - : true, |
|
1347 | - 'display_html_label_text' => false |
|
1348 | - ) |
|
1349 | - ), |
|
1350 | - ) |
|
1351 | - ) |
|
1352 | - ) |
|
1353 | - ) |
|
1354 | - ) |
|
1355 | - ) |
|
1356 | - ); |
|
1357 | - } |
|
1297 | + protected function _tax_settings() { |
|
1298 | + $this->_set_add_edit_form_tags('update_tax_settings'); |
|
1299 | + $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
1300 | + $this->_template_args['admin_page_content'] = $this->tax_settings_form()->get_html(); |
|
1301 | + $this->display_admin_page_with_sidebar(); |
|
1302 | + } |
|
1303 | + |
|
1304 | + |
|
1305 | + |
|
1306 | + /** |
|
1307 | + * @return \EE_Form_Section_Proper |
|
1308 | + * @throws \EE_Error |
|
1309 | + */ |
|
1310 | + protected function tax_settings_form() { |
|
1311 | + return new EE_Form_Section_Proper( |
|
1312 | + array( |
|
1313 | + 'name' => 'tax_settings_form', |
|
1314 | + 'html_id' => 'tax_settings_form', |
|
1315 | + 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
|
1316 | + 'subsections' => apply_filters( |
|
1317 | + 'FHEE__Pricing_Admin_Page__tax_settings_form__form_subsections', |
|
1318 | + array( |
|
1319 | + 'tax_settings' => new EE_Form_Section_Proper( |
|
1320 | + array( |
|
1321 | + 'name' => 'tax_settings_tbl', |
|
1322 | + 'html_id' => 'tax_settings_tbl', |
|
1323 | + 'html_class' => 'form-table', |
|
1324 | + 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
|
1325 | + 'subsections' => array( |
|
1326 | + 'prices_displayed_including_taxes' => new EE_Yes_No_Input( |
|
1327 | + array( |
|
1328 | + 'html_label_text' => __( |
|
1329 | + "Show Prices With Taxes Included?", |
|
1330 | + 'event_espresso' |
|
1331 | + ), |
|
1332 | + 'html_help_text' => __( |
|
1333 | + 'Indicates whether or not to display prices with the taxes included', |
|
1334 | + 'event_espresso' |
|
1335 | + ), |
|
1336 | + 'default' => isset( |
|
1337 | + EE_Registry::instance() |
|
1338 | + ->CFG |
|
1339 | + ->tax_settings |
|
1340 | + ->prices_displayed_including_taxes |
|
1341 | + ) |
|
1342 | + ? EE_Registry::instance() |
|
1343 | + ->CFG |
|
1344 | + ->tax_settings |
|
1345 | + ->prices_displayed_including_taxes |
|
1346 | + : true, |
|
1347 | + 'display_html_label_text' => false |
|
1348 | + ) |
|
1349 | + ), |
|
1350 | + ) |
|
1351 | + ) |
|
1352 | + ) |
|
1353 | + ) |
|
1354 | + ) |
|
1355 | + ) |
|
1356 | + ); |
|
1357 | + } |
|
1358 | 1358 | |
1359 | 1359 | |
1360 | 1360 |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | * @param bool $routing |
32 | 32 | * @return Pricing_Admin_Page |
33 | 33 | */ |
34 | - public function __construct( $routing = TRUE ) { |
|
35 | - parent::__construct( $routing ); |
|
34 | + public function __construct($routing = TRUE) { |
|
35 | + parent::__construct($routing); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | |
51 | 51 | protected function _ajax_hooks() { |
52 | - add_action('wp_ajax_espresso_update_prices_order', array( $this, 'update_price_order' )); |
|
52 | + add_action('wp_ajax_espresso_update_prices_order', array($this, 'update_price_order')); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | * @return void |
83 | 83 | */ |
84 | 84 | protected function _set_page_routes() { |
85 | - $prc_id = ! empty( $this->_req_data['PRC_ID'] ) && ! is_array( $this->_req_data['PRC_ID'] ) ? $this->_req_data['PRC_ID'] : 0; |
|
86 | - $prt_id = ! empty( $this->_req_data['PRT_ID'] ) && ! is_array( $this->_req_data['PRT_ID'] ) ? $this->_req_data['PRT_ID'] : 0; |
|
85 | + $prc_id = ! empty($this->_req_data['PRC_ID']) && ! is_array($this->_req_data['PRC_ID']) ? $this->_req_data['PRC_ID'] : 0; |
|
86 | + $prt_id = ! empty($this->_req_data['PRT_ID']) && ! is_array($this->_req_data['PRT_ID']) ? $this->_req_data['PRT_ID'] : 0; |
|
87 | 87 | $this->_page_routes = array( |
88 | 88 | 'default' => array( |
89 | 89 | 'func' => '_price_overview_list_table', |
@@ -91,38 +91,38 @@ discard block |
||
91 | 91 | ), |
92 | 92 | 'add_new_price' => array( |
93 | 93 | 'func' => '_edit_price_details', |
94 | - 'args' => array( 'new_price' => TRUE ), |
|
94 | + 'args' => array('new_price' => TRUE), |
|
95 | 95 | 'capability' => 'ee_edit_default_prices' |
96 | 96 | ), |
97 | 97 | 'edit_price' => array( |
98 | 98 | 'func' => '_edit_price_details', |
99 | - 'args' => array( 'new_price' => FALSE ), |
|
99 | + 'args' => array('new_price' => FALSE), |
|
100 | 100 | 'capability' => 'ee_edit_default_price', |
101 | 101 | 'obj_id' => $prc_id |
102 | 102 | ), |
103 | 103 | 'insert_price' => array( |
104 | 104 | 'func' => '_insert_or_update_price', |
105 | - 'args' => array( 'new_price' => TRUE ), |
|
105 | + 'args' => array('new_price' => TRUE), |
|
106 | 106 | 'noheader' => TRUE, |
107 | 107 | 'capability' => 'ee_edit_default_prices', |
108 | 108 | ), |
109 | 109 | 'update_price' => array( |
110 | 110 | 'func' => '_insert_or_update_price', |
111 | - 'args' => array( 'new_price' => FALSE ), |
|
111 | + 'args' => array('new_price' => FALSE), |
|
112 | 112 | 'noheader' => TRUE, |
113 | 113 | 'capability' => 'ee_edit_default_price', |
114 | 114 | 'obj_id' => $prc_id |
115 | 115 | ), |
116 | 116 | 'trash_price' => array( |
117 | 117 | 'func' => '_trash_or_restore_price', |
118 | - 'args' => array( 'trash' => TRUE ), |
|
118 | + 'args' => array('trash' => TRUE), |
|
119 | 119 | 'noheader' => TRUE, |
120 | 120 | 'capability' => 'ee_delete_default_price', |
121 | 121 | 'obj_id' => $prc_id |
122 | 122 | ), |
123 | 123 | 'restore_price' => array( |
124 | 124 | 'func' => '_trash_or_restore_price', |
125 | - 'args' => array( 'trash' => FALSE ), |
|
125 | + 'args' => array('trash' => FALSE), |
|
126 | 126 | 'noheader' => TRUE, |
127 | 127 | 'capability' => 'ee_delete_default_price', |
128 | 128 | 'obj_id' => $prc_id |
@@ -154,27 +154,27 @@ discard block |
||
154 | 154 | ), |
155 | 155 | 'insert_price_type' => array( |
156 | 156 | 'func' => '_insert_or_update_price_type', |
157 | - 'args' => array( 'new_price_type' => TRUE ), |
|
157 | + 'args' => array('new_price_type' => TRUE), |
|
158 | 158 | 'noheader' => TRUE, |
159 | 159 | 'capability' => 'ee_edit_default_price_types' |
160 | 160 | ), |
161 | 161 | 'update_price_type' => array( |
162 | 162 | 'func' => '_insert_or_update_price_type', |
163 | - 'args' => array( 'new_price_type' => FALSE ), |
|
163 | + 'args' => array('new_price_type' => FALSE), |
|
164 | 164 | 'noheader' => TRUE, |
165 | 165 | 'capability' => 'ee_edit_default_price_type', |
166 | 166 | 'obj_id' => $prt_id |
167 | 167 | ), |
168 | 168 | 'trash_price_type' => array( |
169 | 169 | 'func' => '_trash_or_restore_price_type', |
170 | - 'args' => array( 'trash' => TRUE ), |
|
170 | + 'args' => array('trash' => TRUE), |
|
171 | 171 | 'noheader' => TRUE, |
172 | 172 | 'capability' => 'ee_delete_default_price_type', |
173 | 173 | 'obj_id' => $prt_id |
174 | 174 | ), |
175 | 175 | 'restore_price_type' => array( |
176 | 176 | 'func' => '_trash_or_restore_price_type', |
177 | - 'args' => array( 'trash' => FALSE ), |
|
177 | + 'args' => array('trash' => FALSE), |
|
178 | 178 | 'noheader' => TRUE, |
179 | 179 | 'capability' => 'ee_delete_default_price_type', |
180 | 180 | 'obj_id' => $prt_id |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | 'filename' => 'pricing_default_pricing_views_bulk_actions_search' |
224 | 224 | ) |
225 | 225 | ), |
226 | - 'help_tour' => array( 'Pricing_Default_Prices_Help_Tour'), |
|
226 | + 'help_tour' => array('Pricing_Default_Prices_Help_Tour'), |
|
227 | 227 | 'require_nonce' => FALSE |
228 | 228 | ), |
229 | 229 | 'add_new_price' => array( |
@@ -239,24 +239,24 @@ discard block |
||
239 | 239 | ) |
240 | 240 | ), |
241 | 241 | 'help_tour' => array('Pricing_Add_New_Default_Price_Help_Tour'), |
242 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
|
242 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes'), |
|
243 | 243 | 'require_nonce' => FALSE |
244 | 244 | ), |
245 | 245 | 'edit_price' => array( |
246 | 246 | 'nav' => array( |
247 | 247 | 'label' => __('Edit Default Price', 'event_espresso'), |
248 | 248 | 'order' => 20, |
249 | - 'url' => isset($this->_req_data['id']) ? add_query_arg(array('id' => $this->_req_data['id'] ), $this->_current_page_view_url ) : $this->_admin_base_url, |
|
249 | + 'url' => isset($this->_req_data['id']) ? add_query_arg(array('id' => $this->_req_data['id']), $this->_current_page_view_url) : $this->_admin_base_url, |
|
250 | 250 | 'persistent' => FALSE |
251 | 251 | ), |
252 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
|
252 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes'), |
|
253 | 253 | 'help_tabs' => array( |
254 | 254 | 'edit_default_price_help_tab' => array( |
255 | 255 | 'title' => __('Edit Default Price', 'event_espresso'), |
256 | 256 | 'filename' => 'pricing_edit_default_price' |
257 | 257 | ) |
258 | 258 | ), |
259 | - 'help_tour' => array( 'Pricing_Edit_Default_Price_Help_Tour' ), |
|
259 | + 'help_tour' => array('Pricing_Edit_Default_Price_Help_Tour'), |
|
260 | 260 | 'require_nonce' => FALSE |
261 | 261 | ), |
262 | 262 | 'price_types' => array( |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | 'filename' => 'pricing_price_types_views_bulk_actions_search' |
280 | 280 | ), |
281 | 281 | ), |
282 | - 'help_tour' => array( 'Pricing_Price_Types_Default_Help_Tour' ), |
|
282 | + 'help_tour' => array('Pricing_Price_Types_Default_Help_Tour'), |
|
283 | 283 | 'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'), |
284 | 284 | 'require_nonce' => FALSE |
285 | 285 | ), |
@@ -295,8 +295,8 @@ discard block |
||
295 | 295 | 'filename' => 'pricing_add_new_price_type' |
296 | 296 | ) |
297 | 297 | ), |
298 | - 'help_tour' => array( 'Pricing_Add_New_Price_Type_Help_Tour' ), |
|
299 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
|
298 | + 'help_tour' => array('Pricing_Add_New_Price_Type_Help_Tour'), |
|
299 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes'), |
|
300 | 300 | 'require_nonce' => FALSE |
301 | 301 | ), |
302 | 302 | 'edit_price_type' => array( |
@@ -311,8 +311,8 @@ discard block |
||
311 | 311 | 'filename' => 'pricing_edit_price_type' |
312 | 312 | ) |
313 | 313 | ), |
314 | - 'help_tour' => array( 'Pricing_Edit_Price_Type_Help_Tour' ), |
|
315 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
|
314 | + 'help_tour' => array('Pricing_Edit_Price_Type_Help_Tour'), |
|
315 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes'), |
|
316 | 316 | |
317 | 317 | 'require_nonce' => FALSE |
318 | 318 | ), |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | public function load_scripts_styles() { |
368 | 368 | //styles |
369 | 369 | wp_enqueue_style('espresso-ui-theme'); |
370 | - wp_register_style( 'espresso_PRICING', PRICING_ASSETS_URL . 'espresso_pricing_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
370 | + wp_register_style('espresso_PRICING', PRICING_ASSETS_URL.'espresso_pricing_admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
371 | 371 | wp_enqueue_style('espresso_PRICING'); |
372 | 372 | |
373 | 373 | //scripts |
@@ -377,8 +377,8 @@ discard block |
||
377 | 377 | //wp_enqueue_script('jquery-ui-dialog'); |
378 | 378 | //wp_enqueue_script('jquery-ui-draggable'); |
379 | 379 | //wp_enqueue_script('jquery-ui-datepicker'); |
380 | - wp_register_script( 'espresso_PRICING', PRICING_ASSETS_URL . 'espresso_pricing_admin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
381 | - wp_enqueue_script( 'espresso_PRICING' ); |
|
380 | + wp_register_script('espresso_PRICING', PRICING_ASSETS_URL.'espresso_pricing_admin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
381 | + wp_enqueue_script('espresso_PRICING'); |
|
382 | 382 | } |
383 | 383 | |
384 | 384 | |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | |
387 | 387 | |
388 | 388 | public function load_scripts_styles_default() { |
389 | - wp_enqueue_script( 'espresso_ajax_table_sorting' ); |
|
389 | + wp_enqueue_script('espresso_ajax_table_sorting'); |
|
390 | 390 | } |
391 | 391 | |
392 | 392 | |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | ) |
415 | 415 | ); |
416 | 416 | |
417 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_prices', 'pricing_trash_price' ) ) { |
|
417 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_prices', 'pricing_trash_price')) { |
|
418 | 418 | $this->_views['trashed'] = array( |
419 | 419 | 'slug' => 'trashed', |
420 | 420 | 'label' => __('Trash', 'event_espresso'), |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | ) |
445 | 445 | ); |
446 | 446 | |
447 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price_types', 'pricing_trash_price_type' ) ) { |
|
447 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price_types', 'pricing_trash_price_type')) { |
|
448 | 448 | $this->_views['trashed'] = array( |
449 | 449 | 'slug' => 'trashed', |
450 | 450 | 'label' => __('Trash', 'event_espresso'), |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | * @return void |
465 | 465 | */ |
466 | 466 | protected function _price_overview_list_table() { |
467 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
467 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button( |
|
468 | 468 | 'add_new_price', |
469 | 469 | 'add', |
470 | 470 | array(), |
@@ -488,18 +488,18 @@ discard block |
||
488 | 488 | * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
489 | 489 | * @return mixed (int|array) int = count || array of price objects |
490 | 490 | */ |
491 | - public function get_prices_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
|
491 | + public function get_prices_overview_data($per_page = 10, $count = FALSE, $trashed = FALSE) { |
|
492 | 492 | |
493 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
493 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
494 | 494 | // start with an empty array |
495 | 495 | $event_pricing = array(); |
496 | 496 | |
497 | - require_once( PRICING_ADMIN . 'Prices_List_Table.class.php' ); |
|
498 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
497 | + require_once(PRICING_ADMIN.'Prices_List_Table.class.php'); |
|
498 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
499 | 499 | //$PRC = EEM_Price::instance(); |
500 | 500 | |
501 | 501 | $this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby']; |
502 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
502 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
503 | 503 | |
504 | 504 | switch ($this->_req_data['orderby']) { |
505 | 505 | case 'name': |
@@ -512,27 +512,27 @@ discard block |
||
512 | 512 | $orderby = array('PRC_amount'=>$order); |
513 | 513 | break; |
514 | 514 | default: |
515 | - $orderby = array( 'PRC_order'=>$order, 'Price_Type.PRT_order'=>$order, 'PRC_ID'=>$order); |
|
515 | + $orderby = array('PRC_order'=>$order, 'Price_Type.PRT_order'=>$order, 'PRC_ID'=>$order); |
|
516 | 516 | } |
517 | 517 | |
518 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
519 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
518 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
519 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
520 | 520 | |
521 | 521 | $_where = array( |
522 | 522 | 'PRC_is_default' => 1, |
523 | 523 | 'PRC_deleted' => $trashed |
524 | 524 | ); |
525 | 525 | |
526 | - $offset = ($current_page-1)*$per_page; |
|
527 | - $limit = array( $offset, $per_page ); |
|
526 | + $offset = ($current_page - 1) * $per_page; |
|
527 | + $limit = array($offset, $per_page); |
|
528 | 528 | |
529 | - if ( isset( $this->_req_data['s'] ) ) { |
|
530 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
529 | + if (isset($this->_req_data['s'])) { |
|
530 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
531 | 531 | $_where['OR'] = array( |
532 | - 'PRC_name' => array('LIKE',$sstr ), |
|
533 | - 'PRC_desc' => array('LIKE',$sstr ), |
|
534 | - 'PRC_amount' => array( 'LIKE',$sstr ), |
|
535 | - 'Price_Type.PRT_name' => array( 'LIKE', $sstr ) |
|
532 | + 'PRC_name' => array('LIKE', $sstr), |
|
533 | + 'PRC_desc' => array('LIKE', $sstr), |
|
534 | + 'PRC_amount' => array('LIKE', $sstr), |
|
535 | + 'Price_Type.PRT_name' => array('LIKE', $sstr) |
|
536 | 536 | ); |
537 | 537 | } |
538 | 538 | |
@@ -543,9 +543,9 @@ discard block |
||
543 | 543 | 'group_by'=>'PRC_ID' |
544 | 544 | ); |
545 | 545 | |
546 | - if($count){ |
|
547 | - return $trashed ? EEM_Price::instance()->count( array( $_where ) ) : EEM_Price::instance()->count_deleted_and_undeleted(array($_where)); |
|
548 | - }else{ |
|
546 | + if ($count) { |
|
547 | + return $trashed ? EEM_Price::instance()->count(array($_where)) : EEM_Price::instance()->count_deleted_and_undeleted(array($_where)); |
|
548 | + } else { |
|
549 | 549 | return EEM_Price::instance()->get_all_deleted_and_undeleted($query_params); |
550 | 550 | } |
551 | 551 | } |
@@ -561,49 +561,49 @@ discard block |
||
561 | 561 | * @return void |
562 | 562 | */ |
563 | 563 | protected function _edit_price_details() { |
564 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
564 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
565 | 565 | // grab price ID |
566 | - $PRC_ID = isset( $this->_req_data['id'] ) && ! empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE; |
|
566 | + $PRC_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE; |
|
567 | 567 | // change page title based on request action |
568 | - switch( $this->_req_action ) { |
|
568 | + switch ($this->_req_action) { |
|
569 | 569 | case 'add_new_price' : |
570 | - $this->_admin_page_title = esc_html__( 'Add New Price', 'event_espresso' ); |
|
570 | + $this->_admin_page_title = esc_html__('Add New Price', 'event_espresso'); |
|
571 | 571 | break; |
572 | 572 | case 'edit_price' : |
573 | - $this->_admin_page_title = esc_html__( 'Edit Price', 'event_espresso' ); |
|
573 | + $this->_admin_page_title = esc_html__('Edit Price', 'event_espresso'); |
|
574 | 574 | break; |
575 | 575 | default : |
576 | - $this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action )); |
|
576 | + $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); |
|
577 | 577 | } |
578 | 578 | // add PRC_ID to title if editing |
579 | - $this->_admin_page_title = $PRC_ID ? $this->_admin_page_title . ' # ' . $PRC_ID : $this->_admin_page_title; |
|
579 | + $this->_admin_page_title = $PRC_ID ? $this->_admin_page_title.' # '.$PRC_ID : $this->_admin_page_title; |
|
580 | 580 | |
581 | 581 | // get prices |
582 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
582 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
583 | 583 | $PRC = EEM_Price::instance(); |
584 | 584 | |
585 | - if ( $PRC_ID ) { |
|
586 | - $price = $PRC->get_one_by_ID( $PRC_ID ); |
|
585 | + if ($PRC_ID) { |
|
586 | + $price = $PRC->get_one_by_ID($PRC_ID); |
|
587 | 587 | $additional_hidden_fields = array( |
588 | - 'PRC_ID' => array( 'type' => 'hidden', 'value' => $PRC_ID ) |
|
588 | + 'PRC_ID' => array('type' => 'hidden', 'value' => $PRC_ID) |
|
589 | 589 | ); |
590 | - $this->_set_add_edit_form_tags( 'update_price', $additional_hidden_fields ); |
|
590 | + $this->_set_add_edit_form_tags('update_price', $additional_hidden_fields); |
|
591 | 591 | } else { |
592 | 592 | $price = $PRC->get_new_price(); |
593 | - $this->_set_add_edit_form_tags( 'insert_price' ); |
|
593 | + $this->_set_add_edit_form_tags('insert_price'); |
|
594 | 594 | } |
595 | 595 | |
596 | 596 | $this->_template_args['PRC_ID'] = $PRC_ID; |
597 | 597 | $this->_template_args['price'] = $price; |
598 | 598 | |
599 | 599 | // get price types |
600 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
600 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
601 | 601 | $PRT = EEM_Price_Type::instance(); |
602 | - $price_types = $PRT->get_all( array( array('PBT_ID' => array('!=', 1 ) ) ) ); |
|
602 | + $price_types = $PRT->get_all(array(array('PBT_ID' => array('!=', 1)))); |
|
603 | 603 | $price_type_names = array(); |
604 | 604 | if (empty($price_types)) { |
605 | - $msg = __( 'You have no price types defined. Please add a price type before adding a price.', 'event_espresso' ); |
|
606 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
605 | + $msg = __('You have no price types defined. Please add a price type before adding a price.', 'event_espresso'); |
|
606 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
607 | 607 | exit(); |
608 | 608 | } else { |
609 | 609 | foreach ($price_types as $type) { |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | $this->_template_args['price_types'] = $price_type_names; |
617 | 617 | $this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link(); |
618 | 618 | |
619 | - $this->_set_publish_post_box_vars( 'id', $PRC_ID ); |
|
619 | + $this->_set_publish_post_box_vars('id', $PRC_ID); |
|
620 | 620 | // the details template wrapper |
621 | 621 | $this->display_admin_page_with_sidebar(); |
622 | 622 | } |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | * @return void |
633 | 633 | */ |
634 | 634 | protected function _price_details_meta_boxes() { |
635 | - add_meta_box( 'edit-price-details-mbox', __( 'Default Price Details', 'event_espresso' ), array( $this, '_edit_price_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
635 | + add_meta_box('edit-price-details-mbox', __('Default Price Details', 'event_espresso'), array($this, '_edit_price_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
636 | 636 | } |
637 | 637 | |
638 | 638 | |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | * @return void |
647 | 647 | */ |
648 | 648 | public function _edit_price_details_meta_box() { |
649 | - echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
|
649 | + echo EEH_Template::display_template(PRICING_TEMPLATE_PATH.'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE); |
|
650 | 650 | } |
651 | 651 | |
652 | 652 | |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | */ |
661 | 661 | protected function set_price_column_values() { |
662 | 662 | |
663 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
663 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
664 | 664 | |
665 | 665 | $set_column_values = array( |
666 | 666 | 'PRT_ID' => absint($this->_req_data['PRT_ID']), |
@@ -688,12 +688,12 @@ discard block |
||
688 | 688 | * @access protected |
689 | 689 | * @return void |
690 | 690 | */ |
691 | - protected function _insert_or_update_price( $insert = FALSE ) { |
|
691 | + protected function _insert_or_update_price($insert = FALSE) { |
|
692 | 692 | |
693 | 693 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
694 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
694 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
695 | 695 | |
696 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
696 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
697 | 697 | $PRC = EEM_Price::instance(); |
698 | 698 | |
699 | 699 | // why be so pessimistic ??? : ( |
@@ -701,14 +701,14 @@ discard block |
||
701 | 701 | |
702 | 702 | $set_column_values = $this->set_price_column_values(); |
703 | 703 | // is this a new Price ? |
704 | - if ( $insert ) { |
|
704 | + if ($insert) { |
|
705 | 705 | // run the insert |
706 | - if ( $PRC_ID = $PRC->insert( $set_column_values )) { |
|
706 | + if ($PRC_ID = $PRC->insert($set_column_values)) { |
|
707 | 707 | //make sure this new price modifier is attached to the ticket but ONLY if it is not a tax type |
708 | 708 | $PR = EEM_price::instance()->get_one_by_ID($PRC_ID); |
709 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
709 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
710 | 710 | $ticket = EEM_Ticket::instance()->get_one_by_ID(1); |
711 | - $ticket->_add_relation_to( $PR, 'Price' ); |
|
711 | + $ticket->_add_relation_to($PR, 'Price'); |
|
712 | 712 | $ticket->save(); |
713 | 713 | } |
714 | 714 | $success = 1; |
@@ -718,29 +718,29 @@ discard block |
||
718 | 718 | } |
719 | 719 | $action_desc = 'created'; |
720 | 720 | } else { |
721 | - $PRC_ID = absint( $this->_req_data['PRC_ID'] ); |
|
721 | + $PRC_ID = absint($this->_req_data['PRC_ID']); |
|
722 | 722 | // run the update |
723 | - $where_cols_n_values = array( 'PRC_ID' => $PRC_ID ); |
|
724 | - if ( $PRC->update( $set_column_values, array($where_cols_n_values))) { |
|
723 | + $where_cols_n_values = array('PRC_ID' => $PRC_ID); |
|
724 | + if ($PRC->update($set_column_values, array($where_cols_n_values))) { |
|
725 | 725 | $success = 1; |
726 | 726 | } |
727 | 727 | |
728 | 728 | $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID); |
729 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
729 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
730 | 730 | |
731 | 731 | //if this is $PRC_ID == 1, then we need to update the default ticket attached to this price so the TKT_price value is updated. |
732 | - if ( $PRC_ID === 1 ) { |
|
732 | + if ($PRC_ID === 1) { |
|
733 | 733 | $ticket = $PR->get_first_related('Ticket'); |
734 | - if ( $ticket ) { |
|
735 | - $ticket->set('TKT_price', $PR->get('PRC_amount') ); |
|
736 | - $ticket->set('TKT_name', $PR->get('PRC_name') ); |
|
734 | + if ($ticket) { |
|
735 | + $ticket->set('TKT_price', $PR->get('PRC_amount')); |
|
736 | + $ticket->set('TKT_name', $PR->get('PRC_name')); |
|
737 | 737 | $ticket->set('TKT_description', $PR->get('PRC_desc')); |
738 | 738 | $ticket->save(); |
739 | 739 | } |
740 | 740 | } else { |
741 | 741 | //we make sure this price is attached to base ticket. but ONLY if its not a tax ticket type. |
742 | 742 | $ticket = EEM_Ticket::instance()->get_one_by_ID(1); |
743 | - $ticket->_add_relation_to( $PRC_ID, 'Price' ); |
|
743 | + $ticket->_add_relation_to($PRC_ID, 'Price'); |
|
744 | 744 | $ticket->save(); |
745 | 745 | } |
746 | 746 | } |
@@ -748,9 +748,9 @@ discard block |
||
748 | 748 | $action_desc = 'updated'; |
749 | 749 | } |
750 | 750 | |
751 | - $query_args = array( 'action' => 'edit_price', 'id' => $PRC_ID ); |
|
751 | + $query_args = array('action' => 'edit_price', 'id' => $PRC_ID); |
|
752 | 752 | |
753 | - $this->_redirect_after_action( $success, 'Prices', $action_desc, $query_args ); |
|
753 | + $this->_redirect_after_action($success, 'Prices', $action_desc, $query_args); |
|
754 | 754 | |
755 | 755 | } |
756 | 756 | |
@@ -764,12 +764,12 @@ discard block |
||
764 | 764 | * @access protected |
765 | 765 | * @return void |
766 | 766 | */ |
767 | - protected function _trash_or_restore_price( $trash = TRUE ) { |
|
767 | + protected function _trash_or_restore_price($trash = TRUE) { |
|
768 | 768 | |
769 | 769 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
770 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
770 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
771 | 771 | |
772 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
772 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
773 | 773 | $PRC = EEM_Price::instance(); |
774 | 774 | |
775 | 775 | $success = 1; |
@@ -778,18 +778,18 @@ discard block |
||
778 | 778 | //get base ticket for updating |
779 | 779 | $ticket = EEM_Ticket::instance()->get_one_by_ID(1); |
780 | 780 | //Checkboxes |
781 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
781 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
782 | 782 | // if array has more than one element than success message should be plural |
783 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
783 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
784 | 784 | // cycle thru checkboxes |
785 | - while (list( $PRC_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
786 | - if ( ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID) ) ) { |
|
785 | + while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) { |
|
786 | + if ( ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID))) { |
|
787 | 787 | $success = 0; |
788 | 788 | } else { |
789 | 789 | $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID); |
790 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
790 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
791 | 791 | //if trashing then remove relations to base default ticket. If restoring then add back to base default ticket |
792 | - if ( $PRC_deleted ) { |
|
792 | + if ($PRC_deleted) { |
|
793 | 793 | $ticket->_remove_relation_to($PRC_ID, 'Price'); |
794 | 794 | } else { |
795 | 795 | $ticket->_add_relation_to($PRC_ID, 'Price'); |
@@ -801,14 +801,14 @@ discard block |
||
801 | 801 | |
802 | 802 | } else { |
803 | 803 | // grab single id and delete |
804 | - $PRC_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0; |
|
805 | - if ( empty( $PRC_ID ) || ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), $PRC_ID) ) { |
|
804 | + $PRC_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0; |
|
805 | + if (empty($PRC_ID) || ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), $PRC_ID)) { |
|
806 | 806 | $success = 0; |
807 | 807 | } else { |
808 | 808 | $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID); |
809 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
809 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
810 | 810 | //if trashing then remove relations to base default ticket. If restoring then add back to base default ticket |
811 | - if ( $PRC_deleted ) { |
|
811 | + if ($PRC_deleted) { |
|
812 | 812 | $ticket->_remove_relation_to($PRC_ID, 'Price'); |
813 | 813 | } else { |
814 | 814 | $ticket->_add_relation_to($PRC_ID, 'Price'); |
@@ -822,17 +822,17 @@ discard block |
||
822 | 822 | 'action' => 'default' |
823 | 823 | ); |
824 | 824 | |
825 | - if ( $success ) { |
|
826 | - if ( $trash ) { |
|
825 | + if ($success) { |
|
826 | + if ($trash) { |
|
827 | 827 | $msg = $success == 2 ? __('The Prices have been trashed.', 'event_espresso') : __('The Price has been trashed.', 'event_espresso'); |
828 | 828 | } else { |
829 | 829 | $msg = $success == 2 ? __('The Prices have been restored.', 'event_espresso') : __('The Price has been restored.', 'event_espresso'); |
830 | 830 | } |
831 | 831 | |
832 | - EE_Error::add_success( $msg ); |
|
832 | + EE_Error::add_success($msg); |
|
833 | 833 | } |
834 | 834 | |
835 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
835 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
836 | 836 | |
837 | 837 | } |
838 | 838 | |
@@ -849,19 +849,19 @@ discard block |
||
849 | 849 | protected function _delete_price() { |
850 | 850 | |
851 | 851 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
852 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
852 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
853 | 853 | |
854 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
854 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
855 | 855 | $PRC = EEM_Price::instance(); |
856 | 856 | |
857 | 857 | $success = 1; |
858 | 858 | //Checkboxes |
859 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
859 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
860 | 860 | // if array has more than one element than success message should be plural |
861 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
861 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
862 | 862 | // cycle thru bulk action checkboxes |
863 | - while (list( $PRC_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
864 | - if (!$PRC->delete_permanently_by_ID(absint($PRC_ID))) { |
|
863 | + while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) { |
|
864 | + if ( ! $PRC->delete_permanently_by_ID(absint($PRC_ID))) { |
|
865 | 865 | $success = 0; |
866 | 866 | } |
867 | 867 | } |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | |
876 | 876 | } |
877 | 877 | |
878 | - $this->_redirect_after_action( $success, 'Prices', 'deleted', array() ); |
|
878 | + $this->_redirect_after_action($success, 'Prices', 'deleted', array()); |
|
879 | 879 | |
880 | 880 | } |
881 | 881 | |
@@ -883,16 +883,16 @@ discard block |
||
883 | 883 | |
884 | 884 | |
885 | 885 | public function update_price_order() { |
886 | - $success = __( 'Price order was updated successfully.', 'event_espresso' ); |
|
886 | + $success = __('Price order was updated successfully.', 'event_espresso'); |
|
887 | 887 | |
888 | 888 | // grab our row IDs |
889 | - $row_ids = isset( $this->_req_data['row_ids'] ) && ! empty( $this->_req_data['row_ids'] ) ? explode( ',', rtrim( $this->_req_data['row_ids'], ',' )) : FALSE; |
|
889 | + $row_ids = isset($this->_req_data['row_ids']) && ! empty($this->_req_data['row_ids']) ? explode(',', rtrim($this->_req_data['row_ids'], ',')) : FALSE; |
|
890 | 890 | |
891 | - if ( is_array( $row_ids )) { |
|
892 | - for ( $i = 0; $i < count( $row_ids ); $i++ ) { |
|
891 | + if (is_array($row_ids)) { |
|
892 | + for ($i = 0; $i < count($row_ids); $i++) { |
|
893 | 893 | //Update the prices when re-ordering |
894 | 894 | $id = absint($row_ids[$i]); |
895 | - if ( EEM_Price::instance()->update ( array( 'PRC_order' => $i+1 ), array(array( 'PRC_ID' => $id ) )) === FALSE ) { |
|
895 | + if (EEM_Price::instance()->update(array('PRC_order' => $i + 1), array(array('PRC_ID' => $id))) === FALSE) { |
|
896 | 896 | $success = FALSE; |
897 | 897 | } |
898 | 898 | } |
@@ -900,9 +900,9 @@ discard block |
||
900 | 900 | $success = FALSE; |
901 | 901 | } |
902 | 902 | |
903 | - $errors = ! $success ? __( 'An error occurred. The price order was not updated.', 'event_espresso' ) : FALSE; |
|
903 | + $errors = ! $success ? __('An error occurred. The price order was not updated.', 'event_espresso') : FALSE; |
|
904 | 904 | |
905 | - echo json_encode( array( 'return_data' => FALSE, 'success' => $success, 'errors' => $errors )); |
|
905 | + echo json_encode(array('return_data' => FALSE, 'success' => $success, 'errors' => $errors)); |
|
906 | 906 | die(); |
907 | 907 | } |
908 | 908 | |
@@ -926,7 +926,7 @@ discard block |
||
926 | 926 | * @return void |
927 | 927 | */ |
928 | 928 | protected function _price_types_overview_list_table() { |
929 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
929 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button( |
|
930 | 930 | 'add_new_price_type', |
931 | 931 | 'add_type', |
932 | 932 | array(), |
@@ -950,46 +950,46 @@ discard block |
||
950 | 950 | * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
951 | 951 | * @return mixed (int|array) int = count || array of price objects |
952 | 952 | */ |
953 | - public function get_price_types_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
|
953 | + public function get_price_types_overview_data($per_page = 10, $count = FALSE, $trashed = FALSE) { |
|
954 | 954 | |
955 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
955 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
956 | 956 | // start with an empty array |
957 | 957 | |
958 | - require_once( PRICING_ADMIN . 'Price_Types_List_Table.class.php' ); |
|
959 | - require_once( EE_MODELS . 'EEM_Price_Type.model.php' ); |
|
958 | + require_once(PRICING_ADMIN.'Price_Types_List_Table.class.php'); |
|
959 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
960 | 960 | |
961 | 961 | $this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby']; |
962 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
962 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
963 | 963 | switch ($this->_req_data['orderby']) { |
964 | 964 | case 'name': |
965 | - $orderby = array( 'PRT_name' => $order); |
|
965 | + $orderby = array('PRT_name' => $order); |
|
966 | 966 | break; |
967 | 967 | default: |
968 | - $orderby = array( 'PRT_order' => $order); |
|
968 | + $orderby = array('PRT_order' => $order); |
|
969 | 969 | } |
970 | 970 | |
971 | 971 | |
972 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
973 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
972 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
973 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
974 | 974 | |
975 | - $offset = ($current_page-1)*$per_page; |
|
976 | - $limit = array( $offset, $per_page ); |
|
975 | + $offset = ($current_page - 1) * $per_page; |
|
976 | + $limit = array($offset, $per_page); |
|
977 | 977 | |
978 | - $_where = array('PRT_deleted'=>$trashed, 'PBT_ID' => array('!=', 1 ) ); |
|
978 | + $_where = array('PRT_deleted'=>$trashed, 'PBT_ID' => array('!=', 1)); |
|
979 | 979 | |
980 | - if ( isset( $this->_req_data['s'] ) ) { |
|
981 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
980 | + if (isset($this->_req_data['s'])) { |
|
981 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
982 | 982 | $_where['OR'] = array( |
983 | - 'PRT_name' => array( 'LIKE', $sstr ) |
|
983 | + 'PRT_name' => array('LIKE', $sstr) |
|
984 | 984 | ); |
985 | 985 | } |
986 | 986 | $query_params = array( |
987 | 987 | $_where, |
988 | 988 | 'order_by'=>$orderby, |
989 | 989 | 'limit'=>$limit); |
990 | - if($count){ |
|
990 | + if ($count) { |
|
991 | 991 | return EEM_Price_Type::instance()->count_deleted_and_undeleted($query_params); |
992 | - }else{ |
|
992 | + } else { |
|
993 | 993 | return EEM_Price_Type::instance()->get_all_deleted_and_undeleted($query_params); |
994 | 994 | } |
995 | 995 | |
@@ -1009,34 +1009,34 @@ discard block |
||
1009 | 1009 | */ |
1010 | 1010 | protected function _edit_price_type_details() { |
1011 | 1011 | |
1012 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1012 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1013 | 1013 | |
1014 | 1014 | |
1015 | 1015 | // grab price type ID |
1016 | - $PRT_ID = isset( $this->_req_data['id'] ) && ! empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE; |
|
1016 | + $PRT_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE; |
|
1017 | 1017 | // change page title based on request action |
1018 | - switch( $this->_req_action ) { |
|
1018 | + switch ($this->_req_action) { |
|
1019 | 1019 | case 'add_new_price_type' : |
1020 | - $this->_admin_page_title = esc_html__( 'Add New Price Type', 'event_espresso' ); |
|
1020 | + $this->_admin_page_title = esc_html__('Add New Price Type', 'event_espresso'); |
|
1021 | 1021 | break; |
1022 | 1022 | case 'edit_price_type' : |
1023 | - $this->_admin_page_title = esc_html__( 'Edit Price Type', 'event_espresso' ); |
|
1023 | + $this->_admin_page_title = esc_html__('Edit Price Type', 'event_espresso'); |
|
1024 | 1024 | break; |
1025 | 1025 | default : |
1026 | - $this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action )); |
|
1026 | + $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); |
|
1027 | 1027 | } |
1028 | 1028 | // add PRT_ID to title if editing |
1029 | - $this->_admin_page_title = $PRT_ID ? $this->_admin_page_title . ' # ' . $PRT_ID : $this->_admin_page_title; |
|
1029 | + $this->_admin_page_title = $PRT_ID ? $this->_admin_page_title.' # '.$PRT_ID : $this->_admin_page_title; |
|
1030 | 1030 | |
1031 | 1031 | // require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
1032 | 1032 | |
1033 | - if ( $PRT_ID ) { |
|
1034 | - $price_type = EEM_Price_Type::instance()->get_one_by_ID( $PRT_ID ); |
|
1035 | - $additional_hidden_fields = array( 'PRT_ID' => array( 'type' => 'hidden', 'value' => $PRT_ID )); |
|
1036 | - $this->_set_add_edit_form_tags( 'update_price_type', $additional_hidden_fields ); |
|
1033 | + if ($PRT_ID) { |
|
1034 | + $price_type = EEM_Price_Type::instance()->get_one_by_ID($PRT_ID); |
|
1035 | + $additional_hidden_fields = array('PRT_ID' => array('type' => 'hidden', 'value' => $PRT_ID)); |
|
1036 | + $this->_set_add_edit_form_tags('update_price_type', $additional_hidden_fields); |
|
1037 | 1037 | } else { |
1038 | 1038 | $price_type = EEM_Price_Type::instance()->get_new_price_type(); |
1039 | - $this->_set_add_edit_form_tags( 'insert_price_type' ); |
|
1039 | + $this->_set_add_edit_form_tags('insert_price_type'); |
|
1040 | 1040 | } |
1041 | 1041 | |
1042 | 1042 | $this->_template_args['PRT_ID'] = $PRT_ID; |
@@ -1045,19 +1045,19 @@ discard block |
||
1045 | 1045 | |
1046 | 1046 | $base_types = EEM_Price_Type::instance()->get_base_types(); |
1047 | 1047 | $select_values = array(); |
1048 | - foreach ( $base_types as $ref => $text ) { |
|
1049 | - if ( $ref == EEM_Price_Type::base_type_base_price ) { |
|
1048 | + foreach ($base_types as $ref => $text) { |
|
1049 | + if ($ref == EEM_Price_Type::base_type_base_price) { |
|
1050 | 1050 | //do not allow creation of base_type_base_prices because that's a system only base type. |
1051 | 1051 | continue; |
1052 | 1052 | } |
1053 | - $values[] = array( 'id' => $ref, 'text' => $text ); |
|
1053 | + $values[] = array('id' => $ref, 'text' => $text); |
|
1054 | 1054 | } |
1055 | 1055 | |
1056 | 1056 | |
1057 | 1057 | $this->_template_args['base_type_select'] = EEH_Form_Fields::select_input('base_type', $values, $price_type->base_type(), 'id="price-type-base-type-slct"'); |
1058 | 1058 | $this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link(); |
1059 | - $redirect_URL = add_query_arg( array( 'action' => 'price_types'), $this->_admin_base_url ); |
|
1060 | - $this->_set_publish_post_box_vars( 'id', $PRT_ID, FALSE, $redirect_URL ); |
|
1059 | + $redirect_URL = add_query_arg(array('action' => 'price_types'), $this->_admin_base_url); |
|
1060 | + $this->_set_publish_post_box_vars('id', $PRT_ID, FALSE, $redirect_URL); |
|
1061 | 1061 | // the details template wrapper |
1062 | 1062 | $this->display_admin_page_with_sidebar(); |
1063 | 1063 | |
@@ -1074,7 +1074,7 @@ discard block |
||
1074 | 1074 | * @return void |
1075 | 1075 | */ |
1076 | 1076 | protected function _price_type_details_meta_boxes() { |
1077 | - add_meta_box( 'edit-price-details-mbox', __( 'Price Type Details', 'event_espresso' ), array( $this, '_edit_price_type_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1077 | + add_meta_box('edit-price-details-mbox', __('Price Type Details', 'event_espresso'), array($this, '_edit_price_type_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1078 | 1078 | } |
1079 | 1079 | |
1080 | 1080 | |
@@ -1087,7 +1087,7 @@ discard block |
||
1087 | 1087 | * @return void |
1088 | 1088 | */ |
1089 | 1089 | public function _edit_price_type_details_meta_box() { |
1090 | - echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
|
1090 | + echo EEH_Template::display_template(PRICING_TEMPLATE_PATH.'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE); |
|
1091 | 1091 | } |
1092 | 1092 | |
1093 | 1093 | |
@@ -1100,9 +1100,9 @@ discard block |
||
1100 | 1100 | */ |
1101 | 1101 | protected function set_price_type_column_values() { |
1102 | 1102 | |
1103 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1103 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1104 | 1104 | |
1105 | - $base_type = !empty( $this->_req_data['base_type'] ) ? $this->_req_data['base_type'] : EEM_Price_Type::base_type_base_price; |
|
1105 | + $base_type = ! empty($this->_req_data['base_type']) ? $this->_req_data['base_type'] : EEM_Price_Type::base_type_base_price; |
|
1106 | 1106 | |
1107 | 1107 | switch ($base_type) { |
1108 | 1108 | |
@@ -1149,12 +1149,12 @@ discard block |
||
1149 | 1149 | * @access protected |
1150 | 1150 | * @return void |
1151 | 1151 | */ |
1152 | - protected function _insert_or_update_price_type( $new_price_type = FALSE ) { |
|
1152 | + protected function _insert_or_update_price_type($new_price_type = FALSE) { |
|
1153 | 1153 | |
1154 | 1154 | // echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
1155 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1155 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1156 | 1156 | |
1157 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
1157 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
1158 | 1158 | $PRT = EEM_Price_Type::instance(); |
1159 | 1159 | |
1160 | 1160 | // why be so pessimistic ??? : ( |
@@ -1162,24 +1162,24 @@ discard block |
||
1162 | 1162 | |
1163 | 1163 | $set_column_values = $this->set_price_type_column_values(); |
1164 | 1164 | // is this a new Price ? |
1165 | - if ( $new_price_type ) { |
|
1165 | + if ($new_price_type) { |
|
1166 | 1166 | // run the insert |
1167 | - if ( $PRT_ID = $PRT->insert( $set_column_values )) { |
|
1167 | + if ($PRT_ID = $PRT->insert($set_column_values)) { |
|
1168 | 1168 | $success = 1; |
1169 | 1169 | } |
1170 | 1170 | $action_desc = 'created'; |
1171 | 1171 | } else { |
1172 | 1172 | $PRT_ID = absint($this->_req_data['PRT_ID']); |
1173 | 1173 | // run the update |
1174 | - $where_cols_n_values = array('PRT_ID' => $PRT_ID ); |
|
1175 | - if ( $PRT->update( $set_column_values, array( $where_cols_n_values ))) { |
|
1174 | + $where_cols_n_values = array('PRT_ID' => $PRT_ID); |
|
1175 | + if ($PRT->update($set_column_values, array($where_cols_n_values))) { |
|
1176 | 1176 | $success = 1; |
1177 | 1177 | } |
1178 | 1178 | $action_desc = 'updated'; |
1179 | 1179 | } |
1180 | 1180 | |
1181 | - $query_args = array( 'action'=> 'edit_price_type', 'id' => $PRT_ID ); |
|
1182 | - $this->_redirect_after_action( $success, 'Price Type', $action_desc, $query_args ); |
|
1181 | + $query_args = array('action'=> 'edit_price_type', 'id' => $PRT_ID); |
|
1182 | + $this->_redirect_after_action($success, 'Price Type', $action_desc, $query_args); |
|
1183 | 1183 | |
1184 | 1184 | } |
1185 | 1185 | |
@@ -1193,49 +1193,49 @@ discard block |
||
1193 | 1193 | * @access protected |
1194 | 1194 | * @return void |
1195 | 1195 | */ |
1196 | - protected function _trash_or_restore_price_type( $trash = TRUE ) { |
|
1196 | + protected function _trash_or_restore_price_type($trash = TRUE) { |
|
1197 | 1197 | |
1198 | 1198 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
1199 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1199 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1200 | 1200 | |
1201 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
1201 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
1202 | 1202 | $PRT = EEM_Price_Type::instance(); |
1203 | 1203 | |
1204 | 1204 | $success = 1; |
1205 | 1205 | $PRT_deleted = $trash ? TRUE : FALSE; |
1206 | 1206 | //Checkboxes |
1207 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1207 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1208 | 1208 | // if array has more than one element than success message should be plural |
1209 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1210 | - $what = count( $this->_req_data['checkbox'] ) > 1 ? 'Price Types' : 'Price Type'; |
|
1209 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1210 | + $what = count($this->_req_data['checkbox']) > 1 ? 'Price Types' : 'Price Type'; |
|
1211 | 1211 | // cycle thru checkboxes |
1212 | - while (list( $PRT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
1213 | - if ( ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID ) ) { |
|
1212 | + while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1213 | + if ( ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) { |
|
1214 | 1214 | $success = 0; |
1215 | 1215 | } |
1216 | 1216 | } |
1217 | 1217 | |
1218 | 1218 | } else { |
1219 | 1219 | // grab single id and delete |
1220 | - $PRT_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0; |
|
1221 | - if ( empty( $PRT_ID ) || ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID )) { |
|
1220 | + $PRT_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0; |
|
1221 | + if (empty($PRT_ID) || ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) { |
|
1222 | 1222 | $success = 0; |
1223 | 1223 | } |
1224 | 1224 | $what = 'Price Type'; |
1225 | 1225 | |
1226 | 1226 | } |
1227 | 1227 | |
1228 | - $query_args = array( 'action' => 'price_types' ); |
|
1229 | - if ( $success ) { |
|
1230 | - if ( $trash ) { |
|
1228 | + $query_args = array('action' => 'price_types'); |
|
1229 | + if ($success) { |
|
1230 | + if ($trash) { |
|
1231 | 1231 | $msg = $success > 1 ? __('The Price Types have been trashed.', 'event_espresso') : __('The Price Type has been trashed.', 'event_espresso'); |
1232 | 1232 | } else { |
1233 | 1233 | $msg = $success > 1 ? __('The Price Types have been restored.', 'event_espresso') : __('The Price Type has been restored.', 'event_espresso'); |
1234 | 1234 | } |
1235 | - EE_Error::add_success( $msg ); |
|
1235 | + EE_Error::add_success($msg); |
|
1236 | 1236 | } |
1237 | 1237 | |
1238 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
1238 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
1239 | 1239 | |
1240 | 1240 | } |
1241 | 1241 | |
@@ -1252,19 +1252,19 @@ discard block |
||
1252 | 1252 | protected function _delete_price_type() { |
1253 | 1253 | |
1254 | 1254 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
1255 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1255 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1256 | 1256 | |
1257 | 1257 | $PRT = EEM_Price_Type::instance(); |
1258 | 1258 | |
1259 | 1259 | $success = 1; |
1260 | 1260 | //Checkboxes |
1261 | - if (!empty($this->_req_data['checkbox'])) { |
|
1261 | + if ( ! empty($this->_req_data['checkbox'])) { |
|
1262 | 1262 | // if array has more than one element than success message should be plural |
1263 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1263 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1264 | 1264 | $what = $PRT->item_name($success); |
1265 | 1265 | // cycle thru bulk action checkboxes |
1266 | - while (list( $PRT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
1267 | - if (!$PRT->delete_permanently_by_ID($PRT_ID) ) { |
|
1266 | + while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1267 | + if ( ! $PRT->delete_permanently_by_ID($PRT_ID)) { |
|
1268 | 1268 | $success = 0; |
1269 | 1269 | } |
1270 | 1270 | } |
@@ -1272,8 +1272,8 @@ discard block |
||
1272 | 1272 | } |
1273 | 1273 | |
1274 | 1274 | |
1275 | - $query_args = array( 'action'=> 'price_types' ); |
|
1276 | - $this->_redirect_after_action( $success, $what, 'deleted', $query_args ); |
|
1275 | + $query_args = array('action'=> 'price_types'); |
|
1276 | + $this->_redirect_after_action($success, $what, 'deleted', $query_args); |
|
1277 | 1277 | |
1278 | 1278 | } |
1279 | 1279 | |
@@ -1289,7 +1289,7 @@ discard block |
||
1289 | 1289 | * @return string |
1290 | 1290 | */ |
1291 | 1291 | protected function _learn_more_about_pricing_link() { |
1292 | - return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how pricing works', 'event_espresso') . '</a>'; |
|
1292 | + return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >'.__('learn more about how pricing works', 'event_espresso').'</a>'; |
|
1293 | 1293 | } |
1294 | 1294 | |
1295 | 1295 | |
@@ -1365,17 +1365,17 @@ discard block |
||
1365 | 1365 | * @return void |
1366 | 1366 | */ |
1367 | 1367 | public function _update_tax_settings() { |
1368 | - if ( ! isset( EE_Registry::instance()->CFG->tax_settings ) ) { |
|
1368 | + if ( ! isset(EE_Registry::instance()->CFG->tax_settings)) { |
|
1369 | 1369 | EE_Registry::instance()->CFG->tax_settings = new EE_Tax_Config(); |
1370 | 1370 | } |
1371 | 1371 | try { |
1372 | 1372 | $tax_form = $this->tax_settings_form(); |
1373 | 1373 | //check for form submission |
1374 | - if ( $tax_form->was_submitted() ) { |
|
1374 | + if ($tax_form->was_submitted()) { |
|
1375 | 1375 | //capture form data |
1376 | 1376 | $tax_form->receive_form_submission(); |
1377 | 1377 | //validate form data |
1378 | - if ( $tax_form->is_valid() ) { |
|
1378 | + if ($tax_form->is_valid()) { |
|
1379 | 1379 | //grab validated data from form |
1380 | 1380 | $valid_data = $tax_form->valid_data(); |
1381 | 1381 | //set data on config |
@@ -1385,7 +1385,7 @@ discard block |
||
1385 | 1385 | ->prices_displayed_including_taxes |
1386 | 1386 | = $valid_data['tax_settings']['prices_displayed_including_taxes']; |
1387 | 1387 | } else { |
1388 | - if ( $tax_form->submission_error_message() !== '' ) { |
|
1388 | + if ($tax_form->submission_error_message() !== '') { |
|
1389 | 1389 | EE_Error::add_error( |
1390 | 1390 | $tax_form->submission_error_message(), |
1391 | 1391 | __FILE__, |
@@ -1395,8 +1395,8 @@ discard block |
||
1395 | 1395 | } |
1396 | 1396 | } |
1397 | 1397 | } |
1398 | - } catch ( EE_Error $e ) { |
|
1399 | - EE_Error::add_error( $e->get_error(), __FILE__, __FUNCTION__, __LINE__ ); |
|
1398 | + } catch (EE_Error $e) { |
|
1399 | + EE_Error::add_error($e->get_error(), __FILE__, __FUNCTION__, __LINE__); |
|
1400 | 1400 | } |
1401 | 1401 | |
1402 | 1402 | $what = 'Tax Settings'; |
@@ -1407,7 +1407,7 @@ discard block |
||
1407 | 1407 | __FUNCTION__, |
1408 | 1408 | __LINE__ |
1409 | 1409 | ); |
1410 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'tax_settings' ) ); |
|
1410 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'tax_settings')); |
|
1411 | 1411 | } |
1412 | 1412 | |
1413 | 1413 |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');} |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); } |
|
2 | 2 | /** |
3 | 3 | * EEH_Activation Helper |
4 | 4 | * |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | * @return \EventEspresso\core\services\database\TableAnalysis |
55 | 55 | */ |
56 | 56 | public static function getTableAnalysis() { |
57 | - if ( ! self::$table_analysis instanceof \EventEspresso\core\services\database\TableAnalysis ) { |
|
58 | - self::$table_analysis = EE_Registry::instance()->create( 'TableAnalysis', array(), true ); |
|
57 | + if ( ! self::$table_analysis instanceof \EventEspresso\core\services\database\TableAnalysis) { |
|
58 | + self::$table_analysis = EE_Registry::instance()->create('TableAnalysis', array(), true); |
|
59 | 59 | } |
60 | 60 | return self::$table_analysis; |
61 | 61 | } |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | * @return \EventEspresso\core\services\database\TableManager |
67 | 67 | */ |
68 | 68 | public static function getTableManager() { |
69 | - if ( ! self::$table_manager instanceof \EventEspresso\core\services\database\TableManager ) { |
|
70 | - self::$table_manager = EE_Registry::instance()->create( 'TableManager', array(), true ); |
|
69 | + if ( ! self::$table_manager instanceof \EventEspresso\core\services\database\TableManager) { |
|
70 | + self::$table_manager = EE_Registry::instance()->create('TableManager', array(), true); |
|
71 | 71 | } |
72 | 72 | return self::$table_manager; |
73 | 73 | } |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | * @param $table_name |
83 | 83 | * @return string |
84 | 84 | */ |
85 | - public static function ensure_table_name_has_prefix( $table_name ) { |
|
86 | - return \EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix( $table_name ); |
|
85 | + public static function ensure_table_name_has_prefix($table_name) { |
|
86 | + return \EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix($table_name); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * @return boolean success, whether the database and folders are setup properly |
112 | 112 | * @throws \EE_Error |
113 | 113 | */ |
114 | - public static function initialize_db_and_folders(){ |
|
114 | + public static function initialize_db_and_folders() { |
|
115 | 115 | $good_filesystem = EEH_Activation::create_upload_directories(); |
116 | 116 | $good_db = EEH_Activation::create_database_tables(); |
117 | 117 | return $good_filesystem && $good_db; |
@@ -127,9 +127,9 @@ discard block |
||
127 | 127 | * |
128 | 128 | * @throws \EE_Error |
129 | 129 | */ |
130 | - public static function initialize_db_content(){ |
|
130 | + public static function initialize_db_content() { |
|
131 | 131 | //let's avoid doing all this logic repeatedly, especially when addons are requesting it |
132 | - if( EEH_Activation::$_initialized_db_content_already_in_this_request ) { |
|
132 | + if (EEH_Activation::$_initialized_db_content_already_in_this_request) { |
|
133 | 133 | return; |
134 | 134 | } |
135 | 135 | EEH_Activation::$_initialized_db_content_already_in_this_request = true; |
@@ -146,9 +146,9 @@ discard block |
||
146 | 146 | EEH_Activation::remove_cron_tasks(); |
147 | 147 | EEH_Activation::create_cron_tasks(); |
148 | 148 | // remove all TXN locks since that is being done via extra meta now |
149 | - delete_option( 'ee_locked_transactions' ); |
|
149 | + delete_option('ee_locked_transactions'); |
|
150 | 150 | //also, check for CAF default db content |
151 | - do_action( 'AHEE__EEH_Activation__initialize_db_content' ); |
|
151 | + do_action('AHEE__EEH_Activation__initialize_db_content'); |
|
152 | 152 | //also: EEM_Gateways::load_all_gateways() outputs a lot of success messages |
153 | 153 | //which users really won't care about on initial activation |
154 | 154 | EE_Error::overwrite_success(); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | * @return array |
169 | 169 | * @throws \EE_Error |
170 | 170 | */ |
171 | - public static function get_cron_tasks( $which_to_include ) { |
|
171 | + public static function get_cron_tasks($which_to_include) { |
|
172 | 172 | $cron_tasks = apply_filters( |
173 | 173 | 'FHEE__EEH_Activation__get_cron_tasks', |
174 | 174 | array( |
@@ -177,16 +177,16 @@ discard block |
||
177 | 177 | 'AHEE__EE_Cron_Tasks__update_transaction_with_payment' => EEH_Activation::cron_task_no_longer_in_use, //there may have been a bug which prevented from these cron tasks from getting unscheduled, so we might want to remove these for a few updates |
178 | 178 | ) |
179 | 179 | ); |
180 | - if ( $which_to_include === 'old' ) { |
|
180 | + if ($which_to_include === 'old') { |
|
181 | 181 | $cron_tasks = array_filter( |
182 | 182 | $cron_tasks, |
183 | - function ( $value ) { |
|
183 | + function($value) { |
|
184 | 184 | return $value === EEH_Activation::cron_task_no_longer_in_use; |
185 | 185 | } |
186 | 186 | ); |
187 | - } elseif ( $which_to_include === 'current' ) { |
|
188 | - $cron_tasks = array_filter( $cron_tasks ); |
|
189 | - } elseif ( WP_DEBUG && $which_to_include !== 'all' ) { |
|
187 | + } elseif ($which_to_include === 'current') { |
|
188 | + $cron_tasks = array_filter($cron_tasks); |
|
189 | + } elseif (WP_DEBUG && $which_to_include !== 'all') { |
|
190 | 190 | throw new EE_Error( |
191 | 191 | sprintf( |
192 | 192 | __( |
@@ -209,9 +209,9 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public static function create_cron_tasks() { |
211 | 211 | |
212 | - foreach( EEH_Activation::get_cron_tasks( 'current' ) as $hook_name => $frequency ) { |
|
213 | - if( ! wp_next_scheduled( $hook_name ) ) { |
|
214 | - wp_schedule_event( time(), $frequency, $hook_name ); |
|
212 | + foreach (EEH_Activation::get_cron_tasks('current') as $hook_name => $frequency) { |
|
213 | + if ( ! wp_next_scheduled($hook_name)) { |
|
214 | + wp_schedule_event(time(), $frequency, $hook_name); |
|
215 | 215 | } |
216 | 216 | } |
217 | 217 | |
@@ -225,10 +225,10 @@ discard block |
||
225 | 225 | * @param boolean $remove_all whether to only remove the old ones, or remove absolutely ALL the EE ones |
226 | 226 | * @throws \EE_Error |
227 | 227 | */ |
228 | - public static function remove_cron_tasks( $remove_all = true ) { |
|
228 | + public static function remove_cron_tasks($remove_all = true) { |
|
229 | 229 | $cron_tasks_to_remove = $remove_all ? 'all' : 'old'; |
230 | 230 | $crons = _get_cron_array(); |
231 | - $crons = is_array( $crons ) ? $crons : array(); |
|
231 | + $crons = is_array($crons) ? $crons : array(); |
|
232 | 232 | /* reminder of what $crons look like: |
233 | 233 | * Top-level keys are timestamps, and their values are arrays. |
234 | 234 | * The 2nd level arrays have keys with each of the cron task hook names to run at that time |
@@ -246,23 +246,23 @@ discard block |
||
246 | 246 | * ... |
247 | 247 | * ... |
248 | 248 | */ |
249 | - $ee_cron_tasks_to_remove = EEH_Activation::get_cron_tasks( $cron_tasks_to_remove ); |
|
250 | - foreach ( $crons as $timestamp => $hooks_to_fire_at_time ) { |
|
251 | - if ( is_array( $hooks_to_fire_at_time ) ) { |
|
252 | - foreach ( $hooks_to_fire_at_time as $hook_name => $hook_actions ) { |
|
253 | - if ( isset( $ee_cron_tasks_to_remove[ $hook_name ] ) |
|
254 | - && is_array( $ee_cron_tasks_to_remove[ $hook_name ] ) |
|
249 | + $ee_cron_tasks_to_remove = EEH_Activation::get_cron_tasks($cron_tasks_to_remove); |
|
250 | + foreach ($crons as $timestamp => $hooks_to_fire_at_time) { |
|
251 | + if (is_array($hooks_to_fire_at_time)) { |
|
252 | + foreach ($hooks_to_fire_at_time as $hook_name => $hook_actions) { |
|
253 | + if (isset($ee_cron_tasks_to_remove[$hook_name]) |
|
254 | + && is_array($ee_cron_tasks_to_remove[$hook_name]) |
|
255 | 255 | ) { |
256 | - unset( $crons[ $timestamp ][ $hook_name ] ); |
|
256 | + unset($crons[$timestamp][$hook_name]); |
|
257 | 257 | } |
258 | 258 | } |
259 | 259 | //also take care of any empty cron timestamps. |
260 | - if ( empty( $hooks_to_fire_at_time ) ) { |
|
261 | - unset( $crons[ $timestamp ] ); |
|
260 | + if (empty($hooks_to_fire_at_time)) { |
|
261 | + unset($crons[$timestamp]); |
|
262 | 262 | } |
263 | 263 | } |
264 | 264 | } |
265 | - _set_cron_array( $crons ); |
|
265 | + _set_cron_array($crons); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | */ |
278 | 278 | public static function CPT_initialization() { |
279 | 279 | // register Custom Post Types |
280 | - EE_Registry::instance()->load_core( 'Register_CPTs' ); |
|
280 | + EE_Registry::instance()->load_core('Register_CPTs'); |
|
281 | 281 | flush_rewrite_rules(); |
282 | 282 | } |
283 | 283 | |
@@ -295,8 +295,8 @@ discard block |
||
295 | 295 | * @return void |
296 | 296 | */ |
297 | 297 | public static function reset_and_update_config() { |
298 | - do_action( 'AHEE__EE_Config___load_core_config__start', array( 'EEH_Activation', 'load_calendar_config' ) ); |
|
299 | - add_filter( 'FHEE__EE_Config___load_core_config__config_settings', array( 'EEH_Activation', 'migrate_old_config_data' ), 10, 3 ); |
|
298 | + do_action('AHEE__EE_Config___load_core_config__start', array('EEH_Activation', 'load_calendar_config')); |
|
299 | + add_filter('FHEE__EE_Config___load_core_config__config_settings', array('EEH_Activation', 'migrate_old_config_data'), 10, 3); |
|
300 | 300 | //EE_Config::reset(); |
301 | 301 | } |
302 | 302 | |
@@ -309,28 +309,28 @@ discard block |
||
309 | 309 | */ |
310 | 310 | public static function load_calendar_config() { |
311 | 311 | // grab array of all plugin folders and loop thru it |
312 | - $plugins = glob( WP_PLUGIN_DIR . DS . '*', GLOB_ONLYDIR ); |
|
313 | - if ( empty( $plugins ) ) { |
|
312 | + $plugins = glob(WP_PLUGIN_DIR.DS.'*', GLOB_ONLYDIR); |
|
313 | + if (empty($plugins)) { |
|
314 | 314 | return; |
315 | 315 | } |
316 | - foreach ( $plugins as $plugin_path ) { |
|
316 | + foreach ($plugins as $plugin_path) { |
|
317 | 317 | // grab plugin folder name from path |
318 | - $plugin = basename( $plugin_path ); |
|
318 | + $plugin = basename($plugin_path); |
|
319 | 319 | // drill down to Espresso plugins |
320 | 320 | // then to calendar related plugins |
321 | 321 | if ( |
322 | - strpos( $plugin, 'espresso' ) !== FALSE |
|
323 | - || strpos( $plugin, 'Espresso' ) !== FALSE |
|
324 | - || strpos( $plugin, 'ee4' ) !== FALSE |
|
325 | - || strpos( $plugin, 'EE4' ) !== FALSE |
|
326 | - || strpos( $plugin, 'calendar' ) !== false |
|
322 | + strpos($plugin, 'espresso') !== FALSE |
|
323 | + || strpos($plugin, 'Espresso') !== FALSE |
|
324 | + || strpos($plugin, 'ee4') !== FALSE |
|
325 | + || strpos($plugin, 'EE4') !== FALSE |
|
326 | + || strpos($plugin, 'calendar') !== false |
|
327 | 327 | ) { |
328 | 328 | // this is what we are looking for |
329 | - $calendar_config = $plugin_path . DS . 'EE_Calendar_Config.php'; |
|
329 | + $calendar_config = $plugin_path.DS.'EE_Calendar_Config.php'; |
|
330 | 330 | // does it exist in this folder ? |
331 | - if ( is_readable( $calendar_config )) { |
|
331 | + if (is_readable($calendar_config)) { |
|
332 | 332 | // YEAH! let's load it |
333 | - require_once( $calendar_config ); |
|
333 | + require_once($calendar_config); |
|
334 | 334 | } |
335 | 335 | } |
336 | 336 | } |
@@ -346,21 +346,21 @@ discard block |
||
346 | 346 | * @param \EE_Config $EE_Config |
347 | 347 | * @return \stdClass |
348 | 348 | */ |
349 | - public static function migrate_old_config_data( $settings = array(), $config = '', EE_Config $EE_Config ) { |
|
350 | - $convert_from_array = array( 'addons' ); |
|
349 | + public static function migrate_old_config_data($settings = array(), $config = '', EE_Config $EE_Config) { |
|
350 | + $convert_from_array = array('addons'); |
|
351 | 351 | // in case old settings were saved as an array |
352 | - if ( is_array( $settings ) && in_array( $config, $convert_from_array )) { |
|
352 | + if (is_array($settings) && in_array($config, $convert_from_array)) { |
|
353 | 353 | // convert existing settings to an object |
354 | 354 | $config_array = $settings; |
355 | 355 | $settings = new stdClass(); |
356 | - foreach ( $config_array as $key => $value ){ |
|
357 | - if ( $key === 'calendar' && class_exists( 'EE_Calendar_Config' )) { |
|
358 | - $EE_Config->set_config( 'addons', 'EE_Calendar', 'EE_Calendar_Config', $value ); |
|
356 | + foreach ($config_array as $key => $value) { |
|
357 | + if ($key === 'calendar' && class_exists('EE_Calendar_Config')) { |
|
358 | + $EE_Config->set_config('addons', 'EE_Calendar', 'EE_Calendar_Config', $value); |
|
359 | 359 | } else { |
360 | 360 | $settings->{$key} = $value; |
361 | 361 | } |
362 | 362 | } |
363 | - add_filter( 'FHEE__EE_Config___load_core_config__update_espresso_config', '__return_true' ); |
|
363 | + add_filter('FHEE__EE_Config___load_core_config__update_espresso_config', '__return_true'); |
|
364 | 364 | } |
365 | 365 | return $settings; |
366 | 366 | } |
@@ -376,8 +376,8 @@ discard block |
||
376 | 376 | */ |
377 | 377 | public static function deactivate_event_espresso() { |
378 | 378 | // check permissions |
379 | - if ( current_user_can( 'activate_plugins' )) { |
|
380 | - deactivate_plugins( EE_PLUGIN_BASENAME, TRUE ); |
|
379 | + if (current_user_can('activate_plugins')) { |
|
380 | + deactivate_plugins(EE_PLUGIN_BASENAME, TRUE); |
|
381 | 381 | } |
382 | 382 | } |
383 | 383 | |
@@ -399,25 +399,25 @@ discard block |
||
399 | 399 | $critical_pages = array( |
400 | 400 | array( |
401 | 401 | 'id' =>'reg_page_id', |
402 | - 'name' => __( 'Registration Checkout', 'event_espresso' ), |
|
402 | + 'name' => __('Registration Checkout', 'event_espresso'), |
|
403 | 403 | 'post' => NULL, |
404 | 404 | 'code' => 'ESPRESSO_CHECKOUT' |
405 | 405 | ), |
406 | 406 | array( |
407 | 407 | 'id' => 'txn_page_id', |
408 | - 'name' => __( 'Transactions', 'event_espresso' ), |
|
408 | + 'name' => __('Transactions', 'event_espresso'), |
|
409 | 409 | 'post' => NULL, |
410 | 410 | 'code' => 'ESPRESSO_TXN_PAGE' |
411 | 411 | ), |
412 | 412 | array( |
413 | 413 | 'id' => 'thank_you_page_id', |
414 | - 'name' => __( 'Thank You', 'event_espresso' ), |
|
414 | + 'name' => __('Thank You', 'event_espresso'), |
|
415 | 415 | 'post' => NULL, |
416 | 416 | 'code' => 'ESPRESSO_THANK_YOU' |
417 | 417 | ), |
418 | 418 | array( |
419 | 419 | 'id' => 'cancel_page_id', |
420 | - 'name' => __( 'Registration Cancelled', 'event_espresso' ), |
|
420 | + 'name' => __('Registration Cancelled', 'event_espresso'), |
|
421 | 421 | 'post' => NULL, |
422 | 422 | 'code' => 'ESPRESSO_CANCELLED' |
423 | 423 | ), |
@@ -425,62 +425,62 @@ discard block |
||
425 | 425 | |
426 | 426 | $EE_Core_Config = EE_Registry::instance()->CFG->core; |
427 | 427 | |
428 | - foreach ( $critical_pages as $critical_page ) { |
|
428 | + foreach ($critical_pages as $critical_page) { |
|
429 | 429 | // is critical page ID set in config ? |
430 | - if ( $EE_Core_Config->{$critical_page[ 'id' ]} !== FALSE ) { |
|
430 | + if ($EE_Core_Config->{$critical_page['id']} !== FALSE) { |
|
431 | 431 | // attempt to find post by ID |
432 | - $critical_page['post'] = get_post( $EE_Core_Config->{$critical_page[ 'id' ]} ); |
|
432 | + $critical_page['post'] = get_post($EE_Core_Config->{$critical_page['id']} ); |
|
433 | 433 | } |
434 | 434 | // no dice? |
435 | - if ( $critical_page['post'] === null ) { |
|
435 | + if ($critical_page['post'] === null) { |
|
436 | 436 | // attempt to find post by title |
437 | - $critical_page['post'] = self::get_page_by_ee_shortcode( $critical_page['code'] ); |
|
437 | + $critical_page['post'] = self::get_page_by_ee_shortcode($critical_page['code']); |
|
438 | 438 | // still nothing? |
439 | - if ( $critical_page['post'] === null ) { |
|
440 | - $critical_page = EEH_Activation::create_critical_page( $critical_page ); |
|
439 | + if ($critical_page['post'] === null) { |
|
440 | + $critical_page = EEH_Activation::create_critical_page($critical_page); |
|
441 | 441 | // REALLY? Still nothing ??!?!? |
442 | - if ( $critical_page['post'] === null ) { |
|
443 | - $msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' ); |
|
444 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
442 | + if ($critical_page['post'] === null) { |
|
443 | + $msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso'); |
|
444 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
445 | 445 | break; |
446 | 446 | } |
447 | 447 | } |
448 | 448 | } |
449 | 449 | // track post_shortcodes |
450 | - if ( $critical_page['post'] ) { |
|
451 | - EEH_Activation::_track_critical_page_post_shortcodes( $critical_page ); |
|
450 | + if ($critical_page['post']) { |
|
451 | + EEH_Activation::_track_critical_page_post_shortcodes($critical_page); |
|
452 | 452 | } |
453 | 453 | // check that Post ID matches critical page ID in config |
454 | 454 | if ( |
455 | - isset( $critical_page['post']->ID ) |
|
456 | - && $critical_page['post']->ID !== $EE_Core_Config->{$critical_page[ 'id' ]} |
|
455 | + isset($critical_page['post']->ID) |
|
456 | + && $critical_page['post']->ID !== $EE_Core_Config->{$critical_page['id']} |
|
457 | 457 | ) { |
458 | 458 | //update Config with post ID |
459 | - $EE_Core_Config->{$critical_page[ 'id' ]} = $critical_page['post']->ID; |
|
460 | - if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE ) ) { |
|
461 | - $msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' ); |
|
462 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
459 | + $EE_Core_Config->{$critical_page['id']} = $critical_page['post']->ID; |
|
460 | + if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) { |
|
461 | + $msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso'); |
|
462 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
463 | 463 | } |
464 | 464 | } |
465 | 465 | |
466 | 466 | $critical_page_problem = |
467 | - ! isset( $critical_page['post']->post_status ) |
|
467 | + ! isset($critical_page['post']->post_status) |
|
468 | 468 | || $critical_page['post']->post_status !== 'publish' |
469 | - || strpos( $critical_page['post']->post_content, $critical_page['code'] ) === FALSE |
|
469 | + || strpos($critical_page['post']->post_content, $critical_page['code']) === FALSE |
|
470 | 470 | ? TRUE |
471 | 471 | : $critical_page_problem; |
472 | 472 | |
473 | 473 | } |
474 | 474 | |
475 | - if ( $critical_page_problem ) { |
|
475 | + if ($critical_page_problem) { |
|
476 | 476 | $msg = sprintf( |
477 | - __('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso' ), |
|
478 | - '<a href="' . admin_url('admin.php?page=espresso_general_settings&action=critical_pages') . '">' . __('Event Espresso Critical Pages Settings', 'event_espresso') . '</a>' |
|
477 | + __('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso'), |
|
478 | + '<a href="'.admin_url('admin.php?page=espresso_general_settings&action=critical_pages').'">'.__('Event Espresso Critical Pages Settings', 'event_espresso').'</a>' |
|
479 | 479 | ); |
480 | - EE_Error::add_persistent_admin_notice( 'critical_page_problem', $msg ); |
|
480 | + EE_Error::add_persistent_admin_notice('critical_page_problem', $msg); |
|
481 | 481 | } |
482 | - if ( EE_Error::has_notices() ) { |
|
483 | - EE_Error::get_notices( FALSE, TRUE, TRUE ); |
|
482 | + if (EE_Error::has_notices()) { |
|
483 | + EE_Error::get_notices(FALSE, TRUE, TRUE); |
|
484 | 484 | } |
485 | 485 | } |
486 | 486 | |
@@ -492,13 +492,13 @@ discard block |
||
492 | 492 | * parameter to the shortcode |
493 | 493 | * @return WP_Post or NULl |
494 | 494 | */ |
495 | - public static function get_page_by_ee_shortcode($ee_shortcode){ |
|
495 | + public static function get_page_by_ee_shortcode($ee_shortcode) { |
|
496 | 496 | global $wpdb; |
497 | 497 | $shortcode_and_opening_bracket = '['.$ee_shortcode; |
498 | 498 | $post_id = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_content LIKE '%$shortcode_and_opening_bracket%' LIMIT 1"); |
499 | - if($post_id){ |
|
499 | + if ($post_id) { |
|
500 | 500 | return get_post($post_id); |
501 | - }else{ |
|
501 | + } else { |
|
502 | 502 | return NULL; |
503 | 503 | } |
504 | 504 | |
@@ -515,32 +515,32 @@ discard block |
||
515 | 515 | * @param array $critical_page |
516 | 516 | * @return array |
517 | 517 | */ |
518 | - public static function create_critical_page( $critical_page ) { |
|
518 | + public static function create_critical_page($critical_page) { |
|
519 | 519 | |
520 | 520 | $post_args = array( |
521 | 521 | 'post_title' => $critical_page['name'], |
522 | 522 | 'post_status' => 'publish', |
523 | 523 | 'post_type' => 'page', |
524 | 524 | 'comment_status' => 'closed', |
525 | - 'post_content' => '[' . $critical_page['code'] . ']' |
|
525 | + 'post_content' => '['.$critical_page['code'].']' |
|
526 | 526 | ); |
527 | 527 | |
528 | - $post_id = wp_insert_post( $post_args ); |
|
529 | - if ( ! $post_id ) { |
|
528 | + $post_id = wp_insert_post($post_args); |
|
529 | + if ( ! $post_id) { |
|
530 | 530 | $msg = sprintf( |
531 | - __( 'The Event Espresso critical page entitled "%s" could not be created.', 'event_espresso' ), |
|
531 | + __('The Event Espresso critical page entitled "%s" could not be created.', 'event_espresso'), |
|
532 | 532 | $critical_page['name'] |
533 | 533 | ); |
534 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
534 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
535 | 535 | return $critical_page; |
536 | 536 | } |
537 | 537 | // get newly created post's details |
538 | - if ( ! $critical_page['post'] = get_post( $post_id )) { |
|
538 | + if ( ! $critical_page['post'] = get_post($post_id)) { |
|
539 | 539 | $msg = sprintf( |
540 | - __( 'The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso' ), |
|
540 | + __('The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso'), |
|
541 | 541 | $critical_page['name'] |
542 | 542 | ); |
543 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
543 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
544 | 544 | } |
545 | 545 | |
546 | 546 | return $critical_page; |
@@ -559,35 +559,35 @@ discard block |
||
559 | 559 | * @param array $critical_page |
560 | 560 | * @return void |
561 | 561 | */ |
562 | - private static function _track_critical_page_post_shortcodes( $critical_page = array() ) { |
|
562 | + private static function _track_critical_page_post_shortcodes($critical_page = array()) { |
|
563 | 563 | // check the goods |
564 | - if ( ! $critical_page['post'] instanceof WP_Post ) { |
|
564 | + if ( ! $critical_page['post'] instanceof WP_Post) { |
|
565 | 565 | $msg = sprintf( |
566 | - __( 'The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso' ), |
|
566 | + __('The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso'), |
|
567 | 567 | $critical_page['name'] |
568 | 568 | ); |
569 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
569 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
570 | 570 | return; |
571 | 571 | } |
572 | 572 | $EE_Core_Config = EE_Registry::instance()->CFG->core; |
573 | 573 | // map shortcode to post |
574 | - $EE_Core_Config->post_shortcodes[ $critical_page['post']->post_name ][ $critical_page['code'] ] = $critical_page['post']->ID; |
|
574 | + $EE_Core_Config->post_shortcodes[$critical_page['post']->post_name][$critical_page['code']] = $critical_page['post']->ID; |
|
575 | 575 | // and make sure it's NOT added to the WP "Posts Page" |
576 | 576 | // name of the WP Posts Page |
577 | 577 | $posts_page = EE_Config::get_page_for_posts(); |
578 | - if ( isset( $EE_Core_Config->post_shortcodes[ $posts_page ] )) { |
|
579 | - unset( $EE_Core_Config->post_shortcodes[ $posts_page ][ $critical_page['code'] ] ); |
|
578 | + if (isset($EE_Core_Config->post_shortcodes[$posts_page])) { |
|
579 | + unset($EE_Core_Config->post_shortcodes[$posts_page][$critical_page['code']]); |
|
580 | 580 | } |
581 | - if ( $posts_page !== 'posts' && isset( $EE_Core_Config->post_shortcodes['posts'] )) { |
|
582 | - unset( $EE_Core_Config->post_shortcodes['posts'][ $critical_page['code'] ] ); |
|
581 | + if ($posts_page !== 'posts' && isset($EE_Core_Config->post_shortcodes['posts'])) { |
|
582 | + unset($EE_Core_Config->post_shortcodes['posts'][$critical_page['code']]); |
|
583 | 583 | } |
584 | 584 | // update post_shortcode CFG |
585 | - if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE )) { |
|
585 | + if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) { |
|
586 | 586 | $msg = sprintf( |
587 | - __( 'The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso' ), |
|
587 | + __('The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso'), |
|
588 | 588 | $critical_page['name'] |
589 | 589 | ); |
590 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
590 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
591 | 591 | } |
592 | 592 | } |
593 | 593 | |
@@ -605,24 +605,24 @@ discard block |
||
605 | 605 | public static function get_default_creator_id() { |
606 | 606 | global $wpdb; |
607 | 607 | |
608 | - if ( ! empty( self::$_default_creator_id ) ) { |
|
608 | + if ( ! empty(self::$_default_creator_id)) { |
|
609 | 609 | return self::$_default_creator_id; |
610 | 610 | }/**/ |
611 | 611 | |
612 | - $role_to_check = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator' ); |
|
612 | + $role_to_check = apply_filters('FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator'); |
|
613 | 613 | |
614 | 614 | //let's allow pre_filtering for early exits by alternative methods for getting id. We check for truthy result and if so then exit early. |
615 | - $pre_filtered_id = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check ); |
|
616 | - if ( $pre_filtered_id !== false ) { |
|
615 | + $pre_filtered_id = apply_filters('FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check); |
|
616 | + if ($pre_filtered_id !== false) { |
|
617 | 617 | return (int) $pre_filtered_id; |
618 | 618 | } |
619 | 619 | |
620 | - $capabilities_key = \EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix( 'capabilities' ); |
|
621 | - $query = $wpdb->prepare( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%' . $role_to_check . '%' ); |
|
622 | - $user_id = $wpdb->get_var( $query ); |
|
623 | - $user_id = apply_filters( 'FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id ); |
|
624 | - if ( $user_id && (int)$user_id ) { |
|
625 | - self::$_default_creator_id = (int)$user_id; |
|
620 | + $capabilities_key = \EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix('capabilities'); |
|
621 | + $query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%'.$role_to_check.'%'); |
|
622 | + $user_id = $wpdb->get_var($query); |
|
623 | + $user_id = apply_filters('FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id); |
|
624 | + if ($user_id && (int) $user_id) { |
|
625 | + self::$_default_creator_id = (int) $user_id; |
|
626 | 626 | return self::$_default_creator_id; |
627 | 627 | } else { |
628 | 628 | return NULL; |
@@ -651,28 +651,28 @@ discard block |
||
651 | 651 | * @return void |
652 | 652 | * @throws EE_Error if there are database errors |
653 | 653 | */ |
654 | - public static function create_table( $table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_pre_existing_table = false ) { |
|
655 | - if( apply_filters( 'FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql ) ){ |
|
654 | + public static function create_table($table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_pre_existing_table = false) { |
|
655 | + if (apply_filters('FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql)) { |
|
656 | 656 | return; |
657 | 657 | } |
658 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
659 | - if ( ! function_exists( 'dbDelta' )) { |
|
660 | - require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
658 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
659 | + if ( ! function_exists('dbDelta')) { |
|
660 | + require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
|
661 | 661 | } |
662 | 662 | $tableAnalysis = \EEH_Activation::getTableAnalysis(); |
663 | - $wp_table_name = $tableAnalysis->ensureTableNameHasPrefix( $table_name ); |
|
663 | + $wp_table_name = $tableAnalysis->ensureTableNameHasPrefix($table_name); |
|
664 | 664 | // do we need to first delete an existing version of this table ? |
665 | - if ( $drop_pre_existing_table && $tableAnalysis->tableExists( $wp_table_name ) ){ |
|
665 | + if ($drop_pre_existing_table && $tableAnalysis->tableExists($wp_table_name)) { |
|
666 | 666 | // ok, delete the table... but ONLY if it's empty |
667 | - $deleted_safely = EEH_Activation::delete_db_table_if_empty( $wp_table_name ); |
|
667 | + $deleted_safely = EEH_Activation::delete_db_table_if_empty($wp_table_name); |
|
668 | 668 | // table is NOT empty, are you SURE you want to delete this table ??? |
669 | - if ( ! $deleted_safely && defined( 'EE_DROP_BAD_TABLES' ) && EE_DROP_BAD_TABLES ){ |
|
670 | - \EEH_Activation::getTableManager()->dropTable( $wp_table_name ); |
|
671 | - } else if ( ! $deleted_safely ) { |
|
669 | + if ( ! $deleted_safely && defined('EE_DROP_BAD_TABLES') && EE_DROP_BAD_TABLES) { |
|
670 | + \EEH_Activation::getTableManager()->dropTable($wp_table_name); |
|
671 | + } else if ( ! $deleted_safely) { |
|
672 | 672 | // so we should be more cautious rather than just dropping tables so easily |
673 | 673 | EE_Error::add_persistent_admin_notice( |
674 | - 'bad_table_' . $wp_table_name . '_detected', |
|
675 | - sprintf( __( 'Database table %1$s exists when it shouldn\'t, and may contain erroneous data. If you have previously restored your database from a backup that didn\'t remove the old tables, then we recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso' ), |
|
674 | + 'bad_table_'.$wp_table_name.'_detected', |
|
675 | + sprintf(__('Database table %1$s exists when it shouldn\'t, and may contain erroneous data. If you have previously restored your database from a backup that didn\'t remove the old tables, then we recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso'), |
|
676 | 676 | $wp_table_name, |
677 | 677 | "<pre>define( 'EE_DROP_BAD_TABLES', TRUE );</pre>", |
678 | 678 | '<b>wp-config.php</b>', |
@@ -680,8 +680,8 @@ discard block |
||
680 | 680 | TRUE ); |
681 | 681 | } |
682 | 682 | } |
683 | - $engine = str_replace( 'ENGINE=', '', $engine ); |
|
684 | - \EEH_Activation::getTableManager()->createTable( $table_name, $sql, $engine ); |
|
683 | + $engine = str_replace('ENGINE=', '', $engine); |
|
684 | + \EEH_Activation::getTableManager()->createTable($table_name, $sql, $engine); |
|
685 | 685 | } |
686 | 686 | |
687 | 687 | |
@@ -699,8 +699,8 @@ discard block |
||
699 | 699 | * 'VARCHAR(10)' |
700 | 700 | * @return bool|int |
701 | 701 | */ |
702 | - public static function add_column_if_it_doesnt_exist($table_name,$column_name,$column_info='INT UNSIGNED NOT NULL'){ |
|
703 | - return \EEH_Activation::getTableManager()->addColumn( $table_name, $column_name, $column_info ); |
|
702 | + public static function add_column_if_it_doesnt_exist($table_name, $column_name, $column_info = 'INT UNSIGNED NOT NULL') { |
|
703 | + return \EEH_Activation::getTableManager()->addColumn($table_name, $column_name, $column_info); |
|
704 | 704 | } |
705 | 705 | |
706 | 706 | |
@@ -716,8 +716,8 @@ discard block |
||
716 | 716 | * @param string $table_name, without prefixed $wpdb->prefix |
717 | 717 | * @return array of database column names |
718 | 718 | */ |
719 | - public static function get_fields_on_table( $table_name = NULL ) { |
|
720 | - return \EEH_Activation::getTableManager()->getTableColumns( $table_name ); |
|
719 | + public static function get_fields_on_table($table_name = NULL) { |
|
720 | + return \EEH_Activation::getTableManager()->getTableColumns($table_name); |
|
721 | 721 | } |
722 | 722 | |
723 | 723 | |
@@ -731,8 +731,8 @@ discard block |
||
731 | 731 | * @param string $table_name |
732 | 732 | * @return bool |
733 | 733 | */ |
734 | - public static function db_table_is_empty( $table_name ) { |
|
735 | - return \EEH_Activation::getTableAnalysis()->tableIsEmpty( $table_name ); |
|
734 | + public static function db_table_is_empty($table_name) { |
|
735 | + return \EEH_Activation::getTableAnalysis()->tableIsEmpty($table_name); |
|
736 | 736 | } |
737 | 737 | |
738 | 738 | |
@@ -745,9 +745,9 @@ discard block |
||
745 | 745 | * @param string $table_name |
746 | 746 | * @return bool | int |
747 | 747 | */ |
748 | - public static function delete_db_table_if_empty( $table_name ) { |
|
749 | - if ( \EEH_Activation::getTableAnalysis()->tableIsEmpty( $table_name ) ) { |
|
750 | - return \EEH_Activation::getTableManager()->dropTable( $table_name ); |
|
748 | + public static function delete_db_table_if_empty($table_name) { |
|
749 | + if (\EEH_Activation::getTableAnalysis()->tableIsEmpty($table_name)) { |
|
750 | + return \EEH_Activation::getTableManager()->dropTable($table_name); |
|
751 | 751 | } |
752 | 752 | return false; |
753 | 753 | } |
@@ -763,8 +763,8 @@ discard block |
||
763 | 763 | * @param string $table_name |
764 | 764 | * @return bool | int |
765 | 765 | */ |
766 | - public static function delete_unused_db_table( $table_name ) { |
|
767 | - return \EEH_Activation::getTableManager()->dropTable( $table_name ); |
|
766 | + public static function delete_unused_db_table($table_name) { |
|
767 | + return \EEH_Activation::getTableManager()->dropTable($table_name); |
|
768 | 768 | } |
769 | 769 | |
770 | 770 | |
@@ -779,8 +779,8 @@ discard block |
||
779 | 779 | * @param string $index_name |
780 | 780 | * @return bool | int |
781 | 781 | */ |
782 | - public static function drop_index( $table_name, $index_name ) { |
|
783 | - return \EEH_Activation::getTableManager()->dropIndex( $table_name, $index_name ); |
|
782 | + public static function drop_index($table_name, $index_name) { |
|
783 | + return \EEH_Activation::getTableManager()->dropIndex($table_name, $index_name); |
|
784 | 784 | } |
785 | 785 | |
786 | 786 | |
@@ -794,27 +794,27 @@ discard block |
||
794 | 794 | * @return boolean success (whether database is setup properly or not) |
795 | 795 | */ |
796 | 796 | public static function create_database_tables() { |
797 | - EE_Registry::instance()->load_core( 'Data_Migration_Manager' ); |
|
797 | + EE_Registry::instance()->load_core('Data_Migration_Manager'); |
|
798 | 798 | //find the migration script that sets the database to be compatible with the code |
799 | 799 | $dms_name = EE_Data_Migration_Manager::instance()->get_most_up_to_date_dms(); |
800 | - if( $dms_name ){ |
|
801 | - $current_data_migration_script = EE_Registry::instance()->load_dms( $dms_name ); |
|
802 | - $current_data_migration_script->set_migrating( false ); |
|
800 | + if ($dms_name) { |
|
801 | + $current_data_migration_script = EE_Registry::instance()->load_dms($dms_name); |
|
802 | + $current_data_migration_script->set_migrating(false); |
|
803 | 803 | $current_data_migration_script->schema_changes_before_migration(); |
804 | 804 | $current_data_migration_script->schema_changes_after_migration(); |
805 | - if( $current_data_migration_script->get_errors() ){ |
|
806 | - if( WP_DEBUG ){ |
|
807 | - foreach( $current_data_migration_script->get_errors() as $error ){ |
|
808 | - EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__ ); |
|
805 | + if ($current_data_migration_script->get_errors()) { |
|
806 | + if (WP_DEBUG) { |
|
807 | + foreach ($current_data_migration_script->get_errors() as $error) { |
|
808 | + EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__); |
|
809 | 809 | } |
810 | - }else{ |
|
811 | - EE_Error::add_error( __( 'There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso' ) ); |
|
810 | + } else { |
|
811 | + EE_Error::add_error(__('There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso')); |
|
812 | 812 | } |
813 | 813 | return false; |
814 | 814 | } |
815 | 815 | EE_Data_Migration_Manager::instance()->update_current_database_state_to(); |
816 | - }else{ |
|
817 | - EE_Error::add_error( __( 'Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
816 | + } else { |
|
817 | + EE_Error::add_error(__('Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
818 | 818 | return false; |
819 | 819 | } |
820 | 820 | return true; |
@@ -834,27 +834,27 @@ discard block |
||
834 | 834 | public static function initialize_system_questions() { |
835 | 835 | // QUESTION GROUPS |
836 | 836 | global $wpdb; |
837 | - $table_name = \EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix( 'esp_question_group' ); |
|
837 | + $table_name = \EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix('esp_question_group'); |
|
838 | 838 | $SQL = "SELECT QSG_system FROM $table_name WHERE QSG_system != 0"; |
839 | 839 | // what we have |
840 | - $question_groups = $wpdb->get_col( $SQL ); |
|
840 | + $question_groups = $wpdb->get_col($SQL); |
|
841 | 841 | // check the response |
842 | - $question_groups = is_array( $question_groups ) ? $question_groups : array(); |
|
842 | + $question_groups = is_array($question_groups) ? $question_groups : array(); |
|
843 | 843 | // what we should have |
844 | - $QSG_systems = array( 1, 2 ); |
|
844 | + $QSG_systems = array(1, 2); |
|
845 | 845 | // loop thru what we should have and compare to what we have |
846 | - foreach ( $QSG_systems as $QSG_system ) { |
|
846 | + foreach ($QSG_systems as $QSG_system) { |
|
847 | 847 | // reset values array |
848 | 848 | $QSG_values = array(); |
849 | 849 | // if we don't have what we should have (but use $QST_system as as string because that's what we got from the db) |
850 | - if ( ! in_array( "$QSG_system", $question_groups )) { |
|
850 | + if ( ! in_array("$QSG_system", $question_groups)) { |
|
851 | 851 | // add it |
852 | - switch ( $QSG_system ) { |
|
852 | + switch ($QSG_system) { |
|
853 | 853 | |
854 | 854 | case 1: |
855 | 855 | $QSG_values = array( |
856 | - 'QSG_name' => __( 'Personal Information', 'event_espresso' ), |
|
857 | - 'QSG_identifier' => 'personal-information-' . time(), |
|
856 | + 'QSG_name' => __('Personal Information', 'event_espresso'), |
|
857 | + 'QSG_identifier' => 'personal-information-'.time(), |
|
858 | 858 | 'QSG_desc' => '', |
859 | 859 | 'QSG_order' => 1, |
860 | 860 | 'QSG_show_group_name' => 1, |
@@ -866,8 +866,8 @@ discard block |
||
866 | 866 | |
867 | 867 | case 2: |
868 | 868 | $QSG_values = array( |
869 | - 'QSG_name' => __( 'Address Information','event_espresso' ), |
|
870 | - 'QSG_identifier' => 'address-information-' . time(), |
|
869 | + 'QSG_name' => __('Address Information', 'event_espresso'), |
|
870 | + 'QSG_identifier' => 'address-information-'.time(), |
|
871 | 871 | 'QSG_desc' => '', |
872 | 872 | 'QSG_order' => 2, |
873 | 873 | 'QSG_show_group_name' => 1, |
@@ -879,14 +879,14 @@ discard block |
||
879 | 879 | |
880 | 880 | } |
881 | 881 | // make sure we have some values before inserting them |
882 | - if ( ! empty( $QSG_values )) { |
|
882 | + if ( ! empty($QSG_values)) { |
|
883 | 883 | // insert system question |
884 | 884 | $wpdb->insert( |
885 | 885 | $table_name, |
886 | 886 | $QSG_values, |
887 | - array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d' ) |
|
887 | + array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d') |
|
888 | 888 | ); |
889 | - $QSG_IDs[ $QSG_system ] = $wpdb->insert_id; |
|
889 | + $QSG_IDs[$QSG_system] = $wpdb->insert_id; |
|
890 | 890 | } |
891 | 891 | } |
892 | 892 | } |
@@ -895,10 +895,10 @@ discard block |
||
895 | 895 | |
896 | 896 | // QUESTIONS |
897 | 897 | global $wpdb; |
898 | - $table_name = \EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix( 'esp_question' ); |
|
898 | + $table_name = \EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix('esp_question'); |
|
899 | 899 | $SQL = "SELECT QST_system FROM $table_name WHERE QST_system != ''"; |
900 | 900 | // what we have |
901 | - $questions = $wpdb->get_col( $SQL ); |
|
901 | + $questions = $wpdb->get_col($SQL); |
|
902 | 902 | // what we should have |
903 | 903 | $QST_systems = array( |
904 | 904 | 'fname', |
@@ -915,25 +915,25 @@ discard block |
||
915 | 915 | $order_for_group_1 = 1; |
916 | 916 | $order_for_group_2 = 1; |
917 | 917 | // loop thru what we should have and compare to what we have |
918 | - foreach ( $QST_systems as $QST_system ) { |
|
918 | + foreach ($QST_systems as $QST_system) { |
|
919 | 919 | // reset values array |
920 | 920 | $QST_values = array(); |
921 | 921 | // if we don't have what we should have |
922 | - if ( ! in_array( $QST_system, $questions )) { |
|
922 | + if ( ! in_array($QST_system, $questions)) { |
|
923 | 923 | // add it |
924 | - switch ( $QST_system ) { |
|
924 | + switch ($QST_system) { |
|
925 | 925 | |
926 | 926 | case 'fname': |
927 | 927 | $QST_values = array( |
928 | - 'QST_display_text' => __( 'First Name', 'event_espresso' ), |
|
929 | - 'QST_admin_label' => __( 'First Name - System Question', 'event_espresso' ), |
|
928 | + 'QST_display_text' => __('First Name', 'event_espresso'), |
|
929 | + 'QST_admin_label' => __('First Name - System Question', 'event_espresso'), |
|
930 | 930 | 'QST_system' => 'fname', |
931 | 931 | 'QST_type' => 'TEXT', |
932 | 932 | 'QST_required' => 1, |
933 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
933 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
934 | 934 | 'QST_order' => 1, |
935 | 935 | 'QST_admin_only' => 0, |
936 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
936 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
937 | 937 | 'QST_wp_user' => self::get_default_creator_id(), |
938 | 938 | 'QST_deleted' => 0 |
939 | 939 | ); |
@@ -941,15 +941,15 @@ discard block |
||
941 | 941 | |
942 | 942 | case 'lname': |
943 | 943 | $QST_values = array( |
944 | - 'QST_display_text' => __( 'Last Name', 'event_espresso' ), |
|
945 | - 'QST_admin_label' => __( 'Last Name - System Question', 'event_espresso' ), |
|
944 | + 'QST_display_text' => __('Last Name', 'event_espresso'), |
|
945 | + 'QST_admin_label' => __('Last Name - System Question', 'event_espresso'), |
|
946 | 946 | 'QST_system' => 'lname', |
947 | 947 | 'QST_type' => 'TEXT', |
948 | 948 | 'QST_required' => 1, |
949 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
949 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
950 | 950 | 'QST_order' => 2, |
951 | 951 | 'QST_admin_only' => 0, |
952 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
952 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
953 | 953 | 'QST_wp_user' => self::get_default_creator_id(), |
954 | 954 | 'QST_deleted' => 0 |
955 | 955 | ); |
@@ -957,15 +957,15 @@ discard block |
||
957 | 957 | |
958 | 958 | case 'email': |
959 | 959 | $QST_values = array( |
960 | - 'QST_display_text' => __( 'Email Address', 'event_espresso' ), |
|
961 | - 'QST_admin_label' => __( 'Email Address - System Question', 'event_espresso' ), |
|
960 | + 'QST_display_text' => __('Email Address', 'event_espresso'), |
|
961 | + 'QST_admin_label' => __('Email Address - System Question', 'event_espresso'), |
|
962 | 962 | 'QST_system' => 'email', |
963 | 963 | 'QST_type' => 'EMAIL', |
964 | 964 | 'QST_required' => 1, |
965 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
965 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
966 | 966 | 'QST_order' => 3, |
967 | 967 | 'QST_admin_only' => 0, |
968 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
968 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
969 | 969 | 'QST_wp_user' => self::get_default_creator_id(), |
970 | 970 | 'QST_deleted' => 0 |
971 | 971 | ); |
@@ -973,15 +973,15 @@ discard block |
||
973 | 973 | |
974 | 974 | case 'address': |
975 | 975 | $QST_values = array( |
976 | - 'QST_display_text' => __( 'Address', 'event_espresso' ), |
|
977 | - 'QST_admin_label' => __( 'Address - System Question', 'event_espresso' ), |
|
976 | + 'QST_display_text' => __('Address', 'event_espresso'), |
|
977 | + 'QST_admin_label' => __('Address - System Question', 'event_espresso'), |
|
978 | 978 | 'QST_system' => 'address', |
979 | 979 | 'QST_type' => 'TEXT', |
980 | 980 | 'QST_required' => 0, |
981 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
981 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
982 | 982 | 'QST_order' => 4, |
983 | 983 | 'QST_admin_only' => 0, |
984 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
984 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
985 | 985 | 'QST_wp_user' => self::get_default_creator_id(), |
986 | 986 | 'QST_deleted' => 0 |
987 | 987 | ); |
@@ -989,15 +989,15 @@ discard block |
||
989 | 989 | |
990 | 990 | case 'address2': |
991 | 991 | $QST_values = array( |
992 | - 'QST_display_text' => __( 'Address2', 'event_espresso' ), |
|
993 | - 'QST_admin_label' => __( 'Address2 - System Question', 'event_espresso' ), |
|
992 | + 'QST_display_text' => __('Address2', 'event_espresso'), |
|
993 | + 'QST_admin_label' => __('Address2 - System Question', 'event_espresso'), |
|
994 | 994 | 'QST_system' => 'address2', |
995 | 995 | 'QST_type' => 'TEXT', |
996 | 996 | 'QST_required' => 0, |
997 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
997 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
998 | 998 | 'QST_order' => 5, |
999 | 999 | 'QST_admin_only' => 0, |
1000 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
1000 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
1001 | 1001 | 'QST_wp_user' => self::get_default_creator_id(), |
1002 | 1002 | 'QST_deleted' => 0 |
1003 | 1003 | ); |
@@ -1005,27 +1005,27 @@ discard block |
||
1005 | 1005 | |
1006 | 1006 | case 'city': |
1007 | 1007 | $QST_values = array( |
1008 | - 'QST_display_text' => __( 'City', 'event_espresso' ), |
|
1009 | - 'QST_admin_label' => __( 'City - System Question', 'event_espresso' ), |
|
1008 | + 'QST_display_text' => __('City', 'event_espresso'), |
|
1009 | + 'QST_admin_label' => __('City - System Question', 'event_espresso'), |
|
1010 | 1010 | 'QST_system' => 'city', |
1011 | 1011 | 'QST_type' => 'TEXT', |
1012 | 1012 | 'QST_required' => 0, |
1013 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1013 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1014 | 1014 | 'QST_order' => 6, |
1015 | 1015 | 'QST_admin_only' => 0, |
1016 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
1016 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
1017 | 1017 | 'QST_wp_user' => self::get_default_creator_id(), |
1018 | 1018 | 'QST_deleted' => 0 |
1019 | 1019 | ); |
1020 | 1020 | break; |
1021 | 1021 | case 'country' : |
1022 | 1022 | $QST_values = array( |
1023 | - 'QST_display_text' => __( 'Country', 'event_espresso' ), |
|
1024 | - 'QST_admin_label' => __( 'Country - System Question', 'event_espresso' ), |
|
1023 | + 'QST_display_text' => __('Country', 'event_espresso'), |
|
1024 | + 'QST_admin_label' => __('Country - System Question', 'event_espresso'), |
|
1025 | 1025 | 'QST_system' => 'country', |
1026 | 1026 | 'QST_type' => 'COUNTRY', |
1027 | 1027 | 'QST_required' => 0, |
1028 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1028 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1029 | 1029 | 'QST_order' => 7, |
1030 | 1030 | 'QST_admin_only' => 0, |
1031 | 1031 | 'QST_wp_user' => self::get_default_creator_id(), |
@@ -1035,12 +1035,12 @@ discard block |
||
1035 | 1035 | |
1036 | 1036 | case 'state': |
1037 | 1037 | $QST_values = array( |
1038 | - 'QST_display_text' => __( 'State/Province', 'event_espresso' ), |
|
1039 | - 'QST_admin_label' => __( 'State/Province - System Question', 'event_espresso' ), |
|
1038 | + 'QST_display_text' => __('State/Province', 'event_espresso'), |
|
1039 | + 'QST_admin_label' => __('State/Province - System Question', 'event_espresso'), |
|
1040 | 1040 | 'QST_system' => 'state', |
1041 | 1041 | 'QST_type' => 'STATE', |
1042 | 1042 | 'QST_required' => 0, |
1043 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1043 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1044 | 1044 | 'QST_order' => 8, |
1045 | 1045 | 'QST_admin_only' => 0, |
1046 | 1046 | 'QST_wp_user' => self::get_default_creator_id(), |
@@ -1050,15 +1050,15 @@ discard block |
||
1050 | 1050 | |
1051 | 1051 | case 'zip': |
1052 | 1052 | $QST_values = array( |
1053 | - 'QST_display_text' => __( 'Zip/Postal Code', 'event_espresso' ), |
|
1054 | - 'QST_admin_label' => __( 'Zip/Postal Code - System Question', 'event_espresso' ), |
|
1053 | + 'QST_display_text' => __('Zip/Postal Code', 'event_espresso'), |
|
1054 | + 'QST_admin_label' => __('Zip/Postal Code - System Question', 'event_espresso'), |
|
1055 | 1055 | 'QST_system' => 'zip', |
1056 | 1056 | 'QST_type' => 'TEXT', |
1057 | 1057 | 'QST_required' => 0, |
1058 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1058 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1059 | 1059 | 'QST_order' => 9, |
1060 | 1060 | 'QST_admin_only' => 0, |
1061 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
1061 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
1062 | 1062 | 'QST_wp_user' => self::get_default_creator_id(), |
1063 | 1063 | 'QST_deleted' => 0 |
1064 | 1064 | ); |
@@ -1066,49 +1066,49 @@ discard block |
||
1066 | 1066 | |
1067 | 1067 | case 'phone': |
1068 | 1068 | $QST_values = array( |
1069 | - 'QST_display_text' => __( 'Phone Number', 'event_espresso' ), |
|
1070 | - 'QST_admin_label' => __( 'Phone Number - System Question', 'event_espresso' ), |
|
1069 | + 'QST_display_text' => __('Phone Number', 'event_espresso'), |
|
1070 | + 'QST_admin_label' => __('Phone Number - System Question', 'event_espresso'), |
|
1071 | 1071 | 'QST_system' => 'phone', |
1072 | 1072 | 'QST_type' => 'TEXT', |
1073 | 1073 | 'QST_required' => 0, |
1074 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1074 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1075 | 1075 | 'QST_order' => 10, |
1076 | 1076 | 'QST_admin_only' => 0, |
1077 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
1077 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
1078 | 1078 | 'QST_wp_user' => self::get_default_creator_id(), |
1079 | 1079 | 'QST_deleted' => 0 |
1080 | 1080 | ); |
1081 | 1081 | break; |
1082 | 1082 | |
1083 | 1083 | } |
1084 | - if ( ! empty( $QST_values )) { |
|
1084 | + if ( ! empty($QST_values)) { |
|
1085 | 1085 | // insert system question |
1086 | 1086 | $wpdb->insert( |
1087 | 1087 | $table_name, |
1088 | 1088 | $QST_values, |
1089 | - array( '%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d' ) |
|
1089 | + array('%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d') |
|
1090 | 1090 | ); |
1091 | 1091 | $QST_ID = $wpdb->insert_id; |
1092 | 1092 | |
1093 | 1093 | // QUESTION GROUP QUESTIONS |
1094 | - if( in_array( $QST_system, array( 'fname', 'lname', 'email' ) ) ) { |
|
1094 | + if (in_array($QST_system, array('fname', 'lname', 'email'))) { |
|
1095 | 1095 | $system_question_we_want = EEM_Question_Group::system_personal; |
1096 | 1096 | } else { |
1097 | 1097 | $system_question_we_want = EEM_Question_Group::system_address; |
1098 | 1098 | } |
1099 | - if( isset( $QSG_IDs[ $system_question_we_want ] ) ) { |
|
1100 | - $QSG_ID = $QSG_IDs[ $system_question_we_want ]; |
|
1099 | + if (isset($QSG_IDs[$system_question_we_want])) { |
|
1100 | + $QSG_ID = $QSG_IDs[$system_question_we_want]; |
|
1101 | 1101 | } else { |
1102 | - $id_col = EEM_Question_Group::instance()->get_col( array( array( 'QSG_system' => $system_question_we_want ) ) ); |
|
1103 | - if( is_array( $id_col ) ) { |
|
1104 | - $QSG_ID = reset( $id_col ); |
|
1102 | + $id_col = EEM_Question_Group::instance()->get_col(array(array('QSG_system' => $system_question_we_want))); |
|
1103 | + if (is_array($id_col)) { |
|
1104 | + $QSG_ID = reset($id_col); |
|
1105 | 1105 | } else { |
1106 | 1106 | //ok so we didn't find it in the db either?? that's weird because we should have inserted it at the start of this method |
1107 | 1107 | EE_Log::instance()->log( |
1108 | 1108 | __FILE__, |
1109 | 1109 | __FUNCTION__, |
1110 | 1110 | sprintf( |
1111 | - __( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), |
|
1111 | + __('Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), |
|
1112 | 1112 | $QST_ID ), |
1113 | 1113 | 'error' ); |
1114 | 1114 | continue; |
@@ -1117,12 +1117,12 @@ discard block |
||
1117 | 1117 | |
1118 | 1118 | // add system questions to groups |
1119 | 1119 | $wpdb->insert( |
1120 | - \EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix( 'esp_question_group_question' ), |
|
1121 | - array( 'QSG_ID' => $QSG_ID, |
|
1120 | + \EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix('esp_question_group_question'), |
|
1121 | + array('QSG_ID' => $QSG_ID, |
|
1122 | 1122 | 'QST_ID' => $QST_ID, |
1123 | - 'QGQ_order' => ( $QSG_ID === 1 ) ? $order_for_group_1++ : $order_for_group_2++ |
|
1123 | + 'QGQ_order' => ($QSG_ID === 1) ? $order_for_group_1++ : $order_for_group_2++ |
|
1124 | 1124 | ), |
1125 | - array( '%d', '%d', '%d' ) |
|
1125 | + array('%d', '%d', '%d') |
|
1126 | 1126 | ); |
1127 | 1127 | } |
1128 | 1128 | } |
@@ -1138,11 +1138,11 @@ discard block |
||
1138 | 1138 | * |
1139 | 1139 | * @throws \EE_Error |
1140 | 1140 | */ |
1141 | - public static function insert_default_payment_methods(){ |
|
1142 | - if( ! EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart ) ){ |
|
1143 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
1144 | - EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' ); |
|
1145 | - }else{ |
|
1141 | + public static function insert_default_payment_methods() { |
|
1142 | + if ( ! EEM_Payment_Method::instance()->count_active(EEM_Payment_Method::scope_cart)) { |
|
1143 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
1144 | + EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice'); |
|
1145 | + } else { |
|
1146 | 1146 | EEM_Payment_Method::instance()->verify_button_urls(); |
1147 | 1147 | } |
1148 | 1148 | } |
@@ -1158,7 +1158,7 @@ discard block |
||
1158 | 1158 | |
1159 | 1159 | global $wpdb; |
1160 | 1160 | |
1161 | - if ( \EEH_Activation::getTableAnalysis()->tableExists( EEM_Status::instance()->table() ) ) { |
|
1161 | + if (\EEH_Activation::getTableAnalysis()->tableExists(EEM_Status::instance()->table())) { |
|
1162 | 1162 | |
1163 | 1163 | $table_name = EEM_Status::instance()->table(); |
1164 | 1164 | |
@@ -1234,33 +1234,33 @@ discard block |
||
1234 | 1234 | $folders = array( |
1235 | 1235 | EVENT_ESPRESSO_TEMPLATE_DIR, |
1236 | 1236 | EVENT_ESPRESSO_GATEWAY_DIR, |
1237 | - EVENT_ESPRESSO_UPLOAD_DIR . 'logs/', |
|
1238 | - EVENT_ESPRESSO_UPLOAD_DIR . 'css/', |
|
1239 | - EVENT_ESPRESSO_UPLOAD_DIR . 'tickets/' |
|
1237 | + EVENT_ESPRESSO_UPLOAD_DIR.'logs/', |
|
1238 | + EVENT_ESPRESSO_UPLOAD_DIR.'css/', |
|
1239 | + EVENT_ESPRESSO_UPLOAD_DIR.'tickets/' |
|
1240 | 1240 | ); |
1241 | - foreach ( $folders as $folder ) { |
|
1241 | + foreach ($folders as $folder) { |
|
1242 | 1242 | try { |
1243 | - EEH_File::ensure_folder_exists_and_is_writable( $folder ); |
|
1244 | - @ chmod( $folder, 0755 ); |
|
1245 | - } catch( EE_Error $e ){ |
|
1243 | + EEH_File::ensure_folder_exists_and_is_writable($folder); |
|
1244 | + @ chmod($folder, 0755); |
|
1245 | + } catch (EE_Error $e) { |
|
1246 | 1246 | EE_Error::add_error( |
1247 | 1247 | sprintf( |
1248 | - __( 'Could not create the folder at "%1$s" because: %2$s', 'event_espresso' ), |
|
1248 | + __('Could not create the folder at "%1$s" because: %2$s', 'event_espresso'), |
|
1249 | 1249 | $folder, |
1250 | - '<br />' . $e->getMessage() |
|
1250 | + '<br />'.$e->getMessage() |
|
1251 | 1251 | ), |
1252 | 1252 | __FILE__, __FUNCTION__, __LINE__ |
1253 | 1253 | ); |
1254 | 1254 | //indicate we'll need to fix this later |
1255 | - update_option( EEH_Activation::upload_directories_incomplete_option_name, true ); |
|
1255 | + update_option(EEH_Activation::upload_directories_incomplete_option_name, true); |
|
1256 | 1256 | return FALSE; |
1257 | 1257 | } |
1258 | 1258 | } |
1259 | 1259 | //just add the .htaccess file to the logs directory to begin with. Even if logging |
1260 | 1260 | //is disabled, there might be activation errors recorded in there |
1261 | - EEH_File::add_htaccess_deny_from_all( EVENT_ESPRESSO_UPLOAD_DIR . 'logs/' ); |
|
1261 | + EEH_File::add_htaccess_deny_from_all(EVENT_ESPRESSO_UPLOAD_DIR.'logs/'); |
|
1262 | 1262 | //remember EE's folders are all good |
1263 | - delete_option( EEH_Activation::upload_directories_incomplete_option_name ); |
|
1263 | + delete_option(EEH_Activation::upload_directories_incomplete_option_name); |
|
1264 | 1264 | return TRUE; |
1265 | 1265 | } |
1266 | 1266 | |
@@ -1273,7 +1273,7 @@ discard block |
||
1273 | 1273 | * @return boolean |
1274 | 1274 | */ |
1275 | 1275 | public static function upload_directories_incomplete() { |
1276 | - return get_option( EEH_Activation::upload_directories_incomplete_option_name, false ); |
|
1276 | + return get_option(EEH_Activation::upload_directories_incomplete_option_name, false); |
|
1277 | 1277 | } |
1278 | 1278 | |
1279 | 1279 | |
@@ -1290,7 +1290,7 @@ discard block |
||
1290 | 1290 | */ |
1291 | 1291 | public static function generate_default_message_templates() { |
1292 | 1292 | /** @type EE_Message_Resource_Manager $message_resource_manager */ |
1293 | - $message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
1293 | + $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
1294 | 1294 | /* |
1295 | 1295 | * This first method is taking care of ensuring any default messengers |
1296 | 1296 | * that should be made active and have templates generated are done. |
@@ -1326,22 +1326,22 @@ discard block |
||
1326 | 1326 | $active_messengers = $message_resource_manager->active_messengers(); |
1327 | 1327 | $installed_message_types = $message_resource_manager->installed_message_types(); |
1328 | 1328 | $templates_created = false; |
1329 | - foreach ( $active_messengers as $active_messenger ) { |
|
1329 | + foreach ($active_messengers as $active_messenger) { |
|
1330 | 1330 | $default_message_type_names_for_messenger = $active_messenger->get_default_message_types(); |
1331 | 1331 | $default_message_type_names_to_activate = array(); |
1332 | 1332 | // looping through each default message type reported by the messenger |
1333 | 1333 | // and setup the actual message types to activate. |
1334 | - foreach ( $default_message_type_names_for_messenger as $default_message_type_name_for_messenger ) { |
|
1334 | + foreach ($default_message_type_names_for_messenger as $default_message_type_name_for_messenger) { |
|
1335 | 1335 | // if already active or has already been activated before we skip |
1336 | 1336 | // (otherwise we might reactivate something user's intentionally deactivated.) |
1337 | 1337 | // we also skip if the message type is not installed. |
1338 | 1338 | if ( |
1339 | - $message_resource_manager->has_message_type_been_activated_for_messenger( $default_message_type_name_for_messenger, $active_messenger->name ) |
|
1339 | + $message_resource_manager->has_message_type_been_activated_for_messenger($default_message_type_name_for_messenger, $active_messenger->name) |
|
1340 | 1340 | || $message_resource_manager->is_message_type_active_for_messenger( |
1341 | 1341 | $active_messenger->name, |
1342 | 1342 | $default_message_type_name_for_messenger |
1343 | 1343 | ) |
1344 | - || ! isset( $installed_message_types[ $default_message_type_name_for_messenger ] ) |
|
1344 | + || ! isset($installed_message_types[$default_message_type_name_for_messenger]) |
|
1345 | 1345 | ) { |
1346 | 1346 | continue; |
1347 | 1347 | } |
@@ -1354,7 +1354,7 @@ discard block |
||
1354 | 1354 | false |
1355 | 1355 | ); |
1356 | 1356 | //activate the templates for these message types |
1357 | - if ( ! empty( $default_message_type_names_to_activate ) ) { |
|
1357 | + if ( ! empty($default_message_type_names_to_activate)) { |
|
1358 | 1358 | $templates_created = EEH_MSG_Template::generate_new_templates( |
1359 | 1359 | $active_messenger->name, |
1360 | 1360 | $default_message_type_names_for_messenger, |
@@ -1381,18 +1381,18 @@ discard block |
||
1381 | 1381 | EE_Message_Resource_Manager $message_resource_manager |
1382 | 1382 | ) { |
1383 | 1383 | /** @type EE_messenger[] $messengers_to_generate */ |
1384 | - $messengers_to_generate = self::_get_default_messengers_to_generate_on_activation( $message_resource_manager ); |
|
1384 | + $messengers_to_generate = self::_get_default_messengers_to_generate_on_activation($message_resource_manager); |
|
1385 | 1385 | $installed_message_types = $message_resource_manager->installed_message_types(); |
1386 | 1386 | $templates_generated = false; |
1387 | - foreach ( $messengers_to_generate as $messenger_to_generate ) { |
|
1387 | + foreach ($messengers_to_generate as $messenger_to_generate) { |
|
1388 | 1388 | $default_message_type_names_for_messenger = $messenger_to_generate->get_default_message_types(); |
1389 | 1389 | //verify the default message types match an installed message type. |
1390 | - foreach ( $default_message_type_names_for_messenger as $key => $name ) { |
|
1390 | + foreach ($default_message_type_names_for_messenger as $key => $name) { |
|
1391 | 1391 | if ( |
1392 | - ! isset( $installed_message_types[ $name ] ) |
|
1393 | - || $message_resource_manager->has_message_type_been_activated_for_messenger( $name, $messenger_to_generate->name ) |
|
1392 | + ! isset($installed_message_types[$name]) |
|
1393 | + || $message_resource_manager->has_message_type_been_activated_for_messenger($name, $messenger_to_generate->name) |
|
1394 | 1394 | ) { |
1395 | - unset( $default_message_type_names_for_messenger[ $key ] ); |
|
1395 | + unset($default_message_type_names_for_messenger[$key]); |
|
1396 | 1396 | } |
1397 | 1397 | } |
1398 | 1398 | // in previous iterations, the active_messengers option in the db |
@@ -1406,7 +1406,7 @@ discard block |
||
1406 | 1406 | false |
1407 | 1407 | ); |
1408 | 1408 | //create any templates needing created (or will reactivate templates already generated as necessary). |
1409 | - if ( ! empty( $default_message_type_names_for_messenger ) ) { |
|
1409 | + if ( ! empty($default_message_type_names_for_messenger)) { |
|
1410 | 1410 | $templates_generated = EEH_MSG_Template::generate_new_templates( |
1411 | 1411 | $messenger_to_generate->name, |
1412 | 1412 | $default_message_type_names_for_messenger, |
@@ -1438,18 +1438,18 @@ discard block |
||
1438 | 1438 | $has_activated = $message_resource_manager->get_has_activated_messengers_option(); |
1439 | 1439 | |
1440 | 1440 | $messengers_to_generate = array(); |
1441 | - foreach ( $installed_messengers as $installed_messenger ) { |
|
1441 | + foreach ($installed_messengers as $installed_messenger) { |
|
1442 | 1442 | //if installed messenger is a messenger that should be activated on install |
1443 | 1443 | //and is not already active |
1444 | 1444 | //and has never been activated |
1445 | 1445 | if ( |
1446 | 1446 | ! $installed_messenger->activate_on_install |
1447 | - || isset( $active_messengers[ $installed_messenger->name ] ) |
|
1448 | - || isset( $has_activated[ $installed_messenger->name ] ) |
|
1447 | + || isset($active_messengers[$installed_messenger->name]) |
|
1448 | + || isset($has_activated[$installed_messenger->name]) |
|
1449 | 1449 | ) { |
1450 | 1450 | continue; |
1451 | 1451 | } |
1452 | - $messengers_to_generate[ $installed_messenger->name ] = $installed_messenger; |
|
1452 | + $messengers_to_generate[$installed_messenger->name] = $installed_messenger; |
|
1453 | 1453 | } |
1454 | 1454 | return $messengers_to_generate; |
1455 | 1455 | } |
@@ -1474,9 +1474,9 @@ discard block |
||
1474 | 1474 | */ |
1475 | 1475 | public static function validate_messages_system() { |
1476 | 1476 | /** @type EE_Message_Resource_Manager $message_resource_manager */ |
1477 | - $message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
1477 | + $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
1478 | 1478 | $message_resource_manager->validate_active_message_types_are_installed(); |
1479 | - do_action( 'AHEE__EEH_Activation__validate_messages_system' ); |
|
1479 | + do_action('AHEE__EEH_Activation__validate_messages_system'); |
|
1480 | 1480 | } |
1481 | 1481 | |
1482 | 1482 | |
@@ -1489,12 +1489,12 @@ discard block |
||
1489 | 1489 | * @static |
1490 | 1490 | * @return void |
1491 | 1491 | */ |
1492 | - public static function create_no_ticket_prices_array(){ |
|
1492 | + public static function create_no_ticket_prices_array() { |
|
1493 | 1493 | // this creates an array for tracking events that have no active ticket prices created |
1494 | 1494 | // this allows us to warn admins of the situation so that it can be corrected |
1495 | - $espresso_no_ticket_prices = get_option( 'ee_no_ticket_prices', FALSE ); |
|
1496 | - if ( ! $espresso_no_ticket_prices ) { |
|
1497 | - add_option( 'ee_no_ticket_prices', array(), '', FALSE ); |
|
1495 | + $espresso_no_ticket_prices = get_option('ee_no_ticket_prices', FALSE); |
|
1496 | + if ( ! $espresso_no_ticket_prices) { |
|
1497 | + add_option('ee_no_ticket_prices', array(), '', FALSE); |
|
1498 | 1498 | } |
1499 | 1499 | } |
1500 | 1500 | |
@@ -1519,24 +1519,24 @@ discard block |
||
1519 | 1519 | * @global wpdb $wpdb |
1520 | 1520 | * @throws \EE_Error |
1521 | 1521 | */ |
1522 | - public static function delete_all_espresso_cpt_data(){ |
|
1522 | + public static function delete_all_espresso_cpt_data() { |
|
1523 | 1523 | global $wpdb; |
1524 | 1524 | //get all the CPT post_types |
1525 | 1525 | $ee_post_types = array(); |
1526 | - foreach(EE_Registry::instance()->non_abstract_db_models as $model_name){ |
|
1527 | - if ( method_exists( $model_name, 'instance' )) { |
|
1528 | - $model_obj = call_user_func( array( $model_name, 'instance' )); |
|
1529 | - if ( $model_obj instanceof EEM_CPT_Base ) { |
|
1530 | - $ee_post_types[] = $wpdb->prepare("%s",$model_obj->post_type()); |
|
1526 | + foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) { |
|
1527 | + if (method_exists($model_name, 'instance')) { |
|
1528 | + $model_obj = call_user_func(array($model_name, 'instance')); |
|
1529 | + if ($model_obj instanceof EEM_CPT_Base) { |
|
1530 | + $ee_post_types[] = $wpdb->prepare("%s", $model_obj->post_type()); |
|
1531 | 1531 | } |
1532 | 1532 | } |
1533 | 1533 | } |
1534 | 1534 | //get all our CPTs |
1535 | - $query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",",$ee_post_types).")"; |
|
1535 | + $query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",", $ee_post_types).")"; |
|
1536 | 1536 | $cpt_ids = $wpdb->get_col($query); |
1537 | 1537 | //delete each post meta and term relations too |
1538 | - foreach($cpt_ids as $post_id){ |
|
1539 | - wp_delete_post($post_id,true); |
|
1538 | + foreach ($cpt_ids as $post_id) { |
|
1539 | + wp_delete_post($post_id, true); |
|
1540 | 1540 | } |
1541 | 1541 | } |
1542 | 1542 | |
@@ -1548,12 +1548,12 @@ discard block |
||
1548 | 1548 | public static function drop_espresso_tables() { |
1549 | 1549 | $tables = array(); |
1550 | 1550 | // load registry |
1551 | - foreach( EE_Registry::instance()->non_abstract_db_models as $model_name ){ |
|
1552 | - if ( method_exists( $model_name, 'instance' )) { |
|
1553 | - $model_obj = call_user_func( array( $model_name, 'instance' )); |
|
1554 | - if ( $model_obj instanceof EEM_Base ) { |
|
1555 | - foreach ( $model_obj->get_tables() as $table ) { |
|
1556 | - if ( strpos( $table->get_table_name(), 'esp_' ) |
|
1551 | + foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) { |
|
1552 | + if (method_exists($model_name, 'instance')) { |
|
1553 | + $model_obj = call_user_func(array($model_name, 'instance')); |
|
1554 | + if ($model_obj instanceof EEM_Base) { |
|
1555 | + foreach ($model_obj->get_tables() as $table) { |
|
1556 | + if (strpos($table->get_table_name(), 'esp_') |
|
1557 | 1557 | && |
1558 | 1558 | ( |
1559 | 1559 | is_main_site()//main site? nuke them all |
@@ -1576,10 +1576,10 @@ discard block |
||
1576 | 1576 | 'esp_promotion_rule', |
1577 | 1577 | 'esp_rule' |
1578 | 1578 | ); |
1579 | - foreach( $tables_without_models as $table ){ |
|
1579 | + foreach ($tables_without_models as $table) { |
|
1580 | 1580 | $tables[] = $table; |
1581 | 1581 | } |
1582 | - return \EEH_Activation::getTableManager()->dropTables( $tables ); |
|
1582 | + return \EEH_Activation::getTableManager()->dropTables($tables); |
|
1583 | 1583 | } |
1584 | 1584 | |
1585 | 1585 | /** |
@@ -1591,8 +1591,8 @@ discard block |
||
1591 | 1591 | * @param array $table_names |
1592 | 1592 | * @return array of table names which we deleted |
1593 | 1593 | */ |
1594 | - public static function drop_tables( $table_names ) { |
|
1595 | - return \EEH_Activation::getTableManager()->dropTables( $table_names ); |
|
1594 | + public static function drop_tables($table_names) { |
|
1595 | + return \EEH_Activation::getTableManager()->dropTables($table_names); |
|
1596 | 1596 | } |
1597 | 1597 | /** |
1598 | 1598 | * plugin_uninstall |
@@ -1602,7 +1602,7 @@ discard block |
||
1602 | 1602 | * @param bool $remove_all |
1603 | 1603 | * @return void |
1604 | 1604 | */ |
1605 | - public static function delete_all_espresso_tables_and_data( $remove_all = true ) { |
|
1605 | + public static function delete_all_espresso_tables_and_data($remove_all = true) { |
|
1606 | 1606 | global $wpdb; |
1607 | 1607 | self::drop_espresso_tables(); |
1608 | 1608 | |
@@ -1640,50 +1640,50 @@ discard block |
||
1640 | 1640 | 'ee_job_parameters_' => false, |
1641 | 1641 | 'ee_upload_directories_incomplete' => true, |
1642 | 1642 | ); |
1643 | - if( is_main_site() ) { |
|
1644 | - $wp_options_to_delete[ 'ee_network_config' ] = true; |
|
1643 | + if (is_main_site()) { |
|
1644 | + $wp_options_to_delete['ee_network_config'] = true; |
|
1645 | 1645 | } |
1646 | 1646 | |
1647 | 1647 | $undeleted_options = array(); |
1648 | - foreach ( $wp_options_to_delete as $option_name => $no_wildcard ) { |
|
1648 | + foreach ($wp_options_to_delete as $option_name => $no_wildcard) { |
|
1649 | 1649 | |
1650 | - if( $no_wildcard ){ |
|
1651 | - if( ! delete_option( $option_name ) ){ |
|
1650 | + if ($no_wildcard) { |
|
1651 | + if ( ! delete_option($option_name)) { |
|
1652 | 1652 | $undeleted_options[] = $option_name; |
1653 | 1653 | } |
1654 | - }else{ |
|
1655 | - $option_names_to_delete_from_wildcard = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'" ); |
|
1656 | - foreach($option_names_to_delete_from_wildcard as $option_name_from_wildcard ){ |
|
1657 | - if( ! delete_option( $option_name_from_wildcard ) ){ |
|
1654 | + } else { |
|
1655 | + $option_names_to_delete_from_wildcard = $wpdb->get_col("SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'"); |
|
1656 | + foreach ($option_names_to_delete_from_wildcard as $option_name_from_wildcard) { |
|
1657 | + if ( ! delete_option($option_name_from_wildcard)) { |
|
1658 | 1658 | $undeleted_options[] = $option_name_from_wildcard; |
1659 | 1659 | } |
1660 | 1660 | } |
1661 | 1661 | } |
1662 | 1662 | } |
1663 | 1663 | //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it |
1664 | - remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 ); |
|
1664 | + remove_action('shutdown', array(EE_Config::instance(), 'shutdown'), 10); |
|
1665 | 1665 | |
1666 | - if ( $remove_all && $espresso_db_update = get_option( 'espresso_db_update' )) { |
|
1666 | + if ($remove_all && $espresso_db_update = get_option('espresso_db_update')) { |
|
1667 | 1667 | $db_update_sans_ee4 = array(); |
1668 | - foreach($espresso_db_update as $version => $times_activated){ |
|
1669 | - if( (string)$version[0] === '3'){//if its NON EE4 |
|
1668 | + foreach ($espresso_db_update as $version => $times_activated) { |
|
1669 | + if ((string) $version[0] === '3') {//if its NON EE4 |
|
1670 | 1670 | $db_update_sans_ee4[$version] = $times_activated; |
1671 | 1671 | } |
1672 | 1672 | } |
1673 | - update_option( 'espresso_db_update', $db_update_sans_ee4 ); |
|
1673 | + update_option('espresso_db_update', $db_update_sans_ee4); |
|
1674 | 1674 | } |
1675 | 1675 | |
1676 | 1676 | $errors = ''; |
1677 | - if ( ! empty( $undeleted_options )) { |
|
1677 | + if ( ! empty($undeleted_options)) { |
|
1678 | 1678 | $errors .= sprintf( |
1679 | - __( 'The following wp-options could not be deleted: %s%s', 'event_espresso' ), |
|
1679 | + __('The following wp-options could not be deleted: %s%s', 'event_espresso'), |
|
1680 | 1680 | '<br/>', |
1681 | - implode( ',<br/>', $undeleted_options ) |
|
1681 | + implode(',<br/>', $undeleted_options) |
|
1682 | 1682 | ); |
1683 | 1683 | |
1684 | 1684 | } |
1685 | - if ( ! empty( $errors ) ) { |
|
1686 | - EE_Error::add_attention( $errors, __FILE__, __FUNCTION__, __LINE__ ); |
|
1685 | + if ( ! empty($errors)) { |
|
1686 | + EE_Error::add_attention($errors, __FILE__, __FUNCTION__, __LINE__); |
|
1687 | 1687 | } |
1688 | 1688 | } |
1689 | 1689 | |
@@ -1693,10 +1693,10 @@ discard block |
||
1693 | 1693 | */ |
1694 | 1694 | public static function last_wpdb_error_code() { |
1695 | 1695 | global $wpdb; |
1696 | - if( $wpdb->use_mysqli ) { |
|
1697 | - return mysqli_errno( $wpdb->dbh ); |
|
1696 | + if ($wpdb->use_mysqli) { |
|
1697 | + return mysqli_errno($wpdb->dbh); |
|
1698 | 1698 | } else { |
1699 | - return mysql_errno( $wpdb->dbh ); |
|
1699 | + return mysql_errno($wpdb->dbh); |
|
1700 | 1700 | } |
1701 | 1701 | } |
1702 | 1702 | |
@@ -1707,14 +1707,14 @@ discard block |
||
1707 | 1707 | * @param string $table_name with or without $wpdb->prefix |
1708 | 1708 | * @return boolean |
1709 | 1709 | */ |
1710 | - public static function table_exists( $table_name ){ |
|
1711 | - return \EEH_Activation::getTableAnalysis()->tableExists( $table_name ); |
|
1710 | + public static function table_exists($table_name) { |
|
1711 | + return \EEH_Activation::getTableAnalysis()->tableExists($table_name); |
|
1712 | 1712 | } |
1713 | 1713 | |
1714 | 1714 | /** |
1715 | 1715 | * Resets the cache on EEH_Activation |
1716 | 1716 | */ |
1717 | - public static function reset(){ |
|
1717 | + public static function reset() { |
|
1718 | 1718 | self::$_default_creator_id = NULL; |
1719 | 1719 | self::$_initialized_db_content_already_in_this_request = false; |
1720 | 1720 | } |