@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | /** @var WP_Admin_Bar $wp_admin_bar */ |
39 | 39 | global $wp_admin_bar; |
40 | 40 | |
41 | - if( is_admin() || ! GVCommon::has_cap( array( 'edit_gravityviews', 'gravityview_edit_entry', 'gravityforms_edit_forms' ) ) ) { |
|
41 | + if ( is_admin() || ! GVCommon::has_cap( array( 'edit_gravityviews', 'gravityview_edit_entry', 'gravityforms_edit_forms' ) ) ) { |
|
42 | 42 | return; |
43 | 43 | } |
44 | 44 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | 'meta' => array( |
104 | 104 | 'title' => sprintf( __( 'Edit Entry %s', 'gravityview' ), $entry->get_slug() ), |
105 | 105 | ), |
106 | - 'href' => esc_url_raw( admin_url( sprintf( 'admin.php?page=gf_entries&screen_mode=edit&view=entry&id=%d&lid=%d', $entry['form_id'], $entry['id'] ) ) ), |
|
106 | + 'href' => esc_url_raw( admin_url( sprintf( 'admin.php?page=gf_entries&screen_mode=edit&view=entry&id=%d&lid=%d', $entry[ 'form_id' ], $entry[ 'id' ] ) ) ), |
|
107 | 107 | ) ); |
108 | 108 | |
109 | 109 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | /** @var WP_Admin_Bar $wp_admin_bar */ |
120 | 120 | global $wp_admin_bar; |
121 | 121 | |
122 | - if( GVCommon::has_cap( array( 'edit_gravityviews', 'edit_gravityview', 'gravityforms_edit_forms' ) ) ) { |
|
122 | + if ( GVCommon::has_cap( array( 'edit_gravityviews', 'edit_gravityview', 'gravityforms_edit_forms' ) ) ) { |
|
123 | 123 | |
124 | 124 | $view_data = GravityView_View_Data::getInstance(); |
125 | 125 | $views = $view_data->get_views(); |
@@ -131,21 +131,21 @@ discard block |
||
131 | 131 | $added_views = array(); |
132 | 132 | |
133 | 133 | foreach ( $views as $view ) { |
134 | - $view = \GV\View::by_id( $view['id'] ); |
|
134 | + $view = \GV\View::by_id( $view[ 'id' ] ); |
|
135 | 135 | $view_id = $view->ID; |
136 | 136 | $form_id = $view->form ? $view->form->ID : null; |
137 | 137 | |
138 | 138 | $edit_view_title = __( 'Edit View', 'gravityview' ); |
139 | 139 | $edit_form_title = __( 'Edit Form', 'gravityview' ); |
140 | 140 | |
141 | - if( sizeof( $views ) > 1 ) { |
|
141 | + if ( sizeof( $views ) > 1 ) { |
|
142 | 142 | $edit_view_title = sprintf( _x( 'Edit View #%d', 'Edit View with the ID of %d', 'gravityview' ), $view_id ); |
143 | 143 | $edit_form_title = sprintf( __( 'Edit Form #%d', 'Edit Form with the ID of %d', 'gravityview' ), $form_id ); |
144 | 144 | } |
145 | 145 | |
146 | - if( GVCommon::has_cap( 'edit_gravityview', $view_id ) && ! in_array( $view_id, $added_views ) ) { |
|
146 | + if ( GVCommon::has_cap( 'edit_gravityview', $view_id ) && ! in_array( $view_id, $added_views ) ) { |
|
147 | 147 | |
148 | - $added_views[] = $view_id; |
|
148 | + $added_views[ ] = $view_id; |
|
149 | 149 | |
150 | 150 | $wp_admin_bar->add_menu( array( |
151 | 151 | 'id' => 'edit-view-' . $view_id, |
@@ -155,9 +155,9 @@ discard block |
||
155 | 155 | ) ); |
156 | 156 | } |
157 | 157 | |
158 | - if ( ! empty( $form_id ) && GVCommon::has_cap( array( 'gravityforms_edit_forms' ), $form_id ) && ! in_array( $form_id, $added_forms ) ) { |
|
158 | + if ( ! empty( $form_id ) && GVCommon::has_cap( array( 'gravityforms_edit_forms' ), $form_id ) && ! in_array( $form_id, $added_forms ) ) { |
|
159 | 159 | |
160 | - $added_forms[] = $form_id; |
|
160 | + $added_forms[ ] = $form_id; |
|
161 | 161 | |
162 | 162 | $wp_admin_bar->add_menu( array( |
163 | 163 | 'id' => 'edit-form-' . $form_id, |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | $args = array(); |
115 | 115 | |
116 | - $view_id = is_null ( $view ) ? null : $view->ID; |
|
116 | + $view_id = is_null( $view ) ? null : $view->ID; |
|
117 | 117 | |
118 | 118 | $permalink = null; |
119 | 119 | |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | |
127 | 127 | $view_collection = View_Collection::from_post( $post ); |
128 | 128 | |
129 | - if( 1 < $view_collection->count() ) { |
|
130 | - $args['gvid'] = $view_id; |
|
129 | + if ( 1 < $view_collection->count() ) { |
|
130 | + $args[ 'gvid' ] = $view_id; |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | } |
@@ -157,21 +157,21 @@ discard block |
||
157 | 157 | */ |
158 | 158 | $link_parts = explode( '?', $permalink ); |
159 | 159 | |
160 | - $query = ! empty( $link_parts[1] ) ? '?' . $link_parts[1] : ''; |
|
160 | + $query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : ''; |
|
161 | 161 | |
162 | - $permalink = trailingslashit( $link_parts[0] ) . $entry_endpoint_name . '/'. $entry_slug .'/' . $query; |
|
162 | + $permalink = trailingslashit( $link_parts[ 0 ] ) . $entry_endpoint_name . '/' . $entry_slug . '/' . $query; |
|
163 | 163 | } else { |
164 | 164 | $args[ $entry_endpoint_name ] = $entry_slug; |
165 | 165 | } |
166 | 166 | |
167 | 167 | if ( $track_directory ) { |
168 | - if ( ! empty( $_GET['pagenum'] ) ) { |
|
169 | - $args['pagenum'] = intval( $_GET['pagenum'] ); |
|
168 | + if ( ! empty( $_GET[ 'pagenum' ] ) ) { |
|
169 | + $args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] ); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | if ( $sort = Utils::_GET( 'sort' ) ) { |
173 | - $args['sort'] = $sort; |
|
174 | - $args['dir'] = Utils::_GET( 'dir' ); |
|
173 | + $args[ 'sort' ] = $sort; |
|
174 | + $args[ 'dir' ] = Utils::_GET( 'dir' ); |
|
175 | 175 | } |
176 | 176 | } |
177 | 177 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | |
210 | 210 | $entry_slug = \GravityView_API::get_entry_slug( $this->ID, $this->as_entry() ); |
211 | 211 | |
212 | - if( ! $apply_filter ) { |
|
212 | + if ( ! $apply_filter ) { |
|
213 | 213 | return $entry_slug; |
214 | 214 | } |
215 | 215 |
@@ -106,14 +106,14 @@ discard block |
||
106 | 106 | * @return \GV\GF_Entry|null An instance of this entry or null if not found. |
107 | 107 | */ |
108 | 108 | public static function from_entry( $entry ) { |
109 | - if ( empty( $entry['id'] ) ) { |
|
109 | + if ( empty( $entry[ 'id' ] ) ) { |
|
110 | 110 | return null; |
111 | 111 | } |
112 | 112 | |
113 | 113 | $self = new self(); |
114 | 114 | $self->entry = $entry; |
115 | 115 | |
116 | - $self->ID = $self->entry['id']; |
|
116 | + $self->ID = $self->entry[ 'id' ]; |
|
117 | 117 | $self->slug = $self->get_slug(); |
118 | 118 | |
119 | 119 | return $self; |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * @return bool Whether the offset exists or not. |
129 | 129 | */ |
130 | 130 | public function offsetExists( $offset ) { |
131 | - return isset( $this->entry[$offset] ); |
|
131 | + return isset( $this->entry[ $offset ] ); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @return mixed The value of the requested entry data. |
144 | 144 | */ |
145 | 145 | public function offsetGet( $offset ) { |
146 | - return $this->entry[$offset]; |
|
146 | + return $this->entry[ $offset ]; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | wp_nonce_field( 'gravityview_select_form', 'gravityview_select_form_nonce' ); |
11 | 11 | |
12 | 12 | //current value |
13 | -$current_form = (int) \GV\Utils::_GET( 'form_id', gravityview_get_form_id( $post->ID ) ); |
|
13 | +$current_form = (int)\GV\Utils::_GET( 'form_id', gravityview_get_form_id( $post->ID ) ); |
|
14 | 14 | |
15 | 15 | // If form is in trash or not existing, show error |
16 | 16 | GravityView_Admin::connected_form_warning( $current_form ); |
17 | 17 | |
18 | 18 | // check for available gravity forms |
19 | -$forms = gravityview_get_forms('any', false, 'title' ); |
|
19 | +$forms = gravityview_get_forms( 'any', false, 'title' ); |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * @param int $current_form Form currently selected in the View (0 if none selected) |
@@ -35,24 +35,24 @@ discard block |
||
35 | 35 | ?> |
36 | 36 | <a class="button button-primary" href="#gv_start_fresh" title="<?php esc_attr_e( 'Use a Form Preset', 'gravityview' ); ?>"><?php esc_html_e( 'Use a Form Preset', 'gravityview' ); ?></a> |
37 | 37 | |
38 | - <?php if( !empty( $forms ) ) { ?> |
|
38 | + <?php if ( ! empty( $forms ) ) { ?> |
|
39 | 39 | <span> <?php esc_html_e( 'or use an existing form', 'gravityview' ); ?> </span> |
40 | 40 | <?php } |
41 | 41 | } |
42 | 42 | |
43 | 43 | // If there are no forms to select, show no forms. |
44 | - if( !empty( $forms ) ) { ?> |
|
44 | + if ( ! empty( $forms ) ) { ?> |
|
45 | 45 | <select name="gravityview_form_id" id="gravityview_form_id"> |
46 | 46 | <option value="" <?php selected( '', $current_form, true ); ?>>— <?php esc_html_e( 'list of forms', 'gravityview' ); ?> —</option> |
47 | - <?php foreach( $forms as $form ) { ?> |
|
48 | - <option value="<?php echo $form['id']; ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option> |
|
47 | + <?php foreach ( $forms as $form ) { ?> |
|
48 | + <option value="<?php echo $form[ 'id' ]; ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option> |
|
49 | 49 | <?php } ?> |
50 | 50 | </select> |
51 | 51 | <?php } else { ?> |
52 | 52 | <select name="gravityview_form_id" id="gravityview_form_id" class="hidden"><option selected="selected" value=""></option></select> |
53 | 53 | <?php } ?> |
54 | 54 | |
55 | - <button class="button button-primary" <?php if( empty( $current_form ) ) { echo 'style="display:none;"'; } ?> id="gv_switch_view_button" title="<?php esc_attr_e( 'Switch View', 'gravityview' ); ?>"><?php esc_html_e( 'Switch View Type', 'gravityview' ); ?></button> |
|
55 | + <button class="button button-primary" <?php if ( empty( $current_form ) ) { echo 'style="display:none;"'; } ?> id="gv_switch_view_button" title="<?php esc_attr_e( 'Switch View', 'gravityview' ); ?>"><?php esc_html_e( 'Switch View Type', 'gravityview' ); ?></button> |
|
56 | 56 | </p> |
57 | 57 | |
58 | 58 | <?php // confirm dialog box ?> |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | self::$file = plugin_dir_path( __FILE__ ); |
38 | 38 | |
39 | - if( is_admin() ) { |
|
39 | + if ( is_admin() ) { |
|
40 | 40 | $this->load_components( 'admin' ); |
41 | 41 | } |
42 | 42 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | static function getInstance() { |
58 | 58 | |
59 | - if( empty( self::$instance ) ) { |
|
59 | + if ( empty( self::$instance ) ) { |
|
60 | 60 | self::$instance = new GravityView_Edit_Entry; |
61 | 61 | } |
62 | 62 | |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | private function add_hooks() { |
83 | 83 | |
84 | 84 | // Add front-end access to Gravity Forms delete file action |
85 | - add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file') ); |
|
85 | + add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file' ) ); |
|
86 | 86 | |
87 | 87 | // Make sure this hook is run for non-admins |
88 | - add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file') ); |
|
88 | + add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file' ) ); |
|
89 | 89 | |
90 | 90 | add_filter( 'gravityview_blacklist_field_types', array( $this, 'modify_field_blacklist' ), 10, 2 ); |
91 | 91 | |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | */ |
103 | 103 | private function addon_specific_hooks() { |
104 | 104 | |
105 | - if( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) { |
|
106 | - add_filter('gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script')); |
|
105 | + if ( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) { |
|
106 | + add_filter( 'gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script' ) ); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | } |
@@ -190,15 +190,15 @@ discard block |
||
190 | 190 | */ |
191 | 191 | public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) { |
192 | 192 | |
193 | - $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id'] ); |
|
193 | + $nonce_key = self::get_nonce_key( $view_id, $entry[ 'form_id' ], $entry[ 'id' ] ); |
|
194 | 194 | |
195 | - $base = gv_entry_link( $entry, $post_id ? : $view_id ); |
|
195 | + $base = gv_entry_link( $entry, $post_id ?: $view_id ); |
|
196 | 196 | |
197 | 197 | $url = add_query_arg( array( |
198 | 198 | 'edit' => wp_create_nonce( $nonce_key ) |
199 | 199 | ), $base ); |
200 | 200 | |
201 | - if( $post_id ) { |
|
201 | + if ( $post_id ) { |
|
202 | 202 | $url = add_query_arg( array( 'gvid' => $view_id ), $url ); |
203 | 203 | } |
204 | 204 | |
@@ -206,9 +206,9 @@ discard block |
||
206 | 206 | * Allow passing params to dynamically populate entry with values |
207 | 207 | * @since 1.9.2 |
208 | 208 | */ |
209 | - if( !empty( $field_values ) ) { |
|
209 | + if ( ! empty( $field_values ) ) { |
|
210 | 210 | |
211 | - if( is_array( $field_values ) ) { |
|
211 | + if ( is_array( $field_values ) ) { |
|
212 | 212 | // If already an array, no parse_str() needed |
213 | 213 | $params = $field_values; |
214 | 214 | } else { |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | * @param array $entry The entry. |
225 | 225 | * @param \GV\View $view The View. |
226 | 226 | */ |
227 | - return apply_filters( 'gravityview/edit/link', $url, $entry, \GV\View::by_id( $view_id ) ); |
|
227 | + return apply_filters( 'gravityview/edit/link', $url, $entry, \GV\View::by_id( $view_id ) ); |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | /** |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | */ |
236 | 236 | public function modify_field_blacklist( $fields = array(), $context = NULL ) { |
237 | 237 | |
238 | - if( empty( $context ) || $context !== 'edit' ) { |
|
238 | + if ( empty( $context ) || $context !== 'edit' ) { |
|
239 | 239 | return $fields; |
240 | 240 | } |
241 | 241 | |
@@ -313,15 +313,15 @@ discard block |
||
313 | 313 | // If they can edit any entries (as defined in Gravity Forms) |
314 | 314 | // Or if they can edit other people's entries |
315 | 315 | // Then we're good. |
316 | - if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) { |
|
316 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry[ 'id' ] ) ) { |
|
317 | 317 | |
318 | 318 | gravityview()->log->debug( 'User has ability to edit all entries.' ); |
319 | 319 | |
320 | 320 | $user_can_edit = true; |
321 | 321 | |
322 | - } else if( !isset( $entry['created_by'] ) ) { |
|
322 | + } else if ( ! isset( $entry[ 'created_by' ] ) ) { |
|
323 | 323 | |
324 | - gravityview()->log->error( 'Entry `created_by` doesn\'t exist.'); |
|
324 | + gravityview()->log->error( 'Entry `created_by` doesn\'t exist.' ); |
|
325 | 325 | |
326 | 326 | $user_can_edit = false; |
327 | 327 | |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | $current_user = wp_get_current_user(); |
331 | 331 | |
332 | 332 | // User edit is disabled |
333 | - if( empty( $user_edit ) ) { |
|
333 | + if ( empty( $user_edit ) ) { |
|
334 | 334 | |
335 | 335 | gravityview()->log->debug( 'User Edit is disabled. Returning false.' ); |
336 | 336 | |
@@ -338,13 +338,13 @@ discard block |
||
338 | 338 | } |
339 | 339 | |
340 | 340 | // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good. |
341 | - else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) { |
|
341 | + else if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) { |
|
342 | 342 | |
343 | 343 | gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id', $current_user->ID ) ); |
344 | 344 | |
345 | 345 | $user_can_edit = true; |
346 | 346 | |
347 | - } else if( ! is_user_logged_in() ) { |
|
347 | + } else if ( ! is_user_logged_in() ) { |
|
348 | 348 | |
349 | 349 | gravityview()->log->debug( 'No user defined; edit entry requires logged in user' ); |
350 | 350 | |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | */ |
363 | 363 | $user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id ); |
364 | 364 | |
365 | - return (bool) $user_can_edit; |
|
365 | + return (bool)$user_can_edit; |
|
366 | 366 | } |
367 | 367 | |
368 | 368 |
@@ -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 | } |
@@ -68,21 +68,21 @@ discard block |
||
68 | 68 | |
69 | 69 | $downloads_data = get_site_transient( self::DOWNLOADS_DATA_TRANSIENT ); |
70 | 70 | |
71 | - if ( ! $downloads_data && ! isset( $_GET['cache'] ) ) { |
|
71 | + if ( ! $downloads_data && ! isset( $_GET[ 'cache' ] ) ) { |
|
72 | 72 | return; |
73 | 73 | } |
74 | 74 | |
75 | - add_filter( 'plugins_api', function ( $data, $action, $args ) use ( $downloads_data ) { |
|
75 | + add_filter( 'plugins_api', function( $data, $action, $args ) use ( $downloads_data ) { |
|
76 | 76 | foreach ( $downloads_data as $extension ) { |
77 | - if ( empty( $extension['info'] ) || empty( $args->slug ) || $args->slug !== $extension['info']['slug'] ) { |
|
77 | + if ( empty( $extension[ 'info' ] ) || empty( $args->slug ) || $args->slug !== $extension[ 'info' ][ 'slug' ] ) { |
|
78 | 78 | continue; |
79 | 79 | } |
80 | 80 | |
81 | - return (object) array( |
|
82 | - 'slug' => $extension['info']['slug'], |
|
83 | - 'name' => $extension['info']['title'], |
|
84 | - 'version' => $extension['licensing']['version'], |
|
85 | - 'download_link' => $extension['files'][0]['file'], |
|
81 | + return (object)array( |
|
82 | + 'slug' => $extension[ 'info' ][ 'slug' ], |
|
83 | + 'name' => $extension[ 'info' ][ 'title' ], |
|
84 | + 'version' => $extension[ 'licensing' ][ 'version' ], |
|
85 | + 'download_link' => $extension[ 'files' ][ 0 ][ 'file' ], |
|
86 | 86 | ); |
87 | 87 | } |
88 | 88 | |
@@ -144,13 +144,13 @@ discard block |
||
144 | 144 | |
145 | 145 | foreach ( $all_plugins as $path => $plugin ) { |
146 | 146 | |
147 | - if ( empty( $plugin['TextDomain'] ) ) { |
|
147 | + if ( empty( $plugin[ 'TextDomain' ] ) ) { |
|
148 | 148 | continue; |
149 | 149 | } |
150 | 150 | |
151 | - $wp_plugins[ $plugin['TextDomain'] ] = array( |
|
151 | + $wp_plugins[ $plugin[ 'TextDomain' ] ] = array( |
|
152 | 152 | 'path' => $path, |
153 | - 'version' => $plugin['Version'], |
|
153 | + 'version' => $plugin[ 'Version' ], |
|
154 | 154 | 'activated' => is_plugin_active( $path ) |
155 | 155 | ); |
156 | 156 | } |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | return $downloads_data; |
209 | 209 | } |
210 | 210 | |
211 | - if( \GV\Plugin::is_network_activated() ) { |
|
211 | + if ( \GV\Plugin::is_network_activated() ) { |
|
212 | 212 | $home_url = network_home_url(); |
213 | 213 | } else { |
214 | 214 | $home_url = home_url(); |
@@ -236,13 +236,13 @@ discard block |
||
236 | 236 | |
237 | 237 | $downloads_data = json_decode( wp_remote_retrieve_body( $response ), true ); |
238 | 238 | |
239 | - if ( empty( $downloads_data['products'] ) ) { |
|
239 | + if ( empty( $downloads_data[ 'products' ] ) ) { |
|
240 | 240 | return array(); |
241 | 241 | } |
242 | 242 | |
243 | - $this->set_downloads_data( $downloads_data['products'] ); |
|
243 | + $this->set_downloads_data( $downloads_data[ 'products' ] ); |
|
244 | 244 | |
245 | - return $downloads_data['products']; |
|
245 | + return $downloads_data[ 'products' ]; |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | /** |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | |
316 | 316 | foreach ( $downloads_data as $extension ) { |
317 | 317 | |
318 | - if ( empty( $extension['info'] ) ) { |
|
318 | + if ( empty( $extension[ 'info' ] ) ) { |
|
319 | 319 | continue; |
320 | 320 | } |
321 | 321 | |
@@ -344,29 +344,29 @@ discard block |
||
344 | 344 | |
345 | 345 | $details = $this->get_download_display_details( $download, $wp_plugins ); |
346 | 346 | |
347 | - $download_info = $details['download_info']; |
|
347 | + $download_info = $details[ 'download_info' ]; |
|
348 | 348 | |
349 | 349 | ?> |
350 | - <div class="item <?php echo esc_attr( $details['item_class'] ); ?>"> |
|
350 | + <div class="item <?php echo esc_attr( $details[ 'item_class' ] ); ?>"> |
|
351 | 351 | <div class="addon-inner"> |
352 | - <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> |
|
353 | - <h3><?php echo esc_html( \GV\Utils::get( $download_info, 'installer_title', $download_info['title'] ) ); ?></h3> |
|
352 | + <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> |
|
353 | + <h3><?php echo esc_html( \GV\Utils::get( $download_info, 'installer_title', $download_info[ 'title' ] ) ); ?></h3> |
|
354 | 354 | <div> |
355 | - <?php if( ! empty( $details['status_label'] ) ) { ?> |
|
356 | - <div class="status <?php echo esc_attr( $details['status'] ); ?>" title="<?php printf( esc_attr__( 'Plugin status: %s', 'gravityview' ), esc_html( $details['status_label'] ) ); ?>"> |
|
357 | - <span class="dashicons dashicons-admin-plugins"></span> <span class="status-label"><?php echo esc_html( $details['status_label'] ); ?></span> |
|
355 | + <?php if ( ! empty( $details[ 'status_label' ] ) ) { ?> |
|
356 | + <div class="status <?php echo esc_attr( $details[ 'status' ] ); ?>" title="<?php printf( esc_attr__( 'Plugin status: %s', 'gravityview' ), esc_html( $details[ 'status_label' ] ) ); ?>"> |
|
357 | + <span class="dashicons dashicons-admin-plugins"></span> <span class="status-label"><?php echo esc_html( $details[ 'status_label' ] ); ?></span> |
|
358 | 358 | </div> |
359 | 359 | <?php } ?> |
360 | 360 | |
361 | - <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'] ); ?>"> |
|
362 | - <span class="title"><?php echo esc_html( $details['button_label'] ); ?></span> |
|
363 | - <?php if( $details['spinner'] ) { ?><span class="spinner"></span><?php } ?> |
|
361 | + <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' ] ); ?>"> |
|
362 | + <span class="title"><?php echo esc_html( $details[ 'button_label' ] ); ?></span> |
|
363 | + <?php if ( $details[ 'spinner' ] ) { ?><span class="spinner"></span><?php } ?> |
|
364 | 364 | </a> |
365 | 365 | </div> |
366 | 366 | |
367 | 367 | <div class="addon-excerpt"><?php |
368 | 368 | |
369 | - $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info['excerpt'] ); |
|
369 | + $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info[ 'excerpt' ] ); |
|
370 | 370 | |
371 | 371 | // Allow some pure HTML tags, but remove everything else from the excerpt. |
372 | 372 | $tags = array( '<strong>', '</strong>', '<em>', '</em>', '<code>', '</code>' ); |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | */ |
407 | 407 | private function get_download_display_details( $download, $wp_plugins ) { |
408 | 408 | |
409 | - $download_info = wp_parse_args( (array) $download['info'], array( |
|
409 | + $download_info = wp_parse_args( (array)$download[ 'info' ], array( |
|
410 | 410 | 'thumbnail' => '', |
411 | 411 | 'title' => '', |
412 | 412 | 'textdomain' => '', |
@@ -418,9 +418,9 @@ discard block |
||
418 | 418 | 'installer_excerpt' => null, // May not be defined |
419 | 419 | ) ); |
420 | 420 | |
421 | - $wp_plugin = \GV\Utils::get( $wp_plugins, $download_info['textdomain'], false ); |
|
421 | + $wp_plugin = \GV\Utils::get( $wp_plugins, $download_info[ 'textdomain' ], false ); |
|
422 | 422 | |
423 | - $has_access = ! empty( $download['files'] ); |
|
423 | + $has_access = ! empty( $download[ 'files' ] ); |
|
424 | 424 | $spinner = true; |
425 | 425 | $href = $plugin_path = '#'; |
426 | 426 | $status = $item_class = $button_title = $button_class = ''; |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | $required_license = $galactic_only ? __( 'All Access', 'gravityview' ) : __( 'Core + Extensions', 'gravityview' ); |
431 | 431 | |
432 | 432 | // The license is not active - no matter what level, this should not work |
433 | - if( ! $is_active && empty( $base_price ) ) { |
|
433 | + if ( ! $is_active && empty( $base_price ) ) { |
|
434 | 434 | $spinner = false; |
435 | 435 | $status_label = ''; |
436 | 436 | $button_class = 'disabled disabled-license'; |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | $status_label = ''; |
444 | 444 | $button_label = sprintf( __( 'Purchase Now for %s', 'gravityview' ), '$' . $base_price ); |
445 | 445 | $button_class = 'button-primary button-large'; |
446 | - $href = $download_info['link']; |
|
446 | + $href = $download_info[ 'link' ]; |
|
447 | 447 | $item_class = 'featured'; |
448 | 448 | } |
449 | 449 | |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | $href = 'https://gravityview.co/pricing/?utm_source=admin-installer&utm_medium=admin&utm_campaign=Admin%20Notice&utm_content=' . $required_license; |
457 | 457 | } |
458 | 458 | |
459 | - elseif ( ! empty( $download_info['coming_soon'] ) ) { |
|
459 | + elseif ( ! empty( $download_info[ 'coming_soon' ] ) ) { |
|
460 | 460 | $spinner = false; |
461 | 461 | $status = 'notinstalled'; |
462 | 462 | $status_label = __( 'Coming Soon', 'gravityview' ); |
@@ -471,8 +471,8 @@ discard block |
||
471 | 471 | $href = add_query_arg( |
472 | 472 | array( |
473 | 473 | 'action' => 'install-plugin', |
474 | - 'plugin' => $download_info['slug'], |
|
475 | - '_wpnonce' => wp_create_nonce( 'install-plugin_' . $download_info['slug'] ), |
|
474 | + 'plugin' => $download_info[ 'slug' ], |
|
475 | + '_wpnonce' => wp_create_nonce( 'install-plugin_' . $download_info[ 'slug' ] ), |
|
476 | 476 | ), |
477 | 477 | self_admin_url( 'update.php' ) |
478 | 478 | ); |
@@ -484,25 +484,25 @@ discard block |
||
484 | 484 | } |
485 | 485 | |
486 | 486 | // Access and the plugin is installed but not active |
487 | - elseif ( false === $wp_plugin['activated'] ) { |
|
487 | + elseif ( false === $wp_plugin[ 'activated' ] ) { |
|
488 | 488 | $status = 'inactive'; |
489 | 489 | $status_label = __( 'Inactive', 'gravityview' ); |
490 | 490 | $button_label = __( 'Activate', 'gravityview' ); |
491 | - $plugin_path = $wp_plugin['path']; |
|
491 | + $plugin_path = $wp_plugin[ 'path' ]; |
|
492 | 492 | |
493 | 493 | } |
494 | 494 | |
495 | 495 | // Access and the plugin is installed and active |
496 | 496 | else { |
497 | 497 | |
498 | - $plugin_path = $wp_plugin['path']; |
|
498 | + $plugin_path = $wp_plugin[ 'path' ]; |
|
499 | 499 | $status = 'active'; |
500 | 500 | $status_label = __( 'Active', 'gravityview' ); |
501 | 501 | $button_label = __( 'Deactivate', 'gravityview' ); |
502 | 502 | |
503 | 503 | } |
504 | 504 | |
505 | - return compact( 'download_info','plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' ); |
|
505 | + return compact( 'download_info', 'plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' ); |
|
506 | 506 | } |
507 | 507 | |
508 | 508 | /** |
@@ -517,11 +517,11 @@ discard block |
||
517 | 517 | $base_price = \GV\Utils::get( $download, 'pricing/amount', 0 ); |
518 | 518 | $base_price = \GFCommon::to_number( $base_price ); |
519 | 519 | |
520 | - unset( $download['pricing']['amount'] ); |
|
520 | + unset( $download[ 'pricing' ][ 'amount' ] ); |
|
521 | 521 | |
522 | 522 | // Price options array, not single price |
523 | - if ( ! $base_price && ! empty( $download['pricing'] ) ) { |
|
524 | - $base_price = array_shift( $download['pricing'] ); |
|
523 | + if ( ! $base_price && ! empty( $download[ 'pricing' ] ) ) { |
|
524 | + $base_price = array_shift( $download[ 'pricing' ] ); |
|
525 | 525 | } |
526 | 526 | |
527 | 527 | return floatval( $base_price ); |
@@ -535,13 +535,13 @@ discard block |
||
535 | 535 | public function activate_download() { |
536 | 536 | $data = \GV\Utils::_POST( 'data', array() ); |
537 | 537 | |
538 | - if ( empty( $data['path'] ) ) { |
|
538 | + if ( empty( $data[ 'path' ] ) ) { |
|
539 | 539 | return; |
540 | 540 | } |
541 | 541 | |
542 | - $result = activate_plugin( $data['path'] ); |
|
542 | + $result = activate_plugin( $data[ 'path' ] ); |
|
543 | 543 | |
544 | - if ( is_wp_error( $result ) || ! is_plugin_active( $data['path'] ) ) { |
|
544 | + if ( is_wp_error( $result ) || ! is_plugin_active( $data[ 'path' ] ) ) { |
|
545 | 545 | wp_send_json_error( array( |
546 | 546 | 'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() ) |
547 | 547 | ) ); |
@@ -558,13 +558,13 @@ discard block |
||
558 | 558 | public function deactivate_download() { |
559 | 559 | $data = \GV\Utils::_POST( 'data', array() ); |
560 | 560 | |
561 | - if ( empty( $data['path'] ) ) { |
|
561 | + if ( empty( $data[ 'path' ] ) ) { |
|
562 | 562 | return; |
563 | 563 | } |
564 | 564 | |
565 | - deactivate_plugins( $data['path'] ); |
|
565 | + deactivate_plugins( $data[ 'path' ] ); |
|
566 | 566 | |
567 | - if( is_plugin_active( $data['path'] ) ) { |
|
567 | + if ( is_plugin_active( $data[ 'path' ] ) ) { |
|
568 | 568 | wp_send_json_error( array( |
569 | 569 | 'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) ) |
570 | 570 | ) ); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | static public function get_email( $field_settings, $entry ) { |
72 | 72 | |
73 | 73 | // There was no logged in user. |
74 | - switch ( $field_settings['email_field'] ) { |
|
74 | + switch ( $field_settings[ 'email_field' ] ) { |
|
75 | 75 | case 'created_by_email': |
76 | 76 | |
77 | 77 | $created_by = \GV\Utils::get( $entry, 'created_by', null ); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | return $field_options; |
103 | 103 | } |
104 | 104 | |
105 | - $field_options['email_field'] = array( |
|
105 | + $field_options[ 'email_field' ] = array( |
|
106 | 106 | 'type' => 'select', |
107 | 107 | 'label' => __( 'Email to Use', 'gravityview' ), |
108 | 108 | 'value' => 'created_by_email', |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | 'choices' => $this->_get_email_field_choices( $form_id ), |
111 | 111 | ); |
112 | 112 | |
113 | - $field_options['default'] = array( |
|
113 | + $field_options[ 'default' ] = array( |
|
114 | 114 | 'type' => 'select', |
115 | 115 | 'label' => __( 'Default Image', 'gravityview' ), |
116 | 116 | 'desc' => __( 'Choose the default image to be shown when an email has no Gravatar.', 'gravityview' ) . ' <a href="https://en.gravatar.com/site/implement/images/">' . esc_html( sprintf( __( 'Read more about %s', 'gravityview' ), __( 'Default Image', 'gravityview' ) ) ) . '</a>', |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | ), |
127 | 127 | ); |
128 | 128 | |
129 | - $field_options['size'] = array( |
|
129 | + $field_options[ 'size' ] = array( |
|
130 | 130 | 'type' => 'number', |
131 | 131 | 'label' => __( 'Size in Pixels', 'gravityview' ), |
132 | 132 | 'value' => 80, |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | $email_fields = GFAPI::get_fields_by_type( $form, array( 'email' ) ); |
160 | 160 | |
161 | 161 | foreach ( $email_fields as $email_field ) { |
162 | - $email_field_id = $email_field['id']; |
|
162 | + $email_field_id = $email_field[ 'id' ]; |
|
163 | 163 | $email_field_label = GVCommon::get_field_label( $form, $email_field_id ); |
164 | 164 | $email_field_label = sprintf( __( 'Field: %s', 'gravityview' ), $email_field_label ); |
165 | 165 | $field_choices[ $email_field_id ] = esc_html( $email_field_label ); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public static function is_add_oembed_preview() { |
71 | 71 | /** The preview request is a parse-embed AJAX call without a type set. */ |
72 | - return ( self::is_ajax() && ! empty( $_POST['action'] ) && $_POST['action'] == 'parse-embed' && ! isset( $_POST['type'] ) ); |
|
72 | + return ( self::is_ajax() && ! empty( $_POST[ 'action' ] ) && $_POST[ 'action' ] == 'parse-embed' && ! isset( $_POST[ 'type' ] ) ); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @return boolean |
88 | 88 | */ |
89 | 89 | public static function is_rest() { |
90 | - return ! empty( $GLOBALS['wp']->query_vars['rest_route'] ); |
|
90 | + return ! empty( $GLOBALS[ 'wp' ]->query_vars[ 'rest_route' ] ); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | return false; |
158 | 158 | } |
159 | 159 | |
160 | - if ( ! in_array( $e['form_id'], $valid_forms ) ) { |
|
160 | + if ( ! in_array( $e[ 'form_id' ], $valid_forms ) ) { |
|
161 | 161 | return false; |
162 | 162 | } |
163 | 163 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | } |
174 | 174 | |
175 | 175 | $entry = Multi_Entry::from_entries( array_filter( $multientry ) ); |
176 | - } else { |
|
176 | + } else { |
|
177 | 177 | /** |
178 | 178 | * A regular one. |
179 | 179 | */ |
@@ -231,15 +231,15 @@ discard block |
||
231 | 231 | $get = $_GET; |
232 | 232 | } |
233 | 233 | |
234 | - unset( $get['mode'] ); |
|
234 | + unset( $get[ 'mode' ] ); |
|
235 | 235 | |
236 | 236 | $get = array_filter( $get, 'gravityview_is_not_empty_string' ); |
237 | 237 | |
238 | - if( $has_field_key = $this->_has_field_key( $get ) ) { |
|
238 | + if ( $has_field_key = $this->_has_field_key( $get ) ) { |
|
239 | 239 | return true; |
240 | 240 | } |
241 | 241 | |
242 | - return isset( $get['gv_search'] ) || isset( $get['gv_start'] ) || isset( $get['gv_end'] ) || isset( $get['gv_by'] ) || isset( $get['gv_id'] ); |
|
242 | + return isset( $get[ 'gv_search' ] ) || isset( $get[ 'gv_start' ] ) || isset( $get[ 'gv_end' ] ) || isset( $get[ 'gv_by' ] ) || isset( $get[ 'gv_id' ] ); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | /** |
@@ -262,13 +262,13 @@ discard block |
||
262 | 262 | |
263 | 263 | $meta = array(); |
264 | 264 | foreach ( $fields as $field ) { |
265 | - if( empty( $field->_gf_field_class_name ) ) { |
|
266 | - $meta[] = preg_quote( $field->name ); |
|
265 | + if ( empty( $field->_gf_field_class_name ) ) { |
|
266 | + $meta[ ] = preg_quote( $field->name ); |
|
267 | 267 | } |
268 | 268 | } |
269 | 269 | |
270 | 270 | foreach ( $get as $key => $value ) { |
271 | - if ( preg_match('/^filter_(([0-9_]+)|'. implode( '|', $meta ) .')$/sm', $key ) ) { |
|
271 | + if ( preg_match( '/^filter_(([0-9_]+)|' . implode( '|', $meta ) . ')$/sm', $key ) ) { |
|
272 | 272 | $has_field_key = true; |
273 | 273 | break; |
274 | 274 | } |
@@ -190,8 +190,8 @@ discard block |
||
190 | 190 | public function get_output() { |
191 | 191 | |
192 | 192 | // No Entries |
193 | - if( empty( $this->entries ) ) { |
|
194 | - return '<div class="gv-no-results">'.$this->empty_message.'</div>'; |
|
193 | + if ( empty( $this->entries ) ) { |
|
194 | + return '<div class="gv-no-results">' . $this->empty_message . '</div>'; |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | $output = ''; |
@@ -202,22 +202,22 @@ discard block |
||
202 | 202 | $current_entry = GravityView_View::getInstance()->getCurrentEntry(); |
203 | 203 | } |
204 | 204 | |
205 | - $output .= '<'. $this->wrapper_tag .'>'; |
|
205 | + $output .= '<' . $this->wrapper_tag . '>'; |
|
206 | 206 | |
207 | - foreach( $this->entries as $entry ) { |
|
207 | + foreach ( $this->entries as $entry ) { |
|
208 | 208 | |
209 | 209 | if ( $entry instanceof \GV\Entry ) { |
210 | 210 | $entry = $entry->as_entry(); |
211 | 211 | } |
212 | 212 | |
213 | - if( $this->skip_entry( $entry, $current_entry ) ) { |
|
213 | + if ( $this->skip_entry( $entry, $current_entry ) ) { |
|
214 | 214 | continue; |
215 | 215 | } |
216 | 216 | |
217 | 217 | $output .= $this->get_item_output( $entry ); |
218 | 218 | } |
219 | 219 | |
220 | - $output .= '</'. $this->wrapper_tag .'>'; |
|
220 | + $output .= '</' . $this->wrapper_tag . '>'; |
|
221 | 221 | |
222 | 222 | /** |
223 | 223 | * @filter `gravityview/widget/recent-entries/output` Modify the HTML of the Recent Entries widget output |
@@ -240,15 +240,15 @@ discard block |
||
240 | 240 | private function skip_entry( $entry, $current_entry ) { |
241 | 241 | |
242 | 242 | // If skip entry is off, or there's no current entry, return false |
243 | - if( empty( $this->skip_current_entry ) || empty( $current_entry ) ) { |
|
243 | + if ( empty( $this->skip_current_entry ) || empty( $current_entry ) ) { |
|
244 | 244 | return false; |
245 | 245 | } |
246 | 246 | |
247 | 247 | // If in Single or Edit mode, $current_entry will be an array. |
248 | - $current_entry_id = is_array( $current_entry ) ? $current_entry['id'] : $current_entry; |
|
248 | + $current_entry_id = is_array( $current_entry ) ? $current_entry[ 'id' ] : $current_entry; |
|
249 | 249 | |
250 | 250 | // If the entry ID matches the current entry, yes: skip |
251 | - if( $entry['id'] === $current_entry_id ) { |
|
251 | + if ( $entry[ 'id' ] === $current_entry_id ) { |
|
252 | 252 | return true; |
253 | 253 | } |
254 | 254 | |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | |
284 | 284 | $item_output = gravityview_get_link( $link, $this->link_format ); |
285 | 285 | |
286 | - if( !empty( $this->after_link ) ) { |
|
286 | + if ( ! empty( $this->after_link ) ) { |
|
287 | 287 | |
288 | 288 | /** |
289 | 289 | * @filter `gravityview/entry-list/after-link` Modify the content displayed after the entry link in an entry list |
@@ -292,14 +292,14 @@ discard block |
||
292 | 292 | * @param array $entry Gravity Forms entry array |
293 | 293 | * @param GravityView_Entry_List $this The current class instance |
294 | 294 | */ |
295 | - $after_link = apply_filters( 'gravityview/entry-list/after-link', '<div>'.$this->after_link.'</div>', $entry, $this ); |
|
295 | + $after_link = apply_filters( 'gravityview/entry-list/after-link', '<div>' . $this->after_link . '</div>', $entry, $this ); |
|
296 | 296 | |
297 | 297 | $item_output .= $after_link; |
298 | 298 | } |
299 | 299 | |
300 | 300 | $item_output = GravityView_API::replace_variables( $item_output, $this->form, $entry ); |
301 | 301 | |
302 | - $item_output = '<'. $this->item_tag .'>'. $item_output .'</'. $this->item_tag .'>'; |
|
302 | + $item_output = '<' . $this->item_tag . '>' . $item_output . '</' . $this->item_tag . '>'; |
|
303 | 303 | |
304 | 304 | /** |
305 | 305 | * @filter `gravityview/entry-list/item` Modify each item's output in an entry list |