@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | */ |
22 | 22 | |
23 | 23 | |
24 | -if( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
25 | - exit( 'No direct script access allowed' ); |
|
24 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
25 | + exit('No direct script access allowed'); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | class Model_Data_Translator { |
@@ -40,14 +40,14 @@ discard block |
||
40 | 40 | * @param string $requested_version |
41 | 41 | * @return mixed |
42 | 42 | */ |
43 | - public static function prepare_field_values_from_json( $field_obj, $original_value_maybe_array, $requested_version ) { |
|
44 | - if( is_array( $original_value_maybe_array ) ) { |
|
43 | + public static function prepare_field_values_from_json($field_obj, $original_value_maybe_array, $requested_version) { |
|
44 | + if (is_array($original_value_maybe_array)) { |
|
45 | 45 | $new_value_maybe_array = array(); |
46 | - foreach( $original_value_maybe_array as $array_key => $array_item ) { |
|
47 | - $new_value_maybe_array[ $array_key ] = Model_Data_Translator::prepare_field_value_from_json( $field_obj, $array_item, $requested_version ); |
|
46 | + foreach ($original_value_maybe_array as $array_key => $array_item) { |
|
47 | + $new_value_maybe_array[$array_key] = Model_Data_Translator::prepare_field_value_from_json($field_obj, $array_item, $requested_version); |
|
48 | 48 | } |
49 | 49 | } else { |
50 | - $new_value_maybe_array = Model_Data_Translator::prepare_field_value_from_json( $field_obj, $original_value_maybe_array, $requested_version ); |
|
50 | + $new_value_maybe_array = Model_Data_Translator::prepare_field_value_from_json($field_obj, $original_value_maybe_array, $requested_version); |
|
51 | 51 | } |
52 | 52 | return $new_value_maybe_array; |
53 | 53 | } |
@@ -59,14 +59,14 @@ discard block |
||
59 | 59 | * @param string $request_version (eg 4.8.36) |
60 | 60 | * @return array |
61 | 61 | */ |
62 | - public static function prepare_field_values_for_json( $field_obj, $original_value_maybe_array, $request_version ){ |
|
63 | - if( is_array( $original_value_maybe_array ) ) { |
|
62 | + public static function prepare_field_values_for_json($field_obj, $original_value_maybe_array, $request_version) { |
|
63 | + if (is_array($original_value_maybe_array)) { |
|
64 | 64 | $new_value_maybe_array = array(); |
65 | - foreach( $original_value_maybe_array as $array_key => $array_item ) { |
|
66 | - $new_value_maybe_array[ $array_key ] = Model_Data_Translator::prepare_field_value_for_json( $field_obj, $array_item, $request_version ); |
|
65 | + foreach ($original_value_maybe_array as $array_key => $array_item) { |
|
66 | + $new_value_maybe_array[$array_key] = Model_Data_Translator::prepare_field_value_for_json($field_obj, $array_item, $request_version); |
|
67 | 67 | } |
68 | 68 | } else { |
69 | - $new_value_maybe_array = Model_Data_Translator::prepare_field_value_for_json( $field_obj, $original_value_maybe_array, $request_version ); |
|
69 | + $new_value_maybe_array = Model_Data_Translator::prepare_field_value_for_json($field_obj, $original_value_maybe_array, $request_version); |
|
70 | 70 | } |
71 | 71 | return $new_value_maybe_array; |
72 | 72 | } |
@@ -79,13 +79,13 @@ discard block |
||
79 | 79 | * @param string $requested_version |
80 | 80 | * @return mixed |
81 | 81 | */ |
82 | - public static function prepare_field_value_from_json( $field_obj, $original_value, $requested_version ) { |
|
82 | + public static function prepare_field_value_from_json($field_obj, $original_value, $requested_version) { |
|
83 | 83 | $new_value = null; |
84 | - if( $field_obj instanceof \EE_Infinite_Integer_Field |
|
85 | - && in_array( $original_value, array( null, '' ), true ) ) { |
|
84 | + if ($field_obj instanceof \EE_Infinite_Integer_Field |
|
85 | + && in_array($original_value, array(null, ''), true)) { |
|
86 | 86 | $new_value = EE_INF; |
87 | - } elseif( $field_obj instanceof \EE_Datetime_Field ) { |
|
88 | - $new_value = rest_parse_date( $original_value ); |
|
87 | + } elseif ($field_obj instanceof \EE_Datetime_Field) { |
|
88 | + $new_value = rest_parse_date($original_value); |
|
89 | 89 | } else { |
90 | 90 | $new_value = $original_value; |
91 | 91 | } |
@@ -98,22 +98,22 @@ discard block |
||
98 | 98 | * @param mixed $original_value |
99 | 99 | * @return mixed |
100 | 100 | */ |
101 | - public static function prepare_field_value_for_json( $field_obj, $original_value, $requested_version ) { |
|
102 | - if( $original_value === EE_INF ) { |
|
101 | + public static function prepare_field_value_for_json($field_obj, $original_value, $requested_version) { |
|
102 | + if ($original_value === EE_INF) { |
|
103 | 103 | $new_value = Model_Data_Translator::ee_inf_in_rest; |
104 | - } elseif( $field_obj instanceof \EE_Datetime_Field ) { |
|
105 | - if( $original_value instanceof \DateTime ) { |
|
106 | - $new_value = $original_value->format( 'Y-m-d H:i:s' ); |
|
107 | - } elseif( is_int( $original_value ) ) { |
|
108 | - $new_value = date( 'Y-m-d H:i:s', $original_value ); |
|
104 | + } elseif ($field_obj instanceof \EE_Datetime_Field) { |
|
105 | + if ($original_value instanceof \DateTime) { |
|
106 | + $new_value = $original_value->format('Y-m-d H:i:s'); |
|
107 | + } elseif (is_int($original_value)) { |
|
108 | + $new_value = date('Y-m-d H:i:s', $original_value); |
|
109 | 109 | } else { |
110 | 110 | $new_value = $original_value; |
111 | 111 | } |
112 | - $new_value = mysql_to_rfc3339( $new_value ); |
|
112 | + $new_value = mysql_to_rfc3339($new_value); |
|
113 | 113 | } else { |
114 | 114 | $new_value = $original_value; |
115 | 115 | } |
116 | - return apply_filters( 'FHEE__EventEspresso\core\libraries\rest_api\Model_Data_Translator__prepare_field_for_rest_api', |
|
116 | + return apply_filters('FHEE__EventEspresso\core\libraries\rest_api\Model_Data_Translator__prepare_field_for_rest_api', |
|
117 | 117 | $new_value, |
118 | 118 | $field_obj, |
119 | 119 | $original_value, |
@@ -129,29 +129,29 @@ discard block |
||
129 | 129 | * @param string $requested_version |
130 | 130 | * @return array |
131 | 131 | */ |
132 | - public static function prepare_conditions_query_params_for_models( $inputted_query_params_of_this_type, \EEM_Base $model, $requested_version ) { |
|
132 | + public static function prepare_conditions_query_params_for_models($inputted_query_params_of_this_type, \EEM_Base $model, $requested_version) { |
|
133 | 133 | $query_param_for_models = array(); |
134 | - foreach( $inputted_query_params_of_this_type as $query_param_key => $query_param_value ) { |
|
134 | + foreach ($inputted_query_params_of_this_type as $query_param_key => $query_param_value) { |
|
135 | 135 | $field = Model_Data_Translator::deduce_field_from_query_param( |
136 | - Model_Data_Translator::remove_stars_and_anything_after_from_condition_query_param_key( $query_param_key ), |
|
136 | + Model_Data_Translator::remove_stars_and_anything_after_from_condition_query_param_key($query_param_key), |
|
137 | 137 | $model |
138 | 138 | ); |
139 | - if( $field instanceof \EE_Model_Field_Base ) { |
|
139 | + if ($field instanceof \EE_Model_Field_Base) { |
|
140 | 140 | //did they specify an operator? |
141 | - if( is_array( $query_param_value ) ) { |
|
142 | - $op = $query_param_value[ 0 ]; |
|
143 | - $translated_value = array( $op ); |
|
144 | - if( isset( $query_param_value[ 1 ] ) ) { |
|
145 | - $value = $query_param_value[ 1 ]; |
|
146 | - $translated_value[1] = Model_Data_Translator::prepare_field_values_from_json( $field, $value, $requested_version ); |
|
141 | + if (is_array($query_param_value)) { |
|
142 | + $op = $query_param_value[0]; |
|
143 | + $translated_value = array($op); |
|
144 | + if (isset($query_param_value[1])) { |
|
145 | + $value = $query_param_value[1]; |
|
146 | + $translated_value[1] = Model_Data_Translator::prepare_field_values_from_json($field, $value, $requested_version); |
|
147 | 147 | } |
148 | 148 | } else { |
149 | - $translated_value = Model_Data_Translator::prepare_field_value_from_json( $field, $query_param_value, $requested_version ); |
|
149 | + $translated_value = Model_Data_Translator::prepare_field_value_from_json($field, $query_param_value, $requested_version); |
|
150 | 150 | } |
151 | - $query_param_for_models[ $query_param_key ] = $translated_value; |
|
151 | + $query_param_for_models[$query_param_key] = $translated_value; |
|
152 | 152 | } else { |
153 | 153 | //so it's not for a field, assume it's a logic query param key |
154 | - $query_param_for_models[ $query_param_key ] = Model_Data_Translator::prepare_conditions_query_params_for_models( $query_param_value, $model, $requested_version ); |
|
154 | + $query_param_for_models[$query_param_key] = Model_Data_Translator::prepare_conditions_query_params_for_models($query_param_value, $model, $requested_version); |
|
155 | 155 | } |
156 | 156 | } |
157 | 157 | return $query_param_for_models; |
@@ -164,27 +164,27 @@ discard block |
||
164 | 164 | * @param string $requested_version eg "4.8.36". If null is provided, defaults to the latest release of the EE4 REST API |
165 | 165 | * @return array which can be passed into the EE4 REST API when querying a model resource |
166 | 166 | */ |
167 | - public static function prepare_query_params_for_rest_api( $model_query_params, \EEM_Base $model, $requested_version = null ) { |
|
168 | - if( $requested_version === null ) { |
|
169 | - $requested_version = \EED_Core_Rest_Api::latest_rest_api_version() ; |
|
167 | + public static function prepare_query_params_for_rest_api($model_query_params, \EEM_Base $model, $requested_version = null) { |
|
168 | + if ($requested_version === null) { |
|
169 | + $requested_version = \EED_Core_Rest_Api::latest_rest_api_version(); |
|
170 | 170 | } |
171 | 171 | $rest_query_params = $model_query_params; |
172 | - if ( isset( $model_query_params[0] ) ) { |
|
173 | - $rest_query_params[ 'where' ] = Model_Data_Translator::prepare_conditions_query_params_for_rest_api( |
|
174 | - $model_query_params[ 0 ], |
|
172 | + if (isset($model_query_params[0])) { |
|
173 | + $rest_query_params['where'] = Model_Data_Translator::prepare_conditions_query_params_for_rest_api( |
|
174 | + $model_query_params[0], |
|
175 | 175 | $model, |
176 | 176 | $requested_version |
177 | 177 | ); |
178 | - unset( $rest_query_params[0] ); |
|
178 | + unset($rest_query_params[0]); |
|
179 | 179 | } |
180 | - if ( isset( $model_query_params[ 'having' ] ) ) { |
|
181 | - $rest_query_params[ 'having' ] = Model_Data_Translator::prepare_conditions_query_params_for_rest_api( |
|
182 | - $model_query_params[ 'having' ], |
|
180 | + if (isset($model_query_params['having'])) { |
|
181 | + $rest_query_params['having'] = Model_Data_Translator::prepare_conditions_query_params_for_rest_api( |
|
182 | + $model_query_params['having'], |
|
183 | 183 | $model, |
184 | 184 | $requested_version |
185 | 185 | ); |
186 | 186 | } |
187 | - return apply_filters( 'FHEE__EventEspresso\core\libraries\rest_api\Model_Data_Translator__prepare_query_params_for_rest_api', $rest_query_params, $model_query_params, $model, $requested_version ); |
|
187 | + return apply_filters('FHEE__EventEspresso\core\libraries\rest_api\Model_Data_Translator__prepare_query_params_for_rest_api', $rest_query_params, $model_query_params, $model, $requested_version); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | /** |
@@ -194,39 +194,39 @@ discard block |
||
194 | 194 | * @param string $requested_version eg "4.8.36" |
195 | 195 | * @return array ready for use in the rest api query params |
196 | 196 | */ |
197 | - public static function prepare_conditions_query_params_for_rest_api( $inputted_query_params_of_this_type, \EEM_Base $model, $requested_version ) { |
|
197 | + public static function prepare_conditions_query_params_for_rest_api($inputted_query_params_of_this_type, \EEM_Base $model, $requested_version) { |
|
198 | 198 | $query_param_for_models = array(); |
199 | - foreach( $inputted_query_params_of_this_type as $query_param_key => $query_param_value ) { |
|
199 | + foreach ($inputted_query_params_of_this_type as $query_param_key => $query_param_value) { |
|
200 | 200 | $field = Model_Data_Translator::deduce_field_from_query_param( |
201 | - Model_Data_Translator::remove_stars_and_anything_after_from_condition_query_param_key( $query_param_key ), |
|
201 | + Model_Data_Translator::remove_stars_and_anything_after_from_condition_query_param_key($query_param_key), |
|
202 | 202 | $model |
203 | 203 | ); |
204 | - if( $field instanceof \EE_Model_Field_Base ) { |
|
204 | + if ($field instanceof \EE_Model_Field_Base) { |
|
205 | 205 | //did they specify an operator? |
206 | - if( is_array( $query_param_value ) ) { |
|
207 | - $op = $query_param_value[ 0 ]; |
|
208 | - $translated_value = array( $op ); |
|
209 | - if( isset( $query_param_value[ 1 ] ) ) { |
|
210 | - $value = $query_param_value[ 1 ]; |
|
211 | - $translated_value[1] = Model_Data_Translator::prepare_field_values_for_json( $field, $value, $requested_version ); |
|
206 | + if (is_array($query_param_value)) { |
|
207 | + $op = $query_param_value[0]; |
|
208 | + $translated_value = array($op); |
|
209 | + if (isset($query_param_value[1])) { |
|
210 | + $value = $query_param_value[1]; |
|
211 | + $translated_value[1] = Model_Data_Translator::prepare_field_values_for_json($field, $value, $requested_version); |
|
212 | 212 | } |
213 | 213 | } else { |
214 | - $translated_value = Model_Data_Translator::prepare_field_value_for_json( $field, $query_param_value, $requested_version ); |
|
214 | + $translated_value = Model_Data_Translator::prepare_field_value_for_json($field, $query_param_value, $requested_version); |
|
215 | 215 | } |
216 | - $query_param_for_models[ $query_param_key ] = $translated_value; |
|
216 | + $query_param_for_models[$query_param_key] = $translated_value; |
|
217 | 217 | } else { |
218 | 218 | //so it's not for a field, assume it's a logic query param key |
219 | - $query_param_for_models[ $query_param_key ] = Model_Data_Translator::prepare_conditions_query_params_for_rest_api( $query_param_value, $model, $requested_version ); |
|
219 | + $query_param_for_models[$query_param_key] = Model_Data_Translator::prepare_conditions_query_params_for_rest_api($query_param_value, $model, $requested_version); |
|
220 | 220 | } |
221 | 221 | } |
222 | 222 | return $query_param_for_models; |
223 | 223 | } |
224 | 224 | |
225 | - public static function remove_stars_and_anything_after_from_condition_query_param_key( $condition_query_param_key ) { |
|
225 | + public static function remove_stars_and_anything_after_from_condition_query_param_key($condition_query_param_key) { |
|
226 | 226 | $pos_of_star = strpos($condition_query_param_key, '*'); |
227 | - if($pos_of_star === FALSE){ |
|
227 | + if ($pos_of_star === FALSE) { |
|
228 | 228 | return $condition_query_param_key; |
229 | - }else{ |
|
229 | + } else { |
|
230 | 230 | $condition_query_param_sans_star = substr($condition_query_param_key, 0, $pos_of_star); |
231 | 231 | return $condition_query_param_sans_star; |
232 | 232 | } |
@@ -238,26 +238,26 @@ discard block |
||
238 | 238 | * @throws EE_Error |
239 | 239 | * @return EE_Model_Field_Base |
240 | 240 | */ |
241 | - public static function deduce_field_from_query_param($query_param_name, \EEM_Base $model){ |
|
241 | + public static function deduce_field_from_query_param($query_param_name, \EEM_Base $model) { |
|
242 | 242 | //ok, now proceed with deducing which part is the model's name, and which is the field's name |
243 | 243 | //which will help us find the database table and column |
244 | 244 | |
245 | - $query_param_parts = explode(".",$query_param_name); |
|
246 | - if(empty($query_param_parts)){ |
|
247 | - throw new \EE_Error(sprintf(__("_extract_column_name is empty when trying to extract column and table name from %s",'event_espresso'),$query_param_name)); |
|
245 | + $query_param_parts = explode(".", $query_param_name); |
|
246 | + if (empty($query_param_parts)) { |
|
247 | + throw new \EE_Error(sprintf(__("_extract_column_name is empty when trying to extract column and table name from %s", 'event_espresso'), $query_param_name)); |
|
248 | 248 | } |
249 | 249 | $number_of_parts = count($query_param_parts); |
250 | - $last_query_param_part = $query_param_parts[ count($query_param_parts) - 1 ]; |
|
251 | - if($number_of_parts == 1){ |
|
250 | + $last_query_param_part = $query_param_parts[count($query_param_parts) - 1]; |
|
251 | + if ($number_of_parts == 1) { |
|
252 | 252 | $field_name = $last_query_param_part; |
253 | - }else{// $number_of_parts >= 2 |
|
253 | + } else {// $number_of_parts >= 2 |
|
254 | 254 | //the last part is the column name, and there are only 2parts. therefore... |
255 | 255 | $field_name = $last_query_param_part; |
256 | - $model = \EE_Registry::instance()->load_model( $query_param_parts[ $number_of_parts - 2 ]); |
|
256 | + $model = \EE_Registry::instance()->load_model($query_param_parts[$number_of_parts - 2]); |
|
257 | 257 | } |
258 | - try{ |
|
258 | + try { |
|
259 | 259 | return $model->field_settings_for($field_name); |
260 | - }catch(\EE_Error $e){ |
|
260 | + } catch (\EE_Error $e) { |
|
261 | 261 | return null; |
262 | 262 | } |
263 | 263 | } |
@@ -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 |
@@ -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 | /** |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @subpackage |
12 | 12 | * @author Mike Nelson |
13 | 13 | */ |
14 | -class EE_PMT_Aim extends EE_PMT_Base{ |
|
14 | +class EE_PMT_Aim extends EE_PMT_Base { |
|
15 | 15 | |
16 | 16 | |
17 | 17 | /** |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | require_once($this->file_folder().'EEG_Aim.gateway.php'); |
35 | 35 | $this->_gateway = new EEG_Aim(); |
36 | 36 | $this->_pretty_name = __("Authorize.net AIM", 'event_espresso'); |
37 | - $this->_default_description = __( 'Please provide the following billing information.', 'event_espresso' ); |
|
37 | + $this->_default_description = __('Please provide the following billing information.', 'event_espresso'); |
|
38 | 38 | $this->_requires_https = true; |
39 | 39 | } |
40 | 40 | |
@@ -47,61 +47,61 @@ discard block |
||
47 | 47 | * @return EE_Billing_Info_Form |
48 | 48 | * @throws \EE_Error |
49 | 49 | */ |
50 | - public function generate_new_billing_form( EE_Transaction $transaction = NULL ) { |
|
51 | - $billing_form = new EE_Billing_Attendee_Info_Form($this->_pm_instance,array( |
|
50 | + public function generate_new_billing_form(EE_Transaction $transaction = NULL) { |
|
51 | + $billing_form = new EE_Billing_Attendee_Info_Form($this->_pm_instance, array( |
|
52 | 52 | 'name'=>'AIM_Form', |
53 | 53 | 'subsections'=>array( |
54 | 54 | 'credit_card'=>new EE_Credit_Card_Input(array( |
55 | 55 | 'required'=>true, |
56 | - 'html_label_text' => __( 'Card Number', 'event_espresso' ) |
|
56 | + 'html_label_text' => __('Card Number', 'event_espresso') |
|
57 | 57 | )), |
58 | 58 | 'exp_month'=>new EE_Credit_Card_Month_Input(true, array( |
59 | 59 | 'required'=>true, |
60 | - 'html_label_text' => __( 'Expiry Month', 'event_espresso' ) |
|
60 | + 'html_label_text' => __('Expiry Month', 'event_espresso') |
|
61 | 61 | )), |
62 | - 'exp_year'=>new EE_Credit_Card_Year_Input( array( |
|
62 | + 'exp_year'=>new EE_Credit_Card_Year_Input(array( |
|
63 | 63 | 'required'=>true, |
64 | - 'html_label_text' => __( 'Expiry Year', 'event_espresso' ) |
|
64 | + 'html_label_text' => __('Expiry Year', 'event_espresso') |
|
65 | 65 | )), |
66 | - 'cvv'=>new EE_CVV_Input( array( |
|
66 | + 'cvv'=>new EE_CVV_Input(array( |
|
67 | 67 | 'required'=>true, |
68 | - 'html_label_text' => __( 'CVV', 'event_espresso' ) ) ), |
|
68 | + 'html_label_text' => __('CVV', 'event_espresso') )), |
|
69 | 69 | ) |
70 | 70 | )); |
71 | - $billing_form->add_subsections( array( |
|
72 | - 'company' => new EE_Text_Input( array( |
|
71 | + $billing_form->add_subsections(array( |
|
72 | + 'company' => new EE_Text_Input(array( |
|
73 | 73 | 'html_label_text' => __('Company', 'event_espresso') |
74 | 74 | )) |
75 | - ), 'email', false ); |
|
75 | + ), 'email', false); |
|
76 | 76 | $billing_form->add_subsections( |
77 | 77 | array( |
78 | - 'fax' => new EE_Text_Input( array( |
|
78 | + 'fax' => new EE_Text_Input(array( |
|
79 | 79 | 'html_label_text' => __('Fax', 'event_espresso') |
80 | 80 | )) |
81 | 81 | ), |
82 | 82 | 'phone', |
83 | 83 | false ); |
84 | 84 | $settings_form = $this->settings_form(); |
85 | - if( $settings_form->get_input( 'excluded_billing_inputs' ) instanceof EE_Checkbox_Multi_Input ) { |
|
86 | - $billing_form->exclude( $settings_form->get_input( 'excluded_billing_inputs' )->normalized_value() ); |
|
85 | + if ($settings_form->get_input('excluded_billing_inputs') instanceof EE_Checkbox_Multi_Input) { |
|
86 | + $billing_form->exclude($settings_form->get_input('excluded_billing_inputs')->normalized_value()); |
|
87 | 87 | } |
88 | - if( $settings_form->get_input( 'required_billing_inputs' ) instanceof EE_Checkbox_Multi_Input ) { |
|
89 | - $required_inputs = $settings_form->get_input( 'required_billing_inputs' )->normalized_value(); |
|
88 | + if ($settings_form->get_input('required_billing_inputs') instanceof EE_Checkbox_Multi_Input) { |
|
89 | + $required_inputs = $settings_form->get_input('required_billing_inputs')->normalized_value(); |
|
90 | 90 | //only change the requirement of inputs which are allowed to be changed |
91 | 91 | /** @var EE_Form_Input_Base[] $inputs_to_evaluate */ |
92 | 92 | $inputs_to_evaluate = array_intersect_key( |
93 | 93 | $billing_form->inputs(), |
94 | 94 | $this->billing_input_names() |
95 | 95 | ); |
96 | - foreach( $inputs_to_evaluate as $input_name => $input ) { |
|
97 | - if( in_array( $input_name, $required_inputs ) ) { |
|
98 | - $input->set_required( true ); |
|
96 | + foreach ($inputs_to_evaluate as $input_name => $input) { |
|
97 | + if (in_array($input_name, $required_inputs)) { |
|
98 | + $input->set_required(true); |
|
99 | 99 | } else { |
100 | - $input->set_required( false ); |
|
100 | + $input->set_required(false); |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | } |
104 | - return $this->apply_billing_form_debug_settings( $billing_form ); |
|
104 | + return $this->apply_billing_form_debug_settings($billing_form); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | |
@@ -114,18 +114,18 @@ discard block |
||
114 | 114 | * @return \EE_Billing_Info_Form |
115 | 115 | * @throws \EE_Error |
116 | 116 | */ |
117 | - public function apply_billing_form_debug_settings( EE_Billing_Info_Form $billing_form ) { |
|
117 | + public function apply_billing_form_debug_settings(EE_Billing_Info_Form $billing_form) { |
|
118 | 118 | if ( |
119 | 119 | $this->_pm_instance->debug_mode() |
120 | - || $this->_pm_instance->get_extra_meta( 'test_transactions', TRUE, FALSE ) |
|
120 | + || $this->_pm_instance->get_extra_meta('test_transactions', TRUE, FALSE) |
|
121 | 121 | ) { |
122 | - $billing_form->get_input( 'credit_card' )->set_default( '4007000000027' ); |
|
123 | - $billing_form->get_input( 'exp_year' )->set_default( '2020' ); |
|
124 | - if( $billing_form->get_subsection( 'cvv' ) instanceof EE_Form_Input_Base ) { |
|
125 | - $billing_form->get_input( 'cvv' )->set_default( '123' ); |
|
122 | + $billing_form->get_input('credit_card')->set_default('4007000000027'); |
|
123 | + $billing_form->get_input('exp_year')->set_default('2020'); |
|
124 | + if ($billing_form->get_subsection('cvv') instanceof EE_Form_Input_Base) { |
|
125 | + $billing_form->get_input('cvv')->set_default('123'); |
|
126 | 126 | } |
127 | 127 | $billing_form->add_subsections( |
128 | - array( 'fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html() ), |
|
128 | + array('fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html()), |
|
129 | 129 | 'credit_card' |
130 | 130 | ); |
131 | 131 | $billing_form->add_subsections( |
@@ -153,17 +153,17 @@ discard block |
||
153 | 153 | 'extra_meta_inputs'=>array( |
154 | 154 | 'login_id'=>new EE_Text_Input( |
155 | 155 | array( |
156 | - 'html_label_text'=> sprintf( __("Authorize.net API Login ID %s", "event_espresso"), $this->get_help_tab_link() ), |
|
156 | + 'html_label_text'=> sprintf(__("Authorize.net API Login ID %s", "event_espresso"), $this->get_help_tab_link()), |
|
157 | 157 | 'required' => true ) |
158 | 158 | ), |
159 | 159 | 'transaction_key'=>new EE_Text_Input( |
160 | 160 | array( |
161 | - 'html_label_text'=> sprintf( __("Authorize.net Transaction Key %s", "event_espresso"), $this->get_help_tab_link() ), |
|
161 | + 'html_label_text'=> sprintf(__("Authorize.net Transaction Key %s", "event_espresso"), $this->get_help_tab_link()), |
|
162 | 162 | 'required' => true ) |
163 | 163 | ), |
164 | 164 | 'test_transactions'=>new EE_Yes_No_Input( |
165 | 165 | array( |
166 | - 'html_label_text'=> sprintf( __("Send test transactions? %s", 'event_espresso'), $this->get_help_tab_link() ), |
|
166 | + 'html_label_text'=> sprintf(__("Send test transactions? %s", 'event_espresso'), $this->get_help_tab_link()), |
|
167 | 167 | 'html_help_text'=> __("Send test transactions, even to live server", 'event_espresso'), |
168 | 168 | 'default' => false, |
169 | 169 | 'required' => true |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | 'excluded_billing_inputs' => new EE_Checkbox_Multi_Input( |
173 | 173 | $billing_input_names, |
174 | 174 | array( |
175 | - 'html_label_text' => sprintf( __("Excluded Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link() ), |
|
175 | + 'html_label_text' => sprintf(__("Excluded Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link()), |
|
176 | 176 | 'default' => array( |
177 | 177 | 'company', |
178 | 178 | 'fax', |
@@ -181,10 +181,10 @@ discard block |
||
181 | 181 | 'required_billing_inputs' => new EE_Checkbox_Multi_Input( |
182 | 182 | $billing_input_names, |
183 | 183 | array( |
184 | - 'html_label_text' => sprintf( __("Required Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link() ), |
|
184 | + 'html_label_text' => sprintf(__("Required Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link()), |
|
185 | 185 | 'default' => array_diff( |
186 | - array_keys( $billing_input_names ), |
|
187 | - array( 'address2', 'phone', 'company', 'fax' ) |
|
186 | + array_keys($billing_input_names), |
|
187 | + array('address2', 'phone', 'company', 'fax') |
|
188 | 188 | ), |
189 | 189 | 'html_help_text' => __('Note: if fields are excluded they cannot be required.', 'event_espresso') |
190 | 190 | ) |
@@ -193,14 +193,14 @@ discard block |
||
193 | 193 | apply_filters( |
194 | 194 | 'FHEE__EE_PMT_Aim__generate_new_settings_form__server_select_input__options', |
195 | 195 | array( |
196 | - 'akamai' => __( 'Authorize.net/Akamai (default)', 'event_espresso' ), |
|
197 | - 'authorize.net' => __( 'Authorize.net (deprecated)', 'event_espresso' ), |
|
196 | + 'akamai' => __('Authorize.net/Akamai (default)', 'event_espresso'), |
|
197 | + 'authorize.net' => __('Authorize.net (deprecated)', 'event_espresso'), |
|
198 | 198 | ), |
199 | 199 | $this |
200 | 200 | ), |
201 | 201 | array( |
202 | - 'html_label_text' => __( 'Server', 'event_espresso' ), |
|
203 | - 'html_help_text' => __( 'The Gateway Server where payment requests will be sent', 'event_espresso' ) |
|
202 | + 'html_label_text' => __('Server', 'event_espresso'), |
|
203 | + 'html_help_text' => __('The Gateway Server where payment requests will be sent', 'event_espresso') |
|
204 | 204 | ) |
205 | 205 | ) |
206 | 206 | |
@@ -216,10 +216,10 @@ discard block |
||
216 | 216 | */ |
217 | 217 | public function billing_input_names() { |
218 | 218 | return array( |
219 | - 'first_name' => __( 'First Name', 'event_espresso' ), |
|
219 | + 'first_name' => __('First Name', 'event_espresso'), |
|
220 | 220 | 'last_name' => __('Last Name', 'event_espresso'), |
221 | - 'email' => __( 'Email', 'event_espresso' ), |
|
222 | - 'company' => __( 'Company', 'event_espresso' ), |
|
221 | + 'email' => __('Email', 'event_espresso'), |
|
222 | + 'company' => __('Company', 'event_espresso'), |
|
223 | 223 | 'address' => __('Address', 'event_espresso'), |
224 | 224 | 'address2' => __('Address2', 'event_espresso'), |
225 | 225 | 'city' => __('City', 'event_espresso'), |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | 'country' => __('Country', 'event_espresso'), |
228 | 228 | 'zip' => __('Zip', 'event_espresso'), |
229 | 229 | 'phone' => __('Phone', 'event_espresso'), |
230 | - 'fax' => __( 'Fax', 'event_espresso' ), |
|
230 | + 'fax' => __('Fax', 'event_espresso'), |
|
231 | 231 | 'cvv' => __('CVV', 'event_espresso') |
232 | 232 | ); |
233 | 233 | } |
@@ -239,10 +239,10 @@ discard block |
||
239 | 239 | * @param EE_Billing_Info_Form $billing_form |
240 | 240 | * @return array |
241 | 241 | */ |
242 | - protected function _get_billing_values_from_form( $billing_form ){ |
|
242 | + protected function _get_billing_values_from_form($billing_form) { |
|
243 | 243 | $all_billing_values_empty = array(); |
244 | - foreach( array_keys( $this->billing_input_names() ) as $input_name ) { |
|
245 | - $all_billing_values_empty[ $input_name ] = ''; |
|
244 | + foreach (array_keys($this->billing_input_names()) as $input_name) { |
|
245 | + $all_billing_values_empty[$input_name] = ''; |
|
246 | 246 | } |
247 | 247 | return array_merge( |
248 | 248 | $all_billing_values_empty, |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * @see EE_PMT_Base::help_tabs_config() |
258 | 258 | * @return array |
259 | 259 | */ |
260 | - public function help_tabs_config(){ |
|
260 | + public function help_tabs_config() { |
|
261 | 261 | return array( |
262 | 262 | $this->get_help_tab_name() => array( |
263 | 263 | 'title' => __('Authorize.net AIM Settings', 'event_espresso'), |
@@ -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 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EEG_Aim extends EE_Onsite_Gateway{ |
|
28 | +class EEG_Aim extends EE_Onsite_Gateway { |
|
29 | 29 | |
30 | 30 | const LIVE_URL = 'https://secure2.authorize.net/gateway/transact.dll'; //Authnet URL |
31 | 31 | |
@@ -157,9 +157,9 @@ discard block |
||
157 | 157 | * @param EEG_Aim $gateway_object |
158 | 158 | * @return string |
159 | 159 | */ |
160 | - public function possibly_use_deprecated_aim_server( $url, EEG_Aim $gateway_object ) { |
|
161 | - if( $gateway_object->_server === 'authorize.net' |
|
162 | - && ! $gateway_object->_debug_mode ) { |
|
160 | + public function possibly_use_deprecated_aim_server($url, EEG_Aim $gateway_object) { |
|
161 | + if ($gateway_object->_server === 'authorize.net' |
|
162 | + && ! $gateway_object->_debug_mode) { |
|
163 | 163 | return 'https://secure.authorize.net/gateway/transact.dll'; |
164 | 164 | } else { |
165 | 165 | return $url; |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | */ |
183 | 183 | |
184 | 184 | public function do_direct_payment($payment, $billing_info = null) { |
185 | - add_filter( 'FHEE__EEG_Aim___get_server_url', array( $this, 'possibly_use_deprecated_aim_server' ), 10, 2 ); |
|
185 | + add_filter('FHEE__EEG_Aim___get_server_url', array($this, 'possibly_use_deprecated_aim_server'), 10, 2); |
|
186 | 186 | // Enable test mode if needed |
187 | 187 | //4007000000027 <-- test successful visa |
188 | 188 | //4222222222222 <-- test failure card number |
@@ -193,17 +193,17 @@ discard block |
||
193 | 193 | $primary_registrant = $transaction->primary_registration(); |
194 | 194 | //if we're are charging for the full amount, show the normal line items |
195 | 195 | //and the itemized total adds up properly |
196 | - if( $this->_can_easily_itemize_transaction_for( $payment ) ){ |
|
196 | + if ($this->_can_easily_itemize_transaction_for($payment)) { |
|
197 | 197 | $total_line_item = $transaction->total_line_item(); |
198 | 198 | foreach ($total_line_item->get_items() as $line_item) { |
199 | 199 | $this->addLineItem($item_num++, $line_item->name(), $line_item->desc(), $line_item->quantity(), $line_item->unit_price(), 'N'); |
200 | 200 | $order_description .= $line_item->desc().', '; |
201 | 201 | } |
202 | - foreach($total_line_item->tax_descendants() as $tax_line_item){ |
|
202 | + foreach ($total_line_item->tax_descendants() as $tax_line_item) { |
|
203 | 203 | $this->addLineItem($item_num++, $tax_line_item->name(), $tax_line_item->desc(), 1, $tax_line_item->total(), 'N'); |
204 | 204 | } |
205 | - }else{//partial payment |
|
206 | - $order_description = sprintf(__("Payment of %s for %s", "event_espresso"),$payment->amount(),$primary_registrant->reg_code()); |
|
205 | + } else {//partial payment |
|
206 | + $order_description = sprintf(__("Payment of %s for %s", "event_espresso"), $payment->amount(), $primary_registrant->reg_code()); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | |
@@ -212,18 +212,18 @@ discard block |
||
212 | 212 | //start transaction |
213 | 213 | //if in debug mode, use authorize.net's sandbox id; otherwise use the Event Espresso partner id |
214 | 214 | $partner_id = $this->_debug_mode ? 'AAA100302' : 'AAA105363'; |
215 | - $this->setField( 'solution_id', $partner_id ); |
|
215 | + $this->setField('solution_id', $partner_id); |
|
216 | 216 | $this->setField('amount', $this->format_currency($payment->amount())); |
217 | - $this->setField('description',substr(rtrim($order_description, ', '), 0, 255)); |
|
218 | - $this->_set_sensitive_billing_data( $billing_info ); |
|
217 | + $this->setField('description', substr(rtrim($order_description, ', '), 0, 255)); |
|
218 | + $this->_set_sensitive_billing_data($billing_info); |
|
219 | 219 | $this->setField('first_name', $billing_info['first_name']); |
220 | 220 | $this->setField('last_name', $billing_info['last_name']); |
221 | 221 | $this->setField('email', $billing_info['email']); |
222 | 222 | $this->setField('company', $billing_info['company']); |
223 | 223 | $this->setField('address', $billing_info['address'].' '.$billing_info['address2']); |
224 | 224 | $this->setField('city', $billing_info['city']); |
225 | - $this->setField('state', $billing_info['state'] ); |
|
226 | - $this->setField('country', $billing_info['country'] ); |
|
225 | + $this->setField('state', $billing_info['state']); |
|
226 | + $this->setField('country', $billing_info['country']); |
|
227 | 227 | $this->setField('zip', $billing_info['zip']); |
228 | 228 | $this->setField('fax', $billing_info['fax']); |
229 | 229 | $this->setField('cust_id', $primary_registrant->ID()); |
@@ -231,9 +231,9 @@ discard block |
||
231 | 231 | //invoice_num would be nice to have it be unique per SPCO page-load, that way if users |
232 | 232 | //press back, they don't submit a duplicate. However, we may be keeping the user on teh same spco page |
233 | 233 | //in which case, we need to generate teh invoice num per request right here... |
234 | - $this->setField('invoice_num', wp_generate_password(12,false));//$billing_info['_reg-page-billing-invoice-'.$this->_gateway_name]['value']); |
|
234 | + $this->setField('invoice_num', wp_generate_password(12, false)); //$billing_info['_reg-page-billing-invoice-'.$this->_gateway_name]['value']); |
|
235 | 235 | //tell AIM that any duplicates sent in the next 5 minutes are to be ignored |
236 | - $this->setField('duplicate_window', 5 * MINUTE_IN_SECONDS ); |
|
236 | + $this->setField('duplicate_window', 5 * MINUTE_IN_SECONDS); |
|
237 | 237 | |
238 | 238 | |
239 | 239 | if ($this->_test_transactions) { |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | //Capture response |
244 | 244 | $this->type = "AUTH_CAPTURE"; |
245 | 245 | $response = $this->_sendRequest($payment); |
246 | - if (!empty($response)){ |
|
246 | + if ( ! empty($response)) { |
|
247 | 247 | if ($this->_debug_mode) { |
248 | 248 | $txn_id = $response->invoice_number; |
249 | 249 | } else { |
@@ -252,15 +252,15 @@ discard block |
||
252 | 252 | $payment_status = $response->approved ? $this->_pay_model->approved_status() : $this->_pay_model->declined_status(); |
253 | 253 | $payment->set_status($payment_status); |
254 | 254 | //make sure we interpret the AMT as a float, not an international string (where periods are thousand separators) |
255 | - $payment->set_amount( (float) $response->amount ); |
|
256 | - $payment->set_gateway_response(sprintf("%s (code: %s)",$response->response_reason_text,$response->response_reason_code)); |
|
257 | - $payment->set_txn_id_chq_nmbr( $txn_id ); |
|
255 | + $payment->set_amount((float) $response->amount); |
|
256 | + $payment->set_gateway_response(sprintf("%s (code: %s)", $response->response_reason_text, $response->response_reason_code)); |
|
257 | + $payment->set_txn_id_chq_nmbr($txn_id); |
|
258 | 258 | $payment->set_extra_accntng($primary_registrant->reg_code()); |
259 | - $payment->set_details(print_r($response,true)); |
|
259 | + $payment->set_details(print_r($response, true)); |
|
260 | 260 | } else { |
261 | 261 | $payment->set_status($this->_pay_model->failed_status()); |
262 | 262 | $payment->set_gateway_response(__("There was no response from Authorize.net", 'event_espresso')); |
263 | - $payment->set_details(print_r($response,true)); |
|
263 | + $payment->set_details(print_r($response, true)); |
|
264 | 264 | } |
265 | 265 | return $payment; |
266 | 266 | } |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | * what billing data gets sent |
272 | 272 | * @param array $billing_info |
273 | 273 | */ |
274 | - protected function _set_sensitive_billing_data( $billing_info ) { |
|
274 | + protected function _set_sensitive_billing_data($billing_info) { |
|
275 | 275 | $this->setField('card_num', $billing_info['credit_card']); |
276 | 276 | $this->setField('exp_date', $billing_info['exp_month'].$billing_info['exp_year']); |
277 | 277 | $this->setField('card_code', $billing_info['cvv']); |
@@ -330,22 +330,22 @@ discard block |
||
330 | 330 | $this->_x_post_fields['tran_key'] = $this->_transaction_key; |
331 | 331 | $x_keys = array(); |
332 | 332 | foreach ($this->_x_post_fields as $key => $value) { |
333 | - $x_keys[] = "x_$key=" . urlencode($value); |
|
333 | + $x_keys[] = "x_$key=".urlencode($value); |
|
334 | 334 | } |
335 | 335 | // Add line items |
336 | 336 | foreach ($this->_additional_line_items as $key => $value) { |
337 | - $x_keys[] = "x_line_item=" . urlencode($value); |
|
337 | + $x_keys[] = "x_line_item=".urlencode($value); |
|
338 | 338 | } |
339 | 339 | $this->_log_clean_request($x_keys, $payment); |
340 | 340 | $post_url = $this->_get_server_url(); |
341 | 341 | $curl_request = curl_init($post_url); |
342 | - curl_setopt($curl_request, CURLOPT_POSTFIELDS, implode("&",$x_keys)); |
|
342 | + curl_setopt($curl_request, CURLOPT_POSTFIELDS, implode("&", $x_keys)); |
|
343 | 343 | curl_setopt($curl_request, CURLOPT_HEADER, 0); |
344 | 344 | curl_setopt($curl_request, CURLOPT_TIMEOUT, 45); |
345 | 345 | curl_setopt($curl_request, CURLOPT_RETURNTRANSFER, 1); |
346 | 346 | curl_setopt($curl_request, CURLOPT_SSL_VERIFYHOST, 2); |
347 | 347 | if ($this->VERIFY_PEER) { |
348 | - curl_setopt($curl_request, CURLOPT_CAINFO, dirname( __DIR__ ) . '/ssl/cert.pem'); |
|
348 | + curl_setopt($curl_request, CURLOPT_CAINFO, dirname(__DIR__).'/ssl/cert.pem'); |
|
349 | 349 | } else { |
350 | 350 | curl_setopt($curl_request, CURLOPT_SSL_VERIFYPEER, false); |
351 | 351 | } |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | $response = curl_exec($curl_request); |
358 | 358 | |
359 | 359 | curl_close($curl_request); |
360 | - $response_obj = new EE_AuthorizeNetAIM_Response($response); |
|
360 | + $response_obj = new EE_AuthorizeNetAIM_Response($response); |
|
361 | 361 | |
362 | 362 | return $this->_log_and_clean_response($response_obj, $payment); |
363 | 363 | } |
@@ -366,18 +366,18 @@ discard block |
||
366 | 366 | * @param array $request_array |
367 | 367 | * @param EEI_Payment $payment |
368 | 368 | */ |
369 | - protected function _log_clean_request($request_array,$payment){ |
|
370 | - $keys_to_filter_out = array( 'x_card_num', 'x_card_code', 'x_exp_date' ); |
|
371 | - foreach($request_array as $index => $keyvaltogether ) { |
|
372 | - foreach( $keys_to_filter_out as $key ) { |
|
373 | - if( strpos( $keyvaltogether, $key ) === 0 ){ |
|
369 | + protected function _log_clean_request($request_array, $payment) { |
|
370 | + $keys_to_filter_out = array('x_card_num', 'x_card_code', 'x_exp_date'); |
|
371 | + foreach ($request_array as $index => $keyvaltogether) { |
|
372 | + foreach ($keys_to_filter_out as $key) { |
|
373 | + if (strpos($keyvaltogether, $key) === 0) { |
|
374 | 374 | //found it at the first character |
375 | 375 | //so its one of them |
376 | - unset( $request_array[ $index ] ); |
|
376 | + unset($request_array[$index]); |
|
377 | 377 | } |
378 | 378 | } |
379 | 379 | } |
380 | - $this->log(array('AIM Request sent:'=>$request_array, 'Server URL' => $this->_get_server_url() ),$payment); |
|
380 | + $this->log(array('AIM Request sent:'=>$request_array, 'Server URL' => $this->_get_server_url()), $payment); |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | |
@@ -389,9 +389,9 @@ discard block |
||
389 | 389 | * @param EE_Payment $payment |
390 | 390 | * @return \EE_AuthorizeNetAIM_Response |
391 | 391 | */ |
392 | - private function _log_and_clean_response($response_obj,$payment){ |
|
392 | + private function _log_and_clean_response($response_obj, $payment) { |
|
393 | 393 | $response_obj->account_number = ''; |
394 | - $this->log(array('AIM Response received:'=>$response_obj),$payment); |
|
394 | + $this->log(array('AIM Response received:'=>$response_obj), $payment); |
|
395 | 395 | return $response_obj; |
396 | 396 | } |
397 | 397 | |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | // Split Array |
491 | 491 | $this->response = $response; |
492 | 492 | if ($encap_char) { |
493 | - $this->_response_array = explode($encap_char . $delimiter . $encap_char, substr($response, 1, -1)); |
|
493 | + $this->_response_array = explode($encap_char.$delimiter.$encap_char, substr($response, 1, -1)); |
|
494 | 494 | } else { |
495 | 495 | $this->_response_array = explode($delimiter, $response); |
496 | 496 | } |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | $this->held = ($this->response_code === self::HELD); |
561 | 561 | |
562 | 562 | if ($this->error || $this->declined || $this->held) { |
563 | - $this->error_message = '<p><strong class="credit_card_failure">Attention: your transaction was declined for the following reason(s):</strong><br />' . $this->response_reason_text . '<br /><span class="response_code">Response Code: ' . $this->response_code . '<br /></span><span class="response_subcode">Response Subcode: ' . $this->response_subcode . '</span></p><p>To try again, <a href="#payment_options">please click here</a>.</p> '; |
|
563 | + $this->error_message = '<p><strong class="credit_card_failure">Attention: your transaction was declined for the following reason(s):</strong><br />'.$this->response_reason_text.'<br /><span class="response_code">Response Code: '.$this->response_code.'<br /></span><span class="response_subcode">Response Subcode: '.$this->response_subcode.'</span></p><p>To try again, <a href="#payment_options">please click here</a>.</p> '; |
|
564 | 564 | |
565 | 565 | |
566 | 566 | /* $this->error_message = "AuthorizeNet Error: |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | |
580 | 580 | } |
581 | 581 | |
582 | -if ( ! class_exists( 'AuthorizeNetException' ) ) { |
|
582 | +if ( ! class_exists('AuthorizeNetException')) { |
|
583 | 583 | /** |
584 | 584 | * Class AuthorizeNetException |
585 | 585 | * |
@@ -595,8 +595,8 @@ discard block |
||
595 | 595 | * @param Exception $previous [optional] The previous exception used for the exception chaining. Since 5.3.0 |
596 | 596 | * @since 5.1.0 |
597 | 597 | */ |
598 | - public function __construct( $message = "", $code = 0, Exception $previous = null ) { |
|
599 | - parent::__construct( $message, $code, $previous ); |
|
598 | + public function __construct($message = "", $code = 0, Exception $previous = null) { |
|
599 | + parent::__construct($message, $code, $previous); |
|
600 | 600 | } |
601 | 601 | } |
602 | 602 | } |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | // if you're a dev and want to receive all errors via email add this to your wp-config.php: define( 'EE_ERROR_EMAILS', TRUE ); |
3 | -if ( defined( 'WP_DEBUG' ) && WP_DEBUG === TRUE && defined( 'EE_ERROR_EMAILS' ) && EE_ERROR_EMAILS === TRUE ) { |
|
4 | - set_error_handler( array( 'EE_Error', 'error_handler' )); |
|
5 | - register_shutdown_function( array( 'EE_Error', 'fatal_error_handler' )); |
|
3 | +if (defined('WP_DEBUG') && WP_DEBUG === TRUE && defined('EE_ERROR_EMAILS') && EE_ERROR_EMAILS === TRUE) { |
|
4 | + set_error_handler(array('EE_Error', 'error_handler')); |
|
5 | + register_shutdown_function(array('EE_Error', 'fatal_error_handler')); |
|
6 | 6 | } |
7 | 7 | /** |
8 | 8 | * |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @access private |
65 | 65 | * @var boolean |
66 | 66 | */ |
67 | - private static $_espresso_notices = array( 'success' => FALSE, 'errors' => FALSE, 'attention' => FALSE ); |
|
67 | + private static $_espresso_notices = array('success' => FALSE, 'errors' => FALSE, 'attention' => FALSE); |
|
68 | 68 | |
69 | 69 | |
70 | 70 | |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | * @access public |
76 | 76 | * @echo string |
77 | 77 | */ |
78 | - function __construct( $message, $code = 0, Exception $previous = NULL ) { |
|
79 | - if ( version_compare( phpversion(), '5.3.0', '<' )) { |
|
80 | - parent::__construct( $message, $code ); |
|
78 | + function __construct($message, $code = 0, Exception $previous = NULL) { |
|
79 | + if (version_compare(phpversion(), '5.3.0', '<')) { |
|
80 | + parent::__construct($message, $code); |
|
81 | 81 | } else { |
82 | - parent::__construct( $message, $code, $previous ); |
|
82 | + parent::__construct($message, $code, $previous); |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | * @param $line |
95 | 95 | * @return void |
96 | 96 | */ |
97 | - public static function error_handler( $code, $message, $file, $line ) { |
|
98 | - $type = EE_Error::error_type( $code ); |
|
97 | + public static function error_handler($code, $message, $file, $line) { |
|
98 | + $type = EE_Error::error_type($code); |
|
99 | 99 | $site = site_url(); |
100 | - switch ( $site ) { |
|
100 | + switch ($site) { |
|
101 | 101 | case 'http://ee4.eventespresso.com/' : |
102 | 102 | case 'http://ee4decaf.eventespresso.com/' : |
103 | 103 | case 'http://ee4hf.eventespresso.com/' : |
@@ -110,16 +110,16 @@ discard block |
||
110 | 110 | $to = '[email protected]'; |
111 | 111 | break; |
112 | 112 | default : |
113 | - $to = get_option( 'admin_email' ); |
|
113 | + $to = get_option('admin_email'); |
|
114 | 114 | } |
115 | - $subject = $type . ' ' . $message . ' in ' . EVENT_ESPRESSO_VERSION . ' on ' . site_url(); |
|
116 | - $msg = EE_Error::_format_error( $type, $message, $file, $line ); |
|
117 | - if ( function_exists( 'wp_mail' )) { |
|
118 | - add_filter( 'wp_mail_content_type', array( 'EE_Error', 'set_content_type' )); |
|
119 | - wp_mail( $to, $subject, $msg ); |
|
115 | + $subject = $type.' '.$message.' in '.EVENT_ESPRESSO_VERSION.' on '.site_url(); |
|
116 | + $msg = EE_Error::_format_error($type, $message, $file, $line); |
|
117 | + if (function_exists('wp_mail')) { |
|
118 | + add_filter('wp_mail_content_type', array('EE_Error', 'set_content_type')); |
|
119 | + wp_mail($to, $subject, $msg); |
|
120 | 120 | } |
121 | 121 | echo '<div id="message" class="espresso-notices error"><p>'; |
122 | - echo $type . ': ' . $message . '<br />' . $file . ' line ' . $line; |
|
122 | + echo $type.': '.$message.'<br />'.$file.' line '.$line; |
|
123 | 123 | echo '<br /></p></div>'; |
124 | 124 | } |
125 | 125 | |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | * @param $code |
133 | 133 | * @return string |
134 | 134 | */ |
135 | - public static function error_type( $code ) { |
|
136 | - switch( $code ) { |
|
135 | + public static function error_type($code) { |
|
136 | + switch ($code) { |
|
137 | 137 | case E_ERROR: // 1 // |
138 | 138 | return 'E_ERROR'; |
139 | 139 | case E_WARNING: // 2 // |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | */ |
180 | 180 | public static function fatal_error_handler() { |
181 | 181 | $last_error = error_get_last(); |
182 | - if ( $last_error['type'] === E_ERROR ) { |
|
183 | - EE_Error::error_handler( E_ERROR, $last_error['message'], $last_error['file'], $last_error['line'] ); |
|
182 | + if ($last_error['type'] === E_ERROR) { |
|
183 | + EE_Error::error_handler(E_ERROR, $last_error['message'], $last_error['file'], $last_error['line']); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * @param $line |
196 | 196 | * @return string |
197 | 197 | */ |
198 | - private static function _format_error( $code, $message, $file, $line ) { |
|
198 | + private static function _format_error($code, $message, $file, $line) { |
|
199 | 199 | $html = "<table cellpadding='5'><thead bgcolor='#f8f8f8'><th>Item</th><th align='left'>Details</th></thead><tbody>"; |
200 | 200 | $html .= "<tr valign='top'><td><b>Code</b></td><td>$code</td></tr>"; |
201 | 201 | $html .= "<tr valign='top'><td><b>Error</b></td><td>$message</td></tr>"; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * @param $content_type |
214 | 214 | * @return string |
215 | 215 | */ |
216 | - public static function set_content_type( $content_type ) { |
|
216 | + public static function set_content_type($content_type) { |
|
217 | 217 | return 'text/html'; |
218 | 218 | } |
219 | 219 | |
@@ -227,24 +227,24 @@ discard block |
||
227 | 227 | */ |
228 | 228 | public function get_error() { |
229 | 229 | |
230 | - if( apply_filters( 'FHEE__EE_Error__get_error__show_normal_exceptions', FALSE ) ){ |
|
230 | + if (apply_filters('FHEE__EE_Error__get_error__show_normal_exceptions', FALSE)) { |
|
231 | 231 | throw $this; |
232 | 232 | } |
233 | 233 | // get separate user and developer messages if they exist |
234 | - $msg = explode( '||', $this->getMessage() ); |
|
234 | + $msg = explode('||', $this->getMessage()); |
|
235 | 235 | $user_msg = $msg[0]; |
236 | - $dev_msg = isset( $msg[1] ) ? $msg[1] : $msg[0]; |
|
236 | + $dev_msg = isset($msg[1]) ? $msg[1] : $msg[0]; |
|
237 | 237 | $msg = WP_DEBUG ? $dev_msg : $user_msg; |
238 | 238 | |
239 | 239 | // add details to _all_exceptions array |
240 | 240 | $x_time = time(); |
241 | - self::$_all_exceptions[ $x_time ]['name'] = get_class( $this ); |
|
242 | - self::$_all_exceptions[ $x_time ]['file'] = $this->getFile(); |
|
243 | - self::$_all_exceptions[ $x_time ]['line'] = $this->getLine(); |
|
244 | - self::$_all_exceptions[ $x_time ]['msg'] = $msg; |
|
245 | - self::$_all_exceptions[ $x_time ]['code'] = $this->getCode(); |
|
246 | - self::$_all_exceptions[ $x_time ]['trace'] = $this->getTrace(); |
|
247 | - self::$_all_exceptions[ $x_time ]['string'] = $this->getTraceAsString(); |
|
241 | + self::$_all_exceptions[$x_time]['name'] = get_class($this); |
|
242 | + self::$_all_exceptions[$x_time]['file'] = $this->getFile(); |
|
243 | + self::$_all_exceptions[$x_time]['line'] = $this->getLine(); |
|
244 | + self::$_all_exceptions[$x_time]['msg'] = $msg; |
|
245 | + self::$_all_exceptions[$x_time]['code'] = $this->getCode(); |
|
246 | + self::$_all_exceptions[$x_time]['trace'] = $this->getTrace(); |
|
247 | + self::$_all_exceptions[$x_time]['string'] = $this->getTraceAsString(); |
|
248 | 248 | self::$_error_count++; |
249 | 249 | |
250 | 250 | //add_action( 'shutdown', array( $this, 'display_errors' )); |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | * @access public |
260 | 260 | * @return boolean |
261 | 261 | */ |
262 | - public static function has_error(){ |
|
262 | + public static function has_error() { |
|
263 | 263 | return self::$_error_count ? TRUE : FALSE; |
264 | 264 | } |
265 | 265 | |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * @access public |
271 | 271 | * @echo string |
272 | 272 | */ |
273 | - public function display_errors(){ |
|
273 | + public function display_errors() { |
|
274 | 274 | |
275 | 275 | $trace_details = ''; |
276 | 276 | |
@@ -331,18 +331,18 @@ discard block |
||
331 | 331 | </style> |
332 | 332 | <div id="ee-error-message" class="error">'; |
333 | 333 | |
334 | - if ( ! WP_DEBUG ) { |
|
334 | + if ( ! WP_DEBUG) { |
|
335 | 335 | $output .= ' |
336 | 336 | <p>'; |
337 | 337 | } |
338 | 338 | |
339 | 339 | // cycle thru errors |
340 | - foreach ( self::$_all_exceptions as $time => $ex ) { |
|
340 | + foreach (self::$_all_exceptions as $time => $ex) { |
|
341 | 341 | |
342 | 342 | // process trace info |
343 | - if ( empty( $ex['trace'] )) { |
|
343 | + if (empty($ex['trace'])) { |
|
344 | 344 | |
345 | - $trace_details .= __( 'Sorry, but no trace information was available for this exception.', 'event_espresso' ); |
|
345 | + $trace_details .= __('Sorry, but no trace information was available for this exception.', 'event_espresso'); |
|
346 | 346 | |
347 | 347 | } else { |
348 | 348 | |
@@ -357,50 +357,50 @@ discard block |
||
357 | 357 | <th scope="col" align="left">Method( arguments )</th> |
358 | 358 | </tr>'; |
359 | 359 | |
360 | - $last_on_stack = count( $ex['trace'] ) - 1; |
|
360 | + $last_on_stack = count($ex['trace']) - 1; |
|
361 | 361 | // reverse array so that stack is in proper chronological order |
362 | - $sorted_trace = array_reverse( $ex['trace'] ); |
|
362 | + $sorted_trace = array_reverse($ex['trace']); |
|
363 | 363 | |
364 | - foreach ( $sorted_trace as $nmbr => $trace ) { |
|
364 | + foreach ($sorted_trace as $nmbr => $trace) { |
|
365 | 365 | |
366 | - $file = isset( $trace['file'] ) ? $trace['file'] : '' ; |
|
367 | - $class = isset( $trace['class'] ) ? $trace['class'] : ''; |
|
368 | - $type = isset( $trace['type'] ) ? $trace['type'] : ''; |
|
369 | - $function = isset( $trace['function'] ) ? $trace['function'] : ''; |
|
370 | - $args = isset( $trace['args'] ) ? $this->_convert_args_to_string( $trace['args'] ) : ''; |
|
371 | - $line = isset( $trace['line'] ) ? $trace['line'] : ''; |
|
366 | + $file = isset($trace['file']) ? $trace['file'] : ''; |
|
367 | + $class = isset($trace['class']) ? $trace['class'] : ''; |
|
368 | + $type = isset($trace['type']) ? $trace['type'] : ''; |
|
369 | + $function = isset($trace['function']) ? $trace['function'] : ''; |
|
370 | + $args = isset($trace['args']) ? $this->_convert_args_to_string($trace['args']) : ''; |
|
371 | + $line = isset($trace['line']) ? $trace['line'] : ''; |
|
372 | 372 | $zebra = $nmbr % 2 ? ' odd' : ''; |
373 | 373 | |
374 | - if ( empty( $file ) && ! empty( $class )) { |
|
375 | - $a = new ReflectionClass( $class ); |
|
374 | + if (empty($file) && ! empty($class)) { |
|
375 | + $a = new ReflectionClass($class); |
|
376 | 376 | $file = $a->getFileName(); |
377 | - if ( empty( $line ) && ! empty( $function )) { |
|
378 | - $b = new ReflectionMethod( $class, $function ); |
|
377 | + if (empty($line) && ! empty($function)) { |
|
378 | + $b = new ReflectionMethod($class, $function); |
|
379 | 379 | $line = $b->getStartLine(); |
380 | 380 | } |
381 | 381 | } |
382 | 382 | |
383 | - if ( $nmbr == $last_on_stack ) { |
|
383 | + if ($nmbr == $last_on_stack) { |
|
384 | 384 | $file = $ex['file'] != '' ? $ex['file'] : $file; |
385 | 385 | $line = $ex['line'] != '' ? $ex['line'] : $line; |
386 | - $error_code = self::generate_error_code ( $file, $trace['function'], $line ); |
|
386 | + $error_code = self::generate_error_code($file, $trace['function'], $line); |
|
387 | 387 | } |
388 | 388 | |
389 | - $nmbr_dsply = ! empty( $nmbr ) ? $nmbr : ' '; |
|
390 | - $line_dsply = ! empty( $line ) ? $line : ' '; |
|
391 | - $file_dsply = ! empty( $file ) ? $file : ' '; |
|
392 | - $class_dsply = ! empty( $class ) ? $class : ' '; |
|
393 | - $type_dsply = ! empty( $type ) ? $type : ' '; |
|
394 | - $function_dsply = ! empty( $function ) ? $function : ' '; |
|
395 | - $args_dsply = ! empty( $args ) ? '( ' . $args . ' )' : ''; |
|
389 | + $nmbr_dsply = ! empty($nmbr) ? $nmbr : ' '; |
|
390 | + $line_dsply = ! empty($line) ? $line : ' '; |
|
391 | + $file_dsply = ! empty($file) ? $file : ' '; |
|
392 | + $class_dsply = ! empty($class) ? $class : ' '; |
|
393 | + $type_dsply = ! empty($type) ? $type : ' '; |
|
394 | + $function_dsply = ! empty($function) ? $function : ' '; |
|
395 | + $args_dsply = ! empty($args) ? '( '.$args.' )' : ''; |
|
396 | 396 | |
397 | 397 | $trace_details .= ' |
398 | 398 | <tr> |
399 | - <td align="right" class="' . $zebra . '">' . $nmbr_dsply . '</td> |
|
400 | - <td align="right" class="' . $zebra . '">' . $line_dsply . '</td> |
|
401 | - <td align="left" class="' . $zebra . '">' . $file_dsply . '</td> |
|
402 | - <td align="left" class="' . $zebra . '">' . $class_dsply . '</td> |
|
403 | - <td align="left" class="' . $zebra . '">' . $type_dsply . $function_dsply . $args_dsply . '</td> |
|
399 | + <td align="right" class="' . $zebra.'">'.$nmbr_dsply.'</td> |
|
400 | + <td align="right" class="' . $zebra.'">'.$line_dsply.'</td> |
|
401 | + <td align="left" class="' . $zebra.'">'.$file_dsply.'</td> |
|
402 | + <td align="left" class="' . $zebra.'">'.$class_dsply.'</td> |
|
403 | + <td align="left" class="' . $zebra.'">'.$type_dsply.$function_dsply.$args_dsply.'</td> |
|
404 | 404 | </tr>'; |
405 | 405 | |
406 | 406 | |
@@ -415,9 +415,9 @@ discard block |
||
415 | 415 | $ex['code'] = $ex['code'] ? $ex['code'] : $error_code; |
416 | 416 | |
417 | 417 | // add generic non-identifying messages for non-privileged uesrs |
418 | - if ( ! WP_DEBUG ) { |
|
418 | + if ( ! WP_DEBUG) { |
|
419 | 419 | |
420 | - $output .= '<span class="ee-error-user-msg-spn">' . trim( $ex['msg'] ) . '</span> <sup>' . $ex['code'] . '</sup><br />'; |
|
420 | + $output .= '<span class="ee-error-user-msg-spn">'.trim($ex['msg']).'</span> <sup>'.$ex['code'].'</sup><br />'; |
|
421 | 421 | |
422 | 422 | } else { |
423 | 423 | |
@@ -425,24 +425,24 @@ discard block |
||
425 | 425 | $output .= ' |
426 | 426 | <div class="ee-error-dev-msg-dv"> |
427 | 427 | <p class="ee-error-dev-msg-pg"> |
428 | - <strong class="ee-error-dev-msg-str">An ' . $ex['name'] . ' exception was thrown!</strong> <span>code: ' . $ex['code'] . '</span><br /> |
|
429 | - <span class="big-text">"' . trim( $ex['msg'] ) . '"</span><br/> |
|
430 | - <a id="display-ee-error-trace-' . self::$_error_count . $time . '" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-' . self::$_error_count . $time . '"> |
|
431 | - ' . __( 'click to view backtrace and class/method details', 'event_espresso' ) . ' |
|
428 | + <strong class="ee-error-dev-msg-str">An ' . $ex['name'].' exception was thrown!</strong> <span>code: '.$ex['code'].'</span><br /> |
|
429 | + <span class="big-text">"' . trim($ex['msg']).'"</span><br/> |
|
430 | + <a id="display-ee-error-trace-' . self::$_error_count.$time.'" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-'.self::$_error_count.$time.'"> |
|
431 | + ' . __('click to view backtrace and class/method details', 'event_espresso').' |
|
432 | 432 | </a><br /> |
433 | 433 | <span class="small-text lt-grey-text">'.$ex['file'].' ( line no: '.$ex['line'].' )</span> |
434 | 434 | </p> |
435 | - <div id="ee-error-trace-' . self::$_error_count . $time . '-dv" class="ee-error-trace-dv" style="display: none;"> |
|
435 | + <div id="ee-error-trace-' . self::$_error_count.$time.'-dv" class="ee-error-trace-dv" style="display: none;"> |
|
436 | 436 | ' . $trace_details; |
437 | 437 | |
438 | - if ( ! empty( $class )) { |
|
438 | + if ( ! empty($class)) { |
|
439 | 439 | $output .= ' |
440 | 440 | <div style="padding:3px; margin:0 0 1em; border:1px solid #666; background:#fff; border-radius:3px;"> |
441 | 441 | <div style="padding:1em 2em; border:1px solid #666; background:#f9f9f9;"> |
442 | 442 | <h3>Class Details</h3>'; |
443 | - $a = new ReflectionClass( $class ); |
|
443 | + $a = new ReflectionClass($class); |
|
444 | 444 | $output .= ' |
445 | - <pre>' . $a . '</pre> |
|
445 | + <pre>' . $a.'</pre> |
|
446 | 446 | </div> |
447 | 447 | </div>'; |
448 | 448 | } |
@@ -454,14 +454,14 @@ discard block |
||
454 | 454 | |
455 | 455 | } |
456 | 456 | |
457 | - $this->write_to_error_log( $time, $ex ); |
|
457 | + $this->write_to_error_log($time, $ex); |
|
458 | 458 | |
459 | 459 | } |
460 | 460 | |
461 | 461 | // remove last linebreak |
462 | - $output = substr( $output, 0, ( count( $output ) - 7 )); |
|
462 | + $output = substr($output, 0, (count($output) - 7)); |
|
463 | 463 | |
464 | - if ( ! WP_DEBUG ) { |
|
464 | + if ( ! WP_DEBUG) { |
|
465 | 465 | $output .= ' |
466 | 466 | </p>'; |
467 | 467 | } |
@@ -469,10 +469,10 @@ discard block |
||
469 | 469 | $output .= ' |
470 | 470 | </div>'; |
471 | 471 | |
472 | - $output .= self::_print_scripts( TRUE ); |
|
472 | + $output .= self::_print_scripts(TRUE); |
|
473 | 473 | |
474 | - if ( defined( 'DOING_AJAX' )) { |
|
475 | - echo json_encode( array( 'error' => $output )); |
|
474 | + if (defined('DOING_AJAX')) { |
|
475 | + echo json_encode(array('error' => $output)); |
|
476 | 476 | exit(); |
477 | 477 | } |
478 | 478 | |
@@ -492,29 +492,29 @@ discard block |
||
492 | 492 | * @ param array $arguments |
493 | 493 | * @ return string |
494 | 494 | */ |
495 | - private function _convert_args_to_string ( $arguments = array(), $array = FALSE ) { |
|
495 | + private function _convert_args_to_string($arguments = array(), $array = FALSE) { |
|
496 | 496 | |
497 | 497 | $arg_string = ''; |
498 | - if ( ! empty( $arguments )) { |
|
498 | + if ( ! empty($arguments)) { |
|
499 | 499 | |
500 | 500 | $args = array(); |
501 | 501 | |
502 | - foreach ( $arguments as $arg ) { |
|
502 | + foreach ($arguments as $arg) { |
|
503 | 503 | |
504 | - if ( ! empty( $arg )) { |
|
504 | + if ( ! empty($arg)) { |
|
505 | 505 | |
506 | - if ( is_string( $arg )) { |
|
507 | - $args[] = " '" . $arg . "'"; |
|
508 | - } elseif ( is_array( $arg )) { |
|
509 | - $args[] = 'ARRAY(' . $this->_convert_args_to_string( $arg, TRUE ); |
|
510 | - } elseif ( is_null( $arg )) { |
|
506 | + if (is_string($arg)) { |
|
507 | + $args[] = " '".$arg."'"; |
|
508 | + } elseif (is_array($arg)) { |
|
509 | + $args[] = 'ARRAY('.$this->_convert_args_to_string($arg, TRUE); |
|
510 | + } elseif (is_null($arg)) { |
|
511 | 511 | $args[] = ' NULL'; |
512 | - } elseif ( is_bool( $arg )) { |
|
513 | - $args[] = ( $arg ) ? ' TRUE' : ' FALSE'; |
|
514 | - } elseif ( is_object( $arg )) { |
|
515 | - $args[] = ' OBJECT ' . get_class( $arg ); |
|
516 | - } elseif ( is_resource( $arg )) { |
|
517 | - $args[] = get_resource_type( $arg ); |
|
512 | + } elseif (is_bool($arg)) { |
|
513 | + $args[] = ($arg) ? ' TRUE' : ' FALSE'; |
|
514 | + } elseif (is_object($arg)) { |
|
515 | + $args[] = ' OBJECT '.get_class($arg); |
|
516 | + } elseif (is_resource($arg)) { |
|
517 | + $args[] = get_resource_type($arg); |
|
518 | 518 | } else { |
519 | 519 | $args[] = $arg; |
520 | 520 | } |
@@ -522,9 +522,9 @@ discard block |
||
522 | 522 | } |
523 | 523 | |
524 | 524 | } |
525 | - $arg_string = implode( ', ', $args ); |
|
525 | + $arg_string = implode(', ', $args); |
|
526 | 526 | } |
527 | - if ( $array ) { |
|
527 | + if ($array) { |
|
528 | 528 | $arg_string .= ' )'; |
529 | 529 | } |
530 | 530 | return $arg_string; |
@@ -544,8 +544,8 @@ discard block |
||
544 | 544 | * @param string $line the line number where the error occurred - just use __LINE__ |
545 | 545 | * @return void |
546 | 546 | */ |
547 | - public static function add_error( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
|
548 | - self::_add_notice ( 'errors', $msg, $file, $func, $line ); |
|
547 | + public static function add_error($msg = NULL, $file = NULL, $func = NULL, $line = NULL) { |
|
548 | + self::_add_notice('errors', $msg, $file, $func, $line); |
|
549 | 549 | self::$_error_count++; |
550 | 550 | } |
551 | 551 | |
@@ -558,11 +558,11 @@ discard block |
||
558 | 558 | * @param string $line |
559 | 559 | * @throws EE_Error |
560 | 560 | */ |
561 | - public static function throw_exception_if_debugging( $msg = null, $file = null, $func = null, $line = null ) { |
|
562 | - if( WP_DEBUG ) { |
|
563 | - throw new EE_Error( $msg ); |
|
564 | - } else { |
|
565 | - EE_Error::add_error( $msg, $file, $func, $line ); |
|
561 | + public static function throw_exception_if_debugging($msg = null, $file = null, $func = null, $line = null) { |
|
562 | + if (WP_DEBUG) { |
|
563 | + throw new EE_Error($msg); |
|
564 | + } else { |
|
565 | + EE_Error::add_error($msg, $file, $func, $line); |
|
566 | 566 | } |
567 | 567 | } |
568 | 568 | |
@@ -580,8 +580,8 @@ discard block |
||
580 | 580 | * @param string $line the line number where the error occurred - just use __LINE__ |
581 | 581 | * @return void |
582 | 582 | */ |
583 | - public static function add_success( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
|
584 | - self::_add_notice ( 'success', $msg, $file, $func, $line ); |
|
583 | + public static function add_success($msg = NULL, $file = NULL, $func = NULL, $line = NULL) { |
|
584 | + self::_add_notice('success', $msg, $file, $func, $line); |
|
585 | 585 | } |
586 | 586 | |
587 | 587 | |
@@ -598,8 +598,8 @@ discard block |
||
598 | 598 | * @param string $line the line number where the error occurred - just use __LINE__ |
599 | 599 | * @return void |
600 | 600 | */ |
601 | - public static function add_attention( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
|
602 | - self::_add_notice ( 'attention', $msg, $file, $func, $line ); |
|
601 | + public static function add_attention($msg = NULL, $file = NULL, $func = NULL, $line = NULL) { |
|
602 | + self::_add_notice('attention', $msg, $file, $func, $line); |
|
603 | 603 | } |
604 | 604 | |
605 | 605 | |
@@ -617,12 +617,12 @@ discard block |
||
617 | 617 | * @param string $line the line number where the error occurred - just use __LINE__ |
618 | 618 | * @return void |
619 | 619 | */ |
620 | - private static function _add_notice( $type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
|
621 | - if ( empty( $msg )) { |
|
620 | + private static function _add_notice($type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL) { |
|
621 | + if (empty($msg)) { |
|
622 | 622 | EE_Error::doing_it_wrong( |
623 | - 'EE_Error::add_' . $type . '()', |
|
623 | + 'EE_Error::add_'.$type.'()', |
|
624 | 624 | sprintf( |
625 | - __( 'Notifications are not much use without a message! Please add a message to the EE_Error::add_%s() call made in %s on line %d', 'event_espresso' ), |
|
625 | + __('Notifications are not much use without a message! Please add a message to the EE_Error::add_%s() call made in %s on line %d', 'event_espresso'), |
|
626 | 626 | $type, |
627 | 627 | $file, |
628 | 628 | $line |
@@ -630,17 +630,17 @@ discard block |
||
630 | 630 | EVENT_ESPRESSO_VERSION |
631 | 631 | ); |
632 | 632 | } |
633 | - if ( $type == 'errors' && ( empty( $file ) || empty( $func ) || empty( $line ))) { |
|
633 | + if ($type == 'errors' && (empty($file) || empty($func) || empty($line))) { |
|
634 | 634 | EE_Error::doing_it_wrong( |
635 | 635 | 'EE_Error::add_error()', |
636 | - __('You need to provide the file name, function name, and line number that the error occurred on in order to better assist with debugging.', 'event_espresso' ), |
|
636 | + __('You need to provide the file name, function name, and line number that the error occurred on in order to better assist with debugging.', 'event_espresso'), |
|
637 | 637 | EVENT_ESPRESSO_VERSION |
638 | 638 | ); |
639 | 639 | } |
640 | 640 | // get separate user and developer messages if they exist |
641 | - $msg = explode( '||', $msg ); |
|
641 | + $msg = explode('||', $msg); |
|
642 | 642 | $user_msg = $msg[0]; |
643 | - $dev_msg = isset( $msg[1] ) ? $msg[1] : $msg[0]; |
|
643 | + $dev_msg = isset($msg[1]) ? $msg[1] : $msg[0]; |
|
644 | 644 | /** |
645 | 645 | * Do an action so other code can be triggered when a notice is created |
646 | 646 | * @param string $type can be 'errors', 'attention', or 'success' |
@@ -650,22 +650,22 @@ discard block |
||
650 | 650 | * @param string $func function where error was generated |
651 | 651 | * @param string $line line where error was generated |
652 | 652 | */ |
653 | - do_action( 'AHEE__EE_Error___add_notice', $type, $user_msg, $dev_msg, $file, $func, $line ); |
|
653 | + do_action('AHEE__EE_Error___add_notice', $type, $user_msg, $dev_msg, $file, $func, $line); |
|
654 | 654 | $msg = WP_DEBUG ? $dev_msg : $user_msg; |
655 | 655 | // add notice if message exists |
656 | - if ( ! empty( $msg )) { |
|
656 | + if ( ! empty($msg)) { |
|
657 | 657 | // get error code |
658 | - $notice_code = EE_Error::generate_error_code( $file, $func, $line ); |
|
659 | - if ( WP_DEBUG && $type == 'errors' ) { |
|
660 | - $msg .= '<br/><span class="tiny-text">' . $notice_code . '</span>'; |
|
658 | + $notice_code = EE_Error::generate_error_code($file, $func, $line); |
|
659 | + if (WP_DEBUG && $type == 'errors') { |
|
660 | + $msg .= '<br/><span class="tiny-text">'.$notice_code.'</span>'; |
|
661 | 661 | } |
662 | 662 | // add notice. Index by code if it's not blank |
663 | - if( $notice_code ) { |
|
664 | - self::$_espresso_notices[ $type ][ $notice_code ] = $msg; |
|
663 | + if ($notice_code) { |
|
664 | + self::$_espresso_notices[$type][$notice_code] = $msg; |
|
665 | 665 | } else { |
666 | - self::$_espresso_notices[ $type ][] = $msg; |
|
666 | + self::$_espresso_notices[$type][] = $msg; |
|
667 | 667 | } |
668 | - add_action( 'wp_footer', array( 'EE_Error', 'enqueue_error_scripts' ), 1 ); |
|
668 | + add_action('wp_footer', array('EE_Error', 'enqueue_error_scripts'), 1); |
|
669 | 669 | } |
670 | 670 | |
671 | 671 | } |
@@ -719,7 +719,7 @@ discard block |
||
719 | 719 | * @access private |
720 | 720 | * @return void |
721 | 721 | */ |
722 | - public static function reset_notices(){ |
|
722 | + public static function reset_notices() { |
|
723 | 723 | self::$_espresso_notices['success'] = FALSE; |
724 | 724 | self::$_espresso_notices['attention'] = FALSE; |
725 | 725 | self::$_espresso_notices['errors'] = FALSE; |
@@ -732,14 +732,14 @@ discard block |
||
732 | 732 | * @access public |
733 | 733 | * @return int |
734 | 734 | */ |
735 | - public static function has_notices(){ |
|
735 | + public static function has_notices() { |
|
736 | 736 | $has_notices = 0; |
737 | 737 | // check for success messages |
738 | - $has_notices = self::$_espresso_notices['success'] && ! empty( self::$_espresso_notices['success'] ) ? 3 : $has_notices; |
|
738 | + $has_notices = self::$_espresso_notices['success'] && ! empty(self::$_espresso_notices['success']) ? 3 : $has_notices; |
|
739 | 739 | // check for attention messages |
740 | - $has_notices = self::$_espresso_notices['attention'] && ! empty( self::$_espresso_notices['attention'] ) ? 2 : $has_notices; |
|
740 | + $has_notices = self::$_espresso_notices['attention'] && ! empty(self::$_espresso_notices['attention']) ? 2 : $has_notices; |
|
741 | 741 | // check for error messages |
742 | - $has_notices = self::$_espresso_notices['errors'] && ! empty( self::$_espresso_notices['errors'] ) ? 1 : $has_notices; |
|
742 | + $has_notices = self::$_espresso_notices['errors'] && ! empty(self::$_espresso_notices['errors']) ? 1 : $has_notices; |
|
743 | 743 | return $has_notices; |
744 | 744 | } |
745 | 745 | |
@@ -754,9 +754,9 @@ discard block |
||
754 | 754 | */ |
755 | 755 | public static function get_vanilla_notices() { |
756 | 756 | return array( |
757 | - 'success' => isset( self::$_espresso_notices['success'] ) ? self::$_espresso_notices['success'] : array(), |
|
758 | - 'attention' => isset( self::$_espresso_notices['attention'] ) ? self::$_espresso_notices['attention'] : array(), |
|
759 | - 'errors' => isset( self::$_espresso_notices['errors'] ) ? self::$_espresso_notices['errors'] : array(), |
|
757 | + 'success' => isset(self::$_espresso_notices['success']) ? self::$_espresso_notices['success'] : array(), |
|
758 | + 'attention' => isset(self::$_espresso_notices['attention']) ? self::$_espresso_notices['attention'] : array(), |
|
759 | + 'errors' => isset(self::$_espresso_notices['errors']) ? self::$_espresso_notices['errors'] : array(), |
|
760 | 760 | ); |
761 | 761 | } |
762 | 762 | |
@@ -772,8 +772,8 @@ discard block |
||
772 | 772 | * @param boolean $remove_empty whether or not to unset empty messages |
773 | 773 | * @return array |
774 | 774 | */ |
775 | - public static function get_notices( $format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE ) { |
|
776 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
775 | + public static function get_notices($format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE) { |
|
776 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
777 | 777 | |
778 | 778 | $success_messages = ''; |
779 | 779 | $attention_messages = ''; |
@@ -783,44 +783,44 @@ discard block |
||
783 | 783 | // EEH_Debug_Tools::printr( self::$_espresso_notices, 'espresso_notices <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
784 | 784 | |
785 | 785 | // either save notices to the db |
786 | - if ( $save_to_transient ) { |
|
787 | - update_option( 'ee_notices', self::$_espresso_notices ); |
|
786 | + if ($save_to_transient) { |
|
787 | + update_option('ee_notices', self::$_espresso_notices); |
|
788 | 788 | return; |
789 | 789 | } |
790 | 790 | // grab any notices that have been previously saved |
791 | - if ( $notices = get_option( 'ee_notices', FALSE )) { |
|
792 | - foreach ( $notices as $type => $notice ) { |
|
793 | - if ( is_array( $notice ) && ! empty( $notice )) { |
|
791 | + if ($notices = get_option('ee_notices', FALSE)) { |
|
792 | + foreach ($notices as $type => $notice) { |
|
793 | + if (is_array($notice) && ! empty($notice)) { |
|
794 | 794 | // make sure that existsing notice type is an array |
795 | - self::$_espresso_notices[ $type ] = is_array( self::$_espresso_notices[ $type ] ) && ! empty( self::$_espresso_notices[ $type ] ) ? self::$_espresso_notices[ $type ] : array(); |
|
795 | + self::$_espresso_notices[$type] = is_array(self::$_espresso_notices[$type]) && ! empty(self::$_espresso_notices[$type]) ? self::$_espresso_notices[$type] : array(); |
|
796 | 796 | // merge stored notices with any newly created ones |
797 | - self::$_espresso_notices[ $type ] = array_merge( self::$_espresso_notices[ $type ], $notice ); |
|
797 | + self::$_espresso_notices[$type] = array_merge(self::$_espresso_notices[$type], $notice); |
|
798 | 798 | $print_scripts = TRUE; |
799 | 799 | } |
800 | 800 | } |
801 | 801 | // now clear any stored notices |
802 | - update_option( 'ee_notices', FALSE ); |
|
802 | + update_option('ee_notices', FALSE); |
|
803 | 803 | } |
804 | 804 | |
805 | 805 | // check for success messages |
806 | - if ( self::$_espresso_notices['success'] && ! empty( self::$_espresso_notices['success'] )) { |
|
806 | + if (self::$_espresso_notices['success'] && ! empty(self::$_espresso_notices['success'])) { |
|
807 | 807 | // combine messages |
808 | - $success_messages .= implode( self::$_espresso_notices['success'], '<br />' ); |
|
808 | + $success_messages .= implode(self::$_espresso_notices['success'], '<br />'); |
|
809 | 809 | $print_scripts = TRUE; |
810 | 810 | } |
811 | 811 | |
812 | 812 | // check for attention messages |
813 | - if ( self::$_espresso_notices['attention'] && ! empty( self::$_espresso_notices['attention'] ) ) { |
|
813 | + if (self::$_espresso_notices['attention'] && ! empty(self::$_espresso_notices['attention'])) { |
|
814 | 814 | // combine messages |
815 | - $attention_messages .= implode( self::$_espresso_notices['attention'], '<br />' ); |
|
815 | + $attention_messages .= implode(self::$_espresso_notices['attention'], '<br />'); |
|
816 | 816 | $print_scripts = TRUE; |
817 | 817 | } |
818 | 818 | |
819 | 819 | // check for error messages |
820 | - if ( self::$_espresso_notices['errors'] && ! empty( self::$_espresso_notices['errors'] ) ) { |
|
821 | - $error_messages .= count( self::$_espresso_notices['errors'] ) > 1 ? __( 'The following errors have occurred:<br />', 'event_espresso' ) : __( 'An error has occurred:<br />', 'event_espresso' ); |
|
820 | + if (self::$_espresso_notices['errors'] && ! empty(self::$_espresso_notices['errors'])) { |
|
821 | + $error_messages .= count(self::$_espresso_notices['errors']) > 1 ? __('The following errors have occurred:<br />', 'event_espresso') : __('An error has occurred:<br />', 'event_espresso'); |
|
822 | 822 | // combine messages |
823 | - $error_messages .= implode( self::$_espresso_notices['errors'], '<br />' ); |
|
823 | + $error_messages .= implode(self::$_espresso_notices['errors'], '<br />'); |
|
824 | 824 | $print_scripts = TRUE; |
825 | 825 | } |
826 | 826 | |
@@ -834,21 +834,21 @@ discard block |
||
834 | 834 | $css_id = is_admin() ? 'message' : 'espresso-notices-success'; |
835 | 835 | $css_class = is_admin() ? 'updated fade' : 'success fade-away'; |
836 | 836 | //showMessage( $success_messages ); |
837 | - $notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $success_messages . '</p>' . $close . '</div>'; |
|
837 | + $notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$success_messages.'</p>'.$close.'</div>'; |
|
838 | 838 | } |
839 | 839 | |
840 | 840 | if ($attention_messages != '') { |
841 | 841 | $css_id = is_admin() ? 'message' : 'espresso-notices-attention'; |
842 | 842 | $css_class = is_admin() ? 'updated ee-notices-attention' : 'attention fade-away'; |
843 | 843 | //showMessage( $error_messages, TRUE ); |
844 | - $notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $attention_messages . '</p>' . $close . '</div>'; |
|
844 | + $notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$attention_messages.'</p>'.$close.'</div>'; |
|
845 | 845 | } |
846 | 846 | |
847 | 847 | if ($error_messages != '') { |
848 | 848 | $css_id = is_admin() ? 'message' : 'espresso-notices-error'; |
849 | 849 | $css_class = is_admin() ? 'error' : 'error fade-away'; |
850 | 850 | //showMessage( $error_messages, TRUE ); |
851 | - $notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $error_messages . '</p>' . $close . '</div>'; |
|
851 | + $notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$error_messages.'</p>'.$close.'</div>'; |
|
852 | 852 | } |
853 | 853 | |
854 | 854 | $notices .= '</div>'; |
@@ -861,7 +861,7 @@ discard block |
||
861 | 861 | 'errors' => $error_messages |
862 | 862 | ); |
863 | 863 | |
864 | - if ( $remove_empty ) { |
|
864 | + if ($remove_empty) { |
|
865 | 865 | // remove empty notices |
866 | 866 | foreach ($notices as $type => $notice) { |
867 | 867 | if (empty($notice)) { |
@@ -871,7 +871,7 @@ discard block |
||
871 | 871 | } |
872 | 872 | } |
873 | 873 | |
874 | - if ( $print_scripts ) { |
|
874 | + if ($print_scripts) { |
|
875 | 875 | self::_print_scripts(); |
876 | 876 | } |
877 | 877 | |
@@ -891,17 +891,17 @@ discard block |
||
891 | 891 | * @param bool $force_update allows one to enforce the reappearance of a persistent message. |
892 | 892 | * @return void |
893 | 893 | */ |
894 | - public static function add_persistent_admin_notice( $pan_name = '', $pan_message, $force_update = FALSE ) { |
|
895 | - if ( ! empty( $pan_name ) && ! empty( $pan_message )) { |
|
896 | - $persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() ); |
|
894 | + public static function add_persistent_admin_notice($pan_name = '', $pan_message, $force_update = FALSE) { |
|
895 | + if ( ! empty($pan_name) && ! empty($pan_message)) { |
|
896 | + $persistent_admin_notices = get_option('ee_pers_admin_notices', array()); |
|
897 | 897 | //maybe initialize persistent_admin_notices |
898 | - if ( empty( $persistent_admin_notices )) { |
|
899 | - add_option( 'ee_pers_admin_notices', array(), '', 'no' ); |
|
898 | + if (empty($persistent_admin_notices)) { |
|
899 | + add_option('ee_pers_admin_notices', array(), '', 'no'); |
|
900 | 900 | } |
901 | - $pan_name = sanitize_key( $pan_name ); |
|
902 | - if ( ! array_key_exists( $pan_name, $persistent_admin_notices ) || $force_update ) { |
|
903 | - $persistent_admin_notices[ $pan_name ] = $pan_message; |
|
904 | - update_option( 'ee_pers_admin_notices', $persistent_admin_notices ); |
|
901 | + $pan_name = sanitize_key($pan_name); |
|
902 | + if ( ! array_key_exists($pan_name, $persistent_admin_notices) || $force_update) { |
|
903 | + $persistent_admin_notices[$pan_name] = $pan_message; |
|
904 | + update_option('ee_pers_admin_notices', $persistent_admin_notices); |
|
905 | 905 | } |
906 | 906 | } |
907 | 907 | } |
@@ -917,34 +917,34 @@ discard block |
||
917 | 917 | * @param bool $return_immediately |
918 | 918 | * @return void |
919 | 919 | */ |
920 | - public static function dismiss_persistent_admin_notice( $pan_name = '', $purge = FALSE, $return_immediately = FALSE ) { |
|
921 | - $pan_name = EE_Registry::instance()->REQ->is_set( 'ee_nag_notice' ) ? EE_Registry::instance()->REQ->get( 'ee_nag_notice' ) : $pan_name; |
|
922 | - if ( ! empty( $pan_name )) { |
|
923 | - $persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() ); |
|
920 | + public static function dismiss_persistent_admin_notice($pan_name = '', $purge = FALSE, $return_immediately = FALSE) { |
|
921 | + $pan_name = EE_Registry::instance()->REQ->is_set('ee_nag_notice') ? EE_Registry::instance()->REQ->get('ee_nag_notice') : $pan_name; |
|
922 | + if ( ! empty($pan_name)) { |
|
923 | + $persistent_admin_notices = get_option('ee_pers_admin_notices', array()); |
|
924 | 924 | // check if notice we wish to dismiss is actually in the $persistent_admin_notices array |
925 | - if ( is_array( $persistent_admin_notices ) && isset( $persistent_admin_notices[ $pan_name ] )) { |
|
925 | + if (is_array($persistent_admin_notices) && isset($persistent_admin_notices[$pan_name])) { |
|
926 | 926 | // completely delete nag notice, or just NULL message so that it can NOT be added again ? |
927 | - if ( $purge ) { |
|
928 | - unset( $persistent_admin_notices[ $pan_name ] ); |
|
927 | + if ($purge) { |
|
928 | + unset($persistent_admin_notices[$pan_name]); |
|
929 | 929 | } else { |
930 | - $persistent_admin_notices[ $pan_name ] = NULL; |
|
930 | + $persistent_admin_notices[$pan_name] = NULL; |
|
931 | 931 | } |
932 | - if ( update_option( 'ee_pers_admin_notices', $persistent_admin_notices ) === FALSE ) { |
|
933 | - EE_Error::add_error( sprintf( __( 'The persistent admin notice for "%s" could not be deleted.', 'event_espresso' ), $pan_name ), __FILE__, __FUNCTION__, __LINE__ ); |
|
932 | + if (update_option('ee_pers_admin_notices', $persistent_admin_notices) === FALSE) { |
|
933 | + EE_Error::add_error(sprintf(__('The persistent admin notice for "%s" could not be deleted.', 'event_espresso'), $pan_name), __FILE__, __FUNCTION__, __LINE__); |
|
934 | 934 | } |
935 | 935 | } |
936 | 936 | } |
937 | - if ( $return_immediately ) { |
|
937 | + if ($return_immediately) { |
|
938 | 938 | return; |
939 | - } else if ( EE_Registry::instance()->REQ->ajax ) { |
|
939 | + } else if (EE_Registry::instance()->REQ->ajax) { |
|
940 | 940 | // grab any notices and concatenate into string |
941 | - echo json_encode( array( 'errors' => implode( '<br />', EE_Error::get_notices( FALSE )))); |
|
941 | + echo json_encode(array('errors' => implode('<br />', EE_Error::get_notices(FALSE)))); |
|
942 | 942 | exit(); |
943 | 943 | } else { |
944 | 944 | // save errors to a transient to be displayed on next request (after redirect) |
945 | - EE_Error::get_notices( FALSE, TRUE ); |
|
946 | - $return_url = EE_Registry::instance()->REQ->is_set( 'return_url' ) ? EE_Registry::instance()->REQ->get( 'return_url' ) : ''; |
|
947 | - wp_safe_redirect( urldecode( $return_url )); |
|
945 | + EE_Error::get_notices(FALSE, TRUE); |
|
946 | + $return_url = EE_Registry::instance()->REQ->is_set('return_url') ? EE_Registry::instance()->REQ->get('return_url') : ''; |
|
947 | + wp_safe_redirect(urldecode($return_url)); |
|
948 | 948 | } |
949 | 949 | } |
950 | 950 | |
@@ -959,20 +959,20 @@ discard block |
||
959 | 959 | * @param string $return_url URL to go back to aftger nag notice is dismissed |
960 | 960 | * @return string |
961 | 961 | */ |
962 | - public static function display_persistent_admin_notices( $pan_name = '', $pan_message = '', $return_url = '' ) { |
|
963 | - if ( ! empty( $pan_name ) && ! empty( $pan_message )) { |
|
962 | + public static function display_persistent_admin_notices($pan_name = '', $pan_message = '', $return_url = '') { |
|
963 | + if ( ! empty($pan_name) && ! empty($pan_message)) { |
|
964 | 964 | $args = array( |
965 | 965 | 'nag_notice' => $pan_name, |
966 | - 'return_url' => urlencode( $return_url ), |
|
966 | + 'return_url' => urlencode($return_url), |
|
967 | 967 | 'ajax_url' => WP_AJAX_URL, |
968 | - 'unknown_error' => __( 'An unknown error has occurred on the server while attempting to dismiss this notice.', 'event_espresso' ) |
|
968 | + 'unknown_error' => __('An unknown error has occurred on the server while attempting to dismiss this notice.', 'event_espresso') |
|
969 | 969 | ); |
970 | - wp_localize_script( 'espresso_core', 'ee_dismiss', $args ); |
|
970 | + wp_localize_script('espresso_core', 'ee_dismiss', $args); |
|
971 | 971 | return ' |
972 | - <div id="' . $pan_name . '" class="espresso-notices updated ee-nag-notice clearfix" style="border-left: 4px solid #fcb93c;"> |
|
973 | - <p>' . $pan_message . '</p> |
|
974 | - <a class="dismiss-ee-nag-notice hide-if-no-js" style="float: right; cursor: pointer; text-decoration:none;" rel="' . $pan_name . '"> |
|
975 | - <span class="dashicons dashicons-dismiss" style="position:relative; top:-1px; margin-right:.25em;"></span>'.__( 'Dismiss', 'event_espresso' ) .' |
|
972 | + <div id="' . $pan_name.'" class="espresso-notices updated ee-nag-notice clearfix" style="border-left: 4px solid #fcb93c;"> |
|
973 | + <p>' . $pan_message.'</p> |
|
974 | + <a class="dismiss-ee-nag-notice hide-if-no-js" style="float: right; cursor: pointer; text-decoration:none;" rel="' . $pan_name.'"> |
|
975 | + <span class="dashicons dashicons-dismiss" style="position:relative; top:-1px; margin-right:.25em;"></span>'.__('Dismiss', 'event_espresso').' |
|
976 | 976 | </a> |
977 | 977 | <div style="clear:both;"></div> |
978 | 978 | </div>'; |
@@ -988,24 +988,24 @@ discard block |
||
988 | 988 | * @param string $return_url |
989 | 989 | * @return array |
990 | 990 | */ |
991 | - public static function get_persistent_admin_notices( $return_url = '' ) { |
|
991 | + public static function get_persistent_admin_notices($return_url = '') { |
|
992 | 992 | $notices = ''; |
993 | 993 | // check for persistent admin notices |
994 | 994 | //filter the list though so plugins can notify the admin in a different way if they want |
995 | 995 | $persistent_admin_notices = apply_filters( |
996 | 996 | 'FHEE__EE_Error__get_persistent_admin_notices', |
997 | - get_option( 'ee_pers_admin_notices', FALSE ), |
|
997 | + get_option('ee_pers_admin_notices', FALSE), |
|
998 | 998 | 'ee_pers_admin_notices', |
999 | 999 | $return_url |
1000 | 1000 | ); |
1001 | - if ( $persistent_admin_notices ) { |
|
1001 | + if ($persistent_admin_notices) { |
|
1002 | 1002 | // load scripts |
1003 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1004 | - wp_register_script( 'ee_error_js', EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1005 | - wp_enqueue_script( 'ee_error_js' ); |
|
1003 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1004 | + wp_register_script('ee_error_js', EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1005 | + wp_enqueue_script('ee_error_js'); |
|
1006 | 1006 | // and display notices |
1007 | - foreach( $persistent_admin_notices as $pan_name => $pan_message ) { |
|
1008 | - $notices .= self::display_persistent_admin_notices( $pan_name, $pan_message, $return_url ); |
|
1007 | + foreach ($persistent_admin_notices as $pan_name => $pan_message) { |
|
1008 | + $notices .= self::display_persistent_admin_notices($pan_name, $pan_message, $return_url); |
|
1009 | 1009 | } |
1010 | 1010 | } |
1011 | 1011 | return $notices; |
@@ -1020,26 +1020,26 @@ discard block |
||
1020 | 1020 | * @param bool $force_print |
1021 | 1021 | * @return void |
1022 | 1022 | */ |
1023 | - private static function _print_scripts( $force_print = FALSE ) { |
|
1024 | - if (( did_action( 'admin_enqueue_scripts' ) || did_action( 'wp_enqueue_scripts' )) && ! $force_print ) { |
|
1025 | - if ( wp_script_is( 'ee_error_js', 'enqueued' )) { |
|
1023 | + private static function _print_scripts($force_print = FALSE) { |
|
1024 | + if ((did_action('admin_enqueue_scripts') || did_action('wp_enqueue_scripts')) && ! $force_print) { |
|
1025 | + if (wp_script_is('ee_error_js', 'enqueued')) { |
|
1026 | 1026 | return; |
1027 | - } else if ( wp_script_is( 'ee_error_js', 'registered' )) { |
|
1028 | - add_filter( 'FHEE_load_css', '__return_true' ); |
|
1029 | - add_filter( 'FHEE_load_js', '__return_true' ); |
|
1030 | - wp_enqueue_script( 'ee_error_js' ); |
|
1031 | - wp_localize_script( 'ee_error_js','ee_settings', array( 'wp_debug'=>WP_DEBUG )); |
|
1027 | + } else if (wp_script_is('ee_error_js', 'registered')) { |
|
1028 | + add_filter('FHEE_load_css', '__return_true'); |
|
1029 | + add_filter('FHEE_load_js', '__return_true'); |
|
1030 | + wp_enqueue_script('ee_error_js'); |
|
1031 | + wp_localize_script('ee_error_js', 'ee_settings', array('wp_debug'=>WP_DEBUG)); |
|
1032 | 1032 | } |
1033 | 1033 | } else { |
1034 | 1034 | return ' |
1035 | 1035 | <script> |
1036 | 1036 | /* <![CDATA[ */ |
1037 | -var ee_settings = {"wp_debug":"' . WP_DEBUG . '"}; |
|
1037 | +var ee_settings = {"wp_debug":"' . WP_DEBUG.'"}; |
|
1038 | 1038 | /* ]]> */ |
1039 | 1039 | </script> |
1040 | -<script src="' . includes_url() . 'js/jquery/jquery.js" type="text/javascript"></script> |
|
1041 | -<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script> |
|
1042 | -<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script> |
|
1040 | +<script src="' . includes_url().'js/jquery/jquery.js" type="text/javascript"></script> |
|
1041 | +<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js'.'?ver='.espresso_version().'" type="text/javascript"></script> |
|
1042 | +<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js'.'?ver='.espresso_version().'" type="text/javascript"></script> |
|
1043 | 1043 | '; |
1044 | 1044 | |
1045 | 1045 | } |
@@ -1073,11 +1073,11 @@ discard block |
||
1073 | 1073 | * @ param string $line |
1074 | 1074 | * @ return string |
1075 | 1075 | */ |
1076 | - public static function generate_error_code ( $file = '', $func = '', $line = '' ) { |
|
1077 | - $file = explode( '.', basename( $file )); |
|
1078 | - $error_code = ! empty( $file[0] ) ? $file[0] : ''; |
|
1079 | - $error_code .= ! empty( $func ) ? ' - ' . $func : ''; |
|
1080 | - $error_code .= ! empty( $line ) ? ' - ' . $line : ''; |
|
1076 | + public static function generate_error_code($file = '', $func = '', $line = '') { |
|
1077 | + $file = explode('.', basename($file)); |
|
1078 | + $error_code = ! empty($file[0]) ? $file[0] : ''; |
|
1079 | + $error_code .= ! empty($func) ? ' - '.$func : ''; |
|
1080 | + $error_code .= ! empty($line) ? ' - '.$line : ''; |
|
1081 | 1081 | return $error_code; |
1082 | 1082 | } |
1083 | 1083 | |
@@ -1093,36 +1093,36 @@ discard block |
||
1093 | 1093 | * @ param object $ex |
1094 | 1094 | * @ return void |
1095 | 1095 | */ |
1096 | - public function write_to_error_log ( $time = FALSE, $ex = FALSE, $clear = FALSE ) { |
|
1096 | + public function write_to_error_log($time = FALSE, $ex = FALSE, $clear = FALSE) { |
|
1097 | 1097 | |
1098 | - if ( ! $ex ) { |
|
1098 | + if ( ! $ex) { |
|
1099 | 1099 | return; |
1100 | 1100 | } |
1101 | 1101 | |
1102 | - if ( ! $time ) { |
|
1102 | + if ( ! $time) { |
|
1103 | 1103 | $time = time(); |
1104 | 1104 | } |
1105 | 1105 | |
1106 | - $exception_log = '----------------------------------------------------------------------------------------' . PHP_EOL; |
|
1107 | - $exception_log .= '[' . date( 'Y-m-d H:i:s', $time ) . '] Exception Details' . PHP_EOL; |
|
1108 | - $exception_log .= 'Message: ' . $ex['msg'] . PHP_EOL; |
|
1109 | - $exception_log .= 'Code: '. $ex['code'] . PHP_EOL; |
|
1110 | - $exception_log .= 'File: '. $ex['file'] . PHP_EOL; |
|
1111 | - $exception_log .= 'Line No: ' . $ex['line'] . PHP_EOL; |
|
1112 | - $exception_log .= 'Stack trace: ' . PHP_EOL; |
|
1113 | - $exception_log .= $ex['string'] . PHP_EOL; |
|
1114 | - $exception_log .= '----------------------------------------------------------------------------------------' . PHP_EOL; |
|
1106 | + $exception_log = '----------------------------------------------------------------------------------------'.PHP_EOL; |
|
1107 | + $exception_log .= '['.date('Y-m-d H:i:s', $time).'] Exception Details'.PHP_EOL; |
|
1108 | + $exception_log .= 'Message: '.$ex['msg'].PHP_EOL; |
|
1109 | + $exception_log .= 'Code: '.$ex['code'].PHP_EOL; |
|
1110 | + $exception_log .= 'File: '.$ex['file'].PHP_EOL; |
|
1111 | + $exception_log .= 'Line No: '.$ex['line'].PHP_EOL; |
|
1112 | + $exception_log .= 'Stack trace: '.PHP_EOL; |
|
1113 | + $exception_log .= $ex['string'].PHP_EOL; |
|
1114 | + $exception_log .= '----------------------------------------------------------------------------------------'.PHP_EOL; |
|
1115 | 1115 | |
1116 | 1116 | try { |
1117 | - EEH_File::ensure_file_exists_and_is_writable( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file ); |
|
1118 | - EEH_File::add_htaccess_deny_from_all( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' ); |
|
1119 | - if ( ! $clear ) { |
|
1117 | + EEH_File::ensure_file_exists_and_is_writable(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file); |
|
1118 | + EEH_File::add_htaccess_deny_from_all(EVENT_ESPRESSO_UPLOAD_DIR.'logs'); |
|
1119 | + if ( ! $clear) { |
|
1120 | 1120 | //get existing log file and append new log info |
1121 | - $exception_log = EEH_File::get_file_contents( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file ) . $exception_log; |
|
1121 | + $exception_log = EEH_File::get_file_contents(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file).$exception_log; |
|
1122 | 1122 | } |
1123 | - EEH_File::write_to_file( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file, $exception_log ); |
|
1124 | - } catch( EE_Error $e ){ |
|
1125 | - EE_Error::add_error( sprintf( __( 'Event Espresso error logging could not be setup because: %s', 'event_espresso' ), $e->getMessage() )); |
|
1123 | + EEH_File::write_to_file(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file, $exception_log); |
|
1124 | + } catch (EE_Error $e) { |
|
1125 | + EE_Error::add_error(sprintf(__('Event Espresso error logging could not be setup because: %s', 'event_espresso'), $e->getMessage())); |
|
1126 | 1126 | return; |
1127 | 1127 | } |
1128 | 1128 | |
@@ -1158,8 +1158,8 @@ discard block |
||
1158 | 1158 | $applies_when = '', |
1159 | 1159 | $error_type = null |
1160 | 1160 | ) { |
1161 | - if ( defined('WP_DEBUG') && WP_DEBUG ) { |
|
1162 | - EEH_Debug_Tools::instance()->doing_it_wrong( $function, $message, $version, $applies_when, $error_type ); |
|
1161 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
1162 | + EEH_Debug_Tools::instance()->doing_it_wrong($function, $message, $version, $applies_when, $error_type); |
|
1163 | 1163 | } |
1164 | 1164 | } |
1165 | 1165 | |
@@ -1193,13 +1193,13 @@ discard block |
||
1193 | 1193 | */ |
1194 | 1194 | function espresso_error_enqueue_scripts() { |
1195 | 1195 | // js for error handling |
1196 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, FALSE ); |
|
1197 | - wp_register_script( 'ee_error_js', EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, FALSE ); |
|
1196 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, FALSE); |
|
1197 | + wp_register_script('ee_error_js', EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, FALSE); |
|
1198 | 1198 | } |
1199 | -if ( is_admin() ) { |
|
1200 | - add_action( 'admin_enqueue_scripts', 'espresso_error_enqueue_scripts', 2 ); |
|
1199 | +if (is_admin()) { |
|
1200 | + add_action('admin_enqueue_scripts', 'espresso_error_enqueue_scripts', 2); |
|
1201 | 1201 | } else { |
1202 | - add_action( 'wp_enqueue_scripts', 'espresso_error_enqueue_scripts', 2 ); |
|
1202 | + add_action('wp_enqueue_scripts', 'espresso_error_enqueue_scripts', 2); |
|
1203 | 1203 | } |
1204 | 1204 | |
1205 | 1205 |
@@ -105,42 +105,42 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @return EEM_Message |
107 | 107 | */ |
108 | - protected function __construct( $timezone = null ) { |
|
109 | - $this->singular_item = __('Message','event_espresso'); |
|
110 | - $this->plural_item = __('Messages','event_espresso'); |
|
108 | + protected function __construct($timezone = null) { |
|
109 | + $this->singular_item = __('Message', 'event_espresso'); |
|
110 | + $this->plural_item = __('Messages', 'event_espresso'); |
|
111 | 111 | |
112 | 112 | //used for token generator |
113 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
113 | + EE_Registry::instance()->load_helper('URL'); |
|
114 | 114 | |
115 | 115 | $this->_tables = array( |
116 | - 'Message'=>new EE_Primary_Table('esp_message','MSG_ID') |
|
116 | + 'Message'=>new EE_Primary_Table('esp_message', 'MSG_ID') |
|
117 | 117 | ); |
118 | 118 | |
119 | 119 | $allowed_priority = array( |
120 | - self::priority_high => __( 'high', 'event_espresso' ), |
|
121 | - self::priority_medium => __( 'medium', 'event_espresso' ), |
|
122 | - self::priority_low => __( 'low', 'event_espresso' ) |
|
120 | + self::priority_high => __('high', 'event_espresso'), |
|
121 | + self::priority_medium => __('medium', 'event_espresso'), |
|
122 | + self::priority_low => __('low', 'event_espresso') |
|
123 | 123 | ); |
124 | 124 | |
125 | 125 | $this->_fields = array( |
126 | 126 | 'Message'=>array( |
127 | - 'MSG_ID'=>new EE_Primary_Key_Int_Field('MSG_ID', __('Message ID','event_espresso')), |
|
128 | - 'MSG_token' => new EE_Plain_Text_Field( 'MSG_token', __('Unique Token used to represent this row in publicly viewable contexts (eg. a url).', 'event_espresso' ), false, EEH_URL::generate_unique_token() ), |
|
129 | - 'GRP_ID'=>new EE_Foreign_Key_Int_Field( 'GRP_ID', __('Foreign key to the EEM_Message_Template_Group table.', 'event_espresso' ), true, 0, 'Message_Template_Group' ), |
|
130 | - 'TXN_ID' => new EE_Foreign_Key_Int_Field( 'TXN_ID', __( 'Foreign key to the related EE_Transaction. This is required to give context for regenerating the specific message', 'event_espresso' ), true, 0, 'Transaction' ), |
|
131 | - 'MSG_messenger' => new EE_Plain_Text_Field('MSG_messenger', __( 'Corresponds to the EE_messenger::name used to send this message. This will also be used to attempt any resending of the message.', 'event_espresso' ), false, 'email' ), |
|
132 | - 'MSG_message_type' => new EE_Plain_Text_Field( 'MSG_message_type', __( 'Corresponds to the EE_message_type::name used to generate this message.', 'event_espresso' ), false, 'receipt' ), |
|
133 | - 'MSG_context' => new EE_Plain_Text_Field( 'MSG_context', __( 'Context', 'event_espresso' ), false ), |
|
134 | - 'MSG_recipient_ID' => new EE_Foreign_Key_Int_Field( 'MSG_recipient_ID', __( 'Recipient ID', 'event_espresso' ), true, null, array( 'Registration', 'Attendee', 'WP_User' ) ), |
|
135 | - 'MSG_recipient_type' => new EE_Any_Foreign_Model_Name_Field( 'MSG_recipient_type', __( 'Recipient Type', 'event_espresso' ), true, null, array( 'Registration', 'Attendee', 'WP_User' ) ), |
|
136 | - 'MSG_content' => new EE_Maybe_Serialized_Text_Field( 'MSG_content', __( 'Content', 'event_espresso' ), true, '' ), |
|
137 | - 'MSG_to' => new EE_Maybe_Serialized_Text_Field( 'MSG_to', __( 'Address To', 'event_espresso' ), true ), |
|
138 | - 'MSG_from' => new EE_Maybe_Serialized_Text_Field( 'MSG_from', __( 'Address From', 'event_espresso' ), true ), |
|
139 | - 'MSG_subject' => new EE_Maybe_Serialized_Text_Field( 'MSG_subject', __( 'Subject', 'event_espresso' ), true, '' ), |
|
140 | - 'MSG_priority' => new EE_Enum_Integer_Field( 'MSG_priority', __( 'Priority', 'event_espresso' ), false, self::priority_low, $allowed_priority ), |
|
141 | - 'STS_ID' => new EE_Foreign_Key_String_Field( 'STS_ID', __( 'Status', 'event_espresso' ), false, self::status_incomplete, 'Status' ), |
|
142 | - 'MSG_created' => new EE_Datetime_Field( 'MSG_created', __( 'Created', 'event_espresso' ), false, time() ), |
|
143 | - 'MSG_modified' => new EE_Datetime_Field( 'MSG_modified', __( 'Modified', 'event_espresso' ), true, time() ) |
|
127 | + 'MSG_ID'=>new EE_Primary_Key_Int_Field('MSG_ID', __('Message ID', 'event_espresso')), |
|
128 | + 'MSG_token' => new EE_Plain_Text_Field('MSG_token', __('Unique Token used to represent this row in publicly viewable contexts (eg. a url).', 'event_espresso'), false, EEH_URL::generate_unique_token()), |
|
129 | + 'GRP_ID'=>new EE_Foreign_Key_Int_Field('GRP_ID', __('Foreign key to the EEM_Message_Template_Group table.', 'event_espresso'), true, 0, 'Message_Template_Group'), |
|
130 | + 'TXN_ID' => new EE_Foreign_Key_Int_Field('TXN_ID', __('Foreign key to the related EE_Transaction. This is required to give context for regenerating the specific message', 'event_espresso'), true, 0, 'Transaction'), |
|
131 | + 'MSG_messenger' => new EE_Plain_Text_Field('MSG_messenger', __('Corresponds to the EE_messenger::name used to send this message. This will also be used to attempt any resending of the message.', 'event_espresso'), false, 'email'), |
|
132 | + 'MSG_message_type' => new EE_Plain_Text_Field('MSG_message_type', __('Corresponds to the EE_message_type::name used to generate this message.', 'event_espresso'), false, 'receipt'), |
|
133 | + 'MSG_context' => new EE_Plain_Text_Field('MSG_context', __('Context', 'event_espresso'), false), |
|
134 | + 'MSG_recipient_ID' => new EE_Foreign_Key_Int_Field('MSG_recipient_ID', __('Recipient ID', 'event_espresso'), true, null, array('Registration', 'Attendee', 'WP_User')), |
|
135 | + 'MSG_recipient_type' => new EE_Any_Foreign_Model_Name_Field('MSG_recipient_type', __('Recipient Type', 'event_espresso'), true, null, array('Registration', 'Attendee', 'WP_User')), |
|
136 | + 'MSG_content' => new EE_Maybe_Serialized_Text_Field('MSG_content', __('Content', 'event_espresso'), true, ''), |
|
137 | + 'MSG_to' => new EE_Maybe_Serialized_Text_Field('MSG_to', __('Address To', 'event_espresso'), true), |
|
138 | + 'MSG_from' => new EE_Maybe_Serialized_Text_Field('MSG_from', __('Address From', 'event_espresso'), true), |
|
139 | + 'MSG_subject' => new EE_Maybe_Serialized_Text_Field('MSG_subject', __('Subject', 'event_espresso'), true, ''), |
|
140 | + 'MSG_priority' => new EE_Enum_Integer_Field('MSG_priority', __('Priority', 'event_espresso'), false, self::priority_low, $allowed_priority), |
|
141 | + 'STS_ID' => new EE_Foreign_Key_String_Field('STS_ID', __('Status', 'event_espresso'), false, self::status_incomplete, 'Status'), |
|
142 | + 'MSG_created' => new EE_Datetime_Field('MSG_created', __('Created', 'event_espresso'), false, time()), |
|
143 | + 'MSG_modified' => new EE_Datetime_Field('MSG_modified', __('Modified', 'event_espresso'), true, time()) |
|
144 | 144 | ) |
145 | 145 | ); |
146 | 146 | $this->_model_relations = array( |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | 'Message_Template_Group' => new EE_Belongs_To_Relation(), |
151 | 151 | 'Transaction' => new EE_Belongs_To_Relation() |
152 | 152 | ); |
153 | - parent::__construct( $timezone ); |
|
153 | + parent::__construct($timezone); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | public function create_default_object() { |
162 | 162 | /** @type EE_Message $message */ |
163 | 163 | $message = parent::create_default_object(); |
164 | - if ( $message instanceof EE_Message ) { |
|
165 | - return EE_Message_Factory::set_messenger_and_message_type( $message ); |
|
164 | + if ($message instanceof EE_Message) { |
|
165 | + return EE_Message_Factory::set_messenger_and_message_type($message); |
|
166 | 166 | } |
167 | 167 | return null; |
168 | 168 | } |
@@ -173,11 +173,11 @@ discard block |
||
173 | 173 | * @param mixed $cols_n_values |
174 | 174 | * @return \EE_Message |
175 | 175 | */ |
176 | - public function instantiate_class_from_array_or_object( $cols_n_values ) { |
|
176 | + public function instantiate_class_from_array_or_object($cols_n_values) { |
|
177 | 177 | /** @type EE_Message $message */ |
178 | - $message = parent::instantiate_class_from_array_or_object( $cols_n_values ); |
|
179 | - if ( $message instanceof EE_Message ) { |
|
180 | - return EE_Message_Factory::set_messenger_and_message_type( $message ); |
|
178 | + $message = parent::instantiate_class_from_array_or_object($cols_n_values); |
|
179 | + if ($message instanceof EE_Message) { |
|
180 | + return EE_Message_Factory::set_messenger_and_message_type($message); |
|
181 | 181 | } |
182 | 182 | return null; |
183 | 183 | } |
@@ -190,13 +190,13 @@ discard block |
||
190 | 190 | * @param string $message_type the message type slug |
191 | 191 | * @return boolean |
192 | 192 | */ |
193 | - public function message_sent_for_attendee( $attendee, $message_type ) { |
|
194 | - $attendee_ID = EEM_Attendee::instance()->ensure_is_ID( $attendee ); |
|
195 | - return $this->exists( array( array( |
|
193 | + public function message_sent_for_attendee($attendee, $message_type) { |
|
194 | + $attendee_ID = EEM_Attendee::instance()->ensure_is_ID($attendee); |
|
195 | + return $this->exists(array(array( |
|
196 | 196 | 'Attendee.ATT_ID' => $attendee_ID, |
197 | 197 | 'MSG_message_type' => $message_type, |
198 | - 'STS_ID' => array( 'IN', $this->stati_indicating_sent() ) |
|
199 | - ) ) ); |
|
198 | + 'STS_ID' => array('IN', $this->stati_indicating_sent()) |
|
199 | + ))); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | |
@@ -208,13 +208,13 @@ discard block |
||
208 | 208 | * @param string $message_type the message type slug |
209 | 209 | * @return boolean |
210 | 210 | */ |
211 | - public function message_sent_for_registration( $registration, $message_type ) { |
|
212 | - $registrationID = EEM_Registration::instance()->ensure_is_ID( $registration ); |
|
213 | - return $this->exists( array( array( |
|
211 | + public function message_sent_for_registration($registration, $message_type) { |
|
212 | + $registrationID = EEM_Registration::instance()->ensure_is_ID($registration); |
|
213 | + return $this->exists(array(array( |
|
214 | 214 | 'Registration.REG_ID' => $registrationID, |
215 | 215 | 'MSG_message_type' => $message_type, |
216 | - 'STS_ID' => array( 'IN', $this->stati_indicating_sent() ) |
|
217 | - ) ) ); |
|
216 | + 'STS_ID' => array('IN', $this->stati_indicating_sent()) |
|
217 | + ))); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | |
@@ -225,10 +225,10 @@ discard block |
||
225 | 225 | * @param string $token |
226 | 226 | * @return EE_Message |
227 | 227 | */ |
228 | - public function get_one_by_token( $token ) { |
|
229 | - return $this->get_one( array( array( |
|
228 | + public function get_one_by_token($token) { |
|
229 | + return $this->get_one(array(array( |
|
230 | 230 | 'MSG_token' => $token |
231 | - ) ) ); |
|
231 | + ))); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | |
@@ -236,8 +236,8 @@ discard block |
||
236 | 236 | * Returns stati that indicate the message HAS been sent |
237 | 237 | * @return array of strings for possible stati |
238 | 238 | */ |
239 | - public function stati_indicating_sent(){ |
|
240 | - return apply_filters( 'FHEE__EEM_Message__stati_indicating_sent', array( self::status_sent ) ); |
|
239 | + public function stati_indicating_sent() { |
|
240 | + return apply_filters('FHEE__EEM_Message__stati_indicating_sent', array(self::status_sent)); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | * @return array of strings for possible stati. |
249 | 249 | */ |
250 | 250 | public function stati_indicating_to_send() { |
251 | - return apply_filters( 'FHEE__EEM_Message__stati_indicating_to_send', array( self::status_idle, self::status_resend ) ); |
|
251 | + return apply_filters('FHEE__EEM_Message__stati_indicating_to_send', array(self::status_idle, self::status_resend)); |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | |
@@ -262,10 +262,10 @@ discard block |
||
262 | 262 | self::status_retry, |
263 | 263 | ); |
264 | 264 | //if WP_DEBUG is set, then let's include debug_only fails |
265 | - if ( WP_DEBUG ) { |
|
265 | + if (WP_DEBUG) { |
|
266 | 266 | $failed_stati[] = self::status_debug_only; |
267 | 267 | } |
268 | - return apply_filters( 'FHEE__EEM_Message__stati_indicating_failed_sending', $failed_stati ); |
|
268 | + return apply_filters('FHEE__EEM_Message__stati_indicating_failed_sending', $failed_stati); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | |
@@ -300,11 +300,11 @@ discard block |
||
300 | 300 | // the value, matches the corresponding EEM_Base child reference. |
301 | 301 | $expected_vars = $this->_expected_vars_for_query_inject(); |
302 | 302 | $query_params[0] = array(); |
303 | - foreach ( $expected_vars as $request_key => $model_name ) { |
|
304 | - $request_value = EE_Registry::instance()->REQ->get( $request_key ); |
|
305 | - if ( $request_value ) { |
|
303 | + foreach ($expected_vars as $request_key => $model_name) { |
|
304 | + $request_value = EE_Registry::instance()->REQ->get($request_key); |
|
305 | + if ($request_value) { |
|
306 | 306 | //special case |
307 | - switch ( $request_key ) { |
|
307 | + switch ($request_key) { |
|
308 | 308 | case '_REG_ID' : |
309 | 309 | $query_params[0]['AND**filter_by']['OR**filter_by_REG_ID'] = array( |
310 | 310 | 'Transaction.Registration.REG_ID' => $request_value, |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | ); |
317 | 317 | break; |
318 | 318 | default : |
319 | - $query_params[0]['AND**filter_by'][ 'OR**filter_by_' . $request_key ][ $model_name . '.' . $request_key ] = $request_value; |
|
319 | + $query_params[0]['AND**filter_by']['OR**filter_by_'.$request_key][$model_name.'.'.$request_key] = $request_value; |
|
320 | 320 | break; |
321 | 321 | } |
322 | 322 | } |
@@ -333,53 +333,53 @@ discard block |
||
333 | 333 | $expected_vars = $this->_expected_vars_for_query_inject(); |
334 | 334 | $pretty_label = ''; |
335 | 335 | $label_parts = array(); |
336 | - foreach ( $expected_vars as $request_key => $model_name ) { |
|
337 | - $model = EE_Registry::instance()->load_model( $model_name ); |
|
338 | - if ( $model_field_value = EE_Registry::instance()->REQ->get( $request_key ) ) { |
|
339 | - switch ( $request_key ) { |
|
336 | + foreach ($expected_vars as $request_key => $model_name) { |
|
337 | + $model = EE_Registry::instance()->load_model($model_name); |
|
338 | + if ($model_field_value = EE_Registry::instance()->REQ->get($request_key)) { |
|
339 | + switch ($request_key) { |
|
340 | 340 | case '_REG_ID' : |
341 | 341 | $label_parts[] = sprintf( |
342 | - esc_html__( 'Registration with the ID: %s', 'event_espresso' ), |
|
342 | + esc_html__('Registration with the ID: %s', 'event_espresso'), |
|
343 | 343 | $model_field_value |
344 | 344 | ); |
345 | 345 | break; |
346 | 346 | case 'ATT_ID' : |
347 | 347 | /** @var EE_Attendee $attendee */ |
348 | - $attendee = $model->get_one_by_ID( $model_field_value ); |
|
348 | + $attendee = $model->get_one_by_ID($model_field_value); |
|
349 | 349 | $label_parts[] = $attendee instanceof EE_Attendee |
350 | - ? sprintf( esc_html__( 'Attendee %s', 'event_espresso' ), $attendee->full_name() ) |
|
351 | - : sprintf( esc_html__( 'Attendee ID: %s', 'event_espresso' ), $model_field_value ); |
|
350 | + ? sprintf(esc_html__('Attendee %s', 'event_espresso'), $attendee->full_name()) |
|
351 | + : sprintf(esc_html__('Attendee ID: %s', 'event_espresso'), $model_field_value); |
|
352 | 352 | break; |
353 | 353 | case 'ID' : |
354 | 354 | /** @var EE_WP_User $wpUser */ |
355 | - $wpUser = $model->get_one_by_ID( $model_field_value ); |
|
355 | + $wpUser = $model->get_one_by_ID($model_field_value); |
|
356 | 356 | $label_parts[] = $wpUser instanceof EE_WP_User |
357 | - ? sprintf( esc_html__( 'WP User: %s', 'event_espresso' ), $wpUser->name() ) |
|
358 | - : sprintf( esc_html__( 'WP User ID: %s', 'event_espresso' ), $model_field_value ); |
|
357 | + ? sprintf(esc_html__('WP User: %s', 'event_espresso'), $wpUser->name()) |
|
358 | + : sprintf(esc_html__('WP User ID: %s', 'event_espresso'), $model_field_value); |
|
359 | 359 | break; |
360 | 360 | case 'TXN_ID' : |
361 | 361 | $label_parts[] = sprintf( |
362 | - esc_html__( 'Transaction with the ID: %s', 'event_espresso' ), |
|
362 | + esc_html__('Transaction with the ID: %s', 'event_espresso'), |
|
363 | 363 | $model_field_value |
364 | 364 | ); |
365 | 365 | break; |
366 | 366 | case 'EVT_ID' : |
367 | 367 | /** @var EE_Event $Event */ |
368 | - $Event = $model->get_one_by_ID( $model_field_value ); |
|
368 | + $Event = $model->get_one_by_ID($model_field_value); |
|
369 | 369 | $label_parts[] = $Event instanceof EE_Event |
370 | - ? sprintf( esc_html__( 'for the Event: %s', 'event_espresso' ), $Event->name() ) |
|
371 | - : sprintf( esc_html__( 'for the Event with ID: %s', 'event_espresso' ), $model_field_value ); |
|
370 | + ? sprintf(esc_html__('for the Event: %s', 'event_espresso'), $Event->name()) |
|
371 | + : sprintf(esc_html__('for the Event with ID: %s', 'event_espresso'), $model_field_value); |
|
372 | 372 | break; |
373 | 373 | } |
374 | 374 | } |
375 | 375 | } |
376 | 376 | |
377 | - if ( $label_parts ) { |
|
377 | + if ($label_parts) { |
|
378 | 378 | |
379 | 379 | //prepend to the last element of $label_parts an "and". |
380 | - if ( count( $label_parts ) > 1 ) { |
|
381 | - $label_parts_index_to_prepend = count( $label_parts ) - 1; |
|
382 | - $label_parts[ $label_parts_index_to_prepend ] = 'and' . $label_parts[ $label_parts_index_to_prepend ]; |
|
380 | + if (count($label_parts) > 1) { |
|
381 | + $label_parts_index_to_prepend = count($label_parts) - 1; |
|
382 | + $label_parts[$label_parts_index_to_prepend] = 'and'.$label_parts[$label_parts_index_to_prepend]; |
|
383 | 383 | } |
384 | 384 | |
385 | 385 | $pretty_label .= sprintf( |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | 'A label for the messages returned in a query that are filtered by items in the query. This could be Transaction, Event, Attendee, Registration, or WP_User.', |
389 | 389 | 'event_espresso' |
390 | 390 | ), |
391 | - implode( ', ', $label_parts ) |
|
391 | + implode(', ', $label_parts) |
|
392 | 392 | ); |
393 | 393 | } |
394 | 394 | return $pretty_label; |
@@ -438,20 +438,20 @@ discard block |
||
438 | 438 | * |
439 | 439 | * @return bool true means Messages is in debug mode. false means messages system is not in debug mode. |
440 | 440 | */ |
441 | - public static function debug( $set_debug = null ) { |
|
441 | + public static function debug($set_debug = null) { |
|
442 | 442 | static $is_debugging = null; |
443 | 443 | |
444 | 444 | //initialize (use constant if set). |
445 | - if ( is_null( $set_debug ) && is_null( $is_debugging ) ) { |
|
446 | - $is_debugging = defined( 'EE_DEBUG_MESSAGES' ) && EE_DEBUG_MESSAGES; |
|
445 | + if (is_null($set_debug) && is_null($is_debugging)) { |
|
446 | + $is_debugging = defined('EE_DEBUG_MESSAGES') && EE_DEBUG_MESSAGES; |
|
447 | 447 | } |
448 | 448 | |
449 | - if ( ! is_null( $set_debug ) ) { |
|
450 | - $is_debugging = filter_var( $set_debug, FILTER_VALIDATE_BOOLEAN ); |
|
449 | + if ( ! is_null($set_debug)) { |
|
450 | + $is_debugging = filter_var($set_debug, FILTER_VALIDATE_BOOLEAN); |
|
451 | 451 | } |
452 | 452 | |
453 | 453 | //return filtered value |
454 | - return apply_filters( 'FHEE__EEM_Message__debug', $is_debugging ); |
|
454 | + return apply_filters('FHEE__EEM_Message__debug', $is_debugging); |
|
455 | 455 | } |
456 | 456 | |
457 | 457 |
@@ -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 | /** |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | class Support_Admin_Page extends EE_Admin_Page { |
31 | 31 | |
32 | 32 | |
33 | - public function __construct( $routing = TRUE ) { |
|
34 | - parent::__construct( $routing ); |
|
33 | + public function __construct($routing = TRUE) { |
|
34 | + parent::__construct($routing); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
@@ -84,14 +84,14 @@ discard block |
||
84 | 84 | 'nav' => array( |
85 | 85 | 'label' => __('Shortcodes', 'event_espresso'), |
86 | 86 | 'order' => 30), |
87 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_shortcodes_boxes' ) ), |
|
87 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_shortcodes_boxes')), |
|
88 | 88 | 'require_nonce' => FALSE |
89 | 89 | ), |
90 | 90 | 'contact_support' => array( |
91 | 91 | 'nav' => array( |
92 | 92 | 'label' => __('Support', 'event_espresso'), |
93 | 93 | 'order' => 40), |
94 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_support_boxes' ) ), |
|
94 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_support_boxes')), |
|
95 | 95 | 'require_nonce' => FALSE |
96 | 96 | ), |
97 | 97 | 'developers' => array( |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | |
120 | 120 | |
121 | 121 | protected function _installation() { |
122 | - $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_installation.template.php'; |
|
123 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, '', TRUE); |
|
122 | + $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_installation.template.php'; |
|
123 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, '', TRUE); |
|
124 | 124 | $this->display_admin_page_with_sidebar(); |
125 | 125 | } |
126 | 126 | |
@@ -145,10 +145,10 @@ discard block |
||
145 | 145 | 'other_resources' => __('Other Resources', 'event_espresso') |
146 | 146 | ); |
147 | 147 | |
148 | - foreach ( $boxes as $box => $label ) { |
|
149 | - $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_' . $box . '.template.php'; |
|
148 | + foreach ($boxes as $box => $label) { |
|
149 | + $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_'.$box.'.template.php'; |
|
150 | 150 | $callback_args = array('template_path' => $template_path); |
151 | - add_meta_box( 'espresso_' . $box . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen->id, 'normal', 'high', $callback_args); |
|
151 | + add_meta_box('espresso_'.$box.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen->id, 'normal', 'high', $callback_args); |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | |
@@ -169,15 +169,15 @@ discard block |
||
169 | 169 | 'shortcodes_event_listings' => __('Event Listings', 'event_espresso'), |
170 | 170 | 'shortcodes_ticket_selector' => __('Event Ticket Selector', 'event_espresso'), |
171 | 171 | 'shortcodes_category' => __('Event Categories', 'event_espresso'), |
172 | - 'shortcodes_attendee' => __( 'Event Attendees', 'event_espresso' ) |
|
172 | + 'shortcodes_attendee' => __('Event Attendees', 'event_espresso') |
|
173 | 173 | /*'shortcodes_single_events' => __('Single Events', 'event_espresso'),*/ |
174 | 174 | /*'shortcodes_attendee_listings' => __('Attendee Listings', 'event_espresso'),*/ |
175 | 175 | ); |
176 | 176 | |
177 | - foreach ( $boxes as $box => $label ) { |
|
178 | - $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_' . $box . '.template.php'; |
|
177 | + foreach ($boxes as $box => $label) { |
|
178 | + $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_'.$box.'.template.php'; |
|
179 | 179 | $callback_args = array('template_path' => $template_path); |
180 | - add_meta_box( 'espresso_' . $box . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen->id, 'normal', 'high', $callback_args); |
|
180 | + add_meta_box('espresso_'.$box.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen->id, 'normal', 'high', $callback_args); |
|
181 | 181 | } |
182 | 182 | } |
183 | 183 | |
@@ -196,17 +196,17 @@ discard block |
||
196 | 196 | 'important_information' => __('Important Information', 'event_espresso') |
197 | 197 | ); |
198 | 198 | |
199 | - foreach ( $boxes as $box => $label ) { |
|
200 | - $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_' . $box . '.template.php'; |
|
199 | + foreach ($boxes as $box => $label) { |
|
200 | + $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_'.$box.'.template.php'; |
|
201 | 201 | $callback_args = array('template_path' => $template_path, 'template_args' => $this->_template_args); |
202 | - add_meta_box( 'espresso_' . $box . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen->id, 'normal', 'high', $callback_args); |
|
202 | + add_meta_box('espresso_'.$box.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen->id, 'normal', 'high', $callback_args); |
|
203 | 203 | } |
204 | 204 | } |
205 | 205 | |
206 | 206 | |
207 | 207 | protected function _developers() { |
208 | - $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'developers_admin_details.template.php'; |
|
209 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, array(), true ); |
|
208 | + $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'developers_admin_details.template.php'; |
|
209 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, array(), true); |
|
210 | 210 | $this->display_admin_page_with_sidebar(); |
211 | 211 | } |
212 | 212 | } //end Support_Admin_Page class |
@@ -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 | /** |
@@ -29,16 +29,16 @@ discard block |
||
29 | 29 | */ |
30 | 30 | class Extend_Support_Admin_Page extends Support_Admin_Page { |
31 | 31 | |
32 | - public function __construct( $routing = TRUE ) { |
|
33 | - parent::__construct( $routing ); |
|
34 | - define( 'EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'support/templates/' ); |
|
32 | + public function __construct($routing = TRUE) { |
|
33 | + parent::__construct($routing); |
|
34 | + define('EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'support/templates/'); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
38 | 38 | |
39 | 39 | |
40 | 40 | protected function _extend_page_config() { |
41 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'support'; |
|
41 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'support'; |
|
42 | 42 | //new routes and new configs (or overrides ) |
43 | 43 | $new_page_routes = array( |
44 | 44 | 'faq' => array( |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | 'capability' => 'ee_read_ee' |
47 | 47 | ) |
48 | 48 | ); |
49 | - $this->_page_routes = array_merge( $this->_page_routes, $new_page_routes ); |
|
49 | + $this->_page_routes = array_merge($this->_page_routes, $new_page_routes); |
|
50 | 50 | |
51 | 51 | $new_page_config = array( |
52 | 52 | 'faq' => array( |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | 'require_nonce' => FALSE |
58 | 58 | ) |
59 | 59 | ); |
60 | - $this->_page_config = array_merge( $this->_page_config, $new_page_config ); |
|
60 | + $this->_page_config = array_merge($this->_page_config, $new_page_config); |
|
61 | 61 | |
62 | 62 | $this->_page_config['default']['metaboxes'][] = '_installation_boxes'; |
63 | 63 | } |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | |
67 | 67 | |
68 | 68 | protected function _faq() { |
69 | - $template_path = EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH . 'support_admin_details_faq.template.php'; |
|
70 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, '', TRUE); |
|
69 | + $template_path = EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH.'support_admin_details_faq.template.php'; |
|
70 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, '', TRUE); |
|
71 | 71 | $this->display_admin_page_with_sidebar(); |
72 | 72 | |
73 | 73 | } |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | |
76 | 76 | |
77 | 77 | protected function _installation_boxes() { |
78 | - $callback_args = array('template_path' => EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH . 'support_admin_details_additional_information.template.php'); |
|
79 | - add_meta_box( 'espresso_additional_information_support', __('Additional Information', 'event_espresso'), create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE);' ), $this->_current_screen->id, 'normal', 'high', $callback_args); |
|
78 | + $callback_args = array('template_path' => EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH.'support_admin_details_additional_information.template.php'); |
|
79 | + add_meta_box('espresso_additional_information_support', __('Additional Information', 'event_espresso'), create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE);'), $this->_current_screen->id, 'normal', 'high', $callback_args); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 |