@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @author Mike Nelson |
10 | 10 | */ |
11 | 11 | use EventEspresso\core\libraries\rest_api\Model_Data_Translator; |
12 | -class EE_Select_Ajax_Model_Rest_Input extends EE_Form_Input_With_Options_Base{ |
|
12 | +class EE_Select_Ajax_Model_Rest_Input extends EE_Form_Input_With_Options_Base { |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * @var string $_model_name |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * And the arguments accepted by EE_Form_Input_With_Options_Base |
44 | 44 | * @throws \EE_Error |
45 | 45 | */ |
46 | - public function __construct( $input_settings = array() ) { |
|
46 | + public function __construct($input_settings = array()) { |
|
47 | 47 | //needed input settings: |
48 | 48 | //select2_args |
49 | 49 | $this->_model_name = EEH_Array::is_set( |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $query_params = EEH_Array::is_set( |
56 | 56 | $input_settings, |
57 | 57 | 'query_params', |
58 | - array( 'limit' => 10, 'caps' => EEM_Base::caps_read_admin ) |
|
58 | + array('limit' => 10, 'caps' => EEM_Base::caps_read_admin) |
|
59 | 59 | ); |
60 | 60 | $this->_value_field_name = EEH_Array::is_set( |
61 | 61 | $input_settings, |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $this->_display_field_name = EEH_Array::is_set( |
66 | 66 | $input_settings, |
67 | 67 | 'display_field_name', |
68 | - $model->get_a_field_of_type( 'EE_Text_Field_Base' )->get_name() |
|
68 | + $model->get_a_field_of_type('EE_Text_Field_Base')->get_name() |
|
69 | 69 | ); |
70 | 70 | $this->_add_validation_strategy( |
71 | 71 | new EE_Model_Matching_Query_Validation_Strategy( |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | ); |
78 | 78 | //get resource endpoint |
79 | 79 | $rest_controller = new EventEspresso\core\libraries\rest_api\controllers\model\Read(); |
80 | - $rest_controller->set_requested_version( EED_Core_Rest_Api::latest_rest_api_version() ); |
|
81 | - $url = $rest_controller->get_versioned_link_to( EEH_Inflector::pluralize_and_lower( $this->_model_name ) ); |
|
80 | + $rest_controller->set_requested_version(EED_Core_Rest_Api::latest_rest_api_version()); |
|
81 | + $url = $rest_controller->get_versioned_link_to(EEH_Inflector::pluralize_and_lower($this->_model_name)); |
|
82 | 82 | $default_select2_args = array( |
83 | 83 | 'ajax' => array( |
84 | 84 | 'url' => $url, |
@@ -86,13 +86,13 @@ discard block |
||
86 | 86 | 'delay' => '250', |
87 | 87 | 'data_interface' => 'EE_Select2_REST_API_Interface', |
88 | 88 | 'data_interface_args' => array( |
89 | - 'default_query_params' => (object)Model_Data_Translator::prepare_query_params_for_rest_api( |
|
89 | + 'default_query_params' => (object) Model_Data_Translator::prepare_query_params_for_rest_api( |
|
90 | 90 | $query_params, |
91 | 91 | $model |
92 | 92 | ), |
93 | 93 | 'display_field' => $this->_display_field_name, |
94 | 94 | 'value_field' => $this->_value_field_name, |
95 | - 'nonce' => wp_create_nonce( 'wp_rest' ) |
|
95 | + 'nonce' => wp_create_nonce('wp_rest') |
|
96 | 96 | ), |
97 | 97 | ), |
98 | 98 | 'cache' => true, |
@@ -100,10 +100,10 @@ discard block |
||
100 | 100 | ); |
101 | 101 | $select2_args = array_replace_recursive( |
102 | 102 | $default_select2_args, |
103 | - (array)EEH_Array::is_set( $input_settings, 'select2_args', array() ) |
|
103 | + (array) EEH_Array::is_set($input_settings, 'select2_args', array()) |
|
104 | 104 | ); |
105 | - $this->set_display_strategy( new EE_Select2_Display_Strategy( $select2_args ) ); |
|
106 | - parent::__construct( array(), $input_settings ); |
|
105 | + $this->set_display_strategy(new EE_Select2_Display_Strategy($select2_args)); |
|
106 | + parent::__construct(array(), $input_settings); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | |
@@ -116,33 +116,33 @@ discard block |
||
116 | 116 | * @return void |
117 | 117 | * @throws \EE_Error |
118 | 118 | */ |
119 | - public function set_default( $value ) { |
|
119 | + public function set_default($value) { |
|
120 | 120 | |
121 | - $values_for_options = (array)$value; |
|
122 | - $value_field = $this->_get_model()->field_settings_for( $this->_value_field_name ); |
|
123 | - $display_field = $this->_get_model()->field_settings_for( $this->_display_field_name ); |
|
121 | + $values_for_options = (array) $value; |
|
122 | + $value_field = $this->_get_model()->field_settings_for($this->_value_field_name); |
|
123 | + $display_field = $this->_get_model()->field_settings_for($this->_display_field_name); |
|
124 | 124 | $display_values = $this->_get_model()->get_all_wpdb_results( |
125 | 125 | array( |
126 | 126 | array( |
127 | - $this->_value_field_name => array( 'IN', $values_for_options ) |
|
127 | + $this->_value_field_name => array('IN', $values_for_options) |
|
128 | 128 | ) |
129 | 129 | ), |
130 | 130 | ARRAY_A, |
131 | 131 | implode( |
132 | 132 | ',', |
133 | 133 | array( |
134 | - $value_field->get_qualified_column() . ' AS ' . $this->_value_field_name, |
|
135 | - $display_field->get_qualified_column() . ' AS ' . $this->_display_field_name |
|
134 | + $value_field->get_qualified_column().' AS '.$this->_value_field_name, |
|
135 | + $display_field->get_qualified_column().' AS '.$this->_display_field_name |
|
136 | 136 | ) |
137 | 137 | ) |
138 | 138 | ); |
139 | 139 | $select_options = array(); |
140 | - foreach( $display_values as $db_rows ) { |
|
141 | - $db_rows = (array)$db_rows; |
|
142 | - $select_options[ $db_rows[ $this->_value_field_name ] ] = $db_rows[ $this->_display_field_name ]; |
|
140 | + foreach ($display_values as $db_rows) { |
|
141 | + $db_rows = (array) $db_rows; |
|
142 | + $select_options[$db_rows[$this->_value_field_name]] = $db_rows[$this->_display_field_name]; |
|
143 | 143 | } |
144 | - $this->set_select_options( $select_options ); |
|
145 | - parent::set_default( $value ); |
|
144 | + $this->set_select_options($select_options); |
|
145 | + parent::set_default($value); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | /** |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @throws EE_Error |
152 | 152 | */ |
153 | 153 | protected function _get_model() { |
154 | - if( ! EE_Registry::instance()->is_model_name( $this->_model_name ) ) { |
|
154 | + if ( ! EE_Registry::instance()->is_model_name($this->_model_name)) { |
|
155 | 155 | throw new EE_Error( |
156 | 156 | sprintf( |
157 | 157 | __( |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | ) |
163 | 163 | ); |
164 | 164 | } else { |
165 | - return EE_Registry::instance()->load_model( $this->_model_name ); |
|
165 | + return EE_Registry::instance()->load_model($this->_model_name); |
|
166 | 166 | } |
167 | 167 | } |
168 | 168 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @since 4.6 |
9 | 9 | * |
10 | 10 | */ |
11 | -abstract class EE_Display_Strategy_Base extends EE_Form_Input_Strategy_Base{ |
|
11 | +abstract class EE_Display_Strategy_Base extends EE_Form_Input_Strategy_Base { |
|
12 | 12 | /** |
13 | 13 | * returns HTML and javascript related to the displaying of this input |
14 | 14 | * @return string |
@@ -24,10 +24,10 @@ discard block |
||
24 | 24 | * @param string $chars - exact string of characters to remove |
25 | 25 | * @return string |
26 | 26 | */ |
27 | - protected function _remove_chars( $string = '', $chars = '-' ) { |
|
28 | - $char_length = strlen( $chars ) * -1; |
|
27 | + protected function _remove_chars($string = '', $chars = '-') { |
|
28 | + $char_length = strlen($chars) * -1; |
|
29 | 29 | // if last three characters of string is " - ", then remove it |
30 | - return substr( $string, $char_length ) === $chars ? substr( $string, 0, $char_length ) : $string; |
|
30 | + return substr($string, $char_length) === $chars ? substr($string, 0, $char_length) : $string; |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | |
@@ -39,16 +39,16 @@ discard block |
||
39 | 39 | * @param string $chars - exact string of characters to be added to end of string |
40 | 40 | * @return string |
41 | 41 | */ |
42 | - protected function _append_chars( $string = '', $chars = '-' ) { |
|
43 | - return $this->_remove_chars( $string, $chars ) . $chars; |
|
42 | + protected function _append_chars($string = '', $chars = '-') { |
|
43 | + return $this->_remove_chars($string, $chars).$chars; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
47 | 47 | * Gets the HTML IDs of all the inputs |
48 | 48 | * @return array |
49 | 49 | */ |
50 | - public function get_html_input_ids( $add_pound_sign = false ) { |
|
51 | - return array( $this->get_input()->html_id( $add_pound_sign ) ); |
|
50 | + public function get_html_input_ids($add_pound_sign = false) { |
|
51 | + return array($this->get_input()->html_id($add_pound_sign)); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @param array $other_js_data |
61 | 61 | * @return array |
62 | 62 | */ |
63 | - public function get_other_js_data( $other_js_data = array() ) { |
|
63 | + public function get_other_js_data($other_js_data = array()) { |
|
64 | 64 | return $other_js_data; |
65 | 65 | } |
66 | 66 |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * @subpackage |
8 | 8 | * @author Mike Nelson |
9 | 9 | */ |
10 | -class EE_Form_Input_With_Options_Base extends EE_Form_Input_Base{ |
|
10 | +class EE_Form_Input_With_Options_Base extends EE_Form_Input_Base { |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * array of available options to choose as an answer |
@@ -57,18 +57,18 @@ discard block |
||
57 | 57 | * } |
58 | 58 | * And all the options accepted by EE_Form_Input_Base |
59 | 59 | */ |
60 | - public function __construct( $answer_options = array(), $input_settings = array() ) { |
|
61 | - if ( isset( $input_settings['label_size'] )) { |
|
62 | - $this->_set_label_size( $input_settings['label_size'] ); |
|
63 | - if ( isset( $input_settings['enforce_label_size'] ) && $input_settings['enforce_label_size'] ) { |
|
60 | + public function __construct($answer_options = array(), $input_settings = array()) { |
|
61 | + if (isset($input_settings['label_size'])) { |
|
62 | + $this->_set_label_size($input_settings['label_size']); |
|
63 | + if (isset($input_settings['enforce_label_size']) && $input_settings['enforce_label_size']) { |
|
64 | 64 | $this->_enforce_label_size = TRUE; |
65 | 65 | } |
66 | 66 | } |
67 | - if ( isset( $input_settings['display_html_label_text'] )) { |
|
68 | - $this->set_display_html_label_text( $input_settings['display_html_label_text'] ); |
|
67 | + if (isset($input_settings['display_html_label_text'])) { |
|
68 | + $this->set_display_html_label_text($input_settings['display_html_label_text']); |
|
69 | 69 | } |
70 | - $this->set_select_options( $answer_options ); |
|
71 | - parent::__construct( $input_settings ); |
|
70 | + $this->set_select_options($answer_options); |
|
71 | + parent::__construct($input_settings); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
@@ -79,47 +79,47 @@ discard block |
||
79 | 79 | * @param array $answer_options |
80 | 80 | * @return void just has the side-effect of setting the options for this input |
81 | 81 | */ |
82 | - public function set_select_options( $answer_options = array() ){ |
|
83 | - $answer_options = is_array( $answer_options ) ? $answer_options : array( $answer_options ); |
|
82 | + public function set_select_options($answer_options = array()) { |
|
83 | + $answer_options = is_array($answer_options) ? $answer_options : array($answer_options); |
|
84 | 84 | //get the first item in the select options and check it's type |
85 | - if ( reset( $answer_options ) instanceof EE_Question_Option ) { |
|
86 | - $this->_options = $this->_process_question_options( $answer_options ); |
|
85 | + if (reset($answer_options) instanceof EE_Question_Option) { |
|
86 | + $this->_options = $this->_process_question_options($answer_options); |
|
87 | 87 | } else { |
88 | 88 | $this->_options = $answer_options; |
89 | 89 | } |
90 | 90 | //d( $this->_options ); |
91 | - $select_option_keys = array_keys( $this->_options ); |
|
91 | + $select_option_keys = array_keys($this->_options); |
|
92 | 92 | // attempt to determine data type for values in order to set normalization type |
93 | 93 | if ( |
94 | - count( $this->_options ) == 2 |
|
94 | + count($this->_options) == 2 |
|
95 | 95 | && |
96 | 96 | ( |
97 | - ( in_array( TRUE, $select_option_keys, true ) && in_array( FALSE, $select_option_keys, true )) |
|
98 | - || ( in_array( 1, $select_option_keys, true ) && in_array( 0, $select_option_keys, true )) |
|
97 | + (in_array(TRUE, $select_option_keys, true) && in_array(FALSE, $select_option_keys, true)) |
|
98 | + || (in_array(1, $select_option_keys, true) && in_array(0, $select_option_keys, true)) |
|
99 | 99 | ) |
100 | - ){ |
|
100 | + ) { |
|
101 | 101 | // values appear to be boolean, like TRUE, FALSE, 1, 0 |
102 | 102 | $normalization = new EE_Boolean_Normalization(); |
103 | - } else{ |
|
103 | + } else { |
|
104 | 104 | //are ALL the options ints? If so use int validation |
105 | 105 | $all_ints = true; |
106 | - foreach($select_option_keys as $value ){ |
|
107 | - if( ! is_int( $value ) ){ |
|
106 | + foreach ($select_option_keys as $value) { |
|
107 | + if ( ! is_int($value)) { |
|
108 | 108 | $all_ints = false; |
109 | 109 | break; |
110 | 110 | } |
111 | 111 | } |
112 | - if( $all_ints ){ |
|
112 | + if ($all_ints) { |
|
113 | 113 | $normalization = new EE_Int_Normalization(); |
114 | - }else{ |
|
114 | + } else { |
|
115 | 115 | $normalization = new EE_Text_Normalization(); |
116 | 116 | } |
117 | 117 | } |
118 | 118 | // does input type have multiple options ? |
119 | - if ( $this->_multiple_selections ) { |
|
120 | - $this->_set_normalization_strategy( new EE_Many_Valued_Normalization( $normalization )); |
|
119 | + if ($this->_multiple_selections) { |
|
120 | + $this->_set_normalization_strategy(new EE_Many_Valued_Normalization($normalization)); |
|
121 | 121 | } else { |
122 | - $this->_set_normalization_strategy( $normalization ); |
|
122 | + $this->_set_normalization_strategy($normalization); |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | /** |
129 | 129 | * @return array |
130 | 130 | */ |
131 | - public function options(){ |
|
131 | + public function options() { |
|
132 | 132 | return $this->_options; |
133 | 133 | } |
134 | 134 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * Returns an array which is guaranteed to not be multidimensional |
139 | 139 | * @return array |
140 | 140 | */ |
141 | - public function flat_options(){ |
|
141 | + public function flat_options() { |
|
142 | 142 | return $this->_flatten_select_options($this->options()); |
143 | 143 | } |
144 | 144 | |
@@ -149,19 +149,19 @@ discard block |
||
149 | 149 | * @param array $arr |
150 | 150 | * @return array |
151 | 151 | */ |
152 | - protected function _flatten_select_options( $arr ){ |
|
152 | + protected function _flatten_select_options($arr) { |
|
153 | 153 | $flat_array = array(); |
154 | - if ( EEH_Array::is_multi_dimensional_array( $arr )) { |
|
155 | - foreach( $arr as $sub_array ){ |
|
156 | - foreach( $sub_array as $key => $value ) { |
|
157 | - $flat_array[ $key ] = $value; |
|
158 | - $this->_set_label_size( $value ); |
|
154 | + if (EEH_Array::is_multi_dimensional_array($arr)) { |
|
155 | + foreach ($arr as $sub_array) { |
|
156 | + foreach ($sub_array as $key => $value) { |
|
157 | + $flat_array[$key] = $value; |
|
158 | + $this->_set_label_size($value); |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | } else { |
162 | - foreach( $arr as $key => $value ) { |
|
163 | - $flat_array[ $key ] = $value; |
|
164 | - $this->_set_label_size( $value ); |
|
162 | + foreach ($arr as $key => $value) { |
|
163 | + $flat_array[$key] = $value; |
|
164 | + $this->_set_label_size($value); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | return $flat_array; |
@@ -173,18 +173,18 @@ discard block |
||
173 | 173 | * @param EE_Question_Option[] $question_options_array |
174 | 174 | * @return array |
175 | 175 | */ |
176 | - protected function _process_question_options( $question_options_array = array() ) { |
|
176 | + protected function _process_question_options($question_options_array = array()) { |
|
177 | 177 | $flat_array = array(); |
178 | - foreach( $question_options_array as $question_option ) { |
|
179 | - if ( $question_option instanceof EE_Question_Option ) { |
|
178 | + foreach ($question_options_array as $question_option) { |
|
179 | + if ($question_option instanceof EE_Question_Option) { |
|
180 | 180 | $desc = ''; |
181 | - if ( $this->_use_desc_in_label ) { |
|
181 | + if ($this->_use_desc_in_label) { |
|
182 | 182 | $desc = $question_option->desc(); |
183 | - $desc = ! empty( $desc ) ? '<span class="ee-question-option-desc"> - ' . $desc . '</span>' : ''; |
|
183 | + $desc = ! empty($desc) ? '<span class="ee-question-option-desc"> - '.$desc.'</span>' : ''; |
|
184 | 184 | } |
185 | - $flat_array[ $question_option->value() ] = $question_option->value() . $desc; |
|
186 | - } elseif ( is_array( $question_option )) { |
|
187 | - $non_question_option = $this->_flatten_select_options( $question_option ); |
|
185 | + $flat_array[$question_option->value()] = $question_option->value().$desc; |
|
186 | + } elseif (is_array($question_option)) { |
|
187 | + $non_question_option = $this->_flatten_select_options($question_option); |
|
188 | 188 | $flat_array = $flat_array + $non_question_option; |
189 | 189 | } |
190 | 190 | } |
@@ -197,12 +197,12 @@ discard block |
||
197 | 197 | * set_label_sizes |
198 | 198 | * @return void |
199 | 199 | */ |
200 | - public function set_label_sizes(){ |
|
200 | + public function set_label_sizes() { |
|
201 | 201 | // did the input settings specifically say to NOT set the label size dynamically ? |
202 | - if ( ! $this->_enforce_label_size ) { |
|
203 | - foreach( $this->_options as $option ) { |
|
202 | + if ( ! $this->_enforce_label_size) { |
|
203 | + foreach ($this->_options as $option) { |
|
204 | 204 | // calculate the strlen of the label |
205 | - $this->_set_label_size( $option ); |
|
205 | + $this->_set_label_size($option); |
|
206 | 206 | } |
207 | 207 | } |
208 | 208 | } |
@@ -214,9 +214,9 @@ discard block |
||
214 | 214 | * @param int|string $value |
215 | 215 | * @return void |
216 | 216 | */ |
217 | - private function _set_label_size( $value = '' ){ |
|
217 | + private function _set_label_size($value = '') { |
|
218 | 218 | // determine length of option value |
219 | - $val_size = is_int( $value ) ? $value : strlen( $value ); |
|
219 | + $val_size = is_int($value) ? $value : strlen($value); |
|
220 | 220 | // use new value if bigger than existing |
221 | 221 | $this->_label_size = $val_size > $this->_label_size ? $val_size : $this->_label_size; |
222 | 222 | } |
@@ -227,22 +227,22 @@ discard block |
||
227 | 227 | * get_label_size_class |
228 | 228 | * @return string |
229 | 229 | */ |
230 | - function get_label_size_class(){ |
|
230 | + function get_label_size_class() { |
|
231 | 231 | // use maximum option value length to determine label size |
232 | - if( $this->_label_size < 3 ) { |
|
232 | + if ($this->_label_size < 3) { |
|
233 | 233 | $size = ' nano-lbl'; |
234 | - } else if ( $this->_label_size < 6 ) { |
|
235 | - $size = ' micro-lbl'; |
|
236 | - } else if ( $this->_label_size < 12 ) { |
|
237 | - $size = ' tiny-lbl'; |
|
238 | - } else if ( $this->_label_size < 25 ) { |
|
239 | - $size = ' small-lbl'; |
|
240 | - } else if ( $this->_label_size < 50 ) { |
|
241 | - $size = ' medium-lbl'; |
|
242 | - } else if ( $this->_label_size >= 100 ) { |
|
243 | - $size = ' big-lbl'; |
|
234 | + } else if ($this->_label_size < 6) { |
|
235 | + $size = ' micro-lbl'; |
|
236 | + } else if ($this->_label_size < 12) { |
|
237 | + $size = ' tiny-lbl'; |
|
238 | + } else if ($this->_label_size < 25) { |
|
239 | + $size = ' small-lbl'; |
|
240 | + } else if ($this->_label_size < 50) { |
|
241 | + $size = ' medium-lbl'; |
|
242 | + } else if ($this->_label_size >= 100) { |
|
243 | + $size = ' big-lbl'; |
|
244 | 244 | } else { |
245 | - $size = ' medium-lbl'; |
|
245 | + $size = ' medium-lbl'; |
|
246 | 246 | } |
247 | 247 | return $size; |
248 | 248 | } |
@@ -251,21 +251,21 @@ discard block |
||
251 | 251 | * Returns the pretty value for the normalized value |
252 | 252 | * @return string |
253 | 253 | */ |
254 | - function pretty_value(){ |
|
254 | + function pretty_value() { |
|
255 | 255 | $options = $this->flat_options(); |
256 | - $unnormalized_value_choices = $this->get_normalization_strategy()->unnormalize( $this->_normalized_value ); |
|
257 | - if( ! $this->_multiple_selections ){ |
|
258 | - $unnormalized_value_choices = array( $unnormalized_value_choices ); |
|
256 | + $unnormalized_value_choices = $this->get_normalization_strategy()->unnormalize($this->_normalized_value); |
|
257 | + if ( ! $this->_multiple_selections) { |
|
258 | + $unnormalized_value_choices = array($unnormalized_value_choices); |
|
259 | 259 | } |
260 | 260 | $pretty_strings = array(); |
261 | - foreach( $unnormalized_value_choices as $unnormalized_value_choice ){ |
|
262 | - if( isset( $options[ $unnormalized_value_choice ] ) ){ |
|
263 | - $pretty_strings[] = $options[ $unnormalized_value_choice ]; |
|
264 | - }else{ |
|
261 | + foreach ($unnormalized_value_choices as $unnormalized_value_choice) { |
|
262 | + if (isset($options[$unnormalized_value_choice])) { |
|
263 | + $pretty_strings[] = $options[$unnormalized_value_choice]; |
|
264 | + } else { |
|
265 | 265 | $pretty_strings[] = $this->normalized_value(); |
266 | 266 | } |
267 | 267 | } |
268 | - return implode(", ", $pretty_strings ); |
|
268 | + return implode(", ", $pretty_strings); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | |
@@ -282,8 +282,8 @@ discard block |
||
282 | 282 | /** |
283 | 283 | * @param boolean $display_html_label_text |
284 | 284 | */ |
285 | - public function set_display_html_label_text( $display_html_label_text ) { |
|
286 | - $this->_display_html_label_text = filter_var( $display_html_label_text, FILTER_VALIDATE_BOOLEAN ); |
|
285 | + public function set_display_html_label_text($display_html_label_text) { |
|
286 | + $this->_display_html_label_text = filter_var($display_html_label_text, FILTER_VALIDATE_BOOLEAN); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @subpackage Expression package is undefined on line 19, column 19 in Templates/Scripting/PHPClass.php. |
11 | 11 | * @author Mike Nelson |
12 | 12 | */ |
13 | -class EE_Model_Matching_Query_Validation_Strategy extends EE_Validation_Strategy_Base{ |
|
13 | +class EE_Model_Matching_Query_Validation_Strategy extends EE_Validation_Strategy_Base { |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * |
@@ -29,17 +29,17 @@ discard block |
||
29 | 29 | * @param string $input_field_name the input will be treated as this field's value |
30 | 30 | * @throws \EE_Error |
31 | 31 | */ |
32 | - public function __construct( $validation_error_message = NULL, $model_name = '', $query_params = array(), $input_field_name = '' ) { |
|
33 | - if( ! EE_Registry::instance()->is_model_name( $model_name ) ) { |
|
34 | - throw new EE_Error( sprintf( __( 'You must provide a valid model object ', 'event_espresso'), $model_name ) ); |
|
32 | + public function __construct($validation_error_message = NULL, $model_name = '', $query_params = array(), $input_field_name = '') { |
|
33 | + if ( ! EE_Registry::instance()->is_model_name($model_name)) { |
|
34 | + throw new EE_Error(sprintf(__('You must provide a valid model object ', 'event_espresso'), $model_name)); |
|
35 | 35 | } |
36 | - $this->_model = EE_Registry::instance()->load_model( $model_name ); |
|
36 | + $this->_model = EE_Registry::instance()->load_model($model_name); |
|
37 | 37 | $this->_query_params = $query_params; |
38 | - if( empty( $input_field_name ) ) { |
|
38 | + if (empty($input_field_name)) { |
|
39 | 39 | $input_field_name = $this->_model->primary_key_name(); |
40 | 40 | } |
41 | 41 | $this->_input_field_name = $input_field_name; |
42 | - parent::__construct( $validation_error_message ); |
|
42 | + parent::__construct($validation_error_message); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -51,13 +51,13 @@ discard block |
||
51 | 51 | * @throws \EE_Validation_Error |
52 | 52 | */ |
53 | 53 | public function validate($normalized_value) { |
54 | - if( empty( $normalized_value ) ) { |
|
54 | + if (empty($normalized_value)) { |
|
55 | 55 | return true; |
56 | 56 | } |
57 | 57 | $combined_query_params = $this->get_query_params(); |
58 | - $combined_query_params[0][ $this->treat_input_as_field() ] = $normalized_value; |
|
59 | - if( ! $this->get_model()->exists( $combined_query_params ) ) { |
|
60 | - throw new EE_Validation_Error( $this->get_validation_error_message(), 'no_matching_model_object' ); |
|
58 | + $combined_query_params[0][$this->treat_input_as_field()] = $normalized_value; |
|
59 | + if ( ! $this->get_model()->exists($combined_query_params)) { |
|
60 | + throw new EE_Validation_Error($this->get_validation_error_message(), 'no_matching_model_object'); |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @return array |
75 | 75 | */ |
76 | 76 | public function get_query_params() { |
77 | - return (array)$this->_query_params; |
|
77 | + return (array) $this->_query_params; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * @subpackage Expression package is undefined on line 19, column 19 in Templates/Scripting/PHPClass.php. |
8 | 8 | * @author Mike Nelson |
9 | 9 | */ |
10 | -class EE_Text_Validation_Strategy extends EE_Validation_Strategy_Base{ |
|
10 | +class EE_Text_Validation_Strategy extends EE_Validation_Strategy_Base { |
|
11 | 11 | |
12 | 12 | protected $_regex = null; |
13 | 13 | /** |
@@ -15,18 +15,18 @@ discard block |
||
15 | 15 | * @param string $validation_error_message |
16 | 16 | * @param string $regex a PHP regex; the javascript regex will be derived from this |
17 | 17 | */ |
18 | - public function __construct( $validation_error_message = NULL, $regex = null ) { |
|
18 | + public function __construct($validation_error_message = NULL, $regex = null) { |
|
19 | 19 | $this->_regex = $regex; |
20 | - parent::__construct( $validation_error_message ); |
|
20 | + parent::__construct($validation_error_message); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | /** |
24 | 24 | * @param $normalized_value |
25 | 25 | */ |
26 | 26 | public function validate($normalized_value) { |
27 | - if( $this->_regex && $normalized_value) { |
|
28 | - if( ! preg_match( $this->_regex, $normalized_value ) ) { |
|
29 | - throw new EE_Validation_Error( $this->get_validation_error_message(), 'regex' ); |
|
27 | + if ($this->_regex && $normalized_value) { |
|
28 | + if ( ! preg_match($this->_regex, $normalized_value)) { |
|
29 | + throw new EE_Validation_Error($this->get_validation_error_message(), 'regex'); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | } |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | /** |
35 | 35 | * @return array |
36 | 36 | */ |
37 | - function get_jquery_validation_rule_array(){ |
|
38 | - if( $this->_regex !== null ){ |
|
39 | - return array( 'regex'=> $this->regex_js(), 'messages' => array( 'regex' => $this->get_validation_error_message() ) ); |
|
40 | - }else{ |
|
37 | + function get_jquery_validation_rule_array() { |
|
38 | + if ($this->_regex !== null) { |
|
39 | + return array('regex'=> $this->regex_js(), 'messages' => array('regex' => $this->get_validation_error_message())); |
|
40 | + } else { |
|
41 | 41 | return array(); |
42 | 42 | } |
43 | 43 | |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | function regex_js() { |
52 | 52 | //first character must be the delimiter |
53 | 53 | $delimeter = $this->_regex[0]; |
54 | - $last_occurence_of_delimieter = strrpos($this->_regex, $delimeter ); |
|
55 | - return substr( $this->_regex, 1, $last_occurence_of_delimieter - 1 ); |
|
54 | + $last_occurence_of_delimieter = strrpos($this->_regex, $delimeter); |
|
55 | + return substr($this->_regex, 1, $last_occurence_of_delimieter - 1); |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * @param null $validation_error_message |
24 | 24 | */ |
25 | - public function __construct( $validation_error_message = null ) { |
|
25 | + public function __construct($validation_error_message = null) { |
|
26 | 26 | $this->_validation_error_message = $validation_error_message === null |
27 | - ? __( 'Input invalid', 'event_espresso' ) |
|
27 | + ? __('Input invalid', 'event_espresso') |
|
28 | 28 | : $validation_error_message; |
29 | 29 | parent::__construct(); |
30 | 30 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * this validation strategy is the 'required' validation strategy, |
42 | 42 | * most should be OK with a null, empty string, etc) |
43 | 43 | */ |
44 | - public function validate( $normalized_value ) { |
|
44 | + public function validate($normalized_value) { |
|
45 | 45 | //by default, the validation strategy does no validation. this should be implemented |
46 | 46 | } |
47 | 47 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * @param array $other_js_data |
93 | 93 | * @return array |
94 | 94 | */ |
95 | - public function get_other_js_data( $other_js_data = array() ) { |
|
95 | + public function get_other_js_data($other_js_data = array()) { |
|
96 | 96 | return $other_js_data; |
97 | 97 | } |
98 | 98 |
@@ -173,7 +173,7 @@ |
||
173 | 173 | if( ! $this->_html_id ){ |
174 | 174 | if( $this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper ){ |
175 | 175 | $this->_html_id = $this->_parent_section->html_id() . '-' . $this->_prep_name_for_html_id( $this->name() ); |
176 | - }else{ |
|
176 | + } else{ |
|
177 | 177 | $this->_html_id = $this->_prep_name_for_html_id( $this->name() ); |
178 | 178 | } |
179 | 179 | } |
@@ -1,5 +1,5 @@ discard block |
||
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 | /** |
@@ -79,12 +79,12 @@ discard block |
||
79 | 79 | * @type $name string the name for this form section, if you want to explicitly define it |
80 | 80 | * } |
81 | 81 | */ |
82 | - public function __construct( $options_array = array() ) { |
|
82 | + public function __construct($options_array = array()) { |
|
83 | 83 | // used by display strategies |
84 | 84 | // assign incoming values to properties |
85 | - foreach( $options_array as $key => $value ) { |
|
86 | - $key = '_' . $key; |
|
87 | - if ( property_exists( $this, $key ) && empty( $this->{$key} )) { |
|
85 | + foreach ($options_array as $key => $value) { |
|
86 | + $key = '_'.$key; |
|
87 | + if (property_exists($this, $key) && empty($this->{$key} )) { |
|
88 | 88 | $this->{$key} = $value; |
89 | 89 | } |
90 | 90 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * @param $name |
98 | 98 | * @throws \EE_Error |
99 | 99 | */ |
100 | - protected function _construct_finalize( $parent_form_section, $name ){ |
|
100 | + protected function _construct_finalize($parent_form_section, $name) { |
|
101 | 101 | $this->_construction_finalized = TRUE; |
102 | 102 | $this->_parent_section = $parent_form_section; |
103 | 103 | $this->_name = $name; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | /** |
119 | 119 | * @param string $action |
120 | 120 | */ |
121 | - public function set_action( $action ) { |
|
121 | + public function set_action($action) { |
|
122 | 122 | $this->_action = $action; |
123 | 123 | } |
124 | 124 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * @return string |
129 | 129 | */ |
130 | 130 | public function method() { |
131 | - return ! empty( $this->_method ) ? $this->_method : 'POST'; |
|
131 | + return ! empty($this->_method) ? $this->_method : 'POST'; |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | |
@@ -136,8 +136,8 @@ discard block |
||
136 | 136 | /** |
137 | 137 | * @param string $method |
138 | 138 | */ |
139 | - public function set_method( $method ) { |
|
140 | - switch ( $method ) { |
|
139 | + public function set_method($method) { |
|
140 | + switch ($method) { |
|
141 | 141 | case 'get' : |
142 | 142 | case 'GET' : |
143 | 143 | $this->_method = 'GET'; |
@@ -156,12 +156,12 @@ discard block |
||
156 | 156 | * |
157 | 157 | * @throws \EE_Error |
158 | 158 | */ |
159 | - protected function _set_default_html_id_if_empty(){ |
|
160 | - if( ! $this->_html_id ){ |
|
161 | - if( $this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper ){ |
|
162 | - $this->_html_id = $this->_parent_section->html_id() . '-' . $this->_prep_name_for_html_id( $this->name() ); |
|
163 | - }else{ |
|
164 | - $this->_html_id = $this->_prep_name_for_html_id( $this->name() ); |
|
159 | + protected function _set_default_html_id_if_empty() { |
|
160 | + if ( ! $this->_html_id) { |
|
161 | + if ($this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper) { |
|
162 | + $this->_html_id = $this->_parent_section->html_id().'-'.$this->_prep_name_for_html_id($this->name()); |
|
163 | + } else { |
|
164 | + $this->_html_id = $this->_prep_name_for_html_id($this->name()); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | } |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | * @param $name |
174 | 174 | * @return string |
175 | 175 | */ |
176 | - private function _prep_name_for_html_id( $name ) { |
|
177 | - return sanitize_key( str_replace( array( ' ', ' ', '_' ), '-', $name )); |
|
176 | + private function _prep_name_for_html_id($name) { |
|
177 | + return sanitize_key(str_replace(array(' ', ' ', '_'), '-', $name)); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | * and so might stop working anytime. |
189 | 189 | * @return string |
190 | 190 | */ |
191 | - public function get_html_and_js(){ |
|
191 | + public function get_html_and_js() { |
|
192 | 192 | return $this->get_html(); |
193 | 193 | } |
194 | 194 | |
@@ -204,8 +204,8 @@ discard block |
||
204 | 204 | * @param bool $add_pound_sign |
205 | 205 | * @return string |
206 | 206 | */ |
207 | - public function html_id( $add_pound_sign = FALSE ){ |
|
208 | - return $add_pound_sign ? '#' . $this->_html_id : $this->_html_id; |
|
207 | + public function html_id($add_pound_sign = FALSE) { |
|
208 | + return $add_pound_sign ? '#'.$this->_html_id : $this->_html_id; |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | /** |
214 | 214 | * @return string |
215 | 215 | */ |
216 | - public function html_class(){ |
|
216 | + public function html_class() { |
|
217 | 217 | return $this->_html_class; |
218 | 218 | } |
219 | 219 | |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | /** |
223 | 223 | * @return string |
224 | 224 | */ |
225 | - public function html_style(){ |
|
225 | + public function html_style() { |
|
226 | 226 | return $this->_html_style; |
227 | 227 | } |
228 | 228 | |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | /** |
232 | 232 | * @param mixed $html_class |
233 | 233 | */ |
234 | - public function set_html_class( $html_class ) { |
|
234 | + public function set_html_class($html_class) { |
|
235 | 235 | $this->_html_class = $html_class; |
236 | 236 | } |
237 | 237 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | /** |
241 | 241 | * @param mixed $html_id |
242 | 242 | */ |
243 | - public function set_html_id( $html_id ) { |
|
243 | + public function set_html_id($html_id) { |
|
244 | 244 | $this->_html_id = $html_id; |
245 | 245 | } |
246 | 246 | |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | /** |
250 | 250 | * @param mixed $html_style |
251 | 251 | */ |
252 | - public function set_html_style( $html_style ) { |
|
252 | + public function set_html_style($html_style) { |
|
253 | 253 | $this->_html_style = $html_style; |
254 | 254 | } |
255 | 255 | |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | /** |
259 | 259 | * @param string $other_html_attributes |
260 | 260 | */ |
261 | - public function set_other_html_attributes( $other_html_attributes ) { |
|
261 | + public function set_other_html_attributes($other_html_attributes) { |
|
262 | 262 | $this->_other_html_attributes = $other_html_attributes; |
263 | 263 | } |
264 | 264 | |
@@ -278,9 +278,9 @@ discard block |
||
278 | 278 | * @throws EE_Error |
279 | 279 | * @return string |
280 | 280 | */ |
281 | - public function name(){ |
|
282 | - if( ! $this->_construction_finalized ){ |
|
283 | - throw new EE_Error(sprintf( __( 'You cannot use the form section\s name until _construct_finalize has been called on it (when we set the name). It was called on a form section of type \'s\'', 'event_espresso' ), get_class($this) ) ); |
|
281 | + public function name() { |
|
282 | + if ( ! $this->_construction_finalized) { |
|
283 | + throw new EE_Error(sprintf(__('You cannot use the form section\s name until _construct_finalize has been called on it (when we set the name). It was called on a form section of type \'s\'', 'event_espresso'), get_class($this))); |
|
284 | 284 | } |
285 | 285 | return $this->_name; |
286 | 286 | } |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | * Gets the parent section |
292 | 292 | * @return EE_Form_Section_Proper |
293 | 293 | */ |
294 | - public function parent_section(){ |
|
294 | + public function parent_section() { |
|
295 | 295 | return $this->_parent_section; |
296 | 296 | } |
297 | 297 | |
@@ -304,18 +304,18 @@ discard block |
||
304 | 304 | * @param string $other_attributes anything else added to the form open tag, MUST BE VALID HTML |
305 | 305 | * @return string |
306 | 306 | */ |
307 | - public function form_open( $action = '', $method = '', $other_attributes = '' ) { |
|
308 | - if ( ! empty( $action )) { |
|
309 | - $this->set_action( $action ); |
|
307 | + public function form_open($action = '', $method = '', $other_attributes = '') { |
|
308 | + if ( ! empty($action)) { |
|
309 | + $this->set_action($action); |
|
310 | 310 | } |
311 | - if ( ! empty( $method )) { |
|
312 | - $this->set_method( $method ); |
|
311 | + if ( ! empty($method)) { |
|
312 | + $this->set_method($method); |
|
313 | 313 | } |
314 | - $html = EEH_HTML::nl( 1, 'form' ) . '<form'; |
|
315 | - $html .= $this->html_id() !== '' ? ' id="' . $this->html_id() . '"' : ''; |
|
316 | - $html .= ' action="' . $this->action() . '"'; |
|
317 | - $html .= ' method="' . $this->method() . '"'; |
|
318 | - $html .= $other_attributes . '>'; |
|
314 | + $html = EEH_HTML::nl(1, 'form').'<form'; |
|
315 | + $html .= $this->html_id() !== '' ? ' id="'.$this->html_id().'"' : ''; |
|
316 | + $html .= ' action="'.$this->action().'"'; |
|
317 | + $html .= ' method="'.$this->method().'"'; |
|
318 | + $html .= $other_attributes.'>'; |
|
319 | 319 | return $html; |
320 | 320 | } |
321 | 321 | |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | * @return string |
327 | 327 | */ |
328 | 328 | public function form_close() { |
329 | - return EEH_HTML::nl( -1, 'form' ) . '</form>' . EEH_HTML::nl() . '<!-- end of ee-' . $this->html_id() . '-form -->' . EEH_HTML::nl(); |
|
329 | + return EEH_HTML::nl( -1, 'form' ).'</form>'.EEH_HTML::nl().'<!-- end of ee-'.$this->html_id().'-form -->'.EEH_HTML::nl(); |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | /** |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | * Default does nothing, but child classes can override |
336 | 336 | * @return void |
337 | 337 | */ |
338 | - public function enqueue_js(){ |
|
338 | + public function enqueue_js() { |
|
339 | 339 | //defaults to enqueue NO js or css |
340 | 340 | } |
341 | 341 | |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | * @param array $form_other_js_data |
352 | 352 | * @return array |
353 | 353 | */ |
354 | - public function get_other_js_data( $form_other_js_data = array() ) { |
|
354 | + public function get_other_js_data($form_other_js_data = array()) { |
|
355 | 355 | return $form_other_js_data; |
356 | 356 | } |
357 | 357 | |
@@ -369,20 +369,20 @@ discard block |
||
369 | 369 | * @param string|false $form_section_path we accept false also because substr( '../', '../' ) = false |
370 | 370 | * @return EE_Form_Section_Base |
371 | 371 | */ |
372 | - public function find_section_from_path( $form_section_path ) { |
|
373 | - if( strpos( $form_section_path, '/' ) === 0 ) { |
|
374 | - $form_section_path = substr( $form_section_path, strlen( '/' ) ); |
|
372 | + public function find_section_from_path($form_section_path) { |
|
373 | + if (strpos($form_section_path, '/') === 0) { |
|
374 | + $form_section_path = substr($form_section_path, strlen('/')); |
|
375 | 375 | } |
376 | - if( empty( $form_section_path ) ) { |
|
376 | + if (empty($form_section_path)) { |
|
377 | 377 | return $this; |
378 | 378 | } |
379 | - if( strpos( $form_section_path, '../' ) === 0 ) { |
|
379 | + if (strpos($form_section_path, '../') === 0) { |
|
380 | 380 | $parent = $this->parent_section(); |
381 | 381 | |
382 | - $form_section_path = substr( $form_section_path, strlen( '../' ) ); |
|
383 | - if( $parent instanceof EE_Form_Section_Base ) { |
|
384 | - return $parent->find_section_from_path( $form_section_path ); |
|
385 | - } elseif( empty( $form_section_path ) ) { |
|
382 | + $form_section_path = substr($form_section_path, strlen('../')); |
|
383 | + if ($parent instanceof EE_Form_Section_Base) { |
|
384 | + return $parent->find_section_from_path($form_section_path); |
|
385 | + } elseif (empty($form_section_path)) { |
|
386 | 386 | return $this; |
387 | 387 | } |
388 | 388 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * |
25 | 25 | * ------------------------------------------------------------------------ |
26 | 26 | */ |
27 | -abstract class EE_Offsite_Gateway extends EE_Gateway{ |
|
27 | +abstract class EE_Offsite_Gateway extends EE_Gateway { |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * whether or not the gateway uses an IPN |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @param string $cancel_url URL to send the user to after a cancelled payment attempt on teh payment provider's website |
62 | 62 | * @return EE_Payment |
63 | 63 | */ |
64 | - public abstract function set_redirection_info( $payment, $billing_info = array(), $return_url = NULL, $notify_url = NULL, $cancel_url = NULL); |
|
64 | + public abstract function set_redirection_info($payment, $billing_info = array(), $return_url = NULL, $notify_url = NULL, $cancel_url = NULL); |
|
65 | 65 | |
66 | 66 | |
67 | 67 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param EEI_Transaction $transaction |
75 | 75 | * @return EEI_Payment updated |
76 | 76 | */ |
77 | - public abstract function handle_payment_update($update_info,$transaction); |
|
77 | + public abstract function handle_payment_update($update_info, $transaction); |
|
78 | 78 | |
79 | 79 | |
80 | 80 | |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | * @access protected |
102 | 102 | * @param boolean $uses_separate_IPN_request |
103 | 103 | */ |
104 | - protected function set_uses_separate_IPN_request( $uses_separate_IPN_request ) { |
|
105 | - $this->_uses_separate_IPN_request = filter_var( $uses_separate_IPN_request, FILTER_VALIDATE_BOOLEAN ); |
|
104 | + protected function set_uses_separate_IPN_request($uses_separate_IPN_request) { |
|
105 | + $this->_uses_separate_IPN_request = filter_var($uses_separate_IPN_request, FILTER_VALIDATE_BOOLEAN); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | * @param boolean $separate_IPN_request |
120 | 120 | * @return boolean |
121 | 121 | */ |
122 | - public function handle_IPN_in_this_request( $request_data, $separate_IPN_request ) { |
|
123 | - if( $separate_IPN_request ) { |
|
122 | + public function handle_IPN_in_this_request($request_data, $separate_IPN_request) { |
|
123 | + if ($separate_IPN_request) { |
|
124 | 124 | // payment data being sent in a request separate from the user |
125 | 125 | // it is this other request that will update the TXN and payment info |
126 | 126 | return $this->_uses_separate_IPN_request; |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * |
14 | 14 | * ------------------------------------------------------------------------ |
15 | 15 | */ |
16 | -require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
|
16 | +require_once (EE_MODELS.'EEM_Base.model.php'); |
|
17 | 17 | /** |
18 | 18 | * |
19 | 19 | * Class EEM_Status |
@@ -32,32 +32,32 @@ discard block |
||
32 | 32 | /** |
33 | 33 | * @return EEM_Status |
34 | 34 | */ |
35 | - protected function __construct( $timezone = NULL ) { |
|
36 | - $this->singular_item = __('Status','event_espresso'); |
|
37 | - $this->plural_item = __('Stati','event_espresso'); |
|
35 | + protected function __construct($timezone = NULL) { |
|
36 | + $this->singular_item = __('Status', 'event_espresso'); |
|
37 | + $this->plural_item = __('Stati', 'event_espresso'); |
|
38 | 38 | $this->_tables = array( |
39 | 39 | 'StatusTable'=> new EE_Primary_Table('esp_status', 'STS_ID') |
40 | 40 | ); |
41 | 41 | $this->_fields = array( |
42 | 42 | 'StatusTable'=>array( |
43 | - 'STS_ID'=> new EE_Primary_Key_String_Field('STS_ID', __('Status ID','event_espresso')), |
|
44 | - 'STS_code'=>new EE_Plain_Text_Field('STS_code',__('Status Code','event_espresso'),false, ''), |
|
43 | + 'STS_ID'=> new EE_Primary_Key_String_Field('STS_ID', __('Status ID', 'event_espresso')), |
|
44 | + 'STS_code'=>new EE_Plain_Text_Field('STS_code', __('Status Code', 'event_espresso'), false, ''), |
|
45 | 45 | 'STS_type'=>new EE_Enum_Text_Field( |
46 | 46 | 'STS_type', |
47 | 47 | __("Type", "event_espresso"), |
48 | 48 | false, |
49 | 49 | 'event', |
50 | 50 | array( |
51 | - 'event'=> __("Event", "event_espresso"),//deprecated |
|
51 | + 'event'=> __("Event", "event_espresso"), //deprecated |
|
52 | 52 | 'registration'=> __("Registration", "event_espresso"), |
53 | 53 | 'transaction'=> __("Transaction", "event_espresso"), |
54 | 54 | 'payment'=> __("Payment", "event_espresso"), |
55 | 55 | 'email'=> __("Email", "event_espresso"), |
56 | 56 | 'message' => __("Message", "event_espresso") |
57 | 57 | )), |
58 | - 'STS_can_edit'=>new EE_Boolean_Field('STS_can_edit', __('Editable?','event_espresso'), false), |
|
58 | + 'STS_can_edit'=>new EE_Boolean_Field('STS_can_edit', __('Editable?', 'event_espresso'), false), |
|
59 | 59 | 'STS_desc'=>new EE_Simple_HTML_Field('STS_desc', __("Description", "event_espresso"), false, ''), |
60 | - 'STS_open'=>new EE_Boolean_Field('STS_open', __("Open?", "event_espresso"), false,false) |
|
60 | + 'STS_open'=>new EE_Boolean_Field('STS_open', __("Open?", "event_espresso"), false, false) |
|
61 | 61 | )); |
62 | 62 | $this->_model_relations = array( |
63 | 63 | 'Registration'=>new EE_Has_Many_Relation(), |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | 'Payment'=>new EE_Has_Many_Relation() |
66 | 66 | ); |
67 | 67 | //this model is generally available for reading |
68 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
68 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public(); |
|
69 | 69 | |
70 | - parent::__construct( $timezone ); |
|
70 | + parent::__construct($timezone); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * @throws EE_Error |
81 | 81 | * @return array an array of translated strings for the incoming status id. |
82 | 82 | */ |
83 | - public function localized_status( $statuses, $plural = FALSE, $schema = 'upper' ) { |
|
83 | + public function localized_status($statuses, $plural = FALSE, $schema = 'upper') { |
|
84 | 84 | //note these are all in lower case because ucwords() on upper case will NOT convert. |
85 | 85 | $translation_array = array( |
86 | 86 | EEM_Registration::status_id_pending_payment => array( |
@@ -222,8 +222,8 @@ discard block |
||
222 | 222 | __('failed', 'event_espresso'), |
223 | 223 | ), |
224 | 224 | EEM_Message::status_debug_only => array( |
225 | - __( 'debug only', 'event_espresso' ), |
|
226 | - __( 'debug only', 'event_espresso' ) |
|
225 | + __('debug only', 'event_espresso'), |
|
226 | + __('debug only', 'event_espresso') |
|
227 | 227 | ), |
228 | 228 | EEM_Message::status_resend => array( |
229 | 229 | __('queued for resending', 'event_espresso'), |
@@ -263,30 +263,30 @@ discard block |
||
263 | 263 | ), |
264 | 264 | ); |
265 | 265 | |
266 | - $translation_array = apply_filters( 'FHEE__EEM_Status__localized_status__translation_array', $translation_array ); |
|
266 | + $translation_array = apply_filters('FHEE__EEM_Status__localized_status__translation_array', $translation_array); |
|
267 | 267 | |
268 | - if ( !is_array($statuses) ) |
|
269 | - throw new EE_Error( __('The incoming statuses argument must be an array with keys as the $status_id and values as the $status_code', 'event_espresso') ); |
|
268 | + if ( ! is_array($statuses)) |
|
269 | + throw new EE_Error(__('The incoming statuses argument must be an array with keys as the $status_id and values as the $status_code', 'event_espresso')); |
|
270 | 270 | |
271 | 271 | $translation = array(); |
272 | 272 | |
273 | - foreach ( $statuses as $id => $code ) { |
|
274 | - if ( isset( $translation_array[$id] ) ) { |
|
273 | + foreach ($statuses as $id => $code) { |
|
274 | + if (isset($translation_array[$id])) { |
|
275 | 275 | $translation[$id] = $plural ? $translation_array[$id][1] : $translation_array[$id][0]; |
276 | 276 | } else { |
277 | 277 | $translation[$id] = $code; |
278 | 278 | } |
279 | 279 | |
280 | 280 | //schema |
281 | - switch ( $schema ) { |
|
281 | + switch ($schema) { |
|
282 | 282 | case 'lower' : |
283 | - $translation[$id] = strtolower( $translation[$id] ); //even though these start in lower case, this will catch any statuses added via filter. |
|
283 | + $translation[$id] = strtolower($translation[$id]); //even though these start in lower case, this will catch any statuses added via filter. |
|
284 | 284 | break; |
285 | 285 | case 'sentence' : |
286 | - $translation[$id] = ucwords( $translation[$id] ); |
|
286 | + $translation[$id] = ucwords($translation[$id]); |
|
287 | 287 | break; |
288 | 288 | case 'upper' : |
289 | - $translation[$id] = strtoupper( $translation[$id] ); |
|
289 | + $translation[$id] = strtoupper($translation[$id]); |
|
290 | 290 | break; |
291 | 291 | } |
292 | 292 | } |