@@ -88,15 +88,15 @@ |
||
88 | 88 | */ |
89 | 89 | public function maybe_modify_button_label( $label = '', $atts = array() ) { |
90 | 90 | |
91 | - if( $this->template_id !== \GV\Utils::get( $atts, 'template_id' ) ) { |
|
91 | + if ( $this->template_id !== \GV\Utils::get( $atts, 'template_id' ) ) { |
|
92 | 92 | return $label; |
93 | 93 | } |
94 | 94 | |
95 | - if( 'field' !== \GV\Utils::get( $atts, 'type' ) ) { |
|
95 | + if ( 'field' !== \GV\Utils::get( $atts, 'type' ) ) { |
|
96 | 96 | return $label; |
97 | 97 | } |
98 | 98 | |
99 | - if( 'edit' === \GV\Utils::get( $atts, 'zone' ) ) { |
|
99 | + if ( 'edit' === \GV\Utils::get( $atts, 'zone' ) ) { |
|
100 | 100 | return $label; |
101 | 101 | } |
102 | 102 |
@@ -33,14 +33,14 @@ discard block |
||
33 | 33 | $defaults = self::get_field_defaults(); |
34 | 34 | |
35 | 35 | // Backward compatibility |
36 | - if( !empty( $field['choices'] ) ) { |
|
37 | - $field['options'] = $field['choices']; |
|
38 | - unset( $field['choices'] ); |
|
36 | + if ( ! empty( $field[ 'choices' ] ) ) { |
|
37 | + $field[ 'options' ] = $field[ 'choices' ]; |
|
38 | + unset( $field[ 'choices' ] ); |
|
39 | 39 | } |
40 | 40 | |
41 | - $this->field = wp_parse_args( $field, $defaults ); |
|
41 | + $this->field = wp_parse_args( $field, $defaults ); |
|
42 | 42 | |
43 | - $this->value = is_null( $curr_value ) ? $this->field['value'] : $curr_value; |
|
43 | + $this->value = is_null( $curr_value ) ? $this->field[ 'value' ] : $curr_value; |
|
44 | 44 | |
45 | 45 | } |
46 | 46 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | |
81 | 81 | function get_tooltip() { |
82 | - if( ! function_exists('gform_tooltip') ) { |
|
82 | + if ( ! function_exists( 'gform_tooltip' ) ) { |
|
83 | 83 | return null; |
84 | 84 | } |
85 | 85 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | 'url' => '#', |
90 | 90 | ) ); |
91 | 91 | |
92 | - return !empty( $this->field['tooltip'] ) ? ' '. $this->tooltip( $this->field['tooltip'], false, true, $article ) : null; |
|
92 | + return ! empty( $this->field[ 'tooltip' ] ) ? ' ' . $this->tooltip( $this->field[ 'tooltip' ], false, true, $article ) : null; |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * Below this line has been modified by GravityView. |
133 | 133 | */ |
134 | 134 | |
135 | - if ( empty( $tooltip_text ) && empty( $article['id'] ) ) { |
|
135 | + if ( empty( $tooltip_text ) && empty( $article[ 'id' ] ) ) { |
|
136 | 136 | return ''; |
137 | 137 | } |
138 | 138 | |
@@ -168,8 +168,8 @@ discard block |
||
168 | 168 | * @return string |
169 | 169 | */ |
170 | 170 | function get_field_id() { |
171 | - if( isset( $this->field['id'] ) ) { |
|
172 | - return esc_attr( $this->field['id'] ); |
|
171 | + if ( isset( $this->field[ 'id' ] ) ) { |
|
172 | + return esc_attr( $this->field[ 'id' ] ); |
|
173 | 173 | } |
174 | 174 | return esc_attr( sanitize_html_class( $this->name ) ); |
175 | 175 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | * @return string |
180 | 180 | */ |
181 | 181 | function get_field_label() { |
182 | - return esc_html( trim( $this->field['label'] ) ); |
|
182 | + return esc_html( trim( $this->field[ 'label' ] ) ); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | /** |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * @return string |
191 | 191 | */ |
192 | 192 | function get_field_left_label() { |
193 | - return ! empty( $this->field['left_label'] ) ? esc_html( trim( $this->field['left_label'] ) ) : NULL; |
|
193 | + return ! empty( $this->field[ 'left_label' ] ) ? esc_html( trim( $this->field[ 'left_label' ] ) ) : NULL; |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | /** |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * @return string |
199 | 199 | */ |
200 | 200 | function get_label_class() { |
201 | - return 'gv-label-'. sanitize_html_class( $this->field['type'] ); |
|
201 | + return 'gv-label-' . sanitize_html_class( $this->field[ 'type' ] ); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * @return string |
208 | 208 | */ |
209 | 209 | function get_field_desc() { |
210 | - return !empty( $this->field['desc'] ) ? '<span class="howto">'. $this->field['desc'] .'</span>' : ''; |
|
210 | + return ! empty( $this->field[ 'desc' ] ) ? '<span class="howto">' . $this->field[ 'desc' ] . '</span>' : ''; |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | */ |
241 | 241 | function render_setting( $override_input = NULL ) { |
242 | 242 | |
243 | - if( !empty( $this->field['full_width'] ) ) { ?> |
|
243 | + if ( ! empty( $this->field[ 'full_width' ] ) ) { ?> |
|
244 | 244 | <th scope="row" colspan="2"> |
245 | 245 | <div> |
246 | 246 | <label for="<?php echo $this->get_field_id(); ?>"> |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * Try subkeys after split. |
92 | 92 | */ |
93 | 93 | if ( count( $parts = explode( '/', $key, 2 ) ) > 1 ) { |
94 | - return self::get( self::get( $array, $parts[0] ), $parts[1], $default ); |
|
94 | + return self::get( self::get( $array, $parts[ 0 ] ), $parts[ 1 ], $default ); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | return $default; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | public static function gf_query_debug( $query ) { |
146 | 146 | $introspect = $query->_introspect(); |
147 | 147 | return array( |
148 | - 'where' => $query->_where_unwrap( $introspect['where'] ) |
|
148 | + 'where' => $query->_where_unwrap( $introspect[ 'where' ] ) |
|
149 | 149 | ); |
150 | 150 | } |
151 | 151 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | if ( $condition->expressions ) { |
159 | 159 | $conditions = array(); |
160 | 160 | foreach ( $condition->expressions as $expression ) { |
161 | - $conditions[] = self::gf_query_strip_condition_column_aliases( $expression ); |
|
161 | + $conditions[ ] = self::gf_query_strip_condition_column_aliases( $expression ); |
|
162 | 162 | } |
163 | 163 | return call_user_func_array( |
164 | 164 | array( '\GF_Query_Condition', $condition->operator == 'AND' ? '_and' : '_or' ), |
@@ -47,11 +47,11 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
49 | 49 | |
50 | - if( 'edit' === $context ) { |
|
50 | + if ( 'edit' === $context ) { |
|
51 | 51 | return $field_options; |
52 | 52 | } |
53 | 53 | |
54 | - $this->add_field_support('date_display', $field_options ); |
|
54 | + $this->add_field_support( 'date_display', $field_options ); |
|
55 | 55 | |
56 | 56 | return $field_options; |
57 | 57 | } |
@@ -71,11 +71,11 @@ discard block |
||
71 | 71 | public function get_content( $output = '', $entry = array(), $field_settings = array(), $field = array() ) { |
72 | 72 | |
73 | 73 | /** Overridden by a template. */ |
74 | - if( \GV\Utils::get( $field, 'field_path' ) !== gravityview()->plugin->dir( 'templates/fields/field-html.php' ) ) { |
|
74 | + if ( \GV\Utils::get( $field, 'field_path' ) !== gravityview()->plugin->dir( 'templates/fields/field-html.php' ) ) { |
|
75 | 75 | return $output; |
76 | 76 | } |
77 | 77 | |
78 | - return GVCommon::format_date( $field['value'], 'format=' . \GV\Utils::get( $field_settings, 'date_display' ) ); |
|
78 | + return GVCommon::format_date( $field[ 'value' ], 'format=' . \GV\Utils::get( $field_settings, 'date_display' ) ); |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | parent::add_hooks(); |
35 | 35 | |
36 | - add_filter( 'gravityview/search/searchable_fields', array( $this, 'modify_search_bar_fields_dropdown'), 10, 2 ); |
|
36 | + add_filter( 'gravityview/search/searchable_fields', array( $this, 'modify_search_bar_fields_dropdown' ), 10, 2 ); |
|
37 | 37 | |
38 | 38 | add_filter( 'gravityview/admin/available_fields', array( $this, 'maybe_add_non_default_fields' ), 10, 3 ); |
39 | 39 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @return void |
54 | 54 | */ |
55 | 55 | public function clear_cache_after_workflow( $form, $entry_id, $step_id, $starting_step_id ) { |
56 | - do_action( 'gravityview_clear_form_cache', $form['id'] ); |
|
56 | + do_action( 'gravityview_clear_form_cache', $form[ 'id' ] ); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -70,13 +70,13 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public static function get_status_options( $form_id = 0, $status_key = 'workflow_final_status' ) { |
72 | 72 | |
73 | - if( empty( $form_id ) ) { |
|
73 | + if ( empty( $form_id ) ) { |
|
74 | 74 | $form_id = GravityView_View::getInstance()->getFormId(); |
75 | 75 | } |
76 | 76 | |
77 | 77 | $entry_meta = gravity_flow()->get_entry_meta( array(), $form_id ); |
78 | 78 | |
79 | - return (array) \GV\Utils::get( $entry_meta, $status_key . '/filter/choices' ); |
|
79 | + return (array)\GV\Utils::get( $entry_meta, $status_key . '/filter/choices' ); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | $workflow_steps = $GFlow->get_steps(); |
100 | 100 | |
101 | - if( $workflow_steps ) { |
|
101 | + if ( $workflow_steps ) { |
|
102 | 102 | |
103 | 103 | foreach ( $workflow_steps as $step ) { |
104 | 104 | |
@@ -110,12 +110,12 @@ discard block |
||
110 | 110 | ); |
111 | 111 | } |
112 | 112 | |
113 | - $fields['workflow_step'] = array( |
|
113 | + $fields[ 'workflow_step' ] = array( |
|
114 | 114 | 'label' => esc_html__( 'Workflow Step', 'gravityview' ), |
115 | 115 | 'type' => 'select', |
116 | 116 | ); |
117 | 117 | |
118 | - $fields['workflow_final_status'] = array( |
|
118 | + $fields[ 'workflow_final_status' ] = array( |
|
119 | 119 | 'label' => esc_html__( 'Workflow Status', 'gravityview' ), |
120 | 120 | 'type' => 'select', |
121 | 121 | ); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | if ( ( $insert_at = array_search( 'workflow_final_status', wp_list_pluck( $fields, 'key' ) ) ) !== false ) { |
132 | 132 | $fields_end = array_splice( $fields, $insert_at + 1 ); |
133 | 133 | |
134 | - $fields[] = array( |
|
134 | + $fields[ ] = array( |
|
135 | 135 | 'text' => __( 'Workflow Current Status Timestamp', 'gravityview' ), |
136 | 136 | 'operators' => array( '>', '<' ), |
137 | 137 | 'placeholder' => 'yyyy-mm-dd', |
@@ -157,8 +157,8 @@ discard block |
||
157 | 157 | $keys_end = array_splice( $keys, $insert_at + 1 ); |
158 | 158 | $values_end = array_splice( $values, $insert_at + 1 ); |
159 | 159 | |
160 | - $keys[] = 'workflow_current_status_timestamp'; |
|
161 | - $values[] = array( |
|
160 | + $keys[ ] = 'workflow_current_status_timestamp'; |
|
161 | + $values[ ] = array( |
|
162 | 162 | 'label' => __( 'Workflow Current Status Timestamp', 'gravityview' ), |
163 | 163 | 'type' => 'workflow_current_status_timestamp', |
164 | 164 | ); |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | 'class' => '', |
44 | 44 | ) ); |
45 | 45 | |
46 | - if ( ! $view_id = $atts['id'] ? : $atts['view_id'] ) { |
|
47 | - if ( $atts['detail'] && $view = $request->is_view() ) { |
|
46 | + if ( ! $view_id = $atts[ 'id' ] ?: $atts[ 'view_id' ] ) { |
|
47 | + if ( $atts[ 'detail' ] && $view = $request->is_view() ) { |
|
48 | 48 | $view_id = $view->ID; |
49 | 49 | } |
50 | 50 | } |
@@ -114,12 +114,12 @@ discard block |
||
114 | 114 | } |
115 | 115 | } |
116 | 116 | |
117 | - $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID ); |
|
117 | + $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID ); |
|
118 | 118 | |
119 | 119 | /** |
120 | 120 | * View details. |
121 | 121 | */ |
122 | - if ( $atts['detail'] ) { |
|
122 | + if ( $atts[ 'detail' ] ) { |
|
123 | 123 | $entries = $view->get_entries( $request ); |
124 | 124 | return self::_return( $this->detail( $view, $entries, $atts ) ); |
125 | 125 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | return self::_return( '' ); |
137 | 137 | } |
138 | 138 | |
139 | - if ( $entry['status'] != 'active' ) { |
|
139 | + if ( $entry[ 'status' ] != 'active' ) { |
|
140 | 140 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
141 | 141 | return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) ); |
142 | 142 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | } |
148 | 148 | |
149 | 149 | if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
150 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
150 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
151 | 151 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
152 | 152 | return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) ); |
153 | 153 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | $entryset = $entry->is_multi() ? $entry->entries : array( $entry ); |
171 | 171 | |
172 | 172 | foreach ( $entryset as $e ) { |
173 | - if ( $e['status'] != 'active' ) { |
|
173 | + if ( $e[ 'status' ] != 'active' ) { |
|
174 | 174 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $e->ID ) ); |
175 | 175 | return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) ); |
176 | 176 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | } |
182 | 182 | |
183 | 183 | if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
184 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $e->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
184 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $e->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
185 | 185 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $e->ID ) ); |
186 | 186 | return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) ); |
187 | 187 | } |
@@ -206,10 +206,10 @@ discard block |
||
206 | 206 | |
207 | 207 | // Mock the request with the actual View, not the global one |
208 | 208 | $mock_request = new \GV\Mock_Request(); |
209 | - $mock_request->returns['is_view'] = $view; |
|
210 | - $mock_request->returns['is_entry'] = $request->is_entry( $view->form ? $view->form->ID : 0 ); |
|
211 | - $mock_request->returns['is_edit_entry'] = $request->is_edit_entry( $view->form ? $view->form->ID : 0 ); |
|
212 | - $mock_request->returns['is_search'] = $request->is_search(); |
|
209 | + $mock_request->returns[ 'is_view' ] = $view; |
|
210 | + $mock_request->returns[ 'is_entry' ] = $request->is_entry( $view->form ? $view->form->ID : 0 ); |
|
211 | + $mock_request->returns[ 'is_edit_entry' ] = $request->is_edit_entry( $view->form ? $view->form->ID : 0 ); |
|
212 | + $mock_request->returns[ 'is_search' ] = $request->is_search(); |
|
213 | 213 | |
214 | 214 | $request = $mock_request; |
215 | 215 | } |
@@ -245,16 +245,16 @@ discard block |
||
245 | 245 | $filtered_atts = shortcode_atts( $supported_atts, $passed_atts, 'gravityview' ); |
246 | 246 | |
247 | 247 | // Only keep the passed attributes after making sure that they're valid pairs |
248 | - $filtered_atts = array_intersect_key( (array) $passed_atts, $filtered_atts ); |
|
248 | + $filtered_atts = array_intersect_key( (array)$passed_atts, $filtered_atts ); |
|
249 | 249 | |
250 | 250 | $atts = array(); |
251 | 251 | |
252 | - foreach( $filtered_atts as $key => $passed_value ) { |
|
252 | + foreach ( $filtered_atts as $key => $passed_value ) { |
|
253 | 253 | |
254 | 254 | // Allow using GravityView merge tags in shortcode attributes, like {get} and {created_by} |
255 | 255 | $passed_value = \GravityView_Merge_Tags::replace_variables( $passed_value ); |
256 | 256 | |
257 | - switch( $defaults[ $key ]['type'] ) { |
|
257 | + switch ( $defaults[ $key ][ 'type' ] ) { |
|
258 | 258 | |
259 | 259 | /** |
260 | 260 | * Make sure number fields are numeric. |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | * @see http://php.net/manual/en/function.is-numeric.php#107326 |
263 | 263 | */ |
264 | 264 | case 'number': |
265 | - if( is_numeric( $passed_value ) ) { |
|
265 | + if ( is_numeric( $passed_value ) ) { |
|
266 | 266 | $atts[ $key ] = ( $passed_value + 0 ); |
267 | 267 | } |
268 | 268 | break; |
@@ -277,8 +277,8 @@ discard block |
||
277 | 277 | */ |
278 | 278 | case 'select': |
279 | 279 | case 'radio': |
280 | - $options = isset( $defaults[ $key ]['choices'] ) ? $defaults[ $key ]['choices'] : $defaults[ $key ]['options']; |
|
281 | - if( in_array( $passed_value, array_keys( $options ) ) ) { |
|
280 | + $options = isset( $defaults[ $key ][ 'choices' ] ) ? $defaults[ $key ][ 'choices' ] : $defaults[ $key ][ 'options' ]; |
|
281 | + if ( in_array( $passed_value, array_keys( $options ) ) ) { |
|
282 | 282 | $atts[ $key ] = $passed_value; |
283 | 283 | } |
284 | 284 | break; |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | } |
291 | 291 | } |
292 | 292 | |
293 | - $atts['detail'] = \GV\Utils::get( $passed_atts, 'detail', null ); |
|
293 | + $atts[ 'detail' ] = \GV\Utils::get( $passed_atts, 'detail', null ); |
|
294 | 294 | |
295 | 295 | return $atts; |
296 | 296 | } |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | private function detail( $view, $entries, $atts ) { |
308 | 308 | $output = ''; |
309 | 309 | |
310 | - switch ( $key = $atts['detail'] ): |
|
310 | + switch ( $key = $atts[ 'detail' ] ): |
|
311 | 311 | case 'total_entries': |
312 | 312 | $output = number_format_i18n( $entries->total() ); |
313 | 313 | break; |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function set_provider( $provider = null ) { |
40 | 40 | |
41 | - if( gravityview()->request->is_admin() ) { |
|
41 | + if ( gravityview()->request->is_admin() ) { |
|
42 | 42 | return; |
43 | 43 | } |
44 | 44 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | // We're switching providers; remove the hooks that were added. |
60 | - if( self::$active_provider ) { |
|
60 | + if ( self::$active_provider ) { |
|
61 | 61 | self::$active_provider->remove_hooks(); |
62 | 62 | } |
63 | 63 |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | function __construct() { |
15 | 15 | |
16 | - $this->widget_description = __('Display a Gravity Forms form.', 'gravityview' ); |
|
16 | + $this->widget_description = __( 'Display a Gravity Forms form.', 'gravityview' ); |
|
17 | 17 | |
18 | 18 | $default_values = array( |
19 | 19 | 'header' => 1, |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | add_filter( 'gravityview/widget/hide_until_searched/whitelist', array( $this, 'add_to_allowlist' ) ); |
56 | 56 | |
57 | - parent::__construct( __( 'Gravity Forms', 'gravityview' ) , 'gravityforms', $default_values, $settings ); |
|
57 | + parent::__construct( __( 'Gravity Forms', 'gravityview' ), 'gravityforms', $default_values, $settings ); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -81,13 +81,13 @@ discard block |
||
81 | 81 | * gravityview_get_forms() is currently running too early as widgets_init runs before init and |
82 | 82 | * when most Gravity Forms plugins register their own fields like GP Terms of Service. |
83 | 83 | */ |
84 | - if( $doing_ajax || ( \GV\Admin_Request::is_admin() && ! GFForms::is_gravity_page() ) ) { |
|
84 | + if ( $doing_ajax || ( \GV\Admin_Request::is_admin() && ! GFForms::is_gravity_page() ) ) { |
|
85 | 85 | |
86 | 86 | // check for available gravity forms |
87 | 87 | $forms = gravityview_get_forms(); |
88 | 88 | |
89 | 89 | foreach ( $forms as $form ) { |
90 | - $choices[ $form['id'] ] = $form['title']; |
|
90 | + $choices[ $form[ 'id' ] ] = $form[ 'title' ]; |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | function add_to_allowlist( $allowlist ) { |
105 | 105 | |
106 | - $allowlist[] = 'gravityforms'; |
|
106 | + $allowlist[ ] = 'gravityforms'; |
|
107 | 107 | |
108 | 108 | return $allowlist; |
109 | 109 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * @param string $content |
114 | 114 | * @param string $context |
115 | 115 | */ |
116 | - public function render_frontend( $widget_args, $content = '', $context = '') { |
|
116 | + public function render_frontend( $widget_args, $content = '', $context = '' ) { |
|
117 | 117 | |
118 | 118 | if ( ! $this->pre_render_frontend() ) { |
119 | 119 | return; |
@@ -48,10 +48,10 @@ discard block |
||
48 | 48 | $this->api_data = $_api_data; |
49 | 49 | $this->name = plugin_basename( $_plugin_file ); |
50 | 50 | $this->slug = basename( $_plugin_file, '.php' ); |
51 | - $this->version = $_api_data['version']; |
|
52 | - $this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false; |
|
53 | - $this->beta = ! empty( $this->api_data['beta'] ) ? true : false; |
|
54 | - $this->cache_key = 'edd_sl_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) ); |
|
51 | + $this->version = $_api_data[ 'version' ]; |
|
52 | + $this->wp_override = isset( $_api_data[ 'wp_override' ] ) ? (bool)$_api_data[ 'wp_override' ] : false; |
|
53 | + $this->beta = ! empty( $this->api_data[ 'beta' ] ) ? true : false; |
|
54 | + $this->cache_key = 'edd_sl_' . md5( serialize( $this->slug . $this->api_data[ 'license' ] . $this->beta ) ); |
|
55 | 55 | |
56 | 56 | $edd_plugin_data[ $this->slug ] = $this->api_data; |
57 | 57 | |
@@ -170,11 +170,11 @@ discard block |
||
170 | 170 | return; |
171 | 171 | } |
172 | 172 | |
173 | - if( ! current_user_can( 'update_plugins' ) ) { |
|
173 | + if ( ! current_user_can( 'update_plugins' ) ) { |
|
174 | 174 | return; |
175 | 175 | } |
176 | 176 | |
177 | - if( ! is_multisite() ) { |
|
177 | + if ( ! is_multisite() ) { |
|
178 | 178 | return; |
179 | 179 | } |
180 | 180 | |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | '<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">', |
282 | 282 | esc_html( $version_info->new_version ), |
283 | 283 | '</a>', |
284 | - '<a href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) .'">', |
|
284 | + '<a href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) . '">', |
|
285 | 285 | '</a>' |
286 | 286 | ); |
287 | 287 | } |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | $_data->contributors = $this->convert_object_to_array( $_data->contributors ); |
366 | 366 | } |
367 | 367 | |
368 | - if( ! isset( $_data->plugin ) ) { |
|
368 | + if ( ! isset( $_data->plugin ) ) { |
|
369 | 369 | $_data->plugin = $this->name; |
370 | 370 | } |
371 | 371 | |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | |
405 | 405 | $verify_ssl = $this->verify_ssl(); |
406 | 406 | if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) { |
407 | - $args['sslverify'] = $verify_ssl; |
|
407 | + $args[ 'sslverify' ] = $verify_ssl; |
|
408 | 408 | } |
409 | 409 | return $args; |
410 | 410 | |
@@ -432,9 +432,9 @@ discard block |
||
432 | 432 | if ( ! is_array( $edd_plugin_url_available ) || ! isset( $edd_plugin_url_available[ $store_hash ] ) ) { |
433 | 433 | $test_url_parts = parse_url( $this->api_url ); |
434 | 434 | |
435 | - $scheme = ! empty( $test_url_parts['scheme'] ) ? $test_url_parts['scheme'] : 'http'; |
|
436 | - $host = ! empty( $test_url_parts['host'] ) ? $test_url_parts['host'] : ''; |
|
437 | - $port = ! empty( $test_url_parts['port'] ) ? ':' . $test_url_parts['port'] : ''; |
|
435 | + $scheme = ! empty( $test_url_parts[ 'scheme' ] ) ? $test_url_parts[ 'scheme' ] : 'http'; |
|
436 | + $host = ! empty( $test_url_parts[ 'host' ] ) ? $test_url_parts[ 'host' ] : ''; |
|
437 | + $port = ! empty( $test_url_parts[ 'port' ] ) ? ':' . $test_url_parts[ 'port' ] : ''; |
|
438 | 438 | |
439 | 439 | if ( empty( $host ) ) { |
440 | 440 | $edd_plugin_url_available[ $store_hash ] = false; |
@@ -451,27 +451,27 @@ discard block |
||
451 | 451 | |
452 | 452 | $data = array_merge( $this->api_data, $_data ); |
453 | 453 | |
454 | - if ( $data['slug'] != $this->slug ) { |
|
454 | + if ( $data[ 'slug' ] != $this->slug ) { |
|
455 | 455 | return; |
456 | 456 | } |
457 | 457 | |
458 | - if( $this->api_url == trailingslashit ( home_url() ) ) { |
|
458 | + if ( $this->api_url == trailingslashit( home_url() ) ) { |
|
459 | 459 | return false; // Don't allow a plugin to ping itself |
460 | 460 | } |
461 | 461 | |
462 | 462 | $api_params = array( |
463 | 463 | 'edd_action' => 'get_version', |
464 | - 'license' => ! empty( $data['license'] ) ? $data['license'] : '', |
|
465 | - 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false, |
|
466 | - 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false, |
|
467 | - 'version' => isset( $data['version'] ) ? $data['version'] : false, |
|
468 | - 'slug' => $data['slug'], |
|
469 | - 'author' => $data['author'], |
|
464 | + 'license' => ! empty( $data[ 'license' ] ) ? $data[ 'license' ] : '', |
|
465 | + 'item_name' => isset( $data[ 'item_name' ] ) ? $data[ 'item_name' ] : false, |
|
466 | + 'item_id' => isset( $data[ 'item_id' ] ) ? $data[ 'item_id' ] : false, |
|
467 | + 'version' => isset( $data[ 'version' ] ) ? $data[ 'version' ] : false, |
|
468 | + 'slug' => $data[ 'slug' ], |
|
469 | + 'author' => $data[ 'author' ], |
|
470 | 470 | 'url' => home_url(), |
471 | - 'beta' => ! empty( $data['beta'] ), |
|
471 | + 'beta' => ! empty( $data[ 'beta' ] ), |
|
472 | 472 | ); |
473 | 473 | |
474 | - $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params ) ); |
|
474 | + $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params ) ); |
|
475 | 475 | |
476 | 476 | if ( ! is_wp_error( $request ) ) { |
477 | 477 | $request = json_decode( wp_remote_retrieve_body( $request ) ); |
@@ -491,9 +491,9 @@ discard block |
||
491 | 491 | $request->icons = maybe_unserialize( $request->icons ); |
492 | 492 | } |
493 | 493 | |
494 | - if( ! empty( $request->sections ) ) { |
|
495 | - foreach( $request->sections as $key => $section ) { |
|
496 | - $request->$key = (array) $section; |
|
494 | + if ( ! empty( $request->sections ) ) { |
|
495 | + foreach ( $request->sections as $key => $section ) { |
|
496 | + $request->$key = (array)$section; |
|
497 | 497 | } |
498 | 498 | } |
499 | 499 | |
@@ -507,35 +507,35 @@ discard block |
||
507 | 507 | |
508 | 508 | global $edd_plugin_data; |
509 | 509 | |
510 | - if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) { |
|
510 | + if ( empty( $_REQUEST[ 'edd_sl_action' ] ) || 'view_plugin_changelog' != $_REQUEST[ 'edd_sl_action' ] ) { |
|
511 | 511 | return; |
512 | 512 | } |
513 | 513 | |
514 | - if( empty( $_REQUEST['plugin'] ) ) { |
|
514 | + if ( empty( $_REQUEST[ 'plugin' ] ) ) { |
|
515 | 515 | return; |
516 | 516 | } |
517 | 517 | |
518 | - if( empty( $_REQUEST['slug'] ) ) { |
|
518 | + if ( empty( $_REQUEST[ 'slug' ] ) ) { |
|
519 | 519 | return; |
520 | 520 | } |
521 | 521 | |
522 | - if( ! current_user_can( 'update_plugins' ) ) { |
|
522 | + if ( ! current_user_can( 'update_plugins' ) ) { |
|
523 | 523 | wp_die( __( 'You do not have permission to install plugin updates', 'gravityview' ), __( 'Error', 'gravityview' ), array( 'response' => 403 ) ); |
524 | 524 | } |
525 | 525 | |
526 | - $data = $edd_plugin_data[ $_REQUEST['slug'] ]; |
|
526 | + $data = $edd_plugin_data[ $_REQUEST[ 'slug' ] ]; |
|
527 | 527 | $version_info = $this->get_cached_version_info(); |
528 | 528 | |
529 | - if( false === $version_info ) { |
|
529 | + if ( false === $version_info ) { |
|
530 | 530 | |
531 | 531 | $api_params = array( |
532 | 532 | 'edd_action' => 'get_version', |
533 | - 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false, |
|
534 | - 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false, |
|
535 | - 'slug' => $_REQUEST['slug'], |
|
536 | - 'author' => $data['author'], |
|
533 | + 'item_name' => isset( $data[ 'item_name' ] ) ? $data[ 'item_name' ] : false, |
|
534 | + 'item_id' => isset( $data[ 'item_id' ] ) ? $data[ 'item_id' ] : false, |
|
535 | + 'slug' => $_REQUEST[ 'slug' ], |
|
536 | + 'author' => $data[ 'author' ], |
|
537 | 537 | 'url' => home_url(), |
538 | - 'beta' => ! empty( $data['beta'] ) |
|
538 | + 'beta' => ! empty( $data[ 'beta' ] ) |
|
539 | 539 | ); |
540 | 540 | |
541 | 541 | $verify_ssl = $this->verify_ssl(); |
@@ -551,22 +551,22 @@ discard block |
||
551 | 551 | $version_info = false; |
552 | 552 | } |
553 | 553 | |
554 | - if( ! empty( $version_info ) ) { |
|
555 | - foreach( $version_info->sections as $key => $section ) { |
|
556 | - $version_info->$key = (array) $section; |
|
554 | + if ( ! empty( $version_info ) ) { |
|
555 | + foreach ( $version_info->sections as $key => $section ) { |
|
556 | + $version_info->$key = (array)$section; |
|
557 | 557 | } |
558 | 558 | } |
559 | 559 | |
560 | 560 | $this->set_version_info_cache( $version_info ); |
561 | 561 | |
562 | 562 | // Delete the unneeded option |
563 | - delete_option( md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_' . $this->beta . '_version_info' ) ); |
|
563 | + delete_option( md5( 'edd_plugin_' . sanitize_key( $_REQUEST[ 'plugin' ] ) . '_' . $this->beta . '_version_info' ) ); |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | if ( isset( $version_info->sections ) ) { |
567 | 567 | $sections = $this->convert_object_to_array( $version_info->sections ); |
568 | - if ( ! empty( $sections['changelog'] ) ) { |
|
569 | - echo '<div style="background:#fff;padding:10px;">' . wp_kses_post( $sections['changelog'] ) . '</div>'; |
|
568 | + if ( ! empty( $sections[ 'changelog' ] ) ) { |
|
569 | + echo '<div style="background:#fff;padding:10px;">' . wp_kses_post( $sections[ 'changelog' ] ) . '</div>'; |
|
570 | 570 | } |
571 | 571 | } |
572 | 572 | |
@@ -581,25 +581,25 @@ discard block |
||
581 | 581 | */ |
582 | 582 | public function get_cached_version_info( $cache_key = '' ) { |
583 | 583 | |
584 | - if( empty( $cache_key ) ) { |
|
584 | + if ( empty( $cache_key ) ) { |
|
585 | 585 | $cache_key = $this->cache_key; |
586 | 586 | } |
587 | 587 | |
588 | 588 | $cache = get_option( $cache_key ); |
589 | 589 | |
590 | - if( empty( $cache['timeout'] ) || time() > $cache['timeout'] ) { |
|
590 | + if ( empty( $cache[ 'timeout' ] ) || time() > $cache[ 'timeout' ] ) { |
|
591 | 591 | return false; // Cache is expired |
592 | 592 | } |
593 | 593 | |
594 | 594 | // We need to turn the icons into an array, thanks to WP Core forcing these into an object at some point. |
595 | - $cache['value'] = json_decode( $cache['value'] ); |
|
596 | - if ( ! empty( $cache['value']->icons ) ) { |
|
597 | - $cache['value']->icons = (array) $cache['value']->icons; |
|
595 | + $cache[ 'value' ] = json_decode( $cache[ 'value' ] ); |
|
596 | + if ( ! empty( $cache[ 'value' ]->icons ) ) { |
|
597 | + $cache[ 'value' ]->icons = (array)$cache[ 'value' ]->icons; |
|
598 | 598 | } else { |
599 | - $cache['value']->icons = array(); |
|
599 | + $cache[ 'value' ]->icons = array(); |
|
600 | 600 | } |
601 | 601 | |
602 | - return $cache['value']; |
|
602 | + return $cache[ 'value' ]; |
|
603 | 603 | |
604 | 604 | } |
605 | 605 | |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | */ |
612 | 612 | public function set_version_info_cache( $value = '', $cache_key = '' ) { |
613 | 613 | |
614 | - if( empty( $cache_key ) ) { |
|
614 | + if ( empty( $cache_key ) ) { |
|
615 | 615 | $cache_key = $this->cache_key; |
616 | 616 | } |
617 | 617 | |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | update_option( $cache_key, $data, 'no' ); |
624 | 624 | |
625 | 625 | // Delete the duplicate option |
626 | - delete_option( 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) ) ); |
|
626 | + delete_option( 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data[ 'license' ] . $this->beta ) ) ); |
|
627 | 627 | } |
628 | 628 | |
629 | 629 | /** |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | * @return bool |
634 | 634 | */ |
635 | 635 | private function verify_ssl() { |
636 | - return (bool) apply_filters( 'edd_sl_api_request_verify_ssl', true, $this ); |
|
636 | + return (bool)apply_filters( 'edd_sl_api_request_verify_ssl', true, $this ); |
|
637 | 637 | } |
638 | 638 | |
639 | 639 | } |