@@ -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' ), |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | add_filter( 'gravityview/sorting/time', array( $this, 'modify_sort_id' ), 10, 2 ); |
| 64 | 64 | |
| 65 | - add_filter('gravityview_search_criteria', array( $this, '_maybe_filter_gravity_forms_query' ), 10, 4 ); |
|
| 65 | + add_filter( 'gravityview_search_criteria', array( $this, '_maybe_filter_gravity_forms_query' ), 10, 4 ); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /** |
@@ -103,31 +103,31 @@ discard block |
||
| 103 | 103 | public function _maybe_filter_gravity_forms_query( $criteria, $form_ids, $view_id ) { |
| 104 | 104 | |
| 105 | 105 | // If the search is being sorted |
| 106 | - if( ! empty( $criteria['sorting']['key'] ) ) { |
|
| 106 | + if ( ! empty( $criteria[ 'sorting' ][ 'key' ] ) ) { |
|
| 107 | 107 | |
| 108 | - $pieces = explode( $this->_sort_divider, $criteria['sorting']['key'] ); |
|
| 108 | + $pieces = explode( $this->_sort_divider, $criteria[ 'sorting' ][ 'key' ] ); |
|
| 109 | 109 | |
| 110 | 110 | /** |
| 111 | 111 | * And the sort key matches the key set in modify_sort_id(), then modify the Gravity Forms query SQL |
| 112 | 112 | * @see modify_sort_id() |
| 113 | 113 | */ |
| 114 | - if( ! empty( $pieces[1] ) ) { |
|
| 114 | + if ( ! empty( $pieces[ 1 ] ) ) { |
|
| 115 | 115 | |
| 116 | 116 | // Pass these to the _modify_query_sort_by_time_hack() method |
| 117 | - $this->_time_format = $pieces[1]; |
|
| 118 | - $this->_date_format = $pieces[2]; |
|
| 117 | + $this->_time_format = $pieces[ 1 ]; |
|
| 118 | + $this->_date_format = $pieces[ 2 ]; |
|
| 119 | 119 | |
| 120 | 120 | // Remove fake input IDs (5.1 doesn't exist. Use 5) |
| 121 | - $criteria['sorting']['key'] = floor( $pieces[0] ); |
|
| 121 | + $criteria[ 'sorting' ][ 'key' ] = floor( $pieces[ 0 ] ); |
|
| 122 | 122 | |
| 123 | 123 | /** |
| 124 | 124 | * Make sure sorting is numeric (# of seconds). IMPORTANT. |
| 125 | 125 | * @see GVCommon::is_field_numeric() is_numeric should also be set here |
| 126 | 126 | */ |
| 127 | - $criteria['sorting']['is_numeric'] = true; |
|
| 127 | + $criteria[ 'sorting' ][ 'is_numeric' ] = true; |
|
| 128 | 128 | |
| 129 | 129 | // Modify the Gravity Forms WP Query |
| 130 | - add_filter('query', array( $this, '_modify_query_sort_by_time_hack' ) ); |
|
| 130 | + add_filter( 'query', array( $this, '_modify_query_sort_by_time_hack' ) ); |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | |
@@ -150,9 +150,9 @@ discard block |
||
| 150 | 150 | * then we want to modify the query. |
| 151 | 151 | * @see GFFormsModel::sort_by_field_query() |
| 152 | 152 | */ |
| 153 | - if( strpos( $query, self::GF_SORTING_SQL ) > 0 ) { |
|
| 153 | + if ( strpos( $query, self::GF_SORTING_SQL ) > 0 ) { |
|
| 154 | 154 | |
| 155 | - if( $this->_time_format === '24' ) { |
|
| 155 | + if ( $this->_time_format === '24' ) { |
|
| 156 | 156 | $sql_str_to_date = "STR_TO_DATE( `value`, '%H:%i' )"; |
| 157 | 157 | } else { |
| 158 | 158 | $sql_str_to_date = "STR_TO_DATE( `value`, '%h:%i %p' )"; |
@@ -198,18 +198,18 @@ discard block |
||
| 198 | 198 | // Set variables |
| 199 | 199 | parent::field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ); |
| 200 | 200 | |
| 201 | - if( 'edit' === $context ) { |
|
| 201 | + if ( 'edit' === $context ) { |
|
| 202 | 202 | return $field_options; |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | /** |
| 206 | 206 | * Set default date format based on field ID and Form ID |
| 207 | 207 | */ |
| 208 | - add_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
| 208 | + add_filter( 'gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
| 209 | 209 | |
| 210 | - $this->add_field_support('date_display', $field_options ); |
|
| 210 | + $this->add_field_support( 'date_display', $field_options ); |
|
| 211 | 211 | |
| 212 | - remove_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
| 212 | + remove_filter( 'gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
| 213 | 213 | |
| 214 | 214 | return $field_options; |
| 215 | 215 | } |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | private function _get_time_format() { |
| 225 | 225 | global $post; |
| 226 | 226 | |
| 227 | - $current_form = isset( $_POST['form_id'] ) ? intval( $_POST['form_id'] ) : gravityview_get_form_id( $post->ID ); |
|
| 227 | + $current_form = isset( $_POST[ 'form_id' ] ) ? intval( $_POST[ 'form_id' ] ) : gravityview_get_form_id( $post->ID ); |
|
| 228 | 228 | |
| 229 | 229 | return self::_get_time_format_for_field( $this->_field_id, $current_form ); |
| 230 | 230 | } |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | // GF defaults to 12, so should we. |
| 244 | 244 | $time_format = '12'; |
| 245 | 245 | |
| 246 | - if( $form_id ) { |
|
| 246 | + if ( $form_id ) { |
|
| 247 | 247 | $form = GFAPI::get_form( $form_id ); |
| 248 | 248 | |
| 249 | 249 | if ( $form ) { |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | $default = 'h:i A'; |
| 291 | 291 | |
| 292 | 292 | // This doesn't take into account 24-hour |
| 293 | - switch( $field_input_id ) { |
|
| 293 | + switch ( $field_input_id ) { |
|
| 294 | 294 | // Hours |
| 295 | 295 | case 1: |
| 296 | 296 | return ( $time_format === '12' ) ? 'h' : 'H'; |
@@ -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' ), |