@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | */ |
45 | 45 | protected $form_id; |
46 | 46 | |
47 | - function __construct( $title = '', $item_id = '', $item = array(), $settings = array(), $form_id = null) { |
|
47 | + function __construct( $title = '', $item_id = '', $item = array(), $settings = array(), $form_id = null ) { |
|
48 | 48 | |
49 | 49 | // Backward compat |
50 | - if ( ! empty( $item['type'] ) ) { |
|
51 | - $item['input_type'] = $item['type']; |
|
52 | - unset( $item['type'] ); |
|
50 | + if ( ! empty( $item[ 'type' ] ) ) { |
|
51 | + $item[ 'input_type' ] = $item[ 'type' ]; |
|
52 | + unset( $item[ 'type' ] ); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | if ( $admin_label = \GV\Utils::get( $settings, 'admin_label' ) ) { |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $this->id = $item_id; |
77 | 77 | $this->form_id = $form_id; |
78 | 78 | $this->settings = $settings; |
79 | - $this->label_type = $item['label_type']; |
|
79 | + $this->label_type = $item[ 'label_type' ]; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -120,14 +120,14 @@ discard block |
||
120 | 120 | |
121 | 121 | foreach ( $field_info_items as $item ) { |
122 | 122 | |
123 | - if( \GV\Utils::get( $item, 'hide_in_picker', false ) ) { |
|
123 | + if ( \GV\Utils::get( $item, 'hide_in_picker', false ) ) { |
|
124 | 124 | continue; |
125 | 125 | } |
126 | 126 | |
127 | - $class = isset( $item['class'] ) ? sanitize_html_class( $item['class'] ) . ' description' : 'description'; |
|
127 | + $class = isset( $item[ 'class' ] ) ? sanitize_html_class( $item[ 'class' ] ) . ' description' : 'description'; |
|
128 | 128 | // Add the title in case the value's long, in which case, it'll be truncated by CSS. |
129 | 129 | $output .= '<span class="' . $class . '">'; |
130 | - $output .= esc_html( $item['value'] ); |
|
130 | + $output .= esc_html( $item[ 'value' ] ); |
|
131 | 131 | $output .= '</span>'; |
132 | 132 | } |
133 | 133 | |
@@ -156,46 +156,46 @@ discard block |
||
156 | 156 | |
157 | 157 | // $settings_html will just be hidden inputs if empty. Otherwise, it'll have an <ul>. Ugly hack, I know. |
158 | 158 | // TODO: Un-hack this |
159 | - $hide_settings_link_class = ( empty( $this->item['settings_html'] ) || strpos( $this->item['settings_html'], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : ''; |
|
160 | - $settings_link = sprintf( '<button class="gv-field-settings %2$s" title="%1$s" aria-label="%1$s"><span class="dashicons-admin-generic dashicons"></span></button>', esc_attr( $settings_title ), $hide_settings_link_class ); |
|
159 | + $hide_settings_link_class = ( empty( $this->item[ 'settings_html' ] ) || strpos( $this->item[ 'settings_html' ], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : ''; |
|
160 | + $settings_link = sprintf( '<button class="gv-field-settings %2$s" title="%1$s" aria-label="%1$s"><span class="dashicons-admin-generic dashicons"></span></button>', esc_attr( $settings_title ), $hide_settings_link_class ); |
|
161 | 161 | |
162 | 162 | // When a field label is empty, use the Field ID |
163 | 163 | $label = empty( $this->title ) ? sprintf( _x( 'Field #%s (No Label)', 'Label in field picker for empty label', 'gravityview' ), $this->id ) : $this->title; |
164 | 164 | |
165 | 165 | // If there's a custom label, and show label is checked, use that as the field heading |
166 | - if ( ! empty( $this->settings['custom_label'] ) && ! empty( $this->settings['show_label'] ) ) { |
|
167 | - $label = $this->settings['custom_label']; |
|
168 | - } else if ( ! empty( $this->item['customLabel'] ) ) { |
|
169 | - $label = $this->item['customLabel']; |
|
166 | + if ( ! empty( $this->settings[ 'custom_label' ] ) && ! empty( $this->settings[ 'show_label' ] ) ) { |
|
167 | + $label = $this->settings[ 'custom_label' ]; |
|
168 | + } else if ( ! empty( $this->item[ 'customLabel' ] ) ) { |
|
169 | + $label = $this->item[ 'customLabel' ]; |
|
170 | 170 | } |
171 | 171 | $label = esc_attr( $label ); |
172 | 172 | |
173 | 173 | $field_icon = ''; |
174 | 174 | |
175 | 175 | $form = ! empty( $this->form_id ) ? GVCommon::get_form( $this->form_id ) : false; |
176 | - $nonexistent_form_field = $form && $this->id && preg_match('/^\d+\.\d+$|^\d+$/', $this->id) && ! gravityview_get_field( $form, $this->id ); |
|
176 | + $nonexistent_form_field = $form && $this->id && preg_match( '/^\d+\.\d+$|^\d+$/', $this->id ) && ! gravityview_get_field( $form, $this->id ); |
|
177 | 177 | |
178 | - if ( $this->item['icon'] && ! \GV\Utils::get( $this->item, 'parent' ) ) { |
|
178 | + if ( $this->item[ 'icon' ] && ! \GV\Utils::get( $this->item, 'parent' ) ) { |
|
179 | 179 | |
180 | - $has_gf_icon = ( false !== strpos( $this->item['icon'], 'gform-icon' ) ); |
|
181 | - $has_dashicon = ( false !== strpos( $this->item['icon'], 'dashicons' ) ); |
|
180 | + $has_gf_icon = ( false !== strpos( $this->item[ 'icon' ], 'gform-icon' ) ); |
|
181 | + $has_dashicon = ( false !== strpos( $this->item[ 'icon' ], 'dashicons' ) ); |
|
182 | 182 | |
183 | - if ( 0 === strpos( $this->item['icon'], 'data:' ) ) { |
|
183 | + if ( 0 === strpos( $this->item[ 'icon' ], 'data:' ) ) { |
|
184 | 184 | // Inline icon SVG |
185 | - $field_icon = '<i class="dashicons background-icon" style="background-image: url(\'' . esc_attr( $this->item['icon'] ) . '\');"></i>'; |
|
186 | - } elseif( $has_gf_icon && gravityview()->plugin->is_GF_25() ) { |
|
185 | + $field_icon = '<i class="dashicons background-icon" style="background-image: url(\'' . esc_attr( $this->item[ 'icon' ] ) . '\');"></i>'; |
|
186 | + } elseif ( $has_gf_icon && gravityview()->plugin->is_GF_25() ) { |
|
187 | 187 | // Gravity Forms icon font |
188 | - $field_icon = '<i class="gform-icon ' . esc_attr( $this->item['icon'] ) . '"></i>'; |
|
189 | - } elseif( $has_dashicon ) { |
|
188 | + $field_icon = '<i class="gform-icon ' . esc_attr( $this->item[ 'icon' ] ) . '"></i>'; |
|
189 | + } elseif ( $has_dashicon ) { |
|
190 | 190 | // Dashicon; prefix with "dashicons" |
191 | - $field_icon = '<i class="dashicons ' . esc_attr( $this->item['icon'] ) . '"></i>'; |
|
191 | + $field_icon = '<i class="dashicons ' . esc_attr( $this->item[ 'icon' ] ) . '"></i>'; |
|
192 | 192 | } else { |
193 | 193 | // Not dashicon icon |
194 | - $field_icon = '<i class="' . esc_attr( $this->item['icon'] ) . '"></i>'; |
|
194 | + $field_icon = '<i class="' . esc_attr( $this->item[ 'icon' ] ) . '"></i>'; |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | $field_icon = $field_icon . ' '; |
198 | - } elseif( \GV\Utils::get( $this->item, 'parent' ) ) { |
|
198 | + } elseif ( \GV\Utils::get( $this->item, 'parent' ) ) { |
|
199 | 199 | $field_icon = '<i class="gv-icon gv-icon-level-down"></i>' . ' '; |
200 | 200 | } |
201 | 201 | |
@@ -222,19 +222,19 @@ discard block |
||
222 | 222 | |
223 | 223 | $output .= '</h5>'; |
224 | 224 | |
225 | - $container_class = ! empty( $this->item['parent'] ) ? ' gv-child-field' : ''; |
|
225 | + $container_class = ! empty( $this->item[ 'parent' ] ) ? ' gv-child-field' : ''; |
|
226 | 226 | |
227 | 227 | $container_class .= $nonexistent_form_field ? ' gv-nonexistent-form-field' : ''; |
228 | 228 | |
229 | - $container_class .= empty( $this->settings['show_as_link'] ) ? '' : ' has-single-entry-link'; |
|
229 | + $container_class .= empty( $this->settings[ 'show_as_link' ] ) ? '' : ' has-single-entry-link'; |
|
230 | 230 | |
231 | - $container_class .= empty( $this->settings['only_loggedin'] ) ? '' : ' has-custom-visibility'; |
|
231 | + $container_class .= empty( $this->settings[ 'only_loggedin' ] ) ? '' : ' has-custom-visibility'; |
|
232 | 232 | |
233 | - $data_form_id = $form ? ' data-formid="' . esc_attr( $this->form_id ) . '"' : ''; |
|
233 | + $data_form_id = $form ? ' data-formid="' . esc_attr( $this->form_id ) . '"' : ''; |
|
234 | 234 | |
235 | - $data_parent_label = ! empty( $this->item['parent'] ) ? ' data-parent-label="' . esc_attr( $this->item['parent']['label'] ) . '"' : ''; |
|
235 | + $data_parent_label = ! empty( $this->item[ 'parent' ] ) ? ' data-parent-label="' . esc_attr( $this->item[ 'parent' ][ 'label' ] ) . '"' : ''; |
|
236 | 236 | |
237 | - $output = '<div data-fieldid="' . esc_attr( $this->id ) . '" ' . $data_form_id . $data_parent_label . ' data-inputtype="' . esc_attr( $this->item['input_type'] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item['settings_html'] . '</div>'; |
|
237 | + $output = '<div data-fieldid="' . esc_attr( $this->id ) . '" ' . $data_form_id . $data_parent_label . ' data-inputtype="' . esc_attr( $this->item[ 'input_type' ] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item[ 'settings_html' ] . '</div>'; |
|
238 | 238 | |
239 | 239 | return $output; |
240 | 240 | } |
@@ -252,12 +252,12 @@ discard block |
||
252 | 252 | |
253 | 253 | $icons = array( |
254 | 254 | 'show_as_link' => array( |
255 | - 'visible' => ( ! empty( $this->settings['show_as_link'] ) ), |
|
255 | + 'visible' => ( ! empty( $this->settings[ 'show_as_link' ] ) ), |
|
256 | 256 | 'title' => __( 'This field links to the Single Entry', 'gravityview' ), |
257 | 257 | 'css_class' => 'dashicons dashicons-media-default icon-link-to-single-entry', |
258 | 258 | ), |
259 | 259 | 'only_loggedin' => array( |
260 | - 'visible' => ( \GV\Utils::get( $this->settings, 'only_loggedin' ) || isset( $this->settings['allow_edit_cap'] ) && 'read' !== $this->settings['allow_edit_cap'] ), |
|
260 | + 'visible' => ( \GV\Utils::get( $this->settings, 'only_loggedin' ) || isset( $this->settings[ 'allow_edit_cap' ] ) && 'read' !== $this->settings[ 'allow_edit_cap' ] ), |
|
261 | 261 | 'title' => __( 'This field has modified visibility', 'gravityview' ), |
262 | 262 | 'css_class' => 'dashicons dashicons-lock icon-custom-visibility', |
263 | 263 | ), |
@@ -271,21 +271,21 @@ discard block |
||
271 | 271 | * @param array $icons Array of icons to be shown, with `visible`, `title`, `css_class` keys. |
272 | 272 | * @param array $item_settings Settings for the current item (widget or field) |
273 | 273 | */ |
274 | - $icons = (array) apply_filters( 'gravityview/admin/indicator_icons', $icons, $this->settings ); |
|
274 | + $icons = (array)apply_filters( 'gravityview/admin/indicator_icons', $icons, $this->settings ); |
|
275 | 275 | |
276 | 276 | foreach ( $icons as $icon ) { |
277 | 277 | |
278 | - if ( empty( $icon['css_class'] ) || empty( $icon['title'] ) ) { |
|
278 | + if ( empty( $icon[ 'css_class' ] ) || empty( $icon[ 'title' ] ) ) { |
|
279 | 279 | continue; |
280 | 280 | } |
281 | 281 | |
282 | - $css_class = trim( $icon['css_class'] ); |
|
282 | + $css_class = trim( $icon[ 'css_class' ] ); |
|
283 | 283 | |
284 | - if ( empty( $icon['visible'] ) ) { |
|
284 | + if ( empty( $icon[ 'visible' ] ) ) { |
|
285 | 285 | $css_class .= ' hide-if-js'; |
286 | 286 | } |
287 | 287 | |
288 | - $output .= '<span class="' . gravityview_sanitize_html_class( $css_class ) . '" title="' . esc_attr( $icon['title'] ) . '"></span>'; |
|
288 | + $output .= '<span class="' . gravityview_sanitize_html_class( $css_class ) . '" title="' . esc_attr( $icon[ 'title' ] ) . '"></span>'; |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | return $output; |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | 'GravityView_DataTables_Template' => array( |
60 | 60 | 'slug' => 'dt_placeholder', |
61 | 61 | 'label' => __( 'DataTables Table', 'gv-datatables', 'gravityview' ), |
62 | - 'description' => __('Display items in a dynamic table powered by DataTables.', 'gravityview'), |
|
63 | - 'logo' => plugins_url('assets/images/templates/logo-datatables.png', GRAVITYVIEW_FILE ), |
|
62 | + 'description' => __( 'Display items in a dynamic table powered by DataTables.', 'gravityview' ), |
|
63 | + 'logo' => plugins_url( 'assets/images/templates/logo-datatables.png', GRAVITYVIEW_FILE ), |
|
64 | 64 | 'buy_source' => 'https://gravityview.co/pricing/?utm_source=plugin&utm_medium=buy_now&utm_campaign=view_type&utm_term=datatables', |
65 | 65 | 'preview' => 'https://try.gravityview.co/demo/view/datatables/?utm_source=plugin&utm_medium=try_demo&utm_campaign=view_type&utm_term=datatables', |
66 | 66 | 'license' => esc_html__( 'All Access', 'gravityview' ), |
@@ -102,10 +102,10 @@ discard block |
||
102 | 102 | continue; |
103 | 103 | } |
104 | 104 | |
105 | - $placeholder['type'] = 'custom'; |
|
106 | - $placeholder['included'] = ( (int) $license['price_id'] >= $placeholder['price_id'] ); |
|
105 | + $placeholder[ 'type' ] = 'custom'; |
|
106 | + $placeholder[ 'included' ] = ( (int)$license[ 'price_id' ] >= $placeholder[ 'price_id' ] ); |
|
107 | 107 | |
108 | - new GravityView_Placeholder_Template( $placeholder['slug'], $placeholder ); |
|
108 | + new GravityView_Placeholder_Template( $placeholder[ 'slug' ], $placeholder ); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | } catch ( Exception $exception ) { |
@@ -50,26 +50,26 @@ |
||
50 | 50 | |
51 | 51 | if ( ! empty( $quiz_fields ) ) { |
52 | 52 | |
53 | - $fields['gquiz_score'] = array( |
|
53 | + $fields[ 'gquiz_score' ] = array( |
|
54 | 54 | 'label' => __( 'Quiz Score Total', 'gravityview' ), |
55 | 55 | 'type' => 'quiz_score', |
56 | 56 | 'desc' => __( 'Displays the number of correct Quiz answers the user submitted.', 'gravityview' ), |
57 | 57 | 'icon' => 'dashicons-forms', |
58 | 58 | ); |
59 | - $fields['gquiz_percent'] = array( |
|
59 | + $fields[ 'gquiz_percent' ] = array( |
|
60 | 60 | 'label' => __( 'Quiz Percentage Grade', 'gravityview' ), |
61 | 61 | 'type' => 'quiz_percent', |
62 | 62 | 'desc' => __( 'Displays the percentage of correct Quiz answers the user submitted.', 'gravityview' ), |
63 | 63 | 'icon' => 'dashicons-forms', |
64 | 64 | ); |
65 | - $fields['gquiz_grade'] = array( |
|
65 | + $fields[ 'gquiz_grade' ] = array( |
|
66 | 66 | /* translators: This is a field type used by the Gravity Forms Quiz Addon. "A" is 100-90, "B" is 89-80, "C" is 79-70, etc. */ |
67 | 67 | 'label' => __( 'Quiz Letter Grade', 'gravityview' ), |
68 | 68 | 'type' => 'quiz_grade', |
69 | 69 | 'desc' => __( 'Displays the Grade the user achieved based on Letter Grading configured in the Quiz Settings.', 'gravityview' ), |
70 | 70 | 'icon' => 'dashicons-forms', |
71 | 71 | ); |
72 | - $fields['gquiz_is_pass'] = array( |
|
72 | + $fields[ 'gquiz_is_pass' ] = array( |
|
73 | 73 | 'label' => __( 'Quiz Pass/Fail', 'gravityview' ), |
74 | 74 | 'type' => 'quiz_is_pass', |
75 | 75 | 'desc' => __( 'Displays either Passed or Failed based on the Pass/Fail settings configured in the Quiz Settings.', 'gravityview' ), |
@@ -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 | |
@@ -149,13 +149,13 @@ discard block |
||
149 | 149 | |
150 | 150 | foreach ( $all_plugins as $path => $plugin ) { |
151 | 151 | |
152 | - if ( empty( $plugin['TextDomain'] ) ) { |
|
152 | + if ( empty( $plugin[ 'TextDomain' ] ) ) { |
|
153 | 153 | continue; |
154 | 154 | } |
155 | 155 | |
156 | - $wp_plugins[ $plugin['TextDomain'] ] = array( |
|
156 | + $wp_plugins[ $plugin[ 'TextDomain' ] ] = array( |
|
157 | 157 | 'path' => $path, |
158 | - 'version' => $plugin['Version'], |
|
158 | + 'version' => $plugin[ 'Version' ], |
|
159 | 159 | 'activated' => is_plugin_active( $path ) |
160 | 160 | ); |
161 | 161 | } |
@@ -209,11 +209,11 @@ discard block |
||
209 | 209 | |
210 | 210 | $downloads_data = get_site_transient( self::DOWNLOADS_DATA_TRANSIENT ); |
211 | 211 | |
212 | - if ( $downloads_data && ! isset( $_GET['cache'] ) ) { |
|
212 | + if ( $downloads_data && ! isset( $_GET[ 'cache' ] ) ) { |
|
213 | 213 | return $downloads_data; |
214 | 214 | } |
215 | 215 | |
216 | - if( \GV\Plugin::is_network_activated() ) { |
|
216 | + if ( \GV\Plugin::is_network_activated() ) { |
|
217 | 217 | $home_url = network_home_url(); |
218 | 218 | } else { |
219 | 219 | $home_url = home_url(); |
@@ -241,13 +241,13 @@ discard block |
||
241 | 241 | |
242 | 242 | $downloads_data = json_decode( wp_remote_retrieve_body( $response ), true ); |
243 | 243 | |
244 | - if ( empty( $downloads_data['products'] ) ) { |
|
244 | + if ( empty( $downloads_data[ 'products' ] ) ) { |
|
245 | 245 | return array(); |
246 | 246 | } |
247 | 247 | |
248 | - $this->set_downloads_data( $downloads_data['products'] ); |
|
248 | + $this->set_downloads_data( $downloads_data[ 'products' ] ); |
|
249 | 249 | |
250 | - return $downloads_data['products']; |
|
250 | + return $downloads_data[ 'products' ]; |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | /** |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | |
308 | 308 | <h2><?php esc_html_e( 'The following plugins extend GravityView and Gravity Forms functionality:', 'gravityview' ); ?></h2> |
309 | 309 | |
310 | - <a class="button button-secondary gv-admin-installer-refresh-link" href="<?php echo add_query_arg(array( 'cache' => 1 ) ); ?>"><i class="dashicons dashicons-update" style="margin-top: .2em"></i> <?php esc_html_e( 'Refresh', 'gravityview' ); ?></a> |
|
310 | + <a class="button button-secondary gv-admin-installer-refresh-link" href="<?php echo add_query_arg( array( 'cache' => 1 ) ); ?>"><i class="dashicons dashicons-update" style="margin-top: .2em"></i> <?php esc_html_e( 'Refresh', 'gravityview' ); ?></a> |
|
311 | 311 | |
312 | 312 | <hr class="wp-header-end" /> |
313 | 313 | |
@@ -324,9 +324,9 @@ discard block |
||
324 | 324 | |
325 | 325 | $this->render_section( 'extensions', esc_html__( 'GravityView Extensions', 'gravityview' ), $downloads_data, $wp_plugins ); |
326 | 326 | |
327 | - $this->render_section( 'plugins', esc_html__( 'Gravity Forms Add-Ons', 'gravityview' ), $downloads_data, $wp_plugins ); |
|
327 | + $this->render_section( 'plugins', esc_html__( 'Gravity Forms Add-Ons', 'gravityview' ), $downloads_data, $wp_plugins ); |
|
328 | 328 | |
329 | - $this->render_section( 'friends', esc_html__( 'Friends of GravityView', 'gravityview' ), $downloads_data, $wp_plugins ); |
|
329 | + $this->render_section( 'friends', esc_html__( 'Friends of GravityView', 'gravityview' ), $downloads_data, $wp_plugins ); |
|
330 | 330 | ?> |
331 | 331 | </div> |
332 | 332 | </div> |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | continue; |
354 | 354 | } |
355 | 355 | |
356 | - if ( empty( $download['info'] ) ) { |
|
356 | + if ( empty( $download[ 'info' ] ) ) { |
|
357 | 357 | continue; |
358 | 358 | } |
359 | 359 | |
@@ -381,31 +381,31 @@ discard block |
||
381 | 381 | |
382 | 382 | $details = $this->get_download_display_details( $download, $wp_plugins ); |
383 | 383 | |
384 | - $download_info = $details['download_info']; |
|
384 | + $download_info = $details[ 'download_info' ]; |
|
385 | 385 | |
386 | 386 | ?> |
387 | - <div class="item <?php echo esc_attr( $details['item_class'] ); ?>"> |
|
387 | + <div class="item <?php echo esc_attr( $details[ 'item_class' ] ); ?>"> |
|
388 | 388 | <div class="addon-inner"> |
389 | - <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> |
|
390 | - <h3><?php echo esc_html( \GV\Utils::get( $download_info, 'installer_title', $download_info['title'] ) ); ?></h3> |
|
389 | + <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> |
|
390 | + <h3><?php echo esc_html( \GV\Utils::get( $download_info, 'installer_title', $download_info[ 'title' ] ) ); ?></h3> |
|
391 | 391 | <div> |
392 | - <?php if( ! empty( $details['status_label'] ) ) { ?> |
|
393 | - <div class="status <?php echo esc_attr( $details['status'] ); ?>" title="<?php printf( esc_attr__( 'Plugin status: %s', 'gravityview' ), esc_html( $details['status_label'] ) ); ?>"> |
|
394 | - <span class="dashicons dashicons-admin-plugins"></span> <span class="status-label"><?php echo esc_html( $details['status_label'] ); ?></span> |
|
392 | + <?php if ( ! empty( $details[ 'status_label' ] ) ) { ?> |
|
393 | + <div class="status <?php echo esc_attr( $details[ 'status' ] ); ?>" title="<?php printf( esc_attr__( 'Plugin status: %s', 'gravityview' ), esc_html( $details[ 'status_label' ] ) ); ?>"> |
|
394 | + <span class="dashicons dashicons-admin-plugins"></span> <span class="status-label"><?php echo esc_html( $details[ 'status_label' ] ); ?></span> |
|
395 | 395 | </div> |
396 | 396 | <?php } ?> |
397 | 397 | |
398 | - <?php if ( 'gravityview' !== $download_info['slug'] ) { ?> |
|
399 | - <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'] ); ?>"> |
|
400 | - <span class="title"><?php echo esc_html( $details['button_label'] ); ?></span> |
|
401 | - <?php if( $details['spinner'] ) { ?><span class="spinner"></span><?php } ?> |
|
398 | + <?php if ( 'gravityview' !== $download_info[ 'slug' ] ) { ?> |
|
399 | + <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' ] ); ?>"> |
|
400 | + <span class="title"><?php echo esc_html( $details[ 'button_label' ] ); ?></span> |
|
401 | + <?php if ( $details[ 'spinner' ] ) { ?><span class="spinner"></span><?php } ?> |
|
402 | 402 | </a> |
403 | 403 | <?php } ?> |
404 | 404 | </div> |
405 | 405 | |
406 | 406 | <div class="addon-excerpt"><?php |
407 | 407 | |
408 | - $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info['excerpt'] ); |
|
408 | + $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info[ 'excerpt' ] ); |
|
409 | 409 | |
410 | 410 | // Allow some pure HTML tags, but remove everything else from the excerpt. |
411 | 411 | $tags = array( '<strong>', '</strong>', '<em>', '</em>', '<code>', '</code>' ); |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | */ |
448 | 448 | private function get_download_display_details( $download, $wp_plugins ) { |
449 | 449 | |
450 | - $download_info = wp_parse_args( (array) $download['info'], array( |
|
450 | + $download_info = wp_parse_args( (array)$download[ 'info' ], array( |
|
451 | 451 | 'thumbnail' => '', |
452 | 452 | 'title' => '', |
453 | 453 | 'textdomain' => '', |
@@ -459,9 +459,9 @@ discard block |
||
459 | 459 | 'installer_excerpt' => null, // May not be defined |
460 | 460 | ) ); |
461 | 461 | |
462 | - $wp_plugin = \GV\Utils::get( $wp_plugins, $download_info['textdomain'], false ); |
|
462 | + $wp_plugin = \GV\Utils::get( $wp_plugins, $download_info[ 'textdomain' ], false ); |
|
463 | 463 | |
464 | - $has_access = ! empty( $download['files'] ); |
|
464 | + $has_access = ! empty( $download[ 'files' ] ); |
|
465 | 465 | $spinner = true; |
466 | 466 | $href = $plugin_path = '#'; |
467 | 467 | $status = $item_class = $button_title = $button_class = ''; |
@@ -471,11 +471,11 @@ discard block |
||
471 | 471 | $required_license = $galactic_only ? __( 'All Access', 'gravityview' ) : __( 'Core + Extensions', 'gravityview' ); |
472 | 472 | |
473 | 473 | // The license is not active - no matter what level, this should not work |
474 | - if( ! $is_active && empty( $base_price ) ) { |
|
474 | + if ( ! $is_active && empty( $base_price ) ) { |
|
475 | 475 | $spinner = false; |
476 | 476 | $status_label = ''; |
477 | 477 | $button_label = sprintf( __( 'Active %s License is Required.', 'gravityview' ), $required_license ); |
478 | - $href = $download_info['link']; |
|
478 | + $href = $download_info[ 'link' ]; |
|
479 | 479 | $button_class = 'button-primary'; |
480 | 480 | } |
481 | 481 | |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | $status_label = ''; |
486 | 486 | $button_label = sprintf( __( 'Purchase Now for %s', 'gravityview' ), '$' . $base_price ); |
487 | 487 | $button_class = 'button-primary button-large'; |
488 | - $href = $download_info['link']; |
|
488 | + $href = $download_info[ 'link' ]; |
|
489 | 489 | $item_class = 'featured'; |
490 | 490 | } |
491 | 491 | |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | $href = 'https://gravityview.co/pricing/?utm_source=admin-installer&utm_medium=admin&utm_campaign=Admin%20Notice&utm_content=' . $required_license; |
499 | 499 | } |
500 | 500 | |
501 | - elseif ( ! empty( $download_info['coming_soon'] ) ) { |
|
501 | + elseif ( ! empty( $download_info[ 'coming_soon' ] ) ) { |
|
502 | 502 | $spinner = false; |
503 | 503 | $status = 'notinstalled'; |
504 | 504 | $status_label = __( 'Coming Soon', 'gravityview' ); |
@@ -513,8 +513,8 @@ discard block |
||
513 | 513 | $href = add_query_arg( |
514 | 514 | array( |
515 | 515 | 'action' => 'install-plugin', |
516 | - 'plugin' => $download_info['slug'], |
|
517 | - '_wpnonce' => wp_create_nonce( 'install-plugin_' . $download_info['slug'] ), |
|
516 | + 'plugin' => $download_info[ 'slug' ], |
|
517 | + '_wpnonce' => wp_create_nonce( 'install-plugin_' . $download_info[ 'slug' ] ), |
|
518 | 518 | ), |
519 | 519 | self_admin_url( 'update.php' ) |
520 | 520 | ); |
@@ -530,12 +530,12 @@ discard block |
||
530 | 530 | $status = 'inactive'; |
531 | 531 | $status_label = __( 'Inactive', 'gravityview' ); |
532 | 532 | $button_label = __( 'Activate', 'gravityview' ); |
533 | - $plugin_path = $wp_plugin['path']; |
|
533 | + $plugin_path = $wp_plugin[ 'path' ]; |
|
534 | 534 | $button_class = 'button-secondary'; |
535 | 535 | } |
536 | 536 | // The plugin is installed and active |
537 | - elseif ( ! empty( $wp_plugin['path'] ) ) { |
|
538 | - $plugin_path = $wp_plugin['path']; |
|
537 | + elseif ( ! empty( $wp_plugin[ 'path' ] ) ) { |
|
538 | + $plugin_path = $wp_plugin[ 'path' ]; |
|
539 | 539 | $status = 'active'; |
540 | 540 | $status_label = __( 'Active', 'gravityview' ); |
541 | 541 | $button_label = __( 'Deactivate', 'gravityview' ); |
@@ -548,9 +548,9 @@ discard block |
||
548 | 548 | $href = add_query_arg( array( 'license_key' => $license_key ), $href ); |
549 | 549 | } |
550 | 550 | |
551 | - $download_info['link'] = add_query_arg( array( 'license_key' => $license_key ), $download_info['link'] ); |
|
551 | + $download_info[ 'link' ] = add_query_arg( array( 'license_key' => $license_key ), $download_info[ 'link' ] ); |
|
552 | 552 | |
553 | - return compact( 'download_info','plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' ); |
|
553 | + return compact( 'download_info', 'plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' ); |
|
554 | 554 | } |
555 | 555 | |
556 | 556 | /** |
@@ -565,11 +565,11 @@ discard block |
||
565 | 565 | $base_price = \GV\Utils::get( $download, 'pricing/amount', 0 ); |
566 | 566 | $base_price = \GFCommon::to_number( $base_price ); |
567 | 567 | |
568 | - unset( $download['pricing']['amount'] ); |
|
568 | + unset( $download[ 'pricing' ][ 'amount' ] ); |
|
569 | 569 | |
570 | 570 | // Price options array, not single price |
571 | - if ( ! $base_price && ! empty( $download['pricing'] ) ) { |
|
572 | - $base_price = array_shift( $download['pricing'] ); |
|
571 | + if ( ! $base_price && ! empty( $download[ 'pricing' ] ) ) { |
|
572 | + $base_price = array_shift( $download[ 'pricing' ] ); |
|
573 | 573 | } |
574 | 574 | |
575 | 575 | return floatval( $base_price ); |
@@ -583,13 +583,13 @@ discard block |
||
583 | 583 | public function activate_download() { |
584 | 584 | $data = \GV\Utils::_POST( 'data', array() ); |
585 | 585 | |
586 | - if ( empty( $data['path'] ) ) { |
|
586 | + if ( empty( $data[ 'path' ] ) ) { |
|
587 | 587 | return; |
588 | 588 | } |
589 | 589 | |
590 | - $result = activate_plugin( $data['path'] ); |
|
590 | + $result = activate_plugin( $data[ 'path' ] ); |
|
591 | 591 | |
592 | - if ( is_wp_error( $result ) || ! is_plugin_active( $data['path'] ) ) { |
|
592 | + if ( is_wp_error( $result ) || ! is_plugin_active( $data[ 'path' ] ) ) { |
|
593 | 593 | wp_send_json_error( array( |
594 | 594 | 'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() ) |
595 | 595 | ) ); |
@@ -606,13 +606,13 @@ discard block |
||
606 | 606 | public function deactivate_download() { |
607 | 607 | $data = \GV\Utils::_POST( 'data', array() ); |
608 | 608 | |
609 | - if ( empty( $data['path'] ) ) { |
|
609 | + if ( empty( $data[ 'path' ] ) ) { |
|
610 | 610 | return; |
611 | 611 | } |
612 | 612 | |
613 | - deactivate_plugins( $data['path'] ); |
|
613 | + deactivate_plugins( $data[ 'path' ] ); |
|
614 | 614 | |
615 | - if( is_plugin_active( $data['path'] ) ) { |
|
615 | + if ( is_plugin_active( $data[ 'path' ] ) ) { |
|
616 | 616 | wp_send_json_error( array( |
617 | 617 | 'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) ) |
618 | 618 | ) ); |