@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $meta_keys = apply_filters_ref_array( 'gravityview/view_collection/from_post/meta_keys', array( array(), $post, &$views ) ); |
100 | 100 | |
101 | 101 | if ( function_exists( 'apply_filters_deprecated' ) ) { |
102 | - $meta_keys = (array) apply_filters_deprecated( 'gravityview/data/parse/meta_keys', array( $meta_keys, $post->ID ), '2.0.7', 'gravityview/view_collection/from_post/meta_keys' ); |
|
102 | + $meta_keys = (array)apply_filters_deprecated( 'gravityview/data/parse/meta_keys', array( $meta_keys, $post->ID ), '2.0.7', 'gravityview/view_collection/from_post/meta_keys' ); |
|
103 | 103 | } else { |
104 | 104 | /** |
105 | 105 | * @filter `gravityview/data/parse/meta_keys` |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * @todo Require WP 4.6.0 so that `apply_filters_deprecated` is always available |
108 | 108 | * @see The `gravityview/view_collection/from_post/meta_keys` filter. |
109 | 109 | */ |
110 | - $meta_keys = (array) apply_filters( 'gravityview/data/parse/meta_keys', $meta_keys, $post->ID ); |
|
110 | + $meta_keys = (array)apply_filters( 'gravityview/data/parse/meta_keys', $meta_keys, $post->ID ); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** What about inside post meta values? */ |
@@ -137,12 +137,12 @@ discard block |
||
137 | 137 | |
138 | 138 | /** Let's find us some [gravityview] shortcodes perhaps. */ |
139 | 139 | foreach ( Shortcode::parse( $content ) as $shortcode ) { |
140 | - if ( $shortcode->name != 'gravityview' || empty( $shortcode->atts['id'] ) ) { |
|
140 | + if ( $shortcode->name != 'gravityview' || empty( $shortcode->atts[ 'id' ] ) ) { |
|
141 | 141 | continue; |
142 | 142 | } |
143 | 143 | |
144 | - if ( is_numeric( $shortcode->atts['id'] ) ) { |
|
145 | - $view = View::by_id( $shortcode->atts['id'] ); |
|
144 | + if ( is_numeric( $shortcode->atts[ 'id' ] ) ) { |
|
145 | + $view = View::by_id( $shortcode->atts[ 'id' ] ); |
|
146 | 146 | if ( ! $view ) { |
147 | 147 | continue; |
148 | 148 | } |
@@ -39,19 +39,19 @@ discard block |
||
39 | 39 | */ |
40 | 40 | function merge_content_meta_keys( $meta_keys = array(), $post = null, & $views = null ) { |
41 | 41 | |
42 | - if( empty( $post->panels_data ) || empty( $post->panels_data['widgets'] ) ) { |
|
42 | + if ( empty( $post->panels_data ) || empty( $post->panels_data[ 'widgets' ] ) ) { |
|
43 | 43 | return $meta_keys; |
44 | 44 | } |
45 | 45 | |
46 | - foreach ( (array) $post->panels_data['widgets'] as $widget ) { |
|
46 | + foreach ( (array)$post->panels_data[ 'widgets' ] as $widget ) { |
|
47 | 47 | |
48 | 48 | $views->merge( \GV\View_Collection::from_content( \GV\Utils::get( $widget, 'text' ) ) ); |
49 | 49 | |
50 | - if ( empty( $widget['tabs'] ) || ! is_array( $widget['tabs'] ) ) { |
|
50 | + if ( empty( $widget[ 'tabs' ] ) || ! is_array( $widget[ 'tabs' ] ) ) { |
|
51 | 51 | continue; |
52 | 52 | } |
53 | 53 | |
54 | - foreach ( $widget['tabs'] as $tab ) { |
|
54 | + foreach ( $widget[ 'tabs' ] as $tab ) { |
|
55 | 55 | |
56 | 56 | // Livemesh Tabs |
57 | 57 | $backup = \GV\Utils::get( $tab, 'tab_content' ); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | // SiteOrigin Tabs |
60 | 60 | $content = \GV\Utils::get( $tab, 'content_text', $backup ); |
61 | 61 | |
62 | - if( $content ) { |
|
62 | + if ( $content ) { |
|
63 | 63 | $views->merge( \GV\View_Collection::from_content( $content ) ); |
64 | 64 | } |
65 | 65 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | $acf_keys = get_field_objects( $post->ID, array( 'load_value' => false ) ); |
57 | 57 | |
58 | - if( $acf_keys ) { |
|
58 | + if ( $acf_keys ) { |
|
59 | 59 | return array_merge( array_keys( $acf_keys ), $meta_keys ); |
60 | 60 | } |
61 | 61 | |
@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | * @return void |
71 | 71 | */ |
72 | 72 | private function fix_posted_fields() { |
73 | - if( is_admin() && isset( $_POST['action'] ) && isset( $_POST['post_type'] ) ) { |
|
74 | - if( 'editpost' === $_POST['action'] && 'gravityview' === $_POST['post_type'] ) { |
|
75 | - $_POST['fields'] = _gravityview_process_posted_fields(); |
|
73 | + if ( is_admin() && isset( $_POST[ 'action' ] ) && isset( $_POST[ 'post_type' ] ) ) { |
|
74 | + if ( 'editpost' === $_POST[ 'action' ] && 'gravityview' === $_POST[ 'post_type' ] ) { |
|
75 | + $_POST[ 'fields' ] = _gravityview_process_posted_fields(); |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | } |
@@ -24,9 +24,8 @@ |
||
24 | 24 | /** |
25 | 25 | * Get a \GV\Field by Field ID for this data source. |
26 | 26 | * |
27 | - * @param int $field_id The internal field ID (custom content, etc.) |
|
28 | 27 | * |
29 | - * @return \GV\Field|null The requested field or null if not found. |
|
28 | + * @return null|Internal_Field The requested field or null if not found. |
|
30 | 29 | */ |
31 | 30 | public static function get_field( /** varargs */ ) { |
32 | 31 | $args = func_get_args(); |
@@ -44,16 +44,16 @@ discard block |
||
44 | 44 | */ |
45 | 45 | $atts = apply_filters( 'gravityview/shortcodes/gventry/atts', $atts ); |
46 | 46 | |
47 | - $view = \GV\View::by_id( $atts['view_id'] ); |
|
47 | + $view = \GV\View::by_id( $atts[ 'view_id' ] ); |
|
48 | 48 | |
49 | 49 | if ( ! $view ) { |
50 | - gravityview()->log->error( 'View does not exist #{view_id}', array( 'view_id' => $atts['view_id'] ) ); |
|
50 | + gravityview()->log->error( 'View does not exist #{view_id}', array( 'view_id' => $atts[ 'view_id' ] ) ); |
|
51 | 51 | return apply_filters( 'gravityview/shortcodes/gventry/output', '', null, null, $atts ); |
52 | 52 | } |
53 | 53 | |
54 | - $entry_id = ! empty( $atts['entry_id'] ) ? $atts['entry_id'] : $atts['id']; |
|
54 | + $entry_id = ! empty( $atts[ 'entry_id' ] ) ? $atts[ 'entry_id' ] : $atts[ 'id' ]; |
|
55 | 55 | |
56 | - switch( $entry_id ): |
|
56 | + switch ( $entry_id ): |
|
57 | 57 | case 'last': |
58 | 58 | if ( class_exists( '\GF_Query' ) ) { |
59 | 59 | /** |
@@ -62,17 +62,17 @@ discard block |
||
62 | 62 | * Since we're using \GF_Query shorthand initialization we have to reverse the order parameters here. |
63 | 63 | */ |
64 | 64 | add_filter( 'gravityview_get_entries', $filter = function( $parameters, $args, $form_id ) { |
65 | - if ( ! empty( $parameters['sorting'] ) ) { |
|
65 | + if ( ! empty( $parameters[ 'sorting' ] ) ) { |
|
66 | 66 | /** |
67 | 67 | * Reverse existing sorts. |
68 | 68 | */ |
69 | - $sort = &$parameters['sorting']; |
|
70 | - $sort['direction'] = $sort['direction'] == 'RAND' ? : ( $sort['direction'] == 'ASC' ? 'DESC' : 'ASC' ); |
|
69 | + $sort = &$parameters[ 'sorting' ]; |
|
70 | + $sort[ 'direction' ] = $sort[ 'direction' ] == 'RAND' ?: ( $sort[ 'direction' ] == 'ASC' ? 'DESC' : 'ASC' ); |
|
71 | 71 | } else { |
72 | 72 | /** |
73 | 73 | * Otherwise, sort by date_created. |
74 | 74 | */ |
75 | - $parameters['sorting'] = array( |
|
75 | + $parameters[ 'sorting' ] = array( |
|
76 | 76 | 'key' => 'id', |
77 | 77 | 'direction' => 'ASC', |
78 | 78 | 'is_numeric' => true |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | /** If a sort already exists, reverse it. */ |
89 | 89 | if ( $sort = end( $entries->sorts ) ) { |
90 | - $entries = $entries->sort( new \GV\Entry_Sort( $sort->field, $sort->direction == \GV\Entry_Sort::RAND ? : ( $sort->direction == \GV\Entry_Sort::ASC ? \GV\Entry_Sort::DESC : \GV\Entry_Sort::ASC ) ), $sort->mode ); |
|
90 | + $entries = $entries->sort( new \GV\Entry_Sort( $sort->field, $sort->direction == \GV\Entry_Sort::RAND ?: ( $sort->direction == \GV\Entry_Sort::ASC ? \GV\Entry_Sort::DESC : \GV\Entry_Sort::ASC ) ), $sort->mode ); |
|
91 | 91 | } else { |
92 | 92 | /** Otherwise, sort by date_created */ |
93 | 93 | $entries = $entries->sort( new \GV\Entry_Sort( \GV\Internal_Field::by_id( 'id' ), \GV\Entry_Sort::ASC ), \GV\Entry_Sort::NUMERIC ); |
@@ -105,12 +105,12 @@ discard block |
||
105 | 105 | break; |
106 | 106 | default: |
107 | 107 | if ( ! $entry = \GV\GF_Entry::by_id( $entry_id ) ) { |
108 | - gravityview()->log->error( 'Entry #{entry_id} not found', array( 'view_id' => $atts['view_id'] ) ); |
|
108 | + gravityview()->log->error( 'Entry #{entry_id} not found', array( 'view_id' => $atts[ 'view_id' ] ) ); |
|
109 | 109 | return apply_filters( 'gravityview/shortcodes/gventry/output', '', $view, null, $atts ); |
110 | 110 | } |
111 | 111 | endswitch; |
112 | 112 | |
113 | - if ( $view->form->ID != $entry['form_id'] ) { |
|
113 | + if ( $view->form->ID != $entry[ 'form_id' ] ) { |
|
114 | 114 | gravityview()->log->error( 'Entry does not belong to view (form mismatch)' ); |
115 | 115 | return apply_filters( 'gravityview/shortcodes/gventry/output', '', $view, $entry, $atts ); |
116 | 116 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | return apply_filters( 'gravityview/shortcodes/gventry/output', get_the_password_form( $view->ID ), $view, $entry, $atts ); |
121 | 121 | } |
122 | 122 | |
123 | - if ( ! $view->form ) { |
|
123 | + if ( ! $view->form ) { |
|
124 | 124 | gravityview()->log->notice( 'View #{id} has no form attached to it.', array( 'id' => $view->ID ) ); |
125 | 125 | |
126 | 126 | /** |
@@ -143,15 +143,15 @@ discard block |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | /** Unapproved entries. */ |
146 | - if ( $entry['status'] != 'active' ) { |
|
146 | + if ( $entry[ 'status' ] != 'active' ) { |
|
147 | 147 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
148 | 148 | return apply_filters( 'gravityview/shortcodes/gventry/output', '', $view, $entry, $atts ); |
149 | 149 | } |
150 | 150 | |
151 | - $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID ); |
|
151 | + $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID ); |
|
152 | 152 | |
153 | 153 | if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
154 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
154 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
155 | 155 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
156 | 156 | return apply_filters( 'gravityview/shortcodes/gventry/output', '', $view, $entry, $atts ); |
157 | 157 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $renderer = new \GV\Entry_Renderer(); |
164 | 164 | |
165 | 165 | $request = new \GV\Mock_Request(); |
166 | - $request->returns['is_entry'] = $entry; |
|
166 | + $request->returns[ 'is_entry' ] = $entry; |
|
167 | 167 | |
168 | 168 | $output = $renderer->render( $entry, $view, $request ); |
169 | 169 |
@@ -29,12 +29,12 @@ |
||
29 | 29 | */ |
30 | 30 | public static function from_configuration( $configuration ) { |
31 | 31 | |
32 | - if ( empty( $configuration['id'] ) || ! is_string( $configuration['id'] ) ) { |
|
32 | + if ( empty( $configuration[ 'id' ] ) || ! is_string( $configuration[ 'id' ] ) ) { |
|
33 | 33 | gravityview()->log->error( 'Invalid configuration[id] supplied.' ); |
34 | 34 | return null; |
35 | 35 | } |
36 | 36 | |
37 | - $field = self::by_id( $configuration['id'] ); |
|
37 | + $field = self::by_id( $configuration[ 'id' ] ); |
|
38 | 38 | |
39 | 39 | $field->update_configuration( $configuration ); |
40 | 40 |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | * @return \GV\Field The field implementation from configuration (\GV\GF_Field, \GV\Internal_Field). |
167 | 167 | */ |
168 | 168 | public static function from_configuration( $configuration ) { |
169 | - if ( empty( $configuration['id'] ) ) { |
|
169 | + if ( empty( $configuration[ 'id' ] ) ) { |
|
170 | 170 | $field = new self(); |
171 | 171 | gravityview()->log->error( 'Trying to get field from configuration without a field ID.', array( 'data' => $configuration ) ); |
172 | 172 | $field->update_configuration( $configuration ); |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | } else { |
180 | 180 | $trace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ); |
181 | 181 | } |
182 | - $trace = $trace[1]; |
|
183 | - if ( $trace['function'] == 'from_configuration' && $trace['class'] == __CLASS__ ) { |
|
182 | + $trace = $trace[ 1 ]; |
|
183 | + if ( $trace[ 'function' ] == 'from_configuration' && $trace[ 'class' ] == __CLASS__ ) { |
|
184 | 184 | $field = new self(); |
185 | 185 | gravityview()->log->error( 'Infinite loop protection tripped. Returning default class here.' ); |
186 | 186 | $field->update_configuration( $configuration ); |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | } |
189 | 189 | |
190 | 190 | /** Determine the field implementation to use, and try to use. */ |
191 | - $field_class = is_numeric( $configuration['id'] ) ? '\GV\GF_Field' : '\GV\Internal_Field'; |
|
191 | + $field_class = is_numeric( $configuration[ 'id' ] ) ? '\GV\GF_Field' : '\GV\Internal_Field'; |
|
192 | 192 | |
193 | 193 | /** |
194 | 194 | * @filter `gravityview/field/class` Filter the field class about to be created from the configuration. |
@@ -227,24 +227,24 @@ discard block |
||
227 | 227 | public function update_configuration( $configuration ) { |
228 | 228 | $configuration = wp_parse_args( $configuration, $this->as_configuration() ); |
229 | 229 | |
230 | - if ( $this->ID != $configuration['id'] ) { |
|
230 | + if ( $this->ID != $configuration[ 'id' ] ) { |
|
231 | 231 | /** Smelling trouble here... */ |
232 | 232 | gravityview()->log->warning( 'ID is being changed for {field_class} instance, but implementation is not. Use ::from_configuration instead', array( 'field_class', __CLASS__ ) ); |
233 | 233 | } |
234 | 234 | |
235 | - $this->ID = $configuration['id']; |
|
236 | - $this->label = $configuration['label']; |
|
237 | - $this->show_label = $configuration['show_label'] == '1'; |
|
238 | - $this->custom_label = $configuration['custom_label']; |
|
239 | - $this->custom_class = $configuration['custom_class']; |
|
240 | - $this->cap = $configuration['only_loggedin'] == '1' ? $configuration['only_loggedin_cap'] : ''; |
|
241 | - $this->search_filter = $configuration['search_filter'] == '1'; |
|
242 | - $this->show_as_link = $configuration['show_as_link'] == '1'; |
|
235 | + $this->ID = $configuration[ 'id' ]; |
|
236 | + $this->label = $configuration[ 'label' ]; |
|
237 | + $this->show_label = $configuration[ 'show_label' ] == '1'; |
|
238 | + $this->custom_label = $configuration[ 'custom_label' ]; |
|
239 | + $this->custom_class = $configuration[ 'custom_class' ]; |
|
240 | + $this->cap = $configuration[ 'only_loggedin' ] == '1' ? $configuration[ 'only_loggedin_cap' ] : ''; |
|
241 | + $this->search_filter = $configuration[ 'search_filter' ] == '1'; |
|
242 | + $this->show_as_link = $configuration[ 'show_as_link' ] == '1'; |
|
243 | 243 | |
244 | 244 | /** Shared among all field types (sort of). */ |
245 | 245 | $shared_configuration_keys = array( |
246 | 246 | 'id', 'label', 'show_label', 'custom_label', 'custom_class', |
247 | - 'only_loggedin' ,'only_loggedin_cap', 'search_filter', 'show_as_link', |
|
247 | + 'only_loggedin', 'only_loggedin_cap', 'search_filter', 'show_as_link', |
|
248 | 248 | ); |
249 | 249 | |
250 | 250 | /** Everything else goes into the properties for now. @todo subclasses! */ |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | |
274 | 274 | /** A custom label is available. */ |
275 | 275 | if ( ! empty( $this->custom_label ) ) { |
276 | - return \GravityView_API::replace_variables( $this->custom_label, $source ? $source->form ? : null : null, $entry ? $entry->as_entry() : null ); |
|
276 | + return \GravityView_API::replace_variables( $this->custom_label, $source ? $source->form ?: null : null, $entry ? $entry->as_entry() : null ); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | return ''; |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | * @return mixed|null The value for the given configuration key, null if doesn't exist. |
351 | 351 | */ |
352 | 352 | public function __get( $key ) { |
353 | - switch( $key ): |
|
353 | + switch ( $key ): |
|
354 | 354 | default: |
355 | 355 | if ( isset( $this->configuration[ $key ] ) ) { |
356 | 356 | return $this->configuration[ $key ]; |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | * @return boolean Whether this $key is set or not. |
367 | 367 | */ |
368 | 368 | public function __isset( $key ) { |
369 | - switch( $key ): |
|
369 | + switch ( $key ): |
|
370 | 370 | default: |
371 | 371 | return isset( $this->configuration[ $key ] ); |
372 | 372 | endswitch; |
@@ -53,7 +53,6 @@ discard block |
||
53 | 53 | * Columns are able to be added to View layouts, but not separately searched! |
54 | 54 | * |
55 | 55 | * @param array $fields |
56 | - * @param int $form_id |
|
57 | 56 | * |
58 | 57 | * @return array |
59 | 58 | */ |
@@ -133,7 +132,7 @@ discard block |
||
133 | 132 | * |
134 | 133 | * @param GF_Field_List $field Gravity Forms field |
135 | 134 | * @param string|array $field_value Serialized or unserialized array value for the field |
136 | - * @param int|string $column_id The numeric key of the column (0-index) or the label of the column |
|
135 | + * @param integer $column_id The numeric key of the column (0-index) or the label of the column |
|
137 | 136 | * @param string $format If set to 'raw', return an array of values for the column. Otherwise, allow Gravity Forms to render using `html` or `text` |
138 | 137 | * |
139 | 138 | * @return array|string|null Returns null if the $field_value passed wasn't an array or serialized array |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | public function remove_columns_from_searchable_fields( $fields ) { |
61 | 61 | |
62 | 62 | foreach ( $fields as $key => $field ) { |
63 | - if ( isset( $field['parent'] ) && $field['parent'] instanceof \GF_Field_List ) { |
|
63 | + if ( isset( $field[ 'parent' ] ) && $field[ 'parent' ] instanceof \GF_Field_List ) { |
|
64 | 64 | unset( $fields[ $key ] ); |
65 | 65 | } |
66 | 66 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | // Add the list columns |
87 | 87 | foreach ( $list_fields as $list_field ) { |
88 | 88 | |
89 | - if( empty( $list_field->enableColumns ) ) { |
|
89 | + if ( empty( $list_field->enableColumns ) ) { |
|
90 | 90 | continue; |
91 | 91 | } |
92 | 92 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | } |
108 | 108 | |
109 | 109 | // If there are columns, add them under the parent field |
110 | - if( ! empty( $list_columns ) ) { |
|
110 | + if ( ! empty( $list_columns ) ) { |
|
111 | 111 | |
112 | 112 | $index = array_search( $list_field->id, array_keys( $fields ) ) + 1; |
113 | 113 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | * Merge the $list_columns into the $fields array at $index |
116 | 116 | * @see https://stackoverflow.com/a/1783125 |
117 | 117 | */ |
118 | - $fields = array_slice( $fields, 0, $index, true) + $list_columns + array_slice( $fields, $index, null, true); |
|
118 | + $fields = array_slice( $fields, 0, $index, true ) + $list_columns + array_slice( $fields, $index, null, true ); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | unset( $list_columns, $index, $input_id ); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | |
143 | 143 | $list_rows = maybe_unserialize( $field_value ); |
144 | 144 | |
145 | - if( ! is_array( $list_rows ) ) { |
|
145 | + if ( ! is_array( $list_rows ) ) { |
|
146 | 146 | gravityview()->log->error( '$field_value did not unserialize', array( 'data' => $field_value ) ); |
147 | 147 | return null; |
148 | 148 | } |
@@ -152,18 +152,18 @@ discard block |
||
152 | 152 | // Each list row |
153 | 153 | foreach ( $list_rows as $list_row ) { |
154 | 154 | $current_column = 0; |
155 | - foreach ( (array) $list_row as $column_key => $column_value ) { |
|
155 | + foreach ( (array)$list_row as $column_key => $column_value ) { |
|
156 | 156 | |
157 | 157 | // If the label of the column matches $column_id, or the numeric key value matches, add the value |
158 | - if( (string)$column_key === (string)$column_id || ( is_numeric( $column_id ) && (int)$column_id === $current_column ) ) { |
|
159 | - $column_values[] = $column_value; |
|
158 | + if ( (string)$column_key === (string)$column_id || ( is_numeric( $column_id ) && (int)$column_id === $current_column ) ) { |
|
159 | + $column_values[ ] = $column_value; |
|
160 | 160 | } |
161 | 161 | $current_column++; |
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
165 | 165 | // Return the array of values |
166 | - if( 'raw' === $format ) { |
|
166 | + if ( 'raw' === $format ) { |
|
167 | 167 | return $column_values; |
168 | 168 | } |
169 | 169 | // Return the Gravity Forms Field output |
@@ -186,22 +186,22 @@ discard block |
||
186 | 186 | */ |
187 | 187 | public function _filter_field_label( $label, $field, $form, $entry ) { |
188 | 188 | |
189 | - $field_object = RGFormsModel::get_field( $form, $field['id'] ); |
|
189 | + $field_object = RGFormsModel::get_field( $form, $field[ 'id' ] ); |
|
190 | 190 | |
191 | 191 | // Not a list field |
192 | - if( ! $field_object || 'list' !== $field_object->type ) { |
|
192 | + if ( ! $field_object || 'list' !== $field_object->type ) { |
|
193 | 193 | return $label; |
194 | 194 | } |
195 | 195 | |
196 | 196 | // Custom label is defined, so use it |
197 | - if( ! empty( $field['custom_label'] ) ) { |
|
197 | + if ( ! empty( $field[ 'custom_label' ] ) ) { |
|
198 | 198 | return $label; |
199 | 199 | } |
200 | 200 | |
201 | - $column_id = gravityview_get_input_id_from_id( $field['id'] ); |
|
201 | + $column_id = gravityview_get_input_id_from_id( $field[ 'id' ] ); |
|
202 | 202 | |
203 | 203 | // Parent field, not column field |
204 | - if( false === $column_id ) { |
|
204 | + if ( false === $column_id ) { |
|
205 | 205 | return $label; |
206 | 206 | } |
207 | 207 | |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | public static function get_column_label( GF_Field_List $field, $column_id, $backup_label = '' ) { |
223 | 223 | |
224 | 224 | // Doesn't have columns enabled |
225 | - if( ! isset( $field->choices ) || ! $field->enableColumns ) { |
|
225 | + if ( ! isset( $field->choices ) || ! $field->enableColumns ) { |
|
226 | 226 | return $backup_label; |
227 | 227 | } |
228 | 228 |
@@ -603,7 +603,8 @@ discard block |
||
603 | 603 | // Fast-forward 24 hour on the end time |
604 | 604 | $curr_end = date( 'Y-m-d H:i:s', strtotime( $curr_end ) + DAY_IN_SECONDS ); |
605 | 605 | $search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
606 | - if ( strpos( $search_criteria['end_date'], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056 |
|
606 | + if ( strpos( $search_criteria['end_date'], '00:00:00' ) ) { |
|
607 | +// See https://github.com/gravityview/GravityView/issues/1056 |
|
607 | 608 | $search_criteria['end_date'] = date( 'Y-m-d H:i:s', strtotime( $search_criteria['end_date'] ) - 1 ); |
608 | 609 | } |
609 | 610 | } |
@@ -874,7 +875,7 @@ discard block |
||
874 | 875 | 'ymd_dot' => 'Y.m.d', |
875 | 876 | ); |
876 | 877 | |
877 | - if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){ |
|
878 | + if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) { |
|
878 | 879 | $format = $datepicker[ $field->dateFormat ]; |
879 | 880 | } |
880 | 881 |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | /** |
244 | 244 | * Add admin script to the no-conflict scripts whitelist |
245 | 245 | * @param array $allowed Scripts allowed in no-conflict mode |
246 | - * @return array Scripts allowed in no-conflict mode, plus the search widget script |
|
246 | + * @return string[] Scripts allowed in no-conflict mode, plus the search widget script |
|
247 | 247 | */ |
248 | 248 | public function register_no_conflict( $allowed ) { |
249 | 249 | $allowed[] = 'gravityview_searchwidget_admin'; |
@@ -709,7 +709,6 @@ discard block |
||
709 | 709 | * Dropin for the legacy flat filters when \GF_Query is available. |
710 | 710 | * |
711 | 711 | * @param \GF_Query $query The current query object reference |
712 | - * @param \GV\View $this The current view object |
|
713 | 712 | * @param \GV\Request $request The request object |
714 | 713 | */ |
715 | 714 | public function gf_query_filter( &$query, $view, $request ) { |
@@ -1199,7 +1198,7 @@ discard block |
||
1199 | 1198 | /** |
1200 | 1199 | * Get the label for a search form field |
1201 | 1200 | * @param array $field Field setting as sent by the GV configuration - has `field`, `input` (input type), and `label` keys |
1202 | - * @param array $form_field Form field data, as fetched by `gravityview_get_field()` |
|
1201 | + * @param GF_Field|null $form_field Form field data, as fetched by `gravityview_get_field()` |
|
1203 | 1202 | * @return string Label for the search form |
1204 | 1203 | */ |
1205 | 1204 | private static function get_field_label( $field, $form_field = array() ) { |
@@ -1364,7 +1363,7 @@ discard block |
||
1364 | 1363 | /** |
1365 | 1364 | * Require the datepicker script for the frontend GV script |
1366 | 1365 | * @param array $js_dependencies Array of existing required scripts for the fe-views.js script |
1367 | - * @return array Array required scripts, with `jquery-ui-datepicker` added |
|
1366 | + * @return string[] Array required scripts, with `jquery-ui-datepicker` added |
|
1368 | 1367 | */ |
1369 | 1368 | public function add_datepicker_js_dependency( $js_dependencies ) { |
1370 | 1369 | |
@@ -1376,7 +1375,7 @@ discard block |
||
1376 | 1375 | /** |
1377 | 1376 | * Modify the array passed to wp_localize_script() |
1378 | 1377 | * |
1379 | - * @param array $js_localization The data padded to the Javascript file |
|
1378 | + * @param array $localizations The data padded to the Javascript file |
|
1380 | 1379 | * @param array $view_data View data array with View settings |
1381 | 1380 | * |
1382 | 1381 | * @return array |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | 'type' => 'radio', |
65 | 65 | 'full_width' => true, |
66 | 66 | 'label' => esc_html__( 'Search Mode', 'gravityview' ), |
67 | - 'desc' => __('Should search results match all search fields, or any?', 'gravityview'), |
|
67 | + 'desc' => __( 'Should search results match all search fields, or any?', 'gravityview' ), |
|
68 | 68 | 'value' => 'any', |
69 | 69 | 'class' => 'hide-if-js', |
70 | 70 | 'options' => array( |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | // admin - add scripts - run at 1100 to make sure GravityView_Admin_Views::add_scripts_and_styles() runs first at 999 |
88 | 88 | add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 1100 ); |
89 | - add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') ); |
|
89 | + add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) ); |
|
90 | 90 | add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
91 | 91 | |
92 | 92 | // ajax - get the searchable fields |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | $script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
225 | 225 | $script_source = empty( $script_min ) ? '/source' : ''; |
226 | 226 | |
227 | - wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js'.$script_source.'/admin-search-widget'.$script_min.'.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), \GV\Plugin::$version ); |
|
227 | + wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js' . $script_source . '/admin-search-widget' . $script_min . '.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), \GV\Plugin::$version ); |
|
228 | 228 | |
229 | 229 | wp_localize_script( 'gravityview_searchwidget_admin', 'gvSearchVar', array( |
230 | 230 | 'nonce' => wp_create_nonce( 'gravityview_ajaxsearchwidget' ), |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | * @return array Scripts allowed in no-conflict mode, plus the search widget script |
247 | 247 | */ |
248 | 248 | public function register_no_conflict( $allowed ) { |
249 | - $allowed[] = 'gravityview_searchwidget_admin'; |
|
249 | + $allowed[ ] = 'gravityview_searchwidget_admin'; |
|
250 | 250 | return $allowed; |
251 | 251 | } |
252 | 252 | |
@@ -259,24 +259,24 @@ discard block |
||
259 | 259 | */ |
260 | 260 | public static function get_searchable_fields() { |
261 | 261 | |
262 | - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) { |
|
262 | + if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) { |
|
263 | 263 | exit( '0' ); |
264 | 264 | } |
265 | 265 | |
266 | 266 | $form = ''; |
267 | 267 | |
268 | 268 | // Fetch the form for the current View |
269 | - if ( ! empty( $_POST['view_id'] ) ) { |
|
269 | + if ( ! empty( $_POST[ 'view_id' ] ) ) { |
|
270 | 270 | |
271 | - $form = gravityview_get_form_id( $_POST['view_id'] ); |
|
271 | + $form = gravityview_get_form_id( $_POST[ 'view_id' ] ); |
|
272 | 272 | |
273 | - } elseif ( ! empty( $_POST['formid'] ) ) { |
|
273 | + } elseif ( ! empty( $_POST[ 'formid' ] ) ) { |
|
274 | 274 | |
275 | - $form = (int) $_POST['formid']; |
|
275 | + $form = (int)$_POST[ 'formid' ]; |
|
276 | 276 | |
277 | - } elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
277 | + } elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
278 | 278 | |
279 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
279 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
280 | 280 | |
281 | 281 | } |
282 | 282 | |
@@ -325,8 +325,8 @@ discard block |
||
325 | 325 | ), |
326 | 326 | ); |
327 | 327 | |
328 | - foreach( $custom_fields as $custom_field_key => $custom_field ) { |
|
329 | - $output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field['type'], self::get_field_label( array('field' => $custom_field_key ) ), $custom_field['text'] ); |
|
328 | + foreach ( $custom_fields as $custom_field_key => $custom_field ) { |
|
329 | + $output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field[ 'type' ], self::get_field_label( array( 'field' => $custom_field_key ) ), $custom_field[ 'text' ] ); |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | // Get fields with sub-inputs and no parent |
@@ -348,13 +348,13 @@ discard block |
||
348 | 348 | |
349 | 349 | foreach ( $fields as $id => $field ) { |
350 | 350 | |
351 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
351 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
352 | 352 | continue; |
353 | 353 | } |
354 | 354 | |
355 | - $types = self::get_search_input_types( $id, $field['type'] ); |
|
355 | + $types = self::get_search_input_types( $id, $field[ 'type' ] ); |
|
356 | 356 | |
357 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>'; |
|
357 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>'; |
|
358 | 358 | } |
359 | 359 | } |
360 | 360 | |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | public static function get_search_input_types( $field_id = '', $field_type = null ) { |
378 | 378 | |
379 | 379 | // @todo - This needs to be improved - many fields have . including products and addresses |
380 | - if ( false !== strpos( (string) $field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) { |
|
380 | + if ( false !== strpos( (string)$field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) { |
|
381 | 381 | $input_type = 'boolean'; // on/off checkbox |
382 | 382 | } elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) { |
383 | 383 | $input_type = 'multi'; //multiselect |
@@ -421,19 +421,19 @@ discard block |
||
421 | 421 | $post_id = 0; |
422 | 422 | |
423 | 423 | // We're in the WordPress Widget context, and an overriding post ID has been set. |
424 | - if ( ! empty( $widget_args['post_id'] ) ) { |
|
425 | - $post_id = absint( $widget_args['post_id'] ); |
|
424 | + if ( ! empty( $widget_args[ 'post_id' ] ) ) { |
|
425 | + $post_id = absint( $widget_args[ 'post_id' ] ); |
|
426 | 426 | } |
427 | 427 | // We're in the WordPress Widget context, and the base View ID should be used |
428 | - else if ( ! empty( $widget_args['view_id'] ) ) { |
|
429 | - $post_id = absint( $widget_args['view_id'] ); |
|
428 | + else if ( ! empty( $widget_args[ 'view_id' ] ) ) { |
|
429 | + $post_id = absint( $widget_args[ 'view_id' ] ); |
|
430 | 430 | } |
431 | 431 | |
432 | 432 | $args = gravityview_get_permalink_query_args( $post_id ); |
433 | 433 | |
434 | 434 | // Add hidden fields to the search form |
435 | 435 | foreach ( $args as $key => $value ) { |
436 | - $search_fields[] = array( |
|
436 | + $search_fields[ ] = array( |
|
437 | 437 | 'name' => $key, |
438 | 438 | 'input' => 'hidden', |
439 | 439 | 'value' => $value, |
@@ -472,22 +472,22 @@ discard block |
||
472 | 472 | /** |
473 | 473 | * Include the sidebar Widgets. |
474 | 474 | */ |
475 | - $widgets = (array) get_option( 'widget_gravityview_search', array() ); |
|
475 | + $widgets = (array)get_option( 'widget_gravityview_search', array() ); |
|
476 | 476 | |
477 | 477 | foreach ( $widgets as $widget ) { |
478 | - if ( ! empty( $widget['view_id'] ) && $widget['view_id'] == $view->ID ) { |
|
479 | - if( $_fields = json_decode( $widget['search_fields'], true ) ) { |
|
478 | + if ( ! empty( $widget[ 'view_id' ] ) && $widget[ 'view_id' ] == $view->ID ) { |
|
479 | + if ( $_fields = json_decode( $widget[ 'search_fields' ], true ) ) { |
|
480 | 480 | foreach ( $_fields as $field ) { |
481 | - $searchable_fields [] = $with_full_field ? $field : $field['field']; |
|
481 | + $searchable_fields [ ] = $with_full_field ? $field : $field[ 'field' ]; |
|
482 | 482 | } |
483 | 483 | } |
484 | 484 | } |
485 | 485 | } |
486 | 486 | |
487 | 487 | foreach ( $view->widgets->by_id( $this->get_widget_id() )->all() as $widget ) { |
488 | - if( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) { |
|
488 | + if ( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) { |
|
489 | 489 | foreach ( $_fields as $field ) { |
490 | - $searchable_fields [] = $with_full_field ? $field : $field['field']; |
|
490 | + $searchable_fields [ ] = $with_full_field ? $field : $field[ 'field' ]; |
|
491 | 491 | } |
492 | 492 | } |
493 | 493 | } |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | return $search_criteria; // Return the original criteria, GF_Query modification kicks in later |
521 | 521 | } |
522 | 522 | |
523 | - if( 'post' === $this->search_method ) { |
|
523 | + if ( 'post' === $this->search_method ) { |
|
524 | 524 | $get = $_POST; |
525 | 525 | } else { |
526 | 526 | $get = $_GET; |
@@ -539,14 +539,14 @@ discard block |
||
539 | 539 | $get = gv_map_deep( $get, 'rawurldecode' ); |
540 | 540 | |
541 | 541 | // Make sure array key is set up |
542 | - $search_criteria['field_filters'] = \GV\Utils::get( $search_criteria, 'field_filters', array() ); |
|
542 | + $search_criteria[ 'field_filters' ] = \GV\Utils::get( $search_criteria, 'field_filters', array() ); |
|
543 | 543 | |
544 | 544 | $searchable_fields = $this->get_view_searchable_fields( $view ); |
545 | 545 | |
546 | 546 | // add free search |
547 | - if ( isset( $get['gv_search'] ) && '' !== $get['gv_search'] && in_array( 'search_all', $searchable_fields ) ) { |
|
547 | + if ( isset( $get[ 'gv_search' ] ) && '' !== $get[ 'gv_search' ] && in_array( 'search_all', $searchable_fields ) ) { |
|
548 | 548 | |
549 | - $search_all_value = trim( $get['gv_search'] ); |
|
549 | + $search_all_value = trim( $get[ 'gv_search' ] ); |
|
550 | 550 | |
551 | 551 | /** |
552 | 552 | * @filter `gravityview/search-all-split-words` Search for each word separately or the whole phrase? |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | } |
572 | 572 | |
573 | 573 | foreach ( $words as $word ) { |
574 | - $search_criteria['field_filters'][] = array( |
|
574 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
575 | 575 | 'key' => null, // The field ID to search |
576 | 576 | 'value' => $word, // The value to search |
577 | 577 | 'operator' => 'contains', // What to search in. Options: `is` or `contains` |
@@ -584,14 +584,14 @@ discard block |
||
584 | 584 | /** |
585 | 585 | * Get and normalize the dates according to the input format. |
586 | 586 | */ |
587 | - if ( $curr_start = ! empty( $get['gv_start'] ) ? $get['gv_start'] : '' ) { |
|
588 | - if( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) { |
|
587 | + if ( $curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : '' ) { |
|
588 | + if ( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) { |
|
589 | 589 | $curr_start = $curr_start_date->format( 'Y-m-d' ); |
590 | 590 | } |
591 | 591 | } |
592 | 592 | |
593 | - if ( $curr_end = ! empty( $get['gv_start'] ) ? ( ! empty( $get['gv_end'] ) ? $get['gv_end'] : '' ) : '' ) { |
|
594 | - if( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) { |
|
593 | + if ( $curr_end = ! empty( $get[ 'gv_start' ] ) ? ( ! empty( $get[ 'gv_end' ] ) ? $get[ 'gv_end' ] : '' ) : '' ) { |
|
594 | + if ( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) { |
|
595 | 595 | $curr_end = $curr_end_date->format( 'Y-m-d' ); |
596 | 596 | } |
597 | 597 | } |
@@ -626,22 +626,22 @@ discard block |
||
626 | 626 | */ |
627 | 627 | if ( ! empty( $curr_start ) ) { |
628 | 628 | $curr_start = date( 'Y-m-d H:i:s', strtotime( $curr_start ) ); |
629 | - $search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
629 | + $search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
630 | 630 | } |
631 | 631 | |
632 | 632 | if ( ! empty( $curr_end ) ) { |
633 | 633 | // Fast-forward 24 hour on the end time |
634 | 634 | $curr_end = date( 'Y-m-d H:i:s', strtotime( $curr_end ) + DAY_IN_SECONDS ); |
635 | - $search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
636 | - if ( strpos( $search_criteria['end_date'], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056 |
|
637 | - $search_criteria['end_date'] = date( 'Y-m-d H:i:s', strtotime( $search_criteria['end_date'] ) - 1 ); |
|
635 | + $search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
636 | + if ( strpos( $search_criteria[ 'end_date' ], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056 |
|
637 | + $search_criteria[ 'end_date' ] = date( 'Y-m-d H:i:s', strtotime( $search_criteria[ 'end_date' ] ) - 1 ); |
|
638 | 638 | } |
639 | 639 | } |
640 | 640 | } |
641 | 641 | |
642 | 642 | // search for a specific entry ID |
643 | 643 | if ( ! empty( $get[ 'gv_id' ] ) && in_array( 'entry_id', $searchable_fields ) ) { |
644 | - $search_criteria['field_filters'][] = array( |
|
644 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
645 | 645 | 'key' => 'id', |
646 | 646 | 'value' => absint( $get[ 'gv_id' ] ), |
647 | 647 | 'operator' => '=', |
@@ -650,42 +650,42 @@ discard block |
||
650 | 650 | |
651 | 651 | // search for a specific Created_by ID |
652 | 652 | if ( ! empty( $get[ 'gv_by' ] ) && in_array( 'created_by', $searchable_fields ) ) { |
653 | - $search_criteria['field_filters'][] = array( |
|
653 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
654 | 654 | 'key' => 'created_by', |
655 | - 'value' => absint( $get['gv_by'] ), |
|
655 | + 'value' => absint( $get[ 'gv_by' ] ), |
|
656 | 656 | 'operator' => '=', |
657 | 657 | ); |
658 | 658 | } |
659 | 659 | |
660 | 660 | |
661 | 661 | // Get search mode passed in URL |
662 | - $mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ? $get['mode'] : 'any'; |
|
662 | + $mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any'; |
|
663 | 663 | |
664 | 664 | // get the other search filters |
665 | 665 | foreach ( $get as $key => $value ) { |
666 | 666 | |
667 | - if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[0], false, false ) ) ) { |
|
667 | + if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[ 0 ], false, false ) ) ) { |
|
668 | 668 | continue; |
669 | 669 | } |
670 | 670 | |
671 | 671 | $filter_key = $this->convert_request_key_to_filter_key( $key ); |
672 | 672 | |
673 | 673 | // could return simple filter or multiple filters |
674 | - if ( ! in_array( 'search_all', $searchable_fields ) && ! in_array( $filter_key , $searchable_fields ) ) { |
|
674 | + if ( ! in_array( 'search_all', $searchable_fields ) && ! in_array( $filter_key, $searchable_fields ) ) { |
|
675 | 675 | continue; |
676 | 676 | } |
677 | 677 | |
678 | 678 | $filter = $this->prepare_field_filter( $filter_key, $value, $view ); |
679 | 679 | |
680 | - if ( isset( $filter[0]['value'] ) ) { |
|
681 | - $search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter ); |
|
680 | + if ( isset( $filter[ 0 ][ 'value' ] ) ) { |
|
681 | + $search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter ); |
|
682 | 682 | |
683 | 683 | // if date range type, set search mode to ALL |
684 | - if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) { |
|
684 | + if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) { |
|
685 | 685 | $mode = 'all'; |
686 | 686 | } |
687 | - } elseif( !empty( $filter ) ) { |
|
688 | - $search_criteria['field_filters'][] = $filter; |
|
687 | + } elseif ( ! empty( $filter ) ) { |
|
688 | + $search_criteria[ 'field_filters' ][ ] = $filter; |
|
689 | 689 | } |
690 | 690 | } |
691 | 691 | |
@@ -694,7 +694,7 @@ discard block |
||
694 | 694 | * @since 1.5.1 |
695 | 695 | * @param[out,in] string $mode Search mode (`any` vs `all`) |
696 | 696 | */ |
697 | - $search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode ); |
|
697 | + $search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode ); |
|
698 | 698 | |
699 | 699 | gravityview()->log->debug( 'Returned Search Criteria: ', array( 'data' => $search_criteria ) ); |
700 | 700 | |
@@ -719,24 +719,24 @@ discard block |
||
719 | 719 | */ |
720 | 720 | $search_criteria = $this->filter_entries( array(), null, array( 'id' => $view->ID ), true /** force search_criteria */ ); |
721 | 721 | |
722 | - if ( empty( $search_criteria['field_filters'] ) ) { |
|
722 | + if ( empty( $search_criteria[ 'field_filters' ] ) ) { |
|
723 | 723 | return; |
724 | 724 | } |
725 | 725 | |
726 | - foreach ( $search_criteria['field_filters'] as &$filter ) { |
|
726 | + foreach ( $search_criteria[ 'field_filters' ] as &$filter ) { |
|
727 | 727 | if ( ! is_array( $filter ) ) { |
728 | 728 | continue; |
729 | 729 | } |
730 | 730 | |
731 | 731 | // By default, we want searches to be wildcard for each field. |
732 | - $filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator']; |
|
732 | + $filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ]; |
|
733 | 733 | |
734 | 734 | /** |
735 | 735 | * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc) |
736 | 736 | * @param string $operator Existing search operator |
737 | 737 | * @param array $filter array with `key`, `value`, `operator`, `type` keys |
738 | 738 | */ |
739 | - $filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter ); |
|
739 | + $filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter ); |
|
740 | 740 | } |
741 | 741 | |
742 | 742 | /** |
@@ -750,12 +750,12 @@ discard block |
||
750 | 750 | /** |
751 | 751 | * Grab the current clauses. We'll be combining them shortly. |
752 | 752 | */ |
753 | - $query_parts = $query->_introspect(); |
|
753 | + $query_parts = $query->_introspect(); |
|
754 | 754 | |
755 | 755 | /** |
756 | 756 | * Combine the parts as a new WHERE clause. |
757 | 757 | */ |
758 | - $query->where( GF_Query_Condition::_and( $query_parts['where'], $_tmp_query_parts['where'] ) ); |
|
758 | + $query->where( GF_Query_Condition::_and( $query_parts[ 'where' ], $_tmp_query_parts[ 'where' ] ) ); |
|
759 | 759 | } |
760 | 760 | |
761 | 761 | /** |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | $field_id = str_replace( 'filter_', '', $key ); |
778 | 778 | |
779 | 779 | // calculates field_id, removing 'filter_' and for '_' for advanced fields ( like name or checkbox ) |
780 | - if ( preg_match('/^[0-9_]+$/ism', $field_id ) ) { |
|
780 | + if ( preg_match( '/^[0-9_]+$/ism', $field_id ) ) { |
|
781 | 781 | $field_id = str_replace( '_', '.', $field_id ); |
782 | 782 | } |
783 | 783 | |
@@ -812,7 +812,7 @@ discard block |
||
812 | 812 | |
813 | 813 | case 'select': |
814 | 814 | case 'radio': |
815 | - $filter['operator'] = 'is'; |
|
815 | + $filter[ 'operator' ] = 'is'; |
|
816 | 816 | break; |
817 | 817 | |
818 | 818 | case 'post_category': |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | |
827 | 827 | foreach ( $value as $val ) { |
828 | 828 | $cat = get_term( $val, 'category' ); |
829 | - $filter[] = array( |
|
829 | + $filter[ ] = array( |
|
830 | 830 | 'key' => $filter_key, |
831 | 831 | 'value' => esc_attr( $cat->name ) . ':' . $val, |
832 | 832 | 'operator' => 'is', |
@@ -845,7 +845,7 @@ discard block |
||
845 | 845 | $filter = array(); |
846 | 846 | |
847 | 847 | foreach ( $value as $val ) { |
848 | - $filter[] = array( 'key' => $filter_key, 'value' => $val ); |
|
848 | + $filter[ ] = array( 'key' => $filter_key, 'value' => $val ); |
|
849 | 849 | } |
850 | 850 | |
851 | 851 | break; |
@@ -854,9 +854,9 @@ discard block |
||
854 | 854 | // convert checkbox on/off into the correct search filter |
855 | 855 | if ( false !== strpos( $filter_key, '.' ) && ! empty( $form_field->inputs ) && ! empty( $form_field->choices ) ) { |
856 | 856 | foreach ( $form_field->inputs as $k => $input ) { |
857 | - if ( $input['id'] == $filter_key ) { |
|
858 | - $filter['value'] = $form_field->choices[ $k ]['value']; |
|
859 | - $filter['operator'] = 'is'; |
|
857 | + if ( $input[ 'id' ] == $filter_key ) { |
|
858 | + $filter[ 'value' ] = $form_field->choices[ $k ][ 'value' ]; |
|
859 | + $filter[ 'operator' ] = 'is'; |
|
860 | 860 | break; |
861 | 861 | } |
862 | 862 | } |
@@ -866,7 +866,7 @@ discard block |
||
866 | 866 | $filter = array(); |
867 | 867 | |
868 | 868 | foreach ( $value as $val ) { |
869 | - $filter[] = array( |
|
869 | + $filter[ ] = array( |
|
870 | 870 | 'key' => $filter_key, |
871 | 871 | 'value' => $val, |
872 | 872 | 'operator' => 'is', |
@@ -887,9 +887,9 @@ discard block |
||
887 | 887 | foreach ( $words as $word ) { |
888 | 888 | if ( ! empty( $word ) && strlen( $word ) > 1 ) { |
889 | 889 | // Keep the same key for each filter |
890 | - $filter['value'] = $word; |
|
890 | + $filter[ 'value' ] = $word; |
|
891 | 891 | // Add a search for the value |
892 | - $filters[] = $filter; |
|
892 | + $filters[ ] = $filter; |
|
893 | 893 | } |
894 | 894 | } |
895 | 895 | |
@@ -903,19 +903,19 @@ discard block |
||
903 | 903 | |
904 | 904 | foreach ( $searchable_fields as $searchable_field ) { |
905 | 905 | |
906 | - if( $form_field->ID !== $searchable_field['field'] ) { |
|
906 | + if ( $form_field->ID !== $searchable_field[ 'field' ] ) { |
|
907 | 907 | continue; |
908 | 908 | } |
909 | 909 | |
910 | 910 | // Only exact-match dropdowns, not text search |
911 | - if( in_array( $searchable_field['input'], array( 'text', 'search' ), true ) ) { |
|
911 | + if ( in_array( $searchable_field[ 'input' ], array( 'text', 'search' ), true ) ) { |
|
912 | 912 | continue; |
913 | 913 | } |
914 | 914 | |
915 | 915 | $input_id = gravityview_get_input_id_from_id( $form_field->ID ); |
916 | 916 | |
917 | 917 | if ( 4 === $input_id ) { |
918 | - $filter['operator'] = 'is'; |
|
918 | + $filter[ 'operator' ] = 'is'; |
|
919 | 919 | }; |
920 | 920 | } |
921 | 921 | } |
@@ -942,12 +942,12 @@ discard block |
||
942 | 942 | * @since 1.16.3 |
943 | 943 | * Safeguard until GF implements '<=' operator |
944 | 944 | */ |
945 | - if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
945 | + if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
946 | 946 | $operator = '<'; |
947 | 947 | $date = date( 'Y-m-d', strtotime( self::get_formatted_date( $date, 'Y-m-d', $date_format ) . ' +1 day' ) ); |
948 | 948 | } |
949 | 949 | |
950 | - $filter[] = array( |
|
950 | + $filter[ ] = array( |
|
951 | 951 | 'key' => $filter_key, |
952 | 952 | 'value' => self::get_formatted_date( $date, 'Y-m-d', $date_format ), |
953 | 953 | 'operator' => $operator, |
@@ -955,7 +955,7 @@ discard block |
||
955 | 955 | } |
956 | 956 | } else { |
957 | 957 | $date = $value; |
958 | - $filter['value'] = self::get_formatted_date( $date, 'Y-m-d', $date_format ); |
|
958 | + $filter[ 'value' ] = self::get_formatted_date( $date, 'Y-m-d', $date_format ); |
|
959 | 959 | } |
960 | 960 | |
961 | 961 | break; |
@@ -986,7 +986,7 @@ discard block |
||
986 | 986 | 'ymd_dot' => 'Y.m.d', |
987 | 987 | ); |
988 | 988 | |
989 | - if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){ |
|
989 | + if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) { |
|
990 | 990 | $format = $datepicker[ $field->dateFormat ]; |
991 | 991 | } |
992 | 992 | |
@@ -1023,7 +1023,7 @@ discard block |
||
1023 | 1023 | public function add_template_path( $file_paths ) { |
1024 | 1024 | |
1025 | 1025 | // Index 100 is the default GravityView template path. |
1026 | - $file_paths[102] = self::$file . 'templates/'; |
|
1026 | + $file_paths[ 102 ] = self::$file . 'templates/'; |
|
1027 | 1027 | |
1028 | 1028 | return $file_paths; |
1029 | 1029 | } |
@@ -1042,7 +1042,7 @@ discard block |
||
1042 | 1042 | $has_date = false; |
1043 | 1043 | |
1044 | 1044 | foreach ( $search_fields as $k => $field ) { |
1045 | - if ( in_array( $field['input'], array( 'date', 'date_range', 'entry_date' ) ) ) { |
|
1045 | + if ( in_array( $field[ 'input' ], array( 'date', 'date_range', 'entry_date' ) ) ) { |
|
1046 | 1046 | $has_date = true; |
1047 | 1047 | break; |
1048 | 1048 | } |
@@ -1069,7 +1069,7 @@ discard block |
||
1069 | 1069 | } |
1070 | 1070 | |
1071 | 1071 | // get configured search fields |
1072 | - $search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : ''; |
|
1072 | + $search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : ''; |
|
1073 | 1073 | |
1074 | 1074 | if ( empty( $search_fields ) || ! is_array( $search_fields ) ) { |
1075 | 1075 | gravityview()->log->debug( 'No search fields configured for widget:', array( 'data' => $widget_args ) ); |
@@ -1084,34 +1084,34 @@ discard block |
||
1084 | 1084 | |
1085 | 1085 | $updated_field = $this->get_search_filter_details( $updated_field ); |
1086 | 1086 | |
1087 | - switch ( $field['field'] ) { |
|
1087 | + switch ( $field[ 'field' ] ) { |
|
1088 | 1088 | |
1089 | 1089 | case 'search_all': |
1090 | - $updated_field['key'] = 'search_all'; |
|
1091 | - $updated_field['input'] = 'search_all'; |
|
1092 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' ); |
|
1090 | + $updated_field[ 'key' ] = 'search_all'; |
|
1091 | + $updated_field[ 'input' ] = 'search_all'; |
|
1092 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' ); |
|
1093 | 1093 | break; |
1094 | 1094 | |
1095 | 1095 | case 'entry_date': |
1096 | - $updated_field['key'] = 'entry_date'; |
|
1097 | - $updated_field['input'] = 'entry_date'; |
|
1098 | - $updated_field['value'] = array( |
|
1096 | + $updated_field[ 'key' ] = 'entry_date'; |
|
1097 | + $updated_field[ 'input' ] = 'entry_date'; |
|
1098 | + $updated_field[ 'value' ] = array( |
|
1099 | 1099 | 'start' => $this->rgget_or_rgpost( 'gv_start' ), |
1100 | 1100 | 'end' => $this->rgget_or_rgpost( 'gv_end' ), |
1101 | 1101 | ); |
1102 | 1102 | break; |
1103 | 1103 | |
1104 | 1104 | case 'entry_id': |
1105 | - $updated_field['key'] = 'entry_id'; |
|
1106 | - $updated_field['input'] = 'entry_id'; |
|
1107 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' ); |
|
1105 | + $updated_field[ 'key' ] = 'entry_id'; |
|
1106 | + $updated_field[ 'input' ] = 'entry_id'; |
|
1107 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' ); |
|
1108 | 1108 | break; |
1109 | 1109 | |
1110 | 1110 | case 'created_by': |
1111 | - $updated_field['key'] = 'created_by'; |
|
1112 | - $updated_field['name'] = 'gv_by'; |
|
1113 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' ); |
|
1114 | - $updated_field['choices'] = self::get_created_by_choices(); |
|
1111 | + $updated_field[ 'key' ] = 'created_by'; |
|
1112 | + $updated_field[ 'name' ] = 'gv_by'; |
|
1113 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' ); |
|
1114 | + $updated_field[ 'choices' ] = self::get_created_by_choices(); |
|
1115 | 1115 | break; |
1116 | 1116 | } |
1117 | 1117 | |
@@ -1130,16 +1130,16 @@ discard block |
||
1130 | 1130 | */ |
1131 | 1131 | $gravityview_view->search_fields = apply_filters( 'gravityview_widget_search_filters', $search_fields, $this, $widget_args, $context ); |
1132 | 1132 | |
1133 | - $gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal'; |
|
1133 | + $gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal'; |
|
1134 | 1134 | |
1135 | 1135 | /** @since 1.14 */ |
1136 | - $gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any'; |
|
1136 | + $gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any'; |
|
1137 | 1137 | |
1138 | - $custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
1138 | + $custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; |
|
1139 | 1139 | |
1140 | 1140 | $gravityview_view->search_class = self::get_search_class( $custom_class ); |
1141 | 1141 | |
1142 | - $gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false; |
|
1142 | + $gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false; |
|
1143 | 1143 | |
1144 | 1144 | if ( $this->has_date_field( $search_fields ) ) { |
1145 | 1145 | // enqueue datepicker stuff only if needed! |
@@ -1161,10 +1161,10 @@ discard block |
||
1161 | 1161 | public static function get_search_class( $custom_class = '' ) { |
1162 | 1162 | $gravityview_view = GravityView_View::getInstance(); |
1163 | 1163 | |
1164 | - $search_class = 'gv-search-'.$gravityview_view->search_layout; |
|
1164 | + $search_class = 'gv-search-' . $gravityview_view->search_layout; |
|
1165 | 1165 | |
1166 | - if ( ! empty( $custom_class ) ) { |
|
1167 | - $search_class .= ' '.$custom_class; |
|
1166 | + if ( ! empty( $custom_class ) ) { |
|
1167 | + $search_class .= ' ' . $custom_class; |
|
1168 | 1168 | } |
1169 | 1169 | |
1170 | 1170 | /** |
@@ -1208,9 +1208,9 @@ discard block |
||
1208 | 1208 | |
1209 | 1209 | if ( ! $label ) { |
1210 | 1210 | |
1211 | - $label = isset( $form_field['label'] ) ? $form_field['label'] : ''; |
|
1211 | + $label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : ''; |
|
1212 | 1212 | |
1213 | - switch( $field['field'] ) { |
|
1213 | + switch ( $field[ 'field' ] ) { |
|
1214 | 1214 | case 'search_all': |
1215 | 1215 | $label = __( 'Search Entries:', 'gravityview' ); |
1216 | 1216 | break; |
@@ -1222,10 +1222,10 @@ discard block |
||
1222 | 1222 | break; |
1223 | 1223 | default: |
1224 | 1224 | // If this is a field input, not a field |
1225 | - if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) { |
|
1225 | + if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) { |
|
1226 | 1226 | |
1227 | 1227 | // Get the label for the field in question, which returns an array |
1228 | - $items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) ); |
|
1228 | + $items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) ); |
|
1229 | 1229 | |
1230 | 1230 | // Get the item with the `label` key |
1231 | 1231 | $values = wp_list_pluck( $items, 'label' ); |
@@ -1264,32 +1264,32 @@ discard block |
||
1264 | 1264 | $form = $gravityview_view->getForm(); |
1265 | 1265 | |
1266 | 1266 | // for advanced field ids (eg, first name / last name ) |
1267 | - $name = 'filter_' . str_replace( '.', '_', $field['field'] ); |
|
1267 | + $name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] ); |
|
1268 | 1268 | |
1269 | 1269 | // get searched value from $_GET/$_POST (string or array) |
1270 | 1270 | $value = $this->rgget_or_rgpost( $name ); |
1271 | 1271 | |
1272 | 1272 | // get form field details |
1273 | - $form_field = gravityview_get_field( $form, $field['field'] ); |
|
1273 | + $form_field = gravityview_get_field( $form, $field[ 'field' ] ); |
|
1274 | 1274 | |
1275 | 1275 | $filter = array( |
1276 | - 'key' => $field['field'], |
|
1276 | + 'key' => $field[ 'field' ], |
|
1277 | 1277 | 'name' => $name, |
1278 | 1278 | 'label' => self::get_field_label( $field, $form_field ), |
1279 | - 'input' => $field['input'], |
|
1279 | + 'input' => $field[ 'input' ], |
|
1280 | 1280 | 'value' => $value, |
1281 | - 'type' => $form_field['type'], |
|
1281 | + 'type' => $form_field[ 'type' ], |
|
1282 | 1282 | ); |
1283 | 1283 | |
1284 | 1284 | // collect choices |
1285 | - if ( 'post_category' === $form_field['type'] && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) { |
|
1286 | - $filter['choices'] = gravityview_get_terms_choices(); |
|
1287 | - } elseif ( ! empty( $form_field['choices'] ) ) { |
|
1288 | - $filter['choices'] = $form_field['choices']; |
|
1285 | + if ( 'post_category' === $form_field[ 'type' ] && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) { |
|
1286 | + $filter[ 'choices' ] = gravityview_get_terms_choices(); |
|
1287 | + } elseif ( ! empty( $form_field[ 'choices' ] ) ) { |
|
1288 | + $filter[ 'choices' ] = $form_field[ 'choices' ]; |
|
1289 | 1289 | } |
1290 | 1290 | |
1291 | - if ( 'date_range' === $field['input'] && empty( $value ) ) { |
|
1292 | - $filter['value'] = array( 'start' => '', 'end' => '' ); |
|
1291 | + if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) { |
|
1292 | + $filter[ 'value' ] = array( 'start' => '', 'end' => '' ); |
|
1293 | 1293 | } |
1294 | 1294 | |
1295 | 1295 | return $filter; |
@@ -1313,7 +1313,7 @@ discard block |
||
1313 | 1313 | |
1314 | 1314 | $choices = array(); |
1315 | 1315 | foreach ( $users as $user ) { |
1316 | - $choices[] = array( |
|
1316 | + $choices[ ] = array( |
|
1317 | 1317 | 'value' => $user->ID, |
1318 | 1318 | 'text' => $user->display_name, |
1319 | 1319 | ); |
@@ -1368,7 +1368,7 @@ discard block |
||
1368 | 1368 | */ |
1369 | 1369 | public function add_datepicker_js_dependency( $js_dependencies ) { |
1370 | 1370 | |
1371 | - $js_dependencies[] = 'jquery-ui-datepicker'; |
|
1371 | + $js_dependencies[ ] = 'jquery-ui-datepicker'; |
|
1372 | 1372 | |
1373 | 1373 | return $js_dependencies; |
1374 | 1374 | } |
@@ -1412,7 +1412,7 @@ discard block |
||
1412 | 1412 | 'isRTL' => is_rtl(), |
1413 | 1413 | ), $view_data ); |
1414 | 1414 | |
1415 | - $localizations['datepicker'] = $datepicker_settings; |
|
1415 | + $localizations[ 'datepicker' ] = $datepicker_settings; |
|
1416 | 1416 | |
1417 | 1417 | return $localizations; |
1418 | 1418 | |
@@ -1439,7 +1439,7 @@ discard block |
||
1439 | 1439 | * @return void |
1440 | 1440 | */ |
1441 | 1441 | private function maybe_enqueue_flexibility() { |
1442 | - if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/MSIE [8-9]/', $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
1442 | + if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) && preg_match( '/MSIE [8-9]/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) { |
|
1443 | 1443 | wp_enqueue_script( 'gv-flexibility' ); |
1444 | 1444 | } |
1445 | 1445 | } |
@@ -1461,7 +1461,7 @@ discard block |
||
1461 | 1461 | add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 ); |
1462 | 1462 | |
1463 | 1463 | $scheme = is_ssl() ? 'https://' : 'http://'; |
1464 | - wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
1464 | + wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
1465 | 1465 | |
1466 | 1466 | /** |
1467 | 1467 | * @filter `gravityview_search_datepicker_class` |