@@ -12,10 +12,10 @@ |
||
12 | 12 | |
13 | 13 | $field_info_items = array(); |
14 | 14 | |
15 | - if( !empty( $this->item['description'] ) ) { |
|
15 | + if ( ! empty( $this->item[ 'description' ] ) ) { |
|
16 | 16 | |
17 | - $field_info_items[] = array( |
|
18 | - 'value' => $this->item['description'] |
|
17 | + $field_info_items[ ] = array( |
|
18 | + 'value' => $this->item[ 'description' ] |
|
19 | 19 | ); |
20 | 20 | |
21 | 21 | } |
@@ -47,11 +47,11 @@ discard block |
||
47 | 47 | function modify_entry_value_workflow_step( $output, $entry, $field_settings, $field ) { |
48 | 48 | |
49 | 49 | // If not set, the entry hasn't started a workflow |
50 | - $has_workflow_step = isset( $entry['workflow_step'] ); |
|
50 | + $has_workflow_step = isset( $entry[ 'workflow_step' ] ); |
|
51 | 51 | |
52 | - if( $has_workflow_step ) { |
|
52 | + if ( $has_workflow_step ) { |
|
53 | 53 | |
54 | - $GFlow = new Gravity_Flow_API( $entry['form_id'] ); |
|
54 | + $GFlow = new Gravity_Flow_API( $entry[ 'form_id' ] ); |
|
55 | 55 | |
56 | 56 | if ( $current_step = $GFlow->get_current_step( $entry ) ) { |
57 | 57 | $output = esc_html( $current_step->get_name() ); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | preg_match( '/workflow_step_status_(\d+)/', $key, $matches ); |
80 | 80 | |
81 | 81 | if ( ! empty( $matches ) ) { |
82 | - $workflow_step_id = intval( $matches[1] ); |
|
82 | + $workflow_step_id = intval( $matches[ 1 ] ); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | return $workflow_step_id; |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | $return = $label; |
100 | 100 | |
101 | - if ( '' === $label && $workflow_step_id = $this->get_step_id_from_key( $field['field'] ) ) { |
|
101 | + if ( '' === $label && $workflow_step_id = $this->get_step_id_from_key( $field[ 'field' ] ) ) { |
|
102 | 102 | |
103 | 103 | $step = $this->get_workflow_step( $workflow_step_id ); |
104 | 104 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | $workflow_step = $GFlow->get_step( $workflow_step_id ); |
130 | 130 | |
131 | - if( ! $GFlow || ! $workflow_step ) { |
|
131 | + if ( ! $GFlow || ! $workflow_step ) { |
|
132 | 132 | return false; |
133 | 133 | } |
134 | 134 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | |
151 | 151 | foreach ( $search_fields as & $search_field ) { |
152 | 152 | |
153 | - if ( $this->name === $search_field['key'] ) { |
|
153 | + if ( $this->name === $search_field[ 'key' ] ) { |
|
154 | 154 | |
155 | 155 | $form_id = GravityView_View::getInstance()->getFormId(); |
156 | 156 | |
@@ -159,21 +159,21 @@ discard block |
||
159 | 159 | $choices = array(); |
160 | 160 | |
161 | 161 | foreach ( $workflow_steps as $step ) { |
162 | - $choices[] = array( |
|
162 | + $choices[ ] = array( |
|
163 | 163 | 'text' => $step->get_name(), |
164 | 164 | 'value' => $step->get_id(), |
165 | 165 | ); |
166 | 166 | } |
167 | 167 | |
168 | - $search_field['choices'] = $choices; |
|
168 | + $search_field[ 'choices' ] = $choices; |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | // Workflow Step Statuses |
172 | - else if ( $workflow_step_id = $this->get_step_id_from_key( $search_field['key'] ) ) { |
|
172 | + else if ( $workflow_step_id = $this->get_step_id_from_key( $search_field[ 'key' ] ) ) { |
|
173 | 173 | |
174 | 174 | $status_key = sprintf( 'workflow_step_status_%d', $workflow_step_id ); |
175 | 175 | |
176 | - $search_field['choices'] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options( null, $status_key ); |
|
176 | + $search_field[ 'choices' ] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options( null, $status_key ); |
|
177 | 177 | } |
178 | 178 | } |
179 | 179 |
@@ -14,7 +14,7 @@ |
||
14 | 14 | |
15 | 15 | var $is_numeric = true; |
16 | 16 | |
17 | - var $search_operators = array( 'is', 'isnot', 'starts_with', 'ends_with' ); |
|
17 | + var $search_operators = array( 'is', 'isnot', 'starts_with', 'ends_with' ); |
|
18 | 18 | |
19 | 19 | var $group = 'pricing'; |
20 | 20 |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | function clear_product_info_cache( $form = array(), $entry_id = 0, $Edit_Entry_Render = null ) { |
51 | 51 | |
52 | - if( $this->should_hide_product_fields( $Edit_Entry_Render->entry ) ) { |
|
52 | + if ( $this->should_hide_product_fields( $Edit_Entry_Render->entry ) ) { |
|
53 | 53 | return; |
54 | 54 | } |
55 | 55 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @see GVCommon::entry_has_transaction_data() |
102 | 102 | * @param boolean $hide_product_fields Whether to hide product fields in the editor. Uses $entry data to determine. |
103 | 103 | */ |
104 | - $hide_product_fields = (bool) apply_filters( 'gravityview/edit_entry/hide-product-fields', $has_transaction_data ); |
|
104 | + $hide_product_fields = (bool)apply_filters( 'gravityview/edit_entry/hide-product-fields', $has_transaction_data ); |
|
105 | 105 | |
106 | 106 | return $hide_product_fields; |
107 | 107 | } |
@@ -40,7 +40,6 @@ |
||
40 | 40 | * Get the default date format for a field based on the field ID and the time format setting |
41 | 41 | * |
42 | 42 | * @since 1.16.4 |
43 | - |
|
44 | 43 | * @param string $date_format The Gravity Forms date format for the field. Default: "mdy" |
45 | 44 | * @param int $field_id The ID of the field. Used to figure out full date/day/month/year |
46 | 45 | * |
@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | |
32 | 32 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
33 | 33 | |
34 | - if( 'edit' === $context ) { |
|
34 | + if ( 'edit' === $context ) { |
|
35 | 35 | return $field_options; |
36 | 36 | } |
37 | 37 | |
38 | - $this->add_field_support('date_display', $field_options ); |
|
38 | + $this->add_field_support( 'date_display', $field_options ); |
|
39 | 39 | |
40 | 40 | return $field_options; |
41 | 41 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $field_input_id = gravityview_get_input_id_from_id( $field_id ); |
84 | 84 | |
85 | 85 | $date_field_output = ''; |
86 | - switch( $field_input_id ) { |
|
86 | + switch ( $field_input_id ) { |
|
87 | 87 | case 1: |
88 | 88 | $date_field_output = \GV\Utils::get( $parsed_date, 'month' ); |
89 | 89 | break; |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | ?> |
14 | 14 | <label for="<?php echo $this->get_field_id(); ?>" class="<?php echo $this->get_label_class(); ?>"><?php |
15 | 15 | |
16 | - echo '<span class="gv-label">'.$this->get_field_label().'</span>'; |
|
16 | + echo '<span class="gv-label">' . $this->get_field_label() . '</span>'; |
|
17 | 17 | |
18 | 18 | echo $this->get_tooltip() . $this->get_field_desc(); |
19 | 19 | |
@@ -26,14 +26,14 @@ discard block |
||
26 | 26 | |
27 | 27 | function render_input( $override_input = null ) { |
28 | 28 | |
29 | - if( isset( $override_input ) ) { |
|
29 | + if ( isset( $override_input ) ) { |
|
30 | 30 | echo $override_input; |
31 | 31 | return; |
32 | 32 | } |
33 | 33 | |
34 | 34 | ?> |
35 | 35 | <select name="<?php echo esc_attr( $this->name ); ?>[]" id="<?php echo $this->get_field_id(); ?>" multiple="multiple"> |
36 | - <?php foreach( $this->field['options'] as $value => $label ) : ?> |
|
36 | + <?php foreach ( $this->field[ 'options' ] as $value => $label ) : ?> |
|
37 | 37 | <option value="<?php echo esc_attr( $value ); ?>" <?php selected( in_array( $value, (array)$this->value ), true, true ); ?>><?php echo esc_html( $label ); ?></option> |
38 | 38 | <?php endforeach; ?> |
39 | 39 | </select> |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | } |
325 | 325 | |
326 | 326 | |
327 | - if( GFCommon::is_product_field( $field['type'] ) ){ |
|
327 | + if( GFCommon::is_product_field( $field['type'] ) ) { |
|
328 | 328 | $has_product_fields = true; |
329 | 329 | } |
330 | 330 | |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | |
385 | 385 | $fields = array(); |
386 | 386 | |
387 | - foreach ( $extra_fields as $key => $field ){ |
|
387 | + foreach ( $extra_fields as $key => $field ) { |
|
388 | 388 | if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) { |
389 | 389 | $fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' ); |
390 | 390 | } |
@@ -978,7 +978,7 @@ discard block |
||
978 | 978 | $form = GFAPI::get_form( $form ); |
979 | 979 | } |
980 | 980 | |
981 | - if ( class_exists( 'GFFormsModel' ) ){ |
|
981 | + if ( class_exists( 'GFFormsModel' ) ) { |
|
982 | 982 | return GFFormsModel::get_field( $form, $field_id ); |
983 | 983 | } else { |
984 | 984 | return null; |
@@ -1025,7 +1025,7 @@ discard block |
||
1025 | 1025 | $shortcodes = array(); |
1026 | 1026 | |
1027 | 1027 | preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ); |
1028 | - if ( empty( $matches ) ){ |
|
1028 | + if ( empty( $matches ) ) { |
|
1029 | 1029 | return false; |
1030 | 1030 | } |
1031 | 1031 |
@@ -316,12 +316,12 @@ discard block |
||
316 | 316 | } |
317 | 317 | |
318 | 318 | /** |
319 | - * @hack |
|
320 | - * In case of email/email confirmation, the input for email has the same id as the parent field |
|
321 | - */ |
|
319 | + * @hack |
|
320 | + * In case of email/email confirmation, the input for email has the same id as the parent field |
|
321 | + */ |
|
322 | 322 | if( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) { |
323 | - continue; |
|
324 | - } |
|
323 | + continue; |
|
324 | + } |
|
325 | 325 | $fields["{$input['id']}"] = array( |
326 | 326 | 'label' => \GV\Utils::get( $input, 'label' ), |
327 | 327 | 'customLabel' => \GV\Utils::get( $input, 'customLabel' ), |
@@ -1421,7 +1421,7 @@ discard block |
||
1421 | 1421 | ), |
1422 | 1422 | ); |
1423 | 1423 | |
1424 | - $fields = $date_created + $fields; |
|
1424 | + $fields = $date_created + $fields; |
|
1425 | 1425 | |
1426 | 1426 | $blocklist_field_types = $blocklist; |
1427 | 1427 | |
@@ -1453,13 +1453,13 @@ discard block |
||
1453 | 1453 | |
1454 | 1454 | } |
1455 | 1455 | |
1456 | - /** |
|
1457 | - * @filter `gravityview/common/sortable_fields` Filter the sortable fields |
|
1458 | - * @since 1.12 |
|
1459 | - * @param array $fields Sub-set of GF form fields that are sortable |
|
1460 | - * @param int $formid The Gravity Forms form ID that the fields are from |
|
1461 | - */ |
|
1462 | - $fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid ); |
|
1456 | + /** |
|
1457 | + * @filter `gravityview/common/sortable_fields` Filter the sortable fields |
|
1458 | + * @since 1.12 |
|
1459 | + * @param array $fields Sub-set of GF form fields that are sortable |
|
1460 | + * @param int $formid The Gravity Forms form ID that the fields are from |
|
1461 | + */ |
|
1462 | + $fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid ); |
|
1463 | 1463 | |
1464 | 1464 | return $fields; |
1465 | 1465 | } |
@@ -1752,26 +1752,26 @@ discard block |
||
1752 | 1752 | } |
1753 | 1753 | |
1754 | 1754 | |
1755 | - /** |
|
1756 | - * Display updated/error notice |
|
1757 | - * |
|
1758 | - * @since 1.19.2 Added $cap and $object_id parameters |
|
1759 | - * |
|
1760 | - * @param string $notice text/HTML of notice |
|
1761 | - * @param string $class CSS class for notice (`updated` or `error`) |
|
1762 | - * @param string $cap [Optional] Define a capability required to show a notice. If not set, displays to all caps. |
|
1763 | - * |
|
1764 | - * @return string |
|
1765 | - */ |
|
1766 | - public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) { |
|
1767 | - |
|
1768 | - // If $cap is defined, only show notice if user has capability |
|
1769 | - if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) { |
|
1770 | - return ''; |
|
1771 | - } |
|
1772 | - |
|
1773 | - return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
1774 | - } |
|
1755 | + /** |
|
1756 | + * Display updated/error notice |
|
1757 | + * |
|
1758 | + * @since 1.19.2 Added $cap and $object_id parameters |
|
1759 | + * |
|
1760 | + * @param string $notice text/HTML of notice |
|
1761 | + * @param string $class CSS class for notice (`updated` or `error`) |
|
1762 | + * @param string $cap [Optional] Define a capability required to show a notice. If not set, displays to all caps. |
|
1763 | + * |
|
1764 | + * @return string |
|
1765 | + */ |
|
1766 | + public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) { |
|
1767 | + |
|
1768 | + // If $cap is defined, only show notice if user has capability |
|
1769 | + if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) { |
|
1770 | + return ''; |
|
1771 | + } |
|
1772 | + |
|
1773 | + return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
1774 | + } |
|
1775 | 1775 | |
1776 | 1776 | /** |
1777 | 1777 | * Inspired on \GFCommon::encode_shortcodes, reverse the encoding by replacing the ascii characters by the shortcode brackets |
@@ -124,8 +124,8 @@ discard block |
||
124 | 124 | |
125 | 125 | $form = false; |
126 | 126 | |
127 | - if( $entry ) { |
|
128 | - $form = GFAPI::get_form( $entry['form_id'] ); |
|
127 | + if ( $entry ) { |
|
128 | + $form = GFAPI::get_form( $entry[ 'form_id' ] ); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | return $form; |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | } |
202 | 202 | } |
203 | 203 | |
204 | - return (bool) $has_transaction_data; |
|
204 | + return (bool)$has_transaction_data; |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | |
240 | 240 | $results = GFAPI::get_entries( intval( $form_id ), $search_criteria, null, $paging ); |
241 | 241 | |
242 | - $result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null; |
|
242 | + $result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null; |
|
243 | 243 | |
244 | 244 | return $result; |
245 | 245 | } |
@@ -259,13 +259,13 @@ discard block |
||
259 | 259 | * |
260 | 260 | * @return array Empty array if GFAPI class isn't available or no forms. Otherwise, the array of Forms |
261 | 261 | */ |
262 | - public static function get_forms( $active = true, $trash = false, $order_by = 'id', $order = 'ASC' ) { |
|
262 | + public static function get_forms( $active = true, $trash = false, $order_by = 'id', $order = 'ASC' ) { |
|
263 | 263 | $forms = array(); |
264 | 264 | if ( ! class_exists( 'GFAPI' ) ) { |
265 | 265 | return array(); |
266 | 266 | } |
267 | 267 | |
268 | - if( 'any' === $active ) { |
|
268 | + if ( 'any' === $active ) { |
|
269 | 269 | $active_forms = GFAPI::get_forms( true, $trash ); |
270 | 270 | $inactive_forms = GFAPI::get_forms( false, $trash ); |
271 | 271 | $forms = array_merge( array_filter( $active_forms ), array_filter( $inactive_forms ) ); |
@@ -297,9 +297,9 @@ discard block |
||
297 | 297 | $has_post_fields = false; |
298 | 298 | |
299 | 299 | if ( $form ) { |
300 | - foreach ( $form['fields'] as $field ) { |
|
301 | - if ( $include_parent_field || empty( $field['inputs'] ) ) { |
|
302 | - $fields["{$field['id']}"] = array( |
|
300 | + foreach ( $form[ 'fields' ] as $field ) { |
|
301 | + if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) { |
|
302 | + $fields[ "{$field[ 'id' ]}" ] = array( |
|
303 | 303 | 'label' => \GV\Utils::get( $field, 'label' ), |
304 | 304 | 'parent' => null, |
305 | 305 | 'type' => \GV\Utils::get( $field, 'type' ), |
@@ -308,10 +308,10 @@ discard block |
||
308 | 308 | ); |
309 | 309 | } |
310 | 310 | |
311 | - if ( $add_default_properties && ! empty( $field['inputs'] ) ) { |
|
312 | - foreach ( $field['inputs'] as $input ) { |
|
311 | + if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) { |
|
312 | + foreach ( $field[ 'inputs' ] as $input ) { |
|
313 | 313 | |
314 | - if( ! empty( $input['isHidden'] ) ) { |
|
314 | + if ( ! empty( $input[ 'isHidden' ] ) ) { |
|
315 | 315 | continue; |
316 | 316 | } |
317 | 317 | |
@@ -319,10 +319,10 @@ discard block |
||
319 | 319 | * @hack |
320 | 320 | * In case of email/email confirmation, the input for email has the same id as the parent field |
321 | 321 | */ |
322 | - if( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) { |
|
322 | + if ( 'email' === $field[ 'type' ] && false === strpos( $input[ 'id' ], '.' ) ) { |
|
323 | 323 | continue; |
324 | 324 | } |
325 | - $fields["{$input['id']}"] = array( |
|
325 | + $fields[ "{$input[ 'id' ]}" ] = array( |
|
326 | 326 | 'label' => \GV\Utils::get( $input, 'label' ), |
327 | 327 | 'customLabel' => \GV\Utils::get( $input, 'customLabel' ), |
328 | 328 | 'parent' => $field, |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | } |
335 | 335 | |
336 | 336 | |
337 | - if( GFCommon::is_product_field( $field['type'] ) ){ |
|
337 | + if ( GFCommon::is_product_field( $field[ 'type' ] ) ) { |
|
338 | 338 | $has_product_fields = true; |
339 | 339 | } |
340 | 340 | |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | * @since 1.7 |
349 | 349 | */ |
350 | 350 | if ( $has_post_fields ) { |
351 | - $fields['post_id'] = array( |
|
351 | + $fields[ 'post_id' ] = array( |
|
352 | 352 | 'label' => __( 'Post ID', 'gk-gravityview' ), |
353 | 353 | 'type' => 'post_id', |
354 | 354 | ); |
@@ -361,11 +361,11 @@ discard block |
||
361 | 361 | foreach ( $payment_fields as $payment_field ) { |
362 | 362 | |
363 | 363 | // Either the field exists ($fields['shipping']) or the form explicitly contains a `shipping` field with numeric key |
364 | - if( isset( $fields["{$payment_field->name}"] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) { |
|
364 | + if ( isset( $fields[ "{$payment_field->name}" ] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) { |
|
365 | 365 | continue; |
366 | 366 | } |
367 | 367 | |
368 | - $fields["{$payment_field->name}"] = array( |
|
368 | + $fields[ "{$payment_field->name}" ] = array( |
|
369 | 369 | 'label' => $payment_field->label, |
370 | 370 | 'desc' => $payment_field->description, |
371 | 371 | 'type' => $payment_field->name, |
@@ -397,9 +397,9 @@ discard block |
||
397 | 397 | |
398 | 398 | $fields = array(); |
399 | 399 | |
400 | - foreach ( $extra_fields as $key => $field ){ |
|
401 | - if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) { |
|
402 | - $fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' ); |
|
400 | + foreach ( $extra_fields as $key => $field ) { |
|
401 | + if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) { |
|
402 | + $fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' ); |
|
403 | 403 | } |
404 | 404 | } |
405 | 405 | |
@@ -439,33 +439,33 @@ discard block |
||
439 | 439 | 'search_criteria' => null, |
440 | 440 | 'sorting' => null, |
441 | 441 | 'paging' => null, |
442 | - 'cache' => (isset( $passed_criteria['cache'] ) ? (bool) $passed_criteria['cache'] : true), |
|
442 | + 'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? (bool)$passed_criteria[ 'cache' ] : true ), |
|
443 | 443 | 'context_view_id' => null, |
444 | 444 | ); |
445 | 445 | |
446 | 446 | $criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults ); |
447 | 447 | |
448 | - if ( ! empty( $criteria['search_criteria']['field_filters'] ) && is_array( $criteria['search_criteria']['field_filters'] ) ) { |
|
449 | - foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) { |
|
448 | + if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) && is_array( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
449 | + foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) { |
|
450 | 450 | |
451 | 451 | if ( ! is_array( $filter ) ) { |
452 | 452 | continue; |
453 | 453 | } |
454 | 454 | |
455 | 455 | // By default, we want searches to be wildcard for each field. |
456 | - $filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator']; |
|
456 | + $filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ]; |
|
457 | 457 | |
458 | 458 | /** |
459 | 459 | * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc) |
460 | 460 | * @param string $operator Existing search operator |
461 | 461 | * @param array $filter array with `key`, `value`, `operator`, `type` keys |
462 | 462 | */ |
463 | - $filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter ); |
|
463 | + $filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter ); |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | // don't send just the [mode] without any field filter. |
467 | - if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) { |
|
468 | - unset( $criteria['search_criteria']['field_filters']['mode'] ); |
|
467 | + if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
468 | + unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] ); |
|
469 | 469 | } |
470 | 470 | |
471 | 471 | } |
@@ -476,33 +476,33 @@ discard block |
||
476 | 476 | * Prepare date formats to be in Gravity Forms DB format; |
477 | 477 | * $passed_criteria may include date formats incompatible with Gravity Forms. |
478 | 478 | */ |
479 | - foreach ( array('start_date', 'end_date' ) as $key ) { |
|
479 | + foreach ( array( 'start_date', 'end_date' ) as $key ) { |
|
480 | 480 | |
481 | - if ( ! empty( $criteria['search_criteria'][ $key ] ) ) { |
|
481 | + if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) { |
|
482 | 482 | |
483 | 483 | // Use date_create instead of new DateTime so it returns false if invalid date format. |
484 | - $date = date_create( $criteria['search_criteria'][ $key ] ); |
|
484 | + $date = date_create( $criteria[ 'search_criteria' ][ $key ] ); |
|
485 | 485 | |
486 | 486 | if ( $date ) { |
487 | 487 | // Gravity Forms wants dates in the `Y-m-d H:i:s` format. |
488 | - $criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
488 | + $criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
489 | 489 | } else { |
490 | - gravityview()->log->error( '{key} Date format not valid:', array( 'key' => $key, $criteria['search_criteria'][ $key ] ) ); |
|
490 | + gravityview()->log->error( '{key} Date format not valid:', array( 'key' => $key, $criteria[ 'search_criteria' ][ $key ] ) ); |
|
491 | 491 | |
492 | 492 | // If it's an invalid date, unset it. Gravity Forms freaks out otherwise. |
493 | - unset( $criteria['search_criteria'][ $key ] ); |
|
493 | + unset( $criteria[ 'search_criteria' ][ $key ] ); |
|
494 | 494 | } |
495 | 495 | } |
496 | 496 | } |
497 | 497 | |
498 | - if ( empty( $criteria['context_view_id'] ) ) { |
|
498 | + if ( empty( $criteria[ 'context_view_id' ] ) ) { |
|
499 | 499 | // Calculate the context view id and send it to the advanced filter |
500 | 500 | if ( GravityView_frontend::getInstance()->getSingleEntry() ) { |
501 | - $criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
501 | + $criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
502 | 502 | } else if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance() && GravityView_View_Data::getInstance()->has_multiple_views() ) { |
503 | - $criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
503 | + $criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
504 | 504 | } else if ( 'delete' === GFForms::get( 'action' ) ) { |
505 | - $criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null; |
|
505 | + $criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? intval( $_GET[ 'view_id' ] ) : null; |
|
506 | 506 | } |
507 | 507 | } |
508 | 508 | |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | * @param array $form_ids Forms to search |
513 | 513 | * @param int $view_id ID of the view being used to search |
514 | 514 | */ |
515 | - $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] ); |
|
515 | + $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] ); |
|
516 | 516 | |
517 | 517 | return (array)$criteria; |
518 | 518 | } |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | /** Reduce # of database calls */ |
547 | 547 | add_filter( 'gform_is_encrypted_field', '__return_false' ); |
548 | 548 | |
549 | - if ( ! empty( $criteria['cache'] ) ) { |
|
549 | + if ( ! empty( $criteria[ 'cache' ] ) ) { |
|
550 | 550 | |
551 | 551 | $Cache = new GravityView_Cache( $form_ids, $criteria ); |
552 | 552 | |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | |
555 | 555 | // Still update the total count when using cached results |
556 | 556 | if ( ! is_null( $total ) ) { |
557 | - $total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] ); |
|
557 | + $total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] ); |
|
558 | 558 | } |
559 | 559 | |
560 | 560 | $return = $entries; |
@@ -576,9 +576,9 @@ discard block |
||
576 | 576 | $entries = apply_filters_ref_array( 'gravityview_before_get_entries', array( null, $criteria, $passed_criteria, &$total ) ); |
577 | 577 | |
578 | 578 | // No entries returned from gravityview_before_get_entries |
579 | - if( is_null( $entries ) ) { |
|
579 | + if ( is_null( $entries ) ) { |
|
580 | 580 | |
581 | - $entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total ); |
|
581 | + $entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total ); |
|
582 | 582 | |
583 | 583 | if ( is_wp_error( $entries ) ) { |
584 | 584 | gravityview()->log->error( '{error}', array( 'error' => $entries->get_error_message(), 'data' => $entries ) ); |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | } |
590 | 590 | } |
591 | 591 | |
592 | - if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) { |
|
592 | + if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) { |
|
593 | 593 | |
594 | 594 | // Cache results |
595 | 595 | $Cache->set( $entries, 'entries' ); |
@@ -706,18 +706,18 @@ discard block |
||
706 | 706 | $check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry, $view ); |
707 | 707 | |
708 | 708 | // Is the entry allowed |
709 | - if( $check_entry_display ) { |
|
709 | + if ( $check_entry_display ) { |
|
710 | 710 | |
711 | 711 | $gvid = \GV\Utils::_GET( 'gvid' ); |
712 | 712 | |
713 | - if( $gvid ) { |
|
713 | + if ( $gvid ) { |
|
714 | 714 | $view = \GV\View::by_id( $gvid ); |
715 | 715 | } |
716 | 716 | |
717 | 717 | $entry = self::check_entry_display( $entry, $view ); |
718 | 718 | } |
719 | 719 | |
720 | - if( is_wp_error( $entry ) ) { |
|
720 | + if ( is_wp_error( $entry ) ) { |
|
721 | 721 | gravityview()->log->error( '{error}', array( 'error' => $entry->get_error_message() ) ); |
722 | 722 | return false; |
723 | 723 | } |
@@ -751,12 +751,12 @@ discard block |
||
751 | 751 | |
752 | 752 | $value = false; |
753 | 753 | |
754 | - if( 'context' === $val1 ) { |
|
754 | + if ( 'context' === $val1 ) { |
|
755 | 755 | |
756 | 756 | $matching_contexts = array( $val2 ); |
757 | 757 | |
758 | 758 | // We allow for non-standard contexts. |
759 | - switch( $val2 ) { |
|
759 | + switch ( $val2 ) { |
|
760 | 760 | // Check for either single or edit |
761 | 761 | case 'singular': |
762 | 762 | $matching_contexts = array( 'single', 'edit' ); |
@@ -776,8 +776,8 @@ discard block |
||
776 | 776 | |
777 | 777 | // If both are timestamps, cast to string so we can use the > and < comparisons below. |
778 | 778 | if ( $timestamp_1 && $timestamp_2 ) { |
779 | - $val1 = (string) $timestamp_1; |
|
780 | - $val2 = (string) $timestamp_2; |
|
779 | + $val1 = (string)$timestamp_1; |
|
780 | + $val2 = (string)$timestamp_2; |
|
781 | 781 | } |
782 | 782 | |
783 | 783 | switch ( $operation ) { |
@@ -809,18 +809,18 @@ discard block |
||
809 | 809 | $json_val_1 = json_decode( $val1, true ); |
810 | 810 | $json_val_2 = json_decode( $val2, true ); |
811 | 811 | |
812 | - if( ! empty( $json_val_1 ) || ! empty( $json_val_2 ) ) { |
|
812 | + if ( ! empty( $json_val_1 ) || ! empty( $json_val_2 ) ) { |
|
813 | 813 | |
814 | 814 | $json_in = false; |
815 | - $json_val_1 = $json_val_1 ? (array) $json_val_1 : array( $val1 ); |
|
816 | - $json_val_2 = $json_val_2 ? (array) $json_val_2 : array( $val2 ); |
|
815 | + $json_val_1 = $json_val_1 ? (array)$json_val_1 : array( $val1 ); |
|
816 | + $json_val_2 = $json_val_2 ? (array)$json_val_2 : array( $val2 ); |
|
817 | 817 | |
818 | 818 | // For JSON, we want to compare as "in" or "not in" rather than "contains" |
819 | 819 | foreach ( $json_val_1 as $item_1 ) { |
820 | 820 | foreach ( $json_val_2 as $item_2 ) { |
821 | 821 | $json_in = self::matches_operation( $item_1, $item_2, 'is' ); |
822 | 822 | |
823 | - if( $json_in ) { |
|
823 | + if ( $json_in ) { |
|
824 | 824 | break 2; |
825 | 825 | } |
826 | 826 | } |
@@ -871,10 +871,10 @@ discard block |
||
871 | 871 | public static function check_entry_display( $entry, $view = null ) { |
872 | 872 | |
873 | 873 | if ( ! $entry || is_wp_error( $entry ) ) { |
874 | - return new WP_Error('entry_not_found', 'Entry was not found.', $entry ); |
|
874 | + return new WP_Error( 'entry_not_found', 'Entry was not found.', $entry ); |
|
875 | 875 | } |
876 | 876 | |
877 | - if ( empty( $entry['form_id'] ) ) { |
|
877 | + if ( empty( $entry[ 'form_id' ] ) ) { |
|
878 | 878 | return new WP_Error( 'form_id_not_set', '[apply_filters_to_entry] Entry is empty!', $entry ); |
879 | 879 | } |
880 | 880 | |
@@ -889,19 +889,19 @@ discard block |
||
889 | 889 | |
890 | 890 | $_gvid = \GV\Utils::_GET( 'gvid' ); |
891 | 891 | |
892 | - if ( $_gvid && $view->ID !== (int) $_gvid ) { |
|
892 | + if ( $_gvid && $view->ID !== (int)$_gvid ) { |
|
893 | 893 | return new WP_Error( 'view_id_not_match_gvid', 'View does not match passed $_GET["gvid"].', $view->ID ); |
894 | 894 | } |
895 | 895 | |
896 | 896 | $view_form_id = $view->form->ID; |
897 | 897 | |
898 | 898 | if ( $view->joins ) { |
899 | - if ( in_array( (int) $entry['form_id'], array_keys( $view::get_joined_forms( $view->ID ) ), true ) ) { |
|
900 | - $view_form_id = $entry['form_id']; |
|
899 | + if ( in_array( (int)$entry[ 'form_id' ], array_keys( $view::get_joined_forms( $view->ID ) ), true ) ) { |
|
900 | + $view_form_id = $entry[ 'form_id' ]; |
|
901 | 901 | } |
902 | 902 | } |
903 | 903 | |
904 | - if ( (int) $view_form_id !== (int) $entry['form_id'] ) { |
|
904 | + if ( (int)$view_form_id !== (int)$entry[ 'form_id' ] ) { |
|
905 | 905 | return new WP_Error( 'view_id_not_match', 'View form source does not match entry form source ID.', $entry ); |
906 | 906 | } |
907 | 907 | |
@@ -909,13 +909,13 @@ discard block |
||
909 | 909 | * Check whether the entry is in the entries subset by running a modified query. |
910 | 910 | */ |
911 | 911 | add_action( 'gravityview/view/query', $entry_subset_callback = function( &$query, $view, $request ) use ( $entry, $view_form_id ) { |
912 | - $_tmp_query = new \GF_Query( $view_form_id, array( |
|
912 | + $_tmp_query = new \GF_Query( $view_form_id, array( |
|
913 | 913 | 'field_filters' => array( |
914 | 914 | 'mode' => 'all', |
915 | 915 | array( |
916 | 916 | 'key' => 'id', |
917 | 917 | 'operation' => 'is', |
918 | - 'value' => $entry['id'] |
|
918 | + 'value' => $entry[ 'id' ] |
|
919 | 919 | ) |
920 | 920 | ) |
921 | 921 | ) ); |
@@ -925,14 +925,14 @@ discard block |
||
925 | 925 | /** @type \GF_Query $query */ |
926 | 926 | $query_parts = $query->_introspect(); |
927 | 927 | |
928 | - $query->where( \GF_Query_Condition::_and( $_tmp_query_parts['where'], $query_parts['where'] ) ); |
|
928 | + $query->where( \GF_Query_Condition::_and( $_tmp_query_parts[ 'where' ], $query_parts[ 'where' ] ) ); |
|
929 | 929 | |
930 | 930 | }, 10, 3 ); |
931 | 931 | |
932 | 932 | // Prevent page offset from being applied to the single entry query; it's used to return to the referring page number |
933 | 933 | add_filter( 'gravityview_search_criteria', $remove_pagenum = function( $criteria ) { |
934 | 934 | |
935 | - $criteria['paging'] = array( |
|
935 | + $criteria[ 'paging' ] = array( |
|
936 | 936 | 'offset' => 0, |
937 | 937 | 'page_size' => 25 |
938 | 938 | ); |
@@ -951,20 +951,20 @@ discard block |
||
951 | 951 | } |
952 | 952 | |
953 | 953 | // This entry is on a View with joins |
954 | - if ( $entries[0]->is_multi() ) { |
|
954 | + if ( $entries[ 0 ]->is_multi() ) { |
|
955 | 955 | |
956 | 956 | $multi_entry_ids = array(); |
957 | 957 | |
958 | - foreach ( $entries[0]->entries as $multi_entry ) { |
|
959 | - $multi_entry_ids[] = (int) $multi_entry->ID; |
|
958 | + foreach ( $entries[ 0 ]->entries as $multi_entry ) { |
|
959 | + $multi_entry_ids[ ] = (int)$multi_entry->ID; |
|
960 | 960 | } |
961 | 961 | |
962 | - if ( ! in_array( (int) $entry['id'], $multi_entry_ids, true ) ) { |
|
962 | + if ( ! in_array( (int)$entry[ 'id' ], $multi_entry_ids, true ) ) { |
|
963 | 963 | remove_action( 'gravityview/view/query', $entry_subset_callback ); |
964 | 964 | return new \WP_Error( 'failed_criteria', 'Entry failed search_criteria and field_filters' ); |
965 | 965 | } |
966 | 966 | |
967 | - } elseif ( (int) $entries[0]->ID !== (int) $entry['id'] ) { |
|
967 | + } elseif ( (int)$entries[ 0 ]->ID !== (int)$entry[ 'id' ] ) { |
|
968 | 968 | remove_action( 'gravityview/view/query', $entry_subset_callback ); |
969 | 969 | return new \WP_Error( 'failed_criteria', 'Entry failed search_criteria and field_filters' ); |
970 | 970 | } |
@@ -1009,18 +1009,18 @@ discard block |
||
1009 | 1009 | * Gravity Forms code to adjust date to locally-configured Time Zone |
1010 | 1010 | * @see GFCommon::format_date() for original code |
1011 | 1011 | */ |
1012 | - $date_gmt_time = mysql2date( 'G', $date_string ); |
|
1012 | + $date_gmt_time = mysql2date( 'G', $date_string ); |
|
1013 | 1013 | $date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time ); |
1014 | 1014 | |
1015 | - $format = \GV\Utils::get( $atts, 'format' ); |
|
1016 | - $is_human = ! empty( $atts['human'] ); |
|
1017 | - $is_diff = ! empty( $atts['diff'] ); |
|
1018 | - $is_raw = ! empty( $atts['raw'] ); |
|
1019 | - $is_timestamp = ! empty( $atts['timestamp'] ); |
|
1020 | - $include_time = ! empty( $atts['time'] ); |
|
1015 | + $format = \GV\Utils::get( $atts, 'format' ); |
|
1016 | + $is_human = ! empty( $atts[ 'human' ] ); |
|
1017 | + $is_diff = ! empty( $atts[ 'diff' ] ); |
|
1018 | + $is_raw = ! empty( $atts[ 'raw' ] ); |
|
1019 | + $is_timestamp = ! empty( $atts[ 'timestamp' ] ); |
|
1020 | + $include_time = ! empty( $atts[ 'time' ] ); |
|
1021 | 1021 | |
1022 | 1022 | // If we're using time diff, we want to have a different default format |
1023 | - if( empty( $format ) ) { |
|
1023 | + if ( empty( $format ) ) { |
|
1024 | 1024 | /* translators: %s: relative time from now, used for generic date comparisons. "1 day ago", or "20 seconds ago" */ |
1025 | 1025 | $format = $is_diff ? esc_html__( '%s ago', 'gk-gravityview' ) : get_option( 'date_format' ); |
1026 | 1026 | } |
@@ -1028,7 +1028,7 @@ discard block |
||
1028 | 1028 | // If raw was specified, don't modify the stored value |
1029 | 1029 | if ( $is_raw ) { |
1030 | 1030 | $formatted_date = $date_string; |
1031 | - } elseif( $is_timestamp ) { |
|
1031 | + } elseif ( $is_timestamp ) { |
|
1032 | 1032 | $formatted_date = $date_local_timestamp; |
1033 | 1033 | } elseif ( $is_diff ) { |
1034 | 1034 | $formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) ); |
@@ -1061,7 +1061,7 @@ discard block |
||
1061 | 1061 | |
1062 | 1062 | $label = \GV\Utils::get( $field, 'label' ); |
1063 | 1063 | |
1064 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
1064 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
1065 | 1065 | $label = GFFormsModel::get_choice_text( $field, $field_value, $field_id ); |
1066 | 1066 | } |
1067 | 1067 | |
@@ -1088,7 +1088,7 @@ discard block |
||
1088 | 1088 | $form = GFAPI::get_form( $form ); |
1089 | 1089 | } |
1090 | 1090 | |
1091 | - if ( class_exists( 'GFFormsModel' ) ){ |
|
1091 | + if ( class_exists( 'GFFormsModel' ) ) { |
|
1092 | 1092 | return GFFormsModel::get_field( $form, $field_id ); |
1093 | 1093 | } else { |
1094 | 1094 | return null; |
@@ -1135,19 +1135,19 @@ discard block |
||
1135 | 1135 | $shortcodes = array(); |
1136 | 1136 | |
1137 | 1137 | preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ); |
1138 | - if ( empty( $matches ) ){ |
|
1138 | + if ( empty( $matches ) ) { |
|
1139 | 1139 | return false; |
1140 | 1140 | } |
1141 | 1141 | |
1142 | 1142 | foreach ( $matches as $shortcode ) { |
1143 | - if ( $tag === $shortcode[2] ) { |
|
1143 | + if ( $tag === $shortcode[ 2 ] ) { |
|
1144 | 1144 | |
1145 | 1145 | // Changed this to $shortcode instead of true so we get the parsed atts. |
1146 | - $shortcodes[] = $shortcode; |
|
1146 | + $shortcodes[ ] = $shortcode; |
|
1147 | 1147 | |
1148 | - } else if ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) { |
|
1149 | - foreach( $results as $result ) { |
|
1150 | - $shortcodes[] = $result; |
|
1148 | + } else if ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) { |
|
1149 | + foreach ( $results as $result ) { |
|
1150 | + $shortcodes[ ] = $result; |
|
1151 | 1151 | } |
1152 | 1152 | } |
1153 | 1153 | } |
@@ -1179,7 +1179,7 @@ discard block |
||
1179 | 1179 | 'post_type' => 'gravityview', |
1180 | 1180 | 'posts_per_page' => 100, |
1181 | 1181 | 'meta_key' => '_gravityview_form_id', |
1182 | - 'meta_value' => (int) $form_id, |
|
1182 | + 'meta_value' => (int)$form_id, |
|
1183 | 1183 | ); |
1184 | 1184 | $args = wp_parse_args( $args, $defaults ); |
1185 | 1185 | $views = get_posts( $args ); |
@@ -1191,21 +1191,21 @@ discard block |
||
1191 | 1191 | |
1192 | 1192 | $data = unserialize( $view->meta_value ); |
1193 | 1193 | |
1194 | - if( ! $data || ! is_array( $data ) ) { |
|
1194 | + if ( ! $data || ! is_array( $data ) ) { |
|
1195 | 1195 | continue; |
1196 | 1196 | } |
1197 | 1197 | |
1198 | 1198 | foreach ( $data as $datum ) { |
1199 | - if ( ! empty( $datum[2] ) && (int) $datum[2] === (int) $form_id ) { |
|
1200 | - $joined_forms[] = $view->post_id; |
|
1199 | + if ( ! empty( $datum[ 2 ] ) && (int)$datum[ 2 ] === (int)$form_id ) { |
|
1200 | + $joined_forms[ ] = $view->post_id; |
|
1201 | 1201 | } |
1202 | 1202 | } |
1203 | 1203 | } |
1204 | 1204 | |
1205 | 1205 | if ( $joined_forms ) { |
1206 | - $joined_args = array( |
|
1206 | + $joined_args = array( |
|
1207 | 1207 | 'post_type' => 'gravityview', |
1208 | - 'posts_per_page' => $args['posts_per_page'], |
|
1208 | + 'posts_per_page' => $args[ 'posts_per_page' ], |
|
1209 | 1209 | 'post__in' => $joined_forms, |
1210 | 1210 | ); |
1211 | 1211 | $views = array_merge( $views, get_posts( $joined_args ) ); |
@@ -1361,7 +1361,7 @@ discard block |
||
1361 | 1361 | |
1362 | 1362 | $directory_widgets = wp_parse_args( $view_widgets, $defaults ); |
1363 | 1363 | |
1364 | - if( $json_decode ) { |
|
1364 | + if ( $json_decode ) { |
|
1365 | 1365 | $directory_widgets = gv_map_deep( $directory_widgets, 'gv_maybe_json_decode' ); |
1366 | 1366 | } |
1367 | 1367 | |
@@ -1376,7 +1376,7 @@ discard block |
||
1376 | 1376 | * @return string html |
1377 | 1377 | */ |
1378 | 1378 | public static function get_sortable_fields( $formid, $current = '' ) { |
1379 | - $output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default (Entry ID)', 'gk-gravityview' ) .'</option>'; |
|
1379 | + $output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default (Entry ID)', 'gk-gravityview' ) . '</option>'; |
|
1380 | 1380 | |
1381 | 1381 | if ( empty( $formid ) ) { |
1382 | 1382 | return $output; |
@@ -1393,11 +1393,11 @@ discard block |
||
1393 | 1393 | $blocklist_field_types = apply_filters( 'gravityview_blocklist_field_types', $blocklist_field_types, null ); |
1394 | 1394 | |
1395 | 1395 | foreach ( $fields as $id => $field ) { |
1396 | - if ( in_array( $field['type'], $blocklist_field_types ) ) { |
|
1396 | + if ( in_array( $field[ 'type' ], $blocklist_field_types ) ) { |
|
1397 | 1397 | continue; |
1398 | 1398 | } |
1399 | 1399 | |
1400 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>'; |
|
1400 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>'; |
|
1401 | 1401 | } |
1402 | 1402 | } |
1403 | 1403 | |
@@ -1440,16 +1440,16 @@ discard block |
||
1440 | 1440 | $blocklist_field_types = apply_filters( 'gravityview_blocklist_field_types', $blocklist_field_types, null ); |
1441 | 1441 | |
1442 | 1442 | // TODO: Convert to using array_filter |
1443 | - foreach( $fields as $id => $field ) { |
|
1443 | + foreach ( $fields as $id => $field ) { |
|
1444 | 1444 | |
1445 | - if( in_array( $field['type'], $blocklist_field_types ) ) { |
|
1445 | + if ( in_array( $field[ 'type' ], $blocklist_field_types ) ) { |
|
1446 | 1446 | unset( $fields[ $id ] ); |
1447 | 1447 | } |
1448 | 1448 | |
1449 | 1449 | /** |
1450 | 1450 | * Merge date and time subfields. |
1451 | 1451 | */ |
1452 | - if ( in_array( $field['type'], array( 'date', 'time' ) ) && ! empty( $field['parent'] ) ) { |
|
1452 | + if ( in_array( $field[ 'type' ], array( 'date', 'time' ) ) && ! empty( $field[ 'parent' ] ) ) { |
|
1453 | 1453 | $fields[ intval( $id ) ] = array( |
1454 | 1454 | 'label' => \GV\Utils::get( $field, 'parent/label' ), |
1455 | 1455 | 'parent' => null, |
@@ -1499,14 +1499,14 @@ discard block |
||
1499 | 1499 | * @param int|array $field field key or field array |
1500 | 1500 | * @return boolean |
1501 | 1501 | */ |
1502 | - public static function is_field_numeric( $form = null, $field = '' ) { |
|
1502 | + public static function is_field_numeric( $form = null, $field = '' ) { |
|
1503 | 1503 | |
1504 | 1504 | if ( ! is_array( $form ) && ! is_array( $field ) ) { |
1505 | 1505 | $form = self::get_form( $form ); |
1506 | 1506 | } |
1507 | 1507 | |
1508 | 1508 | // If entry meta, it's a string. Otherwise, numeric |
1509 | - if( ! is_numeric( $field ) && is_string( $field ) ) { |
|
1509 | + if ( ! is_numeric( $field ) && is_string( $field ) ) { |
|
1510 | 1510 | $type = $field; |
1511 | 1511 | } else { |
1512 | 1512 | $type = self::get_field_type( $form, $field ); |
@@ -1520,9 +1520,9 @@ discard block |
||
1520 | 1520 | $numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) ); |
1521 | 1521 | |
1522 | 1522 | // Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true |
1523 | - if( $gv_field = GravityView_Fields::get( $type ) ) { |
|
1524 | - if( true === $gv_field->is_numeric ) { |
|
1525 | - $numeric_types[] = $gv_field->is_numeric; |
|
1523 | + if ( $gv_field = GravityView_Fields::get( $type ) ) { |
|
1524 | + if ( true === $gv_field->is_numeric ) { |
|
1525 | + $numeric_types[ ] = $gv_field->is_numeric; |
|
1526 | 1526 | } |
1527 | 1527 | } |
1528 | 1528 | |
@@ -1673,20 +1673,20 @@ discard block |
||
1673 | 1673 | $final_atts = array_filter( $final_atts ); |
1674 | 1674 | |
1675 | 1675 | // If the href wasn't passed as an attribute, use the value passed to the function |
1676 | - if ( empty( $final_atts['href'] ) && ! empty( $href ) ) { |
|
1677 | - $final_atts['href'] = $href; |
|
1676 | + if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) { |
|
1677 | + $final_atts[ 'href' ] = $href; |
|
1678 | 1678 | } |
1679 | 1679 | |
1680 | - if ( isset( $final_atts['href'] ) ) { |
|
1681 | - $final_atts['href'] = esc_url_raw( $final_atts['href'] ); |
|
1680 | + if ( isset( $final_atts[ 'href' ] ) ) { |
|
1681 | + $final_atts[ 'href' ] = esc_url_raw( $final_atts[ 'href' ] ); |
|
1682 | 1682 | } |
1683 | 1683 | |
1684 | 1684 | /** |
1685 | 1685 | * Fix potential security issue with target=_blank |
1686 | 1686 | * @see https://dev.to/ben/the-targetblank-vulnerability-by-example |
1687 | 1687 | */ |
1688 | - if( '_blank' === \GV\Utils::get( $final_atts, 'target' ) ) { |
|
1689 | - $final_atts['rel'] = trim( \GV\Utils::get( $final_atts, 'rel', '' ) . ' noopener noreferrer' ); |
|
1688 | + if ( '_blank' === \GV\Utils::get( $final_atts, 'target' ) ) { |
|
1689 | + $final_atts[ 'rel' ] = trim( \GV\Utils::get( $final_atts, 'rel', '' ) . ' noopener noreferrer' ); |
|
1690 | 1690 | } |
1691 | 1691 | |
1692 | 1692 | // Sort the attributes alphabetically, to help testing |
@@ -1698,7 +1698,7 @@ discard block |
||
1698 | 1698 | $output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) ); |
1699 | 1699 | } |
1700 | 1700 | |
1701 | - if( '' !== $output ) { |
|
1701 | + if ( '' !== $output ) { |
|
1702 | 1702 | $output = '<a' . $output . '>' . $anchor_text . '</a>'; |
1703 | 1703 | } |
1704 | 1704 | |
@@ -1725,7 +1725,7 @@ discard block |
||
1725 | 1725 | if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) { |
1726 | 1726 | $merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value ); |
1727 | 1727 | } else if ( is_numeric( $key ) && isset( $merged[ $key ] ) ) { |
1728 | - $merged[] = $value; |
|
1728 | + $merged[ ] = $value; |
|
1729 | 1729 | } else { |
1730 | 1730 | $merged[ $key ] = $value; |
1731 | 1731 | } |
@@ -1758,7 +1758,7 @@ discard block |
||
1758 | 1758 | * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..) |
1759 | 1759 | * @param array $settings Settings array, with `number` key defining the # of users to display |
1760 | 1760 | */ |
1761 | - $get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
1761 | + $get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
1762 | 1762 | |
1763 | 1763 | return get_users( $get_users_settings ); |
1764 | 1764 | } |
@@ -1778,11 +1778,11 @@ discard block |
||
1778 | 1778 | public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) { |
1779 | 1779 | |
1780 | 1780 | // If $cap is defined, only show notice if user has capability |
1781 | - if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) { |
|
1781 | + if ( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) { |
|
1782 | 1782 | return ''; |
1783 | 1783 | } |
1784 | 1784 | |
1785 | - return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
1785 | + return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>'; |
|
1786 | 1786 | } |
1787 | 1787 | |
1788 | 1788 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * @return void |
26 | 26 | */ |
27 | 27 | public function add( $value ) { |
28 | - $this->storage []= $value; |
|
28 | + $this->storage [ ] = $value; |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @return void |
50 | 50 | */ |
51 | 51 | public function merge( \GV\Collection $collection ) { |
52 | - array_map( array( $this, 'add'), $collection->all() ); |
|
52 | + array_map( array( $this, 'add' ), $collection->all() ); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -36,8 +36,7 @@ discard block |
||
36 | 36 | * |
37 | 37 | * @return void |
38 | 38 | */ |
39 | - public function emergency($message, array $context = array()) |
|
40 | - { |
|
39 | + public function emergency($message, array $context = array()) { |
|
41 | 40 | $this->log(LogLevel::EMERGENCY, $message, $context); |
42 | 41 | } |
43 | 42 | |
@@ -52,8 +51,7 @@ discard block |
||
52 | 51 | * |
53 | 52 | * @return void |
54 | 53 | */ |
55 | - public function alert($message, array $context = array()) |
|
56 | - { |
|
54 | + public function alert($message, array $context = array()) { |
|
57 | 55 | $this->log(LogLevel::ALERT, $message, $context); |
58 | 56 | } |
59 | 57 | |
@@ -67,8 +65,7 @@ discard block |
||
67 | 65 | * |
68 | 66 | * @return void |
69 | 67 | */ |
70 | - public function critical($message, array $context = array()) |
|
71 | - { |
|
68 | + public function critical($message, array $context = array()) { |
|
72 | 69 | $this->log(LogLevel::CRITICAL, $message, $context); |
73 | 70 | } |
74 | 71 | |
@@ -81,8 +78,7 @@ discard block |
||
81 | 78 | * |
82 | 79 | * @return void |
83 | 80 | */ |
84 | - public function error($message, array $context = array()) |
|
85 | - { |
|
81 | + public function error($message, array $context = array()) { |
|
86 | 82 | $this->log(LogLevel::ERROR, $message, $context); |
87 | 83 | } |
88 | 84 | |
@@ -97,8 +93,7 @@ discard block |
||
97 | 93 | * |
98 | 94 | * @return void |
99 | 95 | */ |
100 | - public function warning($message, array $context = array()) |
|
101 | - { |
|
96 | + public function warning($message, array $context = array()) { |
|
102 | 97 | $this->log(LogLevel::WARNING, $message, $context); |
103 | 98 | } |
104 | 99 | |
@@ -110,8 +105,7 @@ discard block |
||
110 | 105 | * |
111 | 106 | * @return void |
112 | 107 | */ |
113 | - public function notice($message, array $context = array()) |
|
114 | - { |
|
108 | + public function notice($message, array $context = array()) { |
|
115 | 109 | $this->log(LogLevel::NOTICE, $message, $context); |
116 | 110 | } |
117 | 111 | |
@@ -125,8 +119,7 @@ discard block |
||
125 | 119 | * |
126 | 120 | * @return void |
127 | 121 | */ |
128 | - public function info($message, array $context = array()) |
|
129 | - { |
|
122 | + public function info($message, array $context = array()) { |
|
130 | 123 | $this->log(LogLevel::INFO, $message, $context); |
131 | 124 | } |
132 | 125 | |
@@ -138,8 +131,7 @@ discard block |
||
138 | 131 | * |
139 | 132 | * @return void |
140 | 133 | */ |
141 | - public function debug($message, array $context = array()) |
|
142 | - { |
|
134 | + public function debug($message, array $context = array()) { |
|
143 | 135 | $this->log(LogLevel::DEBUG, $message, $context); |
144 | 136 | } |
145 | 137 |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | * |
37 | 37 | * @return void |
38 | 38 | */ |
39 | - public function emergency($message, array $context = array()) |
|
39 | + public function emergency( $message, array $context = array() ) |
|
40 | 40 | { |
41 | - $this->log(LogLevel::EMERGENCY, $message, $context); |
|
41 | + $this->log( LogLevel::EMERGENCY, $message, $context ); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @return void |
54 | 54 | */ |
55 | - public function alert($message, array $context = array()) |
|
55 | + public function alert( $message, array $context = array() ) |
|
56 | 56 | { |
57 | - $this->log(LogLevel::ALERT, $message, $context); |
|
57 | + $this->log( LogLevel::ALERT, $message, $context ); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @return void |
69 | 69 | */ |
70 | - public function critical($message, array $context = array()) |
|
70 | + public function critical( $message, array $context = array() ) |
|
71 | 71 | { |
72 | - $this->log(LogLevel::CRITICAL, $message, $context); |
|
72 | + $this->log( LogLevel::CRITICAL, $message, $context ); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | * |
82 | 82 | * @return void |
83 | 83 | */ |
84 | - public function error($message, array $context = array()) |
|
84 | + public function error( $message, array $context = array() ) |
|
85 | 85 | { |
86 | - $this->log(LogLevel::ERROR, $message, $context); |
|
86 | + $this->log( LogLevel::ERROR, $message, $context ); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -97,9 +97,9 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @return void |
99 | 99 | */ |
100 | - public function warning($message, array $context = array()) |
|
100 | + public function warning( $message, array $context = array() ) |
|
101 | 101 | { |
102 | - $this->log(LogLevel::WARNING, $message, $context); |
|
102 | + $this->log( LogLevel::WARNING, $message, $context ); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -110,9 +110,9 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @return void |
112 | 112 | */ |
113 | - public function notice($message, array $context = array()) |
|
113 | + public function notice( $message, array $context = array() ) |
|
114 | 114 | { |
115 | - $this->log(LogLevel::NOTICE, $message, $context); |
|
115 | + $this->log( LogLevel::NOTICE, $message, $context ); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | * |
126 | 126 | * @return void |
127 | 127 | */ |
128 | - public function info($message, array $context = array()) |
|
128 | + public function info( $message, array $context = array() ) |
|
129 | 129 | { |
130 | - $this->log(LogLevel::INFO, $message, $context); |
|
130 | + $this->log( LogLevel::INFO, $message, $context ); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -138,9 +138,9 @@ discard block |
||
138 | 138 | * |
139 | 139 | * @return void |
140 | 140 | */ |
141 | - public function debug($message, array $context = array()) |
|
141 | + public function debug( $message, array $context = array() ) |
|
142 | 142 | { |
143 | - $this->log(LogLevel::DEBUG, $message, $context); |
|
143 | + $this->log( LogLevel::DEBUG, $message, $context ); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | protected function interpolate( $message, $context ) { |
154 | 154 | foreach ( $context as $key => $val ) { |
155 | 155 | if ( strpos( $message, "{{$key}}" ) !== false ) { |
156 | - $message = str_replace( "{{$key}}", (string) $val, $message ); |
|
156 | + $message = str_replace( "{{$key}}", (string)$val, $message ); |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 |
@@ -10,14 +10,14 @@ discard block |
||
10 | 10 | * Describes log levels. |
11 | 11 | */ |
12 | 12 | class LogLevel { |
13 | - const EMERGENCY = 'emergency'; |
|
14 | - const ALERT = 'alert'; |
|
15 | - const CRITICAL = 'critical'; |
|
16 | - const ERROR = 'error'; |
|
17 | - const WARNING = 'warning'; |
|
18 | - const NOTICE = 'notice'; |
|
19 | - const INFO = 'info'; |
|
20 | - const DEBUG = 'debug'; |
|
13 | + const EMERGENCY = 'emergency'; |
|
14 | + const ALERT = 'alert'; |
|
15 | + const CRITICAL = 'critical'; |
|
16 | + const ERROR = 'error'; |
|
17 | + const WARNING = 'warning'; |
|
18 | + const NOTICE = 'notice'; |
|
19 | + const INFO = 'info'; |
|
20 | + const DEBUG = 'debug'; |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | /** |
@@ -26,127 +26,127 @@ discard block |
||
26 | 26 | * @TODO: (Foundation) Deprecate in future versions. |
27 | 27 | */ |
28 | 28 | abstract class Logger /** @todo extends Psr\Log\AbstractLogger */ { |
29 | - /** |
|
30 | - * System is unusable. |
|
31 | - * |
|
32 | - * @param string $message |
|
33 | - * @param array $context |
|
34 | - * |
|
35 | - * @return void |
|
36 | - */ |
|
37 | - public function emergency($message, array $context = array()) |
|
38 | - { |
|
39 | - $this->log(LogLevel::EMERGENCY, $message, $context); |
|
40 | - } |
|
29 | + /** |
|
30 | + * System is unusable. |
|
31 | + * |
|
32 | + * @param string $message |
|
33 | + * @param array $context |
|
34 | + * |
|
35 | + * @return void |
|
36 | + */ |
|
37 | + public function emergency($message, array $context = array()) |
|
38 | + { |
|
39 | + $this->log(LogLevel::EMERGENCY, $message, $context); |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * Action must be taken immediately. |
|
44 | - * |
|
45 | - * Example: Entire website down, database unavailable, etc. This should |
|
46 | - * trigger the SMS alerts and wake you up. |
|
47 | - * |
|
48 | - * @param string $message |
|
49 | - * @param array $context |
|
50 | - * |
|
51 | - * @return void |
|
52 | - */ |
|
53 | - public function alert($message, array $context = array()) |
|
54 | - { |
|
55 | - $this->log(LogLevel::ALERT, $message, $context); |
|
56 | - } |
|
42 | + /** |
|
43 | + * Action must be taken immediately. |
|
44 | + * |
|
45 | + * Example: Entire website down, database unavailable, etc. This should |
|
46 | + * trigger the SMS alerts and wake you up. |
|
47 | + * |
|
48 | + * @param string $message |
|
49 | + * @param array $context |
|
50 | + * |
|
51 | + * @return void |
|
52 | + */ |
|
53 | + public function alert($message, array $context = array()) |
|
54 | + { |
|
55 | + $this->log(LogLevel::ALERT, $message, $context); |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * Critical conditions. |
|
60 | - * |
|
61 | - * Example: Application component unavailable, unexpected exception. |
|
62 | - * |
|
63 | - * @param string $message |
|
64 | - * @param array $context |
|
65 | - * |
|
66 | - * @return void |
|
67 | - */ |
|
68 | - public function critical($message, array $context = array()) |
|
69 | - { |
|
70 | - $this->log(LogLevel::CRITICAL, $message, $context); |
|
71 | - } |
|
58 | + /** |
|
59 | + * Critical conditions. |
|
60 | + * |
|
61 | + * Example: Application component unavailable, unexpected exception. |
|
62 | + * |
|
63 | + * @param string $message |
|
64 | + * @param array $context |
|
65 | + * |
|
66 | + * @return void |
|
67 | + */ |
|
68 | + public function critical($message, array $context = array()) |
|
69 | + { |
|
70 | + $this->log(LogLevel::CRITICAL, $message, $context); |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * Runtime errors that do not require immediate action but should typically |
|
75 | - * be logged and monitored. |
|
76 | - * |
|
77 | - * @param string $message |
|
78 | - * @param array $context |
|
79 | - * |
|
80 | - * @return void |
|
81 | - */ |
|
82 | - public function error($message, array $context = array()) |
|
83 | - { |
|
84 | - $this->log(LogLevel::ERROR, $message, $context); |
|
85 | - } |
|
73 | + /** |
|
74 | + * Runtime errors that do not require immediate action but should typically |
|
75 | + * be logged and monitored. |
|
76 | + * |
|
77 | + * @param string $message |
|
78 | + * @param array $context |
|
79 | + * |
|
80 | + * @return void |
|
81 | + */ |
|
82 | + public function error($message, array $context = array()) |
|
83 | + { |
|
84 | + $this->log(LogLevel::ERROR, $message, $context); |
|
85 | + } |
|
86 | 86 | |
87 | - /** |
|
88 | - * Exceptional occurrences that are not errors. |
|
89 | - * |
|
90 | - * Example: Use of deprecated APIs, poor use of an API, undesirable things |
|
91 | - * that are not necessarily wrong. |
|
92 | - * |
|
93 | - * @param string $message |
|
94 | - * @param array $context |
|
95 | - * |
|
96 | - * @return void |
|
97 | - */ |
|
98 | - public function warning($message, array $context = array()) |
|
99 | - { |
|
100 | - $this->log(LogLevel::WARNING, $message, $context); |
|
101 | - } |
|
87 | + /** |
|
88 | + * Exceptional occurrences that are not errors. |
|
89 | + * |
|
90 | + * Example: Use of deprecated APIs, poor use of an API, undesirable things |
|
91 | + * that are not necessarily wrong. |
|
92 | + * |
|
93 | + * @param string $message |
|
94 | + * @param array $context |
|
95 | + * |
|
96 | + * @return void |
|
97 | + */ |
|
98 | + public function warning($message, array $context = array()) |
|
99 | + { |
|
100 | + $this->log(LogLevel::WARNING, $message, $context); |
|
101 | + } |
|
102 | 102 | |
103 | - /** |
|
104 | - * Normal but significant events. |
|
105 | - * |
|
106 | - * @param string $message |
|
107 | - * @param array $context |
|
108 | - * |
|
109 | - * @return void |
|
110 | - */ |
|
111 | - public function notice($message, array $context = array()) |
|
112 | - { |
|
113 | - $this->log(LogLevel::NOTICE, $message, $context); |
|
114 | - } |
|
103 | + /** |
|
104 | + * Normal but significant events. |
|
105 | + * |
|
106 | + * @param string $message |
|
107 | + * @param array $context |
|
108 | + * |
|
109 | + * @return void |
|
110 | + */ |
|
111 | + public function notice($message, array $context = array()) |
|
112 | + { |
|
113 | + $this->log(LogLevel::NOTICE, $message, $context); |
|
114 | + } |
|
115 | 115 | |
116 | - /** |
|
117 | - * Interesting events. |
|
118 | - * |
|
119 | - * Example: User logs in, SQL logs. |
|
120 | - * |
|
121 | - * @param string $message |
|
122 | - * @param array $context |
|
123 | - * |
|
124 | - * @return void |
|
125 | - */ |
|
126 | - public function info($message, array $context = array()) |
|
127 | - { |
|
128 | - $this->log(LogLevel::INFO, $message, $context); |
|
129 | - } |
|
116 | + /** |
|
117 | + * Interesting events. |
|
118 | + * |
|
119 | + * Example: User logs in, SQL logs. |
|
120 | + * |
|
121 | + * @param string $message |
|
122 | + * @param array $context |
|
123 | + * |
|
124 | + * @return void |
|
125 | + */ |
|
126 | + public function info($message, array $context = array()) |
|
127 | + { |
|
128 | + $this->log(LogLevel::INFO, $message, $context); |
|
129 | + } |
|
130 | 130 | |
131 | - /** |
|
132 | - * Detailed debug information. |
|
133 | - * |
|
134 | - * @param string $message |
|
135 | - * @param array $context |
|
136 | - * |
|
137 | - * @return void |
|
138 | - */ |
|
139 | - public function debug($message, array $context = array()) |
|
140 | - { |
|
141 | - $this->log(LogLevel::DEBUG, $message, $context); |
|
142 | - } |
|
131 | + /** |
|
132 | + * Detailed debug information. |
|
133 | + * |
|
134 | + * @param string $message |
|
135 | + * @param array $context |
|
136 | + * |
|
137 | + * @return void |
|
138 | + */ |
|
139 | + public function debug($message, array $context = array()) |
|
140 | + { |
|
141 | + $this->log(LogLevel::DEBUG, $message, $context); |
|
142 | + } |
|
143 | 143 | |
144 | 144 | /** |
145 | 145 | * Bake the context into { } placeholders in the message. |
146 | - * @param string $message |
|
147 | - * @param array $context |
|
148 | - * |
|
149 | - * @return string The baked message; |
|
146 | + * @param string $message |
|
147 | + * @param array $context |
|
148 | + * |
|
149 | + * @return string The baked message; |
|
150 | 150 | */ |
151 | 151 | protected function interpolate( $message, $context ) { |
152 | 152 | foreach ( $context as $key => $val ) { |