@@ -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 |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | $script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
| 230 | 230 | $script_source = empty( $script_min ) ? '/source' : ''; |
| 231 | 231 | |
| 232 | - 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 ); |
|
| 232 | + 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 ); |
|
| 233 | 233 | |
| 234 | 234 | wp_localize_script( 'gravityview_searchwidget_admin', 'gvSearchVar', array( |
| 235 | 235 | 'nonce' => wp_create_nonce( 'gravityview_ajaxsearchwidget' ), |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | * @return array Scripts allowed in no-conflict mode, plus the search widget script |
| 252 | 252 | */ |
| 253 | 253 | public function register_no_conflict( $allowed ) { |
| 254 | - $allowed[] = 'gravityview_searchwidget_admin'; |
|
| 254 | + $allowed[ ] = 'gravityview_searchwidget_admin'; |
|
| 255 | 255 | return $allowed; |
| 256 | 256 | } |
| 257 | 257 | |
@@ -264,24 +264,24 @@ discard block |
||
| 264 | 264 | */ |
| 265 | 265 | public static function get_searchable_fields() { |
| 266 | 266 | |
| 267 | - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) { |
|
| 267 | + if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) { |
|
| 268 | 268 | exit( '0' ); |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | $form = ''; |
| 272 | 272 | |
| 273 | 273 | // Fetch the form for the current View |
| 274 | - if ( ! empty( $_POST['view_id'] ) ) { |
|
| 274 | + if ( ! empty( $_POST[ 'view_id' ] ) ) { |
|
| 275 | 275 | |
| 276 | - $form = gravityview_get_form_id( $_POST['view_id'] ); |
|
| 276 | + $form = gravityview_get_form_id( $_POST[ 'view_id' ] ); |
|
| 277 | 277 | |
| 278 | - } elseif ( ! empty( $_POST['formid'] ) ) { |
|
| 278 | + } elseif ( ! empty( $_POST[ 'formid' ] ) ) { |
|
| 279 | 279 | |
| 280 | - $form = (int) $_POST['formid']; |
|
| 280 | + $form = (int)$_POST[ 'formid' ]; |
|
| 281 | 281 | |
| 282 | - } elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
| 282 | + } elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
| 283 | 283 | |
| 284 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
| 284 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
| 285 | 285 | |
| 286 | 286 | } |
| 287 | 287 | |
@@ -331,14 +331,14 @@ discard block |
||
| 331 | 331 | ); |
| 332 | 332 | |
| 333 | 333 | if ( gravityview()->plugin->supports( \GV\Plugin::FEATURE_GFQUERY ) ) { |
| 334 | - $custom_fields['is_approved'] = array( |
|
| 334 | + $custom_fields[ 'is_approved' ] = array( |
|
| 335 | 335 | 'text' => esc_html__( 'Approval Status', 'gravityview' ), |
| 336 | 336 | 'type' => 'multi', |
| 337 | 337 | ); |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | - foreach( $custom_fields as $custom_field_key => $custom_field ) { |
|
| 341 | - $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'] ); |
|
| 340 | + foreach ( $custom_fields as $custom_field_key => $custom_field ) { |
|
| 341 | + $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' ] ); |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | // Get fields with sub-inputs and no parent |
@@ -360,13 +360,13 @@ discard block |
||
| 360 | 360 | |
| 361 | 361 | foreach ( $fields as $id => $field ) { |
| 362 | 362 | |
| 363 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
| 363 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
| 364 | 364 | continue; |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | - $types = self::get_search_input_types( $id, $field['type'] ); |
|
| 367 | + $types = self::get_search_input_types( $id, $field[ 'type' ] ); |
|
| 368 | 368 | |
| 369 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>'; |
|
| 369 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>'; |
|
| 370 | 370 | } |
| 371 | 371 | } |
| 372 | 372 | |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | public static function get_search_input_types( $field_id = '', $field_type = null ) { |
| 390 | 390 | |
| 391 | 391 | // @todo - This needs to be improved - many fields have . including products and addresses |
| 392 | - if ( false !== strpos( (string) $field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) { |
|
| 392 | + if ( false !== strpos( (string)$field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) { |
|
| 393 | 393 | $input_type = 'boolean'; // on/off checkbox |
| 394 | 394 | } elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) { |
| 395 | 395 | $input_type = 'multi'; //multiselect |
@@ -433,19 +433,19 @@ discard block |
||
| 433 | 433 | $post_id = 0; |
| 434 | 434 | |
| 435 | 435 | // We're in the WordPress Widget context, and an overriding post ID has been set. |
| 436 | - if ( ! empty( $widget_args['post_id'] ) ) { |
|
| 437 | - $post_id = absint( $widget_args['post_id'] ); |
|
| 436 | + if ( ! empty( $widget_args[ 'post_id' ] ) ) { |
|
| 437 | + $post_id = absint( $widget_args[ 'post_id' ] ); |
|
| 438 | 438 | } |
| 439 | 439 | // We're in the WordPress Widget context, and the base View ID should be used |
| 440 | - else if ( ! empty( $widget_args['view_id'] ) ) { |
|
| 441 | - $post_id = absint( $widget_args['view_id'] ); |
|
| 440 | + else if ( ! empty( $widget_args[ 'view_id' ] ) ) { |
|
| 441 | + $post_id = absint( $widget_args[ 'view_id' ] ); |
|
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | $args = gravityview_get_permalink_query_args( $post_id ); |
| 445 | 445 | |
| 446 | 446 | // Add hidden fields to the search form |
| 447 | 447 | foreach ( $args as $key => $value ) { |
| 448 | - $search_fields[] = array( |
|
| 448 | + $search_fields[ ] = array( |
|
| 449 | 449 | 'name' => $key, |
| 450 | 450 | 'input' => 'hidden', |
| 451 | 451 | 'value' => $value, |
@@ -484,28 +484,28 @@ discard block |
||
| 484 | 484 | /** |
| 485 | 485 | * Include the sidebar Widgets. |
| 486 | 486 | */ |
| 487 | - $widgets = (array) get_option( 'widget_gravityview_search', array() ); |
|
| 487 | + $widgets = (array)get_option( 'widget_gravityview_search', array() ); |
|
| 488 | 488 | |
| 489 | 489 | foreach ( $widgets as $widget ) { |
| 490 | - if ( ! empty( $widget['view_id'] ) && $widget['view_id'] == $view->ID ) { |
|
| 491 | - if( $_fields = json_decode( $widget['search_fields'], true ) ) { |
|
| 490 | + if ( ! empty( $widget[ 'view_id' ] ) && $widget[ 'view_id' ] == $view->ID ) { |
|
| 491 | + if ( $_fields = json_decode( $widget[ 'search_fields' ], true ) ) { |
|
| 492 | 492 | foreach ( $_fields as $field ) { |
| 493 | - if ( empty( $field['form_id'] ) ) { |
|
| 494 | - $field['form_id'] = $view->form ? $view->form->ID : 0; |
|
| 493 | + if ( empty( $field[ 'form_id' ] ) ) { |
|
| 494 | + $field[ 'form_id' ] = $view->form ? $view->form->ID : 0; |
|
| 495 | 495 | } |
| 496 | - $searchable_fields[] = $with_full_field ? $field : $field['field']; |
|
| 496 | + $searchable_fields[ ] = $with_full_field ? $field : $field[ 'field' ]; |
|
| 497 | 497 | } |
| 498 | 498 | } |
| 499 | 499 | } |
| 500 | 500 | } |
| 501 | 501 | |
| 502 | 502 | foreach ( $view->widgets->by_id( $this->get_widget_id() )->all() as $widget ) { |
| 503 | - if( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) { |
|
| 503 | + if ( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) { |
|
| 504 | 504 | foreach ( $_fields as $field ) { |
| 505 | - if ( empty( $field['form_id'] ) ) { |
|
| 506 | - $field['form_id'] = $view->form ? $view->form->ID : 0; |
|
| 505 | + if ( empty( $field[ 'form_id' ] ) ) { |
|
| 506 | + $field[ 'form_id' ] = $view->form ? $view->form->ID : 0; |
|
| 507 | 507 | } |
| 508 | - $searchable_fields[] = $with_full_field ? $field : $field['field']; |
|
| 508 | + $searchable_fields[ ] = $with_full_field ? $field : $field[ 'field' ]; |
|
| 509 | 509 | } |
| 510 | 510 | } |
| 511 | 511 | } |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | return $search_criteria; // Return the original criteria, GF_Query modification kicks in later |
| 536 | 536 | } |
| 537 | 537 | |
| 538 | - if( 'post' === $this->search_method ) { |
|
| 538 | + if ( 'post' === $this->search_method ) { |
|
| 539 | 539 | $get = $_POST; |
| 540 | 540 | } else { |
| 541 | 541 | $get = $_GET; |
@@ -554,15 +554,15 @@ discard block |
||
| 554 | 554 | $get = gv_map_deep( $get, 'rawurldecode' ); |
| 555 | 555 | |
| 556 | 556 | // Make sure array key is set up |
| 557 | - $search_criteria['field_filters'] = \GV\Utils::get( $search_criteria, 'field_filters', array() ); |
|
| 557 | + $search_criteria[ 'field_filters' ] = \GV\Utils::get( $search_criteria, 'field_filters', array() ); |
|
| 558 | 558 | |
| 559 | 559 | $searchable_fields = $this->get_view_searchable_fields( $view ); |
| 560 | 560 | $searchable_field_objects = $this->get_view_searchable_fields( $view, true ); |
| 561 | 561 | |
| 562 | 562 | // add free search |
| 563 | - if ( isset( $get['gv_search'] ) && '' !== $get['gv_search'] && in_array( 'search_all', $searchable_fields ) ) { |
|
| 563 | + if ( isset( $get[ 'gv_search' ] ) && '' !== $get[ 'gv_search' ] && in_array( 'search_all', $searchable_fields ) ) { |
|
| 564 | 564 | |
| 565 | - $search_all_value = trim( $get['gv_search'] ); |
|
| 565 | + $search_all_value = trim( $get[ 'gv_search' ] ); |
|
| 566 | 566 | |
| 567 | 567 | /** |
| 568 | 568 | * @filter `gravityview/search-all-split-words` Search for each word separately or the whole phrase? |
@@ -587,7 +587,7 @@ discard block |
||
| 587 | 587 | } |
| 588 | 588 | |
| 589 | 589 | foreach ( $words as $word ) { |
| 590 | - $search_criteria['field_filters'][] = array( |
|
| 590 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 591 | 591 | 'key' => null, // The field ID to search |
| 592 | 592 | 'value' => $word, // The value to search |
| 593 | 593 | 'operator' => 'contains', // What to search in. Options: `is` or `contains` |
@@ -600,14 +600,14 @@ discard block |
||
| 600 | 600 | /** |
| 601 | 601 | * Get and normalize the dates according to the input format. |
| 602 | 602 | */ |
| 603 | - if ( $curr_start = ! empty( $get['gv_start'] ) ? $get['gv_start'] : '' ) { |
|
| 604 | - if( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) { |
|
| 603 | + if ( $curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : '' ) { |
|
| 604 | + if ( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) { |
|
| 605 | 605 | $curr_start = $curr_start_date->format( 'Y-m-d' ); |
| 606 | 606 | } |
| 607 | 607 | } |
| 608 | 608 | |
| 609 | - if ( $curr_end = ! empty( $get['gv_start'] ) ? ( ! empty( $get['gv_end'] ) ? $get['gv_end'] : '' ) : '' ) { |
|
| 610 | - if( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) { |
|
| 609 | + if ( $curr_end = ! empty( $get[ 'gv_start' ] ) ? ( ! empty( $get[ 'gv_end' ] ) ? $get[ 'gv_end' ] : '' ) : '' ) { |
|
| 610 | + if ( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) { |
|
| 611 | 611 | $curr_end = $curr_end_date->format( 'Y-m-d' ); |
| 612 | 612 | } |
| 613 | 613 | } |
@@ -642,22 +642,22 @@ discard block |
||
| 642 | 642 | */ |
| 643 | 643 | if ( ! empty( $curr_start ) ) { |
| 644 | 644 | $curr_start = date( 'Y-m-d H:i:s', strtotime( $curr_start ) ); |
| 645 | - $search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
| 645 | + $search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
| 646 | 646 | } |
| 647 | 647 | |
| 648 | 648 | if ( ! empty( $curr_end ) ) { |
| 649 | 649 | // Fast-forward 24 hour on the end time |
| 650 | 650 | $curr_end = date( 'Y-m-d H:i:s', strtotime( $curr_end ) + DAY_IN_SECONDS ); |
| 651 | - $search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
| 652 | - if ( strpos( $search_criteria['end_date'], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056 |
|
| 653 | - $search_criteria['end_date'] = date( 'Y-m-d H:i:s', strtotime( $search_criteria['end_date'] ) - 1 ); |
|
| 651 | + $search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
| 652 | + if ( strpos( $search_criteria[ 'end_date' ], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056 |
|
| 653 | + $search_criteria[ 'end_date' ] = date( 'Y-m-d H:i:s', strtotime( $search_criteria[ 'end_date' ] ) - 1 ); |
|
| 654 | 654 | } |
| 655 | 655 | } |
| 656 | 656 | } |
| 657 | 657 | |
| 658 | 658 | // search for a specific entry ID |
| 659 | 659 | if ( ! empty( $get[ 'gv_id' ] ) && in_array( 'entry_id', $searchable_fields ) ) { |
| 660 | - $search_criteria['field_filters'][] = array( |
|
| 660 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 661 | 661 | 'key' => 'id', |
| 662 | 662 | 'value' => absint( $get[ 'gv_id' ] ), |
| 663 | 663 | 'operator' => '=', |
@@ -666,20 +666,20 @@ discard block |
||
| 666 | 666 | |
| 667 | 667 | // search for a specific Created_by ID |
| 668 | 668 | if ( ! empty( $get[ 'gv_by' ] ) && in_array( 'created_by', $searchable_fields ) ) { |
| 669 | - $search_criteria['field_filters'][] = array( |
|
| 669 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 670 | 670 | 'key' => 'created_by', |
| 671 | - 'value' => $get['gv_by'], |
|
| 671 | + 'value' => $get[ 'gv_by' ], |
|
| 672 | 672 | 'operator' => '=', |
| 673 | 673 | ); |
| 674 | 674 | } |
| 675 | 675 | |
| 676 | 676 | // Get search mode passed in URL |
| 677 | - $mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ? $get['mode'] : 'any'; |
|
| 677 | + $mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any'; |
|
| 678 | 678 | |
| 679 | 679 | // get the other search filters |
| 680 | 680 | foreach ( $get as $key => $value ) { |
| 681 | 681 | |
| 682 | - if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[0], false, false ) ) ) { |
|
| 682 | + if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[ 0 ], false, false ) ) ) { |
|
| 683 | 683 | continue; |
| 684 | 684 | } |
| 685 | 685 | |
@@ -689,15 +689,15 @@ discard block |
||
| 689 | 689 | continue; |
| 690 | 690 | } |
| 691 | 691 | |
| 692 | - if ( isset( $filter[0]['value'] ) ) { |
|
| 693 | - $search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter ); |
|
| 692 | + if ( isset( $filter[ 0 ][ 'value' ] ) ) { |
|
| 693 | + $search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter ); |
|
| 694 | 694 | |
| 695 | 695 | // if date range type, set search mode to ALL |
| 696 | - if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) { |
|
| 696 | + if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) { |
|
| 697 | 697 | $mode = 'all'; |
| 698 | 698 | } |
| 699 | - } elseif( !empty( $filter ) ) { |
|
| 700 | - $search_criteria['field_filters'][] = $filter; |
|
| 699 | + } elseif ( ! empty( $filter ) ) { |
|
| 700 | + $search_criteria[ 'field_filters' ][ ] = $filter; |
|
| 701 | 701 | } |
| 702 | 702 | } |
| 703 | 703 | |
@@ -706,7 +706,7 @@ discard block |
||
| 706 | 706 | * @since 1.5.1 |
| 707 | 707 | * @param[out,in] string $mode Search mode (`any` vs `all`) |
| 708 | 708 | */ |
| 709 | - $search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode ); |
|
| 709 | + $search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode ); |
|
| 710 | 710 | |
| 711 | 711 | gravityview()->log->debug( 'Returned Search Criteria: ', array( 'data' => $search_criteria ) ); |
| 712 | 712 | |
@@ -733,19 +733,19 @@ discard block |
||
| 733 | 733 | |
| 734 | 734 | $query_class = $view->get_query_class(); |
| 735 | 735 | |
| 736 | - if ( empty( $search_criteria['field_filters'] ) ) { |
|
| 736 | + if ( empty( $search_criteria[ 'field_filters' ] ) ) { |
|
| 737 | 737 | return; |
| 738 | 738 | } |
| 739 | 739 | |
| 740 | 740 | $widgets = $view->widgets->by_id( $this->widget_id ); |
| 741 | 741 | if ( $widgets->count() ) { |
| 742 | 742 | $widgets = $widgets->all(); |
| 743 | - $widget = $widgets[0]; |
|
| 743 | + $widget = $widgets[ 0 ]; |
|
| 744 | 744 | |
| 745 | 745 | $search_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ); |
| 746 | 746 | |
| 747 | - foreach ( (array) $search_fields as $search_field ) { |
|
| 748 | - if ( 'created_by' === $search_field['field'] && 'input_text' === $search_field['input'] ) { |
|
| 747 | + foreach ( (array)$search_fields as $search_field ) { |
|
| 748 | + if ( 'created_by' === $search_field[ 'field' ] && 'input_text' === $search_field[ 'input' ] ) { |
|
| 749 | 749 | $created_by_text_mode = true; |
| 750 | 750 | } |
| 751 | 751 | } |
@@ -754,7 +754,7 @@ discard block |
||
| 754 | 754 | $extra_conditions = array(); |
| 755 | 755 | $mode = 'any'; |
| 756 | 756 | |
| 757 | - foreach ( $search_criteria['field_filters'] as &$filter ) { |
|
| 757 | + foreach ( $search_criteria[ 'field_filters' ] as &$filter ) { |
|
| 758 | 758 | if ( ! is_array( $filter ) ) { |
| 759 | 759 | if ( in_array( strtolower( $filter ), array( 'any', 'all' ) ) ) { |
| 760 | 760 | $mode = $filter; |
@@ -763,13 +763,13 @@ discard block |
||
| 763 | 763 | } |
| 764 | 764 | |
| 765 | 765 | // Construct a manual query for unapproved statuses |
| 766 | - if ( 'is_approved' === $filter['key'] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array) $filter['value'] ) ) { |
|
| 767 | - $_tmp_query = new $query_class( $view->form->ID, array( |
|
| 766 | + if ( 'is_approved' === $filter[ 'key' ] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array)$filter[ 'value' ] ) ) { |
|
| 767 | + $_tmp_query = new $query_class( $view->form->ID, array( |
|
| 768 | 768 | 'field_filters' => array( |
| 769 | 769 | array( |
| 770 | 770 | 'operator' => 'in', |
| 771 | 771 | 'key' => 'is_approved', |
| 772 | - 'value' => (array) $filter['value'], |
|
| 772 | + 'value' => (array)$filter[ 'value' ], |
|
| 773 | 773 | ), |
| 774 | 774 | array( |
| 775 | 775 | 'operator' => 'is', |
@@ -781,30 +781,30 @@ discard block |
||
| 781 | 781 | ) ); |
| 782 | 782 | $_tmp_query_parts = $_tmp_query->_introspect(); |
| 783 | 783 | |
| 784 | - $extra_conditions[] = $_tmp_query_parts['where']; |
|
| 784 | + $extra_conditions[ ] = $_tmp_query_parts[ 'where' ]; |
|
| 785 | 785 | |
| 786 | 786 | $filter = false; |
| 787 | 787 | continue; |
| 788 | 788 | } |
| 789 | 789 | |
| 790 | 790 | // Construct manual query for text mode creator search |
| 791 | - if ( 'created_by' === $filter['key'] && ! empty( $created_by_text_mode ) ) { |
|
| 792 | - $extra_conditions[] = new GravityView_Widget_Search_Author_GF_Query_Condition( $filter, $view ); |
|
| 791 | + if ( 'created_by' === $filter[ 'key' ] && ! empty( $created_by_text_mode ) ) { |
|
| 792 | + $extra_conditions[ ] = new GravityView_Widget_Search_Author_GF_Query_Condition( $filter, $view ); |
|
| 793 | 793 | $filter = false; |
| 794 | 794 | continue; |
| 795 | 795 | } |
| 796 | 796 | |
| 797 | 797 | // By default, we want searches to be wildcard for each field. |
| 798 | - $filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator']; |
|
| 798 | + $filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ]; |
|
| 799 | 799 | |
| 800 | 800 | // For multichoice, let's have an in (OR) search. |
| 801 | - if ( is_array( $filter['value'] ) ) { |
|
| 802 | - $filter['operator'] = 'in'; // @todo what about in contains (OR LIKE chains)? |
|
| 801 | + if ( is_array( $filter[ 'value' ] ) ) { |
|
| 802 | + $filter[ 'operator' ] = 'in'; // @todo what about in contains (OR LIKE chains)? |
|
| 803 | 803 | } |
| 804 | 804 | |
| 805 | 805 | // Default form with joins functionality |
| 806 | - if ( empty( $filter['form_id'] ) ) { |
|
| 807 | - $filter['form_id'] = $view->form ? $view->form->ID : 0; |
|
| 806 | + if ( empty( $filter[ 'form_id' ] ) ) { |
|
| 807 | + $filter[ 'form_id' ] = $view->form ? $view->form->ID : 0; |
|
| 808 | 808 | } |
| 809 | 809 | |
| 810 | 810 | /** |
@@ -812,12 +812,12 @@ discard block |
||
| 812 | 812 | * @param string $operator Existing search operator |
| 813 | 813 | * @param array $filter array with `key`, `value`, `operator`, `type` keys |
| 814 | 814 | */ |
| 815 | - $filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter ); |
|
| 815 | + $filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter ); |
|
| 816 | 816 | } |
| 817 | 817 | |
| 818 | 818 | $search_conditions = array(); |
| 819 | 819 | |
| 820 | - if ( $filters = array_filter( $search_criteria['field_filters'] ) ) { |
|
| 820 | + if ( $filters = array_filter( $search_criteria[ 'field_filters' ] ) ) { |
|
| 821 | 821 | |
| 822 | 822 | foreach ( $filters as $filter ) { |
| 823 | 823 | if ( ! is_array( $filter ) ) { |
@@ -830,9 +830,9 @@ discard block |
||
| 830 | 830 | * code by reusing what's inside GF_Query already as they |
| 831 | 831 | * take care of many small things like forcing numeric, etc. |
| 832 | 832 | */ |
| 833 | - $_tmp_query = new $query_class( $filter['form_id'], array( 'mode' => 'any', 'field_filters' => array( $filter ) ) ); |
|
| 833 | + $_tmp_query = new $query_class( $filter[ 'form_id' ], array( 'mode' => 'any', 'field_filters' => array( $filter ) ) ); |
|
| 834 | 834 | $_tmp_query_parts = $_tmp_query->_introspect(); |
| 835 | - $search_condition = $_tmp_query_parts['where']; |
|
| 835 | + $search_condition = $_tmp_query_parts[ 'where' ]; |
|
| 836 | 836 | |
| 837 | 837 | /** |
| 838 | 838 | * Make sure the column alias is correct. |
@@ -841,9 +841,9 @@ discard block |
||
| 841 | 841 | $alias = $query->_alias( $left->field_id, $left->source, $left->is_entry_column() ? 't' : 'm' ); |
| 842 | 842 | |
| 843 | 843 | if ( $view->joins && $left->field_id == GF_Query_Column::META ) { |
| 844 | - $search_conditions[] = new GravityView_Widget_Search_All_GF_Query_Condition( $search_condition, $view ); |
|
| 844 | + $search_conditions[ ] = new GravityView_Widget_Search_All_GF_Query_Condition( $search_condition, $view ); |
|
| 845 | 845 | } else { |
| 846 | - $search_conditions[] = new GF_Query_Condition( |
|
| 846 | + $search_conditions[ ] = new GF_Query_Condition( |
|
| 847 | 847 | new GF_Query_Column( $left->field_id, $left->source, $alias ), |
| 848 | 848 | $search_condition->operator, |
| 849 | 849 | $search_condition->right |
@@ -864,7 +864,7 @@ discard block |
||
| 864 | 864 | /** |
| 865 | 865 | * Combine the parts as a new WHERE clause. |
| 866 | 866 | */ |
| 867 | - $where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts['where'] ), $search_conditions, $extra_conditions ) ); |
|
| 867 | + $where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts[ 'where' ] ), $search_conditions, $extra_conditions ) ); |
|
| 868 | 868 | $query->where( $where ); |
| 869 | 869 | } |
| 870 | 870 | |
@@ -887,7 +887,7 @@ discard block |
||
| 887 | 887 | $field_id = str_replace( 'filter_', '', $key ); |
| 888 | 888 | |
| 889 | 889 | // calculates field_id, removing 'filter_' and for '_' for advanced fields ( like name or checkbox ) |
| 890 | - if ( preg_match('/^[0-9_]+$/ism', $field_id ) ) { |
|
| 890 | + if ( preg_match( '/^[0-9_]+$/ism', $field_id ) ) { |
|
| 891 | 891 | $field_id = str_replace( '_', '.', $field_id ); |
| 892 | 892 | } |
| 893 | 893 | |
@@ -939,7 +939,7 @@ discard block |
||
| 939 | 939 | // form is in searchable fields |
| 940 | 940 | $found = false; |
| 941 | 941 | foreach ( $searchable_fields as $field ) { |
| 942 | - if ( $field_id == $field['field'] && $form->ID == $field['form_id'] ) { |
|
| 942 | + if ( $field_id == $field[ 'field' ] && $form->ID == $field[ 'form_id' ] ) { |
|
| 943 | 943 | $found = true; |
| 944 | 944 | break; |
| 945 | 945 | } |
@@ -975,7 +975,7 @@ discard block |
||
| 975 | 975 | |
| 976 | 976 | case 'select': |
| 977 | 977 | case 'radio': |
| 978 | - $filter['operator'] = 'is'; |
|
| 978 | + $filter[ 'operator' ] = 'is'; |
|
| 979 | 979 | break; |
| 980 | 980 | |
| 981 | 981 | case 'post_category': |
@@ -989,7 +989,7 @@ discard block |
||
| 989 | 989 | |
| 990 | 990 | foreach ( $value as $val ) { |
| 991 | 991 | $cat = get_term( $val, 'category' ); |
| 992 | - $filter[] = array( |
|
| 992 | + $filter[ ] = array( |
|
| 993 | 993 | 'key' => $field_id, |
| 994 | 994 | 'value' => esc_attr( $cat->name ) . ':' . $val, |
| 995 | 995 | 'operator' => 'is', |
@@ -1008,7 +1008,7 @@ discard block |
||
| 1008 | 1008 | $filter = array(); |
| 1009 | 1009 | |
| 1010 | 1010 | foreach ( $value as $val ) { |
| 1011 | - $filter[] = array( 'key' => $field_id, 'value' => $val ); |
|
| 1011 | + $filter[ ] = array( 'key' => $field_id, 'value' => $val ); |
|
| 1012 | 1012 | } |
| 1013 | 1013 | |
| 1014 | 1014 | break; |
@@ -1017,9 +1017,9 @@ discard block |
||
| 1017 | 1017 | // convert checkbox on/off into the correct search filter |
| 1018 | 1018 | if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field->inputs ) && ! empty( $form_field->choices ) ) { |
| 1019 | 1019 | foreach ( $form_field->inputs as $k => $input ) { |
| 1020 | - if ( $input['id'] == $field_id ) { |
|
| 1021 | - $filter['value'] = $form_field->choices[ $k ]['value']; |
|
| 1022 | - $filter['operator'] = 'is'; |
|
| 1020 | + if ( $input[ 'id' ] == $field_id ) { |
|
| 1021 | + $filter[ 'value' ] = $form_field->choices[ $k ][ 'value' ]; |
|
| 1022 | + $filter[ 'operator' ] = 'is'; |
|
| 1023 | 1023 | break; |
| 1024 | 1024 | } |
| 1025 | 1025 | } |
@@ -1029,7 +1029,7 @@ discard block |
||
| 1029 | 1029 | $filter = array(); |
| 1030 | 1030 | |
| 1031 | 1031 | foreach ( $value as $val ) { |
| 1032 | - $filter[] = array( |
|
| 1032 | + $filter[ ] = array( |
|
| 1033 | 1033 | 'key' => $field_id, |
| 1034 | 1034 | 'value' => $val, |
| 1035 | 1035 | 'operator' => 'is', |
@@ -1050,9 +1050,9 @@ discard block |
||
| 1050 | 1050 | foreach ( $words as $word ) { |
| 1051 | 1051 | if ( ! empty( $word ) && strlen( $word ) > 1 ) { |
| 1052 | 1052 | // Keep the same key for each filter |
| 1053 | - $filter['value'] = $word; |
|
| 1053 | + $filter[ 'value' ] = $word; |
|
| 1054 | 1054 | // Add a search for the value |
| 1055 | - $filters[] = $filter; |
|
| 1055 | + $filters[ ] = $filter; |
|
| 1056 | 1056 | } |
| 1057 | 1057 | } |
| 1058 | 1058 | |
@@ -1066,19 +1066,19 @@ discard block |
||
| 1066 | 1066 | |
| 1067 | 1067 | foreach ( $searchable_fields as $searchable_field ) { |
| 1068 | 1068 | |
| 1069 | - if( $form_field->ID !== $searchable_field['field'] ) { |
|
| 1069 | + if ( $form_field->ID !== $searchable_field[ 'field' ] ) { |
|
| 1070 | 1070 | continue; |
| 1071 | 1071 | } |
| 1072 | 1072 | |
| 1073 | 1073 | // Only exact-match dropdowns, not text search |
| 1074 | - if( in_array( $searchable_field['input'], array( 'text', 'search' ), true ) ) { |
|
| 1074 | + if ( in_array( $searchable_field[ 'input' ], array( 'text', 'search' ), true ) ) { |
|
| 1075 | 1075 | continue; |
| 1076 | 1076 | } |
| 1077 | 1077 | |
| 1078 | 1078 | $input_id = gravityview_get_input_id_from_id( $form_field->ID ); |
| 1079 | 1079 | |
| 1080 | 1080 | if ( 4 === $input_id ) { |
| 1081 | - $filter['operator'] = 'is'; |
|
| 1081 | + $filter[ 'operator' ] = 'is'; |
|
| 1082 | 1082 | }; |
| 1083 | 1083 | } |
| 1084 | 1084 | } |
@@ -1105,12 +1105,12 @@ discard block |
||
| 1105 | 1105 | * @since 1.16.3 |
| 1106 | 1106 | * Safeguard until GF implements '<=' operator |
| 1107 | 1107 | */ |
| 1108 | - if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
| 1108 | + if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
| 1109 | 1109 | $operator = '<'; |
| 1110 | 1110 | $date = date( 'Y-m-d', strtotime( self::get_formatted_date( $date, 'Y-m-d', $date_format ) . ' +1 day' ) ); |
| 1111 | 1111 | } |
| 1112 | 1112 | |
| 1113 | - $filter[] = array( |
|
| 1113 | + $filter[ ] = array( |
|
| 1114 | 1114 | 'key' => $field_id, |
| 1115 | 1115 | 'value' => self::get_formatted_date( $date, 'Y-m-d', $date_format ), |
| 1116 | 1116 | 'operator' => $operator, |
@@ -1118,7 +1118,7 @@ discard block |
||
| 1118 | 1118 | } |
| 1119 | 1119 | } else { |
| 1120 | 1120 | $date = $value; |
| 1121 | - $filter['value'] = self::get_formatted_date( $date, 'Y-m-d', $date_format ); |
|
| 1121 | + $filter[ 'value' ] = self::get_formatted_date( $date, 'Y-m-d', $date_format ); |
|
| 1122 | 1122 | } |
| 1123 | 1123 | |
| 1124 | 1124 | break; |
@@ -1149,7 +1149,7 @@ discard block |
||
| 1149 | 1149 | 'ymd_dot' => 'Y.m.d', |
| 1150 | 1150 | ); |
| 1151 | 1151 | |
| 1152 | - if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){ |
|
| 1152 | + if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) { |
|
| 1153 | 1153 | $format = $datepicker[ $field->dateFormat ]; |
| 1154 | 1154 | } |
| 1155 | 1155 | |
@@ -1186,7 +1186,7 @@ discard block |
||
| 1186 | 1186 | public function add_template_path( $file_paths ) { |
| 1187 | 1187 | |
| 1188 | 1188 | // Index 100 is the default GravityView template path. |
| 1189 | - $file_paths[102] = self::$file . 'templates/'; |
|
| 1189 | + $file_paths[ 102 ] = self::$file . 'templates/'; |
|
| 1190 | 1190 | |
| 1191 | 1191 | return $file_paths; |
| 1192 | 1192 | } |
@@ -1205,7 +1205,7 @@ discard block |
||
| 1205 | 1205 | $has_date = false; |
| 1206 | 1206 | |
| 1207 | 1207 | foreach ( $search_fields as $k => $field ) { |
| 1208 | - if ( in_array( $field['input'], array( 'date', 'date_range', 'entry_date' ) ) ) { |
|
| 1208 | + if ( in_array( $field[ 'input' ], array( 'date', 'date_range', 'entry_date' ) ) ) { |
|
| 1209 | 1209 | $has_date = true; |
| 1210 | 1210 | break; |
| 1211 | 1211 | } |
@@ -1232,7 +1232,7 @@ discard block |
||
| 1232 | 1232 | } |
| 1233 | 1233 | |
| 1234 | 1234 | // get configured search fields |
| 1235 | - $search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : ''; |
|
| 1235 | + $search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : ''; |
|
| 1236 | 1236 | |
| 1237 | 1237 | if ( empty( $search_fields ) || ! is_array( $search_fields ) ) { |
| 1238 | 1238 | gravityview()->log->debug( 'No search fields configured for widget:', array( 'data' => $widget_args ) ); |
@@ -1247,40 +1247,40 @@ discard block |
||
| 1247 | 1247 | |
| 1248 | 1248 | $updated_field = $this->get_search_filter_details( $updated_field ); |
| 1249 | 1249 | |
| 1250 | - switch ( $field['field'] ) { |
|
| 1250 | + switch ( $field[ 'field' ] ) { |
|
| 1251 | 1251 | |
| 1252 | 1252 | case 'search_all': |
| 1253 | - $updated_field['key'] = 'search_all'; |
|
| 1254 | - $updated_field['input'] = 'search_all'; |
|
| 1255 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' ); |
|
| 1253 | + $updated_field[ 'key' ] = 'search_all'; |
|
| 1254 | + $updated_field[ 'input' ] = 'search_all'; |
|
| 1255 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' ); |
|
| 1256 | 1256 | break; |
| 1257 | 1257 | |
| 1258 | 1258 | case 'entry_date': |
| 1259 | - $updated_field['key'] = 'entry_date'; |
|
| 1260 | - $updated_field['input'] = 'entry_date'; |
|
| 1261 | - $updated_field['value'] = array( |
|
| 1259 | + $updated_field[ 'key' ] = 'entry_date'; |
|
| 1260 | + $updated_field[ 'input' ] = 'entry_date'; |
|
| 1261 | + $updated_field[ 'value' ] = array( |
|
| 1262 | 1262 | 'start' => $this->rgget_or_rgpost( 'gv_start' ), |
| 1263 | 1263 | 'end' => $this->rgget_or_rgpost( 'gv_end' ), |
| 1264 | 1264 | ); |
| 1265 | 1265 | break; |
| 1266 | 1266 | |
| 1267 | 1267 | case 'entry_id': |
| 1268 | - $updated_field['key'] = 'entry_id'; |
|
| 1269 | - $updated_field['input'] = 'entry_id'; |
|
| 1270 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' ); |
|
| 1268 | + $updated_field[ 'key' ] = 'entry_id'; |
|
| 1269 | + $updated_field[ 'input' ] = 'entry_id'; |
|
| 1270 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' ); |
|
| 1271 | 1271 | break; |
| 1272 | 1272 | |
| 1273 | 1273 | case 'created_by': |
| 1274 | - $updated_field['key'] = 'created_by'; |
|
| 1275 | - $updated_field['name'] = 'gv_by'; |
|
| 1276 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' ); |
|
| 1277 | - $updated_field['choices'] = self::get_created_by_choices(); |
|
| 1274 | + $updated_field[ 'key' ] = 'created_by'; |
|
| 1275 | + $updated_field[ 'name' ] = 'gv_by'; |
|
| 1276 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' ); |
|
| 1277 | + $updated_field[ 'choices' ] = self::get_created_by_choices(); |
|
| 1278 | 1278 | break; |
| 1279 | 1279 | |
| 1280 | 1280 | case 'is_approved': |
| 1281 | - $updated_field['key'] = 'is_approved'; |
|
| 1282 | - $updated_field['value'] = $this->rgget_or_rgpost( 'filter_is_approved' ); |
|
| 1283 | - $updated_field['choices'] = self::get_is_approved_choices(); |
|
| 1281 | + $updated_field[ 'key' ] = 'is_approved'; |
|
| 1282 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'filter_is_approved' ); |
|
| 1283 | + $updated_field[ 'choices' ] = self::get_is_approved_choices(); |
|
| 1284 | 1284 | break; |
| 1285 | 1285 | } |
| 1286 | 1286 | |
@@ -1299,16 +1299,16 @@ discard block |
||
| 1299 | 1299 | */ |
| 1300 | 1300 | $gravityview_view->search_fields = apply_filters( 'gravityview_widget_search_filters', $search_fields, $this, $widget_args, $context ); |
| 1301 | 1301 | |
| 1302 | - $gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal'; |
|
| 1302 | + $gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal'; |
|
| 1303 | 1303 | |
| 1304 | 1304 | /** @since 1.14 */ |
| 1305 | - $gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any'; |
|
| 1305 | + $gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any'; |
|
| 1306 | 1306 | |
| 1307 | - $custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
| 1307 | + $custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; |
|
| 1308 | 1308 | |
| 1309 | 1309 | $gravityview_view->search_class = self::get_search_class( $custom_class ); |
| 1310 | 1310 | |
| 1311 | - $gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false; |
|
| 1311 | + $gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false; |
|
| 1312 | 1312 | |
| 1313 | 1313 | if ( $this->has_date_field( $search_fields ) ) { |
| 1314 | 1314 | // enqueue datepicker stuff only if needed! |
@@ -1330,10 +1330,10 @@ discard block |
||
| 1330 | 1330 | public static function get_search_class( $custom_class = '' ) { |
| 1331 | 1331 | $gravityview_view = GravityView_View::getInstance(); |
| 1332 | 1332 | |
| 1333 | - $search_class = 'gv-search-'.$gravityview_view->search_layout; |
|
| 1333 | + $search_class = 'gv-search-' . $gravityview_view->search_layout; |
|
| 1334 | 1334 | |
| 1335 | - if ( ! empty( $custom_class ) ) { |
|
| 1336 | - $search_class .= ' '.$custom_class; |
|
| 1335 | + if ( ! empty( $custom_class ) ) { |
|
| 1336 | + $search_class .= ' ' . $custom_class; |
|
| 1337 | 1337 | } |
| 1338 | 1338 | |
| 1339 | 1339 | /** |
@@ -1377,9 +1377,9 @@ discard block |
||
| 1377 | 1377 | |
| 1378 | 1378 | if ( ! $label ) { |
| 1379 | 1379 | |
| 1380 | - $label = isset( $form_field['label'] ) ? $form_field['label'] : ''; |
|
| 1380 | + $label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : ''; |
|
| 1381 | 1381 | |
| 1382 | - switch( $field['field'] ) { |
|
| 1382 | + switch ( $field[ 'field' ] ) { |
|
| 1383 | 1383 | case 'search_all': |
| 1384 | 1384 | $label = __( 'Search Entries:', 'gravityview' ); |
| 1385 | 1385 | break; |
@@ -1391,10 +1391,10 @@ discard block |
||
| 1391 | 1391 | break; |
| 1392 | 1392 | default: |
| 1393 | 1393 | // If this is a field input, not a field |
| 1394 | - if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) { |
|
| 1394 | + if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) { |
|
| 1395 | 1395 | |
| 1396 | 1396 | // Get the label for the field in question, which returns an array |
| 1397 | - $items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) ); |
|
| 1397 | + $items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) ); |
|
| 1398 | 1398 | |
| 1399 | 1399 | // Get the item with the `label` key |
| 1400 | 1400 | $values = wp_list_pluck( $items, 'label' ); |
@@ -1433,32 +1433,32 @@ discard block |
||
| 1433 | 1433 | $form = $gravityview_view->getForm(); |
| 1434 | 1434 | |
| 1435 | 1435 | // for advanced field ids (eg, first name / last name ) |
| 1436 | - $name = 'filter_' . str_replace( '.', '_', $field['field'] ); |
|
| 1436 | + $name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] ); |
|
| 1437 | 1437 | |
| 1438 | 1438 | // get searched value from $_GET/$_POST (string or array) |
| 1439 | 1439 | $value = $this->rgget_or_rgpost( $name ); |
| 1440 | 1440 | |
| 1441 | 1441 | // get form field details |
| 1442 | - $form_field = gravityview_get_field( $form, $field['field'] ); |
|
| 1442 | + $form_field = gravityview_get_field( $form, $field[ 'field' ] ); |
|
| 1443 | 1443 | |
| 1444 | 1444 | $filter = array( |
| 1445 | - 'key' => $field['field'], |
|
| 1445 | + 'key' => $field[ 'field' ], |
|
| 1446 | 1446 | 'name' => $name, |
| 1447 | 1447 | 'label' => self::get_field_label( $field, $form_field ), |
| 1448 | - 'input' => $field['input'], |
|
| 1448 | + 'input' => $field[ 'input' ], |
|
| 1449 | 1449 | 'value' => $value, |
| 1450 | - 'type' => $form_field['type'], |
|
| 1450 | + 'type' => $form_field[ 'type' ], |
|
| 1451 | 1451 | ); |
| 1452 | 1452 | |
| 1453 | 1453 | // collect choices |
| 1454 | - if ( 'post_category' === $form_field['type'] && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) { |
|
| 1455 | - $filter['choices'] = gravityview_get_terms_choices(); |
|
| 1456 | - } elseif ( ! empty( $form_field['choices'] ) ) { |
|
| 1457 | - $filter['choices'] = $form_field['choices']; |
|
| 1454 | + if ( 'post_category' === $form_field[ 'type' ] && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) { |
|
| 1455 | + $filter[ 'choices' ] = gravityview_get_terms_choices(); |
|
| 1456 | + } elseif ( ! empty( $form_field[ 'choices' ] ) ) { |
|
| 1457 | + $filter[ 'choices' ] = $form_field[ 'choices' ]; |
|
| 1458 | 1458 | } |
| 1459 | 1459 | |
| 1460 | - if ( 'date_range' === $field['input'] && empty( $value ) ) { |
|
| 1461 | - $filter['value'] = array( 'start' => '', 'end' => '' ); |
|
| 1460 | + if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) { |
|
| 1461 | + $filter[ 'value' ] = array( 'start' => '', 'end' => '' ); |
|
| 1462 | 1462 | } |
| 1463 | 1463 | |
| 1464 | 1464 | return $filter; |
@@ -1482,7 +1482,7 @@ discard block |
||
| 1482 | 1482 | |
| 1483 | 1483 | $choices = array(); |
| 1484 | 1484 | foreach ( $users as $user ) { |
| 1485 | - $choices[] = array( |
|
| 1485 | + $choices[ ] = array( |
|
| 1486 | 1486 | 'value' => $user->ID, |
| 1487 | 1487 | 'text' => $user->display_name, |
| 1488 | 1488 | ); |
@@ -1502,9 +1502,9 @@ discard block |
||
| 1502 | 1502 | |
| 1503 | 1503 | $choices = array(); |
| 1504 | 1504 | foreach ( GravityView_Entry_Approval_Status::get_all() as $status ) { |
| 1505 | - $choices[] = array( |
|
| 1506 | - 'value' => $status['value'], |
|
| 1507 | - 'text' => $status['label'], |
|
| 1505 | + $choices[ ] = array( |
|
| 1506 | + 'value' => $status[ 'value' ], |
|
| 1507 | + 'text' => $status[ 'label' ], |
|
| 1508 | 1508 | ); |
| 1509 | 1509 | } |
| 1510 | 1510 | |
@@ -1556,7 +1556,7 @@ discard block |
||
| 1556 | 1556 | */ |
| 1557 | 1557 | public function add_datepicker_js_dependency( $js_dependencies ) { |
| 1558 | 1558 | |
| 1559 | - $js_dependencies[] = 'jquery-ui-datepicker'; |
|
| 1559 | + $js_dependencies[ ] = 'jquery-ui-datepicker'; |
|
| 1560 | 1560 | |
| 1561 | 1561 | return $js_dependencies; |
| 1562 | 1562 | } |
@@ -1600,7 +1600,7 @@ discard block |
||
| 1600 | 1600 | 'isRTL' => is_rtl(), |
| 1601 | 1601 | ), $view_data ); |
| 1602 | 1602 | |
| 1603 | - $localizations['datepicker'] = $datepicker_settings; |
|
| 1603 | + $localizations[ 'datepicker' ] = $datepicker_settings; |
|
| 1604 | 1604 | |
| 1605 | 1605 | return $localizations; |
| 1606 | 1606 | |
@@ -1627,7 +1627,7 @@ discard block |
||
| 1627 | 1627 | * @return void |
| 1628 | 1628 | */ |
| 1629 | 1629 | private function maybe_enqueue_flexibility() { |
| 1630 | - if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/MSIE [8-9]/', $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
| 1630 | + if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) && preg_match( '/MSIE [8-9]/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) { |
|
| 1631 | 1631 | wp_enqueue_script( 'gv-flexibility' ); |
| 1632 | 1632 | } |
| 1633 | 1633 | } |
@@ -1649,7 +1649,7 @@ discard block |
||
| 1649 | 1649 | add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 ); |
| 1650 | 1650 | |
| 1651 | 1651 | $scheme = is_ssl() ? 'https://' : 'http://'; |
| 1652 | - wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
| 1652 | + wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
| 1653 | 1653 | |
| 1654 | 1654 | /** |
| 1655 | 1655 | * @filter `gravityview_search_datepicker_class` |
@@ -1728,7 +1728,7 @@ discard block |
||
| 1728 | 1728 | public function add_preview_inputs() { |
| 1729 | 1729 | global $wp; |
| 1730 | 1730 | |
| 1731 | - if ( ! is_preview() || ! current_user_can( 'publish_gravityviews') ) { |
|
| 1731 | + if ( ! is_preview() || ! current_user_can( 'publish_gravityviews' ) ) { |
|
| 1732 | 1732 | return; |
| 1733 | 1733 | } |
| 1734 | 1734 | |
@@ -1753,7 +1753,7 @@ discard block |
||
| 1753 | 1753 | */ |
| 1754 | 1754 | class GravityView_Widget_Search_Author_GF_Query_Condition extends \GF_Query_Condition { |
| 1755 | 1755 | public function __construct( $filter, $view ) { |
| 1756 | - $this->value = $filter['value']; |
|
| 1756 | + $this->value = $filter[ 'value' ]; |
|
| 1757 | 1757 | $this->view = $view; |
| 1758 | 1758 | } |
| 1759 | 1759 | |
@@ -1785,11 +1785,11 @@ discard block |
||
| 1785 | 1785 | $conditions = array(); |
| 1786 | 1786 | |
| 1787 | 1787 | foreach ( $user_fields as $user_field ) { |
| 1788 | - $conditions[] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) . '%' ); |
|
| 1788 | + $conditions[ ] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) . '%' ); |
|
| 1789 | 1789 | } |
| 1790 | 1790 | |
| 1791 | 1791 | foreach ( $user_meta_fields as $meta_field ) { |
| 1792 | - $conditions[] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) . '%' ); |
|
| 1792 | + $conditions[ ] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) . '%' ); |
|
| 1793 | 1793 | } |
| 1794 | 1794 | |
| 1795 | 1795 | $conditions = '(' . implode( ' OR ', $conditions ) . ')'; |
@@ -1818,9 +1818,9 @@ discard block |
||
| 1818 | 1818 | |
| 1819 | 1819 | $conditions = array(); |
| 1820 | 1820 | |
| 1821 | - foreach ( $parameters['aliases'] as $key => $alias ) { |
|
| 1822 | - if ( 'm' == $alias[0] && preg_match( '#\d+_\d+#', $key ) ) { |
|
| 1823 | - $conditions[] = sprintf( "EXISTS(SELECT * FROM `$table` WHERE `meta_value` %s %s AND `entry_id` = `%s`.`entry_id`)", |
|
| 1821 | + foreach ( $parameters[ 'aliases' ] as $key => $alias ) { |
|
| 1822 | + if ( 'm' == $alias[ 0 ] && preg_match( '#\d+_\d+#', $key ) ) { |
|
| 1823 | + $conditions[ ] = sprintf( "EXISTS(SELECT * FROM `$table` WHERE `meta_value` %s %s AND `entry_id` = `%s`.`entry_id`)", |
|
| 1824 | 1824 | $this->search_condition->operator, $this->search_condition->right->sql( $query ), $alias ); |
| 1825 | 1825 | } |
| 1826 | 1826 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | public static function get_instance() { |
| 89 | 89 | |
| 90 | - if( empty( self::$instance ) ) { |
|
| 90 | + if ( empty( self::$instance ) ) { |
|
| 91 | 91 | self::$instance = new self; |
| 92 | 92 | } |
| 93 | 93 | |
@@ -121,9 +121,9 @@ discard block |
||
| 121 | 121 | |
| 122 | 122 | $operators = array_merge( self::$SUPPORTED_ARRAY_OPERATORS, self::$SUPPORTED_NUMERIC_OPERATORS, self::$SUPPORTED_SCALAR_OPERATORS, self::$SUPPORTED_CUSTOM_OPERATORS ); |
| 123 | 123 | |
| 124 | - if( $with_values ) { |
|
| 124 | + if ( $with_values ) { |
|
| 125 | 125 | $operators_with_values = array(); |
| 126 | - foreach( $operators as $key ) { |
|
| 126 | + foreach ( $operators as $key ) { |
|
| 127 | 127 | $operators_with_values[ $key ] = ''; |
| 128 | 128 | } |
| 129 | 129 | return $operators_with_values; |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | $operators = $this->get_operators( false ); |
| 144 | 144 | |
| 145 | - if( !in_array( $operation, $operators ) ) { |
|
| 145 | + if ( ! in_array( $operation, $operators ) ) { |
|
| 146 | 146 | gravityview()->log->debug( ' Attempted to add invalid operation type. {operation}', array( 'operation' => $operation ) ); |
| 147 | 147 | return false; |
| 148 | 148 | } |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | return null; |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | - if( empty( $atts ) ) { |
|
| 197 | + if ( empty( $atts ) ) { |
|
| 198 | 198 | gravityview()->log->error( '$atts are empty.', array( 'data' => $atts ) ); |
| 199 | 199 | return null; |
| 200 | 200 | } |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | $this->parse_atts(); |
| 210 | 210 | |
| 211 | 211 | // We need an "if" |
| 212 | - if( false === $this->if ) { |
|
| 212 | + if ( false === $this->if ) { |
|
| 213 | 213 | gravityview()->log->error( '$atts->if is empty.', array( 'data' => $this->passed_atts ) ); |
| 214 | 214 | return null; |
| 215 | 215 | } |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | $setup = $this->setup_operation_and_comparison(); |
| 218 | 218 | |
| 219 | 219 | // We need an operation and comparison value |
| 220 | - if( ! $setup ) { |
|
| 220 | + if ( ! $setup ) { |
|
| 221 | 221 | gravityview()->log->error( 'No valid operators were passed.', array( 'data' => $this->atts ) ); |
| 222 | 222 | return null; |
| 223 | 223 | } |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | */ |
| 268 | 268 | private function get_output() { |
| 269 | 269 | |
| 270 | - if( $this->is_match ) { |
|
| 270 | + if ( $this->is_match ) { |
|
| 271 | 271 | $output = $this->content; |
| 272 | 272 | } else { |
| 273 | 273 | $output = $this->else_content; |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | * @param string $output HTML/text output |
| 286 | 286 | * @param GVLogic_Shortcode $this This class |
| 287 | 287 | */ |
| 288 | - $output = apply_filters('gravityview/gvlogic/output', $output, $this ); |
|
| 288 | + $output = apply_filters( 'gravityview/gvlogic/output', $output, $this ); |
|
| 289 | 289 | |
| 290 | 290 | gravityview()->log->debug( 'Output: ', array( 'data' => $output ) ); |
| 291 | 291 | |
@@ -305,14 +305,14 @@ discard block |
||
| 305 | 305 | list( $before_else, $after_else ) = array_pad( explode( '[else]', $passed_content ), 2, NULL ); |
| 306 | 306 | list( $before_else_if, $after_else_if ) = array_pad( explode( '[else', $passed_content ), 2, NULL ); |
| 307 | 307 | |
| 308 | - $else_attr = isset( $this->atts['else'] ) ? $this->atts['else'] : NULL; |
|
| 308 | + $else_attr = isset( $this->atts[ 'else' ] ) ? $this->atts[ 'else' ] : NULL; |
|
| 309 | 309 | $else_content = isset( $after_else ) ? $after_else : $else_attr; |
| 310 | 310 | |
| 311 | 311 | // The content is everything OTHER than the [else] |
| 312 | 312 | $this->content = $before_else_if; |
| 313 | 313 | |
| 314 | 314 | if ( ! $this->is_match ) { |
| 315 | - if( $elseif_content = $this->process_elseif( $before_else ) ) { |
|
| 315 | + if ( $elseif_content = $this->process_elseif( $before_else ) ) { |
|
| 316 | 316 | $this->else_content = $elseif_content; |
| 317 | 317 | } else { |
| 318 | 318 | $this->else_content = $else_content; |
@@ -340,16 +340,16 @@ discard block |
||
| 340 | 340 | foreach ( $else_if_matches as $key => $else_if_match ) { |
| 341 | 341 | |
| 342 | 342 | // If $else_if_match[5] exists and has content, check for more shortcodes |
| 343 | - preg_match_all( '/' . $regex . '/', $else_if_match[5] . '[/else]', $recursive_matches, PREG_SET_ORDER ); |
|
| 343 | + preg_match_all( '/' . $regex . '/', $else_if_match[ 5 ] . '[/else]', $recursive_matches, PREG_SET_ORDER ); |
|
| 344 | 344 | |
| 345 | 345 | // If the logic passes, this is the value that should be used for $this->else_content |
| 346 | - $else_if_value = $else_if_match[5]; |
|
| 347 | - $check_elseif_match = $else_if_match[0]; |
|
| 346 | + $else_if_value = $else_if_match[ 5 ]; |
|
| 347 | + $check_elseif_match = $else_if_match[ 0 ]; |
|
| 348 | 348 | |
| 349 | 349 | // Retrieve the value of the match that is currently being checked, without any other [else] tags |
| 350 | - if( ! empty( $recursive_matches[0][0] ) ) { |
|
| 351 | - $else_if_value = str_replace( $recursive_matches[0][0], '', $else_if_value ); |
|
| 352 | - $check_elseif_match = str_replace( $recursive_matches[0][0], '', $check_elseif_match ); |
|
| 350 | + if ( ! empty( $recursive_matches[ 0 ][ 0 ] ) ) { |
|
| 351 | + $else_if_value = str_replace( $recursive_matches[ 0 ][ 0 ], '', $else_if_value ); |
|
| 352 | + $check_elseif_match = str_replace( $recursive_matches[ 0 ][ 0 ], '', $check_elseif_match ); |
|
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | $check_elseif_match = str_replace( '[else', '[gvlogicelse', $check_elseif_match ); |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | // Process any remaining [else] tags |
| 369 | - return $this->process_elseif( $else_if_match[5] ); |
|
| 369 | + return $this->process_elseif( $else_if_match[ 5 ] ); |
|
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | return false; |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | $this->atts = array_intersect_key( $this->passed_atts, $this->atts ); |
| 393 | 393 | |
| 394 | 394 | // Strip whitespace if it's not default false |
| 395 | - $this->if = ( isset( $this->atts['if'] ) && is_string( $this->atts['if'] ) ) ? trim( $this->atts['if'] ) : false; |
|
| 395 | + $this->if = ( isset( $this->atts[ 'if' ] ) && is_string( $this->atts[ 'if' ] ) ) ? trim( $this->atts[ 'if' ] ) : false; |
|
| 396 | 396 | |
| 397 | 397 | /** |
| 398 | 398 | * @action `gravityview/gvlogic/parse_atts/after` Modify shortcode attributes after it's been parsed |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | do_action( 'gravityview/gvlogic/parse_atts/after', $this ); |
| 404 | 404 | |
| 405 | 405 | // Make sure the "if" isn't processed in self::setup_operation_and_comparison() |
| 406 | - unset( $this->atts['if'] ); |
|
| 406 | + unset( $this->atts[ 'if' ] ); |
|
| 407 | 407 | } |
| 408 | 408 | } |
| 409 | 409 | |
@@ -84,7 +84,7 @@ |
||
| 84 | 84 | * @see \Gamajo_Template_Loader::set_template_data |
| 85 | 85 | * @see \GV\Template::pop_template_data |
| 86 | 86 | * |
| 87 | - * @return \Gamajo_Template_Loader The current instance. |
|
| 87 | + * @return Template The current instance. |
|
| 88 | 88 | */ |
| 89 | 89 | public function push_template_data( $data, $var_name = 'data' ) { |
| 90 | 90 | if ( ! isset( self::$data_stack[ $var_name ] ) ) { |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | function modify_entry_value_workflow_final_status( $output, $entry, $field_settings, $field ) { |
| 43 | 43 | |
| 44 | - if( ! empty( $output ) ) { |
|
| 44 | + if ( ! empty( $output ) ) { |
|
| 45 | 45 | $output = gravity_flow()->translate_status_label( $output ); |
| 46 | 46 | } |
| 47 | 47 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | foreach ( $search_fields as & $search_field ) { |
| 66 | 66 | if ( $this->name === \GV\Utils::get( $search_field, 'key' ) ) { |
| 67 | - $search_field['choices'] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options(); |
|
| 67 | + $search_field[ 'choices' ] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options(); |
|
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | |
@@ -26,11 +26,11 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | <?php |
| 28 | 28 | |
| 29 | - do_action('gravityview_render_widgets_active_areas', $curr_template, 'footer', $post->ID ); |
|
| 29 | + do_action('gravityview_render_widgets_active_areas', $curr_template, 'footer', $post->ID ); |
|
| 30 | 30 | |
| 31 | - do_action('gravityview_render_field_pickers', 'directory' ); |
|
| 31 | + do_action('gravityview_render_field_pickers', 'directory' ); |
|
| 32 | 32 | |
| 33 | - ?> |
|
| 33 | + ?> |
|
| 34 | 34 | |
| 35 | 35 | <?php // list of available widgets to be shown in the popup ?> |
| 36 | 36 | <div id="directory-available-widgets" class="hide-if-js gv-tooltip"> |
@@ -55,13 +55,13 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | <div id="single-active-fields" class="gv-grid gv-grid-pad gv-grid-border"> |
| 57 | 57 | <?php |
| 58 | - if(!empty( $curr_template ) ) { |
|
| 59 | - do_action('gravityview_render_directory_active_areas', $curr_template, 'single', $post->ID, true ); |
|
| 60 | - } |
|
| 61 | - ?> |
|
| 58 | + if(!empty( $curr_template ) ) { |
|
| 59 | + do_action('gravityview_render_directory_active_areas', $curr_template, 'single', $post->ID, true ); |
|
| 60 | + } |
|
| 61 | + ?> |
|
| 62 | 62 | </div> |
| 63 | 63 | <?php |
| 64 | - do_action('gravityview_render_field_pickers', 'single' ); |
|
| 64 | + do_action('gravityview_render_field_pickers', 'single' ); |
|
| 65 | 65 | ?> |
| 66 | 66 | </div> |
| 67 | 67 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | </div> |
| 81 | 81 | |
| 82 | 82 | <?php |
| 83 | - do_action('gravityview_render_field_pickers', 'edit' ); |
|
| 83 | + do_action('gravityview_render_field_pickers', 'edit' ); |
|
| 84 | 84 | ?> |
| 85 | 85 | |
| 86 | 86 | </div> |
@@ -10,32 +10,32 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | <div id="directory-fields" class="gv-section"> |
| 12 | 12 | |
| 13 | - <h4><?php esc_html_e( 'Above Entries Widgets', 'gravityview'); ?> <span><?php esc_html_e( 'These widgets will be shown above entries.', 'gravityview'); ?></span></h4> |
|
| 13 | + <h4><?php esc_html_e( 'Above Entries Widgets', 'gravityview' ); ?> <span><?php esc_html_e( 'These widgets will be shown above entries.', 'gravityview' ); ?></span></h4> |
|
| 14 | 14 | |
| 15 | - <?php do_action('gravityview_render_widgets_active_areas', $curr_template, 'header', $post->ID ); ?> |
|
| 15 | + <?php do_action( 'gravityview_render_widgets_active_areas', $curr_template, 'header', $post->ID ); ?> |
|
| 16 | 16 | |
| 17 | - <h4><?php esc_html_e( 'Entries Fields', 'gravityview'); ?> <span><?php esc_html_e( 'These fields will be shown for each entry.', 'gravityview'); ?></span></h4> |
|
| 17 | + <h4><?php esc_html_e( 'Entries Fields', 'gravityview' ); ?> <span><?php esc_html_e( 'These fields will be shown for each entry.', 'gravityview' ); ?></span></h4> |
|
| 18 | 18 | |
| 19 | 19 | <div id="directory-active-fields" class="gv-grid gv-grid-pad gv-grid-border"> |
| 20 | - <?php if(!empty( $curr_template ) ) { |
|
| 21 | - do_action('gravityview_render_directory_active_areas', $curr_template, 'directory', $post->ID, true ); |
|
| 20 | + <?php if ( ! empty( $curr_template ) ) { |
|
| 21 | + do_action( 'gravityview_render_directory_active_areas', $curr_template, 'directory', $post->ID, true ); |
|
| 22 | 22 | } ?> |
| 23 | 23 | </div> |
| 24 | 24 | |
| 25 | - <h4><?php esc_html_e( 'Below Entries Widgets', 'gravityview'); ?> <span><?php esc_html_e( 'These widgets will be shown below entries.', 'gravityview'); ?></span></h4> |
|
| 25 | + <h4><?php esc_html_e( 'Below Entries Widgets', 'gravityview' ); ?> <span><?php esc_html_e( 'These widgets will be shown below entries.', 'gravityview' ); ?></span></h4> |
|
| 26 | 26 | |
| 27 | 27 | <?php |
| 28 | 28 | |
| 29 | - do_action('gravityview_render_widgets_active_areas', $curr_template, 'footer', $post->ID ); |
|
| 29 | + do_action( 'gravityview_render_widgets_active_areas', $curr_template, 'footer', $post->ID ); |
|
| 30 | 30 | |
| 31 | - do_action('gravityview_render_field_pickers', 'directory' ); |
|
| 31 | + do_action( 'gravityview_render_field_pickers', 'directory' ); |
|
| 32 | 32 | |
| 33 | 33 | ?> |
| 34 | 34 | |
| 35 | 35 | <?php // list of available widgets to be shown in the popup ?> |
| 36 | 36 | <div id="directory-available-widgets" class="hide-if-js gv-tooltip"> |
| 37 | 37 | <span class="close"><i class="dashicons dashicons-dismiss"></i></span> |
| 38 | - <?php do_action('gravityview_render_available_widgets' ); ?> |
|
| 38 | + <?php do_action( 'gravityview_render_available_widgets' ); ?> |
|
| 39 | 39 | </div> |
| 40 | 40 | |
| 41 | 41 | </div> |
@@ -51,17 +51,17 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | <div id="single-fields" class="gv-section"> |
| 53 | 53 | |
| 54 | - <h4><?php esc_html_e( 'These fields will be shown in Single Entry view.', 'gravityview'); ?></h4> |
|
| 54 | + <h4><?php esc_html_e( 'These fields will be shown in Single Entry view.', 'gravityview' ); ?></h4> |
|
| 55 | 55 | |
| 56 | 56 | <div id="single-active-fields" class="gv-grid gv-grid-pad gv-grid-border"> |
| 57 | 57 | <?php |
| 58 | - if(!empty( $curr_template ) ) { |
|
| 59 | - do_action('gravityview_render_directory_active_areas', $curr_template, 'single', $post->ID, true ); |
|
| 58 | + if ( ! empty( $curr_template ) ) { |
|
| 59 | + do_action( 'gravityview_render_directory_active_areas', $curr_template, 'single', $post->ID, true ); |
|
| 60 | 60 | } |
| 61 | 61 | ?> |
| 62 | 62 | </div> |
| 63 | 63 | <?php |
| 64 | - do_action('gravityview_render_field_pickers', 'single' ); |
|
| 64 | + do_action( 'gravityview_render_field_pickers', 'single' ); |
|
| 65 | 65 | ?> |
| 66 | 66 | </div> |
| 67 | 67 | |
@@ -71,16 +71,16 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | <div id="edit-fields" class="gv-section"> |
| 73 | 73 | |
| 74 | - <h4><?php esc_html_e( 'Fields shown when editing an entry.', 'gravityview'); ?> <span><?php esc_html_e('If not configured, all form fields will be displayed.', 'gravityview'); ?></span></h4> |
|
| 74 | + <h4><?php esc_html_e( 'Fields shown when editing an entry.', 'gravityview' ); ?> <span><?php esc_html_e( 'If not configured, all form fields will be displayed.', 'gravityview' ); ?></span></h4> |
|
| 75 | 75 | |
| 76 | 76 | <div id="edit-active-fields" class="gv-grid gv-grid-pad gv-grid-border"> |
| 77 | 77 | <?php |
| 78 | - do_action('gravityview_render_directory_active_areas', apply_filters( 'gravityview/template/edit', 'default_table_edit' ), 'edit', $post->ID, true ); |
|
| 78 | + do_action( 'gravityview_render_directory_active_areas', apply_filters( 'gravityview/template/edit', 'default_table_edit' ), 'edit', $post->ID, true ); |
|
| 79 | 79 | ?> |
| 80 | 80 | </div> |
| 81 | 81 | |
| 82 | 82 | <?php |
| 83 | - do_action('gravityview_render_field_pickers', 'edit' ); |
|
| 83 | + do_action( 'gravityview_render_field_pickers', 'edit' ); |
|
| 84 | 84 | ?> |
| 85 | 85 | |
| 86 | 86 | </div> |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | /** |
| 85 | 85 | * @var string The REST API functionality identifier. |
| 86 | 86 | */ |
| 87 | - const FEATURE_REST = 'rest_api'; |
|
| 87 | + const FEATURE_REST = 'rest_api'; |
|
| 88 | 88 | |
| 89 | 89 | /** |
| 90 | 90 | * Get the global instance of \GV\Plugin. |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | include_once $this->dir( 'includes/class-frontend-views.php' ); |
| 211 | 211 | include_once $this->dir( 'includes/class-gravityview-admin-bar.php' ); |
| 212 | 212 | include_once $this->dir( 'includes/class-gravityview-entry-list.php' ); |
| 213 | - include_once $this->dir( 'includes/class-gravityview-merge-tags.php'); /** @since 1.8.4 */ |
|
| 213 | + include_once $this->dir( 'includes/class-gravityview-merge-tags.php' ); /** @since 1.8.4 */ |
|
| 214 | 214 | include_once $this->dir( 'includes/class-data.php' ); |
| 215 | 215 | include_once $this->dir( 'includes/class-gravityview-shortcode.php' ); |
| 216 | 216 | include_once $this->dir( 'includes/class-gravityview-entry-link-shortcode.php' ); |
@@ -244,12 +244,12 @@ discard block |
||
| 244 | 244 | |
| 245 | 245 | $locale = get_locale(); |
| 246 | 246 | |
| 247 | - if ( function_exists('get_user_locale') && is_admin() ) { |
|
| 247 | + if ( function_exists( 'get_user_locale' ) && is_admin() ) { |
|
| 248 | 248 | $locale = get_user_locale(); |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | $locale = apply_filters( 'plugin_locale', $locale, 'gravityview' ); |
| 252 | - $mofile = $this->dir( 'languages' ) . '/gravityview-'. $locale .'.mo'; |
|
| 252 | + $mofile = $this->dir( 'languages' ) . '/gravityview-' . $locale . '.mo'; |
|
| 253 | 253 | load_textdomain( 'gravityview', $mofile ); |
| 254 | 254 | } |
| 255 | 255 | } |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | */ |
| 383 | 383 | public function is_compatible_wordpress( $version = null ) { |
| 384 | 384 | |
| 385 | - if( ! $version ) { |
|
| 385 | + if ( ! $version ) { |
|
| 386 | 386 | $version = self::$min_wp_version; |
| 387 | 387 | } |
| 388 | 388 | |
@@ -423,8 +423,8 @@ discard block |
||
| 423 | 423 | * @return string The version of PHP. |
| 424 | 424 | */ |
| 425 | 425 | private function get_php_version() { |
| 426 | - return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] ) ? |
|
| 427 | - $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] : phpversion(); |
|
| 426 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] ) ? |
|
| 427 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] : phpversion(); |
|
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | /** |
@@ -435,8 +435,8 @@ discard block |
||
| 435 | 435 | * @return string The version of WordPress. |
| 436 | 436 | */ |
| 437 | 437 | private function get_wordpress_version() { |
| 438 | - return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] ) ? |
|
| 439 | - $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] : $GLOBALS['wp_version']; |
|
| 438 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] ) ? |
|
| 439 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] : $GLOBALS[ 'wp_version' ]; |
|
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | /** |
@@ -447,13 +447,13 @@ discard block |
||
| 447 | 447 | * @return string|null The version of Gravity Forms or null if inactive. |
| 448 | 448 | */ |
| 449 | 449 | private function get_gravityforms_version() { |
| 450 | - if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE'] ) ) { |
|
| 450 | + if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE' ] ) ) { |
|
| 451 | 451 | gravityview()->log->error( 'Gravity Forms is inactive or not installed.' ); |
| 452 | 452 | return null; |
| 453 | 453 | } |
| 454 | 454 | |
| 455 | - return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] ) ? |
|
| 456 | - $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] : \GFCommon::$version; |
|
| 455 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] ) ? |
|
| 456 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] : \GFCommon::$version; |
|
| 457 | 457 | } |
| 458 | 458 | |
| 459 | 459 | /** |
@@ -509,9 +509,9 @@ discard block |
||
| 509 | 509 | $tables = array(); |
| 510 | 510 | |
| 511 | 511 | if ( version_compare( \GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) ) { |
| 512 | - $tables []= \GFFormsModel::get_entry_meta_table_name(); |
|
| 512 | + $tables [ ] = \GFFormsModel::get_entry_meta_table_name(); |
|
| 513 | 513 | } |
| 514 | - $tables []= \GFFormsModel::get_lead_meta_table_name(); |
|
| 514 | + $tables [ ] = \GFFormsModel::get_lead_meta_table_name(); |
|
| 515 | 515 | |
| 516 | 516 | foreach ( $tables as $meta_table ) { |
| 517 | 517 | $sql = " |
@@ -529,13 +529,13 @@ discard block |
||
| 529 | 529 | $tables = array(); |
| 530 | 530 | |
| 531 | 531 | if ( version_compare( \GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_notes_table_name' ) ) { |
| 532 | - $tables[] = \GFFormsModel::get_entry_notes_table_name(); |
|
| 532 | + $tables[ ] = \GFFormsModel::get_entry_notes_table_name(); |
|
| 533 | 533 | } |
| 534 | 534 | |
| 535 | - $tables[] = \GFFormsModel::get_lead_notes_table_name(); |
|
| 535 | + $tables[ ] = \GFFormsModel::get_lead_notes_table_name(); |
|
| 536 | 536 | |
| 537 | - $disapproved = __('Disapproved the Entry for GravityView', 'gravityview'); |
|
| 538 | - $approved = __('Approved the Entry for GravityView', 'gravityview'); |
|
| 537 | + $disapproved = __( 'Disapproved the Entry for GravityView', 'gravityview' ); |
|
| 538 | + $approved = __( 'Approved the Entry for GravityView', 'gravityview' ); |
|
| 539 | 539 | |
| 540 | 540 | $suppress = $wpdb->suppress_errors(); |
| 541 | 541 | foreach ( $tables as $notes_table ) { |