@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | |
23 | 23 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
24 | 24 | |
25 | - unset( $field_options['search_filter'] ); |
|
25 | + unset( $field_options[ 'search_filter' ] ); |
|
26 | 26 | |
27 | 27 | if ( 'edit' === $context ) { |
28 | 28 | return $field_options; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $add_options = array(); |
34 | 34 | |
35 | 35 | if ( $field->field->inputType === 'likert' && $field->field->gsurveyLikertEnableScoring ) { |
36 | - $add_options['score'] = array( |
|
36 | + $add_options[ 'score' ] = array( |
|
37 | 37 | 'type' => 'checkbox', |
38 | 38 | 'label' => __( 'Show score', 'gravityview' ), |
39 | 39 | 'desc' => __( 'Display likert score as a simple number.', 'gravityview' ), |
@@ -41,7 +41,7 @@ |
||
41 | 41 | * @return string If Gravity Flow not found, or entry not processed yet, returns initial value. Otherwise, returns name of workflow step. |
42 | 42 | */ |
43 | 43 | function modify_entry_value_workflow_current_status_timestamp( $output, $entry, $field_settings, $field ) { |
44 | - $timestamp = gform_get_meta( $entry['id'], 'workflow_current_status_timestamp' ); |
|
44 | + $timestamp = gform_get_meta( $entry[ 'id' ], 'workflow_current_status_timestamp' ); |
|
45 | 45 | |
46 | 46 | if ( ! $timestamp ) { |
47 | 47 | return $timestamp; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | parent::add_hooks(); |
35 | 35 | |
36 | - add_filter( 'gravityview/search/searchable_fields', array( $this, 'modify_search_bar_fields_dropdown'), 10, 2 ); |
|
36 | + add_filter( 'gravityview/search/searchable_fields', array( $this, 'modify_search_bar_fields_dropdown' ), 10, 2 ); |
|
37 | 37 | |
38 | 38 | add_filter( 'gravityview/admin/available_fields', array( $this, 'maybe_add_non_default_fields' ), 10, 3 ); |
39 | 39 | |
@@ -55,13 +55,13 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public static function get_status_options( $form_id = 0, $status_key = 'workflow_final_status' ) { |
57 | 57 | |
58 | - if( empty( $form_id ) ) { |
|
58 | + if ( empty( $form_id ) ) { |
|
59 | 59 | $form_id = GravityView_View::getInstance()->getFormId(); |
60 | 60 | } |
61 | 61 | |
62 | 62 | $entry_meta = gravity_flow()->get_entry_meta( array(), $form_id ); |
63 | 63 | |
64 | - return (array) \GV\Utils::get( $entry_meta, $status_key . '/filter/choices' ); |
|
64 | + return (array)\GV\Utils::get( $entry_meta, $status_key . '/filter/choices' ); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | $workflow_steps = $GFlow->get_steps(); |
85 | 85 | |
86 | - if( $workflow_steps ) { |
|
86 | + if ( $workflow_steps ) { |
|
87 | 87 | |
88 | 88 | foreach ( $workflow_steps as $step ) { |
89 | 89 | |
@@ -95,12 +95,12 @@ discard block |
||
95 | 95 | ); |
96 | 96 | } |
97 | 97 | |
98 | - $fields['workflow_step'] = array( |
|
98 | + $fields[ 'workflow_step' ] = array( |
|
99 | 99 | 'label' => esc_html__( 'Workflow Step', 'gravityview' ), |
100 | 100 | 'type' => 'select', |
101 | 101 | ); |
102 | 102 | |
103 | - $fields['workflow_final_status'] = array( |
|
103 | + $fields[ 'workflow_final_status' ] = array( |
|
104 | 104 | 'label' => esc_html__( 'Workflow Status', 'gravityview' ), |
105 | 105 | 'type' => 'select', |
106 | 106 | ); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | if ( ( $insert_at = array_search( 'workflow_final_status', wp_list_pluck( $fields, 'key' ) ) ) !== false ) { |
117 | 117 | $fields_end = array_splice( $fields, $insert_at + 1 ); |
118 | 118 | |
119 | - $fields[] = array( |
|
119 | + $fields[ ] = array( |
|
120 | 120 | 'text' => __( 'Workflow Current Status Timestamp', 'gravityview' ), |
121 | 121 | 'operators' => array( '>', '<' ), |
122 | 122 | 'placeholder' => 'yyyy-mm-dd', |
@@ -142,8 +142,8 @@ discard block |
||
142 | 142 | $keys_end = array_splice( $keys, $insert_at + 1 ); |
143 | 143 | $values_end = array_splice( $values, $insert_at + 1 ); |
144 | 144 | |
145 | - $keys[] = 'workflow_current_status_timestamp'; |
|
146 | - $values[] = array( |
|
145 | + $keys[ ] = 'workflow_current_status_timestamp'; |
|
146 | + $values[ ] = array( |
|
147 | 147 | 'label' => __( 'Workflow Current Status Timestamp', 'gravityview' ), |
148 | 148 | 'type' => 'workflow_current_status_timestamp', |
149 | 149 | ); |
@@ -47,16 +47,16 @@ |
||
47 | 47 | |
48 | 48 | foreach ( $shortcodes->get_shortcode_information( 'gravitypdf', $content ) as $shortcode ) { |
49 | 49 | // Let's make sure this entry ID is correct for the supplied form |
50 | - $form_id = $wpdb->get_var( $wpdb->prepare( "SELECT form_id FROM $table WHERE display_meta LIKE %s", '%"' . $wpdb->esc_like( $shortcode['attr']['id'] ) . '"%' ) ); |
|
50 | + $form_id = $wpdb->get_var( $wpdb->prepare( "SELECT form_id FROM $table WHERE display_meta LIKE %s", '%"' . $wpdb->esc_like( $shortcode[ 'attr' ][ 'id' ] ) . '"%' ) ); |
|
51 | 51 | |
52 | 52 | // Inject the needed entry ID |
53 | 53 | $replace = str_replace( |
54 | - sprintf( 'entry="%d"', $shortcode['attr']['entry'] ), |
|
55 | - sprintf( 'entry="%d"', $context->entry[ $form_id ]['id'] ), |
|
56 | - $shortcode['shortcode'] |
|
54 | + sprintf( 'entry="%d"', $shortcode[ 'attr' ][ 'entry' ] ), |
|
55 | + sprintf( 'entry="%d"', $context->entry[ $form_id ][ 'id' ] ), |
|
56 | + $shortcode[ 'shortcode' ] |
|
57 | 57 | ); |
58 | 58 | |
59 | - $content = str_replace( $shortcode['shortcode'], $replace, $content ); |
|
59 | + $content = str_replace( $shortcode[ 'shortcode' ], $replace, $content ); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | return $content; |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * @see GFCommon::get_field_filter_settings Gravity Forms suggests checkboxes should just be "contains" |
14 | 14 | * @var array |
15 | 15 | */ |
16 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains'); |
|
16 | + var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' ); |
|
17 | 17 | |
18 | 18 | var $is_searchable = true; |
19 | 19 | |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | // Set the $_field_id var |
46 | 46 | $field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ); |
47 | 47 | |
48 | - if( $this->is_choice_value_enabled() ) { |
|
49 | - $field_options['choice_display'] = array( |
|
48 | + if ( $this->is_choice_value_enabled() ) { |
|
49 | + $field_options[ 'choice_display' ] = array( |
|
50 | 50 | 'type' => 'radio', |
51 | 51 | 'value' => 'value', |
52 | 52 | 'label' => __( 'What should be displayed:', 'gravityview' ), |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | $field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ); |
46 | 46 | |
47 | 47 | // It's not the parent field; it's an input |
48 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
48 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
49 | 49 | |
50 | - if( $this->is_choice_value_enabled() ) { |
|
50 | + if ( $this->is_choice_value_enabled() ) { |
|
51 | 51 | |
52 | 52 | $desc = esc_html__( 'This input has a label and a value. What should be displayed?', 'gravityview' ); |
53 | 53 | $default = 'value'; |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | ); |
66 | 66 | } |
67 | 67 | |
68 | - $field_options['choice_display'] = array( |
|
68 | + $field_options[ 'choice_display' ] = array( |
|
69 | 69 | 'type' => 'radio', |
70 | 70 | 'class' => 'vertical', |
71 | 71 | 'label' => __( 'What should be displayed:', 'gravityview' ), |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | var $is_searchable = true; |
13 | 13 | |
14 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains'); |
|
14 | + var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' ); |
|
15 | 15 | |
16 | 16 | var $_gf_field_class_name = 'GF_Field_Radio'; |
17 | 17 | |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | // Set the $_field_id var |
41 | 41 | $field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ); |
42 | 42 | |
43 | - if( $this->is_choice_value_enabled() ) { |
|
44 | - $field_options['choice_display'] = array( |
|
43 | + if ( $this->is_choice_value_enabled() ) { |
|
44 | + $field_options[ 'choice_display' ] = array( |
|
45 | 45 | 'type' => 'radio', |
46 | 46 | 'value' => 'value', |
47 | 47 | 'label' => __( 'What should be displayed:', 'gravityview' ), |
@@ -44,8 +44,8 @@ |
||
44 | 44 | // Set the $_field_id var |
45 | 45 | $field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ); |
46 | 46 | |
47 | - if( $this->is_choice_value_enabled() ) { |
|
48 | - $field_options['choice_display'] = array( |
|
47 | + if ( $this->is_choice_value_enabled() ) { |
|
48 | + $field_options[ 'choice_display' ] = array( |
|
49 | 49 | 'type' => 'radio', |
50 | 50 | 'value' => 'value', |
51 | 51 | 'label' => __( 'What should be displayed:', 'gravityview' ), |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public static function get_instance() { |
96 | 96 | |
97 | - if( empty( self::$instance ) ) { |
|
97 | + if ( empty( self::$instance ) ) { |
|
98 | 98 | self::$instance = new self; |
99 | 99 | } |
100 | 100 | |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | |
129 | 129 | $operators = array_merge( self::$SUPPORTED_ARRAY_OPERATORS, self::$SUPPORTED_NUMERIC_OPERATORS, self::$SUPPORTED_SCALAR_OPERATORS, self::$SUPPORTED_CUSTOM_OPERATORS ); |
130 | 130 | |
131 | - if( $with_values ) { |
|
131 | + if ( $with_values ) { |
|
132 | 132 | $operators_with_values = array(); |
133 | - foreach( $operators as $key ) { |
|
133 | + foreach ( $operators as $key ) { |
|
134 | 134 | $operators_with_values[ $key ] = ''; |
135 | 135 | } |
136 | 136 | return $operators_with_values; |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | |
150 | 150 | $operators = $this->get_operators( false ); |
151 | 151 | |
152 | - if( !in_array( $operation, $operators ) ) { |
|
152 | + if ( ! in_array( $operation, $operators ) ) { |
|
153 | 153 | gravityview()->log->debug( ' Attempted to add invalid operation type. {operation}', array( 'operation' => $operation ) ); |
154 | 154 | return false; |
155 | 155 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | return null; |
202 | 202 | } |
203 | 203 | |
204 | - if( empty( $atts ) ) { |
|
204 | + if ( empty( $atts ) ) { |
|
205 | 205 | gravityview()->log->error( '$atts are empty.', array( 'data' => $atts ) ); |
206 | 206 | return null; |
207 | 207 | } |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | $setup = $this->setup_operation_and_comparison(); |
226 | 226 | |
227 | 227 | // We need an operation and comparison value |
228 | - if( ! $setup ) { |
|
228 | + if ( ! $setup ) { |
|
229 | 229 | gravityview()->log->error( 'No valid operators were passed.', array( 'data' => $this->atts ) ); |
230 | 230 | return null; |
231 | 231 | } |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | $logged_in_match = ! $this->logged_in ^ is_user_logged_in(); // XNOR |
278 | 278 | |
279 | 279 | // Only logged-in match |
280 | - if( 1 === sizeof( $this->passed_atts ) ) { |
|
280 | + if ( 1 === sizeof( $this->passed_atts ) ) { |
|
281 | 281 | $this->is_match = $logged_in_match; |
282 | 282 | } else { |
283 | 283 | $this->is_match = $logged_in_match && $comparison_match; |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | */ |
292 | 292 | private function get_output() { |
293 | 293 | |
294 | - if( $this->is_match ) { |
|
294 | + if ( $this->is_match ) { |
|
295 | 295 | $output = $this->content; |
296 | 296 | } else { |
297 | 297 | $output = $this->else_content; |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | * @param string $output HTML/text output |
310 | 310 | * @param GVLogic_Shortcode $this This class |
311 | 311 | */ |
312 | - $output = apply_filters('gravityview/gvlogic/output', $output, $this ); |
|
312 | + $output = apply_filters( 'gravityview/gvlogic/output', $output, $this ); |
|
313 | 313 | |
314 | 314 | gravityview()->log->debug( 'Output: ', array( 'data' => $output ) ); |
315 | 315 | |
@@ -329,14 +329,14 @@ discard block |
||
329 | 329 | list( $before_else, $after_else ) = array_pad( explode( '[else]', $passed_content, 2 ), 2, NULL ); |
330 | 330 | list( $before_else_if, $after_else_if ) = array_pad( explode( '[else', $passed_content, 2 ), 2, NULL ); |
331 | 331 | |
332 | - $else_attr = isset( $this->atts['else'] ) ? $this->atts['else'] : NULL; |
|
332 | + $else_attr = isset( $this->atts[ 'else' ] ) ? $this->atts[ 'else' ] : NULL; |
|
333 | 333 | $else_content = isset( $after_else ) ? $after_else : $else_attr; |
334 | 334 | |
335 | 335 | // The content is everything OTHER than the [else] |
336 | 336 | $this->content = $before_else_if; |
337 | 337 | |
338 | 338 | if ( ! $this->is_match ) { |
339 | - if( $elseif_content = $this->process_elseif( $before_else ) ) { |
|
339 | + if ( $elseif_content = $this->process_elseif( $before_else ) ) { |
|
340 | 340 | $this->else_content = $elseif_content; |
341 | 341 | } else { |
342 | 342 | $this->else_content = $else_content; |
@@ -364,16 +364,16 @@ discard block |
||
364 | 364 | foreach ( $else_if_matches as $key => $else_if_match ) { |
365 | 365 | |
366 | 366 | // If $else_if_match[5] exists and has content, check for more shortcodes |
367 | - preg_match_all( '/' . $regex . '/', $else_if_match[5] . '[/else]', $recursive_matches, PREG_SET_ORDER ); |
|
367 | + preg_match_all( '/' . $regex . '/', $else_if_match[ 5 ] . '[/else]', $recursive_matches, PREG_SET_ORDER ); |
|
368 | 368 | |
369 | 369 | // If the logic passes, this is the value that should be used for $this->else_content |
370 | - $else_if_value = $else_if_match[5]; |
|
371 | - $check_elseif_match = $else_if_match[0]; |
|
370 | + $else_if_value = $else_if_match[ 5 ]; |
|
371 | + $check_elseif_match = $else_if_match[ 0 ]; |
|
372 | 372 | |
373 | 373 | // Retrieve the value of the match that is currently being checked, without any other [else] tags |
374 | - if( ! empty( $recursive_matches[0][0] ) ) { |
|
375 | - $else_if_value = str_replace( $recursive_matches[0][0], '', $else_if_value ); |
|
376 | - $check_elseif_match = str_replace( $recursive_matches[0][0], '', $check_elseif_match ); |
|
374 | + if ( ! empty( $recursive_matches[ 0 ][ 0 ] ) ) { |
|
375 | + $else_if_value = str_replace( $recursive_matches[ 0 ][ 0 ], '', $else_if_value ); |
|
376 | + $check_elseif_match = str_replace( $recursive_matches[ 0 ][ 0 ], '', $check_elseif_match ); |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | $check_elseif_match = str_replace( '[else', '[gvlogicelse', $check_elseif_match ); |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | } |
391 | 391 | |
392 | 392 | // Process any remaining [else] tags |
393 | - return $this->process_elseif( $else_if_match[5] ); |
|
393 | + return $this->process_elseif( $else_if_match[ 5 ] ); |
|
394 | 394 | } |
395 | 395 | |
396 | 396 | return false; |
@@ -417,11 +417,11 @@ discard block |
||
417 | 417 | $this->atts = array_intersect_key( $this->passed_atts, $this->atts ); |
418 | 418 | |
419 | 419 | // Strip whitespace if it's not default false |
420 | - $this->if = ( isset( $this->atts['if'] ) && is_string( $this->atts['if'] ) ) ? trim( $this->atts['if'] ) : false; |
|
420 | + $this->if = ( isset( $this->atts[ 'if' ] ) && is_string( $this->atts[ 'if' ] ) ) ? trim( $this->atts[ 'if' ] ) : false; |
|
421 | 421 | |
422 | - if ( isset( $this->atts['logged_in'] ) ) { |
|
422 | + if ( isset( $this->atts[ 'logged_in' ] ) ) { |
|
423 | 423 | // Truthy |
424 | - if ( in_array( strtolower( $this->atts['logged_in'] ), array( '0', 'false', 'no' ) ) ) { |
|
424 | + if ( in_array( strtolower( $this->atts[ 'logged_in' ] ), array( '0', 'false', 'no' ) ) ) { |
|
425 | 425 | $this->logged_in = false; |
426 | 426 | } else { |
427 | 427 | $this->logged_in = true; |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | do_action( 'gravityview/gvlogic/parse_atts/after', $this ); |
438 | 438 | |
439 | 439 | // Make sure the "if" isn't processed in self::setup_operation_and_comparison() |
440 | - unset( $this->atts['if'] ); |
|
440 | + unset( $this->atts[ 'if' ] ); |
|
441 | 441 | } |
442 | 442 | } |
443 | 443 |