@@ -4,10 +4,10 @@ discard block |
||
4 | 4 | |
5 | 5 | function __construct() { |
6 | 6 | |
7 | - if( ! is_admin() ) { return; } |
|
7 | + if ( ! is_admin() ) { return; } |
|
8 | 8 | |
9 | 9 | // If Gravity Forms isn't active or compatibile, stop loading |
10 | - if( false === GravityView_Compatibility::is_valid() ) { |
|
10 | + if ( false === GravityView_Compatibility::is_valid() ) { |
|
11 | 11 | return; |
12 | 12 | } |
13 | 13 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) ); |
49 | 49 | add_filter( 'bulk_post_updated_messages', array( $this, 'post_updated_messages' ) ); |
50 | 50 | |
51 | - add_filter( 'plugin_action_links_'. plugin_basename( GRAVITYVIEW_FILE ) , array( $this, 'plugin_action_links' ) ); |
|
51 | + add_filter( 'plugin_action_links_' . plugin_basename( GRAVITYVIEW_FILE ), array( $this, 'plugin_action_links' ) ); |
|
52 | 52 | |
53 | 53 | add_action( 'plugins_loaded', array( $this, 'backend_actions' ), 100 ); |
54 | 54 | |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public static function no_views_text() { |
66 | 66 | |
67 | - if ( isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'] ) { |
|
67 | + if ( isset( $_REQUEST[ 'post_status' ] ) && 'trash' === $_REQUEST[ 'post_status' ] ) { |
|
68 | 68 | return __( 'No Views found in Trash', 'gravityview' ); |
69 | - } elseif( ! empty( $_GET['s'] ) ) { |
|
69 | + } elseif ( ! empty( $_GET[ 's' ] ) ) { |
|
70 | 70 | return __( 'No Views found.', 'gravityview' ); |
71 | 71 | } |
72 | 72 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $error .= ' ' . esc_html__( 'or select another form.', 'gravityview' ); |
111 | 111 | } |
112 | 112 | |
113 | - if( $error ) { |
|
113 | + if ( $error ) { |
|
114 | 114 | ?> |
115 | 115 | <div class="wp-dialog notice-warning inline error wp-clearfix"> |
116 | 116 | <?php echo gravityview_get_floaty(); ?> |
@@ -129,23 +129,23 @@ discard block |
||
129 | 129 | public function backend_actions() { |
130 | 130 | |
131 | 131 | /** @define "GRAVITYVIEW_DIR" "../" */ |
132 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.field.type.php' ); |
|
133 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.render.settings.php' ); |
|
134 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-item.php' ); |
|
135 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-field.php' ); |
|
136 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-widget.php' ); |
|
137 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-views.php' ); |
|
138 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-welcome.php' ); |
|
139 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-installer.php' ); |
|
140 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-add-shortcode.php' ); |
|
141 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' ); |
|
132 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.field.type.php' ); |
|
133 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.render.settings.php' ); |
|
134 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-item.php' ); |
|
135 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-field.php' ); |
|
136 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-widget.php' ); |
|
137 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-views.php' ); |
|
138 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-welcome.php' ); |
|
139 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-installer.php' ); |
|
140 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-add-shortcode.php' ); |
|
141 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' ); |
|
142 | 142 | |
143 | 143 | /** |
144 | 144 | * @action `gravityview_include_backend_actions` Triggered after all GravityView admin files are loaded |
145 | 145 | * |
146 | 146 | * Nice place to insert extensions' backend stuff |
147 | 147 | */ |
148 | - do_action('gravityview_include_backend_actions'); |
|
148 | + do_action( 'gravityview_include_backend_actions' ); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
@@ -161,12 +161,12 @@ discard block |
||
161 | 161 | |
162 | 162 | $actions = array(); |
163 | 163 | |
164 | - if( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
165 | - $actions[] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
164 | + if ( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
165 | + $actions[ ] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
166 | 166 | } |
167 | 167 | |
168 | - if( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
169 | - $actions[] = '<a href="https://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
168 | + if ( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
169 | + $actions[ ] = '<a href="https://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | return array_merge( $actions, $links ); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | // By default, there will only be one item being modified. |
195 | 195 | // When in the `bulk_post_updated_messages` filter, there will be passed a number |
196 | 196 | // of modified items that will override this array. |
197 | - $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1 , 'locked' => 1 , 'deleted' => 1 , 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
197 | + $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1, 'locked' => 1, 'deleted' => 1, 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
198 | 198 | |
199 | 199 | // If we're starting fresh, a new form was created. |
200 | 200 | // We should let the user know this is the case. |
@@ -202,60 +202,60 @@ discard block |
||
202 | 202 | |
203 | 203 | $new_form_text = ''; |
204 | 204 | |
205 | - if( !empty( $start_fresh ) ) { |
|
205 | + if ( ! empty( $start_fresh ) ) { |
|
206 | 206 | |
207 | 207 | // Get the form that was created |
208 | 208 | $connected_form = gravityview_get_form_id( $post_id ); |
209 | 209 | |
210 | - if( !empty( $connected_form ) ) { |
|
210 | + if ( ! empty( $connected_form ) ) { |
|
211 | 211 | $form = gravityview_get_form( $connected_form ); |
212 | - $form_name = esc_attr( $form['title'] ); |
|
212 | + $form_name = esc_attr( $form[ 'title' ] ); |
|
213 | 213 | $image = self::get_floaty(); |
214 | - $new_form_text .= '<h3>'.$image.sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ).'</h3>'; |
|
215 | - $new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s |
|
214 | + $new_form_text .= '<h3>' . $image . sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ) . '</h3>'; |
|
215 | + $new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s |
|
216 | 216 | |
217 | 217 | You can %sedit the form%s in Gravity Forms and the updated fields will be available here. Don’t forget to %scustomize the form settings%s. |
218 | - ', 'gravityview' ), '<strong>', '</strong>', '<a href="'.site_url( '?gf_page=preview&id='.$connected_form ).'">', '</a>', '<code>[gravityform id="'.$connected_form.'" name="'.$form_name.'"]</code>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&id='.$connected_form ).'">', '</a>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&view=settings&id='.$connected_form ).'">', '</a>'); |
|
218 | + ', 'gravityview' ), '<strong>', '</strong>', '<a href="' . site_url( '?gf_page=preview&id=' . $connected_form ) . '">', '</a>', '<code>[gravityform id="' . $connected_form . '" name="' . $form_name . '"]</code>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&id=' . $connected_form ) . '">', '</a>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&view=settings&id=' . $connected_form ) . '">', '</a>' ); |
|
219 | 219 | $new_form_text = wpautop( $new_form_text ); |
220 | 220 | |
221 | 221 | delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
222 | 222 | } |
223 | 223 | } |
224 | 224 | |
225 | - $messages['gravityview'] = array( |
|
225 | + $messages[ 'gravityview' ] = array( |
|
226 | 226 | 0 => '', // Unused. Messages start at index 1. |
227 | 227 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
228 | - 1 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
228 | + 1 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
229 | 229 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
230 | - 2 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
230 | + 2 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
231 | 231 | 3 => __( 'View deleted.', 'gravityview' ), |
232 | 232 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
233 | - 4 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
233 | + 4 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
234 | 234 | /* translators: %s: date and time of the revision */ |
235 | - 5 => isset( $_GET['revision'] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
235 | + 5 => isset( $_GET[ 'revision' ] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int)$_GET[ 'revision' ], false ) ) : false, |
|
236 | 236 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
237 | - 6 => sprintf(__( 'View published. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
237 | + 6 => sprintf( __( 'View published. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
238 | 238 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
239 | - 7 => sprintf(__( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
239 | + 7 => sprintf( __( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
240 | 240 | 8 => __( 'View submitted.', 'gravityview' ), |
241 | 241 | 9 => sprintf( |
242 | 242 | /* translators: Date and time the View is scheduled to be published */ |
243 | 243 | __( 'View scheduled for: %1$s.', 'gravityview' ), |
244 | 244 | // translators: Publish box date format, see http://php.net/date |
245 | - date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
245 | + date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
246 | 246 | ) . $new_form_text, |
247 | 247 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
248 | - 10 => sprintf(__( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
248 | + 10 => sprintf( __( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
249 | 249 | |
250 | 250 | /** |
251 | 251 | * These apply to `bulk_post_updated_messages` |
252 | 252 | * @file wp-admin/edit.php |
253 | 253 | */ |
254 | - 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts['updated'], 'gravityview' ), |
|
255 | - 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts['locked'], 'gravityview' ), |
|
256 | - 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts['deleted'], 'gravityview' ), |
|
257 | - 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts['trashed'], 'gravityview' ), |
|
258 | - 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts['untrashed'], 'gravityview' ), |
|
254 | + 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts[ 'updated' ], 'gravityview' ), |
|
255 | + 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts[ 'locked' ], 'gravityview' ), |
|
256 | + 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts[ 'deleted' ], 'gravityview' ), |
|
257 | + 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts[ 'trashed' ], 'gravityview' ), |
|
258 | + 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts[ 'untrashed' ], 'gravityview' ), |
|
259 | 259 | ); |
260 | 260 | |
261 | 261 | return $messages; |
@@ -49,7 +49,7 @@ |
||
49 | 49 | * |
50 | 50 | * @param array $items Scripts or styles to exclude from no-conflict |
51 | 51 | * |
52 | - * @return array |
|
52 | + * @return string[] |
|
53 | 53 | */ |
54 | 54 | public function register_noconflict( $items ) { |
55 | 55 |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function register_noconflict( $items ) { |
55 | 55 | |
56 | - $items[] = 'gravityview-admin-installer'; |
|
56 | + $items[ ] = 'gravityview-admin-installer'; |
|
57 | 57 | |
58 | 58 | return $items; |
59 | 59 | } |
@@ -70,17 +70,17 @@ discard block |
||
70 | 70 | return; |
71 | 71 | } |
72 | 72 | |
73 | - add_filter( 'plugins_api', function ( $data, $action, $args ) use ( $downloads_data ) { |
|
73 | + add_filter( 'plugins_api', function( $data, $action, $args ) use ( $downloads_data ) { |
|
74 | 74 | foreach ( $downloads_data as $extension ) { |
75 | - if ( empty( $extension['info'] ) || empty( $args->slug ) || $args->slug !== $extension['info']['slug'] ) { |
|
75 | + if ( empty( $extension[ 'info' ] ) || empty( $args->slug ) || $args->slug !== $extension[ 'info' ][ 'slug' ] ) { |
|
76 | 76 | continue; |
77 | 77 | } |
78 | 78 | |
79 | - return (object) array( |
|
80 | - 'slug' => $extension['info']['slug'], |
|
81 | - 'name' => $extension['info']['title'], |
|
82 | - 'version' => $extension['licensing']['version'], |
|
83 | - 'download_link' => $extension['files'][0]['file'], |
|
79 | + return (object)array( |
|
80 | + 'slug' => $extension[ 'info' ][ 'slug' ], |
|
81 | + 'name' => $extension[ 'info' ][ 'title' ], |
|
82 | + 'version' => $extension[ 'licensing' ][ 'version' ], |
|
83 | + 'download_link' => $extension[ 'files' ][ 0 ][ 'file' ], |
|
84 | 84 | ); |
85 | 85 | } |
86 | 86 | |
@@ -137,13 +137,13 @@ discard block |
||
137 | 137 | |
138 | 138 | foreach ( $all_plugins as $path => $plugin ) { |
139 | 139 | |
140 | - if ( empty( $plugin['TextDomain'] ) ) { |
|
140 | + if ( empty( $plugin[ 'TextDomain' ] ) ) { |
|
141 | 141 | continue; |
142 | 142 | } |
143 | 143 | |
144 | - $wp_plugins[ $plugin['TextDomain'] ] = array( |
|
144 | + $wp_plugins[ $plugin[ 'TextDomain' ] ] = array( |
|
145 | 145 | 'path' => $path, |
146 | - 'version' => $plugin['Version'], |
|
146 | + 'version' => $plugin[ 'Version' ], |
|
147 | 147 | 'activated' => is_plugin_active( $path ) |
148 | 148 | ); |
149 | 149 | } |
@@ -225,13 +225,13 @@ discard block |
||
225 | 225 | |
226 | 226 | $downloads_data = json_decode( wp_remote_retrieve_body( $response ), true ); |
227 | 227 | |
228 | - if ( empty( $downloads_data['products'] ) ) { |
|
228 | + if ( empty( $downloads_data[ 'products' ] ) ) { |
|
229 | 229 | return array(); |
230 | 230 | } |
231 | 231 | |
232 | - $this->set_downloads_data( $downloads_data['products'] ); |
|
232 | + $this->set_downloads_data( $downloads_data[ 'products' ] ); |
|
233 | 233 | |
234 | - return $downloads_data['products']; |
|
234 | + return $downloads_data[ 'products' ]; |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | /** |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | |
300 | 300 | foreach ( $downloads_data as $extension ) { |
301 | 301 | |
302 | - if ( empty( $extension['info'] ) ) { |
|
302 | + if ( empty( $extension[ 'info' ] ) ) { |
|
303 | 303 | continue; |
304 | 304 | } |
305 | 305 | |
@@ -328,28 +328,28 @@ discard block |
||
328 | 328 | |
329 | 329 | $details = $this->get_download_display_details( $download, $wp_plugins ); |
330 | 330 | |
331 | - $download_info = $details['download_info']; |
|
331 | + $download_info = $details[ 'download_info' ]; |
|
332 | 332 | |
333 | 333 | ?> |
334 | - <div class="item <?php echo esc_attr( $details['item_class'] ); ?>"> |
|
334 | + <div class="item <?php echo esc_attr( $details[ 'item_class' ] ); ?>"> |
|
335 | 335 | <div class="addon-inner"> |
336 | - <a href="<?php echo esc_url( $download_info['link'] ); ?>" rel="external noreferrer noopener" title="<?php esc_html_e( 'Visit the plugin page', 'gravityview' ); ?>"><img class="thumbnail" src="<?php echo esc_attr( $download_info['thumbnail'] ); ?>" alt="" /></a> |
|
337 | - <h3><?php echo esc_html( $download_info['title'] ); ?></h3> |
|
336 | + <a href="<?php echo esc_url( $download_info[ 'link' ] ); ?>" rel="external noreferrer noopener" title="<?php esc_html_e( 'Visit the plugin page', 'gravityview' ); ?>"><img class="thumbnail" src="<?php echo esc_attr( $download_info[ 'thumbnail' ] ); ?>" alt="" /></a> |
|
337 | + <h3><?php echo esc_html( $download_info[ 'title' ] ); ?></h3> |
|
338 | 338 | <div> |
339 | - <?php if( $details['status_label'] ) { ?> |
|
340 | - <div class="status <?php echo esc_attr( $details['status'] ); ?>" title="<?php printf( esc_attr__( 'Plugin status: %s', 'gravityview' ), esc_html( $details['status_label'] ) ); ?>"> |
|
341 | - <span class="dashicons dashicons-admin-plugins"></span> <span class="status-label"><?php echo esc_html( $details['status_label'] ); ?></span> |
|
339 | + <?php if ( $details[ 'status_label' ] ) { ?> |
|
340 | + <div class="status <?php echo esc_attr( $details[ 'status' ] ); ?>" title="<?php printf( esc_attr__( 'Plugin status: %s', 'gravityview' ), esc_html( $details[ 'status_label' ] ) ); ?>"> |
|
341 | + <span class="dashicons dashicons-admin-plugins"></span> <span class="status-label"><?php echo esc_html( $details[ 'status_label' ] ); ?></span> |
|
342 | 342 | </div> |
343 | 343 | <?php } ?> |
344 | 344 | |
345 | - <a data-status="<?php echo esc_attr( $details['status'] ); ?>" data-plugin-path="<?php echo esc_attr( $details['plugin_path'] ); ?>" href="<?php echo esc_url( $details['href'] ); ?>" class="button <?php echo esc_attr( $details['button_class'] ); ?>" title="<?php echo esc_attr( $details['button_title'] ); ?>"> |
|
346 | - <span class="title"><?php echo esc_html( $details['button_label'] ); ?></span> |
|
347 | - <?php if( $details['spinner'] ) { ?><span class="spinner"></span><?php } ?> |
|
345 | + <a data-status="<?php echo esc_attr( $details[ 'status' ] ); ?>" data-plugin-path="<?php echo esc_attr( $details[ 'plugin_path' ] ); ?>" href="<?php echo esc_url( $details[ 'href' ] ); ?>" class="button <?php echo esc_attr( $details[ 'button_class' ] ); ?>" title="<?php echo esc_attr( $details[ 'button_title' ] ); ?>"> |
|
346 | + <span class="title"><?php echo esc_html( $details[ 'button_label' ] ); ?></span> |
|
347 | + <?php if ( $details[ 'spinner' ] ) { ?><span class="spinner"></span><?php } ?> |
|
348 | 348 | </a> |
349 | 349 | </div> |
350 | 350 | |
351 | 351 | <div class="addon-excerpt"> |
352 | - <?php echo wpautop( esc_html( $download_info['excerpt'] ) ); ?> |
|
352 | + <?php echo wpautop( esc_html( $download_info[ 'excerpt' ] ) ); ?> |
|
353 | 353 | </div> |
354 | 354 | </div> |
355 | 355 | </div> |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | */ |
380 | 380 | private function get_download_display_details( $download, $wp_plugins ) { |
381 | 381 | |
382 | - $download_info = wp_parse_args( (array) $download['info'], array( |
|
382 | + $download_info = wp_parse_args( (array)$download[ 'info' ], array( |
|
383 | 383 | 'thumbnail' => '', |
384 | 384 | 'title' => '', |
385 | 385 | 'textdomain' => '', |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | 'link' => '', |
389 | 389 | ) ); |
390 | 390 | |
391 | - $wp_plugin = \GV\Utils::get( $wp_plugins, $download_info['textdomain'], false ); |
|
391 | + $wp_plugin = \GV\Utils::get( $wp_plugins, $download_info[ 'textdomain' ], false ); |
|
392 | 392 | |
393 | 393 | $has_access = true; //! empty( $download['files'] ); |
394 | 394 | $spinner = true; |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | $required_license = $galactic_only ? __( 'Galactic', 'gravityview' ) : __( 'Interstellar', 'gravityview' ); |
401 | 401 | |
402 | 402 | // The license is not active - no matter what level, this should not work |
403 | - if( ! $is_active && empty( $base_price ) ) { |
|
403 | + if ( ! $is_active && empty( $base_price ) ) { |
|
404 | 404 | $spinner = false; |
405 | 405 | $button_class = 'disabled disabled-license'; |
406 | 406 | $button_label = sprintf( __( 'Active %s License is Required.', 'gravityview' ), $required_license ); |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | $status_label = ''; |
413 | 413 | $button_label = sprintf( __( 'Purchase Now for %s', 'gravityview' ), '$' . $base_price ); |
414 | 414 | $button_class = 'button-primary button-large'; |
415 | - $href = $download_info['link']; |
|
415 | + $href = $download_info[ 'link' ]; |
|
416 | 416 | $item_class = 'featured'; |
417 | 417 | } |
418 | 418 | |
@@ -431,8 +431,8 @@ discard block |
||
431 | 431 | $href = add_query_arg( |
432 | 432 | array( |
433 | 433 | 'action' => 'install-plugin', |
434 | - 'plugin' => $download_info['slug'], |
|
435 | - '_wpnonce' => wp_create_nonce( 'install-plugin_' . $download_info['slug'] ), |
|
434 | + 'plugin' => $download_info[ 'slug' ], |
|
435 | + '_wpnonce' => wp_create_nonce( 'install-plugin_' . $download_info[ 'slug' ] ), |
|
436 | 436 | ), |
437 | 437 | self_admin_url( 'update.php' ) |
438 | 438 | ); |
@@ -444,26 +444,26 @@ discard block |
||
444 | 444 | } |
445 | 445 | |
446 | 446 | // Access and the plugin is installed but not active |
447 | - else if ( false === $wp_plugin['activated'] ) { |
|
447 | + else if ( false === $wp_plugin[ 'activated' ] ) { |
|
448 | 448 | |
449 | 449 | $status = 'inactive'; |
450 | 450 | $status_label = __( 'Inactive', 'gravityview' ); |
451 | 451 | $button_label = __( 'Activate', 'gravityview' ); |
452 | - $plugin_path = $wp_plugin['path']; |
|
452 | + $plugin_path = $wp_plugin[ 'path' ]; |
|
453 | 453 | |
454 | 454 | } |
455 | 455 | |
456 | 456 | // Access and the plugin is installed and active |
457 | 457 | else { |
458 | 458 | |
459 | - $plugin_path = $wp_plugin['path']; |
|
459 | + $plugin_path = $wp_plugin[ 'path' ]; |
|
460 | 460 | $status = 'active'; |
461 | 461 | $status_label = __( 'Active', 'gravityview' ); |
462 | 462 | $button_label = __( 'Deactivate', 'gravityview' ); |
463 | 463 | |
464 | 464 | } |
465 | 465 | |
466 | - return compact( 'download_info','plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' ); |
|
466 | + return compact( 'download_info', 'plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' ); |
|
467 | 467 | } |
468 | 468 | |
469 | 469 | /** |
@@ -478,11 +478,11 @@ discard block |
||
478 | 478 | $base_price = \GV\Utils::get( $download, 'pricing/amount', 0 ); |
479 | 479 | $base_price = \GFCommon::to_number( $base_price ); |
480 | 480 | |
481 | - unset( $download['pricing']['amount'] ); |
|
481 | + unset( $download[ 'pricing' ][ 'amount' ] ); |
|
482 | 482 | |
483 | 483 | // Price options array, not single price |
484 | - if ( ! $base_price && ! empty( $download['pricing'] ) ) { |
|
485 | - $base_price = array_shift( $download['pricing'] ); |
|
484 | + if ( ! $base_price && ! empty( $download[ 'pricing' ] ) ) { |
|
485 | + $base_price = array_shift( $download[ 'pricing' ] ); |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | return floatval( $base_price ); |
@@ -496,11 +496,11 @@ discard block |
||
496 | 496 | public function activate_download() { |
497 | 497 | $data = \GV\Utils::_POST( 'data', array() ); |
498 | 498 | |
499 | - if ( empty( $data['path'] ) ) { |
|
499 | + if ( empty( $data[ 'path' ] ) ) { |
|
500 | 500 | return; |
501 | 501 | } |
502 | 502 | |
503 | - $result = activate_plugin( $data['path'] ); |
|
503 | + $result = activate_plugin( $data[ 'path' ] ); |
|
504 | 504 | |
505 | 505 | if ( is_wp_error( $result ) ) { |
506 | 506 | wp_send_json_error( |
@@ -521,11 +521,11 @@ discard block |
||
521 | 521 | public function deactivate_download() { |
522 | 522 | $data = \GV\Utils::_POST( 'data', array() ); |
523 | 523 | |
524 | - if ( empty( $data['path'] ) ) { |
|
524 | + if ( empty( $data[ 'path' ] ) ) { |
|
525 | 525 | return; |
526 | 526 | } |
527 | 527 | |
528 | - $plugin = plugin_basename( trim( $data['path'] ) ); /** @see deactivate_plugins() */ |
|
528 | + $plugin = plugin_basename( trim( $data[ 'path' ] ) ); /** @see deactivate_plugins() */ |
|
529 | 529 | |
530 | 530 | /** |
531 | 531 | * deactivate_plugins() has no return value, so instead, we hook into an action that runs on success |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | */ |
534 | 534 | add_action( 'deactivate_' . $plugin, 'wp_send_json_success' ); |
535 | 535 | |
536 | - deactivate_plugins( $data['path'] ); |
|
536 | + deactivate_plugins( $data[ 'path' ] ); |
|
537 | 537 | |
538 | 538 | // And if we're able to reach this function, we know something went wrong |
539 | 539 | wp_send_json_error( |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function add_admin_menu() { |
97 | 97 | |
98 | - $menu_text = _x( 'Extensions', 'Extensions are WordPress plugins that add functionality to GravityView and Gravity Forms', 'gravityview' ); |
|
98 | + $menu_text = _x( 'Extensions', 'Extensions are WordPress plugins that add functionality to GravityView and Gravity Forms', 'gravityview' ); |
|
99 | 99 | |
100 | 100 | $menu_text = sprintf( '<span title="%s">%s</span>', esc_attr__( 'Plugins that extend GravityView and Gravity Forms functionality.', 'gravityview' ), $menu_text ); |
101 | 101 | |
@@ -110,8 +110,8 @@ discard block |
||
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
113 | - * When on the Installer page, show a different notice than on the Settings page |
|
114 | - * |
|
113 | + * When on the Installer page, show a different notice than on the Settings page |
|
114 | + * |
|
115 | 115 | * @param array $notice |
116 | 116 | * |
117 | 117 | * @return string License notice |
@@ -119,10 +119,10 @@ discard block |
||
119 | 119 | public function maybe_modify_license_notice( $notice = '' ) { |
120 | 120 | |
121 | 121 | if ( ! gravityview()->request->is_admin( '', 'downloads' ) ) { |
122 | - return $notice; |
|
123 | - } |
|
122 | + return $notice; |
|
123 | + } |
|
124 | 124 | |
125 | - return esc_html__( 'Your license %s. Do you want access to these plugins? %sActivate your license%s or %sget a license here%s.', 'gravityview' ); |
|
125 | + return esc_html__( 'Your license %s. Do you want access to these plugins? %sActivate your license%s or %sget a license here%s.', 'gravityview' ); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -160,43 +160,43 @@ discard block |
||
160 | 160 | * Get downloads data from transient or from API; save transient after getting data from API |
161 | 161 | * |
162 | 162 | * @return WP_Error|array If error, returns WP_Error. If not valid JSON, empty array. Otherwise, this structure: { |
163 | - * @type array $info { |
|
164 | - * @type string $id int 17 |
|
165 | - * @type string $slug Extension slug |
|
166 | - * @type string $title Extension title |
|
167 | - * @type string $create_date in '2018-07-19 20:03:10' format |
|
168 | - * @type string $modified_date |
|
169 | - * @type string $status |
|
170 | - * @type string $link URL to public plugin page |
|
171 | - * @type string $content |
|
172 | - * @type string $excerpt |
|
173 | - * @type string $thumbnail URL to thumbnail |
|
174 | - * @type array $category Taxonomy details for the plugin's category { |
|
175 | - * @type int $term_id => int 30 |
|
176 | - * @type string $name => string 'Plugins' (length=7) |
|
177 | - * @type string $slug => string 'plugins' (length=7) |
|
178 | - * @type int $term_group => int 0 |
|
179 | - * @type int $term_taxonomy_id => int 30 |
|
180 | - * @type string $taxonomy => string 'download_category' (length=17) |
|
181 | - * @type string $description => string '' (length=0) |
|
182 | - * @type int $parent => int 0 |
|
183 | - * @type int $count => int 4 |
|
184 | - * @type string $filter => string 'raw' (length=3) |
|
185 | - * } |
|
186 | - * @type array $tags {see $category above} |
|
187 | - * @type string $textdomain string 'gravityview' (length=11) |
|
188 | - * } |
|
189 | - * @type array $pricing array of `price_name_slugs` => '00.00' values, if price options exist |
|
190 | - * @type array $licensing { |
|
191 | - * @type bool $enabled Is licensing enabled for the extension |
|
192 | - * @type string $version Version number |
|
193 | - * @type string $exp_unit Expiration unit ('years') |
|
194 | - * @type string $exp_length Expiration length ('1') |
|
195 | - * } |
|
196 | - * @type array $files Array of files. Empty if user has no access to the file. { |
|
197 | - * @type string $file string URL of the file download |
|
198 | - * } |
|
199 | - * } |
|
163 | + * @type array $info { |
|
164 | + * @type string $id int 17 |
|
165 | + * @type string $slug Extension slug |
|
166 | + * @type string $title Extension title |
|
167 | + * @type string $create_date in '2018-07-19 20:03:10' format |
|
168 | + * @type string $modified_date |
|
169 | + * @type string $status |
|
170 | + * @type string $link URL to public plugin page |
|
171 | + * @type string $content |
|
172 | + * @type string $excerpt |
|
173 | + * @type string $thumbnail URL to thumbnail |
|
174 | + * @type array $category Taxonomy details for the plugin's category { |
|
175 | + * @type int $term_id => int 30 |
|
176 | + * @type string $name => string 'Plugins' (length=7) |
|
177 | + * @type string $slug => string 'plugins' (length=7) |
|
178 | + * @type int $term_group => int 0 |
|
179 | + * @type int $term_taxonomy_id => int 30 |
|
180 | + * @type string $taxonomy => string 'download_category' (length=17) |
|
181 | + * @type string $description => string '' (length=0) |
|
182 | + * @type int $parent => int 0 |
|
183 | + * @type int $count => int 4 |
|
184 | + * @type string $filter => string 'raw' (length=3) |
|
185 | + * } |
|
186 | + * @type array $tags {see $category above} |
|
187 | + * @type string $textdomain string 'gravityview' (length=11) |
|
188 | + * } |
|
189 | + * @type array $pricing array of `price_name_slugs` => '00.00' values, if price options exist |
|
190 | + * @type array $licensing { |
|
191 | + * @type bool $enabled Is licensing enabled for the extension |
|
192 | + * @type string $version Version number |
|
193 | + * @type string $exp_unit Expiration unit ('years') |
|
194 | + * @type string $exp_length Expiration length ('1') |
|
195 | + * } |
|
196 | + * @type array $files Array of files. Empty if user has no access to the file. { |
|
197 | + * @type string $file string URL of the file download |
|
198 | + * } |
|
199 | + * } |
|
200 | 200 | */ |
201 | 201 | public function get_downloads_data() { |
202 | 202 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | ) ); |
225 | 225 | |
226 | 226 | if ( is_wp_error( $response ) ) { |
227 | - gravityview()->log->error( "Extension data response is an error", array( 'data' => $response ) ); |
|
227 | + gravityview()->log->error( "Extension data response is an error", array( 'data' => $response ) ); |
|
228 | 228 | return $response; |
229 | 229 | } |
230 | 230 | |
@@ -277,10 +277,10 @@ discard block |
||
277 | 277 | <div class="gv-admin-installer-notice notice inline error"> |
278 | 278 | <h3><?php esc_html_e( 'Extensions and plugins data cannot be loaded at the moment. Please try again later.', 'gravityview' ); ?></h3> |
279 | 279 | <?php |
280 | - if ( is_wp_error( $downloads_data ) ) { |
|
281 | - echo wpautop( '<pre>' . esc_html( $downloads_data->get_error_message() ) . '</pre>' ); |
|
282 | - } |
|
283 | - ?> |
|
280 | + if ( is_wp_error( $downloads_data ) ) { |
|
281 | + echo wpautop( '<pre>' . esc_html( $downloads_data->get_error_message() ) . '</pre>' ); |
|
282 | + } |
|
283 | + ?> |
|
284 | 284 | </div> |
285 | 285 | </div> |
286 | 286 | <?php |
@@ -336,9 +336,9 @@ discard block |
||
336 | 336 | protected function render_download( $download, $wp_plugins ) { |
337 | 337 | |
338 | 338 | |
339 | - $details = $this->get_download_display_details( $download, $wp_plugins ); |
|
339 | + $details = $this->get_download_display_details( $download, $wp_plugins ); |
|
340 | 340 | |
341 | - $download_info = $details['download_info']; |
|
341 | + $download_info = $details['download_info']; |
|
342 | 342 | |
343 | 343 | ?> |
344 | 344 | <div class="item <?php echo esc_attr( $details['item_class'] ); ?>"> |
@@ -367,25 +367,25 @@ discard block |
||
367 | 367 | } |
368 | 368 | |
369 | 369 | /** |
370 | - * Generates details array for the download to keep the render_download() method a bit tidier |
|
371 | - * |
|
370 | + * Generates details array for the download to keep the render_download() method a bit tidier |
|
371 | + * |
|
372 | 372 | * @param array $download Single download, as returned by {@see get_downloads_data} |
373 | 373 | * @param array $wp_plugins All active plugins, as returned by {@see get_plugins()} |
374 | 374 | * |
375 | 375 | * @return array { |
376 | - * @type array $download_info |
|
377 | - * @type string $plugin_path |
|
378 | - * @type string $status License status returned by Easy Digital Downloads ("active", "inactive", "expired", "revoked", etc) |
|
379 | - * @type string $status_label |
|
380 | - * @type string $button_title Title attribute to show when hovering over the download's button |
|
381 | - * @type string $button_class CSS class to use for the button |
|
382 | - * @type string $button_label Text to use for the download's anchor link |
|
383 | - * @type string $href URL for the download's button |
|
384 | - * @type bool $spinner Whether to show the spinner icon |
|
385 | - * @type string $item_class CSS class for the download container |
|
386 | - * @type string $required_license The name of the required license for the download ("Galactic" or "Interstellar") |
|
387 | - * @type bool $is_active Is the current GravityView license (as entered in Settings) active? |
|
388 | - * } |
|
376 | + * @type array $download_info |
|
377 | + * @type string $plugin_path |
|
378 | + * @type string $status License status returned by Easy Digital Downloads ("active", "inactive", "expired", "revoked", etc) |
|
379 | + * @type string $status_label |
|
380 | + * @type string $button_title Title attribute to show when hovering over the download's button |
|
381 | + * @type string $button_class CSS class to use for the button |
|
382 | + * @type string $button_label Text to use for the download's anchor link |
|
383 | + * @type string $href URL for the download's button |
|
384 | + * @type bool $spinner Whether to show the spinner icon |
|
385 | + * @type string $item_class CSS class for the download container |
|
386 | + * @type string $required_license The name of the required license for the download ("Galactic" or "Interstellar") |
|
387 | + * @type bool $is_active Is the current GravityView license (as entered in Settings) active? |
|
388 | + * } |
|
389 | 389 | */ |
390 | 390 | private function get_download_display_details( $download, $wp_plugins ) { |
391 | 391 | |
@@ -474,18 +474,18 @@ discard block |
||
474 | 474 | } |
475 | 475 | |
476 | 476 | return compact( 'download_info','plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' ); |
477 | - } |
|
477 | + } |
|
478 | 478 | |
479 | 479 | /** |
480 | - * Returns the base price for an extension |
|
481 | - * |
|
480 | + * Returns the base price for an extension |
|
481 | + * |
|
482 | 482 | * @param array $download |
483 | 483 | * |
484 | 484 | * @return float Base price for an extension. If not for sale separately, returns 0 |
485 | 485 | */ |
486 | 486 | private function get_download_base_price( $download ) { |
487 | 487 | |
488 | - $base_price = \GV\Utils::get( $download, 'pricing/amount', 0 ); |
|
488 | + $base_price = \GV\Utils::get( $download, 'pricing/amount', 0 ); |
|
489 | 489 | $base_price = \GFCommon::to_number( $base_price ); |
490 | 490 | |
491 | 491 | unset( $download['pricing']['amount'] ); |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | } |
497 | 497 | |
498 | 498 | return floatval( $base_price ); |
499 | - } |
|
499 | + } |
|
500 | 500 | |
501 | 501 | /** |
502 | 502 | * Handle AJAX request to activate extension |
@@ -538,9 +538,9 @@ discard block |
||
538 | 538 | $plugin = plugin_basename( trim( $data['path'] ) ); /** @see deactivate_plugins() */ |
539 | 539 | |
540 | 540 | /** |
541 | - * deactivate_plugins() has no return value, so instead, we hook into an action that runs on success |
|
542 | - * We could have used `deactivate_plugin`, but this is more specific |
|
543 | - */ |
|
541 | + * deactivate_plugins() has no return value, so instead, we hook into an action that runs on success |
|
542 | + * We could have used `deactivate_plugin`, but this is more specific |
|
543 | + */ |
|
544 | 544 | add_action( 'deactivate_' . $plugin, 'wp_send_json_success' ); |
545 | 545 | |
546 | 546 | deactivate_plugins( $data['path'] ); |
@@ -32,19 +32,19 @@ discard block |
||
32 | 32 | // If there's an overriding CSS file in the current template folder, use it. |
33 | 33 | $template_css_path = trailingslashit( get_stylesheet_directory() ) . 'gravityview/css/' . $css_file; |
34 | 34 | |
35 | - if( file_exists( $template_css_path ) ) { |
|
35 | + if ( file_exists( $template_css_path ) ) { |
|
36 | 36 | $path = trailingslashit( get_stylesheet_directory_uri() ) . 'gravityview/css/' . $css_file; |
37 | 37 | gravityview()->log->debug( 'Stylesheet override ({css_file})', array( 'css_file' => esc_attr( $css_file ) ) ); |
38 | 38 | } else { |
39 | 39 | // Default: use GravityView CSS file |
40 | 40 | |
41 | 41 | // If no path is provided, assume default plugin templates CSS folder |
42 | - if( '' === $dir_path ) { |
|
42 | + if ( '' === $dir_path ) { |
|
43 | 43 | $dir_path = GRAVITYVIEW_DIR . 'templates/css/'; |
44 | 44 | } |
45 | 45 | |
46 | 46 | // plugins_url() expects a path to a file, not directory. We append a file to be stripped. |
47 | - $path = plugins_url( $css_file, trailingslashit( $dir_path ) . 'stripped-by-plugin_basename.php' ); |
|
47 | + $path = plugins_url( $css_file, trailingslashit( $dir_path ) . 'stripped-by-plugin_basename.php' ); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | return $path; |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | |
83 | 83 | $parsed_permalink = parse_url( get_permalink( $id ) ); |
84 | 84 | |
85 | - $permalink_args = isset( $parsed_permalink['query'] ) ? $parsed_permalink['query'] : false; |
|
85 | + $permalink_args = isset( $parsed_permalink[ 'query' ] ) ? $parsed_permalink[ 'query' ] : false; |
|
86 | 86 | |
87 | - if( empty( $permalink_args ) ) { |
|
87 | + if ( empty( $permalink_args ) ) { |
|
88 | 88 | return array(); |
89 | 89 | } |
90 | 90 | |
@@ -109,15 +109,15 @@ discard block |
||
109 | 109 | function gv_selected( $value, $current, $echo = true, $type = 'selected' ) { |
110 | 110 | |
111 | 111 | $output = ''; |
112 | - if( is_array( $current ) ) { |
|
113 | - if( in_array( $value, $current ) ) { |
|
112 | + if ( is_array( $current ) ) { |
|
113 | + if ( in_array( $value, $current ) ) { |
|
114 | 114 | $output = __checked_selected_helper( true, true, false, $type ); |
115 | 115 | } |
116 | 116 | } else { |
117 | 117 | $output = __checked_selected_helper( $value, $current, false, $type ); |
118 | 118 | } |
119 | 119 | |
120 | - if( $echo ) { |
|
120 | + if ( $echo ) { |
|
121 | 121 | echo $output; |
122 | 122 | } |
123 | 123 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | } |
126 | 126 | |
127 | 127 | |
128 | -if( ! function_exists( 'gravityview_sanitize_html_class' ) ) { |
|
128 | +if ( ! function_exists( 'gravityview_sanitize_html_class' ) ) { |
|
129 | 129 | |
130 | 130 | /** |
131 | 131 | * sanitize_html_class doesn't handle spaces (multiple classes). We remedy that. |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | */ |
172 | 172 | function gravityview_strip_whitespace( $string ) { |
173 | 173 | $string = normalize_whitespace( $string ); |
174 | - return preg_replace('/[\r\n\t ]+/', ' ', $string ); |
|
174 | + return preg_replace( '/[\r\n\t ]+/', ' ', $string ); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * @return string Included file contents |
186 | 186 | */ |
187 | 187 | function gravityview_ob_include( $file_path, $object = NULL ) { |
188 | - if( ! file_exists( $file_path ) ) { |
|
188 | + if ( ! file_exists( $file_path ) ) { |
|
189 | 189 | gravityview()->log->error( 'File path does not exist. {path}', array( 'path' => $file_path ) ); |
190 | 190 | return ''; |
191 | 191 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | |
210 | 210 | $width = $height * 0.7586206897; |
211 | 211 | |
212 | - if( function_exists('is_rtl') && is_rtl() ) { |
|
212 | + if ( function_exists( 'is_rtl' ) && is_rtl() ) { |
|
213 | 213 | $style = 'margin:10px 10px 10px 0;'; |
214 | 214 | $css_class = is_string( $css_class ) ? $css_class : 'alignright'; |
215 | 215 | } else { |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $css_class = is_string( $css_class ) ? $css_class : 'alignleft'; |
218 | 218 | } |
219 | 219 | |
220 | - return '<img src="'. esc_url( plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ) ) .'" class="'. gravityview_sanitize_html_class( $css_class ).'" height="'.intval( $height ).'" width="'.round( $width, 2 ).'" alt="The GravityView Astronaut Says:" style="'.$style.'" />'; |
|
220 | + return '<img src="' . esc_url( plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ) ) . '" class="' . gravityview_sanitize_html_class( $css_class ) . '" height="' . intval( $height ) . '" width="' . round( $width, 2 ) . '" alt="The GravityView Astronaut Says:" style="' . $style . '" />'; |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | /** |
@@ -240,9 +240,9 @@ discard block |
||
240 | 240 | function gravityview_number_format( $number, $decimals = '' ) { |
241 | 241 | global $wp_locale; |
242 | 242 | |
243 | - if( '' === $decimals ) { |
|
243 | + if ( '' === $decimals ) { |
|
244 | 244 | |
245 | - $decimal_point = isset( $wp_locale ) ? $wp_locale->number_format['decimal_point'] : '.'; |
|
245 | + $decimal_point = isset( $wp_locale ) ? $wp_locale->number_format[ 'decimal_point' ] : '.'; |
|
246 | 246 | |
247 | 247 | /** |
248 | 248 | * Calculate the position of the decimal point in the number |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | $parts = parse_url( $value ); |
272 | 272 | |
273 | 273 | // No domain? Strange...show the original text. |
274 | - if( empty( $parts['host'] ) ) { |
|
274 | + if ( empty( $parts[ 'host' ] ) ) { |
|
275 | 275 | return $value; |
276 | 276 | } |
277 | 277 | |
@@ -284,16 +284,16 @@ discard block |
||
284 | 284 | * @param boolean $enable Whether to strip the scheme. Return false to show scheme. (default: true)\n |
285 | 285 | * If true: `http://example.com => example.com` |
286 | 286 | */ |
287 | - if( false === apply_filters('gravityview_anchor_text_striphttp', true) ) { |
|
287 | + if ( false === apply_filters( 'gravityview_anchor_text_striphttp', true ) ) { |
|
288 | 288 | |
289 | - if( isset( $parts['scheme'] ) ) { |
|
290 | - $return .= $parts['scheme']; |
|
289 | + if ( isset( $parts[ 'scheme' ] ) ) { |
|
290 | + $return .= $parts[ 'scheme' ]; |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | } |
294 | 294 | |
295 | 295 | // The domain, which may contain a subdomain |
296 | - $domain = $parts['host']; |
|
296 | + $domain = $parts[ 'host' ]; |
|
297 | 297 | |
298 | 298 | /** |
299 | 299 | * @filter `gravityview_anchor_text_stripwww` Strip www from the domain? |
@@ -301,10 +301,10 @@ discard block |
||
301 | 301 | * @param boolean $enable Whether to strip www. Return false to show www. (default: true)\n |
302 | 302 | * If true: `www.example.com => example.com` |
303 | 303 | */ |
304 | - $strip_www = apply_filters('gravityview_anchor_text_stripwww', true ); |
|
304 | + $strip_www = apply_filters( 'gravityview_anchor_text_stripwww', true ); |
|
305 | 305 | |
306 | - if( $strip_www ) { |
|
307 | - $domain = str_replace('www.', '', $domain ); |
|
306 | + if ( $strip_www ) { |
|
307 | + $domain = str_replace( 'www.', '', $domain ); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | /** |
@@ -314,11 +314,11 @@ discard block |
||
314 | 314 | * If true: `http://demo.example.com => example.com` \n |
315 | 315 | * If false: `http://demo.example.com => demo.example.com` |
316 | 316 | */ |
317 | - $strip_subdomains = apply_filters('gravityview_anchor_text_nosubdomain', true); |
|
317 | + $strip_subdomains = apply_filters( 'gravityview_anchor_text_nosubdomain', true ); |
|
318 | 318 | |
319 | - if( $strip_subdomains ) { |
|
319 | + if ( $strip_subdomains ) { |
|
320 | 320 | |
321 | - $domain = _gravityview_strip_subdomain( $parts['host'] ); |
|
321 | + $domain = _gravityview_strip_subdomain( $parts[ 'host' ] ); |
|
322 | 322 | |
323 | 323 | } |
324 | 324 | |
@@ -332,12 +332,12 @@ discard block |
||
332 | 332 | * If true: `http://example.com/sub/directory/page.html => example.com` \n |
333 | 333 | * If false: `http://example.com/sub/directory/page.html => example.com/sub/directory/page.html` |
334 | 334 | */ |
335 | - $root_only = apply_filters('gravityview_anchor_text_rootonly', true); |
|
335 | + $root_only = apply_filters( 'gravityview_anchor_text_rootonly', true ); |
|
336 | 336 | |
337 | - if( empty( $root_only ) ) { |
|
337 | + if ( empty( $root_only ) ) { |
|
338 | 338 | |
339 | - if( isset( $parts['path'] ) ) { |
|
340 | - $return .= $parts['path']; |
|
339 | + if ( isset( $parts[ 'path' ] ) ) { |
|
340 | + $return .= $parts[ 'path' ]; |
|
341 | 341 | } |
342 | 342 | } |
343 | 343 | |
@@ -347,12 +347,12 @@ discard block |
||
347 | 347 | * @param boolean $enable Whether to enable "root only". Return false to show full path. (default: true)\n |
348 | 348 | * If true: `http://example.com/?query=example => example.com` |
349 | 349 | */ |
350 | - $strip_query_string = apply_filters('gravityview_anchor_text_noquerystring', true ); |
|
350 | + $strip_query_string = apply_filters( 'gravityview_anchor_text_noquerystring', true ); |
|
351 | 351 | |
352 | - if( empty( $strip_query_string ) ) { |
|
352 | + if ( empty( $strip_query_string ) ) { |
|
353 | 353 | |
354 | - if( isset( $parts['query'] ) ) { |
|
355 | - $return .= '?'.$parts['query']; |
|
354 | + if ( isset( $parts[ 'query' ] ) ) { |
|
355 | + $return .= '?' . $parts[ 'query' ]; |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | } |
@@ -369,8 +369,8 @@ discard block |
||
369 | 369 | */ |
370 | 370 | function _gravityview_strip_subdomain( $string_maybe_has_subdomain ) { |
371 | 371 | |
372 | - if( preg_match("/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.(?:com\.|co\.|net\.|org\.|firm\.|me\.|school\.|law\.|gov\.|mod\.|msk\.|irkutsks\.|sa\.|act\.|police\.|plc\.|ac\.|tm\.|asso\.|biz\.|pro\.|cg\.|telememo\.)?[a-z\.]{2,6})$/i", $string_maybe_has_subdomain, $matches ) ) { |
|
373 | - return $matches['domain']; |
|
372 | + if ( preg_match( "/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.(?:com\.|co\.|net\.|org\.|firm\.|me\.|school\.|law\.|gov\.|mod\.|msk\.|irkutsks\.|sa\.|act\.|police\.|plc\.|ac\.|tm\.|asso\.|biz\.|pro\.|cg\.|telememo\.)?[a-z\.]{2,6})$/i", $string_maybe_has_subdomain, $matches ) ) { |
|
373 | + return $matches[ 'domain' ]; |
|
374 | 374 | } else { |
375 | 375 | return $string_maybe_has_subdomain; |
376 | 376 | } |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | |
440 | 440 | if ( in_array( $value, array( 'yes', 'true' ), true ) ) { |
441 | 441 | $value = true; |
442 | - } else if( in_array( $value, array( 'no', 'false' ), true ) ) { |
|
442 | + } else if ( in_array( $value, array( 'no', 'false' ), true ) ) { |
|
443 | 443 | $value = false; |
444 | 444 | } |
445 | 445 | } |
@@ -468,19 +468,19 @@ discard block |
||
468 | 468 | */ |
469 | 469 | function gv_maybe_json_decode( $value, $assoc = false, $depth = 512, $options = 0 ) { |
470 | 470 | |
471 | - if( ! is_string( $value ) ) { |
|
471 | + if ( ! is_string( $value ) ) { |
|
472 | 472 | return $value; |
473 | 473 | } |
474 | 474 | |
475 | 475 | $decoded = json_decode( $value ); |
476 | 476 | |
477 | 477 | // There was a JSON error (PHP 5.3+) |
478 | - if( function_exists('json_last_error') && JSON_ERROR_NONE !== json_last_error() ) { |
|
478 | + if ( function_exists( 'json_last_error' ) && JSON_ERROR_NONE !== json_last_error() ) { |
|
479 | 479 | return $value; |
480 | 480 | } |
481 | 481 | |
482 | 482 | // It wasn't JSON (PHP < 5.3 fallback) |
483 | - if( is_null( $decoded ) ) { |
|
483 | + if ( is_null( $decoded ) ) { |
|
484 | 484 | return $value; |
485 | 485 | } |
486 | 486 | |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | |
504 | 504 | // Use the original function, if exists. |
505 | 505 | // Requires WP 4.4+ |
506 | - if( function_exists( 'map_deep') ) { |
|
506 | + if ( function_exists( 'map_deep' ) ) { |
|
507 | 507 | return map_deep( $value, $callback ); |
508 | 508 | } |
509 | 509 | |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | |
569 | 569 | $exploded = explode( '.', "{$field_id}" ); |
570 | 570 | |
571 | - return isset( $exploded[1] ) ? intval( $exploded[1] ) : false; |
|
571 | + return isset( $exploded[ 1 ] ) ? intval( $exploded[ 1 ] ) : false; |
|
572 | 572 | } |
573 | 573 | |
574 | 574 | /** |
@@ -609,13 +609,13 @@ discard block |
||
609 | 609 | */ |
610 | 610 | $args = apply_filters( 'gravityview_get_terms_choices_args', $args ); |
611 | 611 | |
612 | - $terms = get_terms( $args['taxonomy'], $args ); |
|
612 | + $terms = get_terms( $args[ 'taxonomy' ], $args ); |
|
613 | 613 | |
614 | 614 | $choices = array(); |
615 | 615 | |
616 | 616 | if ( is_array( $terms ) ) { |
617 | 617 | foreach ( $terms as $term_id => $term_name ) { |
618 | - $choices[] = array( |
|
618 | + $choices[ ] = array( |
|
619 | 619 | 'text' => $term_name, |
620 | 620 | 'value' => $term_id |
621 | 621 | ); |
@@ -639,21 +639,21 @@ discard block |
||
639 | 639 | function _gravityview_process_posted_fields() { |
640 | 640 | $fields = array(); |
641 | 641 | |
642 | - if( !empty( $_POST['gv_fields'] ) ) { |
|
643 | - if ( ! is_array( $_POST['gv_fields'] ) ) { |
|
642 | + if ( ! empty( $_POST[ 'gv_fields' ] ) ) { |
|
643 | + if ( ! is_array( $_POST[ 'gv_fields' ] ) ) { |
|
644 | 644 | |
645 | 645 | // We are not using parse_str() due to max_input_vars limitation with large View configurations |
646 | 646 | $fields_holder = array(); |
647 | - GVCommon::gv_parse_str( $_POST['gv_fields'], $fields_holder ); |
|
647 | + GVCommon::gv_parse_str( $_POST[ 'gv_fields' ], $fields_holder ); |
|
648 | 648 | |
649 | - if ( isset( $fields_holder['fields'] ) ) { |
|
650 | - $fields = $fields_holder['fields']; |
|
649 | + if ( isset( $fields_holder[ 'fields' ] ) ) { |
|
650 | + $fields = $fields_holder[ 'fields' ]; |
|
651 | 651 | } else { |
652 | 652 | gravityview()->log->error( 'No `fields` key was found after parsing $fields string', array( 'data' => $fields_holder ) ); |
653 | 653 | } |
654 | 654 | |
655 | 655 | } else { |
656 | - $fields = $_POST['gv_fields']; |
|
656 | + $fields = $_POST[ 'gv_fields' ]; |
|
657 | 657 | } |
658 | 658 | } |
659 | 659 |
@@ -134,28 +134,28 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public function add_network_menu() { |
136 | 136 | |
137 | - if ( ! gravityview()->plugin->is_network_activated() ) { |
|
137 | + if ( ! gravityview()->plugin->is_network_activated() ) { |
|
138 | 138 | return; |
139 | 139 | } |
140 | 140 | |
141 | - add_menu_page( __( 'Settings', 'gravityview' ), __( 'GravityView', 'gravityview' ), $this->_capabilities_app_settings, "{$this->_slug}_settings", array( $this, 'app_tab_page' ), 'none' ); |
|
141 | + add_menu_page( __( 'Settings', 'gravityview' ), __( 'GravityView', 'gravityview' ), $this->_capabilities_app_settings, "{$this->_slug}_settings", array( $this, 'app_tab_page' ), 'none' ); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
145 | - * Uninstall all traces of GravityView |
|
146 | - * |
|
147 | - * Note: method is public because parent method is public |
|
148 | - * |
|
145 | + * Uninstall all traces of GravityView |
|
146 | + * |
|
147 | + * Note: method is public because parent method is public |
|
148 | + * |
|
149 | 149 | * @return bool |
150 | 150 | */ |
151 | 151 | public function uninstall() { |
152 | 152 | gravityview()->plugin->uninstall(); |
153 | 153 | |
154 | 154 | /** |
155 | - * Set the path so that Gravity Forms can de-activate GravityView |
|
156 | - * @see GFAddOn::uninstall_addon |
|
157 | - * @uses deactivate_plugins() |
|
158 | - */ |
|
155 | + * Set the path so that Gravity Forms can de-activate GravityView |
|
156 | + * @see GFAddOn::uninstall_addon |
|
157 | + * @uses deactivate_plugins() |
|
158 | + */ |
|
159 | 159 | $this->_path = GRAVITYVIEW_FILE; |
160 | 160 | |
161 | 161 | return true; |
@@ -185,42 +185,42 @@ discard block |
||
185 | 185 | } |
186 | 186 | |
187 | 187 | /** |
188 | - * Get an array of reasons why the plugin might be uninstalled |
|
189 | - * |
|
190 | - * @since 1.17.5 |
|
191 | - * |
|
188 | + * Get an array of reasons why the plugin might be uninstalled |
|
189 | + * |
|
190 | + * @since 1.17.5 |
|
191 | + * |
|
192 | 192 | * @return array Array of reasons with the label and followup questions for each uninstall reason |
193 | 193 | */ |
194 | 194 | private function get_uninstall_reasons() { |
195 | 195 | $reasons = array( |
196 | 196 | 'will-continue' => array( |
197 | - 'label' => esc_html__( 'I am going to continue using GravityView', 'gravityview' ), |
|
198 | - ), |
|
197 | + 'label' => esc_html__( 'I am going to continue using GravityView', 'gravityview' ), |
|
198 | + ), |
|
199 | 199 | 'no-longer-need' => array( |
200 | - 'label' => esc_html__( 'I no longer need GravityView', 'gravityview' ), |
|
201 | - ), |
|
200 | + 'label' => esc_html__( 'I no longer need GravityView', 'gravityview' ), |
|
201 | + ), |
|
202 | 202 | 'doesnt-work' => array( |
203 | - 'label' => esc_html__( 'The plugin doesn\'t work', 'gravityview' ), |
|
204 | - ), |
|
203 | + 'label' => esc_html__( 'The plugin doesn\'t work', 'gravityview' ), |
|
204 | + ), |
|
205 | 205 | 'found-other' => array( |
206 | - 'label' => esc_html__( 'I found a better plugin', 'gravityview' ), |
|
207 | - 'followup' => esc_attr__( 'What plugin you are using, and why?', 'gravityview' ), |
|
208 | - ), |
|
206 | + 'label' => esc_html__( 'I found a better plugin', 'gravityview' ), |
|
207 | + 'followup' => esc_attr__( 'What plugin you are using, and why?', 'gravityview' ), |
|
208 | + ), |
|
209 | 209 | 'other' => array( |
210 | - 'label' => esc_html__( 'Other', 'gravityview' ), |
|
211 | - ), |
|
210 | + 'label' => esc_html__( 'Other', 'gravityview' ), |
|
211 | + ), |
|
212 | 212 | ); |
213 | 213 | |
214 | 214 | shuffle( $reasons ); |
215 | 215 | |
216 | 216 | return $reasons; |
217 | - } |
|
217 | + } |
|
218 | 218 | |
219 | 219 | /** |
220 | - * Display a feedback form when the plugin is uninstalled |
|
221 | - * |
|
222 | - * @since 1.17.5 |
|
223 | - * |
|
220 | + * Display a feedback form when the plugin is uninstalled |
|
221 | + * |
|
222 | + * @since 1.17.5 |
|
223 | + * |
|
224 | 224 | * @return string HTML of the uninstallation form |
225 | 225 | */ |
226 | 226 | public function uninstall_form() { |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | <h2><?php esc_html_e( 'Why did you uninstall GravityView?', 'gravityview' ); ?></h2> |
301 | 301 | <ul> |
302 | 302 | <?php |
303 | - $reasons = $this->get_uninstall_reasons(); |
|
303 | + $reasons = $this->get_uninstall_reasons(); |
|
304 | 304 | foreach ( $reasons as $reason ) { |
305 | 305 | printf( '<li><label><input name="reason" type="radio" value="other" data-followup="%s"> %s</label></li>', Utils::get( $reason, 'followup' ), Utils::get( $reason, 'label' ) ); |
306 | 306 | } |
@@ -394,12 +394,12 @@ discard block |
||
394 | 394 | } |
395 | 395 | |
396 | 396 | public function app_settings_tab() { |
397 | - parent::app_settings_tab(); |
|
397 | + parent::app_settings_tab(); |
|
398 | 398 | |
399 | 399 | if ( $this->maybe_uninstall() ) { |
400 | - echo $this->uninstall_form(); |
|
400 | + echo $this->uninstall_form(); |
|
401 | 401 | } |
402 | - } |
|
402 | + } |
|
403 | 403 | |
404 | 404 | /** |
405 | 405 | * The Settings title |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | * @return array The settings. |
485 | 485 | */ |
486 | 486 | public function all() { |
487 | - return wp_parse_args( get_option( 'gravityformsaddon_' . $this->_slug . '_app_settings', array() ), $this->defaults() ); |
|
487 | + return wp_parse_args( get_option( 'gravityformsaddon_' . $this->_slug . '_app_settings', array() ), $this->defaults() ); |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | /** |
@@ -553,8 +553,8 @@ discard block |
||
553 | 553 | type="' . $field['type'] . '" |
554 | 554 | name="' . esc_attr( $name ) . '" |
555 | 555 | value="' . $value . '" ' . |
556 | - implode( ' ', $attributes ) . |
|
557 | - ' />'; |
|
556 | + implode( ' ', $attributes ) . |
|
557 | + ' />'; |
|
558 | 558 | |
559 | 559 | if ( $echo ) { |
560 | 560 | echo $html; |
@@ -572,12 +572,12 @@ discard block |
||
572 | 572 | } |
573 | 573 | |
574 | 574 | /** |
575 | - * Check whether GravityView is being saved |
|
576 | - * |
|
577 | - * The generic is_save_postback() is true for all addons |
|
578 | - * |
|
579 | - * @since 2.0.8 |
|
580 | - * |
|
575 | + * Check whether GravityView is being saved |
|
576 | + * |
|
577 | + * The generic is_save_postback() is true for all addons |
|
578 | + * |
|
579 | + * @since 2.0.8 |
|
580 | + * |
|
581 | 581 | * @return bool |
582 | 582 | */ |
583 | 583 | public function is_save_postback() { |
@@ -591,16 +591,16 @@ discard block |
||
591 | 591 | */ |
592 | 592 | public function license_key_notice() { |
593 | 593 | |
594 | - if( $this->is_save_postback() ) { |
|
595 | - $settings = $this->get_posted_settings(); |
|
596 | - $license_key = \GV\Utils::get( $settings, 'license_key' ); |
|
597 | - $license_status = \GV\Utils::get( $settings, 'license_key_status', 'inactive' ); |
|
598 | - } else { |
|
599 | - $license_status = $this->get( 'license_key_status', 'inactive' ); |
|
600 | - $license_key = $this->get( 'license_key' ); |
|
601 | - } |
|
594 | + if( $this->is_save_postback() ) { |
|
595 | + $settings = $this->get_posted_settings(); |
|
596 | + $license_key = \GV\Utils::get( $settings, 'license_key' ); |
|
597 | + $license_status = \GV\Utils::get( $settings, 'license_key_status', 'inactive' ); |
|
598 | + } else { |
|
599 | + $license_status = $this->get( 'license_key_status', 'inactive' ); |
|
600 | + $license_key = $this->get( 'license_key' ); |
|
601 | + } |
|
602 | 602 | |
603 | - $license_id = empty( $license_key ) ? 'license' : $license_key; |
|
603 | + $license_id = empty( $license_key ) ? 'license' : $license_key; |
|
604 | 604 | |
605 | 605 | $message = esc_html__( 'Your GravityView license %s. This means you’re missing out on updates and support! %sActivate your license%s or %sget a license here%s.', 'gravityview' ); |
606 | 606 | |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | $update_below = false; |
618 | 618 | $primary_button_link = admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ); |
619 | 619 | |
620 | - switch ( $license_status ) { |
|
620 | + switch ( $license_status ) { |
|
621 | 621 | /** @since 1.17 */ |
622 | 622 | case 'expired': |
623 | 623 | $title = __( 'Expired License', 'gravityview' ); |
@@ -655,13 +655,13 @@ discard block |
||
655 | 655 | return; |
656 | 656 | } |
657 | 657 | |
658 | - \GravityView_Admin_Notices::add_notice( array( |
|
659 | - 'message' => $message, |
|
660 | - 'class' => 'notice notice-warning', |
|
661 | - 'title' => $title, |
|
662 | - 'cap' => 'gravityview_edit_settings', |
|
663 | - 'dismiss' => sha1( $license_status . '_' . $license_id . '_' . date( 'z' ) ), // Show every day, instead of every 8 weeks (which is the default) |
|
664 | - ) ); |
|
658 | + \GravityView_Admin_Notices::add_notice( array( |
|
659 | + 'message' => $message, |
|
660 | + 'class' => 'notice notice-warning', |
|
661 | + 'title' => $title, |
|
662 | + 'cap' => 'gravityview_edit_settings', |
|
663 | + 'dismiss' => sha1( $license_status . '_' . $license_id . '_' . date( 'z' ) ), // Show every day, instead of every 8 weeks (which is the default) |
|
664 | + ) ); |
|
665 | 665 | } |
666 | 666 | |
667 | 667 | /** |
@@ -675,12 +675,12 @@ discard block |
||
675 | 675 | } |
676 | 676 | |
677 | 677 | /** |
678 | - * Add tooltip script to app settings page. Not enqueued by Gravity Forms for some reason. |
|
679 | - * |
|
680 | - * @since 1.21.5 |
|
681 | - * |
|
682 | - * @see GFAddOn::scripts() |
|
683 | - * |
|
678 | + * Add tooltip script to app settings page. Not enqueued by Gravity Forms for some reason. |
|
679 | + * |
|
680 | + * @since 1.21.5 |
|
681 | + * |
|
682 | + * @see GFAddOn::scripts() |
|
683 | + * |
|
684 | 684 | * @return array Array of scripts |
685 | 685 | */ |
686 | 686 | public function scripts() { |
@@ -689,10 +689,10 @@ discard block |
||
689 | 689 | $scripts[] = array( |
690 | 690 | 'handle' => 'gform_tooltip_init', |
691 | 691 | 'enqueue' => array( |
692 | - array( |
|
693 | - 'admin_page' => array( 'app_settings' ) |
|
694 | - ) |
|
695 | - ) |
|
692 | + array( |
|
693 | + 'admin_page' => array( 'app_settings' ) |
|
694 | + ) |
|
695 | + ) |
|
696 | 696 | ); |
697 | 697 | |
698 | 698 | return $scripts; |
@@ -710,10 +710,10 @@ discard block |
||
710 | 710 | 'src' => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ), |
711 | 711 | 'version' => Plugin::$version, |
712 | 712 | 'deps' => array( |
713 | - 'gform_admin', |
|
713 | + 'gform_admin', |
|
714 | 714 | 'gaddon_form_settings_css', |
715 | - 'gform_tooltip', |
|
716 | - 'gform_font_awesome', |
|
715 | + 'gform_tooltip', |
|
716 | + 'gform_font_awesome', |
|
717 | 717 | ), |
718 | 718 | 'enqueue' => array( |
719 | 719 | array( 'admin_page' => array( |
@@ -881,7 +881,7 @@ discard block |
||
881 | 881 | array( |
882 | 882 | 'label' => _x( 'Show me beta versions if they are available.', 'gravityview' ), |
883 | 883 | 'value' => '1', |
884 | - 'name' => 'beta', |
|
884 | + 'name' => 'beta', |
|
885 | 885 | ), |
886 | 886 | ), |
887 | 887 | 'description' => __( 'You will have early access to the latest GravityView features and improvements. There may be bugs! If you encounter an issue, help make GravityView better by reporting it!', 'gravityview' ), |
@@ -919,38 +919,38 @@ discard block |
||
919 | 919 | |
920 | 920 | if ( empty( $field['disabled'] ) ) { |
921 | 921 | unset( $field['disabled'] ); |
922 | - } |
|
922 | + } |
|
923 | 923 | } |
924 | 924 | |
925 | - $sections = array( |
|
926 | - array( |
|
927 | - 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), Plugin::$version ) ), |
|
928 | - 'fields' => $fields, |
|
929 | - ) |
|
930 | - ); |
|
925 | + $sections = array( |
|
926 | + array( |
|
927 | + 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), Plugin::$version ) ), |
|
928 | + 'fields' => $fields, |
|
929 | + ) |
|
930 | + ); |
|
931 | 931 | |
932 | - // custom 'update settings' button |
|
933 | - $button = array( |
|
934 | - 'class' => 'button button-primary button-hero', |
|
935 | - 'type' => 'save', |
|
936 | - ); |
|
932 | + // custom 'update settings' button |
|
933 | + $button = array( |
|
934 | + 'class' => 'button button-primary button-hero', |
|
935 | + 'type' => 'save', |
|
936 | + ); |
|
937 | 937 | |
938 | 938 | if ( $disabled_attribute ) { |
939 | 939 | $button['disabled'] = $disabled_attribute; |
940 | 940 | } |
941 | 941 | |
942 | - /** |
|
943 | - * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page |
|
944 | - * Extensions can tap in here to insert their own section and settings. |
|
945 | - * <code> |
|
946 | - * $sections[] = array( |
|
947 | - * 'title' => __( 'GravityView My Extension Settings', 'gravityview' ), |
|
948 | - * 'fields' => $settings, |
|
949 | - * ); |
|
950 | - * </code> |
|
951 | - * @param array $extension_settings Empty array, ready for extension settings! |
|
952 | - */ |
|
953 | - $extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() ); |
|
942 | + /** |
|
943 | + * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page |
|
944 | + * Extensions can tap in here to insert their own section and settings. |
|
945 | + * <code> |
|
946 | + * $sections[] = array( |
|
947 | + * 'title' => __( 'GravityView My Extension Settings', 'gravityview' ), |
|
948 | + * 'fields' => $settings, |
|
949 | + * ); |
|
950 | + * </code> |
|
951 | + * @param array $extension_settings Empty array, ready for extension settings! |
|
952 | + */ |
|
953 | + $extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() ); |
|
954 | 954 | |
955 | 955 | // If there are extensions, add a section for them |
956 | 956 | if ( ! empty( $extension_sections ) ) { |
@@ -963,13 +963,13 @@ discard block |
||
963 | 963 | } |
964 | 964 | } |
965 | 965 | |
966 | - $k = count( $extension_sections ) - 1 ; |
|
967 | - $extension_sections[ $k ]['fields'][] = $button; |
|
966 | + $k = count( $extension_sections ) - 1 ; |
|
967 | + $extension_sections[ $k ]['fields'][] = $button; |
|
968 | 968 | $sections = array_merge( $sections, $extension_sections ); |
969 | 969 | } else { |
970 | - // add the 'update settings' button to the general section |
|
971 | - $sections[0]['fields'][] = $button; |
|
972 | - } |
|
970 | + // add the 'update settings' button to the general section |
|
971 | + $sections[0]['fields'][] = $button; |
|
972 | + } |
|
973 | 973 | |
974 | 974 | return $sections; |
975 | 975 | } |
@@ -1023,9 +1023,9 @@ discard block |
||
1023 | 1023 | */ |
1024 | 1024 | protected function settings_edd_license( $field, $echo = true ) { |
1025 | 1025 | |
1026 | - if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) { |
|
1027 | - $field['input_type'] = 'password'; |
|
1028 | - } |
|
1026 | + if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) { |
|
1027 | + $field['input_type'] = 'password'; |
|
1028 | + } |
|
1029 | 1029 | |
1030 | 1030 | $text = $this->settings_text( $field, false ); |
1031 | 1031 | |
@@ -1042,9 +1042,9 @@ discard block |
||
1042 | 1042 | |
1043 | 1043 | /** |
1044 | 1044 | * Allow pure HTML settings row |
1045 | - * |
|
1046 | - * @since 2.0.6 |
|
1047 | - * |
|
1045 | + * |
|
1046 | + * @since 2.0.6 |
|
1047 | + * |
|
1048 | 1048 | * @param array $field |
1049 | 1049 | * @param bool $echo Whether to echo the |
1050 | 1050 | * |
@@ -1110,19 +1110,19 @@ discard block |
||
1110 | 1110 | } |
1111 | 1111 | |
1112 | 1112 | /** |
1113 | - * Keep GravityView styling for `$field['description']`, even though Gravity Forms added support for it |
|
1114 | - * |
|
1115 | - * Converts `$field['description']` to `$field['gv_description']` |
|
1116 | - * Converts `$field['subtitle']` to `$field['description']` |
|
1117 | - * |
|
1118 | - * @see \GV\Addon_Settings::single_setting_label Converts `gv_description` back to `description` |
|
1119 | - * @see http://share.gravityview.co/P28uGp/2OIRKxog for image that shows subtitle vs description |
|
1120 | - * |
|
1121 | - * @since 1.21.5.2 |
|
1122 | - * |
|
1113 | + * Keep GravityView styling for `$field['description']`, even though Gravity Forms added support for it |
|
1114 | + * |
|
1115 | + * Converts `$field['description']` to `$field['gv_description']` |
|
1116 | + * Converts `$field['subtitle']` to `$field['description']` |
|
1117 | + * |
|
1118 | + * @see \GV\Addon_Settings::single_setting_label Converts `gv_description` back to `description` |
|
1119 | + * @see http://share.gravityview.co/P28uGp/2OIRKxog for image that shows subtitle vs description |
|
1120 | + * |
|
1121 | + * @since 1.21.5.2 |
|
1122 | + * |
|
1123 | 1123 | * @param array $field |
1124 | - * |
|
1125 | - * @return void |
|
1124 | + * |
|
1125 | + * @return void |
|
1126 | 1126 | */ |
1127 | 1127 | public function single_setting_row( $field ) { |
1128 | 1128 | $field['gv_description'] = Utils::get( $field, 'description' ); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * @return array |
103 | 103 | */ |
104 | 104 | public function modify_app_settings_menu_title( $setting_tabs ) { |
105 | - $setting_tabs[0]['label'] = __( 'GravityView Settings', 'gravityview' ); |
|
105 | + $setting_tabs[ 0 ][ 'label' ] = __( 'GravityView Settings', 'gravityview' ); |
|
106 | 106 | return $setting_tabs; |
107 | 107 | } |
108 | 108 | |
@@ -308,15 +308,15 @@ discard block |
||
308 | 308 | </ul> |
309 | 309 | <div class="gv-followup widefat"> |
310 | 310 | <p><strong><label for="gv-reason-details"><?php esc_html_e( 'Comments', 'gravityview' ); ?></label></strong></p> |
311 | - <textarea id="gv-reason-details" name="reason_details" data-default="<?php esc_attr_e('Please share your thoughts about GravityView', 'gravityview') ?>" placeholder="<?php esc_attr_e('Please share your thoughts about GravityView', 'gravityview'); ?>" class="large-text"></textarea> |
|
311 | + <textarea id="gv-reason-details" name="reason_details" data-default="<?php esc_attr_e( 'Please share your thoughts about GravityView', 'gravityview' ) ?>" placeholder="<?php esc_attr_e( 'Please share your thoughts about GravityView', 'gravityview' ); ?>" class="large-text"></textarea> |
|
312 | 312 | </div> |
313 | 313 | <div class="scale-description"> |
314 | 314 | <p><strong><?php esc_html_e( 'How likely are you to recommend GravityView?', 'gravityview' ); ?></strong></p> |
315 | 315 | <ul class="inline"> |
316 | 316 | <?php |
317 | 317 | $i = 0; |
318 | - while( $i < 11 ) { |
|
319 | - echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_'.$i.'" value="'.$i.'" type="radio"> '.$i.'</label></li>'; |
|
318 | + while ( $i < 11 ) { |
|
319 | + echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_' . $i . '" value="' . $i . '" type="radio"> ' . $i . '</label></li>'; |
|
320 | 320 | $i++; |
321 | 321 | } |
322 | 322 | ?> |
@@ -533,15 +533,15 @@ discard block |
||
533 | 533 | * @return string The HTML |
534 | 534 | */ |
535 | 535 | public function as_html( $field, $echo = true ) { |
536 | - $field['type'] = ( isset( $field['type'] ) && in_array( $field['type'], array( 'submit','reset','button' ) ) ) ? $field['type'] : 'submit'; |
|
536 | + $field[ 'type' ] = ( isset( $field[ 'type' ] ) && in_array( $field[ 'type' ], array( 'submit', 'reset', 'button' ) ) ) ? $field[ 'type' ] : 'submit'; |
|
537 | 537 | |
538 | 538 | $attributes = $this->get_field_attributes( $field ); |
539 | 539 | $default_value = Utils::get( $field, 'value', Utils::get( $field, 'default_value' ) ); |
540 | - $value = $this->get( $field['name'], $default_value ); |
|
540 | + $value = $this->get( $field[ 'name' ], $default_value ); |
|
541 | 541 | |
542 | 542 | |
543 | - $attributes['class'] = isset( $attributes['class'] ) ? esc_attr( $attributes['class'] ) : 'button-primary gfbutton'; |
|
544 | - $name = ( $field['name'] === 'gform-settings-save' ) ? $field['name'] : '_gaddon_setting_' . $field['name']; |
|
543 | + $attributes[ 'class' ] = isset( $attributes[ 'class' ] ) ? esc_attr( $attributes[ 'class' ] ) : 'button-primary gfbutton'; |
|
544 | + $name = ( $field[ 'name' ] === 'gform-settings-save' ) ? $field[ 'name' ] : '_gaddon_setting_' . $field[ 'name' ]; |
|
545 | 545 | |
546 | 546 | if ( empty( $value ) ) { |
547 | 547 | $value = __( 'Update Settings', 'gravityview' ); |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | $attributes = $this->get_field_attributes( $field ); |
551 | 551 | |
552 | 552 | $html = '<input |
553 | - type="' . $field['type'] . '" |
|
553 | + type="' . $field[ 'type' ] . '" |
|
554 | 554 | name="' . esc_attr( $name ) . '" |
555 | 555 | value="' . $value . '" ' . |
556 | 556 | implode( ' ', $attributes ) . |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | * @return bool |
582 | 582 | */ |
583 | 583 | public function is_save_postback() { |
584 | - return isset( $_POST['gform-settings-save'] ) && isset( $_POST['_gravityview_save_settings_nonce'] ); |
|
584 | + return isset( $_POST[ 'gform-settings-save' ] ) && isset( $_POST[ '_gravityview_save_settings_nonce' ] ); |
|
585 | 585 | } |
586 | 586 | |
587 | 587 | /** |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | */ |
592 | 592 | public function license_key_notice() { |
593 | 593 | |
594 | - if( $this->is_save_postback() ) { |
|
594 | + if ( $this->is_save_postback() ) { |
|
595 | 595 | $settings = $this->get_posted_settings(); |
596 | 596 | $license_key = \GV\Utils::get( $settings, 'license_key' ); |
597 | 597 | $license_status = \GV\Utils::get( $settings, 'license_key_status', 'inactive' ); |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | * but didn't want to mess up the translation strings for the translators. |
613 | 613 | */ |
614 | 614 | $message = mb_substr( $message, 0, mb_strlen( $message ) - 1 ); |
615 | - $title = __( 'Inactive License', 'gravityview'); |
|
615 | + $title = __( 'Inactive License', 'gravityview' ); |
|
616 | 616 | $status = ''; |
617 | 617 | $update_below = false; |
618 | 618 | $primary_button_link = admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ); |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | $update_below = __( 'Activate your license key below.', 'gravityview' ); |
643 | 643 | break; |
644 | 644 | } |
645 | - $url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content='.$license_status.'&utm_campaign=Admin%20Notice'; |
|
645 | + $url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content=' . $license_status . '&utm_campaign=Admin%20Notice'; |
|
646 | 646 | |
647 | 647 | // Show a different notice on settings page for inactive licenses (hide the buttons) |
648 | 648 | if ( $update_below && gravityview_is_admin_page( '', 'settings' ) ) { |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | public function scripts() { |
687 | 687 | $scripts = parent::scripts(); |
688 | 688 | |
689 | - $scripts[] = array( |
|
689 | + $scripts[ ] = array( |
|
690 | 690 | 'handle' => 'gform_tooltip_init', |
691 | 691 | 'enqueue' => array( |
692 | 692 | array( |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | public function styles() { |
706 | 706 | $styles = parent::styles(); |
707 | 707 | |
708 | - $styles[] = array( |
|
708 | + $styles[ ] = array( |
|
709 | 709 | 'handle' => 'gravityview_settings', |
710 | 710 | 'src' => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ), |
711 | 711 | 'version' => Plugin::$version, |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | * If multisite and not network admin, we don't want the settings to show. |
737 | 737 | * @since 1.7.6 |
738 | 738 | */ |
739 | - $show_submenu = ( ! is_multisite() ) || is_main_site() || ( ! gravityview()->plugin->is_network_activated() ) || ( is_network_admin() && gravityview()->plugin->is_network_activated() ); |
|
739 | + $show_submenu = ( ! is_multisite() ) || is_main_site() || ( ! gravityview()->plugin->is_network_activated() ) || ( is_network_admin() && gravityview()->plugin->is_network_activated() ); |
|
740 | 740 | |
741 | 741 | /** |
742 | 742 | * Override whether to show the Settings menu on a per-blog basis. |
@@ -784,26 +784,26 @@ discard block |
||
784 | 784 | 'label' => __( 'License Key', 'gravityview' ), |
785 | 785 | 'description' => __( 'Enter the license key that was sent to you on purchase. This enables plugin updates & support.', 'gravityview' ) . $this->get_license_handler()->license_details( $this->get_app_setting( 'license_key_response' ) ), |
786 | 786 | 'type' => 'edd_license', |
787 | - 'disabled' => ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ), |
|
787 | + 'disabled' => ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ), |
|
788 | 788 | 'data-pending-text' => __( 'Verifying license…', 'gravityview' ), |
789 | - 'default_value' => $default_settings['license_key'], |
|
789 | + 'default_value' => $default_settings[ 'license_key' ], |
|
790 | 790 | 'class' => ( '' == $this->get( 'license_key' ) ) ? 'activate code regular-text edd-license-key' : 'deactivate code regular-text edd-license-key', |
791 | 791 | ), |
792 | 792 | array( |
793 | 793 | 'name' => 'license_key_response', |
794 | - 'default_value' => $default_settings['license_key_response'], |
|
794 | + 'default_value' => $default_settings[ 'license_key_response' ], |
|
795 | 795 | 'type' => 'hidden', |
796 | 796 | ), |
797 | 797 | array( |
798 | 798 | 'name' => 'license_key_status', |
799 | - 'default_value' => $default_settings['license_key_status'], |
|
799 | + 'default_value' => $default_settings[ 'license_key_status' ], |
|
800 | 800 | 'type' => 'hidden', |
801 | 801 | ), |
802 | 802 | array( |
803 | 803 | 'name' => 'support-email', |
804 | 804 | 'type' => 'text', |
805 | 805 | 'validate' => 'email', |
806 | - 'default_value' => $default_settings['support-email'], |
|
806 | + 'default_value' => $default_settings[ 'support-email' ], |
|
807 | 807 | 'label' => __( 'Support Email', 'gravityview' ), |
808 | 808 | 'description' => __( 'In order to provide responses to your support requests, please provide your email address.', 'gravityview' ), |
809 | 809 | 'class' => 'code regular-text', |
@@ -815,7 +815,7 @@ discard block |
||
815 | 815 | 'name' => 'support_port', |
816 | 816 | 'type' => 'radio', |
817 | 817 | 'label' => __( 'Show Support Port?', 'gravityview' ), |
818 | - 'default_value' => $default_settings['support_port'], |
|
818 | + 'default_value' => $default_settings[ 'support_port' ], |
|
819 | 819 | 'horizontal' => 1, |
820 | 820 | 'choices' => array( |
821 | 821 | array( |
@@ -834,7 +834,7 @@ discard block |
||
834 | 834 | 'name' => 'no-conflict-mode', |
835 | 835 | 'type' => 'radio', |
836 | 836 | 'label' => __( 'No-Conflict Mode', 'gravityview' ), |
837 | - 'default_value' => $default_settings['no-conflict-mode'], |
|
837 | + 'default_value' => $default_settings[ 'no-conflict-mode' ], |
|
838 | 838 | 'horizontal' => 1, |
839 | 839 | 'choices' => array( |
840 | 840 | array( |
@@ -856,7 +856,7 @@ discard block |
||
856 | 856 | 'name' => 'rest_api', |
857 | 857 | 'type' => 'radio', |
858 | 858 | 'label' => __( 'REST API', 'gravityview' ), |
859 | - 'default_value' => $default_settings['rest_api'], |
|
859 | + 'default_value' => $default_settings[ 'rest_api' ], |
|
860 | 860 | 'horizontal' => 1, |
861 | 861 | 'choices' => array( |
862 | 862 | array( |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | 'name' => 'beta', |
876 | 876 | 'type' => 'checkbox', |
877 | 877 | 'label' => __( 'Become a Beta Tester', 'gravityview' ), |
878 | - 'default_value' => $default_settings['beta'], |
|
878 | + 'default_value' => $default_settings[ 'beta' ], |
|
879 | 879 | 'horizontal' => 1, |
880 | 880 | 'choices' => array( |
881 | 881 | array( |
@@ -908,17 +908,17 @@ discard block |
||
908 | 908 | * @since 1.7.4 |
909 | 909 | */ |
910 | 910 | foreach ( $fields as &$field ) { |
911 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : Utils::get( $field, 'id' ); |
|
912 | - $field['label'] = isset( $field['label'] ) ? $field['label'] : Utils::get( $field, 'title' ); |
|
913 | - $field['default_value'] = isset( $field['default_value'] ) ? $field['default_value'] : Utils::get( $field, 'default' ); |
|
914 | - $field['description'] = isset( $field['description'] ) ? $field['description'] : Utils::get( $field, 'subtitle' ); |
|
911 | + $field[ 'name' ] = isset( $field[ 'name' ] ) ? $field[ 'name' ] : Utils::get( $field, 'id' ); |
|
912 | + $field[ 'label' ] = isset( $field[ 'label' ] ) ? $field[ 'label' ] : Utils::get( $field, 'title' ); |
|
913 | + $field[ 'default_value' ] = isset( $field[ 'default_value' ] ) ? $field[ 'default_value' ] : Utils::get( $field, 'default' ); |
|
914 | + $field[ 'description' ] = isset( $field[ 'description' ] ) ? $field[ 'description' ] : Utils::get( $field, 'subtitle' ); |
|
915 | 915 | |
916 | 916 | if ( $disabled_attribute ) { |
917 | - $field['disabled'] = $disabled_attribute; |
|
917 | + $field[ 'disabled' ] = $disabled_attribute; |
|
918 | 918 | } |
919 | 919 | |
920 | - if ( empty( $field['disabled'] ) ) { |
|
921 | - unset( $field['disabled'] ); |
|
920 | + if ( empty( $field[ 'disabled' ] ) ) { |
|
921 | + unset( $field[ 'disabled' ] ); |
|
922 | 922 | } |
923 | 923 | } |
924 | 924 | |
@@ -936,7 +936,7 @@ discard block |
||
936 | 936 | ); |
937 | 937 | |
938 | 938 | if ( $disabled_attribute ) { |
939 | - $button['disabled'] = $disabled_attribute; |
|
939 | + $button[ 'disabled' ] = $disabled_attribute; |
|
940 | 940 | } |
941 | 941 | |
942 | 942 | /** |
@@ -955,20 +955,20 @@ discard block |
||
955 | 955 | // If there are extensions, add a section for them |
956 | 956 | if ( ! empty( $extension_sections ) ) { |
957 | 957 | |
958 | - if( $disabled_attribute ) { |
|
958 | + if ( $disabled_attribute ) { |
|
959 | 959 | foreach ( $extension_sections as &$section ) { |
960 | - foreach ( $section['fields'] as &$field ) { |
|
961 | - $field['disabled'] = $disabled_attribute; |
|
960 | + foreach ( $section[ 'fields' ] as &$field ) { |
|
961 | + $field[ 'disabled' ] = $disabled_attribute; |
|
962 | 962 | } |
963 | 963 | } |
964 | 964 | } |
965 | 965 | |
966 | - $k = count( $extension_sections ) - 1 ; |
|
967 | - $extension_sections[ $k ]['fields'][] = $button; |
|
966 | + $k = count( $extension_sections ) - 1; |
|
967 | + $extension_sections[ $k ][ 'fields' ][ ] = $button; |
|
968 | 968 | $sections = array_merge( $sections, $extension_sections ); |
969 | 969 | } else { |
970 | 970 | // add the 'update settings' button to the general section |
971 | - $sections[0]['fields'][] = $button; |
|
971 | + $sections[ 0 ][ 'fields' ][ ] = $button; |
|
972 | 972 | } |
973 | 973 | |
974 | 974 | return $sections; |
@@ -1024,7 +1024,7 @@ discard block |
||
1024 | 1024 | protected function settings_edd_license( $field, $echo = true ) { |
1025 | 1025 | |
1026 | 1026 | if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) { |
1027 | - $field['input_type'] = 'password'; |
|
1027 | + $field[ 'input_type' ] = 'password'; |
|
1028 | 1028 | } |
1029 | 1029 | |
1030 | 1030 | $text = $this->settings_text( $field, false ); |
@@ -1073,7 +1073,7 @@ discard block |
||
1073 | 1073 | public function single_setting_row_html( $field ) { |
1074 | 1074 | ?> |
1075 | 1075 | |
1076 | - <tr id="gaddon-setting-row-<?php echo esc_attr( $field['name'] ); ?>"> |
|
1076 | + <tr id="gaddon-setting-row-<?php echo esc_attr( $field[ 'name' ] ); ?>"> |
|
1077 | 1077 | <td colspan="2"> |
1078 | 1078 | <?php $this->single_setting( $field ); ?> |
1079 | 1079 | </td> |
@@ -1091,10 +1091,10 @@ discard block |
||
1091 | 1091 | * @return string |
1092 | 1092 | */ |
1093 | 1093 | public function settings_save( $field, $echo = true ) { |
1094 | - $field['type'] = 'submit'; |
|
1095 | - $field['name'] = 'gform-settings-save'; |
|
1096 | - $field['class'] = isset( $field['class'] ) ? $field['class'] : 'button-primary gfbutton'; |
|
1097 | - $field['value'] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) ); |
|
1094 | + $field[ 'type' ] = 'submit'; |
|
1095 | + $field[ 'name' ] = 'gform-settings-save'; |
|
1096 | + $field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] : 'button-primary gfbutton'; |
|
1097 | + $field[ 'value' ] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) ); |
|
1098 | 1098 | |
1099 | 1099 | $output = $this->settings_submit( $field, false ); |
1100 | 1100 | |
@@ -1125,8 +1125,8 @@ discard block |
||
1125 | 1125 | * @return void |
1126 | 1126 | */ |
1127 | 1127 | public function single_setting_row( $field ) { |
1128 | - $field['gv_description'] = Utils::get( $field, 'description' ); |
|
1129 | - $field['description'] = Utils::get( $field, 'subtitle' ); |
|
1128 | + $field[ 'gv_description' ] = Utils::get( $field, 'description' ); |
|
1129 | + $field[ 'description' ] = Utils::get( $field, 'subtitle' ); |
|
1130 | 1130 | parent::single_setting_row( $field ); |
1131 | 1131 | } |
1132 | 1132 | |
@@ -1138,7 +1138,7 @@ discard block |
||
1138 | 1138 | public function single_setting_label( $field ) { |
1139 | 1139 | parent::single_setting_label( $field ); |
1140 | 1140 | if ( $description = Utils::get( $field, 'gv_description' ) ) { |
1141 | - echo '<span class="description">'. $description .'</span>'; |
|
1141 | + echo '<span class="description">' . $description . '</span>'; |
|
1142 | 1142 | } |
1143 | 1143 | } |
1144 | 1144 | |
@@ -1175,9 +1175,9 @@ discard block |
||
1175 | 1175 | // If the posted key doesn't match the activated/deactivated key (set using the Activate License button, AJAX response), |
1176 | 1176 | // then we assume it's changed. If it's changed, unset the status and the previous response. |
1177 | 1177 | if ( $local_key !== $response_key ) { |
1178 | - unset( $posted_settings['license_key_response'] ); |
|
1179 | - unset( $posted_settings['license_key_status'] ); |
|
1180 | - \GFCommon::add_error_message( __('The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) ); |
|
1178 | + unset( $posted_settings[ 'license_key_response' ] ); |
|
1179 | + unset( $posted_settings[ 'license_key_status' ] ); |
|
1180 | + \GFCommon::add_error_message( __( 'The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) ); |
|
1181 | 1181 | } |
1182 | 1182 | return $posted_settings; |
1183 | 1183 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | return false; |
24 | 24 | } |
25 | 25 | |
26 | - if( ! function_exists( '\get_current_screen' ) ) { |
|
26 | + if ( ! function_exists( '\get_current_screen' ) ) { |
|
27 | 27 | return false; |
28 | 28 | } |
29 | 29 | |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | return true; |
35 | 35 | } |
36 | 36 | |
37 | - $context = $args[1]; |
|
37 | + $context = $args[ 1 ]; |
|
38 | 38 | |
39 | 39 | /** |
40 | 40 | * Assume false by default. |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $is_page = 'single'; |
51 | 51 | } else if ( $is_gv_settings = 'gravityview_page_gravityview_settings' === $current_screen->id ) { |
52 | 52 | $is_page = 'settings'; |
53 | - } else if( $is_extensions = 'gravityview_page_gv-admin-installer' === $current_screen->id ) { |
|
53 | + } else if ( $is_extensions = 'gravityview_page_gv-admin-installer' === $current_screen->id ) { |
|
54 | 54 | $is_page = 'downloads'; |
55 | 55 | } |
56 | 56 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @param[in,out] string|bool $is_page If false, no. If string, the name of the page (`single`, `settings`, or `views`) |
61 | 61 | * @param[in] string $hook The name of the page to check against. Is passed to the method. |
62 | 62 | */ |
63 | - $is_page = apply_filters( 'gravityview_is_admin_page', $is_page, $args[0] ); |
|
63 | + $is_page = apply_filters( 'gravityview_is_admin_page', $is_page, $args[ 0 ] ); |
|
64 | 64 | |
65 | 65 | // If the current page is the same as the compared page |
66 | 66 | if ( ! empty( $context ) ) { |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | ); |
101 | 101 | |
102 | 102 | if ( ! empty( $action ) ) { |
103 | - $settings['edd_action'] = esc_attr( $action ); |
|
103 | + $settings[ 'edd_action' ] = esc_attr( $action ); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | return array_map( 'urlencode', $settings ); |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | 'format' => 'json', |
157 | 157 | ) ); |
158 | 158 | |
159 | - if ( $is_ajax && empty( $data['license'] ) ) { |
|
159 | + if ( $is_ajax && empty( $data[ 'license' ] ) ) { |
|
160 | 160 | die( -1 ); |
161 | 161 | } |
162 | 162 | |
@@ -184,12 +184,12 @@ discard block |
||
184 | 184 | |
185 | 185 | $json = json_encode( $license_data ); |
186 | 186 | |
187 | - $update_license = Utils::get( $data, 'update' ) || 'gravityview_license' === Utils::_POST('action'); |
|
187 | + $update_license = Utils::get( $data, 'update' ) || 'gravityview_license' === Utils::_POST( 'action' ); |
|
188 | 188 | |
189 | 189 | $is_check_action_button = ( 'check_license' === Utils::get( $data, 'edd_action' ) && defined( 'DOING_AJAX' ) && DOING_AJAX ); |
190 | 190 | |
191 | 191 | if ( 'deactivate_license' === Utils::get( $data, 'edd_action' ) ) { |
192 | - do_action('gravityview/admin_installer/delete_downloads_data', true ); |
|
192 | + do_action( 'gravityview/admin_installer/delete_downloads_data', true ); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | if ( $is_check_action_button ) { |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | // most likely a mistake. |
202 | 202 | } else if ( $license_data->license !== 'failed' && $update_license ) { |
203 | 203 | |
204 | - if ( ! empty( $data['field_id'] ) ) { |
|
204 | + if ( ! empty( $data[ 'field_id' ] ) ) { |
|
205 | 205 | set_transient( self::status_transient_key, $license_data, DAY_IN_SECONDS ); |
206 | 206 | } |
207 | 207 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | if ( empty( $license_data ) ) { |
229 | 229 | $message = ''; |
230 | 230 | } else { |
231 | - if( ! empty( $license_data->error ) ) { |
|
231 | + if ( ! empty( $license_data->error ) ) { |
|
232 | 232 | $class = 'error'; |
233 | 233 | $string_key = $license_data->error; |
234 | 234 | } else { $class = $license_data->license; |
@@ -254,17 +254,17 @@ discard block |
||
254 | 254 | */ |
255 | 255 | public function license_details( $response = array() ) { |
256 | 256 | |
257 | - $response = (array) $response; |
|
257 | + $response = (array)$response; |
|
258 | 258 | |
259 | 259 | $return = ''; |
260 | 260 | $wrapper = '<span class="gv-license-details" aria-live="polite" aria-busy="false">%s</span>'; |
261 | 261 | |
262 | - if ( ! empty( $response['license_key'] ) ) { |
|
262 | + if ( ! empty( $response[ 'license_key' ] ) ) { |
|
263 | 263 | $return .= '<h3>' . esc_html__( 'License Details:', 'gravityview' ) . '</h3>'; |
264 | 264 | |
265 | 265 | if ( in_array( Utils::get( $response, 'license' ), array( 'invalid', 'deactivated' ) ) ) { |
266 | - $return .= $this->strings( $response['license'], $response ); |
|
267 | - } elseif ( ! empty( $response['license_name'] ) ) { |
|
266 | + $return .= $this->strings( $response[ 'license' ], $response ); |
|
267 | + } elseif ( ! empty( $response[ 'license_name' ] ) ) { |
|
268 | 268 | $response_keys = array( |
269 | 269 | 'license_name' => '', |
270 | 270 | 'license_limit' => '', |
@@ -278,19 +278,19 @@ discard block |
||
278 | 278 | // Make sure all the keys are set |
279 | 279 | $response = wp_parse_args( $response, $response_keys ); |
280 | 280 | |
281 | - $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' ) ); |
|
282 | - $local_text = ( ! empty( $response['is_local'] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' ); |
|
281 | + $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' ) ); |
|
282 | + $local_text = ( ! empty( $response[ 'is_local' ] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' ); |
|
283 | 283 | $details = array( |
284 | - 'license' => sprintf( esc_html__( 'License level: %s', 'gravityview' ), esc_html( $response['license_name'] ), esc_html( $response['license_limit'] ) ), |
|
285 | - '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, |
|
286 | - 'activations' => sprintf( esc_html__( 'Activations: %d of %s sites', 'gravityview' ), intval( $response['site_count'] ), esc_html( $response['license_limit'] ) ) . $local_text, |
|
287 | - 'expires' => 'lifetime' === $response['expires'] ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response['expires'] ) - DAY_IN_SECONDS ) ), |
|
288 | - 'upgrade' => $this->get_upgrade_html( $response['upgrades'] ), |
|
284 | + 'license' => sprintf( esc_html__( 'License level: %s', 'gravityview' ), esc_html( $response[ 'license_name' ] ), esc_html( $response[ 'license_limit' ] ) ), |
|
285 | + '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, |
|
286 | + 'activations' => sprintf( esc_html__( 'Activations: %d of %s sites', 'gravityview' ), intval( $response[ 'site_count' ] ), esc_html( $response[ 'license_limit' ] ) ) . $local_text, |
|
287 | + 'expires' => 'lifetime' === $response[ 'expires' ] ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response[ 'expires' ] ) - DAY_IN_SECONDS ) ), |
|
288 | + 'upgrade' => $this->get_upgrade_html( $response[ 'upgrades' ] ), |
|
289 | 289 | ); |
290 | 290 | |
291 | - if ( ! empty( $response['error'] ) && 'expired' === $response['error'] ) { |
|
292 | - unset( $details['upgrade'] ); |
|
293 | - $details['expires'] = '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>'; |
|
291 | + if ( ! empty( $response[ 'error' ] ) && 'expired' === $response[ 'error' ] ) { |
|
292 | + unset( $details[ 'upgrade' ] ); |
|
293 | + $details[ 'expires' ] = '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>'; |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | $return .= '<ul><li>' . implode( '</li><li>', array_filter( $details ) ) . '</li></ul>'; |
@@ -316,20 +316,20 @@ discard block |
||
316 | 316 | if ( ! empty( $upgrades ) ) { |
317 | 317 | |
318 | 318 | $locale_parts = explode( '_', get_locale() ); |
319 | - $is_english = ( 'en' === $locale_parts[0] ); |
|
319 | + $is_english = ( 'en' === $locale_parts[ 0 ] ); |
|
320 | 320 | |
321 | 321 | $output .= '<h4>' . esc_html__( 'Upgrades available:', 'gravityview' ) . '</h4>'; |
322 | 322 | $output .= '<ul class="ul-disc">'; |
323 | 323 | |
324 | 324 | foreach ( $upgrades as $upgrade_id => $upgrade ) { |
325 | - $upgrade = (object) $upgrade; |
|
325 | + $upgrade = (object)$upgrade; |
|
326 | 326 | |
327 | 327 | $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 ) ); |
328 | 328 | |
329 | 329 | if ( $is_english && isset( $upgrade->description ) ) { |
330 | 330 | $message = esc_html( $upgrade->description ); |
331 | 331 | } else { |
332 | - switch( $upgrade->price_id ) { |
|
332 | + switch ( $upgrade->price_id ) { |
|
333 | 333 | // Interstellar |
334 | 334 | case 1: |
335 | 335 | default: |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | 'invalid' => esc_html__( 'The license key entered is invalid.', 'gravityview' ), |
389 | 389 | 'missing' => esc_html__( 'Invalid license key.', 'gravityview' ), |
390 | 390 | 'revoked' => esc_html__( 'This license key has been revoked.', 'gravityview' ), |
391 | - '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>' ), |
|
391 | + '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>' ), |
|
392 | 392 | 'capability' => esc_html__( 'You don\'t have the ability to edit plugin settings.', 'gravityview' ), |
393 | 393 | |
394 | 394 | 'verifying_license' => esc_html__( 'Verifying license…', 'gravityview' ), |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | |
418 | 418 | if ( ! empty( $license_data->renewal_url ) ) { |
419 | 419 | $renew_license_url = $license_data->renewal_url; |
420 | - } elseif( ! empty( $license_data->license_key ) ) { |
|
420 | + } elseif ( ! empty( $license_data->license_key ) ) { |
|
421 | 421 | $renew_license_url = sprintf( 'https://gravityview.co/checkout/?download_id=17&edd_license_key=%s', $license_data->license_key ); |
422 | 422 | } else { |
423 | 423 | $renew_license_url = 'https://gravityview.co/account/'; |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | * @return array|\WP_Error |
435 | 435 | */ |
436 | 436 | private function _license_get_remote_response( $data, $license = '' ) { |
437 | - $api_params = $this->_get_edd_settings( $data['edd_action'], $license ); |
|
437 | + $api_params = $this->_get_edd_settings( $data[ 'edd_action' ], $license ); |
|
438 | 438 | |
439 | 439 | $url = add_query_arg( $api_params, self::url ); |
440 | 440 | |
@@ -474,9 +474,9 @@ discard block |
||
474 | 474 | private function license_call_update_settings( $license_data, $data ) { |
475 | 475 | $settings = array(); |
476 | 476 | |
477 | - $settings['license_key'] = $license_data->license_key = trim( $data['license'] ); |
|
478 | - $settings['license_key_status'] = $license_data->license; |
|
479 | - $settings['license_key_response'] = (array)$license_data; |
|
477 | + $settings[ 'license_key' ] = $license_data->license_key = trim( $data[ 'license' ] ); |
|
478 | + $settings[ 'license_key_status' ] = $license_data->license; |
|
479 | + $settings[ 'license_key_response' ] = (array)$license_data; |
|
480 | 480 | |
481 | 481 | $this->settings->set( $settings ); |
482 | 482 | } |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | |
492 | 492 | if ( ! empty( $key ) ) { |
493 | 493 | $response = $this->settings->get( 'license_key_response' ); |
494 | - $response = is_array( $response ) ? (object) $response : json_decode( $response ); |
|
494 | + $response = is_array( $response ) ? (object)$response : json_decode( $response ); |
|
495 | 495 | } else { |
496 | 496 | $response = array(); |
497 | 497 | } |
@@ -533,11 +533,11 @@ discard block |
||
533 | 533 | |
534 | 534 | $submit = '<div class="gv-edd-button-wrapper">'; |
535 | 535 | foreach ( $fields as $field ) { |
536 | - $field['type'] = 'button'; |
|
537 | - $field['class'] = isset( $field['class'] ) ? $field['class'] . ' '. $class : $class; |
|
538 | - $field['style'] = 'margin-left: 10px;'; |
|
539 | - if( $disabled_attribute ) { |
|
540 | - $field['disabled'] = $disabled_attribute; |
|
536 | + $field[ 'type' ] = 'button'; |
|
537 | + $field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] . ' ' . $class : $class; |
|
538 | + $field[ 'style' ] = 'margin-left: 10px;'; |
|
539 | + if ( $disabled_attribute ) { |
|
540 | + $field[ 'disabled' ] = $disabled_attribute; |
|
541 | 541 | } |
542 | 542 | $submit .= $this->settings->as_html( $field, $echo ); |
543 | 543 | } |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | 'url' => home_url(), |
617 | 617 | 'site_data' => $this->get_site_data(), |
618 | 618 | ), |
619 | - )); |
|
619 | + ) ); |
|
620 | 620 | |
621 | 621 | // make sure the response came back okay |
622 | 622 | if ( is_wp_error( $response ) ) { |
@@ -647,45 +647,45 @@ discard block |
||
647 | 647 | $theme_data = wp_get_theme(); |
648 | 648 | $theme = $theme_data->Name . ' ' . $theme_data->Version; |
649 | 649 | |
650 | - $data['gv_version'] = Plugin::$version; |
|
651 | - $data['php_version'] = phpversion(); |
|
652 | - $data['wp_version'] = get_bloginfo( 'version' ); |
|
653 | - $data['gf_version'] = \GFForms::$version; |
|
654 | - $data['server'] = Utils::get( $_SERVER, 'SERVER_SOFTWARE' ); |
|
655 | - $data['multisite'] = is_multisite(); |
|
656 | - $data['theme'] = $theme; |
|
657 | - $data['url'] = home_url(); |
|
658 | - $data['license_key'] = $this->settings->get( 'license_key' ); |
|
659 | - $data['beta'] = $this->settings->get( 'beta' ); |
|
650 | + $data[ 'gv_version' ] = Plugin::$version; |
|
651 | + $data[ 'php_version' ] = phpversion(); |
|
652 | + $data[ 'wp_version' ] = get_bloginfo( 'version' ); |
|
653 | + $data[ 'gf_version' ] = \GFForms::$version; |
|
654 | + $data[ 'server' ] = Utils::get( $_SERVER, 'SERVER_SOFTWARE' ); |
|
655 | + $data[ 'multisite' ] = is_multisite(); |
|
656 | + $data[ 'theme' ] = $theme; |
|
657 | + $data[ 'url' ] = home_url(); |
|
658 | + $data[ 'license_key' ] = $this->settings->get( 'license_key' ); |
|
659 | + $data[ 'beta' ] = $this->settings->get( 'beta' ); |
|
660 | 660 | |
661 | 661 | // View Data |
662 | 662 | $gravityview_posts = wp_count_posts( 'gravityview', 'readable' ); |
663 | 663 | |
664 | - $data['view_count'] = null; |
|
665 | - $data['view_first'] = null; |
|
666 | - $data['view_latest'] = null; |
|
664 | + $data[ 'view_count' ] = null; |
|
665 | + $data[ 'view_first' ] = null; |
|
666 | + $data[ 'view_latest' ] = null; |
|
667 | 667 | |
668 | 668 | if ( $gravityview_posts->publish ) { |
669 | - $data['view_count'] = $gravityview_posts->publish; |
|
669 | + $data[ 'view_count' ] = $gravityview_posts->publish; |
|
670 | 670 | |
671 | 671 | $first = get_posts( 'numberposts=1&post_type=gravityview&post_status=publish&order=ASC' ); |
672 | 672 | $latest = get_posts( 'numberposts=1&post_type=gravityview&post_status=publish&order=DESC' ); |
673 | 673 | |
674 | 674 | if ( $first = array_shift( $first ) ) { |
675 | - $data['view_first'] = $first->post_date; |
|
675 | + $data[ 'view_first' ] = $first->post_date; |
|
676 | 676 | } |
677 | 677 | if ( $latest = array_pop( $latest ) ) { |
678 | - $data['view_latest'] = $latest->post_date; |
|
678 | + $data[ 'view_latest' ] = $latest->post_date; |
|
679 | 679 | } |
680 | 680 | } |
681 | 681 | |
682 | 682 | // Form counts |
683 | 683 | if ( class_exists( 'GFFormsModel' ) ) { |
684 | 684 | $form_data = \GFFormsModel::get_form_count(); |
685 | - $data['forms_total'] = Utils::get( $form_data, 'total', 0 ); |
|
686 | - $data['forms_active'] = Utils::get( $form_data, 'active', 0 ); |
|
687 | - $data['forms_inactive'] = Utils::get( $form_data, 'inactive', 0 ); |
|
688 | - $data['forms_trash'] = Utils::get( $form_data, 'inactive', 0 ); |
|
685 | + $data[ 'forms_total' ] = Utils::get( $form_data, 'total', 0 ); |
|
686 | + $data[ 'forms_active' ] = Utils::get( $form_data, 'active', 0 ); |
|
687 | + $data[ 'forms_inactive' ] = Utils::get( $form_data, 'inactive', 0 ); |
|
688 | + $data[ 'forms_trash' ] = Utils::get( $form_data, 'inactive', 0 ); |
|
689 | 689 | } |
690 | 690 | |
691 | 691 | // Retrieve current plugin information |
@@ -693,13 +693,13 @@ discard block |
||
693 | 693 | include ABSPATH . '/wp-admin/includes/plugin.php'; |
694 | 694 | } |
695 | 695 | |
696 | - $data['integrations'] = self::get_related_plugins_and_extensions(); |
|
697 | - $data['active_plugins'] = get_option( 'active_plugins', array() ); |
|
698 | - $data['inactive_plugins'] = array(); |
|
699 | - $data['locale'] = get_locale(); |
|
696 | + $data[ 'integrations' ] = self::get_related_plugins_and_extensions(); |
|
697 | + $data[ 'active_plugins' ] = get_option( 'active_plugins', array() ); |
|
698 | + $data[ 'inactive_plugins' ] = array(); |
|
699 | + $data[ 'locale' ] = get_locale(); |
|
700 | 700 | |
701 | 701 | // Validate request on the GV server |
702 | - $data['hash'] = 'gv_version.url.locale:' . sha1( $data['gv_version'] . $data['url'] . $data['locale'] ); |
|
702 | + $data[ 'hash' ] = 'gv_version.url.locale:' . sha1( $data[ 'gv_version' ] . $data[ 'url' ] . $data[ 'locale' ] ); |
|
703 | 703 | |
704 | 704 | return $data; |
705 | 705 | } |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | |
730 | 730 | $plugin_data = get_plugin_data( $active_plugin ); |
731 | 731 | |
732 | - $extensions[] = sprintf( '%s %s', $plugin_data['Name'], $plugin_data['Version'] ); |
|
732 | + $extensions[ ] = sprintf( '%s %s', $plugin_data[ 'Name' ], $plugin_data[ 'Version' ] ); |
|
733 | 733 | } |
734 | 734 | |
735 | 735 | if ( ! empty( $extensions ) ) { |