@@ -31,7 +31,7 @@ |
||
| 31 | 31 | |
| 32 | 32 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
| 33 | 33 | |
| 34 | - $this->add_field_support('link_to_post', $field_options ); |
|
| 34 | + $this->add_field_support( 'link_to_post', $field_options ); |
|
| 35 | 35 | |
| 36 | 36 | return $field_options; |
| 37 | 37 | } |
@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | if ( 'address' === \GV\Utils::get( $search_field, 'type' ) ) { |
| 62 | 62 | |
| 63 | - $field_id = intval( floor( $search_field['key'] ) ); |
|
| 64 | - $input_id = gravityview_get_input_id_from_id( $search_field['key'] ); |
|
| 63 | + $field_id = intval( floor( $search_field[ 'key' ] ) ); |
|
| 64 | + $input_id = gravityview_get_input_id_from_id( $search_field[ 'key' ] ); |
|
| 65 | 65 | $form = GravityView_View::getInstance()->getForm(); |
| 66 | 66 | |
| 67 | 67 | /** @var GF_Field_Address $address_field */ |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $choices = array(); |
| 71 | 71 | |
| 72 | 72 | $method_name = 'get_choices_' . self::get_input_type_from_input_id( $input_id ); |
| 73 | - if( method_exists( $this, $method_name ) ) { |
|
| 73 | + if ( method_exists( $this, $method_name ) ) { |
|
| 74 | 74 | /** |
| 75 | 75 | * @uses GravityView_Field_Address::get_choices_country() |
| 76 | 76 | * @uses GravityView_Field_Address::get_choices_state() |
@@ -78,12 +78,12 @@ discard block |
||
| 78 | 78 | $choices = $this->{$method_name}( $address_field, $form ); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - if( ! empty( $choices ) ) { |
|
| 82 | - $search_field['choices'] = $choices; |
|
| 83 | - $search_field['type'] = \GV\Utils::get( $search_field, 'input'); |
|
| 81 | + if ( ! empty( $choices ) ) { |
|
| 82 | + $search_field[ 'choices' ] = $choices; |
|
| 83 | + $search_field[ 'type' ] = \GV\Utils::get( $search_field, 'input' ); |
|
| 84 | 84 | } else { |
| 85 | - $search_field['type'] = 'text'; |
|
| 86 | - $search_field['input'] = 'input_text'; |
|
| 85 | + $search_field[ 'type' ] = 'text'; |
|
| 86 | + $search_field[ 'input' ] = 'input_text'; |
|
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | 89 | } |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | $country_choices = array(); |
| 110 | 110 | |
| 111 | 111 | foreach ( $countries as $key => $country ) { |
| 112 | - $country_choices[] = array( |
|
| 112 | + $country_choices[ ] = array( |
|
| 113 | 113 | 'value' => $country, |
| 114 | 114 | 'text' => $country, |
| 115 | 115 | ); |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | private function get_choices_state( $address_field, $form ) { |
| 136 | 136 | |
| 137 | - $address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form['id'] ) : $address_field->addressType; |
|
| 137 | + $address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form[ 'id' ] ) : $address_field->addressType; |
|
| 138 | 138 | |
| 139 | 139 | $state_choices = array(); |
| 140 | 140 | |
@@ -146,8 +146,8 @@ discard block |
||
| 146 | 146 | $states = GFCommon::get_canadian_provinces(); |
| 147 | 147 | break; |
| 148 | 148 | default: |
| 149 | - $address_types = $address_field->get_address_types( $form['id'] ); |
|
| 150 | - $states = empty( $address_types[ $address_type ]['states'] ) ? array() : $address_types[ $address_type ]['states']; |
|
| 149 | + $address_types = $address_field->get_address_types( $form[ 'id' ] ); |
|
| 150 | + $states = empty( $address_types[ $address_type ][ 'states' ] ) ? array() : $address_types[ $address_type ][ 'states' ]; |
|
| 151 | 151 | break; |
| 152 | 152 | } |
| 153 | 153 | |
@@ -156,19 +156,19 @@ discard block |
||
| 156 | 156 | $state_subchoices = array(); |
| 157 | 157 | |
| 158 | 158 | foreach ( $state as $key => $substate ) { |
| 159 | - $state_subchoices[] = array( |
|
| 159 | + $state_subchoices[ ] = array( |
|
| 160 | 160 | 'value' => is_numeric( $key ) ? $substate : $key, |
| 161 | 161 | 'text' => $substate, |
| 162 | 162 | ); |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - $state_choices[] = array( |
|
| 165 | + $state_choices[ ] = array( |
|
| 166 | 166 | 'text' => $key, |
| 167 | 167 | 'value' => $state_subchoices, |
| 168 | 168 | ); |
| 169 | 169 | |
| 170 | 170 | } else { |
| 171 | - $state_choices[] = array( |
|
| 171 | + $state_choices[ ] = array( |
|
| 172 | 172 | 'value' => is_numeric( $key ) ? $state : $key, |
| 173 | 173 | 'text' => $state, |
| 174 | 174 | ); |
@@ -192,13 +192,13 @@ discard block |
||
| 192 | 192 | // Use the same inputs as the "text" input type allows |
| 193 | 193 | $text_inputs = \GV\Utils::get( $input_types, 'text' ); |
| 194 | 194 | |
| 195 | - $input_types['street'] = $text_inputs; |
|
| 196 | - $input_types['street2'] = $text_inputs; |
|
| 197 | - $input_types['city'] = $text_inputs; |
|
| 195 | + $input_types[ 'street' ] = $text_inputs; |
|
| 196 | + $input_types[ 'street2' ] = $text_inputs; |
|
| 197 | + $input_types[ 'city' ] = $text_inputs; |
|
| 198 | 198 | |
| 199 | - $input_types['state'] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
| 200 | - $input_types['zip'] = array( 'input_text' ); |
|
| 201 | - $input_types['country'] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
| 199 | + $input_types[ 'state' ] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
| 200 | + $input_types[ 'zip' ] = array( 'input_text' ); |
|
| 201 | + $input_types[ 'country' ] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
| 202 | 202 | |
| 203 | 203 | return $input_types; |
| 204 | 204 | } |
@@ -219,10 +219,10 @@ discard block |
||
| 219 | 219 | // Is this search field for an input (eg: 4.2) or the whole address field (eg: 4)? |
| 220 | 220 | $input_id = gravityview_get_input_id_from_id( $field_id ); |
| 221 | 221 | |
| 222 | - if( 'address' === $field_type && $input_id ) { |
|
| 222 | + if ( 'address' === $field_type && $input_id ) { |
|
| 223 | 223 | |
| 224 | 224 | // If the input ID matches an expected address input, set to that. Otherwise, keep existing input type. |
| 225 | - if( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) { |
|
| 225 | + if ( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) { |
|
| 226 | 226 | $input_type = $address_field_name; |
| 227 | 227 | } |
| 228 | 228 | } |
@@ -271,20 +271,20 @@ discard block |
||
| 271 | 271 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
| 272 | 272 | |
| 273 | 273 | // If this is NOT the full address field, return default options. |
| 274 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
| 274 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
| 275 | 275 | return $field_options; |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | - if( 'edit' === $context ) { |
|
| 278 | + if ( 'edit' === $context ) { |
|
| 279 | 279 | return $field_options; |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | $add_options = array(); |
| 283 | 283 | |
| 284 | - $add_options['show_map_link'] = array( |
|
| 284 | + $add_options[ 'show_map_link' ] = array( |
|
| 285 | 285 | 'type' => 'checkbox', |
| 286 | 286 | 'label' => __( 'Show Map Link:', 'gravityview' ), |
| 287 | - 'desc' => __('Display a "Map It" link below the address', 'gravityview'), |
|
| 287 | + 'desc' => __( 'Display a "Map It" link below the address', 'gravityview' ), |
|
| 288 | 288 | 'value' => true, |
| 289 | 289 | 'merge_tags' => false, |
| 290 | 290 | ); |
@@ -28,9 +28,9 @@ |
||
| 28 | 28 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
| 29 | 29 | |
| 30 | 30 | // It makes no sense to use this as the link. |
| 31 | - unset( $field_options['show_as_link'] ); |
|
| 31 | + unset( $field_options[ 'show_as_link' ] ); |
|
| 32 | 32 | |
| 33 | - if( 'edit' === $context ) { |
|
| 33 | + if ( 'edit' === $context ) { |
|
| 34 | 34 | return $field_options; |
| 35 | 35 | } |
| 36 | 36 | |
@@ -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' ), |