@@ -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,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 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | -<?php if ( ! defined( 'ABSPATH' ) ) { |
|
| 2 | - exit( 'No direct script access allowed' ); |
|
| 1 | +<?php if ( ! defined('ABSPATH')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | 3 | } |
| 4 | 4 | /* |
| 5 | 5 | Plugin Name: Event Espresso |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * |
| 43 | 43 | */ |
| 44 | 44 | |
| 45 | -if ( function_exists( 'espresso_version' ) ) { |
|
| 45 | +if (function_exists('espresso_version')) { |
|
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * espresso_duplicate_plugin_error |
@@ -51,12 +51,12 @@ discard block |
||
| 51 | 51 | function espresso_duplicate_plugin_error() { |
| 52 | 52 | ?> |
| 53 | 53 | <div class="error"> |
| 54 | - <p><?php _e( 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso' ); ?></p> |
|
| 54 | + <p><?php _e('Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso'); ?></p> |
|
| 55 | 55 | </div> |
| 56 | 56 | <?php |
| 57 | - espresso_deactivate_plugin( plugin_basename( __FILE__ ) ); |
|
| 57 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
| 58 | 58 | } |
| 59 | - add_action( 'admin_notices', 'espresso_duplicate_plugin_error', 1 ); |
|
| 59 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
| 60 | 60 | |
| 61 | 61 | } else { |
| 62 | 62 | |
@@ -67,103 +67,103 @@ discard block |
||
| 67 | 67 | * @return string |
| 68 | 68 | */ |
| 69 | 69 | function espresso_version() { |
| 70 | - return apply_filters( 'FHEE__espresso__espresso_version', '4.9.13.rc.019' ); |
|
| 70 | + return apply_filters('FHEE__espresso__espresso_version', '4.9.13.rc.019'); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | // define versions |
| 74 | - define( 'EVENT_ESPRESSO_VERSION', espresso_version() ); |
|
| 75 | - define( 'EE_MIN_WP_VER_REQUIRED', '4.1' ); |
|
| 76 | - define( 'EE_MIN_WP_VER_RECOMMENDED', '4.4.2' ); |
|
| 77 | - define( 'EE_MIN_PHP_VER_REQUIRED', '5.3.0' ); |
|
| 78 | - define( 'EE_MIN_PHP_VER_RECOMMENDED', '5.4.44' ); |
|
| 79 | - define( 'EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - ' . EVENT_ESPRESSO_VERSION ); |
|
| 80 | - define( 'EVENT_ESPRESSO_MAIN_FILE', __FILE__ ); |
|
| 74 | + define('EVENT_ESPRESSO_VERSION', espresso_version()); |
|
| 75 | + define('EE_MIN_WP_VER_REQUIRED', '4.1'); |
|
| 76 | + define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2'); |
|
| 77 | + define('EE_MIN_PHP_VER_REQUIRED', '5.3.0'); |
|
| 78 | + define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44'); |
|
| 79 | + define('EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - '.EVENT_ESPRESSO_VERSION); |
|
| 80 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
| 81 | 81 | //used to be DIRECTORY_SEPARATOR, but that caused issues on windows |
| 82 | - if ( ! defined( 'DS' ) ) { |
|
| 83 | - define( 'DS', '/' ); |
|
| 82 | + if ( ! defined('DS')) { |
|
| 83 | + define('DS', '/'); |
|
| 84 | 84 | } |
| 85 | - if ( ! defined( 'PS' ) ) { |
|
| 86 | - define( 'PS', PATH_SEPARATOR ); |
|
| 85 | + if ( ! defined('PS')) { |
|
| 86 | + define('PS', PATH_SEPARATOR); |
|
| 87 | 87 | } |
| 88 | - if ( ! defined( 'SP' ) ) { |
|
| 89 | - define( 'SP', ' ' ); |
|
| 88 | + if ( ! defined('SP')) { |
|
| 89 | + define('SP', ' '); |
|
| 90 | 90 | } |
| 91 | - if ( ! defined( 'EENL' ) ) { |
|
| 92 | - define( 'EENL', "\n" ); |
|
| 91 | + if ( ! defined('EENL')) { |
|
| 92 | + define('EENL', "\n"); |
|
| 93 | 93 | } |
| 94 | - define( 'EE_SUPPORT_EMAIL', '[email protected]' ); |
|
| 94 | + define('EE_SUPPORT_EMAIL', '[email protected]'); |
|
| 95 | 95 | // define the plugin directory and URL |
| 96 | - define( 'EE_PLUGIN_BASENAME', plugin_basename( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
| 97 | - define( 'EE_PLUGIN_DIR_PATH', plugin_dir_path( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
| 98 | - define( 'EE_PLUGIN_DIR_URL', plugin_dir_url( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
| 96 | + define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE)); |
|
| 97 | + define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE)); |
|
| 98 | + define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE)); |
|
| 99 | 99 | // main root folder paths |
| 100 | - define( 'EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS ); |
|
| 101 | - define( 'EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS ); |
|
| 102 | - define( 'EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS ); |
|
| 103 | - define( 'EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS ); |
|
| 104 | - define( 'EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS ); |
|
| 105 | - define( 'EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS ); |
|
| 106 | - define( 'EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS ); |
|
| 107 | - define( 'EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS ); |
|
| 100 | + define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH.'admin_pages'.DS); |
|
| 101 | + define('EE_CORE', EE_PLUGIN_DIR_PATH.'core'.DS); |
|
| 102 | + define('EE_MODULES', EE_PLUGIN_DIR_PATH.'modules'.DS); |
|
| 103 | + define('EE_PUBLIC', EE_PLUGIN_DIR_PATH.'public'.DS); |
|
| 104 | + define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH.'shortcodes'.DS); |
|
| 105 | + define('EE_WIDGETS', EE_PLUGIN_DIR_PATH.'widgets'.DS); |
|
| 106 | + define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH.'payment_methods'.DS); |
|
| 107 | + define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH.'caffeinated'.DS); |
|
| 108 | 108 | // core system paths |
| 109 | - define( 'EE_ADMIN', EE_CORE . 'admin' . DS ); |
|
| 110 | - define( 'EE_CPTS', EE_CORE . 'CPTs' . DS ); |
|
| 111 | - define( 'EE_CLASSES', EE_CORE . 'db_classes' . DS ); |
|
| 112 | - define( 'EE_INTERFACES', EE_CORE . 'interfaces' . DS ); |
|
| 113 | - define( 'EE_BUSINESS', EE_CORE . 'business' . DS ); |
|
| 114 | - define( 'EE_MODELS', EE_CORE . 'db_models' . DS ); |
|
| 115 | - define( 'EE_HELPERS', EE_CORE . 'helpers' . DS ); |
|
| 116 | - define( 'EE_LIBRARIES', EE_CORE . 'libraries' . DS ); |
|
| 117 | - define( 'EE_TEMPLATES', EE_CORE . 'templates' . DS ); |
|
| 118 | - define( 'EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS ); |
|
| 119 | - define( 'EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS ); |
|
| 120 | - define( 'EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS ); |
|
| 109 | + define('EE_ADMIN', EE_CORE.'admin'.DS); |
|
| 110 | + define('EE_CPTS', EE_CORE.'CPTs'.DS); |
|
| 111 | + define('EE_CLASSES', EE_CORE.'db_classes'.DS); |
|
| 112 | + define('EE_INTERFACES', EE_CORE.'interfaces'.DS); |
|
| 113 | + define('EE_BUSINESS', EE_CORE.'business'.DS); |
|
| 114 | + define('EE_MODELS', EE_CORE.'db_models'.DS); |
|
| 115 | + define('EE_HELPERS', EE_CORE.'helpers'.DS); |
|
| 116 | + define('EE_LIBRARIES', EE_CORE.'libraries'.DS); |
|
| 117 | + define('EE_TEMPLATES', EE_CORE.'templates'.DS); |
|
| 118 | + define('EE_THIRD_PARTY', EE_CORE.'third_party_libs'.DS); |
|
| 119 | + define('EE_GLOBAL_ASSETS', EE_TEMPLATES.'global_assets'.DS); |
|
| 120 | + define('EE_FORM_SECTIONS', EE_LIBRARIES.'form_sections'.DS); |
|
| 121 | 121 | // gateways |
| 122 | - define( 'EE_GATEWAYS', EE_MODULES . 'gateways' . DS ); |
|
| 123 | - define( 'EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS ); |
|
| 122 | + define('EE_GATEWAYS', EE_MODULES.'gateways'.DS); |
|
| 123 | + define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL.'modules'.DS.'gateways'.DS); |
|
| 124 | 124 | // asset URL paths |
| 125 | - define( 'EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS ); |
|
| 126 | - define( 'EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS ); |
|
| 127 | - define( 'EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS ); |
|
| 128 | - define( 'EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS ); |
|
| 129 | - define( 'EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/' ); |
|
| 130 | - define( 'EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/' ); |
|
| 125 | + define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL.'core'.DS.'templates'.DS); |
|
| 126 | + define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL.'global_assets'.DS); |
|
| 127 | + define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL.'images'.DS); |
|
| 128 | + define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL.'core'.DS.'third_party_libs'.DS); |
|
| 129 | + define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL.'core/helpers/assets/'); |
|
| 130 | + define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL.'core/libraries/'); |
|
| 131 | 131 | // define upload paths |
| 132 | 132 | $uploads = wp_upload_dir(); |
| 133 | 133 | // define the uploads directory and URL |
| 134 | - define( 'EVENT_ESPRESSO_UPLOAD_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS ); |
|
| 135 | - define( 'EVENT_ESPRESSO_UPLOAD_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS ); |
|
| 134 | + define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'].DS.'espresso'.DS); |
|
| 135 | + define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'].DS.'espresso'.DS); |
|
| 136 | 136 | // define the templates directory and URL |
| 137 | - define( 'EVENT_ESPRESSO_TEMPLATE_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'templates' . DS ); |
|
| 138 | - define( 'EVENT_ESPRESSO_TEMPLATE_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'templates' . DS ); |
|
| 137 | + define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'].DS.'espresso'.DS.'templates'.DS); |
|
| 138 | + define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'].DS.'espresso'.DS.'templates'.DS); |
|
| 139 | 139 | // define the gateway directory and URL |
| 140 | - define( 'EVENT_ESPRESSO_GATEWAY_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'gateways' . DS ); |
|
| 141 | - define( 'EVENT_ESPRESSO_GATEWAY_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'gateways' . DS ); |
|
| 140 | + define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'].DS.'espresso'.DS.'gateways'.DS); |
|
| 141 | + define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'].DS.'espresso'.DS.'gateways'.DS); |
|
| 142 | 142 | // languages folder/path |
| 143 | - define( 'EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS ); |
|
| 144 | - define( 'EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS ); |
|
| 143 | + define('EE_LANGUAGES_SAFE_LOC', '..'.DS.'uploads'.DS.'espresso'.DS.'languages'.DS); |
|
| 144 | + define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'languages'.DS); |
|
| 145 | 145 | //check for dompdf fonts in uploads |
| 146 | - if ( file_exists( EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ) ) { |
|
| 147 | - define( 'DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ); |
|
| 146 | + if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS)) { |
|
| 147 | + define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS); |
|
| 148 | 148 | } |
| 149 | 149 | //ajax constants |
| 150 | - define( 'EE_FRONT_AJAX', isset( $_REQUEST[ 'ee_front_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_front_ajax' ] ) ? true : false ); |
|
| 151 | - define( 'EE_ADMIN_AJAX', isset( $_REQUEST[ 'ee_admin_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_admin_ajax' ] ) ? true : false ); |
|
| 150 | + define('EE_FRONT_AJAX', isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false); |
|
| 151 | + define('EE_ADMIN_AJAX', isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false); |
|
| 152 | 152 | //just a handy constant occasionally needed for finding values representing infinity in the DB |
| 153 | 153 | //you're better to use this than its straight value (currently -1) in case you ever |
| 154 | 154 | //want to change its default value! or find when -1 means infinity |
| 155 | - define( 'EE_INF_IN_DB', -1 ); |
|
| 156 | - define( 'EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX ); |
|
| 157 | - define( 'EE_DEBUG', false ); |
|
| 155 | + define('EE_INF_IN_DB', -1); |
|
| 156 | + define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX); |
|
| 157 | + define('EE_DEBUG', false); |
|
| 158 | 158 | |
| 159 | 159 | /** |
| 160 | 160 | * espresso_plugin_activation |
| 161 | 161 | * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
| 162 | 162 | */ |
| 163 | 163 | function espresso_plugin_activation() { |
| 164 | - update_option( 'ee_espresso_activation', true ); |
|
| 164 | + update_option('ee_espresso_activation', true); |
|
| 165 | 165 | } |
| 166 | - register_activation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation' ); |
|
| 166 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
| 167 | 167 | |
| 168 | 168 | |
| 169 | 169 | |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | // } |
| 178 | 178 | // |
| 179 | 179 | } |
| 180 | - register_deactivation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation' ); |
|
| 180 | + register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation'); |
|
| 181 | 181 | |
| 182 | 182 | |
| 183 | 183 | |
@@ -187,15 +187,15 @@ discard block |
||
| 187 | 187 | */ |
| 188 | 188 | function espresso_load_error_handling() { |
| 189 | 189 | // load debugging tools |
| 190 | - if ( WP_DEBUG === true && is_readable( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ) ) { |
|
| 191 | - require_once( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ); |
|
| 190 | + if (WP_DEBUG === true && is_readable(EE_HELPERS.'EEH_Debug_Tools.helper.php')) { |
|
| 191 | + require_once(EE_HELPERS.'EEH_Debug_Tools.helper.php'); |
|
| 192 | 192 | EEH_Debug_Tools::instance(); |
| 193 | 193 | } |
| 194 | 194 | // load error handling |
| 195 | - if ( is_readable( EE_CORE . 'EE_Error.core.php' ) ) { |
|
| 196 | - require_once( EE_CORE . 'EE_Error.core.php' ); |
|
| 195 | + if (is_readable(EE_CORE.'EE_Error.core.php')) { |
|
| 196 | + require_once(EE_CORE.'EE_Error.core.php'); |
|
| 197 | 197 | } else { |
| 198 | - wp_die( __( 'The EE_Error core class could not be loaded.', 'event_espresso' ) ); |
|
| 198 | + wp_die(__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
| 199 | 199 | } |
| 200 | 200 | } |
| 201 | 201 | |
@@ -209,25 +209,25 @@ discard block |
||
| 209 | 209 | * @param string $full_path_to_file |
| 210 | 210 | * @throws EE_Error |
| 211 | 211 | */ |
| 212 | - function espresso_load_required( $classname, $full_path_to_file ) { |
|
| 212 | + function espresso_load_required($classname, $full_path_to_file) { |
|
| 213 | 213 | static $error_handling_loaded = false; |
| 214 | - if ( ! $error_handling_loaded ) { |
|
| 214 | + if ( ! $error_handling_loaded) { |
|
| 215 | 215 | espresso_load_error_handling(); |
| 216 | 216 | $error_handling_loaded = true; |
| 217 | 217 | } |
| 218 | - if ( is_readable( $full_path_to_file ) ) { |
|
| 219 | - require_once( $full_path_to_file ); |
|
| 218 | + if (is_readable($full_path_to_file)) { |
|
| 219 | + require_once($full_path_to_file); |
|
| 220 | 220 | } else { |
| 221 | - throw new EE_Error ( sprintf( |
|
| 222 | - __( 'The %s class file could not be located or is not readable due to file permissions.', 'event_espresso' ), |
|
| 221 | + throw new EE_Error(sprintf( |
|
| 222 | + __('The %s class file could not be located or is not readable due to file permissions.', 'event_espresso'), |
|
| 223 | 223 | $classname |
| 224 | - ) ); |
|
| 224 | + )); |
|
| 225 | 225 | } |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | - espresso_load_required( 'EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' ); |
|
| 229 | - espresso_load_required( 'EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' ); |
|
| 230 | - espresso_load_required( 'EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php' ); |
|
| 228 | + espresso_load_required('EEH_Base', EE_CORE.'helpers'.DS.'EEH_Base.helper.php'); |
|
| 229 | + espresso_load_required('EEH_File', EE_CORE.'helpers'.DS.'EEH_File.helper.php'); |
|
| 230 | + espresso_load_required('EE_Bootstrap', EE_CORE.'EE_Bootstrap.core.php'); |
|
| 231 | 231 | new EE_Bootstrap(); |
| 232 | 232 | |
| 233 | 233 | |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | |
| 237 | 237 | |
| 238 | 238 | |
| 239 | -if ( ! function_exists( 'espresso_deactivate_plugin' ) ) { |
|
| 239 | +if ( ! function_exists('espresso_deactivate_plugin')) { |
|
| 240 | 240 | /** |
| 241 | 241 | * deactivate_plugin |
| 242 | 242 | * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
@@ -245,11 +245,11 @@ discard block |
||
| 245 | 245 | * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
| 246 | 246 | * @return void |
| 247 | 247 | */ |
| 248 | - function espresso_deactivate_plugin( $plugin_basename = '' ) { |
|
| 249 | - if ( ! function_exists( 'deactivate_plugins' ) ) { |
|
| 250 | - require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
|
| 248 | + function espresso_deactivate_plugin($plugin_basename = '') { |
|
| 249 | + if ( ! function_exists('deactivate_plugins')) { |
|
| 250 | + require_once(ABSPATH.'wp-admin/includes/plugin.php'); |
|
| 251 | 251 | } |
| 252 | - unset( $_GET[ 'activate' ], $_REQUEST[ 'activate' ] ); |
|
| 253 | - deactivate_plugins( $plugin_basename ); |
|
| 252 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
| 253 | + deactivate_plugins($plugin_basename); |
|
| 254 | 254 | } |
| 255 | 255 | } |
@@ -8,31 +8,31 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | $row = 1; |
| 10 | 10 | $max = 1; |
| 11 | -$ticket_count = count( $tickets ); |
|
| 11 | +$ticket_count = count($tickets); |
|
| 12 | 12 | |
| 13 | -if ( ! $ticket_count ) { |
|
| 13 | +if ( ! $ticket_count) { |
|
| 14 | 14 | return; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | $required_ticket_sold_out = FALSE; |
| 18 | -$template_settings = isset ( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) |
|
| 18 | +$template_settings = isset (EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector) |
|
| 19 | 19 | ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector |
| 20 | 20 | : new EE_Ticket_Selector_Config(); |
| 21 | 21 | |
| 22 | 22 | ob_start(); |
| 23 | 23 | |
| 24 | -foreach ( $tickets as $TKT_ID => $ticket ) { |
|
| 25 | - if ( $ticket instanceof EE_Ticket ) { |
|
| 26 | - $remaining = max( $ticket->remaining(), 0 ); |
|
| 24 | +foreach ($tickets as $TKT_ID => $ticket) { |
|
| 25 | + if ($ticket instanceof EE_Ticket) { |
|
| 26 | + $remaining = max($ticket->remaining(), 0); |
|
| 27 | 27 | // max tickets or $max_atndz, whichever is smaller |
| 28 | - $max = min( $ticket->max(), $max_atndz );; |
|
| 28 | + $max = min($ticket->max(), $max_atndz); ; |
|
| 29 | 29 | // offer the number of $tickets_remaining or $max, whichever is smaller |
| 30 | - $max = min( $remaining, $max ); |
|
| 30 | + $max = min($remaining, $max); |
|
| 31 | 31 | // and we also want to restrict the minimum number of tickets by the ticket min setting |
| 32 | 32 | $min = $ticket->min() > 0 ? $ticket->min() : 0; |
| 33 | 33 | // and if the ticket is required, then make sure that min qty is at least 1 |
| 34 | - $min = $ticket->required() ? max( $min, 1 ) : $min; |
|
| 35 | - if ( ! $ticket->is_on_sale() || $remaining < $min ) { |
|
| 34 | + $min = $ticket->required() ? max($min, 1) : $min; |
|
| 35 | + if ( ! $ticket->is_on_sale() || $remaining < $min) { |
|
| 36 | 36 | // set flag if ticket is required (flag is set to start date so that future tickets are not blocked) |
| 37 | 37 | $required_ticket_sold_out = $ticket->required() && ! $remaining ? $ticket->start_date() : $required_ticket_sold_out; |
| 38 | 38 | } |
@@ -40,42 +40,42 @@ discard block |
||
| 40 | 40 | $ticket_price = $ticket->get_ticket_total_with_taxes(); |
| 41 | 41 | $ticket_bundle = FALSE; |
| 42 | 42 | // for ticket bundles, set min and max qty the same |
| 43 | - if ( $ticket->min() != 0 && $ticket->min() == $ticket->max() ) { |
|
| 43 | + if ($ticket->min() != 0 && $ticket->min() == $ticket->max()) { |
|
| 44 | 44 | $ticket_price = $ticket_price * $ticket->min(); |
| 45 | 45 | $ticket_bundle = TRUE; |
| 46 | 46 | } |
| 47 | - $ticket_price = apply_filters( 'FHEE__ticket_selector_chart_template__ticket_price', $ticket_price, $ticket ); |
|
| 47 | + $ticket_price = apply_filters('FHEE__ticket_selector_chart_template__ticket_price', $ticket_price, $ticket); |
|
| 48 | 48 | $is_remaining = $remaining > 0 ? true : false; |
| 49 | 49 | // if a previous required ticket with the same sale start date is sold out, then mark this ticket as sold out as well. |
| 50 | 50 | // tickets that go on sale at a later date than the required ticket will NOT be affected |
| 51 | - $tkt_status = $required_ticket_sold_out !== FALSE && $required_ticket_sold_out === $ticket->start_date() ? EE_Ticket::sold_out : $ticket->ticket_status( false, $is_remaining ); |
|
| 51 | + $tkt_status = $required_ticket_sold_out !== FALSE && $required_ticket_sold_out === $ticket->start_date() ? EE_Ticket::sold_out : $ticket->ticket_status(false, $is_remaining); |
|
| 52 | 52 | $tkt_status = $event_status === EE_Datetime::sold_out ? EE_Ticket::sold_out : $tkt_status; |
| 53 | 53 | // check ticket status |
| 54 | - switch ( $tkt_status ) { |
|
| 54 | + switch ($tkt_status) { |
|
| 55 | 55 | // sold_out |
| 56 | 56 | case EE_Ticket::sold_out : |
| 57 | - $ticket_status = '<span class="ticket-sales-sold-out">' . $ticket->ticket_status( TRUE, $is_remaining ) . '</span>'; |
|
| 57 | + $ticket_status = '<span class="ticket-sales-sold-out">'.$ticket->ticket_status(TRUE, $is_remaining).'</span>'; |
|
| 58 | 58 | $status_class = 'ticket-sales-sold-out lt-grey-text'; |
| 59 | 59 | break; |
| 60 | 60 | // expired |
| 61 | 61 | case EE_Ticket::expired : |
| 62 | - $ticket_status = '<span class="ticket-sales-expired">' . $ticket->ticket_status( true, $is_remaining ) . '</span>'; |
|
| 62 | + $ticket_status = '<span class="ticket-sales-expired">'.$ticket->ticket_status(true, $is_remaining).'</span>'; |
|
| 63 | 63 | $status_class = 'ticket-sales-expired lt-grey-text'; |
| 64 | 64 | break; |
| 65 | 65 | // archived |
| 66 | 66 | case EE_Ticket::archived : |
| 67 | - $ticket_status = '<span class="archived-ticket">' . $ticket->ticket_status( true, $is_remaining ) . '</span>'; |
|
| 67 | + $ticket_status = '<span class="archived-ticket">'.$ticket->ticket_status(true, $is_remaining).'</span>'; |
|
| 68 | 68 | $status_class = 'archived-ticket hidden'; |
| 69 | 69 | break; |
| 70 | 70 | // pending |
| 71 | 71 | case EE_Ticket::pending : |
| 72 | - $ticket_status = '<span class="ticket-pending">' . $ticket->ticket_status( true, $is_remaining ) . '</span>'; |
|
| 72 | + $ticket_status = '<span class="ticket-pending">'.$ticket->ticket_status(true, $is_remaining).'</span>'; |
|
| 73 | 73 | $status_class = 'ticket-pending'; |
| 74 | 74 | break; |
| 75 | 75 | // onsale |
| 76 | 76 | case EE_Ticket::onsale : |
| 77 | 77 | default : |
| 78 | - $ticket_status = '<span class="ticket-on-sale">' . $ticket->ticket_status( true, $is_remaining ) . '</span>'; |
|
| 78 | + $ticket_status = '<span class="ticket-on-sale">'.$ticket->ticket_status(true, $is_remaining).'</span>'; |
|
| 79 | 79 | $status_class = 'ticket-on-sale'; |
| 80 | 80 | break; |
| 81 | 81 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | "tckt-slctr-tkt-details-{$EVT_ID}-{$TKT_ID}" |
| 116 | 116 | ); |
| 117 | 117 | ?> |
| 118 | - <tr class="tckt-slctr-tbl-tr <?php echo $status_class . ' ' . espresso_get_object_css_class( $ticket ); ?>"> |
|
| 118 | + <tr class="tckt-slctr-tbl-tr <?php echo $status_class.' '.espresso_get_object_css_class($ticket); ?>"> |
|
| 119 | 119 | <?php |
| 120 | 120 | /** |
| 121 | 121 | * Allow plugins to hook in and abort the generation and display of the contents of this |
@@ -127,24 +127,24 @@ discard block |
||
| 127 | 127 | * |
| 128 | 128 | * @var string|bool |
| 129 | 129 | */ |
| 130 | - if ( false !== ( $new_row_cells_content = apply_filters( 'FHEE__ticket_selector_chart_template__do_ticket_inside_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class ) ) ) { |
|
| 130 | + if (false !== ($new_row_cells_content = apply_filters('FHEE__ticket_selector_chart_template__do_ticket_inside_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class))) { |
|
| 131 | 131 | echo $new_row_cells_content; |
| 132 | 132 | echo '</tr>'; |
| 133 | 133 | continue; |
| 134 | 134 | } |
| 135 | 135 | ?> |
| 136 | 136 | <td class="tckt-slctr-tbl-td-name"> |
| 137 | - <b><?php echo $ticket->get_pretty('TKT_name');?></b> |
|
| 138 | - <?php if ( $template_settings->show_ticket_details ) : ?> |
|
| 139 | - <a id="display-<?php echo $ticket_details_css_id; ?>" class="display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr( apply_filters( 'FHEE__ticket_selector_chart_template__show_ticket_details_link_title', __( 'click to show additional ticket details', 'event_espresso' )) ); ?>"> |
|
| 140 | - <?php echo sprintf( __( 'show%1$sdetails%1$s+', 'event_espresso' ), ' ' ); ?> |
|
| 137 | + <b><?php echo $ticket->get_pretty('TKT_name'); ?></b> |
|
| 138 | + <?php if ($template_settings->show_ticket_details) : ?> |
|
| 139 | + <a id="display-<?php echo $ticket_details_css_id; ?>" class="display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr(apply_filters('FHEE__ticket_selector_chart_template__show_ticket_details_link_title', __('click to show additional ticket details', 'event_espresso'))); ?>"> |
|
| 140 | + <?php echo sprintf(__('show%1$sdetails%1$s+', 'event_espresso'), ' '); ?> |
|
| 141 | 141 | </a> |
| 142 | - <a id="hide-<?php echo $ticket_details_css_id; ?>" class="hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr( apply_filters( 'FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', __( 'click to hide additional ticket details', 'event_espresso' )) ); ?>" style="display:none;"> |
|
| 143 | - <?php echo sprintf( __( 'hide%1$sdetails%1$s-', 'event_espresso' ), ' ' ); ?> |
|
| 142 | + <a id="hide-<?php echo $ticket_details_css_id; ?>" class="hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr(apply_filters('FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', __('click to hide additional ticket details', 'event_espresso'))); ?>" style="display:none;"> |
|
| 143 | + <?php echo sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '); ?> |
|
| 144 | 144 | </a> |
| 145 | 145 | <?php endif; //end show details check ?> |
| 146 | - <?php if ( $ticket->required() ) { ?> |
|
| 147 | - <p class="ticket-required-pg"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_required_message', __( 'This ticket is required and must be purchased.', 'event_espresso' )); ?></p> |
|
| 146 | + <?php if ($ticket->required()) { ?> |
|
| 147 | + <p class="ticket-required-pg"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_required_message', __('This ticket is required and must be purchased.', 'event_espresso')); ?></p> |
|
| 148 | 148 | <?php } ?> |
| 149 | 149 | <?php |
| 150 | 150 | // echo '<br/><b>$max_atndz : ' . $max_atndz . '</b>'; |
@@ -158,63 +158,63 @@ discard block |
||
| 158 | 158 | // echo '<br/><b> $ticket->required() : ' . $ticket->uses() . '</b>'; |
| 159 | 159 | ?> |
| 160 | 160 | </td> |
| 161 | - <?php if ( apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?> |
|
| 162 | - <td class="tckt-slctr-tbl-td-price jst-rght"><?php echo EEH_Template::format_currency( $ticket_price ); ?> <span class="smaller-text no-bold"><?php |
|
| 163 | - if ( $ticket_bundle ) { |
|
| 164 | - echo apply_filters( 'FHEE__ticket_selector_chart_template__per_ticket_bundle_text', __( ' / bundle', 'event_espresso' )); |
|
| 161 | + <?php if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?> |
|
| 162 | + <td class="tckt-slctr-tbl-td-price jst-rght"><?php echo EEH_Template::format_currency($ticket_price); ?> <span class="smaller-text no-bold"><?php |
|
| 163 | + if ($ticket_bundle) { |
|
| 164 | + echo apply_filters('FHEE__ticket_selector_chart_template__per_ticket_bundle_text', __(' / bundle', 'event_espresso')); |
|
| 165 | 165 | } else { |
| 166 | - echo apply_filters( 'FHEE__ticket_selector_chart_template__per_ticket_text', __( '', 'event_espresso' )); |
|
| 166 | + echo apply_filters('FHEE__ticket_selector_chart_template__per_ticket_text', __('', 'event_espresso')); |
|
| 167 | 167 | }?></span> </td> |
| 168 | 168 | <?php } ?> |
| 169 | 169 | <td class="tckt-slctr-tbl-td-qty cntr"> |
| 170 | 170 | <?php |
| 171 | 171 | $hidden_input_qty = $max_atndz > 1 ? TRUE : FALSE; |
| 172 | 172 | // sold out or other status ? |
| 173 | - if ( $tkt_status == EE_Ticket::sold_out || $remaining == 0 ) { |
|
| 173 | + if ($tkt_status == EE_Ticket::sold_out || $remaining == 0) { |
|
| 174 | 174 | ?> |
| 175 | - <span class="sold-out"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_sold_out_msg', __( 'Sold Out', 'event_espresso' ));?></span> |
|
| 175 | + <span class="sold-out"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_sold_out_msg', __('Sold Out', 'event_espresso')); ?></span> |
|
| 176 | 176 | <?php |
| 177 | - } else if ( $tkt_status == EE_Ticket::expired || $tkt_status == EE_Ticket::archived ) { |
|
| 177 | + } else if ($tkt_status == EE_Ticket::expired || $tkt_status == EE_Ticket::archived) { |
|
| 178 | 178 | echo $ticket_status; |
| 179 | - } else if ( $tkt_status == EE_Ticket::pending ) { |
|
| 179 | + } else if ($tkt_status == EE_Ticket::pending) { |
|
| 180 | 180 | ?> |
| 181 | 181 | <div class="ticket-pending-pg"> |
| 182 | - <span class="ticket-pending"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', __( 'Goes On Sale', 'event_espresso' )); ?></span><br/> |
|
| 183 | - <span class="small-text"><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', apply_filters( 'FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', $date_format ) ); ?></span> |
|
| 182 | + <span class="ticket-pending"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', __('Goes On Sale', 'event_espresso')); ?></span><br/> |
|
| 183 | + <span class="small-text"><?php echo $ticket->get_i18n_datetime('TKT_start_date', apply_filters('FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', $date_format)); ?></span> |
|
| 184 | 184 | </div> |
| 185 | 185 | <?php |
| 186 | 186 | // min qty purchasable is less than tickets available |
| 187 | - } else if ( $ticket->min() > $remaining ) { |
|
| 187 | + } else if ($ticket->min() > $remaining) { |
|
| 188 | 188 | ?> |
| 189 | 189 | <div class="archived-ticket-pg"> |
| 190 | - <span class="archived-ticket small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_not_available_msg', __( 'Not Available', 'event_espresso' )); ?></span><br/> |
|
| 190 | + <span class="archived-ticket small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_not_available_msg', __('Not Available', 'event_espresso')); ?></span><br/> |
|
| 191 | 191 | </div> |
| 192 | 192 | <?php |
| 193 | 193 | // if only one attendee is allowed to register at a time |
| 194 | - } else if ( $max_atndz == 1 ) { |
|
| 194 | + } else if ($max_atndz == 1) { |
|
| 195 | 195 | // display submit button since we have tickets available |
| 196 | - add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
| 196 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
| 197 | 197 | ?> |
| 198 | - <input type="radio" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID . '-' . $row; ?>" class="ticket-selector-tbl-qty-slct" value="<?php echo $row . '-'; ?>1" <?php echo $row == 1 ? ' checked="checked"' : ''; ?> title=""/> |
|
| 198 | + <input type="radio" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID.'-'.$row; ?>" class="ticket-selector-tbl-qty-slct" value="<?php echo $row.'-'; ?>1" <?php echo $row == 1 ? ' checked="checked"' : ''; ?> title=""/> |
|
| 199 | 199 | <?php |
| 200 | 200 | $hidden_input_qty = FALSE; |
| 201 | 201 | |
| 202 | - } else if ( $max_atndz == 0 ) { |
|
| 203 | - echo '<span class="sold-out">' . apply_filters( 'FHEE__ticket_selector_chart_template__ticket_closed_msg', __( 'Closed', 'event_espresso' )) . '</span>'; |
|
| 204 | - } elseif ( $max > 0 ) { |
|
| 202 | + } else if ($max_atndz == 0) { |
|
| 203 | + echo '<span class="sold-out">'.apply_filters('FHEE__ticket_selector_chart_template__ticket_closed_msg', __('Closed', 'event_espresso')).'</span>'; |
|
| 204 | + } elseif ($max > 0) { |
|
| 205 | 205 | // display submit button since we have tickets available |
| 206 | - add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
| 206 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
| 207 | 207 | |
| 208 | 208 | ?> |
| 209 | - <select name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID . '-' . $row; ?>" class="ticket-selector-tbl-qty-slct" title=""> |
|
| 209 | + <select name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID.'-'.$row; ?>" class="ticket-selector-tbl-qty-slct" title=""> |
|
| 210 | 210 | <?php |
| 211 | 211 | // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased |
| 212 | - if ( ! $ticket->required() && $min !== 0 ) { |
|
| 212 | + if ( ! $ticket->required() && $min !== 0) { |
|
| 213 | 213 | ?> |
| 214 | 214 | <option value="0"> 0 </option> |
| 215 | 215 | <?php } |
| 216 | 216 | // offer ticket quantities from the min to the max |
| 217 | - for ( $i = $min; $i <= $max; $i++) { |
|
| 217 | + for ($i = $min; $i <= $max; $i++) { |
|
| 218 | 218 | ?> |
| 219 | 219 | <option value="<?php echo $i; ?>"> <?php echo $i; ?> </option> |
| 220 | 220 | <?php } ?> |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | |
| 225 | 225 | } |
| 226 | 226 | // depending on group reg we need to change the format for qty |
| 227 | - if ( $hidden_input_qty ) { |
|
| 227 | + if ($hidden_input_qty) { |
|
| 228 | 228 | ?> |
| 229 | 229 | <input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="0" /> |
| 230 | 230 | <?php |
@@ -234,33 +234,33 @@ discard block |
||
| 234 | 234 | |
| 235 | 235 | </td> |
| 236 | 236 | </tr> |
| 237 | - <?php if ( $template_settings->show_ticket_details ) : ?> |
|
| 238 | - <tr class="tckt-slctr-tkt-details-tr <?php echo espresso_get_object_css_class( $ticket, '', 'details' );?>"> |
|
| 237 | + <?php if ($template_settings->show_ticket_details) : ?> |
|
| 238 | + <tr class="tckt-slctr-tkt-details-tr <?php echo espresso_get_object_css_class($ticket, '', 'details'); ?>"> |
|
| 239 | 239 | <td class="tckt-slctr-tkt-details-td" colspan="3" > |
| 240 | 240 | <div id="<?php echo $ticket_details_css_id; ?>-dv" class="tckt-slctr-tkt-details-dv" style="display: none;"> |
| 241 | 241 | |
| 242 | 242 | <section class="tckt-slctr-tkt-details-sctn"> |
| 243 | - <h3><?php _e( 'Details', 'event_espresso' ); ?></h3> |
|
| 243 | + <h3><?php _e('Details', 'event_espresso'); ?></h3> |
|
| 244 | 244 | <p><?php echo $ticket->description(); ?></p> |
| 245 | 245 | |
| 246 | - <?php if ( $ticket_price != 0 && apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?> |
|
| 246 | + <?php if ($ticket_price != 0 && apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?> |
|
| 247 | 247 | <section class="tckt-slctr-tkt-price-sctn"> |
| 248 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', __( 'Price', 'event_espresso' )); ?></h5> |
|
| 248 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', __('Price', 'event_espresso')); ?></h5> |
|
| 249 | 249 | <div class="tckt-slctr-tkt-details-tbl-wrap-dv"> |
| 250 | 250 | <table class="tckt-slctr-tkt-details-tbl"> |
| 251 | 251 | <thead> |
| 252 | 252 | <tr> |
| 253 | - <th class="ee-third-width"><span class="small-text"><?php _e( 'Name', 'event_espresso' ); ?></span></th> |
|
| 254 | - <th class="jst-cntr"><span class="small-text"><?php _e( 'Description', 'event_espresso' ); ?></span></th> |
|
| 255 | - <th class="ee-fourth-width jst-rght"><span class="small-text"><?php _e( 'Amount', 'event_espresso' ); ?></span></th> |
|
| 253 | + <th class="ee-third-width"><span class="small-text"><?php _e('Name', 'event_espresso'); ?></span></th> |
|
| 254 | + <th class="jst-cntr"><span class="small-text"><?php _e('Description', 'event_espresso'); ?></span></th> |
|
| 255 | + <th class="ee-fourth-width jst-rght"><span class="small-text"><?php _e('Amount', 'event_espresso'); ?></span></th> |
|
| 256 | 256 | </tr> |
| 257 | 257 | </thead> |
| 258 | 258 | <tbody> |
| 259 | - <?php if ( $ticket->base_price() instanceof EE_Price ) { ?> |
|
| 259 | + <?php if ($ticket->base_price() instanceof EE_Price) { ?> |
|
| 260 | 260 | <tr> |
| 261 | - <td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="small-text"><b><?php echo $ticket->base_price()->name(); ?></b></td> |
|
| 262 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $ticket->base_price()->desc(); ?></td> |
|
| 263 | - <td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td> |
|
| 261 | + <td data-th="<?php _e('Name', 'event_espresso'); ?>" class="small-text"><b><?php echo $ticket->base_price()->name(); ?></b></td> |
|
| 262 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $ticket->base_price()->desc(); ?></td> |
|
| 263 | + <td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td> |
|
| 264 | 264 | </tr> |
| 265 | 265 | <?php |
| 266 | 266 | $running_total = $ticket->base_price()->amount(); |
@@ -268,44 +268,44 @@ discard block |
||
| 268 | 268 | $running_total = 0; |
| 269 | 269 | } |
| 270 | 270 | // now add price modifiers |
| 271 | - foreach ( $ticket->price_modifiers() as $price_mod ) { ?> |
|
| 271 | + foreach ($ticket->price_modifiers() as $price_mod) { ?> |
|
| 272 | 272 | <tr> |
| 273 | - <td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $price_mod->name(); ?></td> |
|
| 274 | - <?php if ( $price_mod->is_percent() ) { ?> |
|
| 275 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $price_mod->desc(); ?> <?php echo $price_mod->amount(); ?>%</td> |
|
| 273 | + <td data-th="<?php _e('Name', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $price_mod->name(); ?></td> |
|
| 274 | + <?php if ($price_mod->is_percent()) { ?> |
|
| 275 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $price_mod->desc(); ?> <?php echo $price_mod->amount(); ?>%</td> |
|
| 276 | 276 | <?php |
| 277 | - $new_sub_total = $running_total * ( $price_mod->amount() / 100 ); |
|
| 277 | + $new_sub_total = $running_total * ($price_mod->amount() / 100); |
|
| 278 | 278 | $new_sub_total = $price_mod->is_discount() ? $new_sub_total * -1 : $new_sub_total; |
| 279 | 279 | ?> |
| 280 | 280 | <?php } else { ?> |
| 281 | 281 | <?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 : $price_mod->amount(); ?> |
| 282 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $price_mod->desc(); ?></td> |
|
| 282 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $price_mod->desc(); ?></td> |
|
| 283 | 283 | <?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 : $price_mod->amount(); ?> |
| 284 | 284 | <?php } ?> |
| 285 | - <td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency( $new_sub_total ); ?></td> |
|
| 285 | + <td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency($new_sub_total); ?></td> |
|
| 286 | 286 | <?php $running_total += $new_sub_total; ?> |
| 287 | 287 | </tr> |
| 288 | 288 | <?php } ?> |
| 289 | - <?php if ( $ticket->taxable() ) { ?> |
|
| 289 | + <?php if ($ticket->taxable()) { ?> |
|
| 290 | 290 | <?php //$ticket_subtotal =$ticket->get_ticket_subtotal(); ?> |
| 291 | 291 | <tr> |
| 292 | - <td colspan="2" class="jst-rght small-text sbttl"><b><?php _e( 'subtotal', 'event_espresso' ); ?></b></td> |
|
| 293 | - <td data-th="<?php _e( 'subtotal', 'event_espresso' ); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency( $running_total ); ?></b></td> |
|
| 292 | + <td colspan="2" class="jst-rght small-text sbttl"><b><?php _e('subtotal', 'event_espresso'); ?></b></td> |
|
| 293 | + <td data-th="<?php _e('subtotal', 'event_espresso'); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency($running_total); ?></b></td> |
|
| 294 | 294 | </tr> |
| 295 | 295 | |
| 296 | - <?php foreach ( $ticket->get_ticket_taxes_for_admin() as $tax ) { ?> |
|
| 296 | + <?php foreach ($ticket->get_ticket_taxes_for_admin() as $tax) { ?> |
|
| 297 | 297 | <tr> |
| 298 | - <td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $tax->name(); ?></td> |
|
| 299 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $tax->amount(); ?>%</td> |
|
| 300 | - <?php $tax_amount = $running_total * ( $tax->amount() / 100 ); ?> |
|
| 301 | - <td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency( $tax_amount ); ?></td> |
|
| 298 | + <td data-th="<?php _e('Name', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $tax->name(); ?></td> |
|
| 299 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $tax->amount(); ?>%</td> |
|
| 300 | + <?php $tax_amount = $running_total * ($tax->amount() / 100); ?> |
|
| 301 | + <td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency($tax_amount); ?></td> |
|
| 302 | 302 | <?php $running_total += $tax_amount; ?> |
| 303 | 303 | </tr> |
| 304 | 304 | <?php } ?> |
| 305 | 305 | <?php } ?> |
| 306 | 306 | <tr> |
| 307 | - <td colspan="2" class="jst-rght small-text ttl-lbl-td"><b><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_total_price', __( 'Total', 'event_espresso' )); ?></b></td> |
|
| 308 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_total_price', __( 'Total', 'event_espresso' )); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency( $running_total ); ?></b></td> |
|
| 307 | + <td colspan="2" class="jst-rght small-text ttl-lbl-td"><b><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price', __('Total', 'event_espresso')); ?></b></td> |
|
| 308 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price', __('Total', 'event_espresso')); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency($running_total); ?></b></td> |
|
| 309 | 309 | </tr> |
| 310 | 310 | </tbody> |
| 311 | 311 | </table> |
@@ -315,106 +315,106 @@ discard block |
||
| 315 | 315 | <?php } ?> |
| 316 | 316 | |
| 317 | 317 | <section class="tckt-slctr-tkt-sale-dates-sctn"> |
| 318 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', __( 'Sale Dates', 'event_espresso' )); ?></h5> |
|
| 319 | - <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', __( 'The dates when this option is available for purchase.', 'event_espresso' )); ?></span><br/> |
|
| 320 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', __( 'Goes On Sale:', 'event_espresso' )); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', $date_format) . ' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', $time_format ) ; ?><br/> |
|
| 321 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_sales_end', __( 'Sales End:', 'event_espresso' )); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime( 'TKT_end_date', $date_format ) . ' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime( 'TKT_end_date', $time_format ) ; ?><br/> |
|
| 318 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', __('Sale Dates', 'event_espresso')); ?></h5> |
|
| 319 | + <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', __('The dates when this option is available for purchase.', 'event_espresso')); ?></span><br/> |
|
| 320 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', __('Goes On Sale:', 'event_espresso')); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime('TKT_start_date', $date_format).' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime('TKT_start_date', $time_format); ?><br/> |
|
| 321 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_sales_end', __('Sales End:', 'event_espresso')); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime('TKT_end_date', $date_format).' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime('TKT_end_date', $time_format); ?><br/> |
|
| 322 | 322 | </section> |
| 323 | 323 | <br/> |
| 324 | 324 | |
| 325 | - <?php do_action( 'AHEE__ticket_selector_chart_template__after_ticket_date', $ticket ); ?> |
|
| 325 | + <?php do_action('AHEE__ticket_selector_chart_template__after_ticket_date', $ticket); ?> |
|
| 326 | 326 | |
| 327 | - <?php if ( $ticket->min() && $ticket->max() ) { ?> |
|
| 327 | + <?php if ($ticket->min() && $ticket->max()) { ?> |
|
| 328 | 328 | <section class="tckt-slctr-tkt-quantities-sctn"> |
| 329 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', __( 'Purchasable Quantities', 'event_espresso' )); ?></h5> |
|
| 330 | - <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', __( 'The number of tickets that can be purchased per transaction (if available).', 'event_espresso' )); ?></span><br/> |
|
| 331 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', __( 'Minimum Qty:', 'event_espresso' )); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?> |
|
| 332 | - <?php if ( $ticket->min() > $remaining ) { ?> <span class="important-notice small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', __( 'The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', 'event_espresso' )); ?></span><?php } ?><br/> |
|
| 329 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', __('Purchasable Quantities', 'event_espresso')); ?></h5> |
|
| 330 | + <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', __('The number of tickets that can be purchased per transaction (if available).', 'event_espresso')); ?></span><br/> |
|
| 331 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', __('Minimum Qty:', 'event_espresso')); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?> |
|
| 332 | + <?php if ($ticket->min() > $remaining) { ?> <span class="important-notice small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', __('The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', 'event_espresso')); ?></span><?php } ?><br/> |
|
| 333 | 333 | <?php //$max = min( $max, $max_atndz );?> |
| 334 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', __( 'Maximum Qty:', 'event_espresso' )); ?></span><?php echo $ticket->max() === EE_INF ? __( 'no limit', 'event_espresso' ) : max( $ticket->max(), 1 ); ?><br/> |
|
| 334 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', __('Maximum Qty:', 'event_espresso')); ?></span><?php echo $ticket->max() === EE_INF ? __('no limit', 'event_espresso') : max($ticket->max(), 1); ?><br/> |
|
| 335 | 335 | </section> |
| 336 | 336 | <br/> |
| 337 | 337 | <?php } ?> |
| 338 | 338 | |
| 339 | - <?php if ( $ticket->uses() !== EE_INF && ( ! defined( 'EE_DECAF' ) || EE_DECAF !== TRUE )) { ?> |
|
| 339 | + <?php if ($ticket->uses() !== EE_INF && ( ! defined('EE_DECAF') || EE_DECAF !== TRUE)) { ?> |
|
| 340 | 340 | <section class="tckt-slctr-tkt-uses-sctn"> |
| 341 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', __( 'Event Date Ticket Uses', 'event_espresso' )); ?></h5> |
|
| 341 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', __('Event Date Ticket Uses', 'event_espresso')); ?></h5> |
|
| 342 | 342 | <span class="drk-grey-text small-text no-bold"> - <?php |
| 343 | 343 | echo apply_filters( |
| 344 | 344 | 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_message', |
| 345 | 345 | sprintf( |
| 346 | - __( 'The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', 'event_espresso' ), |
|
| 346 | + __('The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', 'event_espresso'), |
|
| 347 | 347 | '<br/>', |
| 348 | 348 | '<strong>', |
| 349 | 349 | '</strong>' |
| 350 | 350 | ) |
| 351 | 351 | ); |
| 352 | 352 | ?></span><br/> |
| 353 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', __( '# Datetimes:', 'event_espresso' )); ?></span><?php echo $ticket->uses();?><br/> |
|
| 353 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', __('# Datetimes:', 'event_espresso')); ?></span><?php echo $ticket->uses(); ?><br/> |
|
| 354 | 354 | </section> |
| 355 | 355 | <?php } ?> |
| 356 | 356 | |
| 357 | 357 | <?php |
| 358 | - $datetimes = $ticket->datetimes_ordered( $event_is_expired, FALSE ); |
|
| 358 | + $datetimes = $ticket->datetimes_ordered($event_is_expired, FALSE); |
|
| 359 | 359 | $chart_column_width = $template_settings->show_ticket_sale_columns ? ' ee-fourth-width' : ' ee-half-width'; |
| 360 | - if ( ! empty( $datetimes )) { ?> |
|
| 360 | + if ( ! empty($datetimes)) { ?> |
|
| 361 | 361 | <section class="tckt-slctr-tkt-datetimes-sctn"> |
| 362 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', __( 'Access', 'event_espresso' )); ?></h5> |
|
| 363 | - <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_message', __( 'This option allows access to the following dates and times.', 'event_espresso' )); ?></span> |
|
| 362 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', __('Access', 'event_espresso')); ?></h5> |
|
| 363 | + <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_message', __('This option allows access to the following dates and times.', 'event_espresso')); ?></span> |
|
| 364 | 364 | <div class="tckt-slctr-tkt-details-tbl-wrap-dv"> |
| 365 | 365 | <table class="tckt-slctr-tkt-details-tbl"> |
| 366 | 366 | <thead> |
| 367 | 367 | <tr> |
| 368 | 368 | <th class="tckt-slctr-tkt-details-date-th"> |
| 369 | - <span class="dashicons dashicons-calendar"></span><span class="small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __( 'Date ', 'event_espresso' )); ?></span> |
|
| 369 | + <span class="dashicons dashicons-calendar"></span><span class="small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __('Date ', 'event_espresso')); ?></span> |
|
| 370 | 370 | </th> |
| 371 | 371 | <th class="tckt-slctr-tkt-details-time-th <?php echo $chart_column_width; ?>"> |
| 372 | - <span class="dashicons dashicons-clock"></span><span class="small-text"><?php _e( 'Time ', 'event_espresso' ); ?></span> |
|
| 372 | + <span class="dashicons dashicons-clock"></span><span class="small-text"><?php _e('Time ', 'event_espresso'); ?></span> |
|
| 373 | 373 | </th> |
| 374 | - <?php if ( $template_settings->show_ticket_sale_columns ) : ?> |
|
| 374 | + <?php if ($template_settings->show_ticket_sale_columns) : ?> |
|
| 375 | 375 | <th class="tckt-slctr-tkt-details-this-ticket-sold-th ee-fourth-width cntr"> |
| 376 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', sprintf( __( 'Sold', 'event_espresso' ), '<br/>' )); ?></span> |
|
| 376 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', sprintf(__('Sold', 'event_espresso'), '<br/>')); ?></span> |
|
| 377 | 377 | </th> |
| 378 | 378 | <th class="tckt-slctr-tkt-details-this-ticket-left-th ee-fourth-width cntr"> |
| 379 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', sprintf( __( 'Remaining', 'event_espresso' ), '<br/>' )); ?></span> |
|
| 379 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', sprintf(__('Remaining', 'event_espresso'), '<br/>')); ?></span> |
|
| 380 | 380 | </th> |
| 381 | 381 | <th class="tckt-slctr-tkt-details-total-tickets-sold-th ee-fourth-width cntr"> |
| 382 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', sprintf( __( 'Total%sSold', 'event_espresso' ), '<br/>' )); ?></span> |
|
| 382 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', sprintf(__('Total%sSold', 'event_espresso'), '<br/>')); ?></span> |
|
| 383 | 383 | </th> |
| 384 | 384 | <th class="tckt-slctr-tkt-details-total-tickets-left-th ee-fourth-width cntr"> |
| 385 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', sprintf( __( 'Total Spaces%sLeft', 'event_espresso' ), '<br/>' )); ?></span> |
|
| 385 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', sprintf(__('Total Spaces%sLeft', 'event_espresso'), '<br/>')); ?></span> |
|
| 386 | 386 | </th> |
| 387 | 387 | <?php endif; //end $template_settings->show_ticket_sale_columns conditional ?> |
| 388 | 388 | </tr> |
| 389 | 389 | </thead> |
| 390 | 390 | <tbody> |
| 391 | 391 | <?php |
| 392 | - foreach ( $datetimes as $datetime ) { |
|
| 393 | - if ( $datetime instanceof EE_Datetime ) { |
|
| 392 | + foreach ($datetimes as $datetime) { |
|
| 393 | + if ($datetime instanceof EE_Datetime) { |
|
| 394 | 394 | ?> |
| 395 | 395 | |
| 396 | 396 | <tr> |
| 397 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __( 'Event Date ', 'event_espresso' )); ?>" class="small-text"> |
|
| 397 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __('Event Date ', 'event_espresso')); ?>" class="small-text"> |
|
| 398 | 398 | <?php $datetime_name = $datetime->name(); ?> |
| 399 | - <?php echo ! empty( $datetime_name ) ? '<b>' . $datetime_name . '</b><br/>' : ''; ?> |
|
| 400 | - <?php echo $datetime->date_range( $date_format, __( ' to ', 'event_espresso' )); ?> |
|
| 399 | + <?php echo ! empty($datetime_name) ? '<b>'.$datetime_name.'</b><br/>' : ''; ?> |
|
| 400 | + <?php echo $datetime->date_range($date_format, __(' to ', 'event_espresso')); ?> |
|
| 401 | 401 | </td> |
| 402 | - <td data-th="<?php _e( 'Time ', 'event_espresso' ); ?>" class="cntr small-text"> |
|
| 403 | - <?php echo $datetime->time_range( $time_format, __( ' to ', 'event_espresso' )); ?> |
|
| 402 | + <td data-th="<?php _e('Time ', 'event_espresso'); ?>" class="cntr small-text"> |
|
| 403 | + <?php echo $datetime->time_range($time_format, __(' to ', 'event_espresso')); ?> |
|
| 404 | 404 | </td> |
| 405 | - <?php if ( $template_settings->show_ticket_sale_columns ) : ?> |
|
| 406 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', __( 'Sold', 'event_espresso' )); ?>" class="cntr small-text"> |
|
| 405 | + <?php if ($template_settings->show_ticket_sale_columns) : ?> |
|
| 406 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', __('Sold', 'event_espresso')); ?>" class="cntr small-text"> |
|
| 407 | 407 | <?php echo $ticket->sold(); ?> |
| 408 | 408 | </td> |
| 409 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', __( 'Remaining', 'event_espresso' )); ?>" class="cntr small-text"> |
|
| 410 | - <?php echo $remaining === EE_INF ? '<span class="smaller-text">' . __( 'unlimited ', 'event_espresso' ) . '</span>' : $remaining; ?> |
|
| 409 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', __('Remaining', 'event_espresso')); ?>" class="cntr small-text"> |
|
| 410 | + <?php echo $remaining === EE_INF ? '<span class="smaller-text">'.__('unlimited ', 'event_espresso').'</span>' : $remaining; ?> |
|
| 411 | 411 | </td> |
| 412 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', __( 'Total Sold', 'event_espresso' )); ?>" class="cntr small-text"> |
|
| 412 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', __('Total Sold', 'event_espresso')); ?>" class="cntr small-text"> |
|
| 413 | 413 | <?php echo $datetime->sold(); ?> |
| 414 | 414 | </td> |
| 415 | - <?php $tkts_left = $datetime->sold_out() ? '<span class="sold-out smaller-text">' . __( 'Sold Out', 'event_espresso' ) . '</span>' : $datetime->spaces_remaining(); ?> |
|
| 416 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', __( 'Total Spaces Left', 'event_espresso' )); ?>" class="cntr small-text"> |
|
| 417 | - <?php echo $tkts_left === EE_INF ? '<span class="smaller-text">' . __( 'unlimited ', 'event_espresso' ) . '</span>' : $tkts_left; ?> |
|
| 415 | + <?php $tkts_left = $datetime->sold_out() ? '<span class="sold-out smaller-text">'.__('Sold Out', 'event_espresso').'</span>' : $datetime->spaces_remaining(); ?> |
|
| 416 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', __('Total Spaces Left', 'event_espresso')); ?>" class="cntr small-text"> |
|
| 417 | + <?php echo $tkts_left === EE_INF ? '<span class="smaller-text">'.__('unlimited ', 'event_espresso').'</span>' : $tkts_left; ?> |
|
| 418 | 418 | </td> |
| 419 | 419 | <?php endif; //end $template_settings->show_ticket_sale_columns conditional ?> |
| 420 | 420 | </tr> |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | </div> |
| 433 | 433 | </td> |
| 434 | 434 | </tr> |
| 435 | - <?php endif; //end template_settings->show_ticket_details check?> |
|
| 435 | + <?php endif; //end template_settings->show_ticket_details check?> |
|
| 436 | 436 | <?php |
| 437 | 437 | $row++; |
| 438 | 438 | } |
@@ -441,18 +441,18 @@ discard block |
||
| 441 | 441 | $ticket_row_html = ob_get_clean(); |
| 442 | 442 | // if there is only ONE ticket with a max qty of ONE, and it is free... then not much need for the ticket selector |
| 443 | 443 | $hide_ticket_selector = $ticket_count == 1 && $max_atndz == 1 && $ticket->is_free() ? true : false; |
| 444 | -$hide_ticket_selector = apply_filters( 'FHEE__ticket_selector_chart_template__hide_ticket_selector', $hide_ticket_selector, $EVT_ID ); |
|
| 444 | +$hide_ticket_selector = apply_filters('FHEE__ticket_selector_chart_template__hide_ticket_selector', $hide_ticket_selector, $EVT_ID); |
|
| 445 | 445 | // EEH_Debug_Tools::printr( $ticket_count, '$ticket_count', __FILE__, __LINE__ ); |
| 446 | 446 | // EEH_Debug_Tools::printr( $max, '$max', __FILE__, __LINE__ ); |
| 447 | 447 | // EEH_Debug_Tools::printr( $hide_ticket_selector, '$hide_ticket_selector', __FILE__, __LINE__ ); |
| 448 | 448 | //EEH_Debug_Tools::printr( $table_style, '$table_style', __FILE__, __LINE__ ); |
| 449 | 449 | remove_filter( |
| 450 | 450 | 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', |
| 451 | - array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' ) |
|
| 451 | + array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv') |
|
| 452 | 452 | ); |
| 453 | 453 | remove_filter( |
| 454 | 454 | 'FHEE__EE_Ticket_Selector__after_view_details_btn', |
| 455 | - array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' ) |
|
| 455 | + array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv') |
|
| 456 | 456 | ); |
| 457 | 457 | /** |
| 458 | 458 | * Filters the anchor ID used when redirecting to the Ticket Selector if no quantity selected |
@@ -462,20 +462,20 @@ discard block |
||
| 462 | 462 | * @param string '#tkt-slctr-tbl-' . $EVT_ID The html ID to anchor to |
| 463 | 463 | * @param int $EVT_ID The Event ID |
| 464 | 464 | */ |
| 465 | -$anchor_id = apply_filters( 'FHEE__EE_Ticket_Selector__redirect_anchor_id', '#tkt-slctr-tbl-' . $EVT_ID, $EVT_ID ); |
|
| 466 | -if ( ! $hide_ticket_selector ) { |
|
| 465 | +$anchor_id = apply_filters('FHEE__EE_Ticket_Selector__redirect_anchor_id', '#tkt-slctr-tbl-'.$EVT_ID, $EVT_ID); |
|
| 466 | +if ( ! $hide_ticket_selector) { |
|
| 467 | 467 | ?> |
| 468 | 468 | <div id="tkt-slctr-tbl-wrap-dv-<?php echo $EVT_ID; ?>" class="tkt-slctr-tbl-wrap-dv"> |
| 469 | 469 | |
| 470 | - <?php do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); ?> |
|
| 470 | + <?php do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event); ?> |
|
| 471 | 471 | |
| 472 | 472 | <table id="tkt-slctr-tbl-<?php echo $EVT_ID; ?>" class="tkt-slctr-tbl"> |
| 473 | 473 | <thead> |
| 474 | 474 | <tr> |
| 475 | 475 | <th scope="col" class="ee-ticket-selector-ticket-details-th"> |
| 476 | - <?php echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_available_tickets', '', $EVT_ID ) ); ?> |
|
| 476 | + <?php echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_available_tickets', '', $EVT_ID)); ?> |
|
| 477 | 477 | </th> |
| 478 | - <?php if ( apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?> |
|
| 478 | + <?php if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?> |
|
| 479 | 479 | <th scope="col" class="ee-ticket-selector-ticket-price-th cntr"> |
| 480 | 480 | <?php |
| 481 | 481 | /** |
@@ -486,7 +486,7 @@ discard block |
||
| 486 | 486 | * @param string 'Price' The translatable text to display in the table header for price |
| 487 | 487 | * @param int $EVT_ID The Event ID |
| 488 | 488 | */ |
| 489 | - echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_price', __( 'Price', 'event_espresso' ), $EVT_ID ) ); |
|
| 489 | + echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_price', __('Price', 'event_espresso'), $EVT_ID)); |
|
| 490 | 490 | ?> |
| 491 | 491 | </th> |
| 492 | 492 | <?php } ?> |
@@ -500,24 +500,24 @@ discard block |
||
| 500 | 500 | * @param string 'Qty*' The translatable text to display in the table header for the Quantity of tickets |
| 501 | 501 | * @param int $EVT_ID The Event ID |
| 502 | 502 | */ |
| 503 | - echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_qty', __( 'Qty*', 'event_espresso' ), $EVT_ID ) ); |
|
| 503 | + echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_qty', __('Qty*', 'event_espresso'), $EVT_ID)); |
|
| 504 | 504 | ?> |
| 505 | 505 | </th> |
| 506 | 506 | </tr> |
| 507 | 507 | </thead> |
| 508 | 508 | <tbody> |
| 509 | - <?php echo $ticket_row_html;?> |
|
| 509 | + <?php echo $ticket_row_html; ?> |
|
| 510 | 510 | </tbody> |
| 511 | 511 | </table> |
| 512 | 512 | |
| 513 | 513 | <input type="hidden" name="noheader" value="true" /> |
| 514 | - <input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url() . $anchor_id; ?>" /> |
|
| 514 | + <input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url().$anchor_id; ?>" /> |
|
| 515 | 515 | <input type="hidden" name="tkt-slctr-rows-<?php echo $EVT_ID; ?>" value="<?php echo $row - 1; ?>" /> |
| 516 | 516 | <input type="hidden" name="tkt-slctr-max-atndz-<?php echo $EVT_ID; ?>" value="<?php echo $max_atndz; ?>" /> |
| 517 | 517 | <input type="hidden" name="tkt-slctr-event-id" value="<?php echo $EVT_ID; ?>" /> |
| 518 | 518 | |
| 519 | 519 | <?php |
| 520 | - if ( $max_atndz > 0 && ! $hide_ticket_selector ) { |
|
| 520 | + if ($max_atndz > 0 && ! $hide_ticket_selector) { |
|
| 521 | 521 | echo apply_filters( |
| 522 | 522 | 'FHEE__ticket_selector_chart_template__maximum_tickets_purchased_footnote', |
| 523 | 523 | '' |
@@ -525,39 +525,39 @@ discard block |
||
| 525 | 525 | } |
| 526 | 526 | ?> |
| 527 | 527 | |
| 528 | - <?php do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event ); ?> |
|
| 528 | + <?php do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event); ?> |
|
| 529 | 529 | |
| 530 | 530 | </div> |
| 531 | -<?php } else if ( isset( $TKT_ID ) ) { ?> |
|
| 531 | +<?php } else if (isset($TKT_ID)) { ?> |
|
| 532 | 532 | <input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="1"/> |
| 533 | 533 | <input type="hidden" name="tkt-slctr-ticket-id-<?php echo $EVT_ID; ?>[]" value="<?php echo $TKT_ID; ?>"/> |
| 534 | 534 | <input type="hidden" name="noheader" value="true"/> |
| 535 | -<input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url() . $anchor_id; ?>"/> |
|
| 535 | +<input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url().$anchor_id; ?>"/> |
|
| 536 | 536 | <input type="hidden" name="tkt-slctr-rows-<?php echo $EVT_ID; ?>" value="<?php echo $row - 1; ?>"/> |
| 537 | 537 | <input type="hidden" name="tkt-slctr-max-atndz-<?php echo $EVT_ID; ?>" value="<?php echo $max_atndz; ?>"/> |
| 538 | 538 | <input type="hidden" name="tkt-slctr-event-id" value="<?php echo $EVT_ID; ?>"/> |
| 539 | 539 | <?php |
| 540 | - if ( $ticket instanceof EE_Ticket ) { |
|
| 541 | - do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); |
|
| 540 | + if ($ticket instanceof EE_Ticket) { |
|
| 541 | + do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event); |
|
| 542 | 542 | $ticket_description = $ticket->description(); |
| 543 | 543 | ?> |
| 544 | 544 | <div id="no-tkt-slctr-ticket-dv-<?php echo $EVT_ID; ?>" class="no-tkt-slctr-ticket-dv"> |
| 545 | 545 | <div class="no-tkt-slctr-ticket-content-dv"> |
| 546 | 546 | <h5><?php echo $ticket->name(); ?></h5> |
| 547 | - <?php if ( ! empty( $ticket_description ) ) { ?> |
|
| 547 | + <?php if ( ! empty($ticket_description)) { ?> |
|
| 548 | 548 | <p><?php echo $ticket_description; ?></p> |
| 549 | 549 | <?php } ?> |
| 550 | 550 | </div> |
| 551 | 551 | <?php |
| 552 | 552 | add_filter( |
| 553 | 553 | 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', |
| 554 | - array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' ) |
|
| 554 | + array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv') |
|
| 555 | 555 | ); |
| 556 | 556 | add_filter( |
| 557 | 557 | 'FHEE__EE_Ticket_Selector__after_view_details_btn', |
| 558 | - array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' ) |
|
| 558 | + array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv') |
|
| 559 | 559 | ); |
| 560 | - do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event ); |
|
| 560 | + do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event); |
|
| 561 | 561 | } |
| 562 | 562 | } |
| 563 | 563 | ?> |