@@ -19,85 +19,85 @@ |
||
| 19 | 19 | { |
| 20 | 20 | |
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * _init_props |
|
| 24 | - * |
|
| 25 | - * @access protected |
|
| 26 | - * @return void |
|
| 27 | - */ |
|
| 28 | - protected function _init_props() |
|
| 29 | - { |
|
| 30 | - $this->label = esc_html__('Attendee Shortcodes', 'event_espresso'); |
|
| 31 | - $this->description = esc_html__('All shortcodes specific to attendee related data', 'event_espresso'); |
|
| 32 | - $this->_shortcodes = array( |
|
| 33 | - '[QUESTION]' => esc_html__('Will parse to a question.', 'event_espresso'), |
|
| 34 | - '[ANSWER]' => esc_html__('Will parse to the answer for a question', 'event_espresso'), |
|
| 35 | - ); |
|
| 36 | - } |
|
| 22 | + /** |
|
| 23 | + * _init_props |
|
| 24 | + * |
|
| 25 | + * @access protected |
|
| 26 | + * @return void |
|
| 27 | + */ |
|
| 28 | + protected function _init_props() |
|
| 29 | + { |
|
| 30 | + $this->label = esc_html__('Attendee Shortcodes', 'event_espresso'); |
|
| 31 | + $this->description = esc_html__('All shortcodes specific to attendee related data', 'event_espresso'); |
|
| 32 | + $this->_shortcodes = array( |
|
| 33 | + '[QUESTION]' => esc_html__('Will parse to a question.', 'event_espresso'), |
|
| 34 | + '[ANSWER]' => esc_html__('Will parse to the answer for a question', 'event_espresso'), |
|
| 35 | + ); |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * This method will give parsing instructions for each shortcode defined in the _shortcodes array. Child methods |
|
| 41 | - * will have to take care of handling. |
|
| 42 | - * |
|
| 43 | - * @access protected |
|
| 44 | - * |
|
| 45 | - * @param string $shortcode the shortcode to be parsed. |
|
| 46 | - * |
|
| 47 | - * @return string parsed shortcode |
|
| 48 | - */ |
|
| 49 | - protected function _parser($shortcode) |
|
| 50 | - { |
|
| 39 | + /** |
|
| 40 | + * This method will give parsing instructions for each shortcode defined in the _shortcodes array. Child methods |
|
| 41 | + * will have to take care of handling. |
|
| 42 | + * |
|
| 43 | + * @access protected |
|
| 44 | + * |
|
| 45 | + * @param string $shortcode the shortcode to be parsed. |
|
| 46 | + * |
|
| 47 | + * @return string parsed shortcode |
|
| 48 | + */ |
|
| 49 | + protected function _parser($shortcode) |
|
| 50 | + { |
|
| 51 | 51 | |
| 52 | - if (! $this->_data instanceof EE_Answer || ! isset($this->_extra_data['data']) || ! $this->_extra_data['data'] instanceof EE_Messages_Addressee) { |
|
| 53 | - return ''; |
|
| 54 | - } |
|
| 52 | + if (! $this->_data instanceof EE_Answer || ! isset($this->_extra_data['data']) || ! $this->_extra_data['data'] instanceof EE_Messages_Addressee) { |
|
| 53 | + return ''; |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - switch ($shortcode) { |
|
| 57 | - case '[QUESTION]': |
|
| 58 | - $question = isset($this->_extra_data['data']->questions[ $this->_data->ID() ]) |
|
| 59 | - ? $this->_extra_data['data']->questions[ $this->_data->ID() ] : $this->_data->question(); |
|
| 60 | - if (! $question instanceof EE_Question) { |
|
| 61 | - return ''; // get out because we can't figure out what the question is. |
|
| 62 | - } |
|
| 56 | + switch ($shortcode) { |
|
| 57 | + case '[QUESTION]': |
|
| 58 | + $question = isset($this->_extra_data['data']->questions[ $this->_data->ID() ]) |
|
| 59 | + ? $this->_extra_data['data']->questions[ $this->_data->ID() ] : $this->_data->question(); |
|
| 60 | + if (! $question instanceof EE_Question) { |
|
| 61 | + return ''; // get out because we can't figure out what the question is. |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - return $question->get('QST_display_text'); |
|
| 65 | - break; |
|
| 64 | + return $question->get('QST_display_text'); |
|
| 65 | + break; |
|
| 66 | 66 | |
| 67 | - case '[ANSWER]': |
|
| 68 | - // need to get the question to determine the type of question (some questions require translation of the answer). |
|
| 69 | - $question = isset($this->_extra_data['data']->questions[ $this->_data->ID() ]) |
|
| 70 | - ? $this->_extra_data['data']->questions[ $this->_data->ID() ] : $this->_data->question(); |
|
| 71 | - if (! $question instanceof EE_Question) { |
|
| 72 | - return ''; // get out cause we can't figure out what the question type is! |
|
| 73 | - } |
|
| 67 | + case '[ANSWER]': |
|
| 68 | + // need to get the question to determine the type of question (some questions require translation of the answer). |
|
| 69 | + $question = isset($this->_extra_data['data']->questions[ $this->_data->ID() ]) |
|
| 70 | + ? $this->_extra_data['data']->questions[ $this->_data->ID() ] : $this->_data->question(); |
|
| 71 | + if (! $question instanceof EE_Question) { |
|
| 72 | + return ''; // get out cause we can't figure out what the question type is! |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - // what we show for the answer depends on the question type! |
|
| 76 | - switch ($question->get('QST_type')) { |
|
| 77 | - case 'STATE': |
|
| 78 | - $state = EEM_State::instance()->get_one_by_ID($this->_data->get('ANS_value')); |
|
| 79 | - $answer = $state instanceof EE_State ? $state->name() : ''; |
|
| 80 | - break; |
|
| 75 | + // what we show for the answer depends on the question type! |
|
| 76 | + switch ($question->get('QST_type')) { |
|
| 77 | + case 'STATE': |
|
| 78 | + $state = EEM_State::instance()->get_one_by_ID($this->_data->get('ANS_value')); |
|
| 79 | + $answer = $state instanceof EE_State ? $state->name() : ''; |
|
| 80 | + break; |
|
| 81 | 81 | |
| 82 | - case 'COUNTRY': |
|
| 83 | - $country = EEM_Country::instance()->get_one_by_ID($this->_data->get('ANS_value')); |
|
| 84 | - $answer = $country instanceof EE_Country ? $country->name() : ''; |
|
| 85 | - break; |
|
| 82 | + case 'COUNTRY': |
|
| 83 | + $country = EEM_Country::instance()->get_one_by_ID($this->_data->get('ANS_value')); |
|
| 84 | + $answer = $country instanceof EE_Country ? $country->name() : ''; |
|
| 85 | + break; |
|
| 86 | 86 | |
| 87 | - default: |
|
| 88 | - $answer = $this->_data->get_pretty('ANS_value', 'no_wpautop'); |
|
| 89 | - break; |
|
| 90 | - } |
|
| 87 | + default: |
|
| 88 | + $answer = $this->_data->get_pretty('ANS_value', 'no_wpautop'); |
|
| 89 | + break; |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - return apply_filters( |
|
| 93 | - 'FHEE__EE_Question_Shortcodes___parser__answer', |
|
| 94 | - $answer, |
|
| 95 | - $question, |
|
| 96 | - $this->_data |
|
| 97 | - ); |
|
| 98 | - break; |
|
| 99 | - } |
|
| 92 | + return apply_filters( |
|
| 93 | + 'FHEE__EE_Question_Shortcodes___parser__answer', |
|
| 94 | + $answer, |
|
| 95 | + $question, |
|
| 96 | + $this->_data |
|
| 97 | + ); |
|
| 98 | + break; |
|
| 99 | + } |
|
| 100 | 100 | |
| 101 | - return ''; |
|
| 102 | - } |
|
| 101 | + return ''; |
|
| 102 | + } |
|
| 103 | 103 | } |