@@ -55,10 +55,10 @@ |
||
55 | 55 | $search_criteria[ $key ] = $field_filters; |
56 | 56 | } |
57 | 57 | |
58 | - if ( ! empty( $b[ $key ]['mode'] ) ) { |
|
59 | - $search_criteria[ $key ]['mode' ] = $b[ $key ]['mode']; |
|
60 | - } else if ( ! empty( $a[ $key ]['mode'] ) ) { |
|
61 | - $search_criteria[ $key ]['mode' ] = $a[ $key ]['mode']; |
|
58 | + if ( ! empty( $b[ $key ][ 'mode' ] ) ) { |
|
59 | + $search_criteria[ $key ][ 'mode' ] = $b[ $key ][ 'mode' ]; |
|
60 | + } else if ( ! empty( $a[ $key ][ 'mode' ] ) ) { |
|
61 | + $search_criteria[ $key ][ 'mode' ] = $a[ $key ][ 'mode' ]; |
|
62 | 62 | } |
63 | 63 | break; |
64 | 64 | case 'start_date': |
@@ -42,14 +42,14 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public static function by_id( $form_id ) { |
44 | 44 | $form = \GFAPI::get_form( $form_id ); |
45 | - if ( !$form ) { |
|
45 | + if ( ! $form ) { |
|
46 | 46 | return null; |
47 | 47 | } |
48 | 48 | |
49 | 49 | $self = new self(); |
50 | 50 | $self->form = $form; |
51 | 51 | |
52 | - $self->ID = $self->form['id']; |
|
52 | + $self->ID = $self->form[ 'id' ]; |
|
53 | 53 | |
54 | 54 | return $self; |
55 | 55 | } |
@@ -91,15 +91,15 @@ discard block |
||
91 | 91 | |
92 | 92 | /** The offset and limit */ |
93 | 93 | if ( ! empty( $offset->limit ) ) { |
94 | - $paging['page_size'] = $offset->limit; |
|
94 | + $paging[ 'page_size' ] = $offset->limit; |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | if ( ! empty( $offset->offset ) ) { |
98 | - $paging['offset'] = $offset->offset; |
|
98 | + $paging[ 'offset' ] = $offset->offset; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | foreach ( \GFAPI::get_entries( $form->ID, $search_criteria, $sorting, $paging ) as $entry ) { |
102 | - $entries->add( \GV\GF_Entry::by_id( $entry['id'] ) ); |
|
102 | + $entries->add( \GV\GF_Entry::by_id( $entry[ 'id' ] ) ); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | return $entries; |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * @return bool Whether the offset exists or not. |
132 | 132 | */ |
133 | 133 | public function offsetExists( $offset ) { |
134 | - return isset( $this->form[$offset] ); |
|
134 | + return isset( $this->form[ $offset ] ); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @return mixed The value of the requested form data. |
149 | 149 | */ |
150 | 150 | public function offsetGet( $offset ) { |
151 | - return $this->form[$offset]; |
|
151 | + return $this->form[ $offset ]; |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | /** |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @return void |
27 | 27 | */ |
28 | 28 | public function set( $key, $value ) { |
29 | - $this->settings[$key] = $value; |
|
29 | + $this->settings[ $key ] = $value; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @return mixed|null |
41 | 41 | */ |
42 | 42 | public function get( $key, $default = null ) { |
43 | - return isset( $this->settings[$key] ) ? $this->settings[$key] : $default; |
|
43 | + return isset( $this->settings[ $key ] ) ? $this->settings[ $key ] : $default; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -144,19 +144,19 @@ |
||
144 | 144 | public function from_configuration( $configuration ) { |
145 | 145 | $configuration = wp_parse_args( $configuration, $this->as_configuration() ); |
146 | 146 | |
147 | - $this->ID = $configuration['id']; |
|
148 | - $this->label = $configuration['label']; |
|
149 | - $this->show_label = $configuration['show_label'] == '1'; |
|
150 | - $this->custom_label = $configuration['custom_label']; |
|
151 | - $this->custom_class = $configuration['custom_class']; |
|
152 | - $this->cap = $configuration['only_loggedin'] == '1' ? $configuration['only_loggedin_cap'] : ''; |
|
153 | - $this->search_filter = $configuration['search_filter'] == '1'; |
|
154 | - $this->show_as_link = $configuration['show_as_link'] == '1'; |
|
147 | + $this->ID = $configuration[ 'id' ]; |
|
148 | + $this->label = $configuration[ 'label' ]; |
|
149 | + $this->show_label = $configuration[ 'show_label' ] == '1'; |
|
150 | + $this->custom_label = $configuration[ 'custom_label' ]; |
|
151 | + $this->custom_class = $configuration[ 'custom_class' ]; |
|
152 | + $this->cap = $configuration[ 'only_loggedin' ] == '1' ? $configuration[ 'only_loggedin_cap' ] : ''; |
|
153 | + $this->search_filter = $configuration[ 'search_filter' ] == '1'; |
|
154 | + $this->show_as_link = $configuration[ 'show_as_link' ] == '1'; |
|
155 | 155 | |
156 | 156 | /** Shared among all field types (sort of). */ |
157 | 157 | $shared_configuration_keys = array( |
158 | 158 | 'id', 'label', 'show_label', 'custom_label', 'custom_class', |
159 | - 'only_loggedin' ,'only_loggedin_cap', 'search_filter', 'show_as_link', |
|
159 | + 'only_loggedin', 'only_loggedin_cap', 'search_filter', 'show_as_link', |
|
160 | 160 | ); |
161 | 161 | |
162 | 162 | /** Everything else goes into the properties for now. @todo subclasses! */ |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | public function set_template_data( array $data, $var_name = 'data' ) { |
118 | 118 | global $wp_query; |
119 | 119 | |
120 | - $wp_query->query_vars[ $var_name ] = (object) $data; |
|
120 | + $wp_query->query_vars[ $var_name ] = (object)$data; |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -130,8 +130,8 @@ discard block |
||
130 | 130 | public function unset_template_data() { |
131 | 131 | global $wp_query; |
132 | 132 | |
133 | - if ( isset( $wp_query->query_vars['data'] ) ) { |
|
134 | - unset( $wp_query->query_vars['data'] ); |
|
133 | + if ( isset( $wp_query->query_vars[ 'data' ] ) ) { |
|
134 | + unset( $wp_query->query_vars[ 'data' ] ); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
@@ -148,9 +148,9 @@ discard block |
||
148 | 148 | protected function get_template_file_names( $slug, $name ) { |
149 | 149 | $templates = array(); |
150 | 150 | if ( isset( $name ) ) { |
151 | - $templates[] = $slug . '-' . $name . '.php'; |
|
151 | + $templates[ ] = $slug . '-' . $name . '.php'; |
|
152 | 152 | } |
153 | - $templates[] = $slug . '.php'; |
|
153 | + $templates[ ] = $slug . '.php'; |
|
154 | 154 | |
155 | 155 | /** |
156 | 156 | * Allow template choices to be filtered. |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $located = false; |
189 | 189 | |
190 | 190 | // Remove empty entries. |
191 | - $template_names = array_filter( (array) $template_names ); |
|
191 | + $template_names = array_filter( (array)$template_names ); |
|
192 | 192 | $template_paths = $this->get_template_paths(); |
193 | 193 | |
194 | 194 | // Try to find a template file. |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | |
234 | 234 | // Only add this conditionally, so non-child themes don't redundantly check active theme twice. |
235 | 235 | if ( is_child_theme() ) { |
236 | - $file_paths[1] = trailingslashit( get_stylesheet_directory() ) . $theme_directory; |
|
236 | + $file_paths[ 1 ] = trailingslashit( get_stylesheet_directory() ) . $theme_directory; |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | /** |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | /** |
82 | 82 | * @see RGFormsModel::update_lead_property() Trigger when any entry property changes |
83 | 83 | */ |
84 | - foreach( $this->lead_db_columns as $column ) { |
|
84 | + foreach ( $this->lead_db_columns as $column ) { |
|
85 | 85 | add_action( 'gform_update_' . $column, array( $this, 'entry_status_changed' ), 10, 3 ); |
86 | 86 | } |
87 | 87 | |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | return; |
115 | 115 | } |
116 | 116 | |
117 | - do_action( 'gravityview_log_debug', __METHOD__ . ' adding form ' . $entry['form_id'] . ' to blacklist because entry #' . $lead_id . ' was deleted', array( 'value' => $property_value, 'previous' => $previous_value ) ); |
|
117 | + do_action( 'gravityview_log_debug', __METHOD__ . ' adding form ' . $entry[ 'form_id' ] . ' to blacklist because entry #' . $lead_id . ' was deleted', array( 'value' => $property_value, 'previous' => $previous_value ) ); |
|
118 | 118 | |
119 | - $this->blacklist_add( $entry['form_id'] ); |
|
119 | + $this->blacklist_add( $entry[ 'form_id' ] ); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -129,9 +129,9 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function entry_updated( $form, $lead_id ) { |
131 | 131 | |
132 | - do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_updated] adding form ' . $form['id'] . ' to blacklist because entry #' . $lead_id . ' was updated' ); |
|
132 | + do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_updated] adding form ' . $form[ 'id' ] . ' to blacklist because entry #' . $lead_id . ' was updated' ); |
|
133 | 133 | |
134 | - $this->blacklist_add( $form['id'] ); |
|
134 | + $this->blacklist_add( $form[ 'id' ] ); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -146,9 +146,9 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function entry_created( $entry, $form ) { |
148 | 148 | |
149 | - do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_created] adding form ' . $form['id'] . ' to blacklist because entry #' . $entry['id'] . ' was created' ); |
|
149 | + do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_created] adding form ' . $form[ 'id' ] . ' to blacklist because entry #' . $entry[ 'id' ] . ' was created' ); |
|
150 | 150 | |
151 | - $this->blacklist_add( $form['id'] ); |
|
151 | + $this->blacklist_add( $form[ 'id' ] ); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | /** |
@@ -164,9 +164,9 @@ discard block |
||
164 | 164 | return; |
165 | 165 | } |
166 | 166 | |
167 | - do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_added] adding form ' . $form['id'] . ' to blacklist because entry #' . $entry['id'] . ' was added' ); |
|
167 | + do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_added] adding form ' . $form[ 'id' ] . ' to blacklist because entry #' . $entry[ 'id' ] . ' was added' ); |
|
168 | 168 | |
169 | - $this->blacklist_add( $form['id'] ); |
|
169 | + $this->blacklist_add( $form[ 'id' ] ); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | // Normally just one form, but supports multiple forms |
186 | 186 | // |
187 | 187 | // Array of IDs 12, 5, 14 would result in `f-12f-5f-14` |
188 | - $forms = 'f:' . implode( '&f:', (array) $form_ids ); |
|
188 | + $forms = 'f:' . implode( '&f:', (array)$form_ids ); |
|
189 | 189 | |
190 | 190 | // Prefix for transient keys |
191 | 191 | // Now the prefix would be: `gv-cache-f-12f-5f-14` |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | ) ); |
243 | 243 | |
244 | 244 | // Add the passed form IDs |
245 | - $blacklist = array_merge( (array) $blacklist, $form_ids ); |
|
245 | + $blacklist = array_merge( (array)$blacklist, $form_ids ); |
|
246 | 246 | |
247 | 247 | // Don't duplicate |
248 | 248 | $blacklist = array_unique( $blacklist ); |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | |
263 | 263 | $blacklist = get_option( self::BLACKLIST_OPTION_NAME, array() ); |
264 | 264 | |
265 | - $updated_list = array_diff( $blacklist, (array) $form_ids ); |
|
265 | + $updated_list = array_diff( $blacklist, (array)$form_ids ); |
|
266 | 266 | |
267 | 267 | do_action( 'gravityview_log_debug', 'GravityView_Cache[blacklist_remove] Removing form IDs from cache blacklist', array( |
268 | 268 | '$form_ids' => $form_ids, |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | return false; |
296 | 296 | } |
297 | 297 | |
298 | - foreach ( (array) $form_ids as $form_id ) { |
|
298 | + foreach ( (array)$form_ids as $form_id ) { |
|
299 | 299 | |
300 | 300 | if ( in_array( $form_id, $blacklist ) ) { |
301 | 301 | |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | * @filter `gravityview_cache_time_{$filter_name}` Modify the cache time for a type of cache |
368 | 368 | * @param int $time_in_seconds Default: `DAY_IN_SECONDS` |
369 | 369 | */ |
370 | - $cache_time = (int) apply_filters( 'gravityview_cache_time_' . $filter_name, DAY_IN_SECONDS ); |
|
370 | + $cache_time = (int)apply_filters( 'gravityview_cache_time_' . $filter_name, DAY_IN_SECONDS ); |
|
371 | 371 | |
372 | 372 | do_action( 'gravityview_log_debug', 'GravityView_Cache[set] Setting cache with transient key ' . $this->key . ' for ' . $cache_time . ' seconds' ); |
373 | 373 | |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | return; |
404 | 404 | } |
405 | 405 | |
406 | - foreach ( (array) $form_ids as $form_id ) { |
|
406 | + foreach ( (array)$form_ids as $form_id ) { |
|
407 | 407 | |
408 | 408 | $key = $this->get_cache_key_prefix( $form_id ); |
409 | 409 | |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | |
518 | 518 | if ( GVCommon::has_cap( 'edit_gravityviews' ) ) { |
519 | 519 | |
520 | - if ( isset( $_GET['cache'] ) || isset( $_GET['nocache'] ) ) { |
|
520 | + if ( isset( $_GET[ 'cache' ] ) || isset( $_GET[ 'nocache' ] ) ) { |
|
521 | 521 | |
522 | 522 | do_action( 'gravityview_log_debug', 'GravityView_Cache[use_cache] Not using cache: ?cache or ?nocache is in the URL' ); |
523 | 523 | |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | */ |
547 | 547 | $use_cache = apply_filters( 'gravityview_use_cache', $use_cache, $this ); |
548 | 548 | |
549 | - return (boolean) $use_cache; |
|
549 | + return (boolean)$use_cache; |
|
550 | 550 | } |
551 | 551 | |
552 | 552 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | return $meta_keys; |
49 | 49 | } |
50 | 50 | |
51 | - if( $acf_keys = get_field_objects( $post_id, array( 'load_value' => false ) ) ) { |
|
51 | + if ( $acf_keys = get_field_objects( $post_id, array( 'load_value' => false ) ) ) { |
|
52 | 52 | return array_merge( array_keys( $acf_keys ), $meta_keys ); |
53 | 53 | } |
54 | 54 | |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | * @return void |
64 | 64 | */ |
65 | 65 | private function fix_posted_fields() { |
66 | - if( is_admin() && isset( $_POST['action'] ) && isset( $_POST['post_type'] ) ) { |
|
67 | - if( 'editpost' === $_POST['action'] && 'gravityview' === $_POST['post_type'] ) { |
|
68 | - $_POST['fields'] = _gravityview_process_posted_fields(); |
|
66 | + if ( is_admin() && isset( $_POST[ 'action' ] ) && isset( $_POST[ 'post_type' ] ) ) { |
|
67 | + if ( 'editpost' === $_POST[ 'action' ] && 'gravityview' === $_POST[ 'post_type' ] ) { |
|
68 | + $_POST[ 'fields' ] = _gravityview_process_posted_fields(); |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | } |
@@ -62,6 +62,8 @@ |
||
62 | 62 | * @internal |
63 | 63 | * @since future |
64 | 64 | * |
65 | + * @param integer $form_id |
|
66 | + * @param integer $count |
|
65 | 67 | * @return array The old associative array data as returned by |
66 | 68 | * \GravityView_frontend::get_view_entries(), the paging parameters |
67 | 69 | * and a total count of all entries. |
@@ -94,15 +94,15 @@ discard block |
||
94 | 94 | $paging = rgar( $parameters, 'paging' ); |
95 | 95 | } else { |
96 | 96 | $entries = $form->entries |
97 | - ->filter( \GV\GF_Entry_Filter::from_search_criteria( $criteria['search_criteria'] ) ) |
|
98 | - ->offset( $args['offset'] ) |
|
99 | - ->limit( $criteria['paging']['page_size'] ) |
|
100 | - ->page( ( ( $criteria['paging']['offset'] - $args['offset'] ) / $criteria['paging']['page_size'] ) + 1 ); |
|
101 | - if ( ! empty( $criteria['sorting'] ) ) { |
|
97 | + ->filter( \GV\GF_Entry_Filter::from_search_criteria( $criteria[ 'search_criteria' ] ) ) |
|
98 | + ->offset( $args[ 'offset' ] ) |
|
99 | + ->limit( $criteria[ 'paging' ][ 'page_size' ] ) |
|
100 | + ->page( ( ( $criteria[ 'paging' ][ 'offset' ] - $args[ 'offset' ] ) / $criteria[ 'paging' ][ 'page_size' ] ) + 1 ); |
|
101 | + if ( ! empty( $criteria[ 'sorting' ] ) ) { |
|
102 | 102 | $field = new \GV\Field(); |
103 | - $field->ID = $criteria['sorting']['key']; |
|
104 | - $direction = strtolower( $criteria['sorting']['direction'] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC; |
|
105 | - $mode = $criteria['sorting']['is_numeric'] ? \GV\Entry_Sort::NUMERIC : \GV\Entry_Sort::ALPHA; |
|
103 | + $field->ID = $criteria[ 'sorting' ][ 'key' ]; |
|
104 | + $direction = strtolower( $criteria[ 'sorting' ][ 'direction' ] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC; |
|
105 | + $mode = $criteria[ 'sorting' ][ 'is_numeric' ] ? \GV\Entry_Sort::NUMERIC : \GV\Entry_Sort::ALPHA; |
|
106 | 106 | $entries = $entries->sort( new \GV\Entry_Sort( $field, $direction, $mode ) ); |
107 | 107 | } |
108 | 108 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | /** Add some global fix for field capability discrepancies. */ |
130 | 130 | add_filter( 'gravityview/configuration/fields', function( $fields ) { |
131 | - if ( empty( $fields ) ) { |
|
131 | + if ( empty( $fields ) ) { |
|
132 | 132 | return $fields; |
133 | 133 | } |
134 | 134 | |
@@ -155,11 +155,11 @@ discard block |
||
155 | 155 | } |
156 | 156 | |
157 | 157 | foreach ( $_fields as $uid => &$_field ) { |
158 | - if ( ! isset( $_field['only_loggedin'] ) ) { |
|
158 | + if ( ! isset( $_field[ 'only_loggedin' ] ) ) { |
|
159 | 159 | continue; |
160 | 160 | } |
161 | 161 | /** If we do not require login, we don't require a cap. */ |
162 | - $_field['only_loggedin'] != '1' && ( $_field['only_loggedin_cap'] = '' ); |
|
162 | + $_field[ 'only_loggedin' ] != '1' && ( $_field[ 'only_loggedin_cap' ] = '' ); |
|
163 | 163 | } |
164 | 164 | } |
165 | 165 | return $fields; |
@@ -5,7 +5,7 @@ |
||
5 | 5 | } |
6 | 6 | |
7 | 7 | /** The future branch of GravityView requires PHP 5.3+ namespaces and SPL. */ |
8 | -if ( version_compare( phpversion(), '5.3' , '<' ) ) { |
|
8 | +if ( version_compare( phpversion(), '5.3', '<' ) ) { |
|
9 | 9 | return false; |
10 | 10 | |
11 | 11 | /** Tests with a suppressed future. */ |