@@ -25,7 +25,7 @@ |
||
25 | 25 | * |
26 | 26 | * @param GF_Field_List $field Gravity Forms field |
27 | 27 | * @param string|array $field_value Serialized or unserialized array value for the field |
28 | - * @param int|string $column_id The numeric key of the column (0-index) or the label of the column |
|
28 | + * @param integer $column_id The numeric key of the column (0-index) or the label of the column |
|
29 | 29 | * @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` |
30 | 30 | * |
31 | 31 | * @return array|string|null Returns null if the $field_value passed wasn't an array or serialized array |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | // Add the list columns |
63 | 63 | foreach ( $list_fields as $list_field ) { |
64 | 64 | |
65 | - if( empty( $list_field->enableColumns ) ) { |
|
65 | + if ( empty( $list_field->enableColumns ) ) { |
|
66 | 66 | continue; |
67 | 67 | } |
68 | 68 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | // If there are columns, add them under the parent field |
86 | - if( ! empty( $list_columns ) ) { |
|
86 | + if ( ! empty( $list_columns ) ) { |
|
87 | 87 | |
88 | 88 | $index = array_search( $list_field->id, array_keys( $fields ) ) + 1; |
89 | 89 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * Merge the $list_columns into the $fields array at $index |
92 | 92 | * @see https://stackoverflow.com/a/1783125 |
93 | 93 | */ |
94 | - $fields = array_slice( $fields, 0, $index, true) + $list_columns + array_slice( $fields, $index, null, true); |
|
94 | + $fields = array_slice( $fields, 0, $index, true ) + $list_columns + array_slice( $fields, $index, null, true ); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | unset( $list_columns, $index, $input_id ); |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | $list_rows = maybe_unserialize( $field_value ); |
120 | 120 | |
121 | - if( ! is_array( $list_rows ) ) { |
|
121 | + if ( ! is_array( $list_rows ) ) { |
|
122 | 122 | do_action( 'gravityview_log_error', __METHOD__ . ' - $field_value did not unserialize', $field_value ); |
123 | 123 | return null; |
124 | 124 | } |
@@ -131,15 +131,15 @@ discard block |
||
131 | 131 | foreach ( $list_row as $column_key => $column_value ) { |
132 | 132 | |
133 | 133 | // If the label of the column matches $column_id, or the numeric key value matches, add the value |
134 | - if( (string)$column_key === (string)$column_id || ( is_numeric( $column_id ) && (int)$column_id === $current_column ) ) { |
|
135 | - $column_values[] = $column_value; |
|
134 | + if ( (string)$column_key === (string)$column_id || ( is_numeric( $column_id ) && (int)$column_id === $current_column ) ) { |
|
135 | + $column_values[ ] = $column_value; |
|
136 | 136 | } |
137 | 137 | $current_column++; |
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
141 | 141 | // Return the array of values |
142 | - if( 'raw' === $format ) { |
|
142 | + if ( 'raw' === $format ) { |
|
143 | 143 | return $column_values; |
144 | 144 | } |
145 | 145 | // Return the Gravity Forms Field output |
@@ -162,22 +162,22 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public function _filter_field_label( $label, $field, $form, $entry ) { |
164 | 164 | |
165 | - $field_object = RGFormsModel::get_field( $form, $field['id'] ); |
|
165 | + $field_object = RGFormsModel::get_field( $form, $field[ 'id' ] ); |
|
166 | 166 | |
167 | 167 | // Not a list field |
168 | - if( ! $field_object || 'list' !== $field_object->type ) { |
|
168 | + if ( ! $field_object || 'list' !== $field_object->type ) { |
|
169 | 169 | return $label; |
170 | 170 | } |
171 | 171 | |
172 | 172 | // Custom label is defined, so use it |
173 | - if( ! empty( $field['custom_label'] ) ) { |
|
173 | + if ( ! empty( $field[ 'custom_label' ] ) ) { |
|
174 | 174 | return $label; |
175 | 175 | } |
176 | 176 | |
177 | - $column_id = gravityview_get_input_id_from_id( $field['id'] ); |
|
177 | + $column_id = gravityview_get_input_id_from_id( $field[ 'id' ] ); |
|
178 | 178 | |
179 | 179 | // Parent field, not column field |
180 | - if( false === $column_id ) { |
|
180 | + if ( false === $column_id ) { |
|
181 | 181 | return $label; |
182 | 182 | } |
183 | 183 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | public static function get_column_label( GF_Field_List $field, $column_id, $backup_label = '' ) { |
199 | 199 | |
200 | 200 | // Doesn't have columns enabled |
201 | - if( ! isset( $field->choices ) || ! $field->enableColumns ) { |
|
201 | + if ( ! isset( $field->choices ) || ! $field->enableColumns ) { |
|
202 | 202 | return $backup_label; |
203 | 203 | } |
204 | 204 |
@@ -227,7 +227,7 @@ |
||
227 | 227 | */ |
228 | 228 | $content = apply_filters( 'gravityview/fields/fileupload/link_content', $content, $gravityview_view->getCurrentField() ); |
229 | 229 | |
230 | - $content = gravityview_get_link( $link, $content, $link_atts ); |
|
230 | + $content = gravityview_get_link( $link, $content, $link_atts ); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | $output_arr[] = array( |
@@ -20,16 +20,16 @@ discard block |
||
20 | 20 | |
21 | 21 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
22 | 22 | |
23 | - unset( $field_options['search_filter'] ); |
|
23 | + unset( $field_options[ 'search_filter' ] ); |
|
24 | 24 | |
25 | - if( 'edit' === $context ) { |
|
25 | + if ( 'edit' === $context ) { |
|
26 | 26 | return $field_options; |
27 | 27 | } |
28 | 28 | |
29 | - $add_options['link_to_file'] = array( |
|
29 | + $add_options[ 'link_to_file' ] = array( |
|
30 | 30 | 'type' => 'checkbox', |
31 | 31 | 'label' => __( 'Display as a Link:', 'gravityview' ), |
32 | - 'desc' => __('Display the uploaded files as links, rather than embedded content.', 'gravityview'), |
|
32 | + 'desc' => __( 'Display the uploaded files as links, rather than embedded content.', 'gravityview' ), |
|
33 | 33 | 'value' => false, |
34 | 34 | 'merge_tags' => false, |
35 | 35 | ); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $output_arr = array(); |
66 | 66 | |
67 | 67 | // Get an array of file paths for the field. |
68 | - $file_paths = rgar( $field , 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
68 | + $file_paths = rgar( $field, 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
69 | 69 | |
70 | 70 | // The $value JSON was probably truncated; let's check lead_detail_long. |
71 | 71 | if ( ! is_array( $file_paths ) ) { |
@@ -79,19 +79,19 @@ discard block |
||
79 | 79 | } |
80 | 80 | |
81 | 81 | // Process each file path |
82 | - foreach( $file_paths as $file_path ) { |
|
82 | + foreach ( $file_paths as $file_path ) { |
|
83 | 83 | |
84 | 84 | // If the site is HTTPS, use HTTPS |
85 | - if(function_exists('set_url_scheme')) { $file_path = set_url_scheme($file_path); } |
|
85 | + if ( function_exists( 'set_url_scheme' ) ) { $file_path = set_url_scheme( $file_path ); } |
|
86 | 86 | |
87 | 87 | // This is from Gravity Forms's code |
88 | - $file_path = esc_attr(str_replace(" ", "%20", $file_path)); |
|
88 | + $file_path = esc_attr( str_replace( " ", "%20", $file_path ) ); |
|
89 | 89 | |
90 | 90 | // If the field is set to link to the single entry, link to it. |
91 | - $link = !empty( $field_settings['show_as_link'] ) ? GravityView_API::entry_link( $entry, $field ) : $file_path; |
|
91 | + $link = ! empty( $field_settings[ 'show_as_link' ] ) ? GravityView_API::entry_link( $entry, $field ) : $file_path; |
|
92 | 92 | |
93 | 93 | // Get file path information |
94 | - $file_path_info = pathinfo($file_path); |
|
94 | + $file_path_info = pathinfo( $file_path ); |
|
95 | 95 | |
96 | 96 | $html_format = NULL; |
97 | 97 | |
@@ -100,30 +100,30 @@ discard block |
||
100 | 100 | $disable_wrapped_link = false; |
101 | 101 | |
102 | 102 | // Is this an image? |
103 | - $image = new GravityView_Image(array( |
|
103 | + $image = new GravityView_Image( array( |
|
104 | 104 | 'src' => $file_path, |
105 | - 'class' => 'gv-image gv-field-id-'.$field_settings['id'], |
|
106 | - 'alt' => $field_settings['label'], |
|
107 | - 'width' => (gravityview_get_context() === 'single' ? NULL : 250) |
|
108 | - )); |
|
105 | + 'class' => 'gv-image gv-field-id-' . $field_settings[ 'id' ], |
|
106 | + 'alt' => $field_settings[ 'label' ], |
|
107 | + 'width' => ( gravityview_get_context() === 'single' ? NULL : 250 ) |
|
108 | + ) ); |
|
109 | 109 | |
110 | 110 | $content = $image->html(); |
111 | 111 | |
112 | 112 | // The new default content is the image, if it exists. If not, use the file name as the content. |
113 | - $content = !empty( $content ) ? $content : $file_path_info['basename']; |
|
113 | + $content = ! empty( $content ) ? $content : $file_path_info[ 'basename' ]; |
|
114 | 114 | |
115 | 115 | // If pathinfo() gave us the extension of the file, run the switch statement using that. |
116 | - $extension = empty( $file_path_info['extension'] ) ? NULL : strtolower( $file_path_info['extension'] ); |
|
116 | + $extension = empty( $file_path_info[ 'extension' ] ) ? NULL : strtolower( $file_path_info[ 'extension' ] ); |
|
117 | 117 | |
118 | 118 | |
119 | - switch( true ) { |
|
119 | + switch ( true ) { |
|
120 | 120 | |
121 | 121 | // Audio file |
122 | 122 | case in_array( $extension, wp_get_audio_extensions() ): |
123 | 123 | |
124 | 124 | $disable_lightbox = true; |
125 | 125 | |
126 | - if( shortcode_exists( 'audio' ) ) { |
|
126 | + if ( shortcode_exists( 'audio' ) ) { |
|
127 | 127 | |
128 | 128 | $disable_wrapped_link = true; |
129 | 129 | |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | */ |
135 | 135 | $audio_settings = apply_filters( 'gravityview_audio_settings', array( |
136 | 136 | 'src' => $file_path, |
137 | - 'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id'] |
|
138 | - )); |
|
137 | + 'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings[ 'id' ] |
|
138 | + ) ); |
|
139 | 139 | |
140 | 140 | /** |
141 | 141 | * Generate the audio shortcode |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | |
154 | 154 | $disable_lightbox = true; |
155 | 155 | |
156 | - if( shortcode_exists( 'video' ) ) { |
|
156 | + if ( shortcode_exists( 'video' ) ) { |
|
157 | 157 | |
158 | 158 | $disable_wrapped_link = true; |
159 | 159 | |
@@ -164,8 +164,8 @@ discard block |
||
164 | 164 | */ |
165 | 165 | $video_settings = apply_filters( 'gravityview_video_settings', array( |
166 | 166 | 'src' => $file_path, |
167 | - 'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id'] |
|
168 | - )); |
|
167 | + 'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings[ 'id' ] |
|
168 | + ) ); |
|
169 | 169 | |
170 | 170 | /** |
171 | 171 | * Generate the video shortcode |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | break; |
188 | 188 | |
189 | 189 | // if not image, do not set the lightbox (@since 1.5.3) |
190 | - case !in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ): |
|
190 | + case ! in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ): |
|
191 | 191 | |
192 | 192 | $disable_lightbox = true; |
193 | 193 | |
@@ -197,10 +197,10 @@ discard block |
||
197 | 197 | |
198 | 198 | // If using Link to File, override the content. |
199 | 199 | // (We do this here so that the $disable_lightbox can be set. Yes, there's a little more processing time, but oh well.) |
200 | - if( !empty( $field_settings['link_to_file'] ) ) { |
|
200 | + if ( ! empty( $field_settings[ 'link_to_file' ] ) ) { |
|
201 | 201 | |
202 | 202 | // Force the content to be the file name |
203 | - $content = $file_path_info["basename"]; |
|
203 | + $content = $file_path_info[ "basename" ]; |
|
204 | 204 | |
205 | 205 | // Restore the wrapped link |
206 | 206 | $disable_wrapped_link = false; |
@@ -208,13 +208,13 @@ discard block |
||
208 | 208 | } |
209 | 209 | |
210 | 210 | // Whether to use lightbox or not |
211 | - if( $disable_lightbox || empty( $gravityview_view->atts['lightbox'] ) || !empty( $field_settings['show_as_link'] ) ) { |
|
211 | + if ( $disable_lightbox || empty( $gravityview_view->atts[ 'lightbox' ] ) || ! empty( $field_settings[ 'show_as_link' ] ) ) { |
|
212 | 212 | |
213 | - $link_atts = empty( $field_settings['show_as_link'] ) ? array( 'target' => '_blank' ) : array(); |
|
213 | + $link_atts = empty( $field_settings[ 'show_as_link' ] ) ? array( 'target' => '_blank' ) : array(); |
|
214 | 214 | |
215 | 215 | } else { |
216 | 216 | |
217 | - $entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry ); |
|
217 | + $entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ); |
|
218 | 218 | |
219 | 219 | $link_atts = array( |
220 | 220 | 'rel' => sprintf( "%s-%s", $gv_class, $entry_slug ), |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | $disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', $disable_wrapped_link, $gravityview_view->getCurrentField() ); |
241 | 241 | |
242 | 242 | // If the HTML output hasn't been overridden by the switch statement above, use the default format |
243 | - if( !empty( $content ) && empty( $disable_wrapped_link ) ) { |
|
243 | + if ( ! empty( $content ) && empty( $disable_wrapped_link ) ) { |
|
244 | 244 | |
245 | 245 | /** |
246 | 246 | * Modify the link text (defaults to the file name) |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | $content = gravityview_get_link( $link, $content, $link_atts ); |
256 | 256 | } |
257 | 257 | |
258 | - $output_arr[] = array( |
|
258 | + $output_arr[ ] = array( |
|
259 | 259 | 'file_path' => $file_path, |
260 | 260 | 'content' => $content |
261 | 261 | ); |
@@ -21,13 +21,13 @@ |
||
21 | 21 | 'tooltip' => __( 'Enter the number of words to be shown. If specified it truncates the text. Leave it blank if you want to show the full text.', 'gravityview' ), |
22 | 22 | ); |
23 | 23 | |
24 | - $field_options['make_clickable'] = array( |
|
25 | - 'type' => 'checkbox', |
|
26 | - 'merge_tags' => false, |
|
27 | - 'value' => 0, |
|
28 | - 'label' => __( 'Convert text URLs to HTML links', 'gravityview' ), |
|
29 | - 'tooltip' => __( 'Converts URI, www, FTP, and email addresses in HTML links', 'gravityview' ), |
|
30 | - ); |
|
24 | + $field_options['make_clickable'] = array( |
|
25 | + 'type' => 'checkbox', |
|
26 | + 'merge_tags' => false, |
|
27 | + 'value' => 0, |
|
28 | + 'label' => __( 'Convert text URLs to HTML links', 'gravityview' ), |
|
29 | + 'tooltip' => __( 'Converts URI, www, FTP, and email addresses in HTML links', 'gravityview' ), |
|
30 | + ); |
|
31 | 31 | |
32 | 32 | return $field_options; |
33 | 33 | } |
@@ -25,11 +25,11 @@ discard block |
||
25 | 25 | |
26 | 26 | function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) { |
27 | 27 | |
28 | - if( 'edit' === $context ) { |
|
28 | + if ( 'edit' === $context ) { |
|
29 | 29 | return $field_options; |
30 | 30 | } |
31 | 31 | |
32 | - $field_options['trim_words'] = array( |
|
32 | + $field_options[ 'trim_words' ] = array( |
|
33 | 33 | 'type' => 'number', |
34 | 34 | 'merge_tags' => false, |
35 | 35 | 'value' => null, |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | 'tooltip' => __( 'Enter the number of words to be shown. If specified it truncates the text. Leave it blank if you want to show the full text.', 'gravityview' ), |
38 | 38 | ); |
39 | 39 | |
40 | - $field_options['make_clickable'] = array( |
|
40 | + $field_options[ 'make_clickable' ] = array( |
|
41 | 41 | 'type' => 'checkbox', |
42 | 42 | 'merge_tags' => false, |
43 | 43 | 'value' => 0, |
@@ -255,7 +255,6 @@ |
||
255 | 255 | * Get the default date format for a field based on the field ID and the time format setting |
256 | 256 | * |
257 | 257 | * @since 1.14 |
258 | - |
|
259 | 258 | * @param string $time_format The time format ("12" or "24"). Default: "12" {@since 1.14} |
260 | 259 | * @param int $field_id The ID of the field. Used to figure out full time/hours/minutes/am/pm {@since 1.14} |
261 | 260 | * |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | add_filter( 'gravityview/sorting/time', array( $this, 'modify_sort_id' ), 10, 2 ); |
61 | 61 | |
62 | - add_filter('gravityview_search_criteria', array( $this, '_maybe_filter_gravity_forms_query' ), 10, 4 ); |
|
62 | + add_filter( 'gravityview_search_criteria', array( $this, '_maybe_filter_gravity_forms_query' ), 10, 4 ); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -100,31 +100,31 @@ discard block |
||
100 | 100 | public function _maybe_filter_gravity_forms_query( $criteria, $form_ids, $view_id ) { |
101 | 101 | |
102 | 102 | // If the search is being sorted |
103 | - if( ! empty( $criteria['sorting']['key'] ) ) { |
|
103 | + if ( ! empty( $criteria[ 'sorting' ][ 'key' ] ) ) { |
|
104 | 104 | |
105 | - $pieces = explode( $this->_sort_divider, $criteria['sorting']['key'] ); |
|
105 | + $pieces = explode( $this->_sort_divider, $criteria[ 'sorting' ][ 'key' ] ); |
|
106 | 106 | |
107 | 107 | /** |
108 | 108 | * And the sort key matches the key set in modify_sort_id(), then modify the Gravity Forms query SQL |
109 | 109 | * @see modify_sort_id() |
110 | 110 | */ |
111 | - if( ! empty( $pieces[1] ) ) { |
|
111 | + if ( ! empty( $pieces[ 1 ] ) ) { |
|
112 | 112 | |
113 | 113 | // Pass these to the _modify_query_sort_by_time_hack() method |
114 | - $this->_time_format = $pieces[1]; |
|
115 | - $this->_date_format = $pieces[2]; |
|
114 | + $this->_time_format = $pieces[ 1 ]; |
|
115 | + $this->_date_format = $pieces[ 2 ]; |
|
116 | 116 | |
117 | 117 | // Remove fake input IDs (5.1 doesn't exist. Use 5) |
118 | - $criteria['sorting']['key'] = floor( $pieces[0] ); |
|
118 | + $criteria[ 'sorting' ][ 'key' ] = floor( $pieces[ 0 ] ); |
|
119 | 119 | |
120 | 120 | /** |
121 | 121 | * Make sure sorting is numeric (# of seconds). IMPORTANT. |
122 | 122 | * @see GVCommon::is_field_numeric() is_numeric should also be set here |
123 | 123 | */ |
124 | - $criteria['sorting']['is_numeric'] = true; |
|
124 | + $criteria[ 'sorting' ][ 'is_numeric' ] = true; |
|
125 | 125 | |
126 | 126 | // Modify the Gravity Forms WP Query |
127 | - add_filter('query', array( $this, '_modify_query_sort_by_time_hack' ) ); |
|
127 | + add_filter( 'query', array( $this, '_modify_query_sort_by_time_hack' ) ); |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
@@ -147,9 +147,9 @@ discard block |
||
147 | 147 | * then we want to modify the query. |
148 | 148 | * @see GFFormsModel::sort_by_field_query() |
149 | 149 | */ |
150 | - if( strpos( $query, self::GF_SORTING_SQL ) > 0 ) { |
|
150 | + if ( strpos( $query, self::GF_SORTING_SQL ) > 0 ) { |
|
151 | 151 | |
152 | - if( $this->_time_format === '24' ) { |
|
152 | + if ( $this->_time_format === '24' ) { |
|
153 | 153 | $sql_str_to_date = "STR_TO_DATE( `value`, '%H:%i' )"; |
154 | 154 | } else { |
155 | 155 | $sql_str_to_date = "STR_TO_DATE( `value`, '%h:%i %p' )"; |
@@ -195,18 +195,18 @@ discard block |
||
195 | 195 | // Set variables |
196 | 196 | parent::field_options( $field_options, $template_id, $field_id, $context, $input_type ); |
197 | 197 | |
198 | - if( 'edit' === $context ) { |
|
198 | + if ( 'edit' === $context ) { |
|
199 | 199 | return $field_options; |
200 | 200 | } |
201 | 201 | |
202 | 202 | /** |
203 | 203 | * Set default date format based on field ID and Form ID |
204 | 204 | */ |
205 | - add_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
205 | + add_filter( 'gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
206 | 206 | |
207 | - $this->add_field_support('date_display', $field_options ); |
|
207 | + $this->add_field_support( 'date_display', $field_options ); |
|
208 | 208 | |
209 | - remove_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
209 | + remove_filter( 'gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
210 | 210 | |
211 | 211 | return $field_options; |
212 | 212 | } |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | private function _get_time_format() { |
222 | 222 | global $post; |
223 | 223 | |
224 | - $current_form = isset( $_POST['form_id'] ) ? intval( $_POST['form_id'] ) : gravityview_get_form_id( $post->ID ); |
|
224 | + $current_form = isset( $_POST[ 'form_id' ] ) ? intval( $_POST[ 'form_id' ] ) : gravityview_get_form_id( $post->ID ); |
|
225 | 225 | |
226 | 226 | return self::_get_time_format_for_field( $this->_field_id, $current_form ); |
227 | 227 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | // GF defaults to 12, so should we. |
241 | 241 | $time_format = '12'; |
242 | 242 | |
243 | - if( $form_id ) { |
|
243 | + if ( $form_id ) { |
|
244 | 244 | $form = GFAPI::get_form( $form_id ); |
245 | 245 | |
246 | 246 | if ( $form ) { |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | $default = 'h:i A'; |
288 | 288 | |
289 | 289 | // This doesn't take into account 24-hour |
290 | - switch( $field_input_id ) { |
|
290 | + switch ( $field_input_id ) { |
|
291 | 291 | // Hours |
292 | 292 | case 1: |
293 | 293 | return ( $time_format === '12' ) ? 'h' : 'H'; |
@@ -69,7 +69,7 @@ |
||
69 | 69 | * |
70 | 70 | * @since 1.16 |
71 | 71 | * |
72 | - * @param int|string $value Number value for the field |
|
72 | + * @param string $value Number value for the field |
|
73 | 73 | * |
74 | 74 | * @return string Based on $value; `1`: "One-Time Payment"; `2`: "Subscription" |
75 | 75 | */ |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | public function get_content( $output, $entry, $field_settings, $field ) { |
60 | 60 | |
61 | 61 | /** Overridden by a template. */ |
62 | - if( ! empty( $field['field_path'] ) ) { return $output; } |
|
62 | + if ( ! empty( $field[ 'field_path' ] ) ) { return $output; } |
|
63 | 63 | |
64 | 64 | return $this->get_string_from_value( $output ); |
65 | 65 | } |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | switch ( intval( $value ) ) { |
79 | 79 | case self::ONE_TIME_PAYMENT: |
80 | 80 | default: |
81 | - $return = __('One-Time Payment', 'gravityview'); |
|
81 | + $return = __( 'One-Time Payment', 'gravityview' ); |
|
82 | 82 | break; |
83 | 83 | |
84 | 84 | case self::SUBSCRIPTION: |
85 | - $return = __('Subscription', 'gravityview'); |
|
85 | + $return = __( 'Subscription', 'gravityview' ); |
|
86 | 86 | break; |
87 | 87 | } |
88 | 88 |
@@ -135,7 +135,7 @@ |
||
135 | 135 | * @param bool $url_encode Whether to URL-encode output |
136 | 136 | * @param bool $esc_html Whether to apply `esc_html()` to output |
137 | 137 | * |
138 | - * @return mixed |
|
138 | + * @return string |
|
139 | 139 | */ |
140 | 140 | public static function replace_gv_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
141 | 141 |
@@ -134,17 +134,17 @@ discard block |
||
134 | 134 | |
135 | 135 | add_filter( 'gravityview/sortable/field_blacklist', array( $this, '_filter_sortable_fields' ), 1 ); |
136 | 136 | |
137 | - if( $this->entry_meta_key ) { |
|
137 | + if ( $this->entry_meta_key ) { |
|
138 | 138 | add_filter( 'gform_entry_meta', array( $this, 'add_entry_meta' ) ); |
139 | 139 | add_filter( 'gravityview/common/sortable_fields', array( $this, 'add_sortable_field' ), 10, 2 ); |
140 | 140 | } |
141 | 141 | |
142 | - if( $this->_custom_merge_tag ) { |
|
142 | + if ( $this->_custom_merge_tag ) { |
|
143 | 143 | add_filter( 'gform_custom_merge_tags', array( $this, '_filter_gform_custom_merge_tags' ), 10, 4 ); |
144 | 144 | add_filter( 'gform_replace_merge_tags', array( $this, '_filter_gform_replace_merge_tags' ), 10, 7 ); |
145 | 145 | } |
146 | 146 | |
147 | - if( 'meta' === $this->group || '' !== $this->default_search_label ) { |
|
147 | + if ( 'meta' === $this->group || '' !== $this->default_search_label ) { |
|
148 | 148 | add_filter( 'gravityview_search_field_label', array( $this, 'set_default_search_label' ), 10, 3 ); |
149 | 149 | } |
150 | 150 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | 'type' => $this->name |
168 | 168 | ); |
169 | 169 | |
170 | - $fields["{$this->entry_meta_key}"] = $added_field; |
|
170 | + $fields[ "{$this->entry_meta_key}" ] = $added_field; |
|
171 | 171 | |
172 | 172 | return $fields; |
173 | 173 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | */ |
188 | 188 | function set_default_search_label( $label = '', $gf_field = null, $field = array() ) { |
189 | 189 | |
190 | - if( $this->name === $field['field'] && '' === $label ) { |
|
190 | + if ( $this->name === $field[ 'field' ] && '' === $label ) { |
|
191 | 191 | $label = esc_html( $this->default_search_label ); |
192 | 192 | } |
193 | 193 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | * |
209 | 209 | * @return string Original text if {_custom_merge_tag} isn't found. Otherwise, replaced text. |
210 | 210 | */ |
211 | - public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
211 | + public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
212 | 212 | |
213 | 213 | /** |
214 | 214 | * This prevents the gform_replace_merge_tags filter from being called twice, as defined in: |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * @see GFCommon::replace_variables_prepopulate() |
217 | 217 | * @todo Remove eventually: Gravity Forms fixed this issue in 1.9.14 |
218 | 218 | */ |
219 | - if( false === $form ) { |
|
219 | + if ( false === $form ) { |
|
220 | 220 | return $text; |
221 | 221 | } |
222 | 222 | |
@@ -249,19 +249,19 @@ discard block |
||
249 | 249 | */ |
250 | 250 | public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
251 | 251 | |
252 | - foreach( $matches as $match ) { |
|
252 | + foreach ( $matches as $match ) { |
|
253 | 253 | |
254 | - $full_tag = $match[0]; |
|
254 | + $full_tag = $match[ 0 ]; |
|
255 | 255 | |
256 | 256 | // Strip the Merge Tags |
257 | - $tag = str_replace( array( '{', '}'), '', $full_tag ); |
|
257 | + $tag = str_replace( array( '{', '}' ), '', $full_tag ); |
|
258 | 258 | |
259 | 259 | // Replace the value from the entry, if exists |
260 | - if( isset( $entry[ $tag ] ) ) { |
|
260 | + if ( isset( $entry[ $tag ] ) ) { |
|
261 | 261 | |
262 | 262 | $value = $entry[ $tag ]; |
263 | 263 | |
264 | - if( is_callable( array( $this, 'get_content') ) ) { |
|
264 | + if ( is_callable( array( $this, 'get_content' ) ) ) { |
|
265 | 265 | $value = $this->get_content( $value ); |
266 | 266 | } |
267 | 267 | |
@@ -334,8 +334,8 @@ discard block |
||
334 | 334 | */ |
335 | 335 | public function _filter_sortable_fields( $not_sortable ) { |
336 | 336 | |
337 | - if( ! $this->is_sortable ) { |
|
338 | - $not_sortable[] = $this->name; |
|
337 | + if ( ! $this->is_sortable ) { |
|
338 | + $not_sortable[ ] = $this->name; |
|
339 | 339 | } |
340 | 340 | |
341 | 341 | return $not_sortable; |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | */ |
353 | 353 | function add_entry_meta( $entry_meta ) { |
354 | 354 | |
355 | - if( ! isset( $entry_meta["{$this->entry_meta_key}"] ) ) { |
|
355 | + if ( ! isset( $entry_meta[ "{$this->entry_meta_key}" ] ) ) { |
|
356 | 356 | |
357 | 357 | $added_meta = array( |
358 | 358 | 'label' => $this->label, |
@@ -361,13 +361,13 @@ discard block |
||
361 | 361 | ); |
362 | 362 | |
363 | 363 | if ( $this->entry_meta_update_callback && is_callable( $this->entry_meta_update_callback ) ) { |
364 | - $added_meta['update_entry_meta_callback'] = $this->entry_meta_update_callback; |
|
364 | + $added_meta[ 'update_entry_meta_callback' ] = $this->entry_meta_update_callback; |
|
365 | 365 | } |
366 | 366 | |
367 | - $entry_meta["{$this->entry_meta_key}"] = $added_meta; |
|
367 | + $entry_meta[ "{$this->entry_meta_key}" ] = $added_meta; |
|
368 | 368 | |
369 | 369 | } else { |
370 | - do_action( 'gravityview_log_error', __METHOD__ . ' Entry meta already set: ' . $this->entry_meta_key, $entry_meta["{$this->entry_meta_key}"] ); |
|
370 | + do_action( 'gravityview_log_error', __METHOD__ . ' Entry meta already set: ' . $this->entry_meta_key, $entry_meta[ "{$this->entry_meta_key}" ] ); |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | return $entry_meta; |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | 'date_display' => array( |
397 | 397 | 'type' => 'text', |
398 | 398 | 'label' => __( 'Override Date Format', 'gravityview' ), |
399 | - 'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview'), '<a href="https://codex.wordpress.org/Formatting_Date_and_Time">', '</a>' ), |
|
399 | + 'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview' ), '<a href="https://codex.wordpress.org/Formatting_Date_and_Time">', '</a>' ), |
|
400 | 400 | /** |
401 | 401 | * @filter `gravityview_date_format` Override the date format with a [PHP date format](https://codex.wordpress.org/Formatting_Date_and_Time) |
402 | 402 | * @param[in,out] null|string $date_format Date Format (default: null) |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | |
422 | 422 | $options = $this->field_support_options(); |
423 | 423 | |
424 | - if( isset( $options[ $key ] ) ) { |
|
424 | + if ( isset( $options[ $key ] ) ) { |
|
425 | 425 | $field_options[ $key ] = $options[ $key ]; |
426 | 426 | } |
427 | 427 | |
@@ -485,11 +485,11 @@ discard block |
||
485 | 485 | $connected_form = rgpost( 'form_id' ); |
486 | 486 | |
487 | 487 | // Otherwise, get the Form ID from the Post page |
488 | - if( empty( $connected_form ) ) { |
|
488 | + if ( empty( $connected_form ) ) { |
|
489 | 489 | $connected_form = gravityview_get_form_id( get_the_ID() ); |
490 | 490 | } |
491 | 491 | |
492 | - if( empty( $connected_form ) ) { |
|
492 | + if ( empty( $connected_form ) ) { |
|
493 | 493 | do_action( 'gravityview_log_error', sprintf( '%s: Form not found for form ID "%s"', __METHOD__, $connected_form ) ); |
494 | 494 | return false; |
495 | 495 | } |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | */ |
242 | 242 | $this->context_view_id = $_GET['gvid']; |
243 | 243 | |
244 | - } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
244 | + } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
245 | 245 | $array_keys = array_keys( $this->getGvOutputData()->get_views() ); |
246 | 246 | $this->context_view_id = array_pop( $array_keys ); |
247 | 247 | unset( $array_keys ); |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | global $post; |
270 | 270 | |
271 | 271 | // If in admin and NOT AJAX request, get outta here. |
272 | - if ( GravityView_Plugin::is_admin() ) { |
|
272 | + if ( GravityView_Plugin::is_admin() ) { |
|
273 | 273 | return; |
274 | 274 | } |
275 | 275 | |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | } |
373 | 373 | |
374 | 374 | // User reported WooCommerce doesn't pass two args. |
375 | - if ( empty( $passed_post_id ) ) { |
|
375 | + if ( empty( $passed_post_id ) ) { |
|
376 | 376 | return $title; |
377 | 377 | } |
378 | 378 | |
@@ -1108,7 +1108,7 @@ discard block |
||
1108 | 1108 | */ |
1109 | 1109 | $address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); |
1110 | 1110 | |
1111 | - switch( strtolower( $address_part ) ){ |
|
1111 | + switch( strtolower( $address_part ) ) { |
|
1112 | 1112 | case 'street': |
1113 | 1113 | $sort_field_id .= '.1'; |
1114 | 1114 | break; |
@@ -1188,7 +1188,7 @@ discard block |
||
1188 | 1188 | */ |
1189 | 1189 | $single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); |
1190 | 1190 | |
1191 | - if ( empty( $single_entry ) ){ |
|
1191 | + if ( empty( $single_entry ) ) { |
|
1192 | 1192 | return false; |
1193 | 1193 | } else { |
1194 | 1194 | return $single_entry; |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | |
151 | 151 | /** |
152 | 152 | * Sets the single entry ID and also the entry |
153 | - * @param bool|int|string $single_entry |
|
153 | + * @param boolean|string $single_entry |
|
154 | 154 | */ |
155 | 155 | public function setSingleEntry( $single_entry ) { |
156 | 156 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | |
168 | 168 | /** |
169 | 169 | * Set the current entry |
170 | - * @param array|int $entry Entry array or entry slug or ID |
|
170 | + * @param boolean|string $entry Entry array or entry slug or ID |
|
171 | 171 | */ |
172 | 172 | public function setEntry( $entry ) { |
173 | 173 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | * |
226 | 226 | * |
227 | 227 | * |
228 | - * @param null $view_id |
|
228 | + * @param string $view_id |
|
229 | 229 | */ |
230 | 230 | public function set_context_view_id( $view_id = null ) { |
231 | 231 | |
@@ -957,7 +957,7 @@ discard block |
||
957 | 957 | * |
958 | 958 | * @uses gravityview_get_entries() |
959 | 959 | * @access public |
960 | - * @param array $args\n |
|
960 | + * @param array $args |
|
961 | 961 | * - $id - View id |
962 | 962 | * - $page_size - Page |
963 | 963 | * - $sort_field - form field id to sort |
@@ -1413,7 +1413,7 @@ discard block |
||
1413 | 1413 | /** |
1414 | 1414 | * Checks if field (column) is sortable |
1415 | 1415 | * |
1416 | - * @param string $field Field settings |
|
1416 | + * @param string $field_id Field settings |
|
1417 | 1417 | * @param array $form Gravity Forms form array |
1418 | 1418 | * |
1419 | 1419 | * @since 1.7 |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | private function __construct() {} |
86 | 86 | |
87 | 87 | private function initialize() { |
88 | - add_action( 'wp', array( $this, 'parse_content'), 11 ); |
|
88 | + add_action( 'wp', array( $this, 'parse_content' ), 11 ); |
|
89 | 89 | add_filter( 'parse_query', array( $this, 'parse_query_fix_frontpage' ), 10 ); |
90 | - add_action( 'template_redirect', array( $this, 'set_entry_data'), 1 ); |
|
90 | + add_action( 'template_redirect', array( $this, 'set_entry_data' ), 1 ); |
|
91 | 91 | |
92 | 92 | // Enqueue scripts and styles after GravityView_Template::register_styles() |
93 | 93 | add_action( 'wp_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 20 ); |
@@ -236,15 +236,15 @@ discard block |
||
236 | 236 | |
237 | 237 | $this->context_view_id = $view_id; |
238 | 238 | |
239 | - } elseif ( isset( $_GET['gvid'] ) && $this->getGvOutputData()->has_multiple_views() ) { |
|
239 | + } elseif ( isset( $_GET[ 'gvid' ] ) && $this->getGvOutputData()->has_multiple_views() ) { |
|
240 | 240 | /** |
241 | 241 | * used on a has_multiple_views context |
242 | 242 | * @see GravityView_API::entry_link |
243 | 243 | * @see GravityView_View_Data::getInstance()->has_multiple_views() |
244 | 244 | */ |
245 | - $this->context_view_id = $_GET['gvid']; |
|
245 | + $this->context_view_id = $_GET[ 'gvid' ]; |
|
246 | 246 | |
247 | - } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
247 | + } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
248 | 248 | $array_keys = array_keys( $this->getGvOutputData()->get_views() ); |
249 | 249 | $this->context_view_id = array_pop( $array_keys ); |
250 | 250 | unset( $array_keys ); |
@@ -279,24 +279,24 @@ discard block |
||
279 | 279 | global $wp_rewrite; |
280 | 280 | |
281 | 281 | $is_front_page = ( $query->is_home || $query->is_page ); |
282 | - $show_on_front = ( 'page' === get_option('show_on_front') ); |
|
283 | - $front_page_id = get_option('page_on_front'); |
|
282 | + $show_on_front = ( 'page' === get_option( 'show_on_front' ) ); |
|
283 | + $front_page_id = get_option( 'page_on_front' ); |
|
284 | 284 | |
285 | - if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
285 | + if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
286 | 286 | |
287 | 287 | // Force to be an array, potentially a query string ( entry=16 ) |
288 | 288 | $_query = wp_parse_args( $query->query ); |
289 | 289 | |
290 | 290 | // pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename. |
291 | - if ( isset( $_query['pagename'] ) && '' === $_query['pagename'] ) { |
|
292 | - unset( $_query['pagename'] ); |
|
291 | + if ( isset( $_query[ 'pagename' ] ) && '' === $_query[ 'pagename' ] ) { |
|
292 | + unset( $_query[ 'pagename' ] ); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | // this is where will break from core wordpress |
296 | 296 | $ignore = array( 'preview', 'page', 'paged', 'cpage' ); |
297 | 297 | $endpoints = rgobj( $wp_rewrite, 'endpoints' ); |
298 | - foreach ( (array) $endpoints as $endpoint ) { |
|
299 | - $ignore[] = $endpoint[1]; |
|
298 | + foreach ( (array)$endpoints as $endpoint ) { |
|
299 | + $ignore[ ] = $endpoint[ 1 ]; |
|
300 | 300 | } |
301 | 301 | unset( $endpoints ); |
302 | 302 | |
@@ -306,21 +306,21 @@ discard block |
||
306 | 306 | // - The query includes keys that are associated with registered endpoints. `entry`, for example. |
307 | 307 | if ( empty( $_query ) || ! array_diff( array_keys( $_query ), $ignore ) ) { |
308 | 308 | |
309 | - $qv =& $query->query_vars; |
|
309 | + $qv = & $query->query_vars; |
|
310 | 310 | |
311 | 311 | // Prevent redirect when on the single entry endpoint |
312 | - if( self::is_single_entry() ) { |
|
312 | + if ( self::is_single_entry() ) { |
|
313 | 313 | add_filter( 'redirect_canonical', '__return_false' ); |
314 | 314 | } |
315 | 315 | |
316 | 316 | $query->is_page = true; |
317 | 317 | $query->is_home = false; |
318 | - $qv['page_id'] = $front_page_id; |
|
318 | + $qv[ 'page_id' ] = $front_page_id; |
|
319 | 319 | |
320 | 320 | // Correct <!--nextpage--> for page_on_front |
321 | - if ( ! empty( $qv['paged'] ) ) { |
|
322 | - $qv['page'] = $qv['paged']; |
|
323 | - unset( $qv['paged'] ); |
|
321 | + if ( ! empty( $qv[ 'paged' ] ) ) { |
|
322 | + $qv[ 'page' ] = $qv[ 'paged' ]; |
|
323 | + unset( $qv[ 'paged' ] ); |
|
324 | 324 | } |
325 | 325 | } |
326 | 326 | |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | global $post; |
339 | 339 | |
340 | 340 | // If in admin and NOT AJAX request, get outta here. |
341 | - if ( GravityView_Plugin::is_admin() ) { |
|
341 | + if ( GravityView_Plugin::is_admin() ) { |
|
342 | 342 | return; |
343 | 343 | } |
344 | 344 | |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | |
351 | 351 | $this->setIsGravityviewPostType( get_post_type( $post ) === 'gravityview' ); |
352 | 352 | |
353 | - $post_id = $this->getPostId() ? $this->getPostId() : (isset( $post ) ? $post->ID : null ); |
|
353 | + $post_id = $this->getPostId() ? $this->getPostId() : ( isset( $post ) ? $post->ID : null ); |
|
354 | 354 | $this->setPostId( $post_id ); |
355 | 355 | $post_has_shortcode = ! empty( $post->post_content ) ? gravityview_has_shortcode_r( $post->post_content, 'gravityview' ) : false; |
356 | 356 | $this->setPostHasShortcode( $this->isGravityviewPostType() ? null : ! empty( $post_has_shortcode ) ); |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | |
387 | 387 | $search_method = GravityView_Widget_Search::getInstance()->get_search_method(); |
388 | 388 | |
389 | - if( 'post' === $search_method ) { |
|
389 | + if ( 'post' === $search_method ) { |
|
390 | 390 | $get = $_POST; |
391 | 391 | } else { |
392 | 392 | $get = $_GET; |
@@ -442,20 +442,20 @@ discard block |
||
442 | 442 | * @param boolean $in_the_loop Whether to apply the filter to the menu title and the meta tag <title> - outside the loop |
443 | 443 | * @param array $entry Current entry |
444 | 444 | */ |
445 | - $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop' , in_the_loop(), $entry ); |
|
445 | + $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop', in_the_loop(), $entry ); |
|
446 | 446 | |
447 | 447 | if ( ! $apply_outside_loop ) { |
448 | 448 | return $title; |
449 | 449 | } |
450 | 450 | |
451 | 451 | // User reported WooCommerce doesn't pass two args. |
452 | - if ( empty( $passed_post_id ) ) { |
|
452 | + if ( empty( $passed_post_id ) ) { |
|
453 | 453 | return $title; |
454 | 454 | } |
455 | 455 | |
456 | 456 | // Don't modify the title for anything other than the current view/post. |
457 | 457 | // This is true for embedded shortcodes and Views. |
458 | - if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) { |
|
458 | + if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) { |
|
459 | 459 | return $title; |
460 | 460 | } |
461 | 461 | |
@@ -465,19 +465,19 @@ discard block |
||
465 | 465 | $view_meta = $this->getGvOutputData()->get_view( $context_view_id ); |
466 | 466 | } else { |
467 | 467 | foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) { |
468 | - if ( intval( $view_data['form_id'] ) === intval( $entry['form_id'] ) ) { |
|
468 | + if ( intval( $view_data[ 'form_id' ] ) === intval( $entry[ 'form_id' ] ) ) { |
|
469 | 469 | $view_meta = $view_data; |
470 | 470 | break; |
471 | 471 | } |
472 | 472 | } |
473 | 473 | } |
474 | 474 | |
475 | - if ( ! empty( $view_meta['atts']['single_title'] ) ) { |
|
475 | + if ( ! empty( $view_meta[ 'atts' ][ 'single_title' ] ) ) { |
|
476 | 476 | |
477 | - $title = $view_meta['atts']['single_title']; |
|
477 | + $title = $view_meta[ 'atts' ][ 'single_title' ]; |
|
478 | 478 | |
479 | 479 | // We are allowing HTML in the fields, so no escaping the output |
480 | - $title = GravityView_API::replace_variables( $title, $view_meta['form'], $entry ); |
|
480 | + $title = GravityView_API::replace_variables( $title, $view_meta[ 'form' ], $entry ); |
|
481 | 481 | |
482 | 482 | $title = do_shortcode( $title ); |
483 | 483 | } |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | } |
514 | 514 | |
515 | 515 | // Only render in the loop. Fixes issues with the_content filter being applied in places like the sidebar |
516 | - if( ! in_the_loop() ) { |
|
516 | + if ( ! in_the_loop() ) { |
|
517 | 517 | return $content; |
518 | 518 | } |
519 | 519 | |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | |
578 | 578 | $context = GravityView_View::getInstance()->getContext(); |
579 | 579 | |
580 | - switch( $context ) { |
|
580 | + switch ( $context ) { |
|
581 | 581 | case 'directory': |
582 | 582 | $tab = __( 'Multiple Entries', 'gravityview' ); |
583 | 583 | break; |
@@ -591,9 +591,9 @@ discard block |
||
591 | 591 | } |
592 | 592 | |
593 | 593 | |
594 | - $title = sprintf( esc_html_x('The %s layout has not been configured.', 'Displayed when a View is not configured. %s is replaced by the tab label', 'gravityview' ), $tab ); |
|
594 | + $title = sprintf( esc_html_x( 'The %s layout has not been configured.', 'Displayed when a View is not configured. %s is replaced by the tab label', 'gravityview' ), $tab ); |
|
595 | 595 | $edit_link = admin_url( sprintf( 'post.php?post=%d&action=edit#%s-view', $view_id, $context ) ); |
596 | - $action_text = sprintf( esc_html__('Add fields to %s', 'gravityview' ), $tab ); |
|
596 | + $action_text = sprintf( esc_html__( 'Add fields to %s', 'gravityview' ), $tab ); |
|
597 | 597 | $message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gravityview' ); |
598 | 598 | |
599 | 599 | $output = sprintf( '<h3>%s <strong><a href="%s">%s</a></strong></h3><p>%s</p>', $title, esc_url( $edit_link ), $action_text, $message ); |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | public function render_view( $passed_args ) { |
627 | 627 | |
628 | 628 | // validate attributes |
629 | - if ( empty( $passed_args['id'] ) ) { |
|
629 | + if ( empty( $passed_args[ 'id' ] ) ) { |
|
630 | 630 | do_action( 'gravityview_log_error', '[render_view] Returning; no ID defined.', $passed_args ); |
631 | 631 | return null; |
632 | 632 | } |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | return null; |
649 | 649 | } |
650 | 650 | |
651 | - $view_id = $passed_args['id']; |
|
651 | + $view_id = $passed_args[ 'id' ]; |
|
652 | 652 | |
653 | 653 | $view_data = $this->getGvOutputData()->get_view( $view_id, $passed_args ); |
654 | 654 | |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | $passed_args = array_filter( $passed_args, 'strlen' ); |
662 | 662 | |
663 | 663 | //Override shortcode args over View template settings |
664 | - $atts = wp_parse_args( $passed_args, $view_data['atts'] ); |
|
664 | + $atts = wp_parse_args( $passed_args, $view_data[ 'atts' ] ); |
|
665 | 665 | |
666 | 666 | do_action( 'gravityview_log_debug', '[render_view] Arguments after merging with View settings: ', $atts ); |
667 | 667 | |
@@ -684,14 +684,14 @@ discard block |
||
684 | 684 | * @since 1.15 |
685 | 685 | * @since 1.17.2 Added check for if a user has no caps but is logged in (member of multisite, but not any site). Treat as if logged-out. |
686 | 686 | */ |
687 | - if( is_user_logged_in() && ! ( empty( wp_get_current_user()->caps ) && empty( wp_get_current_user()->roles ) ) && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
687 | + if ( is_user_logged_in() && ! ( empty( wp_get_current_user()->caps ) && empty( wp_get_current_user()->roles ) ) && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
688 | 688 | |
689 | 689 | do_action( 'gravityview_log_debug', sprintf( '%s Returning: View %d is not visible by current user.', __METHOD__, $view_id ) ); |
690 | 690 | |
691 | 691 | return null; |
692 | 692 | } |
693 | 693 | |
694 | - if( $this->isGravityviewPostType() ) { |
|
694 | + if ( $this->isGravityviewPostType() ) { |
|
695 | 695 | |
696 | 696 | /** |
697 | 697 | * @filter `gravityview_direct_access` Should Views be directly accessible, or only visible using the shortcode? |
@@ -703,9 +703,9 @@ discard block |
||
703 | 703 | */ |
704 | 704 | $direct_access = apply_filters( 'gravityview_direct_access', true, $view_id ); |
705 | 705 | |
706 | - $embed_only = ! empty( $atts['embed_only'] ); |
|
706 | + $embed_only = ! empty( $atts[ 'embed_only' ] ); |
|
707 | 707 | |
708 | - if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
708 | + if ( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
709 | 709 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
710 | 710 | } |
711 | 711 | } |
@@ -720,7 +720,7 @@ discard block |
||
720 | 720 | |
721 | 721 | $gravityview_view = new GravityView_View( $view_data ); |
722 | 722 | |
723 | - $post_id = ! empty( $atts['post_id'] ) ? intval( $atts['post_id'] ) : $this->getPostId(); |
|
723 | + $post_id = ! empty( $atts[ 'post_id' ] ) ? intval( $atts[ 'post_id' ] ) : $this->getPostId(); |
|
724 | 724 | |
725 | 725 | $gravityview_view->setPostId( $post_id ); |
726 | 726 | |
@@ -730,20 +730,20 @@ discard block |
||
730 | 730 | do_action( 'gravityview_log_debug', '[render_view] Executing Directory View' ); |
731 | 731 | |
732 | 732 | //fetch template and slug |
733 | - $view_slug = apply_filters( 'gravityview_template_slug_'. $view_data['template_id'], 'table', 'directory' ); |
|
733 | + $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'directory' ); |
|
734 | 734 | |
735 | 735 | do_action( 'gravityview_log_debug', '[render_view] View template slug: ', $view_slug ); |
736 | 736 | |
737 | 737 | /** |
738 | 738 | * Disable fetching initial entries for views that don't need it (DataTables) |
739 | 739 | */ |
740 | - $get_entries = apply_filters( 'gravityview_get_view_entries_'.$view_slug, true ); |
|
740 | + $get_entries = apply_filters( 'gravityview_get_view_entries_' . $view_slug, true ); |
|
741 | 741 | |
742 | 742 | /** |
743 | 743 | * Hide View data until search is performed |
744 | 744 | * @since 1.5.4 |
745 | 745 | */ |
746 | - if ( ! empty( $atts['hide_until_searched'] ) && ! $this->isSearch() ) { |
|
746 | + if ( ! empty( $atts[ 'hide_until_searched' ] ) && ! $this->isSearch() ) { |
|
747 | 747 | $gravityview_view->setHideUntilSearched( true ); |
748 | 748 | $get_entries = false; |
749 | 749 | } |
@@ -751,23 +751,23 @@ discard block |
||
751 | 751 | |
752 | 752 | if ( $get_entries ) { |
753 | 753 | |
754 | - if ( ! empty( $atts['sort_columns'] ) ) { |
|
754 | + if ( ! empty( $atts[ 'sort_columns' ] ) ) { |
|
755 | 755 | // add filter to enable column sorting |
756 | - add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ) , 100, 3 ); |
|
756 | + add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ), 100, 3 ); |
|
757 | 757 | } |
758 | 758 | |
759 | - $view_entries = self::get_view_entries( $atts, $view_data['form_id'] ); |
|
759 | + $view_entries = self::get_view_entries( $atts, $view_data[ 'form_id' ] ); |
|
760 | 760 | |
761 | - do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries['count'], sizeof( $view_entries['entries'] ) ) ); |
|
761 | + do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries[ 'count' ], sizeof( $view_entries[ 'entries' ] ) ) ); |
|
762 | 762 | |
763 | 763 | } else { |
764 | 764 | |
765 | 765 | $view_entries = array( 'count' => null, 'entries' => null, 'paging' => null ); |
766 | 766 | |
767 | - do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_'.$view_slug.'` is false' ); |
|
767 | + do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_' . $view_slug . '` is false' ); |
|
768 | 768 | } |
769 | 769 | |
770 | - $gravityview_view->setPaging( $view_entries['paging'] ); |
|
770 | + $gravityview_view->setPaging( $view_entries[ 'paging' ] ); |
|
771 | 771 | $gravityview_view->setContext( 'directory' ); |
772 | 772 | $sections = array( 'header', 'body', 'footer' ); |
773 | 773 | |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | * @action `gravityview_render_entry_{View ID}` Before rendering a single entry for a specific View ID |
782 | 782 | * @since 1.17 |
783 | 783 | */ |
784 | - do_action( 'gravityview_render_entry_'.$view_data['id'] ); |
|
784 | + do_action( 'gravityview_render_entry_' . $view_data[ 'id' ] ); |
|
785 | 785 | |
786 | 786 | $entry = $this->getEntry(); |
787 | 787 | |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | do_action( 'gravityview_log_debug', '[render_view] Entry does not exist. This may be because of View filters limiting access.' ); |
792 | 792 | |
793 | 793 | // Only display warning once when multiple Views are embedded |
794 | - if( $view_id !== (int) GravityView_frontend::get_context_view_id() ) { |
|
794 | + if ( $view_id !== (int)GravityView_frontend::get_context_view_id() ) { |
|
795 | 795 | return null; |
796 | 796 | } |
797 | 797 | |
@@ -813,20 +813,20 @@ discard block |
||
813 | 813 | // We're in single view, but the view being processed is not the same view the single entry belongs to. |
814 | 814 | // important: do not remove this as it prevents fake attempts of displaying entries from other views/forms |
815 | 815 | if ( $this->getGvOutputData()->has_multiple_views() && $view_id != $this->get_context_view_id() ) { |
816 | - do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: '. $view_id ); |
|
816 | + do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: ' . $view_id ); |
|
817 | 817 | return null; |
818 | 818 | } |
819 | 819 | |
820 | 820 | //fetch template and slug |
821 | - $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data['template_id'], 'table', 'single' ); |
|
821 | + $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'single' ); |
|
822 | 822 | do_action( 'gravityview_log_debug', '[render_view] View single template slug: ', $view_slug ); |
823 | 823 | |
824 | 824 | //fetch entry detail |
825 | - $view_entries['count'] = 1; |
|
826 | - $view_entries['entries'][] = $entry; |
|
827 | - do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries['entries'] ); |
|
825 | + $view_entries[ 'count' ] = 1; |
|
826 | + $view_entries[ 'entries' ][ ] = $entry; |
|
827 | + do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries[ 'entries' ] ); |
|
828 | 828 | |
829 | - $back_link_label = isset( $atts['back_link_label'] ) ? $atts['back_link_label'] : null; |
|
829 | + $back_link_label = isset( $atts[ 'back_link_label' ] ) ? $atts[ 'back_link_label' ] : null; |
|
830 | 830 | |
831 | 831 | // set back link label |
832 | 832 | $gravityview_view->setBackLinkLabel( $back_link_label ); |
@@ -836,11 +836,11 @@ discard block |
||
836 | 836 | } |
837 | 837 | |
838 | 838 | // add template style |
839 | - self::add_style( $view_data['template_id'] ); |
|
839 | + self::add_style( $view_data[ 'template_id' ] ); |
|
840 | 840 | |
841 | 841 | // Prepare to render view and set vars |
842 | - $gravityview_view->setEntries( $view_entries['entries'] ); |
|
843 | - $gravityview_view->setTotalEntries( $view_entries['count'] ); |
|
842 | + $gravityview_view->setEntries( $view_entries[ 'entries' ] ); |
|
843 | + $gravityview_view->setTotalEntries( $view_entries[ 'count' ] ); |
|
844 | 844 | |
845 | 845 | // If Edit |
846 | 846 | if ( 'edit' === gravityview_get_context() ) { |
@@ -853,11 +853,11 @@ discard block |
||
853 | 853 | |
854 | 854 | } else { |
855 | 855 | // finaly we'll render some html |
856 | - $sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data['template_id'] ); |
|
856 | + $sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data[ 'template_id' ] ); |
|
857 | 857 | |
858 | 858 | do_action( 'gravityview_log_debug', '[render_view] Sections to render: ', $sections ); |
859 | 859 | foreach ( $sections as $section ) { |
860 | - do_action( 'gravityview_log_debug', '[render_view] Rendering '. $section . ' section.' ); |
|
860 | + do_action( 'gravityview_log_debug', '[render_view] Rendering ' . $section . ' section.' ); |
|
861 | 861 | $gravityview_view->render( $view_slug, $section, false ); |
862 | 862 | } |
863 | 863 | } |
@@ -911,7 +911,7 @@ discard block |
||
911 | 911 | $datetime_format = 'Y-m-d H:i:s'; |
912 | 912 | $search_is_outside_view_bounds = false; |
913 | 913 | |
914 | - if( ! empty( $search_criteria[ $key ] ) ) { |
|
914 | + if ( ! empty( $search_criteria[ $key ] ) ) { |
|
915 | 915 | |
916 | 916 | $search_date = strtotime( $search_criteria[ $key ] ); |
917 | 917 | |
@@ -939,14 +939,14 @@ discard block |
||
939 | 939 | if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) { |
940 | 940 | |
941 | 941 | // Then we override the search and re-set the start date |
942 | - $return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true ); |
|
942 | + $return_search_criteria[ $key ] = date_i18n( $datetime_format, $date, true ); |
|
943 | 943 | } |
944 | 944 | } |
945 | 945 | } |
946 | 946 | |
947 | - if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) { |
|
947 | + if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) { |
|
948 | 948 | // The start date is AFTER the end date. This will result in no results, but let's not force the issue. |
949 | - if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) { |
|
949 | + if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) { |
|
950 | 950 | do_action( 'gravityview_log_error', __METHOD__ . ' Invalid search: the start date is after the end date.', $return_search_criteria ); |
951 | 951 | } |
952 | 952 | } |
@@ -965,19 +965,19 @@ discard block |
||
965 | 965 | public static function process_search_only_approved( $args, $search_criteria ) { |
966 | 966 | |
967 | 967 | /** @since 1.19 */ |
968 | - if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) { |
|
968 | + if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
969 | 969 | do_action( 'gravityview_log_debug', __METHOD__ . ': User can moderate entries; showing all approval statuses' ); |
970 | 970 | return $search_criteria; |
971 | 971 | } |
972 | 972 | |
973 | - if ( ! empty( $args['show_only_approved'] ) ) { |
|
973 | + if ( ! empty( $args[ 'show_only_approved' ] ) ) { |
|
974 | 974 | |
975 | - $search_criteria['field_filters'][] = array( |
|
975 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
976 | 976 | 'key' => GravityView_Entry_Approval::meta_key, |
977 | 977 | 'value' => GravityView_Entry_Approval_Status::APPROVED |
978 | 978 | ); |
979 | 979 | |
980 | - $search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met |
|
980 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met |
|
981 | 981 | |
982 | 982 | do_action( 'gravityview_log_debug', '[process_search_only_approved] Search Criteria if show only approved: ', $search_criteria ); |
983 | 983 | } |
@@ -1004,18 +1004,18 @@ discard block |
||
1004 | 1004 | */ |
1005 | 1005 | public static function is_entry_approved( $entry, $args = array() ) { |
1006 | 1006 | |
1007 | - if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) { |
|
1007 | + if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) { |
|
1008 | 1008 | // is implicitly approved if entry is null or View settings doesn't require to check for approval |
1009 | 1009 | return true; |
1010 | 1010 | } |
1011 | 1011 | |
1012 | 1012 | /** @since 1.19 */ |
1013 | - if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) { |
|
1013 | + if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
1014 | 1014 | do_action( 'gravityview_log_debug', __METHOD__ . ': User can moderate entries, so entry is approved for viewing' ); |
1015 | 1015 | return true; |
1016 | 1016 | } |
1017 | 1017 | |
1018 | - $is_approved = gform_get_meta( $entry['id'], GravityView_Entry_Approval::meta_key ); |
|
1018 | + $is_approved = gform_get_meta( $entry[ 'id' ], GravityView_Entry_Approval::meta_key ); |
|
1019 | 1019 | |
1020 | 1020 | return GravityView_Entry_Approval_Status::is_approved( $is_approved ); |
1021 | 1021 | } |
@@ -1049,26 +1049,26 @@ discard block |
||
1049 | 1049 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', $search_criteria ); |
1050 | 1050 | |
1051 | 1051 | // implicity search |
1052 | - if ( ! empty( $args['search_value'] ) ) { |
|
1052 | + if ( ! empty( $args[ 'search_value' ] ) ) { |
|
1053 | 1053 | |
1054 | 1054 | // Search operator options. Options: `is` or `contains` |
1055 | - $operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains'; |
|
1055 | + $operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains'; |
|
1056 | 1056 | |
1057 | - $search_criteria['field_filters'][] = array( |
|
1057 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
1058 | 1058 | 'key' => rgget( 'search_field', $args ), // The field ID to search |
1059 | - 'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes. |
|
1059 | + 'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes. |
|
1060 | 1060 | 'operator' => $operator, |
1061 | 1061 | ); |
1062 | 1062 | } |
1063 | 1063 | |
1064 | - if( $search_criteria !== $original_search_criteria ) { |
|
1064 | + if ( $search_criteria !== $original_search_criteria ) { |
|
1065 | 1065 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after implicity search: ', $search_criteria ); |
1066 | 1066 | } |
1067 | 1067 | |
1068 | 1068 | // Handle setting date range |
1069 | 1069 | $search_criteria = self::process_search_dates( $args, $search_criteria ); |
1070 | 1070 | |
1071 | - if( $search_criteria !== $original_search_criteria ) { |
|
1071 | + if ( $search_criteria !== $original_search_criteria ) { |
|
1072 | 1072 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after date params: ', $search_criteria ); |
1073 | 1073 | } |
1074 | 1074 | |
@@ -1079,7 +1079,7 @@ discard block |
||
1079 | 1079 | * @filter `gravityview_status` Modify entry status requirements to be included in search results. |
1080 | 1080 | * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash` |
1081 | 1081 | */ |
1082 | - $search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args ); |
|
1082 | + $search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args ); |
|
1083 | 1083 | |
1084 | 1084 | return $search_criteria; |
1085 | 1085 | } |
@@ -1125,16 +1125,16 @@ discard block |
||
1125 | 1125 | $search_criteria = self::get_search_criteria( $args, $form_id ); |
1126 | 1126 | |
1127 | 1127 | // Paging & offset |
1128 | - $page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : apply_filters( 'gravityview_default_page_size', 25 ); |
|
1128 | + $page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : apply_filters( 'gravityview_default_page_size', 25 ); |
|
1129 | 1129 | |
1130 | 1130 | if ( -1 === $page_size ) { |
1131 | 1131 | $page_size = PHP_INT_MAX; |
1132 | 1132 | } |
1133 | 1133 | |
1134 | - if ( isset( $args['offset'] ) ) { |
|
1135 | - $offset = intval( $args['offset'] ); |
|
1134 | + if ( isset( $args[ 'offset' ] ) ) { |
|
1135 | + $offset = intval( $args[ 'offset' ] ); |
|
1136 | 1136 | } else { |
1137 | - $curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] ); |
|
1137 | + $curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] ); |
|
1138 | 1138 | $offset = ( $curr_page - 1 ) * $page_size; |
1139 | 1139 | } |
1140 | 1140 | |
@@ -1152,7 +1152,7 @@ discard block |
||
1152 | 1152 | 'search_criteria' => $search_criteria, |
1153 | 1153 | 'sorting' => $sorting, |
1154 | 1154 | 'paging' => $paging, |
1155 | - 'cache' => isset( $args['cache'] ) ? $args['cache'] : true, |
|
1155 | + 'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true, |
|
1156 | 1156 | ); |
1157 | 1157 | |
1158 | 1158 | /** |
@@ -1177,7 +1177,7 @@ discard block |
||
1177 | 1177 | * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys. |
1178 | 1178 | * @param array $args View configuration args. |
1179 | 1179 | */ |
1180 | - $parameters = apply_filters( 'gravityview_get_entries_'.$args['id'], $parameters, $args, $form_id ); |
|
1180 | + $parameters = apply_filters( 'gravityview_get_entries_' . $args[ 'id' ], $parameters, $args, $form_id ); |
|
1181 | 1181 | |
1182 | 1182 | do_action( 'gravityview_log_debug', __METHOD__ . ': $parameters passed to gravityview_get_entries(): ', $parameters ); |
1183 | 1183 | |
@@ -1217,8 +1217,8 @@ discard block |
||
1217 | 1217 | */ |
1218 | 1218 | public static function updateViewSorting( $args, $form_id ) { |
1219 | 1219 | $sorting = array(); |
1220 | - $sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : rgar( $args, 'sort_field' ); |
|
1221 | - $sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : rgar( $args, 'sort_direction' ); |
|
1220 | + $sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : rgar( $args, 'sort_field' ); |
|
1221 | + $sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : rgar( $args, 'sort_direction' ); |
|
1222 | 1222 | |
1223 | 1223 | $sort_field_id = self::_override_sorting_id_by_field_type( $sort_field_id, $form_id ); |
1224 | 1224 | |
@@ -1258,11 +1258,11 @@ discard block |
||
1258 | 1258 | |
1259 | 1259 | $sort_field = GFFormsModel::get_field( $form, $sort_field_id ); |
1260 | 1260 | |
1261 | - if( ! $sort_field ) { |
|
1261 | + if ( ! $sort_field ) { |
|
1262 | 1262 | return $sort_field_id; |
1263 | 1263 | } |
1264 | 1264 | |
1265 | - switch ( $sort_field['type'] ) { |
|
1265 | + switch ( $sort_field[ 'type' ] ) { |
|
1266 | 1266 | |
1267 | 1267 | case 'address': |
1268 | 1268 | // Sorting by full address |
@@ -1279,7 +1279,7 @@ discard block |
||
1279 | 1279 | */ |
1280 | 1280 | $address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); |
1281 | 1281 | |
1282 | - switch( strtolower( $address_part ) ){ |
|
1282 | + switch ( strtolower( $address_part ) ) { |
|
1283 | 1283 | case 'street': |
1284 | 1284 | $sort_field_id .= '.1'; |
1285 | 1285 | break; |
@@ -1359,7 +1359,7 @@ discard block |
||
1359 | 1359 | */ |
1360 | 1360 | $single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); |
1361 | 1361 | |
1362 | - if ( empty( $single_entry ) ){ |
|
1362 | + if ( empty( $single_entry ) ) { |
|
1363 | 1363 | return false; |
1364 | 1364 | } else { |
1365 | 1365 | return $single_entry; |
@@ -1386,7 +1386,7 @@ discard block |
||
1386 | 1386 | * Don't enqueue the scripts or styles if it's not going to be displayed. |
1387 | 1387 | * @since 1.15 |
1388 | 1388 | */ |
1389 | - if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
1389 | + if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
1390 | 1390 | continue; |
1391 | 1391 | } |
1392 | 1392 | |
@@ -1395,19 +1395,19 @@ discard block |
||
1395 | 1395 | $css_dependencies = array(); |
1396 | 1396 | |
1397 | 1397 | // If the thickbox is enqueued, add dependencies |
1398 | - if ( ! empty( $data['atts']['lightbox'] ) ) { |
|
1398 | + if ( ! empty( $data[ 'atts' ][ 'lightbox' ] ) ) { |
|
1399 | 1399 | |
1400 | 1400 | /** |
1401 | 1401 | * @filter `gravity_view_lightbox_script` Override the lightbox script to enqueue. Default: `thickbox` |
1402 | 1402 | * @param string $script_slug If you want to use a different lightbox script, return the name of it here. |
1403 | 1403 | */ |
1404 | - $js_dependencies[] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
1404 | + $js_dependencies[ ] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
1405 | 1405 | |
1406 | 1406 | /** |
1407 | 1407 | * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox` |
1408 | 1408 | * @param string $script_slug If you want to use a different lightbox script, return the name of its CSS file here. |
1409 | 1409 | */ |
1410 | - $css_dependencies[] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
1410 | + $css_dependencies[ ] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
1411 | 1411 | } |
1412 | 1412 | |
1413 | 1413 | /** |
@@ -1415,25 +1415,25 @@ discard block |
||
1415 | 1415 | * @see https://github.com/katzwebservices/GravityView/issues/536 |
1416 | 1416 | * @since 1.15 |
1417 | 1417 | */ |
1418 | - if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) { |
|
1419 | - $css_dependencies[] = 'dashicons'; |
|
1418 | + if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) { |
|
1419 | + $css_dependencies[ ] = 'dashicons'; |
|
1420 | 1420 | } |
1421 | 1421 | |
1422 | 1422 | wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
1423 | 1423 | |
1424 | 1424 | $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
1425 | 1425 | |
1426 | - wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ) , GravityView_Plugin::version, true ); |
|
1426 | + wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ), GravityView_Plugin::version, true ); |
|
1427 | 1427 | |
1428 | 1428 | wp_enqueue_script( 'gravityview-fe-view' ); |
1429 | 1429 | |
1430 | - if ( ! empty( $data['atts']['sort_columns'] ) ) { |
|
1430 | + if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) { |
|
1431 | 1431 | wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' ); |
1432 | 1432 | } |
1433 | 1433 | |
1434 | 1434 | $this->enqueue_default_style( $css_dependencies ); |
1435 | 1435 | |
1436 | - self::add_style( $data['template_id'] ); |
|
1436 | + self::add_style( $data[ 'template_id' ] ); |
|
1437 | 1437 | } |
1438 | 1438 | |
1439 | 1439 | if ( 'wp_print_footer_scripts' === current_filter() ) { |
@@ -1495,7 +1495,7 @@ discard block |
||
1495 | 1495 | } elseif ( empty( $template_id ) ) { |
1496 | 1496 | do_action( 'gravityview_log_error', '[add_style] Cannot add template style; template_id is empty' ); |
1497 | 1497 | } else { |
1498 | - do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_'.$template_id ) ); |
|
1498 | + do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_' . $template_id ) ); |
|
1499 | 1499 | } |
1500 | 1500 | |
1501 | 1501 | } |
@@ -1520,11 +1520,11 @@ discard block |
||
1520 | 1520 | * Not a table-based template; don't add sort icons |
1521 | 1521 | * @since 1.12 |
1522 | 1522 | */ |
1523 | - if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
1523 | + if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
1524 | 1524 | return $label; |
1525 | 1525 | } |
1526 | 1526 | |
1527 | - if ( ! $this->is_field_sortable( $field['id'], $form ) ) { |
|
1527 | + if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) { |
|
1528 | 1528 | return $label; |
1529 | 1529 | } |
1530 | 1530 | |
@@ -1532,29 +1532,29 @@ discard block |
||
1532 | 1532 | |
1533 | 1533 | $class = 'gv-sort'; |
1534 | 1534 | |
1535 | - $sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] ); |
|
1535 | + $sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] ); |
|
1536 | 1536 | |
1537 | 1537 | $sort_args = array( |
1538 | - 'sort' => $field['id'], |
|
1538 | + 'sort' => $field[ 'id' ], |
|
1539 | 1539 | 'dir' => 'asc', |
1540 | 1540 | ); |
1541 | 1541 | |
1542 | - if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) { |
|
1542 | + if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) { |
|
1543 | 1543 | //toggle sorting direction. |
1544 | - if ( 'asc' === $sorting['direction'] ) { |
|
1545 | - $sort_args['dir'] = 'desc'; |
|
1544 | + if ( 'asc' === $sorting[ 'direction' ] ) { |
|
1545 | + $sort_args[ 'dir' ] = 'desc'; |
|
1546 | 1546 | $class .= ' gv-icon-sort-desc'; |
1547 | 1547 | } else { |
1548 | - $sort_args['dir'] = 'asc'; |
|
1548 | + $sort_args[ 'dir' ] = 'asc'; |
|
1549 | 1549 | $class .= ' gv-icon-sort-asc'; |
1550 | 1550 | } |
1551 | 1551 | } else { |
1552 | 1552 | $class .= ' gv-icon-caret-up-down'; |
1553 | 1553 | } |
1554 | 1554 | |
1555 | - $url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) ); |
|
1555 | + $url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) ); |
|
1556 | 1556 | |
1557 | - return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a> '. $label; |
|
1557 | + return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a> ' . $label; |
|
1558 | 1558 | |
1559 | 1559 | } |
1560 | 1560 | |
@@ -1572,7 +1572,7 @@ discard block |
||
1572 | 1572 | |
1573 | 1573 | $field_type = $field_id; |
1574 | 1574 | |
1575 | - if( is_numeric( $field_id ) ) { |
|
1575 | + if ( is_numeric( $field_id ) ) { |
|
1576 | 1576 | $field = GFFormsModel::get_field( $form, $field_id ); |
1577 | 1577 | $field_type = $field->type; |
1578 | 1578 | } |
@@ -1595,7 +1595,7 @@ discard block |
||
1595 | 1595 | return false; |
1596 | 1596 | } |
1597 | 1597 | |
1598 | - return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
1598 | + return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
1599 | 1599 | |
1600 | 1600 | } |
1601 | 1601 |
@@ -295,7 +295,8 @@ discard block |
||
295 | 295 | if ( empty( $license_data ) ) { |
296 | 296 | if ( $is_ajax ) { |
297 | 297 | exit( json_encode( array() ) ); |
298 | - } else { // Non-ajax call |
|
298 | + } else { |
|
299 | +// Non-ajax call |
|
299 | 300 | return json_encode( array() ); |
300 | 301 | } |
301 | 302 | } |
@@ -325,7 +326,8 @@ discard block |
||
325 | 326 | |
326 | 327 | if ( $is_ajax ) { |
327 | 328 | exit( $json ); |
328 | - } else { // Non-ajax call |
|
329 | + } else { |
|
330 | +// Non-ajax call |
|
329 | 331 | return ( rgget('format', $data ) === 'object' ) ? $license_data : $json; |
330 | 332 | } |
331 | 333 | } |
@@ -86,7 +86,6 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @since 1.19.3 |
88 | 88 | * |
89 | - * @param bool $force Whether to force checking license, even if AJAX |
|
90 | 89 | * |
91 | 90 | * @return void |
92 | 91 | */ |
@@ -272,6 +271,9 @@ discard block |
||
272 | 271 | return $implode ? implode( $implode, $extensions ) : $extensions; |
273 | 272 | } |
274 | 273 | |
274 | + /** |
|
275 | + * @param boolean $echo |
|
276 | + */ |
|
275 | 277 | function settings_edd_license_activation( $field, $echo ) { |
276 | 278 | |
277 | 279 | $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
@@ -464,7 +466,7 @@ discard block |
||
464 | 466 | * Generate the status message box HTML based on the current status |
465 | 467 | * |
466 | 468 | * @since 1.7.4 |
467 | - * @param $message |
|
469 | + * @param string $message |
|
468 | 470 | * @param string $class |
469 | 471 | * |
470 | 472 | * @return string |
@@ -115,14 +115,14 @@ discard block |
||
115 | 115 | // Call the custom API. |
116 | 116 | $response = wp_remote_post( self::url, array( |
117 | 117 | 'timeout' => 15, |
118 | - 'sslverify' => false, |
|
119 | - 'body' => array( |
|
120 | - 'edd_action' => 'check_license', |
|
121 | - 'license' => trim( $this->Addon->get_app_setting( 'license_key' ) ), |
|
122 | - 'item_name' => self::name, |
|
123 | - 'url' => home_url(), |
|
124 | - 'site_data' => $this->get_site_data(), |
|
125 | - ), |
|
118 | + 'sslverify' => false, |
|
119 | + 'body' => array( |
|
120 | + 'edd_action' => 'check_license', |
|
121 | + 'license' => trim( $this->Addon->get_app_setting( 'license_key' ) ), |
|
122 | + 'item_name' => self::name, |
|
123 | + 'url' => home_url(), |
|
124 | + 'site_data' => $this->get_site_data(), |
|
125 | + ), |
|
126 | 126 | )); |
127 | 127 | |
128 | 128 | // make sure the response came back okay |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | // Update option with passed data license |
676 | 676 | $settings = $this->Addon->get_app_settings(); |
677 | 677 | |
678 | - $settings['license_key'] = $license_data->license_key = trim( $data['license'] ); |
|
678 | + $settings['license_key'] = $license_data->license_key = trim( $data['license'] ); |
|
679 | 679 | $settings['license_key_status'] = $license_data->license; |
680 | 680 | $settings['license_key_response'] = (array)$license_data; |
681 | 681 |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * @return GV_License_Handler |
47 | 47 | */ |
48 | 48 | public static function get_instance( GravityView_Settings $GFAddOn ) { |
49 | - if( empty( self::$instance ) ) { |
|
49 | + if ( empty( self::$instance ) ) { |
|
50 | 50 | self::$instance = new self( $GFAddOn ); |
51 | 51 | } |
52 | 52 | return self::$instance; |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | 'url' => home_url(), |
124 | 124 | 'site_data' => $this->get_site_data(), |
125 | 125 | ), |
126 | - )); |
|
126 | + ) ); |
|
127 | 127 | |
128 | 128 | // make sure the response came back okay |
129 | 129 | if ( is_wp_error( $response ) ) { |
@@ -149,12 +149,12 @@ discard block |
||
149 | 149 | */ |
150 | 150 | public function refresh_license_status() { |
151 | 151 | |
152 | - if ( defined('DOING_AJAX') && DOING_AJAX ) { |
|
152 | + if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
153 | 153 | return; |
154 | 154 | } |
155 | 155 | |
156 | 156 | // The transient is fresh; don't fetch. |
157 | - if( $status = get_transient( self::status_transient_key ) ) { |
|
157 | + if ( $status = get_transient( self::status_transient_key ) ) { |
|
158 | 158 | return; |
159 | 159 | } |
160 | 160 | |
@@ -187,48 +187,48 @@ discard block |
||
187 | 187 | $theme_data = wp_get_theme(); |
188 | 188 | $theme = $theme_data->Name . ' ' . $theme_data->Version; |
189 | 189 | |
190 | - $data['gv_version'] = GravityView_Plugin::version; |
|
191 | - $data['php_version'] = phpversion(); |
|
192 | - $data['wp_version'] = get_bloginfo( 'version' ); |
|
193 | - $data['gf_version'] = GFForms::$version; |
|
194 | - $data['server'] = isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : ''; |
|
195 | - $data['multisite'] = is_multisite(); |
|
196 | - $data['theme'] = $theme; |
|
197 | - $data['url'] = home_url(); |
|
198 | - $data['license_key'] = GravityView_Settings::get_instance()->get_app_setting( 'license_key' ); |
|
190 | + $data[ 'gv_version' ] = GravityView_Plugin::version; |
|
191 | + $data[ 'php_version' ] = phpversion(); |
|
192 | + $data[ 'wp_version' ] = get_bloginfo( 'version' ); |
|
193 | + $data[ 'gf_version' ] = GFForms::$version; |
|
194 | + $data[ 'server' ] = isset( $_SERVER[ 'SERVER_SOFTWARE' ] ) ? $_SERVER[ 'SERVER_SOFTWARE' ] : ''; |
|
195 | + $data[ 'multisite' ] = is_multisite(); |
|
196 | + $data[ 'theme' ] = $theme; |
|
197 | + $data[ 'url' ] = home_url(); |
|
198 | + $data[ 'license_key' ] = GravityView_Settings::get_instance()->get_app_setting( 'license_key' ); |
|
199 | 199 | |
200 | 200 | // View Data |
201 | - $gravityview_posts = get_posts('numberposts=-1&post_type=gravityview&post_status=publish&order=ASC'); |
|
201 | + $gravityview_posts = get_posts( 'numberposts=-1&post_type=gravityview&post_status=publish&order=ASC' ); |
|
202 | 202 | |
203 | 203 | if ( ! empty( $gravityview_posts ) ) { |
204 | 204 | $first = array_shift( $gravityview_posts ); |
205 | 205 | $latest = array_pop( $gravityview_posts ); |
206 | - $data['view_count'] = count( $gravityview_posts ); |
|
207 | - $data['view_first'] = $first->post_date; |
|
208 | - $data['view_latest'] = $latest->post_date; |
|
206 | + $data[ 'view_count' ] = count( $gravityview_posts ); |
|
207 | + $data[ 'view_first' ] = $first->post_date; |
|
208 | + $data[ 'view_latest' ] = $latest->post_date; |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | // Form counts |
212 | 212 | if ( class_exists( 'GFFormsModel' ) ) { |
213 | 213 | $form_data = GFFormsModel::get_form_count(); |
214 | - $data['forms_total'] = rgar( $form_data, 'total', 0 ); |
|
215 | - $data['forms_active'] = rgar( $form_data, 'active', 0 ); |
|
216 | - $data['forms_inactive'] = rgar( $form_data, 'inactive', 0 ); |
|
217 | - $data['forms_trash'] = rgar( $form_data, 'inactive', 0 ); |
|
214 | + $data[ 'forms_total' ] = rgar( $form_data, 'total', 0 ); |
|
215 | + $data[ 'forms_active' ] = rgar( $form_data, 'active', 0 ); |
|
216 | + $data[ 'forms_inactive' ] = rgar( $form_data, 'inactive', 0 ); |
|
217 | + $data[ 'forms_trash' ] = rgar( $form_data, 'inactive', 0 ); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | // Retrieve current plugin information |
221 | - if( ! function_exists( 'get_plugins' ) ) { |
|
221 | + if ( ! function_exists( 'get_plugins' ) ) { |
|
222 | 222 | include ABSPATH . '/wp-admin/includes/plugin.php'; |
223 | 223 | } |
224 | 224 | |
225 | - $data['integrations'] = self::get_related_plugins_and_extensions(); |
|
226 | - $data['active_plugins'] = get_option( 'active_plugins', array() ); |
|
227 | - $data['inactive_plugins'] = array(); |
|
228 | - $data['locale'] = get_locale(); |
|
225 | + $data[ 'integrations' ] = self::get_related_plugins_and_extensions(); |
|
226 | + $data[ 'active_plugins' ] = get_option( 'active_plugins', array() ); |
|
227 | + $data[ 'inactive_plugins' ] = array(); |
|
228 | + $data[ 'locale' ] = get_locale(); |
|
229 | 229 | |
230 | 230 | // Validate request on the GV server |
231 | - $data['hash'] = 'gv_version.url.locale:' . sha1( $data['gv_version'] . $data['url'] . $data['locale'] ); |
|
231 | + $data[ 'hash' ] = 'gv_version.url.locale:' . sha1( $data[ 'gv_version' ] . $data[ 'url' ] . $data[ 'locale' ] ); |
|
232 | 232 | |
233 | 233 | return $data; |
234 | 234 | } |
@@ -260,10 +260,10 @@ discard block |
||
260 | 260 | |
261 | 261 | $plugin_data = get_plugin_data( $active_plugin ); |
262 | 262 | |
263 | - $extensions[] = sprintf( '%s %s', $plugin_data['Name'], $plugin_data['Version'] ); |
|
263 | + $extensions[ ] = sprintf( '%s %s', $plugin_data[ 'Name' ], $plugin_data[ 'Version' ] ); |
|
264 | 264 | } |
265 | 265 | |
266 | - if( ! empty( $extensions ) ) { |
|
266 | + if ( ! empty( $extensions ) ) { |
|
267 | 267 | set_site_transient( self::related_plugins_key, $extensions, HOUR_IN_SECONDS ); |
268 | 268 | } else { |
269 | 269 | return 'There was an error fetching related plugins.'; |
@@ -282,37 +282,37 @@ discard block |
||
282 | 282 | $status = trim( $this->Addon->get_app_setting( 'license_key_status' ) ); |
283 | 283 | $key = trim( $this->Addon->get_app_setting( 'license_key' ) ); |
284 | 284 | |
285 | - if( !empty( $key ) ) { |
|
285 | + if ( ! empty( $key ) ) { |
|
286 | 286 | $response = $this->Addon->get_app_setting( 'license_key_response' ); |
287 | - $response = is_array( $response ) ? (object) $response : json_decode( $response ); |
|
287 | + $response = is_array( $response ) ? (object)$response : json_decode( $response ); |
|
288 | 288 | } else { |
289 | 289 | $response = array(); |
290 | 290 | } |
291 | 291 | |
292 | 292 | wp_localize_script( 'gv-admin-edd-license', 'GVGlobals', array( |
293 | 293 | 'license_box' => $this->get_license_message( $response ) |
294 | - )); |
|
294 | + ) ); |
|
295 | 295 | |
296 | 296 | |
297 | 297 | $fields = array( |
298 | 298 | array( |
299 | 299 | 'name' => 'edd-activate', |
300 | - 'value' => __('Activate License', 'gravityview'), |
|
301 | - 'data-pending_text' => __('Verifying license…', 'gravityview'), |
|
300 | + 'value' => __( 'Activate License', 'gravityview' ), |
|
301 | + 'data-pending_text' => __( 'Verifying license…', 'gravityview' ), |
|
302 | 302 | 'data-edd_action' => 'activate_license', |
303 | 303 | 'class' => 'button-primary', |
304 | 304 | ), |
305 | 305 | array( |
306 | 306 | 'name' => 'edd-deactivate', |
307 | - 'value' => __('Deactivate License', 'gravityview'), |
|
308 | - 'data-pending_text' => __('Deactivating license…', 'gravityview'), |
|
307 | + 'value' => __( 'Deactivate License', 'gravityview' ), |
|
308 | + 'data-pending_text' => __( 'Deactivating license…', 'gravityview' ), |
|
309 | 309 | 'data-edd_action' => 'deactivate_license', |
310 | 310 | 'class' => ( empty( $status ) ? 'button-primary hide' : 'button-primary' ), |
311 | 311 | ), |
312 | 312 | array( |
313 | 313 | 'name' => 'edd-check', |
314 | - 'value' => __('Check License', 'gravityview'), |
|
315 | - 'data-pending_text' => __('Verifying license…', 'gravityview'), |
|
314 | + 'value' => __( 'Check License', 'gravityview' ), |
|
315 | + 'data-pending_text' => __( 'Verifying license…', 'gravityview' ), |
|
316 | 316 | 'title' => 'Check the license before saving it', |
317 | 317 | 'data-edd_action' => 'check_license', |
318 | 318 | 'class' => 'button-secondary', |
@@ -322,17 +322,17 @@ discard block |
||
322 | 322 | |
323 | 323 | $class = 'button gv-edd-action'; |
324 | 324 | |
325 | - $class .= ( !empty( $key ) && $status !== 'valid' ) ? '' : ' hide'; |
|
325 | + $class .= ( ! empty( $key ) && $status !== 'valid' ) ? '' : ' hide'; |
|
326 | 326 | |
327 | 327 | $disabled_attribute = GVCommon::has_cap( 'gravityview_edit_settings' ) ? false : 'disabled'; |
328 | 328 | |
329 | 329 | $submit = '<div class="gv-edd-button-wrapper">'; |
330 | 330 | foreach ( $fields as $field ) { |
331 | - $field['type'] = 'button'; |
|
332 | - $field['class'] = isset( $field['class'] ) ? $field['class'] . ' '. $class : $class; |
|
333 | - $field['style'] = 'margin-left: 10px;'; |
|
334 | - if( $disabled_attribute ) { |
|
335 | - $field['disabled'] = $disabled_attribute; |
|
331 | + $field[ 'type' ] = 'button'; |
|
332 | + $field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] . ' ' . $class : $class; |
|
333 | + $field[ 'style' ] = 'margin-left: 10px;'; |
|
334 | + if ( $disabled_attribute ) { |
|
335 | + $field[ 'disabled' ] = $disabled_attribute; |
|
336 | 336 | } |
337 | 337 | $submit .= $this->Addon->settings_submit( $field, $echo ); |
338 | 338 | } |
@@ -348,8 +348,8 @@ discard block |
||
348 | 348 | */ |
349 | 349 | private function setup_edd() { |
350 | 350 | |
351 | - if( !class_exists('EDD_SL_Plugin_Updater') ) { |
|
352 | - require_once( GRAVITYVIEW_DIR . 'includes/lib/EDD_SL_Plugin_Updater.php'); |
|
351 | + if ( ! class_exists( 'EDD_SL_Plugin_Updater' ) ) { |
|
352 | + require_once( GRAVITYVIEW_DIR . 'includes/lib/EDD_SL_Plugin_Updater.php' ); |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | // setup the updater |
@@ -386,8 +386,8 @@ discard block |
||
386 | 386 | 'url' => home_url(), |
387 | 387 | ); |
388 | 388 | |
389 | - if( !empty( $action ) ) { |
|
390 | - $settings['edd_action'] = esc_attr( $action ); |
|
389 | + if ( ! empty( $action ) ) { |
|
390 | + $settings[ 'edd_action' ] = esc_attr( $action ); |
|
391 | 391 | } |
392 | 392 | |
393 | 393 | $settings = array_map( 'urlencode', $settings ); |
@@ -401,14 +401,14 @@ discard block |
||
401 | 401 | */ |
402 | 402 | private function _license_get_remote_response( $data, $license = '' ) { |
403 | 403 | |
404 | - $api_params = $this->_get_edd_settings( $data['edd_action'], $license ); |
|
404 | + $api_params = $this->_get_edd_settings( $data[ 'edd_action' ], $license ); |
|
405 | 405 | |
406 | 406 | $url = add_query_arg( $api_params, self::url ); |
407 | 407 | |
408 | 408 | $response = wp_remote_get( $url, array( |
409 | 409 | 'timeout' => 15, |
410 | 410 | 'sslverify' => false, |
411 | - )); |
|
411 | + ) ); |
|
412 | 412 | |
413 | 413 | if ( is_wp_error( $response ) ) { |
414 | 414 | return array(); |
@@ -441,11 +441,11 @@ discard block |
||
441 | 441 | */ |
442 | 442 | function get_license_message( $license_data ) { |
443 | 443 | |
444 | - if( empty( $license_data ) ) { |
|
444 | + if ( empty( $license_data ) ) { |
|
445 | 445 | $message = ''; |
446 | 446 | } else { |
447 | 447 | |
448 | - if( ! empty( $license_data->error ) ) { |
|
448 | + if ( ! empty( $license_data->error ) ) { |
|
449 | 449 | $class = 'error'; |
450 | 450 | $string_key = $license_data->error; |
451 | 451 | } else { |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | $string_key = $license_data->license; |
454 | 454 | } |
455 | 455 | |
456 | - $message = sprintf( '<p><strong>%s: %s</strong></p>', $this->strings('status'), $this->strings( $string_key, $license_data ) ); |
|
456 | + $message = sprintf( '<p><strong>%s: %s</strong></p>', $this->strings( 'status' ), $this->strings( $string_key, $license_data ) ); |
|
457 | 457 | |
458 | 458 | $message = $this->generate_license_box( $message, $class ); |
459 | 459 | } |
@@ -490,18 +490,18 @@ discard block |
||
490 | 490 | */ |
491 | 491 | public function license_details( $response = array() ) { |
492 | 492 | |
493 | - $response = (array) $response; |
|
493 | + $response = (array)$response; |
|
494 | 494 | |
495 | 495 | $return = ''; |
496 | 496 | $wrapper = '<span class="gv-license-details" aria-live="polite" aria-busy="false">%s</span>'; |
497 | 497 | |
498 | - if( ! empty( $response['license_key'] ) ) { |
|
498 | + if ( ! empty( $response[ 'license_key' ] ) ) { |
|
499 | 499 | |
500 | 500 | $return .= '<h3>' . esc_html__( 'License Details:', 'gravityview' ) . '</h3>'; |
501 | 501 | |
502 | 502 | if ( in_array( rgar( $response, 'license' ), array( 'invalid', 'deactivated' ) ) ) { |
503 | - $return .= $this->strings( $response['license'], $response ); |
|
504 | - } elseif ( ! empty( $response['license_name'] ) ) { |
|
503 | + $return .= $this->strings( $response[ 'license' ], $response ); |
|
504 | + } elseif ( ! empty( $response[ 'license_name' ] ) ) { |
|
505 | 505 | |
506 | 506 | $response_keys = array( |
507 | 507 | 'license_name' => '', |
@@ -516,19 +516,19 @@ discard block |
||
516 | 516 | // Make sure all the keys are set |
517 | 517 | $response = wp_parse_args( $response, $response_keys ); |
518 | 518 | |
519 | - $login_link = sprintf( '<a href="%s" class="howto" rel="external">%s</a>', esc_url( sprintf( 'https://gravityview.co/wp-login.php?username=%s', $response['customer_email'] ) ), esc_html__( 'Access your GravityView account', 'gravityview' ) ); |
|
520 | - $local_text = ( ! empty( $response['is_local'] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' ); |
|
519 | + $login_link = sprintf( '<a href="%s" class="howto" rel="external">%s</a>', esc_url( sprintf( 'https://gravityview.co/wp-login.php?username=%s', $response[ 'customer_email' ] ) ), esc_html__( 'Access your GravityView account', 'gravityview' ) ); |
|
520 | + $local_text = ( ! empty( $response[ 'is_local' ] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' ); |
|
521 | 521 | $details = array( |
522 | - 'license' => sprintf( esc_html__( 'License level: %s', 'gravityview' ), esc_html( $response['license_name'] ), esc_html( $response['license_limit'] ) ), |
|
523 | - 'licensed_to' => sprintf( esc_html_x( 'Licensed to: %1$s (%2$s)', '1: Customer name; 2: Customer email', 'gravityview' ), esc_html__( $response['customer_name'], 'gravityview' ), esc_html__( $response['customer_email'], 'gravityview' ) ) . $login_link, |
|
524 | - 'activations' => sprintf( esc_html__( 'Activations: %d of %s sites', 'gravityview' ), intval( $response['site_count'] ), esc_html( $response['license_limit'] ) ) . $local_text, |
|
525 | - 'expires' => 'lifetime' === $response['expires'] ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response['expires'] ) - DAY_IN_SECONDS ) ), |
|
526 | - 'upgrade' => $this->get_upgrade_html( $response['upgrades'] ), |
|
522 | + 'license' => sprintf( esc_html__( 'License level: %s', 'gravityview' ), esc_html( $response[ 'license_name' ] ), esc_html( $response[ 'license_limit' ] ) ), |
|
523 | + 'licensed_to' => sprintf( esc_html_x( 'Licensed to: %1$s (%2$s)', '1: Customer name; 2: Customer email', 'gravityview' ), esc_html__( $response[ 'customer_name' ], 'gravityview' ), esc_html__( $response[ 'customer_email' ], 'gravityview' ) ) . $login_link, |
|
524 | + 'activations' => sprintf( esc_html__( 'Activations: %d of %s sites', 'gravityview' ), intval( $response[ 'site_count' ] ), esc_html( $response[ 'license_limit' ] ) ) . $local_text, |
|
525 | + 'expires' => 'lifetime' === $response[ 'expires' ] ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response[ 'expires' ] ) - DAY_IN_SECONDS ) ), |
|
526 | + 'upgrade' => $this->get_upgrade_html( $response[ 'upgrades' ] ), |
|
527 | 527 | ); |
528 | 528 | |
529 | - if ( ! empty( $response['error'] ) && 'expired' === $response['error'] ) { |
|
530 | - unset( $details['upgrade'] ); |
|
531 | - $details['expires'] = '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>'; |
|
529 | + if ( ! empty( $response[ 'error' ] ) && 'expired' === $response[ 'error' ] ) { |
|
530 | + unset( $details[ 'upgrade' ] ); |
|
531 | + $details[ 'expires' ] = '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>'; |
|
532 | 532 | } |
533 | 533 | |
534 | 534 | $return .= '<ul><li>' . implode( '</li><li>', array_filter( $details ) ) . '</li></ul>'; |
@@ -551,11 +551,11 @@ discard block |
||
551 | 551 | |
552 | 552 | $output = ''; |
553 | 553 | |
554 | - if( ! empty( $upgrades ) ) { |
|
554 | + if ( ! empty( $upgrades ) ) { |
|
555 | 555 | |
556 | 556 | $locale_parts = explode( '_', get_locale() ); |
557 | 557 | |
558 | - $is_english = ( 'en' === $locale_parts[0] ); |
|
558 | + $is_english = ( 'en' === $locale_parts[ 0 ] ); |
|
559 | 559 | |
560 | 560 | $output .= '<h4>' . esc_html__( 'Upgrades available:', 'gravityview' ) . '</h4>'; |
561 | 561 | |
@@ -563,14 +563,14 @@ discard block |
||
563 | 563 | |
564 | 564 | foreach ( $upgrades as $upgrade_id => $upgrade ) { |
565 | 565 | |
566 | - $upgrade = (object) $upgrade; |
|
566 | + $upgrade = (object)$upgrade; |
|
567 | 567 | |
568 | 568 | $anchor_text = sprintf( esc_html_x( 'Upgrade to %1$s for %2$s', '1: GravityView upgrade name, 2: Cost of upgrade', 'gravityview' ), esc_attr( $upgrade->name ), esc_attr( $upgrade->price ) ); |
569 | 569 | |
570 | - if( $is_english && isset( $upgrade->description ) ) { |
|
570 | + if ( $is_english && isset( $upgrade->description ) ) { |
|
571 | 571 | $message = esc_html( $upgrade->description ); |
572 | 572 | } else { |
573 | - switch( $upgrade->price_id ) { |
|
573 | + switch ( $upgrade->price_id ) { |
|
574 | 574 | // Interstellar |
575 | 575 | case 1: |
576 | 576 | default: |
@@ -608,16 +608,16 @@ discard block |
||
608 | 608 | */ |
609 | 609 | public function license_call( $array = array() ) { |
610 | 610 | |
611 | - $is_ajax = ( defined('DOING_AJAX') && DOING_AJAX ); |
|
612 | - $data = empty( $array ) ? $_POST['data'] : $array; |
|
611 | + $is_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX ); |
|
612 | + $data = empty( $array ) ? $_POST[ 'data' ] : $array; |
|
613 | 613 | $has_cap = GVCommon::has_cap( 'gravityview_edit_settings' ); |
614 | 614 | |
615 | - if ( $is_ajax && empty( $data['license'] ) ) { |
|
616 | - die( - 1 ); |
|
615 | + if ( $is_ajax && empty( $data[ 'license' ] ) ) { |
|
616 | + die( -1 ); |
|
617 | 617 | } |
618 | 618 | |
619 | 619 | // If the user isn't allowed to edit settings, show an error message |
620 | - if( ! $has_cap && empty( $data['all_caps'] ) ) { |
|
620 | + if ( ! $has_cap && empty( $data[ 'all_caps' ] ) ) { |
|
621 | 621 | $license_data = new stdClass(); |
622 | 622 | $license_data->error = 'capability'; |
623 | 623 | $license_data->message = $this->get_license_message( $license_data ); |
@@ -641,9 +641,9 @@ discard block |
||
641 | 641 | |
642 | 642 | $json = json_encode( $license_data ); |
643 | 643 | |
644 | - $update_license = ( ! isset( $data['update'] ) || ! empty( $data['update'] ) ); |
|
644 | + $update_license = ( ! isset( $data[ 'update' ] ) || ! empty( $data[ 'update' ] ) ); |
|
645 | 645 | |
646 | - $is_check_action_button = ( 'check_license' === $data['edd_action'] && defined( 'DOING_AJAX' ) && DOING_AJAX ); |
|
646 | + $is_check_action_button = ( 'check_license' === $data[ 'edd_action' ] && defined( 'DOING_AJAX' ) && DOING_AJAX ); |
|
647 | 647 | |
648 | 648 | // Failed is the response from trying to de-activate a license and it didn't work. |
649 | 649 | // This likely happened because people entered in a different key and clicked "Deactivate", |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | // most likely a mistake. |
652 | 652 | if ( $license_data->license !== 'failed' && ! $is_check_action_button && $update_license ) { |
653 | 653 | |
654 | - if ( ! empty( $data['field_id'] ) ) { |
|
654 | + if ( ! empty( $data[ 'field_id' ] ) ) { |
|
655 | 655 | set_transient( self::status_transient_key, $license_data, DAY_IN_SECONDS ); |
656 | 656 | } |
657 | 657 | |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | if ( $is_ajax ) { |
663 | 663 | exit( $json ); |
664 | 664 | } else { // Non-ajax call |
665 | - return ( rgget('format', $data ) === 'object' ) ? $license_data : $json; |
|
665 | + return ( rgget( 'format', $data ) === 'object' ) ? $license_data : $json; |
|
666 | 666 | } |
667 | 667 | } |
668 | 668 | |
@@ -676,9 +676,9 @@ discard block |
||
676 | 676 | // Update option with passed data license |
677 | 677 | $settings = $this->Addon->get_app_settings(); |
678 | 678 | |
679 | - $settings['license_key'] = $license_data->license_key = trim( $data['license'] ); |
|
680 | - $settings['license_key_status'] = $license_data->license; |
|
681 | - $settings['license_key_response'] = (array)$license_data; |
|
679 | + $settings[ 'license_key' ] = $license_data->license_key = trim( $data[ 'license' ] ); |
|
680 | + $settings[ 'license_key_status' ] = $license_data->license; |
|
681 | + $settings[ 'license_key_response' ] = (array)$license_data; |
|
682 | 682 | |
683 | 683 | $this->Addon->update_app_settings( $settings ); |
684 | 684 | } |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | */ |
692 | 692 | private function get_license_renewal_url( $license_data ) { |
693 | 693 | $license_data = is_array( $license_data ) ? (object)$license_data : $license_data; |
694 | - $renew_license_url = ( ! empty( $license_data ) && !empty( $license_data->license_key ) ) ? sprintf( 'https://gravityview.co/checkout/?download_id=17&edd_license_key=%s&utm_source=admin_notice&utm_medium=admin&utm_content=expired&utm_campaign=Activation&force_login=1', $license_data->license_key ) : 'https://gravityview.co/account/'; |
|
694 | + $renew_license_url = ( ! empty( $license_data ) && ! empty( $license_data->license_key ) ) ? sprintf( 'https://gravityview.co/checkout/?download_id=17&edd_license_key=%s&utm_source=admin_notice&utm_medium=admin&utm_content=expired&utm_campaign=Activation&force_login=1', $license_data->license_key ) : 'https://gravityview.co/account/'; |
|
695 | 695 | return $renew_license_url; |
696 | 696 | } |
697 | 697 | |
@@ -706,31 +706,31 @@ discard block |
||
706 | 706 | |
707 | 707 | |
708 | 708 | $strings = array( |
709 | - 'status' => esc_html__('Status', 'gravityview'), |
|
710 | - 'error' => esc_html__('There was an error processing the request.', 'gravityview'), |
|
711 | - 'failed' => esc_html__('Could not deactivate the license. The license key you attempted to deactivate may not be active or valid.', 'gravityview'), |
|
712 | - 'site_inactive' => esc_html__('The license key is valid, but it has not been activated for this site.', 'gravityview'), |
|
713 | - 'inactive' => esc_html__('The license key is valid, but it has not been activated for this site.', 'gravityview'), |
|
714 | - 'no_activations_left' => esc_html__('Invalid: this license has reached its activation limit.', 'gravityview') . ' ' . sprintf( esc_html__('You can manage license activations %son your GravityView account page%s.', 'gravityview'), '<a href="https://gravityview.co/account/#licenses">', '</a>' ), |
|
715 | - 'deactivated' => esc_html__('The license has been deactivated.', 'gravityview'), |
|
716 | - 'valid' => esc_html__('The license key is valid and active.', 'gravityview'), |
|
717 | - 'invalid' => esc_html__('The license key entered is invalid.', 'gravityview'), |
|
718 | - 'missing' => esc_html__('Invalid license key.', 'gravityview'), |
|
719 | - 'revoked' => esc_html__('This license key has been revoked.', 'gravityview'), |
|
720 | - 'expired' => sprintf( esc_html__('This license key has expired. %sRenew your license on the GravityView website%s to receive updates and support.', 'gravityview'), '<a href="'. esc_url( $this->get_license_renewal_url( $license_data ) ) .'">', '</a>' ), |
|
709 | + 'status' => esc_html__( 'Status', 'gravityview' ), |
|
710 | + 'error' => esc_html__( 'There was an error processing the request.', 'gravityview' ), |
|
711 | + 'failed' => esc_html__( 'Could not deactivate the license. The license key you attempted to deactivate may not be active or valid.', 'gravityview' ), |
|
712 | + 'site_inactive' => esc_html__( 'The license key is valid, but it has not been activated for this site.', 'gravityview' ), |
|
713 | + 'inactive' => esc_html__( 'The license key is valid, but it has not been activated for this site.', 'gravityview' ), |
|
714 | + 'no_activations_left' => esc_html__( 'Invalid: this license has reached its activation limit.', 'gravityview' ) . ' ' . sprintf( esc_html__( 'You can manage license activations %son your GravityView account page%s.', 'gravityview' ), '<a href="https://gravityview.co/account/#licenses">', '</a>' ), |
|
715 | + 'deactivated' => esc_html__( 'The license has been deactivated.', 'gravityview' ), |
|
716 | + 'valid' => esc_html__( 'The license key is valid and active.', 'gravityview' ), |
|
717 | + 'invalid' => esc_html__( 'The license key entered is invalid.', 'gravityview' ), |
|
718 | + 'missing' => esc_html__( 'Invalid license key.', 'gravityview' ), |
|
719 | + 'revoked' => esc_html__( 'This license key has been revoked.', 'gravityview' ), |
|
720 | + 'expired' => sprintf( esc_html__( 'This license key has expired. %sRenew your license on the GravityView website%s to receive updates and support.', 'gravityview' ), '<a href="' . esc_url( $this->get_license_renewal_url( $license_data ) ) . '">', '</a>' ), |
|
721 | 721 | 'capability' => esc_html__( 'You don\'t have the ability to edit plugin settings.', 'gravityview' ), |
722 | 722 | |
723 | - 'verifying_license' => esc_html__('Verifying license…', 'gravityview'), |
|
724 | - 'activate_license' => esc_html__('Activate License', 'gravityview'), |
|
725 | - 'deactivate_license' => esc_html__('Deactivate License', 'gravityview'), |
|
726 | - 'check_license' => esc_html__('Verify License', 'gravityview'), |
|
723 | + 'verifying_license' => esc_html__( 'Verifying license…', 'gravityview' ), |
|
724 | + 'activate_license' => esc_html__( 'Activate License', 'gravityview' ), |
|
725 | + 'deactivate_license' => esc_html__( 'Deactivate License', 'gravityview' ), |
|
726 | + 'check_license' => esc_html__( 'Verify License', 'gravityview' ), |
|
727 | 727 | ); |
728 | 728 | |
729 | - if( empty( $status ) ) { |
|
729 | + if ( empty( $status ) ) { |
|
730 | 730 | return $strings; |
731 | 731 | } |
732 | 732 | |
733 | - if( isset( $strings[ $status ] ) ) { |
|
733 | + if ( isset( $strings[ $status ] ) ) { |
|
734 | 734 | return $strings[ $status ]; |
735 | 735 | } |
736 | 736 |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | parent::add_hooks(); |
58 | 58 | |
59 | - if( gravityview_is_admin_page() ) { |
|
59 | + if ( gravityview_is_admin_page() ) { |
|
60 | 60 | |
61 | 61 | // Make Yoast metabox go down to the bottom please. |
62 | 62 | add_filter( 'wpseo_metabox_prio', array( $this, '__return_low' ) ); |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | global $pagenow; |
84 | 84 | |
85 | 85 | // New View page |
86 | - if( $pagenow === 'post-new.php' ) { |
|
87 | - $options['hideeditbox-gravityview'] = true; |
|
86 | + if ( $pagenow === 'post-new.php' ) { |
|
87 | + $options[ 'hideeditbox-gravityview' ] = true; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | return $options; |