@@ -88,15 +88,15 @@ |
||
88 | 88 | */ |
89 | 89 | public function maybe_modify_button_label( $label = '', $atts = array() ) { |
90 | 90 | |
91 | - if( $this->template_id !== \GV\Utils::get( $atts, 'template_id' ) ) { |
|
91 | + if ( $this->template_id !== \GV\Utils::get( $atts, 'template_id' ) ) { |
|
92 | 92 | return $label; |
93 | 93 | } |
94 | 94 | |
95 | - if( 'field' !== \GV\Utils::get( $atts, 'type' ) ) { |
|
95 | + if ( 'field' !== \GV\Utils::get( $atts, 'type' ) ) { |
|
96 | 96 | return $label; |
97 | 97 | } |
98 | 98 | |
99 | - if( 'edit' === \GV\Utils::get( $atts, 'zone' ) ) { |
|
99 | + if ( 'edit' === \GV\Utils::get( $atts, 'zone' ) ) { |
|
100 | 100 | return $label; |
101 | 101 | } |
102 | 102 |
@@ -33,14 +33,14 @@ discard block |
||
33 | 33 | $defaults = self::get_field_defaults(); |
34 | 34 | |
35 | 35 | // Backward compatibility |
36 | - if( !empty( $field['choices'] ) ) { |
|
37 | - $field['options'] = $field['choices']; |
|
38 | - unset( $field['choices'] ); |
|
36 | + if ( ! empty( $field[ 'choices' ] ) ) { |
|
37 | + $field[ 'options' ] = $field[ 'choices' ]; |
|
38 | + unset( $field[ 'choices' ] ); |
|
39 | 39 | } |
40 | 40 | |
41 | - $this->field = wp_parse_args( $field, $defaults ); |
|
41 | + $this->field = wp_parse_args( $field, $defaults ); |
|
42 | 42 | |
43 | - $this->value = is_null( $curr_value ) ? $this->field['value'] : $curr_value; |
|
43 | + $this->value = is_null( $curr_value ) ? $this->field[ 'value' ] : $curr_value; |
|
44 | 44 | |
45 | 45 | } |
46 | 46 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | |
81 | 81 | function get_tooltip() { |
82 | - if( ! function_exists('gform_tooltip') ) { |
|
82 | + if ( ! function_exists( 'gform_tooltip' ) ) { |
|
83 | 83 | return null; |
84 | 84 | } |
85 | 85 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | 'url' => '#', |
90 | 90 | ) ); |
91 | 91 | |
92 | - return !empty( $this->field['tooltip'] ) ? ' '. $this->tooltip( $this->field['tooltip'], false, true, $article ) : null; |
|
92 | + return ! empty( $this->field[ 'tooltip' ] ) ? ' ' . $this->tooltip( $this->field[ 'tooltip' ], false, true, $article ) : null; |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * Below this line has been modified by GravityView. |
133 | 133 | */ |
134 | 134 | |
135 | - if ( empty( $tooltip_text ) && empty( $article['id'] ) ) { |
|
135 | + if ( empty( $tooltip_text ) && empty( $article[ 'id' ] ) ) { |
|
136 | 136 | return ''; |
137 | 137 | } |
138 | 138 | |
@@ -168,8 +168,8 @@ discard block |
||
168 | 168 | * @return string |
169 | 169 | */ |
170 | 170 | function get_field_id() { |
171 | - if( isset( $this->field['id'] ) ) { |
|
172 | - return esc_attr( $this->field['id'] ); |
|
171 | + if ( isset( $this->field[ 'id' ] ) ) { |
|
172 | + return esc_attr( $this->field[ 'id' ] ); |
|
173 | 173 | } |
174 | 174 | return esc_attr( sanitize_html_class( $this->name ) ); |
175 | 175 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | * @return string |
180 | 180 | */ |
181 | 181 | function get_field_label() { |
182 | - return esc_html( trim( $this->field['label'] ) ); |
|
182 | + return esc_html( trim( $this->field[ 'label' ] ) ); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | /** |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * @return string |
191 | 191 | */ |
192 | 192 | function get_field_left_label() { |
193 | - return ! empty( $this->field['left_label'] ) ? esc_html( trim( $this->field['left_label'] ) ) : NULL; |
|
193 | + return ! empty( $this->field[ 'left_label' ] ) ? esc_html( trim( $this->field[ 'left_label' ] ) ) : NULL; |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | /** |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * @return string |
199 | 199 | */ |
200 | 200 | function get_label_class() { |
201 | - return 'gv-label-'. sanitize_html_class( $this->field['type'] ); |
|
201 | + return 'gv-label-' . sanitize_html_class( $this->field[ 'type' ] ); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * @return string |
208 | 208 | */ |
209 | 209 | function get_field_desc() { |
210 | - return !empty( $this->field['desc'] ) ? '<span class="howto">'. $this->field['desc'] .'</span>' : ''; |
|
210 | + return ! empty( $this->field[ 'desc' ] ) ? '<span class="howto">' . $this->field[ 'desc' ] . '</span>' : ''; |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | */ |
241 | 241 | function render_setting( $override_input = NULL ) { |
242 | 242 | |
243 | - if( !empty( $this->field['full_width'] ) ) { ?> |
|
243 | + if ( ! empty( $this->field[ 'full_width' ] ) ) { ?> |
|
244 | 244 | <th scope="row" colspan="2"> |
245 | 245 | <div> |
246 | 246 | <label for="<?php echo $this->get_field_id(); ?>"> |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * Try subkeys after split. |
92 | 92 | */ |
93 | 93 | if ( count( $parts = explode( '/', $key, 2 ) ) > 1 ) { |
94 | - return self::get( self::get( $array, $parts[0] ), $parts[1], $default ); |
|
94 | + return self::get( self::get( $array, $parts[ 0 ] ), $parts[ 1 ], $default ); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | return $default; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | public static function gf_query_debug( $query ) { |
146 | 146 | $introspect = $query->_introspect(); |
147 | 147 | return array( |
148 | - 'where' => $query->_where_unwrap( $introspect['where'] ) |
|
148 | + 'where' => $query->_where_unwrap( $introspect[ 'where' ] ) |
|
149 | 149 | ); |
150 | 150 | } |
151 | 151 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | if ( $condition->expressions ) { |
159 | 159 | $conditions = array(); |
160 | 160 | foreach ( $condition->expressions as $expression ) { |
161 | - $conditions[] = self::gf_query_strip_condition_column_aliases( $expression ); |
|
161 | + $conditions[ ] = self::gf_query_strip_condition_column_aliases( $expression ); |
|
162 | 162 | } |
163 | 163 | return call_user_func_array( |
164 | 164 | array( '\GF_Query_Condition', $condition->operator == 'AND' ? '_and' : '_or' ), |
@@ -47,11 +47,11 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
49 | 49 | |
50 | - if( 'edit' === $context ) { |
|
50 | + if ( 'edit' === $context ) { |
|
51 | 51 | return $field_options; |
52 | 52 | } |
53 | 53 | |
54 | - $this->add_field_support('date_display', $field_options ); |
|
54 | + $this->add_field_support( 'date_display', $field_options ); |
|
55 | 55 | |
56 | 56 | return $field_options; |
57 | 57 | } |
@@ -71,11 +71,11 @@ discard block |
||
71 | 71 | public function get_content( $output = '', $entry = array(), $field_settings = array(), $field = array() ) { |
72 | 72 | |
73 | 73 | /** Overridden by a template. */ |
74 | - if( \GV\Utils::get( $field, 'field_path' ) !== gravityview()->plugin->dir( 'templates/fields/field-html.php' ) ) { |
|
74 | + if ( \GV\Utils::get( $field, 'field_path' ) !== gravityview()->plugin->dir( 'templates/fields/field-html.php' ) ) { |
|
75 | 75 | return $output; |
76 | 76 | } |
77 | 77 | |
78 | - return GVCommon::format_date( $field['value'], 'format=' . \GV\Utils::get( $field_settings, 'date_display' ) ); |
|
78 | + return GVCommon::format_date( $field[ 'value' ], 'format=' . \GV\Utils::get( $field_settings, 'date_display' ) ); |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function set_provider( $provider = null ) { |
40 | 40 | |
41 | - if( gravityview()->request->is_admin() ) { |
|
41 | + if ( gravityview()->request->is_admin() ) { |
|
42 | 42 | return; |
43 | 43 | } |
44 | 44 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | // We're switching providers; remove the hooks that were added. |
60 | - if( self::$active_provider ) { |
|
60 | + if ( self::$active_provider ) { |
|
61 | 61 | self::$active_provider->remove_hooks(); |
62 | 62 | } |
63 | 63 |
@@ -21,13 +21,13 @@ |
||
21 | 21 | $plugin_hooks_files = glob( $include_path . 'class-gravityview-plugin-hooks-*.php' ); |
22 | 22 | |
23 | 23 | // Load all plugin files automatically |
24 | -foreach ( (array) $plugin_hooks_files as $plugin_hooks_file ) { |
|
24 | +foreach ( (array)$plugin_hooks_files as $plugin_hooks_file ) { |
|
25 | 25 | include $plugin_hooks_file; |
26 | 26 | } |
27 | 27 | |
28 | 28 | $theme_hooks_files = glob( $include_path . 'class-gravityview-theme-hooks-*.php' ); |
29 | 29 | |
30 | 30 | // Load all theme files automatically |
31 | -foreach ( (array) $theme_hooks_files as $theme_hooks_file ) { |
|
31 | +foreach ( (array)$theme_hooks_files as $theme_hooks_file ) { |
|
32 | 32 | include $theme_hooks_file; |
33 | 33 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | add_filter( 'icl_ls_languages', array( $this, 'wpml_ls_filter' ) ); |
66 | 66 | |
67 | - add_filter( 'gravityview_directory_link', array( $this, 'filter_gravityview_back_link') ); |
|
67 | + add_filter( 'gravityview_directory_link', array( $this, 'filter_gravityview_back_link' ) ); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | function filter_gravityview_back_link( $link ) { |
85 | 85 | global $wpml_url_filters; |
86 | 86 | |
87 | - if( $wpml_url_filters ) { |
|
87 | + if ( $wpml_url_filters ) { |
|
88 | 88 | $link = $wpml_url_filters->permalink_filter( $link, GravityView_frontend::getInstance()->getPostId() ); |
89 | 89 | } |
90 | 90 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | private function remove_url_hooks() { |
102 | 102 | global $wpml_url_filters; |
103 | 103 | |
104 | - if( ! $wpml_url_filters ) { |
|
104 | + if ( ! $wpml_url_filters ) { |
|
105 | 105 | return; |
106 | 106 | } |
107 | 107 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | private function add_url_hooks() { |
130 | 130 | global $wpml_url_filters; |
131 | 131 | |
132 | - if( ! $wpml_url_filters ) { |
|
132 | + if ( ! $wpml_url_filters ) { |
|
133 | 133 | return; |
134 | 134 | } |
135 | 135 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | break; |
227 | 227 | } |
228 | 228 | |
229 | - $languages[ $lang_code ]['url'] = $entry_link; |
|
229 | + $languages[ $lang_code ][ 'url' ] = $entry_link; |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | $this->add_url_hooks(); |
@@ -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,35 +103,35 @@ discard block |
||
103 | 103 | public function _maybe_filter_gravity_forms_query( $criteria, $form_ids, $view_id ) { |
104 | 104 | |
105 | 105 | // If the search is not being sorted, return early |
106 | - if( empty( $criteria['sorting']['key'] ) ) { |
|
106 | + if ( empty( $criteria[ 'sorting' ][ 'key' ] ) ) { |
|
107 | 107 | return $criteria; |
108 | 108 | } |
109 | 109 | |
110 | - $pieces = explode( $this->_sort_divider, $criteria['sorting']['key'] ); |
|
110 | + $pieces = explode( $this->_sort_divider, $criteria[ 'sorting' ][ 'key' ] ); |
|
111 | 111 | |
112 | 112 | /** |
113 | 113 | * If the sort key does not match the key set in modify_sort_id(), do not modify the Gravity Forms query SQL |
114 | 114 | * @see modify_sort_id() |
115 | 115 | */ |
116 | - if( empty( $pieces[1] ) ) { |
|
116 | + if ( empty( $pieces[ 1 ] ) ) { |
|
117 | 117 | return $criteria; |
118 | 118 | } |
119 | 119 | |
120 | 120 | // Pass these to the _modify_query_sort_by_time_hack() method |
121 | - $this->_time_format = $pieces[1]; |
|
122 | - $this->_date_format = $pieces[2]; |
|
121 | + $this->_time_format = $pieces[ 1 ]; |
|
122 | + $this->_date_format = $pieces[ 2 ]; |
|
123 | 123 | |
124 | 124 | // Remove fake input IDs (5.1 doesn't exist. Use 5) |
125 | - $criteria['sorting']['key'] = floor( $pieces[0] ); |
|
125 | + $criteria[ 'sorting' ][ 'key' ] = floor( $pieces[ 0 ] ); |
|
126 | 126 | |
127 | 127 | /** |
128 | 128 | * Make sure sorting is numeric (# of seconds). IMPORTANT. |
129 | 129 | * @see GVCommon::is_field_numeric() is_numeric should also be set here |
130 | 130 | */ |
131 | - $criteria['sorting']['is_numeric'] = true; |
|
131 | + $criteria[ 'sorting' ][ 'is_numeric' ] = true; |
|
132 | 132 | |
133 | 133 | // Modify the Gravity Forms WP Query |
134 | - add_filter('query', array( $this, '_modify_query_sort_by_time_hack' ) ); |
|
134 | + add_filter( 'query', array( $this, '_modify_query_sort_by_time_hack' ) ); |
|
135 | 135 | |
136 | 136 | return $criteria; |
137 | 137 | } |
@@ -152,9 +152,9 @@ discard block |
||
152 | 152 | * then we want to modify the query. |
153 | 153 | * @see GFFormsModel::sort_by_field_query() |
154 | 154 | */ |
155 | - if( strpos( $query, self::GF_SORTING_SQL ) > 0 ) { |
|
155 | + if ( strpos( $query, self::GF_SORTING_SQL ) > 0 ) { |
|
156 | 156 | |
157 | - if( $this->_time_format === '24' ) { |
|
157 | + if ( $this->_time_format === '24' ) { |
|
158 | 158 | $sql_str_to_date = "STR_TO_DATE( `value`, '%H:%i' )"; |
159 | 159 | } else { |
160 | 160 | $sql_str_to_date = "STR_TO_DATE( `value`, '%h:%i %p' )"; |
@@ -200,18 +200,18 @@ discard block |
||
200 | 200 | // Set variables |
201 | 201 | parent::field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ); |
202 | 202 | |
203 | - if( 'edit' === $context ) { |
|
203 | + if ( 'edit' === $context ) { |
|
204 | 204 | return $field_options; |
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
208 | 208 | * Set default date format based on field ID and Form ID |
209 | 209 | */ |
210 | - add_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
210 | + add_filter( 'gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
211 | 211 | |
212 | - $this->add_field_support('date_display', $field_options ); |
|
212 | + $this->add_field_support( 'date_display', $field_options ); |
|
213 | 213 | |
214 | - remove_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
214 | + remove_filter( 'gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
215 | 215 | |
216 | 216 | return $field_options; |
217 | 217 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | private function _get_time_format() { |
227 | 227 | global $post; |
228 | 228 | |
229 | - $current_form = isset( $_POST['form_id'] ) ? intval( $_POST['form_id'] ) : gravityview_get_form_id( $post->ID ); |
|
229 | + $current_form = isset( $_POST[ 'form_id' ] ) ? intval( $_POST[ 'form_id' ] ) : gravityview_get_form_id( $post->ID ); |
|
230 | 230 | |
231 | 231 | return self::_get_time_format_for_field( $this->_field_id, $current_form ); |
232 | 232 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | // GF defaults to 12, so should we. |
246 | 246 | $time_format = '12'; |
247 | 247 | |
248 | - if( $form_id ) { |
|
248 | + if ( $form_id ) { |
|
249 | 249 | $form = GFAPI::get_form( $form_id ); |
250 | 250 | |
251 | 251 | if ( $form ) { |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | $default = 'h:i A'; |
293 | 293 | |
294 | 294 | // This doesn't take into account 24-hour |
295 | - switch( $field_input_id ) { |
|
295 | + switch ( $field_input_id ) { |
|
296 | 296 | // Hours |
297 | 297 | case 1: |
298 | 298 | return ( $time_format === '12' ) ? 'h' : 'H'; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | function edit_entry_fix_hidden_fields( $fields ) { |
50 | 50 | |
51 | 51 | /** @type GF_Field $field */ |
52 | - foreach( $fields as &$field ) { |
|
52 | + foreach ( $fields as &$field ) { |
|
53 | 53 | |
54 | 54 | if ( 'hidden' === $field->type ) { |
55 | 55 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | $reveal_hidden_field = apply_filters( 'gravityview/edit_entry/reveal_hidden_field', false, $field ); |
64 | 64 | |
65 | - if( ! $reveal_hidden_field ) { |
|
65 | + if ( ! $reveal_hidden_field ) { |
|
66 | 66 | continue; |
67 | 67 | } |
68 | 68 |