@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @subpackage |
| 7 | 7 | * @author Mike Nelson |
| 8 | 8 | */ |
| 9 | -class EE_Text_Area_Input extends EE_Form_Input_Base{ |
|
| 9 | +class EE_Text_Area_Input extends EE_Form_Input_Base { |
|
| 10 | 10 | |
| 11 | 11 | |
| 12 | 12 | protected $_rows = 2; |
@@ -16,28 +16,28 @@ discard block |
||
| 16 | 16 | * sets the rows property on this input |
| 17 | 17 | * @param int $rows |
| 18 | 18 | */ |
| 19 | - public function set_rows( $rows ) { |
|
| 19 | + public function set_rows($rows) { |
|
| 20 | 20 | $this->_rows = $rows; |
| 21 | 21 | } |
| 22 | 22 | /** |
| 23 | 23 | * sets the cols html property on this input |
| 24 | 24 | * @param int $cols |
| 25 | 25 | */ |
| 26 | - public function set_cols( $cols ) { |
|
| 26 | + public function set_cols($cols) { |
|
| 27 | 27 | $this->_cols = $cols; |
| 28 | 28 | } |
| 29 | 29 | /** |
| 30 | 30 | * |
| 31 | 31 | * @return int |
| 32 | 32 | */ |
| 33 | - public function get_rows(){ |
|
| 33 | + public function get_rows() { |
|
| 34 | 34 | return $this->_rows; |
| 35 | 35 | } |
| 36 | 36 | /** |
| 37 | 37 | * |
| 38 | 38 | * @return int |
| 39 | 39 | */ |
| 40 | - public function get_cols(){ |
|
| 40 | + public function get_cols() { |
|
| 41 | 41 | return $this->_cols; |
| 42 | 42 | } |
| 43 | 43 | |
@@ -6,13 +6,13 @@ |
||
| 6 | 6 | * @subpackage |
| 7 | 7 | * @author Mike Nelson |
| 8 | 8 | */ |
| 9 | -class EE_Text_Input extends EE_Form_Input_Base{ |
|
| 9 | +class EE_Text_Input extends EE_Form_Input_Base { |
|
| 10 | 10 | |
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * @param array $options |
| 14 | 14 | */ |
| 15 | - function __construct($options = array()){ |
|
| 15 | + function __construct($options = array()) { |
|
| 16 | 16 | $this->_set_display_strategy(new EE_Text_Input_Display_Strategy()); |
| 17 | 17 | $this->_set_normalization_strategy(new EE_Text_Normalization()); |
| 18 | 18 | parent::__construct($options); |
@@ -1,16 +1,16 @@ |
||
| 1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
| 2 | 2 | /** |
| 3 | - * |
|
| 4 | - * Class EE_Question_Answer_Form_Section |
|
| 5 | - * |
|
| 6 | - * Description |
|
| 7 | - * |
|
| 8 | - * @package Event Espresso |
|
| 9 | - * @subpackage core |
|
| 10 | - * @author Brent Christensen |
|
| 11 | - * @since $VID:$ |
|
| 12 | - * |
|
| 13 | - */ |
|
| 3 | + * |
|
| 4 | + * Class EE_Question_Answer_Form_Section |
|
| 5 | + * |
|
| 6 | + * Description |
|
| 7 | + * |
|
| 8 | + * @package Event Espresso |
|
| 9 | + * @subpackage core |
|
| 10 | + * @author Brent Christensen |
|
| 11 | + * @since $VID:$ |
|
| 12 | + * |
|
| 13 | + */ |
|
| 14 | 14 | |
| 15 | 15 | class EE_Question_Answer_Form_Section extends EE_Form_Section_Proper { |
| 16 | 16 | |
@@ -19,13 +19,13 @@ discard block |
||
| 19 | 19 | * @param EE_Question $question |
| 20 | 20 | * @param EE_Answer $answer |
| 21 | 21 | */ |
| 22 | - public function __construct( EE_Registration $registration, EE_Question $question, EE_Answer $answer ){ |
|
| 22 | + public function __construct(EE_Registration $registration, EE_Question $question, EE_Answer $answer) { |
|
| 23 | 23 | // array of params to pass to parent constructor |
| 24 | 24 | $form_args = array( |
| 25 | 25 | 'name' => $registration->reg_url_link(), |
| 26 | 26 | 'subsections' => array(), |
| 27 | 27 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
| 28 | - 'html_name' => '[' . $registration->reg_url_link() . ']', |
|
| 28 | + 'html_name' => '['.$registration->reg_url_link().']', |
|
| 29 | 29 | 'html_id' => $registration->reg_url_link(), |
| 30 | 30 | 'html_class' => 'ee-reg-page-questions' |
| 31 | 31 | ); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | 'default'=>$model_field->get_default_value(), |
| 36 | 36 | )); |
| 37 | 37 | |
| 38 | - switch ( $question->type() ) { |
|
| 38 | + switch ($question->type()) { |
|
| 39 | 39 | // Text |
| 40 | 40 | case EEM_Question::QST_type_text : |
| 41 | 41 | $input_class = 'EE_Text_Input'; |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | $input_class = 'EE_Text_Input'; |
| 62 | 62 | break; |
| 63 | 63 | } |
| 64 | - $reflection = new ReflectionClass( $input_class ); |
|
| 65 | - $form_args['subsections'][] = $reflection->newInstanceArgs( $input_constructor_args ); |
|
| 66 | - parent::__construct( $form_args ); |
|
| 64 | + $reflection = new ReflectionClass($input_class); |
|
| 65 | + $form_args['subsections'][] = $reflection->newInstanceArgs($input_constructor_args); |
|
| 66 | + parent::__construct($form_args); |
|
| 67 | 67 | |
| 68 | 68 | } |
| 69 | 69 | |
@@ -1,16 +1,16 @@ |
||
| 1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
| 2 | 2 | /** |
| 3 | - * |
|
| 4 | - * Class EE_Reg_Form_Question_Form |
|
| 5 | - * |
|
| 6 | - * For auto-generating form sections for an EE_Transaction |
|
| 7 | - * |
|
| 8 | - * @package Event Espresso |
|
| 9 | - * @subpackage core |
|
| 10 | - * @author Brent Christensen |
|
| 11 | - * @since 4.5.0 |
|
| 12 | - * |
|
| 13 | - */ |
|
| 3 | + * |
|
| 4 | + * Class EE_Reg_Form_Question_Form |
|
| 5 | + * |
|
| 6 | + * For auto-generating form sections for an EE_Transaction |
|
| 7 | + * |
|
| 8 | + * @package Event Espresso |
|
| 9 | + * @subpackage core |
|
| 10 | + * @author Brent Christensen |
|
| 11 | + * @since 4.5.0 |
|
| 12 | + * |
|
| 13 | + */ |
|
| 14 | 14 | |
| 15 | 15 | class EE_Reg_Form_Question_Form extends EE_Model_Form_Section { |
| 16 | 16 | |
@@ -20,41 +20,41 @@ |
||
| 20 | 20 | * @param EE_Question $question |
| 21 | 21 | * @return EE_Reg_Form_Question_Form |
| 22 | 22 | */ |
| 23 | - public function __construct( EE_Registration $registration, EE_Question $question ){ |
|
| 23 | + public function __construct(EE_Registration $registration, EE_Question $question) { |
|
| 24 | 24 | |
| 25 | - if( $question instanceof EE_Question ){ |
|
| 25 | + if ($question instanceof EE_Question) { |
|
| 26 | 26 | // array of params to pass to parent constructor |
| 27 | 27 | $form_args = array( |
| 28 | 28 | 'name' => $registration->reg_url_link(), |
| 29 | 29 | 'subsections' => array(), |
| 30 | 30 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
| 31 | - 'html_name' => '[' . $registration->reg_url_link() . ']', |
|
| 31 | + 'html_name' => '['.$registration->reg_url_link().']', |
|
| 32 | 32 | 'html_id' => $registration->reg_url_link(), |
| 33 | 33 | 'html_class' => 'ee-reg-page-questions' |
| 34 | 34 | ); |
| 35 | 35 | |
| 36 | 36 | // if this question was for an attendee detail, then check for that answer |
| 37 | - $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value( $registration, $question->ID() ); |
|
| 38 | - $answer = $registration->reg_url_link() || ! $answer_value ? EEM_Answer::instance()->get_one( array( array( 'QST_ID'=>$question->ID(), 'REG_ID'=>$registration->ID() ))) : NULL; |
|
| 37 | + $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value($registration, $question->ID()); |
|
| 38 | + $answer = $registration->reg_url_link() || ! $answer_value ? EEM_Answer::instance()->get_one(array(array('QST_ID'=>$question->ID(), 'REG_ID'=>$registration->ID()))) : NULL; |
|
| 39 | 39 | // if NOT returning to edit an existing registration OR if this question is for an attendee property OR we still don't have an EE_Answer object |
| 40 | - if( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer ) { |
|
| 40 | + if ( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer) { |
|
| 41 | 41 | // create an EE_Answer object for storing everything in |
| 42 | - $answer = EE_Answer::new_instance ( array( |
|
| 42 | + $answer = EE_Answer::new_instance(array( |
|
| 43 | 43 | 'QST_ID'=> $question->ID(), |
| 44 | 44 | 'REG_ID'=> $registration->ID() |
| 45 | 45 | )); |
| 46 | 46 | } |
| 47 | 47 | // verify instance |
| 48 | - if( $answer instanceof EE_Answer ){ |
|
| 49 | - if ( ! empty( $answer_value )) { |
|
| 50 | - $answer->set( 'ANS_value', $answer_value ); |
|
| 48 | + if ($answer instanceof EE_Answer) { |
|
| 49 | + if ( ! empty($answer_value)) { |
|
| 50 | + $answer->set('ANS_value', $answer_value); |
|
| 51 | 51 | } |
| 52 | - $answer->cache( 'Question', $question ); |
|
| 53 | - $answer_cache_id =$question->system_ID() != NULL ? $question->system_ID() . '-' . $registration->reg_url_link() : $question->ID() . '-' . $registration->reg_url_link(); |
|
| 54 | - $registration->cache( 'Answer', $answer, $answer_cache_id ); |
|
| 52 | + $answer->cache('Question', $question); |
|
| 53 | + $answer_cache_id = $question->system_ID() != NULL ? $question->system_ID().'-'.$registration->reg_url_link() : $question->ID().'-'.$registration->reg_url_link(); |
|
| 54 | + $registration->cache('Answer', $answer, $answer_cache_id); |
|
| 55 | 55 | } |
| 56 | - $form_args['subsections'][] = new EE_Question_Answer_Form_Section( $registration, $question, $answer ); |
|
| 57 | - parent::__construct( $form_args ); |
|
| 56 | + $form_args['subsections'][] = new EE_Question_Answer_Form_Section($registration, $question, $answer); |
|
| 57 | + parent::__construct($form_args); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | |
@@ -1,16 +1,16 @@ |
||
| 1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
| 2 | 2 | /** |
| 3 | - * |
|
| 4 | - * Class EE_Registration_Question_Group_Reg_Form |
|
| 5 | - * |
|
| 6 | - * For auto-generating form sections for an EE_Transaction |
|
| 7 | - * |
|
| 8 | - * @package Event Espresso |
|
| 9 | - * @subpackage core |
|
| 10 | - * @author Brent Christensen |
|
| 11 | - * @since 4.5.0 |
|
| 12 | - * |
|
| 13 | - */ |
|
| 3 | + * |
|
| 4 | + * Class EE_Registration_Question_Group_Reg_Form |
|
| 5 | + * |
|
| 6 | + * For auto-generating form sections for an EE_Transaction |
|
| 7 | + * |
|
| 8 | + * @package Event Espresso |
|
| 9 | + * @subpackage core |
|
| 10 | + * @author Brent Christensen |
|
| 11 | + * @since 4.5.0 |
|
| 12 | + * |
|
| 13 | + */ |
|
| 14 | 14 | |
| 15 | 15 | class EE_Registration_Question_Group_Reg_Form extends EE_Form_Section_Proper { |
| 16 | 16 | |
@@ -20,15 +20,15 @@ discard block |
||
| 20 | 20 | * @param EE_Question_Group $question_group |
| 21 | 21 | * @return EE_Registration_Question_Group_Reg_Form |
| 22 | 22 | */ |
| 23 | - public function __construct( EE_Registration $registration, EE_Question_Group $question_group ){ |
|
| 23 | + public function __construct(EE_Registration $registration, EE_Question_Group $question_group) { |
|
| 24 | 24 | // array of params to pass to parent constructor |
| 25 | 25 | $form_args = array( |
| 26 | 26 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
| 27 | 27 | 'subsections' => array(), |
| 28 | 28 | 'name' => $question_group->identifier(), |
| 29 | - 'html_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier(), |
|
| 29 | + 'html_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier(), |
|
| 30 | 30 | 'html_class' => 'ee-reg-form-qstn-grp-dv', |
| 31 | - 'html_label_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-lbl' |
|
| 31 | + 'html_label_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-lbl' |
|
| 32 | 32 | ); |
| 33 | 33 | |
| 34 | 34 | $questions = $question_group->get_many_related( |
@@ -37,20 +37,20 @@ discard block |
||
| 37 | 37 | array( |
| 38 | 38 | // where params |
| 39 | 39 | 'QST_deleted' => 0, |
| 40 | - 'QST_admin_only' => is_admin() ? 1 :0 |
|
| 40 | + 'QST_admin_only' => is_admin() ? 1 : 0 |
|
| 41 | 41 | ), |
| 42 | 42 | 'order_by'=>array( |
| 43 | 43 | 'Question_Group_Question.QGQ_order' =>'ASC' |
| 44 | 44 | ) |
| 45 | 45 | ) |
| 46 | 46 | ); |
| 47 | - foreach ( $questions as $question ) { |
|
| 48 | - if( $question instanceof EE_Question ){ |
|
| 49 | - $form_args['subsections'][] = $this->_reg_form_question( $registration, $question ); |
|
| 47 | + foreach ($questions as $question) { |
|
| 48 | + if ($question instanceof EE_Question) { |
|
| 49 | + $form_args['subsections'][] = $this->_reg_form_question($registration, $question); |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | // d( $form_args ); |
| 53 | - parent::__construct( $form_args ); |
|
| 53 | + parent::__construct($form_args); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -59,29 +59,29 @@ discard block |
||
| 59 | 59 | * @param EE_Question $question |
| 60 | 60 | * @return EE_Form_Input_Base |
| 61 | 61 | */ |
| 62 | - public function _reg_form_question( EE_Registration $registration, EE_Question $question ){ |
|
| 62 | + public function _reg_form_question(EE_Registration $registration, EE_Question $question) { |
|
| 63 | 63 | |
| 64 | 64 | // if this question was for an attendee detail, then check for that answer |
| 65 | - $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value( $registration, $question->ID() ); |
|
| 66 | - $answer = $registration->reg_url_link() || ! $answer_value ? EEM_Answer::instance()->get_one( array( array( 'QST_ID'=>$question->ID(), 'REG_ID'=>$registration->ID() ))) : NULL; |
|
| 65 | + $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value($registration, $question->ID()); |
|
| 66 | + $answer = $registration->reg_url_link() || ! $answer_value ? EEM_Answer::instance()->get_one(array(array('QST_ID'=>$question->ID(), 'REG_ID'=>$registration->ID()))) : NULL; |
|
| 67 | 67 | // if NOT returning to edit an existing registration OR if this question is for an attendee property OR we still don't have an EE_Answer object |
| 68 | - if( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer ) { |
|
| 68 | + if ( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer) { |
|
| 69 | 69 | // create an EE_Answer object for storing everything in |
| 70 | - $answer = EE_Answer::new_instance ( array( |
|
| 70 | + $answer = EE_Answer::new_instance(array( |
|
| 71 | 71 | 'QST_ID'=> $question->ID(), |
| 72 | 72 | 'REG_ID'=> $registration->ID() |
| 73 | 73 | )); |
| 74 | 74 | } |
| 75 | 75 | // verify instance |
| 76 | - if( $answer instanceof EE_Answer ){ |
|
| 77 | - if ( ! empty( $answer_value )) { |
|
| 78 | - $answer->set( 'ANS_value', $answer_value ); |
|
| 76 | + if ($answer instanceof EE_Answer) { |
|
| 77 | + if ( ! empty($answer_value)) { |
|
| 78 | + $answer->set('ANS_value', $answer_value); |
|
| 79 | 79 | } |
| 80 | - $answer->cache( 'Question', $question ); |
|
| 81 | - $answer_cache_id =$question->system_ID() != NULL ? $question->system_ID() . '-' . $registration->reg_url_link() : $question->ID() . '-' . $registration->reg_url_link(); |
|
| 82 | - $registration->cache( 'Answer', $answer, $answer_cache_id ); |
|
| 80 | + $answer->cache('Question', $question); |
|
| 81 | + $answer_cache_id = $question->system_ID() != NULL ? $question->system_ID().'-'.$registration->reg_url_link() : $question->ID().'-'.$registration->reg_url_link(); |
|
| 82 | + $registration->cache('Answer', $answer, $answer_cache_id); |
|
| 83 | 83 | } |
| 84 | - return $this->_generate_question_input( $registration, $question, $answer ); |
|
| 84 | + return $this->_generate_question_input($registration, $question, $answer); |
|
| 85 | 85 | |
| 86 | 86 | } |
| 87 | 87 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @param mixed EE_Answer|NULL $answer |
| 94 | 94 | * @return EE_Form_Input_Base |
| 95 | 95 | */ |
| 96 | - public function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){ |
|
| 96 | + public function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer) { |
|
| 97 | 97 | // d( $registration ); |
| 98 | 98 | // d( $question ); |
| 99 | 99 | // d( $answer ); |
@@ -115,22 +115,22 @@ discard block |
||
| 115 | 115 | // raw_value; |
| 116 | 116 | $input_constructor_args = array( |
| 117 | 117 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
| 118 | - 'name' => $registration->reg_url_link() . '-' . $question->ID(), |
|
| 119 | - 'html_name' => 'ee_reg_qstn[' . $registration->reg_url_link() . '][' . $question->ID() . ']', |
|
| 120 | - 'html_id' => 'ee-reg-qstn-' . $registration->reg_url_link() . '-' . $question->ID(), |
|
| 118 | + 'name' => $registration->reg_url_link().'-'.$question->ID(), |
|
| 119 | + 'html_name' => 'ee_reg_qstn['.$registration->reg_url_link().']['.$question->ID().']', |
|
| 120 | + 'html_id' => 'ee-reg-qstn-'.$registration->reg_url_link().'-'.$question->ID(), |
|
| 121 | 121 | 'html_class' => 'ee-reg-qstn', |
| 122 | 122 | 'required' => $question->required(), |
| 123 | - 'html_label_id' => 'ee-reg-qstn-' . $registration->reg_url_link() . '-' . $question->ID() . '-lbl', |
|
| 123 | + 'html_label_id' => 'ee-reg-qstn-'.$registration->reg_url_link().'-'.$question->ID().'-lbl', |
|
| 124 | 124 | 'html_label_class' => 'ee-reg-qstn-lbl', |
| 125 | 125 | 'html_label_text' => $question->display_text() |
| 126 | 126 | ); |
| 127 | 127 | |
| 128 | - if ( $answer instanceof EE_Answer ) { |
|
| 129 | - $input_constructor_args['html_name'] .= '[' . $answer->ID() . ']'; |
|
| 128 | + if ($answer instanceof EE_Answer) { |
|
| 129 | + $input_constructor_args['html_name'] .= '['.$answer->ID().']'; |
|
| 130 | 130 | $input_constructor_args['default'] .= $answer->value(); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - switch ( $question->type() ) { |
|
| 133 | + switch ($question->type()) { |
|
| 134 | 134 | // Text |
| 135 | 135 | case EEM_Question::QST_type_text : |
| 136 | 136 | $input_class = 'EE_Text_Input'; |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | break; |
| 158 | 158 | } |
| 159 | 159 | // d( $input_constructor_args ); |
| 160 | - return new $input_class( $input_constructor_args ); |
|
| 160 | + return new $input_class($input_constructor_args); |
|
| 161 | 161 | |
| 162 | 162 | } |
| 163 | 163 | |
@@ -1,16 +1,16 @@ |
||
| 1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
| 2 | 2 | /** |
| 3 | - * |
|
| 4 | - * Class EE_Registration_Reg_Form |
|
| 5 | - * |
|
| 6 | - * For auto-generating form sections for an EE_Transaction |
|
| 7 | - * |
|
| 8 | - * @package Event Espresso |
|
| 9 | - * @subpackage core |
|
| 10 | - * @author Brent Christensen |
|
| 11 | - * @since 4.5.0 |
|
| 12 | - * |
|
| 13 | - */ |
|
| 3 | + * |
|
| 4 | + * Class EE_Registration_Reg_Form |
|
| 5 | + * |
|
| 6 | + * For auto-generating form sections for an EE_Transaction |
|
| 7 | + * |
|
| 8 | + * @package Event Espresso |
|
| 9 | + * @subpackage core |
|
| 10 | + * @author Brent Christensen |
|
| 11 | + * @since 4.5.0 |
|
| 12 | + * |
|
| 13 | + */ |
|
| 14 | 14 | |
| 15 | 15 | class EE_Registration_Reg_Form extends EE_Form_Section_Proper { |
| 16 | 16 | |
@@ -20,35 +20,35 @@ |
||
| 20 | 20 | * @param EE_SPCO_Reg_Step $reg_step |
| 21 | 21 | * @return EE_Registration_Reg_Form |
| 22 | 22 | */ |
| 23 | - public function __construct( EE_Registration $registration, EE_SPCO_Reg_Step $reg_step ){ |
|
| 23 | + public function __construct(EE_Registration $registration, EE_SPCO_Reg_Step $reg_step) { |
|
| 24 | 24 | // array of params to pass to parent constructor |
| 25 | 25 | $form_args = array( |
| 26 | 26 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
| 27 | 27 | 'subsections' => array(), |
| 28 | 28 | 'name' => $registration->reg_url_link(), |
| 29 | - 'html_id' => 'ee-registration-' . $registration->reg_url_link() |
|
| 29 | + 'html_id' => 'ee-registration-'.$registration->reg_url_link() |
|
| 30 | 30 | ); |
| 31 | 31 | |
| 32 | 32 | // verify that registration has valid event |
| 33 | - if ( $registration->event() instanceof EE_Event ) { |
|
| 33 | + if ($registration->event() instanceof EE_Event) { |
|
| 34 | 34 | $query_params = array( |
| 35 | 35 | array( |
| 36 | 36 | 'Event.EVT_ID' => $registration->event()->ID(), |
| 37 | 37 | 'Event_Question_Group.EQG_primary' => $registration->count() == 1 ? TRUE : FALSE |
| 38 | 38 | ), |
| 39 | - 'order_by'=>array( 'QSG_order'=>'ASC' ) |
|
| 39 | + 'order_by'=>array('QSG_order'=>'ASC') |
|
| 40 | 40 | ); |
| 41 | - $question_groups = $registration->event()->question_groups( $query_params ); |
|
| 42 | - if ( $question_groups ) { |
|
| 43 | - foreach ( $question_groups as $question_group ) { |
|
| 44 | - if ( $question_group instanceof EE_Question_Group ) { |
|
| 45 | - $form_args['subsections'][] = new EE_Registration_Question_Group_Reg_Form( $registration, $question_group ); |
|
| 41 | + $question_groups = $registration->event()->question_groups($query_params); |
|
| 42 | + if ($question_groups) { |
|
| 43 | + foreach ($question_groups as $question_group) { |
|
| 44 | + if ($question_group instanceof EE_Question_Group) { |
|
| 45 | + $form_args['subsections'][] = new EE_Registration_Question_Group_Reg_Form($registration, $question_group); |
|
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | // d( $form_args ); |
| 51 | - parent::__construct( $form_args ); |
|
| 51 | + parent::__construct($form_args); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | |
@@ -26,31 +26,31 @@ discard block |
||
| 26 | 26 | * @param EE_Form_Input_Base $input |
| 27 | 27 | * @return string |
| 28 | 28 | */ |
| 29 | - public function layout_input( $input ) { |
|
| 29 | + public function layout_input($input) { |
|
| 30 | 30 | $html = ''; |
| 31 | - if ( $input instanceof EE_Hidden_Input ) { |
|
| 32 | - $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
| 33 | - } else if ( $input instanceof EE_Submit_Input ) { |
|
| 31 | + if ($input instanceof EE_Hidden_Input) { |
|
| 32 | + $html .= EEH_HTML::nl().$input->get_html_for_input(); |
|
| 33 | + } else if ($input instanceof EE_Submit_Input) { |
|
| 34 | 34 | $html .= EEH_HTML::br(); |
| 35 | 35 | $html .= $input->get_html_for_input(); |
| 36 | - } else if ( $input instanceof EE_Select_Input ) { |
|
| 36 | + } else if ($input instanceof EE_Select_Input) { |
|
| 37 | 37 | $html .= EEH_HTML::br(); |
| 38 | - $html .= EEH_HTML::nl(1) . $input->get_html_for_label(); |
|
| 39 | - $html .= EEH_HTML::nl() . $input->get_html_for_errors(); |
|
| 40 | - $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
| 41 | - $html .= EEH_HTML::nl() . $input->get_html_for_help(); |
|
| 38 | + $html .= EEH_HTML::nl(1).$input->get_html_for_label(); |
|
| 39 | + $html .= EEH_HTML::nl().$input->get_html_for_errors(); |
|
| 40 | + $html .= EEH_HTML::nl().$input->get_html_for_input(); |
|
| 41 | + $html .= EEH_HTML::nl().$input->get_html_for_help(); |
|
| 42 | 42 | $html .= EEH_HTML::br(); |
| 43 | - } else if ( $input instanceof EE_Form_Input_With_Options_Base ) { |
|
| 43 | + } else if ($input instanceof EE_Form_Input_With_Options_Base) { |
|
| 44 | 44 | $html .= EEH_HTML::br(); |
| 45 | - $html .= EEH_HTML::nl() . $input->get_html_for_errors(); |
|
| 46 | - $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
| 47 | - $html .= EEH_HTML::nl() . $input->get_html_for_help(); |
|
| 45 | + $html .= EEH_HTML::nl().$input->get_html_for_errors(); |
|
| 46 | + $html .= EEH_HTML::nl().$input->get_html_for_input(); |
|
| 47 | + $html .= EEH_HTML::nl().$input->get_html_for_help(); |
|
| 48 | 48 | } else { |
| 49 | 49 | $html .= EEH_HTML::br(); |
| 50 | - $html .= EEH_HTML::nl(1) . $input->get_html_for_label(); |
|
| 51 | - $html .= EEH_HTML::nl() . $input->get_html_for_errors(); |
|
| 52 | - $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
| 53 | - $html .= EEH_HTML::nl() . $input->get_html_for_help(); |
|
| 50 | + $html .= EEH_HTML::nl(1).$input->get_html_for_label(); |
|
| 51 | + $html .= EEH_HTML::nl().$input->get_html_for_errors(); |
|
| 52 | + $html .= EEH_HTML::nl().$input->get_html_for_input(); |
|
| 53 | + $html .= EEH_HTML::nl().$input->get_html_for_help(); |
|
| 54 | 54 | } |
| 55 | 55 | return $html; |
| 56 | 56 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | * closing div tag for a form |
| 59 | 59 | * @return string |
| 60 | 60 | */ |
| 61 | - public function layout_form_end(){ |
|
| 61 | + public function layout_form_end() { |
|
| 62 | 62 | return ''; |
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | \ No newline at end of file |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
| 4 | 4 | exit('NO direct script access allowed'); |
| 5 | 5 | |
| 6 | 6 | /** |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * For the constructor of this special preview class. We're either looking for an event id or empty data. If we have an event id (or ids) then we'll use that as the source for the "dummy" data. If the data is empty then we'll get the first three published events from the users database and use that as a source. |
| 43 | 43 | * @param array $data |
| 44 | 44 | */ |
| 45 | - public function __construct( $data = array() ) { |
|
| 45 | + public function __construct($data = array()) { |
|
| 46 | 46 | |
| 47 | 47 | $data = empty($data) ? array() : $data['event_ids']; |
| 48 | 48 | $this->_setup_attendees_events(); |
@@ -65,8 +65,8 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | $answers_n_questions = $this->_get_some_q_and_as(); |
| 67 | 67 | |
| 68 | - if ( count( $events ) < 1 ) { |
|
| 69 | - throw new EE_Error( __('We can\'t generate a preview for you because there are no active events in your database', 'event_espresso' ) ); |
|
| 68 | + if (count($events) < 1) { |
|
| 69 | + throw new EE_Error(__('We can\'t generate a preview for you because there are no active events in your database', 'event_espresso')); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | |
@@ -76,11 +76,11 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | //we'll actually use the generated line_item identifiers for our loop |
| 78 | 78 | $dtts = array(); |
| 79 | - foreach( $events as $id => $event ) { |
|
| 79 | + foreach ($events as $id => $event) { |
|
| 80 | 80 | $this->_events[$id]['ID'] = $id; |
| 81 | 81 | $this->_events[$id]['name'] = $event->get('EVT_name'); |
| 82 | 82 | $datetime = $event->get_first_related('Datetime'); |
| 83 | - $tickets = $datetime instanceof EE_Datetime ? $datetime->get_many_related('Ticket', array('default_where_conditions' => 'none') ) : array(); |
|
| 83 | + $tickets = $datetime instanceof EE_Datetime ? $datetime->get_many_related('Ticket', array('default_where_conditions' => 'none')) : array(); |
|
| 84 | 84 | $this->_events[$id]['event'] = $event; |
| 85 | 85 | $this->_events[$id]['reg_objs'] = array(); |
| 86 | 86 | $this->_events[$id]['tkt_objs'] = $tickets; |
@@ -88,15 +88,15 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | $dttcache = array(); |
| 90 | 90 | $tkts = array(); |
| 91 | - foreach ( $tickets as $ticket ) { |
|
| 91 | + foreach ($tickets as $ticket) { |
|
| 92 | 92 | $tkts[$ticket->ID()]['ticket'] = $ticket; |
| 93 | 93 | $reldatetime = $ticket->datetimes(); |
| 94 | 94 | $tkts[$ticket->ID()]['dtt_objs'] = $reldatetime; |
| 95 | 95 | $tkts[$ticket->ID()]['att_objs'] = $attendees; |
| 96 | 96 | $tkts[$ticket->ID()]['count'] = count($attendees); |
| 97 | 97 | $tkts[$ticket->ID()]['EE_Event'] = $event; |
| 98 | - foreach ( $reldatetime as $datetime ) { |
|
| 99 | - if ( !isset( $dtts[$datetime->ID()] ) ) { |
|
| 98 | + foreach ($reldatetime as $datetime) { |
|
| 99 | + if ( ! isset($dtts[$datetime->ID()])) { |
|
| 100 | 100 | $this->_events[$id]['dtt_objs'][$datetime->ID()] = $datetime; |
| 101 | 101 | $dtts[$datetime->ID()]['datetime'] = $datetime; |
| 102 | 102 | $dtts[$datetime->ID()]['tkt_objs'][] = $ticket; |
@@ -106,26 +106,26 @@ discard block |
||
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - $this->_events[$id]['total_attendees'] = count( $attendees ); |
|
| 109 | + $this->_events[$id]['total_attendees'] = count($attendees); |
|
| 110 | 110 | $this->_events[$id]['att_objs'] = $attendees; |
| 111 | 111 | |
| 112 | 112 | //let's also setup the dummy attendees property! |
| 113 | - foreach ( $attendees as $att_key => $attendee ) { |
|
| 114 | - $this->_attendees[$att_key]['line_ref'][] = $id; //so later it can be determined what events this attendee registered for! |
|
| 113 | + foreach ($attendees as $att_key => $attendee) { |
|
| 114 | + $this->_attendees[$att_key]['line_ref'][] = $id; //so later it can be determined what events this attendee registered for! |
|
| 115 | 115 | $this->_attendees[$att_key]['evt_objs'][] = $event; |
| 116 | 116 | $this->_attendees[$att_key]['att_obj'] = $attendee; |
| 117 | 117 | //$this->_attendees[$att_key]['registration_id'] = 0; |
| 118 | 118 | $this->_attendees[$att_key]['attendee_email'] = $attendee->email(); |
| 119 | 119 | $this->_attendees[$att_key]['tkt_objs'] = $tickets; |
| 120 | - if ( $att_key == 999999991 ) { |
|
| 120 | + if ($att_key == 999999991) { |
|
| 121 | 121 | $this->_attendees[$att_key]['ans_objs'][999] = $answers_n_questions['answers'][999]; |
| 122 | 122 | $this->_attendees[$att_key]['ans_objs'][1002] = $answers_n_questions['answers'][1002]; |
| 123 | 123 | $this->_attendees[$att_key]['ans_objs'][1005] = $answers_n_questions['answers'][1005]; |
| 124 | - } elseif ( $att_key == 999999992 ) { |
|
| 124 | + } elseif ($att_key == 999999992) { |
|
| 125 | 125 | $this->_attendees[$att_key]['ans_objs'][1000] = $answers_n_questions['answers'][1000]; |
| 126 | 126 | $this->_attendees[$att_key]['ans_objs'][1003] = $answers_n_questions['answers'][1003]; |
| 127 | 127 | $this->_attendees[$att_key]['ans_objs'][1006] = $answers_n_questions['answers'][1006]; |
| 128 | - } elseif ( $att_key == 999999993 ) { |
|
| 128 | + } elseif ($att_key == 999999993) { |
|
| 129 | 129 | $this->_attendees[$att_key]['ans_objs'][1001] = $answers_n_questions['answers'][1001]; |
| 130 | 130 | $this->_attendees[$att_key]['ans_objs'][1004] = $answers_n_questions['answers'][1004]; |
| 131 | 131 | $this->_attendees[$att_key]['ans_objs'][1007] = $answers_n_questions['answers'][1007]; |
@@ -198,11 +198,11 @@ discard block |
||
| 198 | 198 | |
| 199 | 199 | //let's generate the attendee objects |
| 200 | 200 | $attendees = array(); |
| 201 | - $var_array = array('fname','lname','email','address','address2','city','staid','cntry','zip','phone','deleted','attid'); |
|
| 201 | + $var_array = array('fname', 'lname', 'email', 'address', 'address2', 'city', 'staid', 'cntry', 'zip', 'phone', 'deleted', 'attid'); |
|
| 202 | 202 | |
| 203 | - EE_Registry::instance()->load_class( 'Attendee', array(), FALSE, TRUE, TRUE ); |
|
| 204 | - foreach ( $dummy_attendees as $dummy ) { |
|
| 205 | - $att = array_combine( $var_array, $dummy ); |
|
| 203 | + EE_Registry::instance()->load_class('Attendee', array(), FALSE, TRUE, TRUE); |
|
| 204 | + foreach ($dummy_attendees as $dummy) { |
|
| 205 | + $att = array_combine($var_array, $dummy); |
|
| 206 | 206 | extract($att); |
| 207 | 207 | $attendees[$attid] = EE_Attendee::new_instance( |
| 208 | 208 | array( |
@@ -303,19 +303,19 @@ discard block |
||
| 303 | 303 | $qst_columns = array('QST_ID', 'QST_display_text', 'QST_system'); |
| 304 | 304 | $ans_columns = array('ANS_ID', 'QST_ID', 'ANS_value'); |
| 305 | 305 | |
| 306 | - EE_Registry::instance()->load_class( 'Question', array(), FALSE, TRUE, TRUE ); |
|
| 307 | - EE_Registry::instance()->load_class( 'Answer', array(), FALSE, TRUE, TRUE ); |
|
| 306 | + EE_Registry::instance()->load_class('Question', array(), FALSE, TRUE, TRUE); |
|
| 307 | + EE_Registry::instance()->load_class('Answer', array(), FALSE, TRUE, TRUE); |
|
| 308 | 308 | |
| 309 | 309 | //first the questions |
| 310 | - foreach ( $quests_array as $qst ) { |
|
| 311 | - $qstobj = array_combine( $qst_columns, $qst ); |
|
| 310 | + foreach ($quests_array as $qst) { |
|
| 311 | + $qstobj = array_combine($qst_columns, $qst); |
|
| 312 | 312 | $qsts[$qstobj['QST_ID']] = EE_Question::new_instance($qstobj); |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | //now the answers (and we'll setup our arrays) |
| 316 | 316 | $q_n_as = array(); |
| 317 | - foreach ( $ans_array as $ans ) { |
|
| 318 | - $ansobj = array_combine( $ans_columns, $ans ); |
|
| 317 | + foreach ($ans_array as $ans) { |
|
| 318 | + $ansobj = array_combine($ans_columns, $ans); |
|
| 319 | 319 | $ansobj = EE_Answer::new_instance($ansobj); |
| 320 | 320 | $q_n_as['answers'][$ansobj->ID()] = $ansobj; |
| 321 | 321 | $q_n_as['questions'][$ansobj->ID()] = $qsts[$ansobj->get('QST_ID')]; |
@@ -337,17 +337,17 @@ discard block |
||
| 337 | 337 | * @param array $event_ids if set, this will be an array of event ids to obtain events for. |
| 338 | 338 | * @return array An array of event objects from the db. |
| 339 | 339 | */ |
| 340 | - private function _get_some_events( $event_ids = array() ) { |
|
| 340 | + private function _get_some_events($event_ids = array()) { |
|
| 341 | 341 | global $wpdb; |
| 342 | 342 | |
| 343 | 343 | //HEY, if we have an evt_id then we want to make sure we use that for the preview (because a specific event template is being viewed); |
| 344 | - $event_ids = isset( $_REQUEST['evt_id'] ) && !empty($_REQUEST['evt_id'] ) ? array( $_REQUEST['evt_id'] ) : array(); |
|
| 344 | + $event_ids = isset($_REQUEST['evt_id']) && ! empty($_REQUEST['evt_id']) ? array($_REQUEST['evt_id']) : array(); |
|
| 345 | 345 | |
| 346 | - $limit = !empty( $event_ids ) ? NULL : apply_filters( 'FHEE__EE_Messages_Preview_incoming_data___get_some_events__limit', '0,1' ); |
|
| 346 | + $limit = ! empty($event_ids) ? NULL : apply_filters('FHEE__EE_Messages_Preview_incoming_data___get_some_events__limit', '0,1'); |
|
| 347 | 347 | |
| 348 | - $where = !empty($event_ids) ? array('EVT_ID' => array( 'IN', $event_ids ), 'Datetime.Ticket.TKT_ID' => array('>', 1) ) : array('Datetime.Ticket.TKT_ID' => array('>', 1) ); |
|
| 348 | + $where = ! empty($event_ids) ? array('EVT_ID' => array('IN', $event_ids), 'Datetime.Ticket.TKT_ID' => array('>', 1)) : array('Datetime.Ticket.TKT_ID' => array('>', 1)); |
|
| 349 | 349 | |
| 350 | - $events = EE_Registry::instance()->load_model('Event')->get_all(array($where, 'limit' => $limit ) ); |
|
| 350 | + $events = EE_Registry::instance()->load_model('Event')->get_all(array($where, 'limit' => $limit)); |
|
| 351 | 351 | |
| 352 | 352 | return $events; |
| 353 | 353 | } |
@@ -361,13 +361,13 @@ discard block |
||
| 361 | 361 | |
| 362 | 362 | //need to figure out the running total for test purposes so... we're going to create a temp cart and add the tickets to it! |
| 363 | 363 | |
| 364 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
| 364 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
| 365 | 365 | |
| 366 | 366 | $cart = EE_Cart::instance(); |
| 367 | 367 | |
| 368 | 368 | |
| 369 | 369 | //add tickets to cart |
| 370 | - foreach ( $this->tickets as $ticket ) { |
|
| 370 | + foreach ($this->tickets as $ticket) { |
|
| 371 | 371 | $cart->add_ticket_to_cart($ticket['ticket']); |
| 372 | 372 | } |
| 373 | 373 | |
@@ -391,13 +391,13 @@ discard block |
||
| 391 | 391 | //note we're setting up a reg object for each attendee in each event but ALSO adding to the reg_object array. |
| 392 | 392 | $this->reg_objs = array(); |
| 393 | 393 | $regid = 9999990; |
| 394 | - foreach ( $this->_attendees as $key => $attendee ) { |
|
| 394 | + foreach ($this->_attendees as $key => $attendee) { |
|
| 395 | 395 | //note we need to setup reg_objects for each event this attendee belongs to |
| 396 | 396 | $regatt = $attendee['att_obj']->ID(); |
| 397 | 397 | $regtxn = $this->txn->ID(); |
| 398 | 398 | $regcnt = 1; |
| 399 | - foreach ( $attendee['line_ref'] as $evtid ) { |
|
| 400 | - foreach ( $this->_events[$evtid]['tkt_objs'] as $ticket ) { |
|
| 399 | + foreach ($attendee['line_ref'] as $evtid) { |
|
| 400 | + foreach ($this->_events[$evtid]['tkt_objs'] as $ticket) { |
|
| 401 | 401 | $reg_array = array( |
| 402 | 402 | 'EVT_ID' => $evtid, |
| 403 | 403 | 'ATT_ID' => $regatt, |
@@ -407,14 +407,14 @@ discard block |
||
| 407 | 407 | 'REG_date' => current_time('mysql'), |
| 408 | 408 | 'REG_final_price' => $ticket->get('TKT_price'), |
| 409 | 409 | 'REG_session' => 'dummy_session_id', |
| 410 | - 'REG_code' => $regid . '-dummy-generated-code', |
|
| 411 | - 'REG_url_link' => $regcnt . '-daafpapasdlfakasdfpqasdfasdf', |
|
| 410 | + 'REG_code' => $regid.'-dummy-generated-code', |
|
| 411 | + 'REG_url_link' => $regcnt.'-daafpapasdlfakasdfpqasdfasdf', |
|
| 412 | 412 | 'REG_count' => $regcnt, |
| 413 | 413 | 'REG_group_size' => $this->_events[$evtid]['total_attendees'], |
| 414 | 414 | 'REG_att_is_going' => TRUE, |
| 415 | 415 | 'REG_ID' => $regid |
| 416 | 416 | ); |
| 417 | - $REG_OBJ = EE_Registration::new_instance( $reg_array ); |
|
| 417 | + $REG_OBJ = EE_Registration::new_instance($reg_array); |
|
| 418 | 418 | $this->_attendees[$key]['reg_objs'][$regid] = $REG_OBJ; |
| 419 | 419 | $this->_events[$evtid]['reg_objs'][] = $REG_OBJ; |
| 420 | 420 | $this->reg_objs[] = $REG_OBJ; |
@@ -430,35 +430,35 @@ discard block |
||
| 430 | 430 | |
| 431 | 431 | //setup line items! |
| 432 | 432 | EE_Registry::instance()->load_helper('Line_Item'); |
| 433 | - $line_item_total = EEH_Line_Item::create_default_total_line_item( $this->txn ); |
|
| 433 | + $line_item_total = EEH_Line_Item::create_default_total_line_item($this->txn); |
|
| 434 | 434 | |
| 435 | 435 | //add tickets |
| 436 | - foreach ( $this->tickets as $tktid => $item ) { |
|
| 436 | + foreach ($this->tickets as $tktid => $item) { |
|
| 437 | 437 | $qty = $item['count']; |
| 438 | 438 | $ticket = $item['ticket']; |
| 439 | - EEH_Line_Item::add_ticket_purchase( $line_item_total, $ticket, $qty ); |
|
| 439 | + EEH_Line_Item::add_ticket_purchase($line_item_total, $ticket, $qty); |
|
| 440 | 440 | } |
| 441 | 441 | |
| 442 | - $shipping_line_item = EE_Line_Item::new_instance( array( |
|
| 443 | - 'LIN_name' => __( 'Shipping Surcharge', 'event_espresso' ), |
|
| 444 | - 'LIN_desc' => __( 'Sent via Millenium Falcon', 'event_espresso' ), |
|
| 442 | + $shipping_line_item = EE_Line_Item::new_instance(array( |
|
| 443 | + 'LIN_name' => __('Shipping Surcharge', 'event_espresso'), |
|
| 444 | + 'LIN_desc' => __('Sent via Millenium Falcon', 'event_espresso'), |
|
| 445 | 445 | 'LIN_unit_price' => 20, |
| 446 | 446 | 'LIN_quantity' => 1, |
| 447 | 447 | 'LIN_is_taxable' => TRUE, |
| 448 | 448 | 'LIN_total' => 20, |
| 449 | 449 | 'LIN_type' => EEM_Line_Item::type_line_item |
| 450 | 450 | )); |
| 451 | - EEH_Line_Item::add_item($line_item_total, $shipping_line_item ); |
|
| 452 | - $this->additional_line_items = array( $shipping_line_item ); |
|
| 451 | + EEH_Line_Item::add_item($line_item_total, $shipping_line_item); |
|
| 452 | + $this->additional_line_items = array($shipping_line_item); |
|
| 453 | 453 | |
| 454 | 454 | //now let's add taxes |
| 455 | - EEH_Line_Item::apply_taxes( $line_item_total ); |
|
| 455 | + EEH_Line_Item::apply_taxes($line_item_total); |
|
| 456 | 456 | |
| 457 | 457 | //now we should be able to get the items we need from this object |
| 458 | - $ticket_line_items = EEH_Line_Item::get_items_subtotal( $line_item_total )->children(); |
|
| 458 | + $ticket_line_items = EEH_Line_Item::get_items_subtotal($line_item_total)->children(); |
|
| 459 | 459 | |
| 460 | - foreach ( $ticket_line_items as $line_id => $line_item ) { |
|
| 461 | - if( $line_item->OBJ_ID() && $line_item->OBJ_type() ){ |
|
| 460 | + foreach ($ticket_line_items as $line_id => $line_item) { |
|
| 461 | + if ($line_item->OBJ_ID() && $line_item->OBJ_type()) { |
|
| 462 | 462 | $this->tickets[$line_item->OBJ_ID()]['line_item'] = $line_item; |
| 463 | 463 | $this->tickets[$line_item->OBJ_ID()]['sub_line_items'] = $line_item->children(); |
| 464 | 464 | $line_items[$line_item->ID()]['children'] = $line_item->children(); |
@@ -472,11 +472,11 @@ discard block |
||
| 472 | 472 | //add proper total to transaction object. |
| 473 | 473 | $grand_total = $line_item_total->recalculate_total_including_taxes(); |
| 474 | 474 | $this->grand_total_line_item = $line_item_total; |
| 475 | - $this->txn->set_total( $grand_total ); |
|
| 475 | + $this->txn->set_total($grand_total); |
|
| 476 | 476 | |
| 477 | 477 | |
| 478 | 478 | //add additional details for each registration |
| 479 | - foreach ( $this->reg_objs as $reg ) { |
|
| 479 | + foreach ($this->reg_objs as $reg) { |
|
| 480 | 480 | $this->_registrations[$reg->ID()]['tkt_obj'] = $this->tickets[$reg->get('TKT_ID')]['ticket']; |
| 481 | 481 | $this->_registrations[$reg->ID()]['evt_obj'] = $this->_events[$reg->get('EVT_ID')]['event']; |
| 482 | 482 | $this->_registrations[$reg->ID()]['reg_obj'] = $reg; |
@@ -507,7 +507,7 @@ discard block |
||
| 507 | 507 | $this->reg_info = array(); |
| 508 | 508 | |
| 509 | 509 | //let's set a reg_obj for messengers expecting one. |
| 510 | - $this->reg_obj = array_pop( $this->_attendees[999999991]['reg_objs'] ); |
|
| 510 | + $this->reg_obj = array_pop($this->_attendees[999999991]['reg_objs']); |
|
| 511 | 511 | |
| 512 | 512 | |
| 513 | 513 | //the below are just dummy items. |
@@ -1,6 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
| 3 | 3 | exit('NO direct script access allowed'); |
| 4 | +} |
|
| 4 | 5 | |
| 5 | 6 | /** |
| 6 | 7 | * Event Espresso |
@@ -40,39 +40,39 @@ discard block |
||
| 40 | 40 | * |
| 41 | 41 | * @return void |
| 42 | 42 | */ |
| 43 | - public static function register( $cap_reference = NULL, $setup_args = array() ) { |
|
| 43 | + public static function register($cap_reference = NULL, $setup_args = array()) { |
|
| 44 | 44 | //required fields MUST be present, so let's make sure they are. |
| 45 | - if ( ! isset( $cap_reference ) || ! is_array( $setup_args ) || empty( $setup_args['capabilities'] ) ) { |
|
| 45 | + if ( ! isset($cap_reference) || ! is_array($setup_args) || empty($setup_args['capabilities'])) { |
|
| 46 | 46 | throw new EE_Error( |
| 47 | - __( 'In order to register capabilities with EE_Register_Capabilities::register, you must include a unique name to reference the capabilities being registered, plus an array containing the following keys: "capabilities".', 'event_espresso' ) |
|
| 47 | + __('In order to register capabilities with EE_Register_Capabilities::register, you must include a unique name to reference the capabilities being registered, plus an array containing the following keys: "capabilities".', 'event_espresso') |
|
| 48 | 48 | ); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | //make sure we don't register twice |
| 52 | - if( isset( self::$_registry[ $cap_reference ] ) ){ |
|
| 52 | + if (isset(self::$_registry[$cap_reference])) { |
|
| 53 | 53 | return; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | //make sure this is not registered too late or too early. |
| 57 | - if ( ! did_action( 'AHEE__EE_System__load_espresso_addons' ) || did_action( 'AHEE__EE_System___detect_if_activation_or_upgrade__begin' ) ) { |
|
| 58 | - EE_Error::doing_it_wrong( __METHOD__, sprintf( __('%s has been registered too late. Please ensure that EE_Register_Capabilities::register has been called at some point before the "AHEE__EE_System___detect_if_activation_or_upgrade__begin" action hook has been called.', 'event_espresso'), $cap_reference ), '4.5.0' ); |
|
| 57 | + if ( ! did_action('AHEE__EE_System__load_espresso_addons') || did_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin')) { |
|
| 58 | + EE_Error::doing_it_wrong(__METHOD__, sprintf(__('%s has been registered too late. Please ensure that EE_Register_Capabilities::register has been called at some point before the "AHEE__EE_System___detect_if_activation_or_upgrade__begin" action hook has been called.', 'event_espresso'), $cap_reference), '4.5.0'); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | //some preliminary sanitization and setting to the $_registry property |
| 62 | 62 | self::$_registry[$cap_reference] = array( |
| 63 | - 'caps' => isset( $setup_args['capabilities'] ) && is_array( $setup_args['capabilities'] ) ? $setup_args['capabilities'] : array(), |
|
| 64 | - 'cap_maps' => isset( $setup_args['capability_maps'] ) ? $setup_args['capability_maps'] : array() |
|
| 63 | + 'caps' => isset($setup_args['capabilities']) && is_array($setup_args['capabilities']) ? $setup_args['capabilities'] : array(), |
|
| 64 | + 'cap_maps' => isset($setup_args['capability_maps']) ? $setup_args['capability_maps'] : array() |
|
| 65 | 65 | ); |
| 66 | 66 | |
| 67 | 67 | |
| 68 | 68 | //set initial caps (note that EE_Capabilities takes care of making sure that the caps get added donly once) |
| 69 | - add_filter( 'FHEE__EE_Capabilities__init_caps_map__caps', array( 'EE_Register_Capabilities', 'register_capabilities' ), 10 ); |
|
| 69 | + add_filter('FHEE__EE_Capabilities__init_caps_map__caps', array('EE_Register_Capabilities', 'register_capabilities'), 10); |
|
| 70 | 70 | |
| 71 | 71 | //add filter for cap maps |
| 72 | - add_filter( 'FHEE__EE_Capabilities___set_meta_caps__meta_caps', array( 'EE_Register_Capabilities', 'register_cap_maps' ), 10 ); |
|
| 72 | + add_filter('FHEE__EE_Capabilities___set_meta_caps__meta_caps', array('EE_Register_Capabilities', 'register_cap_maps'), 10); |
|
| 73 | 73 | |
| 74 | 74 | //init_role_caps to register new capabilities |
| 75 | - if ( is_admin() ) { |
|
| 75 | + if (is_admin()) { |
|
| 76 | 76 | EE_Registry::instance()->load('Capabilities'); |
| 77 | 77 | EE_Capabilities::instance()->init_caps(); |
| 78 | 78 | } |
@@ -88,9 +88,9 @@ discard block |
||
| 88 | 88 | * |
| 89 | 89 | * @return array merged in new caps. |
| 90 | 90 | */ |
| 91 | - public static function register_capabilities( $incoming_caps ) { |
|
| 92 | - foreach ( self::$_registry as $ref => $caps_and_cap_map ) { |
|
| 93 | - $incoming_caps = array_merge_recursive( $incoming_caps, $caps_and_cap_map[ 'caps' ] ); |
|
| 91 | + public static function register_capabilities($incoming_caps) { |
|
| 92 | + foreach (self::$_registry as $ref => $caps_and_cap_map) { |
|
| 93 | + $incoming_caps = array_merge_recursive($incoming_caps, $caps_and_cap_map['caps']); |
|
| 94 | 94 | } |
| 95 | 95 | return $incoming_caps; |
| 96 | 96 | } |
@@ -106,22 +106,22 @@ discard block |
||
| 106 | 106 | * |
| 107 | 107 | * @return EE_Meta_Capability_Map[] |
| 108 | 108 | */ |
| 109 | - public static function register_cap_maps( $cap_maps ) { |
|
| 109 | + public static function register_cap_maps($cap_maps) { |
|
| 110 | 110 | //loop through and instantiate cap maps. |
| 111 | - foreach ( self::$_registry as $cap_reference => $setup ) { |
|
| 112 | - if ( ! isset( $setup['cap_maps'] ) ) { |
|
| 111 | + foreach (self::$_registry as $cap_reference => $setup) { |
|
| 112 | + if ( ! isset($setup['cap_maps'])) { |
|
| 113 | 113 | continue; |
| 114 | 114 | } |
| 115 | - foreach ( $setup['cap_maps'] as $cap_class => $args ) { |
|
| 116 | - if ( ! class_exists( $cap_class ) ) { |
|
| 117 | - throw new EE_Error( sprintf( __( 'An addon (%s) has tried to register a capability map improperly. Capability map arrays must be indexed by capability map classname, and an array for the class arguments', 'event_espresso' ), $cap_reference ) ); |
|
| 115 | + foreach ($setup['cap_maps'] as $cap_class => $args) { |
|
| 116 | + if ( ! class_exists($cap_class)) { |
|
| 117 | + throw new EE_Error(sprintf(__('An addon (%s) has tried to register a capability map improperly. Capability map arrays must be indexed by capability map classname, and an array for the class arguments', 'event_espresso'), $cap_reference)); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - if ( count( $args ) !== 2 ) { |
|
| 121 | - throw new EE_Error( sprintf( __('An addon (%s) has tried to register a capability map improperly. Capability map arrays must be indexed by capability map classname, and an array for the class arguments. The array should have two values the first being a string and the second an array.', 'event_espresso' ), $cap_reference ) ); |
|
| 120 | + if (count($args) !== 2) { |
|
| 121 | + throw new EE_Error(sprintf(__('An addon (%s) has tried to register a capability map improperly. Capability map arrays must be indexed by capability map classname, and an array for the class arguments. The array should have two values the first being a string and the second an array.', 'event_espresso'), $cap_reference)); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - $cap_maps[] = new $cap_class( $args[0], $args[1] ); |
|
| 124 | + $cap_maps[] = new $cap_class($args[0], $args[1]); |
|
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | return $cap_maps; |
@@ -130,8 +130,8 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | |
| 132 | 132 | |
| 133 | - public static function deregister( $cap_reference = NULL ) { |
|
| 134 | - if ( !empty( self::$_registry[$cap_reference] ) ) |
|
| 135 | - unset( self::$_registry[$cap_reference] ); |
|
| 133 | + public static function deregister($cap_reference = NULL) { |
|
| 134 | + if ( ! empty(self::$_registry[$cap_reference])) |
|
| 135 | + unset(self::$_registry[$cap_reference]); |
|
| 136 | 136 | } |
| 137 | 137 | } |
@@ -132,6 +132,6 @@ |
||
| 132 | 132 | |
| 133 | 133 | public static function deregister( $cap_reference = NULL ) { |
| 134 | 134 | if ( !empty( self::$_registry[$cap_reference] ) ) |
| 135 | - unset( self::$_registry[$cap_reference] ); |
|
| 135 | + unset( self::$_registry[$cap_reference] ); |
|
| 136 | 136 | } |
| 137 | 137 | } |
@@ -5,7 +5,9 @@ discard block |
||
| 5 | 5 | * @subpackage plugin api, capabilities |
| 6 | 6 | * @since 4.5.0 |
| 7 | 7 | */ |
| 8 | -if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
| 8 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 9 | + exit('No direct script access allowed'); |
|
| 10 | +} |
|
| 9 | 11 | |
| 10 | 12 | /** |
| 11 | 13 | * Use this to register new capabilities for the EE capabilities system. |
@@ -131,7 +133,8 @@ discard block |
||
| 131 | 133 | |
| 132 | 134 | |
| 133 | 135 | public static function deregister( $cap_reference = NULL ) { |
| 134 | - if ( !empty( self::$_registry[$cap_reference] ) ) |
|
| 135 | - unset( self::$_registry[$cap_reference] ); |
|
| 136 | + if ( !empty( self::$_registry[$cap_reference] ) ) { |
|
| 137 | + unset( self::$_registry[$cap_reference] ); |
|
| 138 | + } |
|
| 136 | 139 | } |
| 137 | 140 | } |