@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | function __construct( ) { |
14 | 14 | |
15 | - $name = __('GravityView Recent Entries', 'gravityview'); |
|
15 | + $name = __( 'GravityView Recent Entries', 'gravityview' ); |
|
16 | 16 | |
17 | 17 | $widget_options = array( |
18 | 18 | 'description' => __( 'Display the most recent entries for a View', 'gravityview' ), |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | private function initialize() { |
27 | 27 | |
28 | - add_action('admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts') ); |
|
28 | + add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); |
|
29 | 29 | |
30 | 30 | add_action( 'wp_ajax_gv_get_view_merge_tag_data', array( $this, 'ajax_get_view_merge_tag_data' ) ); |
31 | 31 | |
@@ -38,21 +38,21 @@ discard block |
||
38 | 38 | */ |
39 | 39 | function ajax_get_view_merge_tag_data() { |
40 | 40 | |
41 | - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajax_widget' ) ) { |
|
41 | + if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajax_widget' ) ) { |
|
42 | 42 | exit( false ); |
43 | 43 | } |
44 | 44 | |
45 | - $form_id = gravityview_get_form_id( $_POST['view_id'] ); |
|
45 | + $form_id = gravityview_get_form_id( $_POST[ 'view_id' ] ); |
|
46 | 46 | |
47 | 47 | $form = RGFormsModel::get_form_meta( $form_id ); |
48 | 48 | |
49 | 49 | $output = array( |
50 | 50 | 'form' => array( |
51 | - 'id' => $form['id'], |
|
52 | - 'title' => $form['title'], |
|
53 | - 'fields' => $form['fields'], |
|
51 | + 'id' => $form[ 'id' ], |
|
52 | + 'title' => $form[ 'title' ], |
|
53 | + 'fields' => $form[ 'fields' ], |
|
54 | 54 | ), |
55 | - 'mergeTags' => GFCommon::get_merge_tags( $form['fields'], '', false ), |
|
55 | + 'mergeTags' => GFCommon::get_merge_tags( $form[ 'fields' ], '', false ), |
|
56 | 56 | ); |
57 | 57 | |
58 | 58 | echo json_encode( $output ); |
@@ -68,17 +68,17 @@ discard block |
||
68 | 68 | function admin_enqueue_scripts() { |
69 | 69 | global $pagenow; |
70 | 70 | |
71 | - if( $pagenow === 'widgets.php' ) { |
|
71 | + if ( $pagenow === 'widgets.php' ) { |
|
72 | 72 | |
73 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
73 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
74 | 74 | |
75 | - wp_enqueue_script( 'gravityview_widgets', plugins_url('assets/js/admin-widgets'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery', 'gform_gravityforms' ), GravityView_Plugin::version ); |
|
75 | + wp_enqueue_script( 'gravityview_widgets', plugins_url( 'assets/js/admin-widgets' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery', 'gform_gravityforms' ), GravityView_Plugin::version ); |
|
76 | 76 | |
77 | 77 | wp_localize_script( 'gravityview_widgets', 'GVWidgets', array( |
78 | 78 | 'nonce' => wp_create_nonce( 'gravityview_ajax_widget' ) |
79 | - )); |
|
79 | + ) ); |
|
80 | 80 | |
81 | - wp_enqueue_style( 'gravityview_views_styles', plugins_url('assets/css/admin-views.css', GRAVITYVIEW_FILE), array('dashicons' ), GravityView_Plugin::version ); |
|
81 | + wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons' ), GravityView_Plugin::version ); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | } |
@@ -93,19 +93,19 @@ discard block |
||
93 | 93 | function widget( $args, $instance ) { |
94 | 94 | |
95 | 95 | // Don't have the Customizer render too soon. |
96 | - if( empty( $instance['view_id'] ) ) { |
|
96 | + if ( empty( $instance[ 'view_id' ] ) ) { |
|
97 | 97 | return; |
98 | 98 | } |
99 | 99 | |
100 | - $args['id'] = ( isset( $args['id'] ) ) ? $args['id'] : 'gv_recent_entries'; |
|
101 | - $instance['title'] = ( isset( $instance['title'] ) ) ? $instance['title'] : ''; |
|
100 | + $args[ 'id' ] = ( isset( $args[ 'id' ] ) ) ? $args[ 'id' ] : 'gv_recent_entries'; |
|
101 | + $instance[ 'title' ] = ( isset( $instance[ 'title' ] ) ) ? $instance[ 'title' ] : ''; |
|
102 | 102 | |
103 | - $title = apply_filters( 'widget_title', $instance[ 'title' ], $instance, $args['id'] ); |
|
103 | + $title = apply_filters( 'widget_title', $instance[ 'title' ], $instance, $args[ 'id' ] ); |
|
104 | 104 | |
105 | - echo $args['before_widget']; |
|
105 | + echo $args[ 'before_widget' ]; |
|
106 | 106 | |
107 | - if ( !empty( $title ) ) { |
|
108 | - echo $args['before_title'] . $title . $args['after_title']; |
|
107 | + if ( ! empty( $title ) ) { |
|
108 | + echo $args[ 'before_title' ] . $title . $args[ 'after_title' ]; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | */ |
126 | 126 | do_action( 'gravityview/widget/recent-entries/after_widget', $args, $instance ); |
127 | 127 | |
128 | - echo $args['after_widget']; |
|
128 | + echo $args[ 'after_widget' ]; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | */ |
140 | 140 | private function get_output( $instance ) { |
141 | 141 | |
142 | - $form_id = gravityview_get_form_id( $instance['view_id'] ); |
|
142 | + $form_id = gravityview_get_form_id( $instance[ 'view_id' ] ); |
|
143 | 143 | |
144 | 144 | $form = gravityview_get_form( $form_id ); |
145 | 145 | |
@@ -149,13 +149,13 @@ discard block |
||
149 | 149 | * @since 1.6.1 |
150 | 150 | * @var int $entry_link_post_id The ID to use as the parent post for the entry |
151 | 151 | */ |
152 | - $entry_link_post_id = ( empty( $instance['error_post_id'] ) && !empty( $instance['post_id'] ) ) ? $instance['post_id'] : $instance['view_id']; |
|
152 | + $entry_link_post_id = ( empty( $instance[ 'error_post_id' ] ) && ! empty( $instance[ 'post_id' ] ) ) ? $instance[ 'post_id' ] : $instance[ 'view_id' ]; |
|
153 | 153 | |
154 | 154 | /** |
155 | 155 | * Generate list output |
156 | 156 | * @since 1.7.2 |
157 | 157 | */ |
158 | - $List = new GravityView_Entry_List( $entries, $entry_link_post_id, $form, $instance['link_format'], $instance['after_link'], 'recent-entries-widget' ); |
|
158 | + $List = new GravityView_Entry_List( $entries, $entry_link_post_id, $form, $instance[ 'link_format' ], $instance[ 'after_link' ], 'recent-entries-widget' ); |
|
159 | 159 | |
160 | 160 | $output = $List->get_output(); |
161 | 161 | |
@@ -180,30 +180,30 @@ discard block |
||
180 | 180 | private function get_entries( $instance, $form_id ) { |
181 | 181 | |
182 | 182 | // Get the settings for the View ID |
183 | - $view_settings = gravityview_get_template_settings( $instance['view_id'] ); |
|
183 | + $view_settings = gravityview_get_template_settings( $instance[ 'view_id' ] ); |
|
184 | 184 | |
185 | 185 | // Set the context view ID to avoid conflicts with the Advanced Filter extension. |
186 | - $criteria['context_view_id'] = $instance['view_id']; |
|
186 | + $criteria[ 'context_view_id' ] = $instance[ 'view_id' ]; |
|
187 | 187 | |
188 | - $instance['limit'] = isset( $instance['limit'] ) ? $instance['limit'] : 10; |
|
189 | - $view_settings['id'] = $instance['view_id']; |
|
190 | - $view_settings['page_size'] = $instance['limit']; |
|
188 | + $instance[ 'limit' ] = isset( $instance[ 'limit' ] ) ? $instance[ 'limit' ] : 10; |
|
189 | + $view_settings[ 'id' ] = $instance[ 'view_id' ]; |
|
190 | + $view_settings[ 'page_size' ] = $instance[ 'limit' ]; |
|
191 | 191 | |
192 | 192 | // Prepare paging criteria |
193 | - $criteria['paging'] = array( |
|
193 | + $criteria[ 'paging' ] = array( |
|
194 | 194 | 'offset' => 0, |
195 | - 'page_size' => $instance['limit'] |
|
195 | + 'page_size' => $instance[ 'limit' ] |
|
196 | 196 | ); |
197 | 197 | |
198 | 198 | // Prepare Search Criteria |
199 | - $criteria['search_criteria'] = array( 'field_filters' => array() ); |
|
200 | - $criteria['search_criteria'] = GravityView_frontend::process_search_only_approved( $view_settings, $criteria['search_criteria']); |
|
201 | - $criteria['search_criteria']['status'] = apply_filters( 'gravityview_status', 'active', $view_settings ); |
|
199 | + $criteria[ 'search_criteria' ] = array( 'field_filters' => array() ); |
|
200 | + $criteria[ 'search_criteria' ] = GravityView_frontend::process_search_only_approved( $view_settings, $criteria[ 'search_criteria' ] ); |
|
201 | + $criteria[ 'search_criteria' ][ 'status' ] = apply_filters( 'gravityview_status', 'active', $view_settings ); |
|
202 | 202 | |
203 | 203 | /** |
204 | 204 | * Modify the search parameters before the entries are fetched |
205 | 205 | */ |
206 | - $criteria = apply_filters('gravityview/widget/recent-entries/criteria', $criteria, $instance, $form_id ); |
|
206 | + $criteria = apply_filters( 'gravityview/widget/recent-entries/criteria', $criteria, $instance, $form_id ); |
|
207 | 207 | |
208 | 208 | $results = GVCommon::get_entries( $form_id, $criteria ); |
209 | 209 | |
@@ -224,23 +224,23 @@ discard block |
||
224 | 224 | $instance = $new_instance; |
225 | 225 | |
226 | 226 | // Force positive number |
227 | - $instance['limit'] = empty( $instance['limit'] ) ? 10 : absint( $instance['limit'] ); |
|
227 | + $instance[ 'limit' ] = empty( $instance[ 'limit' ] ) ? 10 : absint( $instance[ 'limit' ] ); |
|
228 | 228 | |
229 | - $instance['view_id'] = intval( $instance['view_id'] ); |
|
229 | + $instance[ 'view_id' ] = intval( $instance[ 'view_id' ] ); |
|
230 | 230 | |
231 | - $instance['link_format'] = trim( rtrim( $instance['link_format'] ) ); |
|
231 | + $instance[ 'link_format' ] = trim( rtrim( $instance[ 'link_format' ] ) ); |
|
232 | 232 | |
233 | - $instance['link_format'] = empty( $instance['link_format'] ) ? $old_instance['link_format'] : $instance['link_format']; |
|
233 | + $instance[ 'link_format' ] = empty( $instance[ 'link_format' ] ) ? $old_instance[ 'link_format' ] : $instance[ 'link_format' ]; |
|
234 | 234 | |
235 | - $instance['post_id'] = empty( $instance['post_id'] ) ? '' : intval( $instance['post_id'] ); |
|
235 | + $instance[ 'post_id' ] = empty( $instance[ 'post_id' ] ) ? '' : intval( $instance[ 'post_id' ] ); |
|
236 | 236 | |
237 | - $is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance['post_id'], $instance['view_id'] ); |
|
237 | + $is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance[ 'post_id' ], $instance[ 'view_id' ] ); |
|
238 | 238 | |
239 | 239 | //check if post_id is a valid post with embedded View |
240 | - $instance['error_post_id'] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL; |
|
240 | + $instance[ 'error_post_id' ] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL; |
|
241 | 241 | |
242 | 242 | // Share that the widget isn't brand new |
243 | - $instance['updated'] = 1; |
|
243 | + $instance[ 'updated' ] = 1; |
|
244 | 244 | |
245 | 245 | /** |
246 | 246 | * Modify the updated instance. This will allow for validating any added instance settings externally. |
@@ -262,22 +262,22 @@ discard block |
||
262 | 262 | |
263 | 263 | // Set up some default widget settings. |
264 | 264 | $defaults = array( |
265 | - 'title' => __('Recent Entries', 'gravityview'), |
|
265 | + 'title' => __( 'Recent Entries', 'gravityview' ), |
|
266 | 266 | 'view_id' => NULL, |
267 | 267 | 'post_id' => NULL, |
268 | 268 | 'limit' => 10, |
269 | - 'link_format' => __('Entry #{entry_id}', 'gravityview'), |
|
269 | + 'link_format' => __( 'Entry #{entry_id}', 'gravityview' ), |
|
270 | 270 | 'after_link' => '' |
271 | 271 | ); |
272 | 272 | |
273 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
273 | + $instance = wp_parse_args( (array)$instance, $defaults ); |
|
274 | 274 | |
275 | 275 | ?> |
276 | 276 | |
277 | 277 | <!-- Title --> |
278 | 278 | <p> |
279 | 279 | <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:', 'gravityview' ) ?></label> |
280 | - <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" /> |
|
280 | + <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance[ 'title' ] ); ?>" /> |
|
281 | 281 | </p> |
282 | 282 | |
283 | 283 | <!-- Download --> |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | $views = get_posts( $args ); |
291 | 291 | |
292 | 292 | // If there are no views set up yet, we get outta here. |
293 | - if( empty( $views ) ) { |
|
293 | + if ( empty( $views ) ) { |
|
294 | 294 | echo '<div id="select_gravityview_view"><div class="wrap">' . GravityView_Admin::no_views_text() . '</div></div>'; |
295 | 295 | return; |
296 | 296 | } |
@@ -302,10 +302,10 @@ discard block |
||
302 | 302 | * Display errors generated for invalid embed IDs |
303 | 303 | * @see GravityView_View_Data::is_valid_embed_id |
304 | 304 | */ |
305 | - if( isset( $instance['updated'] ) && empty( $instance['view_id'] ) ) { |
|
305 | + if ( isset( $instance[ 'updated' ] ) && empty( $instance[ 'view_id' ] ) ) { |
|
306 | 306 | ?> |
307 | 307 | <div class="error inline hide-on-view-change"> |
308 | - <p><?php esc_html_e('Please select a View to search.', 'gravityview'); ?></p> |
|
308 | + <p><?php esc_html_e( 'Please select a View to search.', 'gravityview' ); ?></p> |
|
309 | 309 | </div> |
310 | 310 | <?php |
311 | 311 | unset ( $error ); |
@@ -313,14 +313,14 @@ discard block |
||
313 | 313 | ?> |
314 | 314 | |
315 | 315 | <p> |
316 | - <label for="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>"><?php esc_html_e('Select a View', 'gravityview'); ?></label> |
|
316 | + <label for="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>"><?php esc_html_e( 'Select a View', 'gravityview' ); ?></label> |
|
317 | 317 | <select class="widefat gv-recent-entries-select-view" name="<?php echo esc_attr( $this->get_field_name( 'view_id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>"> |
318 | 318 | <option value=""><?php esc_html_e( '— Select a View as Entries Source —', 'gravityview' ); ?></option> |
319 | 319 | <?php |
320 | 320 | |
321 | - foreach( $views as $view ) { |
|
322 | - $title = empty( $view->post_title ) ? __('(no title)', 'gravityview') : $view->post_title; |
|
323 | - echo '<option value="'. $view->ID .'"'.selected( absint( $instance['view_id'] ), $view->ID ).'>'. esc_html( sprintf('%s #%d', $title, $view->ID ) ) .'</option>'; |
|
321 | + foreach ( $views as $view ) { |
|
322 | + $title = empty( $view->post_title ) ? __( '(no title)', 'gravityview' ) : $view->post_title; |
|
323 | + echo '<option value="' . $view->ID . '"' . selected( absint( $instance[ 'view_id' ] ), $view->ID ) . '>' . esc_html( sprintf( '%s #%d', $title, $view->ID ) ) . '</option>'; |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | ?> |
@@ -332,10 +332,10 @@ discard block |
||
332 | 332 | * Display errors generated for invalid embed IDs |
333 | 333 | * @see GravityView_View_Data::is_valid_embed_id |
334 | 334 | */ |
335 | - if( !empty( $instance['error_post_id'] ) ) { |
|
335 | + if ( ! empty( $instance[ 'error_post_id' ] ) ) { |
|
336 | 336 | ?> |
337 | 337 | <div class="error inline"> |
338 | - <p><?php echo $instance['error_post_id']; ?></p> |
|
338 | + <p><?php echo $instance[ 'error_post_id' ]; ?></p> |
|
339 | 339 | </div> |
340 | 340 | <?php |
341 | 341 | unset ( $error ); |
@@ -343,11 +343,11 @@ discard block |
||
343 | 343 | ?> |
344 | 344 | |
345 | 345 | <p> |
346 | - <label for="<?php echo $this->get_field_id('post_id'); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label> |
|
347 | - <input class="code" size="3" id="<?php echo $this->get_field_id('post_id'); ?>" name="<?php echo $this->get_field_name('post_id'); ?>" type="text" value="<?php echo esc_attr( $instance['post_id'] ); ?>" /> |
|
346 | + <label for="<?php echo $this->get_field_id( 'post_id' ); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label> |
|
347 | + <input class="code" size="3" id="<?php echo $this->get_field_id( 'post_id' ); ?>" name="<?php echo $this->get_field_name( 'post_id' ); ?>" type="text" value="<?php echo esc_attr( $instance[ 'post_id' ] ); ?>" /> |
|
348 | 348 | <span class="howto"><?php |
349 | - esc_html_e('To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' ); |
|
350 | - echo ' '.gravityview_get_link('http://docs.gravityview.co/article/222-the-search-widget', __('Learn more…', 'gravityview' ), 'target=_blank' ); |
|
349 | + esc_html_e( 'To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' ); |
|
350 | + echo ' ' . gravityview_get_link( 'http://docs.gravityview.co/article/222-the-search-widget', __( 'Learn more…', 'gravityview' ), 'target=_blank' ); |
|
351 | 351 | ?></span> |
352 | 352 | </p> |
353 | 353 | |
@@ -355,21 +355,21 @@ discard block |
||
355 | 355 | <label for="<?php echo $this->get_field_id( 'limit' ); ?>"> |
356 | 356 | <span><?php _e( 'Number of entries to show:', 'gravityview' ); ?></span> |
357 | 357 | </label> |
358 | - <input class="code" id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="number" value="<?php echo intval( $instance['limit'] ); ?>" size="3" /> |
|
358 | + <input class="code" id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="number" value="<?php echo intval( $instance[ 'limit' ] ); ?>" size="3" /> |
|
359 | 359 | </p> |
360 | 360 | |
361 | 361 | <p> |
362 | 362 | <label for="<?php echo $this->get_field_id( 'link_format' ); ?>"> |
363 | 363 | <span><?php _e( 'Entry link text (required)', 'gravityview' ); ?></span> |
364 | 364 | </label> |
365 | - <input id="<?php echo $this->get_field_id( 'link_format' ); ?>" name="<?php echo $this->get_field_name( 'link_format' ); ?>" type="text" value="<?php echo esc_attr( $instance['link_format'] ); ?>" class="widefat merge-tag-support mt-position-right mt-hide_all_fields" /> |
|
365 | + <input id="<?php echo $this->get_field_id( 'link_format' ); ?>" name="<?php echo $this->get_field_name( 'link_format' ); ?>" type="text" value="<?php echo esc_attr( $instance[ 'link_format' ] ); ?>" class="widefat merge-tag-support mt-position-right mt-hide_all_fields" /> |
|
366 | 366 | </p> |
367 | 367 | |
368 | 368 | <p> |
369 | 369 | <label for="<?php echo $this->get_field_id( 'after_link' ); ?>"> |
370 | 370 | <span><?php _e( 'Text or HTML to display after the link (optional)', 'gravityview' ); ?></span> |
371 | 371 | </label> |
372 | - <textarea id="<?php echo $this->get_field_id( 'after_link' ); ?>" name="<?php echo $this->get_field_name( 'after_link' ); ?>" rows="5" class="widefat code merge-tag-support mt-position-right mt-hide_all_fields"><?php echo esc_textarea( $instance['after_link'] ); ?></textarea> |
|
372 | + <textarea id="<?php echo $this->get_field_id( 'after_link' ); ?>" name="<?php echo $this->get_field_name( 'after_link' ); ?>" rows="5" class="widefat code merge-tag-support mt-position-right mt-hide_all_fields"><?php echo esc_textarea( $instance[ 'after_link' ] ); ?></textarea> |
|
373 | 373 | </p> |
374 | 374 | |
375 | 375 | <?php |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | * @param GravityView_Recent_Entries_Widget $this WP_Widget object |
380 | 380 | * @param array $instance Current widget instance |
381 | 381 | */ |
382 | - do_action( 'gravityview_recent_entries_widget_form' , $this, $instance ); |
|
382 | + do_action( 'gravityview_recent_entries_widget_form', $this, $instance ); |
|
383 | 383 | |
384 | 384 | ?> |
385 | 385 |
@@ -23,7 +23,7 @@ |
||
23 | 23 | */ |
24 | 24 | protected $script_handles = array( |
25 | 25 | 'rcp-admin-scripts', |
26 | - 'bbq', |
|
26 | + 'bbq', |
|
27 | 27 | ); |
28 | 28 | |
29 | 29 | /** |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | |
137 | 137 | if( empty( $connected_views ) ) { |
138 | 138 | |
139 | - $menu_items['gravityview'] = array( |
|
139 | + $menu_items['gravityview'] = array( |
|
140 | 140 | 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
141 | 141 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
142 | 142 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
@@ -167,13 +167,13 @@ discard block |
||
167 | 167 | // If there were no items added, then let's create the parent menu |
168 | 168 | if( $sub_menu_items ) { |
169 | 169 | |
170 | - $sub_menu_items[] = array( |
|
171 | - 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
|
172 | - 'link_class' => 'gv-create-view', |
|
173 | - 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
|
174 | - 'url' => admin_url( 'post-new.php?post_type=gravityview&form_id=' . $id ), |
|
175 | - 'capabilities' => array( 'edit_gravityviews' ), |
|
176 | - ); |
|
170 | + $sub_menu_items[] = array( |
|
171 | + 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
|
172 | + 'link_class' => 'gv-create-view', |
|
173 | + 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
|
174 | + 'url' => admin_url( 'post-new.php?post_type=gravityview&form_id=' . $id ), |
|
175 | + 'capabilities' => array( 'edit_gravityviews' ), |
|
176 | + ); |
|
177 | 177 | |
178 | 178 | // Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown |
179 | 179 | $sub_menu_items[] = array( |
@@ -549,12 +549,12 @@ discard block |
||
549 | 549 | * Render html for displaying available fields based on a Form ID |
550 | 550 | * $blacklist_field_types - contains the field types which are not proper to be shown in a directory. |
551 | 551 | * |
552 | - * @see GravityView_Ajax::get_available_fields_html() Triggers `gravityview_render_available_fields` action |
|
552 | + * @see GravityView_Ajax::get_available_fields_html() Triggers `gravityview_render_available_fields` action |
|
553 | 553 | * @access public |
554 | - * |
|
554 | + * |
|
555 | 555 | * @param int $form Gravity Forms Form ID (default: '') |
556 | 556 | * @param string $context (default: 'single') |
557 | - * |
|
557 | + * |
|
558 | 558 | * @return void |
559 | 559 | */ |
560 | 560 | function render_available_fields( $form = 0, $context = 'single' ) { |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | |
569 | 569 | if ( ! is_array( $blacklist_field_types ) ) { |
570 | 570 | |
571 | - do_action( 'gravityview_log_error', __METHOD__ . ': $blacklist_field_types is not an array', print_r( $blacklist_field_types, true ) ); |
|
571 | + do_action( 'gravityview_log_error', __METHOD__ . ': $blacklist_field_types is not an array', print_r( $blacklist_field_types, true ) ); |
|
572 | 572 | |
573 | 573 | $blacklist_field_types = array(); |
574 | 574 | } |
@@ -700,12 +700,12 @@ discard block |
||
700 | 700 | /** |
701 | 701 | * @since 1.7.2 |
702 | 702 | */ |
703 | - 'other_entries' => array( |
|
704 | - 'label' => __('Other Entries', 'gravityview'), |
|
705 | - 'type' => 'other_entries', |
|
706 | - 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
707 | - ), |
|
708 | - ); |
|
703 | + 'other_entries' => array( |
|
704 | + 'label' => __('Other Entries', 'gravityview'), |
|
705 | + 'type' => 'other_entries', |
|
706 | + 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
707 | + ), |
|
708 | + ); |
|
709 | 709 | |
710 | 710 | if( 'single' !== $zone) { |
711 | 711 | |
@@ -1016,59 +1016,59 @@ discard block |
||
1016 | 1016 | |
1017 | 1017 | // Don't process any scripts below here if it's not a GravityView page. |
1018 | 1018 | if( ! gravityview_is_admin_page( $hook, 'single' ) && ! $is_widgets_page ) { |
1019 | - return; |
|
1019 | + return; |
|
1020 | 1020 | } |
1021 | 1021 | |
1022 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
1023 | - wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), GravityView_Plugin::version ); |
|
1024 | - |
|
1025 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
1026 | - |
|
1027 | - //enqueue scripts |
|
1028 | - wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), GravityView_Plugin::version ); |
|
1029 | - |
|
1030 | - wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
1031 | - 'cookiepath' => COOKIEPATH, |
|
1032 | - 'passed_form_id' => (bool) rgget( 'form_id' ), |
|
1033 | - 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
|
1034 | - 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
|
1035 | - 'label_close' => __( 'Close', 'gravityview' ), |
|
1036 | - 'label_cancel' => __( 'Cancel', 'gravityview' ), |
|
1037 | - 'label_continue' => __( 'Continue', 'gravityview' ), |
|
1038 | - 'label_ok' => __( 'Ok', 'gravityview' ), |
|
1039 | - 'label_publisherror' => __( 'Error while creating the View for you. Check the settings or contact GravityView support.', 'gravityview' ), |
|
1040 | - 'loading_text' => esc_html__( 'Loading…', 'gravityview' ), |
|
1041 | - 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
|
1042 | - 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
|
1043 | - 'remove_all_fields' => __( 'Would you like to remove all fields in this zone? (You are seeing this message because you were holding down the ALT key)', 'gravityview' ), |
|
1044 | - )); |
|
1045 | - |
|
1046 | - wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array('dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
1047 | - |
|
1048 | - // Enqueue scripts needed for merge tags |
|
1049 | - self::enqueue_gravity_forms_scripts(); |
|
1022 | + wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
1023 | + wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), GravityView_Plugin::version ); |
|
1024 | + |
|
1025 | + $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
1026 | + |
|
1027 | + //enqueue scripts |
|
1028 | + wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), GravityView_Plugin::version ); |
|
1029 | + |
|
1030 | + wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
1031 | + 'cookiepath' => COOKIEPATH, |
|
1032 | + 'passed_form_id' => (bool) rgget( 'form_id' ), |
|
1033 | + 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
|
1034 | + 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
|
1035 | + 'label_close' => __( 'Close', 'gravityview' ), |
|
1036 | + 'label_cancel' => __( 'Cancel', 'gravityview' ), |
|
1037 | + 'label_continue' => __( 'Continue', 'gravityview' ), |
|
1038 | + 'label_ok' => __( 'Ok', 'gravityview' ), |
|
1039 | + 'label_publisherror' => __( 'Error while creating the View for you. Check the settings or contact GravityView support.', 'gravityview' ), |
|
1040 | + 'loading_text' => esc_html__( 'Loading…', 'gravityview' ), |
|
1041 | + 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
|
1042 | + 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
|
1043 | + 'remove_all_fields' => __( 'Would you like to remove all fields in this zone? (You are seeing this message because you were holding down the ALT key)', 'gravityview' ), |
|
1044 | + )); |
|
1045 | + |
|
1046 | + wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array('dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
1047 | + |
|
1048 | + // Enqueue scripts needed for merge tags |
|
1049 | + self::enqueue_gravity_forms_scripts(); |
|
1050 | 1050 | } |
1051 | 1051 | |
1052 | 1052 | /** |
1053 | 1053 | * Enqueue Gravity Forms scripts, needed for Merge Tags |
1054 | - * |
|
1055 | - * @since 1.0.5-beta |
|
1056 | - * |
|
1057 | - * @return void |
|
1054 | + * |
|
1055 | + * @since 1.0.5-beta |
|
1056 | + * |
|
1057 | + * @return void |
|
1058 | 1058 | */ |
1059 | 1059 | static function enqueue_gravity_forms_scripts() { |
1060 | 1060 | GFForms::register_scripts(); |
1061 | 1061 | |
1062 | 1062 | $scripts = array( |
1063 | - 'sack', |
|
1064 | - 'gform_gravityforms', |
|
1065 | - 'gform_forms', |
|
1066 | - 'gform_form_admin', |
|
1067 | - 'jquery-ui-autocomplete' |
|
1063 | + 'sack', |
|
1064 | + 'gform_gravityforms', |
|
1065 | + 'gform_forms', |
|
1066 | + 'gform_form_admin', |
|
1067 | + 'jquery-ui-autocomplete' |
|
1068 | 1068 | ); |
1069 | 1069 | |
1070 | 1070 | if ( wp_is_mobile() ) { |
1071 | - $scripts[] = 'jquery-touch-punch'; |
|
1071 | + $scripts[] = 'jquery-touch-punch'; |
|
1072 | 1072 | } |
1073 | 1073 | |
1074 | 1074 | wp_enqueue_script( $scripts ); |
@@ -28,30 +28,30 @@ discard block |
||
28 | 28 | add_filter( 'gravityview_blacklist_field_types', array( $this, 'default_field_blacklist' ), 10, 2 ); |
29 | 29 | |
30 | 30 | // Tooltips |
31 | - add_filter( 'gform_tooltips', array( $this, 'tooltips') ); |
|
31 | + add_filter( 'gform_tooltips', array( $this, 'tooltips' ) ); |
|
32 | 32 | |
33 | 33 | // adding styles and scripts |
34 | - add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles'), 999 ); |
|
35 | - add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
36 | - add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
37 | - add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
38 | - add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
39 | - |
|
40 | - add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas'), 10, 4 ); |
|
41 | - add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas'), 10, 3 ); |
|
42 | - add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields'), 10, 2 ); |
|
43 | - add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets') ); |
|
44 | - add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas'), 10, 5 ); |
|
34 | + add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles' ), 999 ); |
|
35 | + add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
36 | + add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
37 | + add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
38 | + add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
39 | + |
|
40 | + add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas' ), 10, 4 ); |
|
41 | + add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas' ), 10, 3 ); |
|
42 | + add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields' ), 10, 2 ); |
|
43 | + add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets' ) ); |
|
44 | + add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas' ), 10, 5 ); |
|
45 | 45 | |
46 | 46 | // @todo check if this hook is needed.. |
47 | 47 | //add_action( 'gravityview_render_field_options', array( $this, 'render_field_options'), 10, 9 ); |
48 | 48 | |
49 | 49 | // Add Connected Form column |
50 | - add_filter('manage_gravityview_posts_columns' , array( $this, 'add_post_type_columns' ) ); |
|
50 | + add_filter( 'manage_gravityview_posts_columns', array( $this, 'add_post_type_columns' ) ); |
|
51 | 51 | |
52 | 52 | add_filter( 'gform_toolbar_menu', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 ); |
53 | 53 | |
54 | - add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content'), 10, 2 ); |
|
54 | + add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content' ), 10, 2 ); |
|
55 | 55 | |
56 | 56 | add_action( 'restrict_manage_posts', array( $this, 'add_view_dropdown' ) ); |
57 | 57 | |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | public function filter_pre_get_posts_by_gravityview_form_id( &$query ) { |
67 | 67 | global $pagenow; |
68 | 68 | |
69 | - if ( !is_admin() ) { |
|
69 | + if ( ! is_admin() ) { |
|
70 | 70 | return; |
71 | 71 | } |
72 | 72 | |
73 | - if( 'edit.php' !== $pagenow || ! rgget( 'gravityview_form_id' ) || ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
73 | + if ( 'edit.php' !== $pagenow || ! rgget( 'gravityview_form_id' ) || ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
74 | 74 | return; |
75 | 75 | } |
76 | 76 | |
@@ -87,18 +87,18 @@ discard block |
||
87 | 87 | function add_view_dropdown() { |
88 | 88 | $current_screen = get_current_screen(); |
89 | 89 | |
90 | - if( 'gravityview' !== $current_screen->post_type ) { |
|
90 | + if ( 'gravityview' !== $current_screen->post_type ) { |
|
91 | 91 | return; |
92 | 92 | } |
93 | 93 | |
94 | 94 | $forms = gravityview_get_forms(); |
95 | 95 | $current_form = rgget( 'gravityview_form_id' ); |
96 | 96 | // If there are no forms to select, show no forms. |
97 | - if( !empty( $forms ) ) { ?> |
|
97 | + if ( ! empty( $forms ) ) { ?> |
|
98 | 98 | <select name="gravityview_form_id" id="gravityview_form_id"> |
99 | 99 | <option value="" <?php selected( '', $current_form, true ); ?>><?php esc_html_e( 'All forms', 'gravityview' ); ?></option> |
100 | - <?php foreach( $forms as $form ) { ?> |
|
101 | - <option value="<?php echo $form['id']; ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option> |
|
100 | + <?php foreach ( $forms as $form ) { ?> |
|
101 | + <option value="<?php echo $form[ 'id' ]; ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option> |
|
102 | 102 | <?php } ?> |
103 | 103 | </select> |
104 | 104 | <?php } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) { |
113 | 113 | _deprecated_function( 'GravityView_Admin_Views::render_setting_row', '1.1.7', 'GravityView_Render_Settings::render_setting_row' ); |
114 | - GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name , $id ); |
|
114 | + GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name, $id ); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -134,9 +134,9 @@ discard block |
||
134 | 134 | |
135 | 135 | $connected_views = gravityview_get_connected_views( $id ); |
136 | 136 | |
137 | - if( empty( $connected_views ) ) { |
|
137 | + if ( empty( $connected_views ) ) { |
|
138 | 138 | |
139 | - $menu_items['gravityview'] = array( |
|
139 | + $menu_items[ 'gravityview' ] = array( |
|
140 | 140 | 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
141 | 141 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
142 | 142 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
@@ -152,22 +152,22 @@ discard block |
||
152 | 152 | $sub_menu_items = array(); |
153 | 153 | foreach ( (array)$connected_views as $view ) { |
154 | 154 | |
155 | - if( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
155 | + if ( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
156 | 156 | continue; |
157 | 157 | } |
158 | 158 | |
159 | - $label = empty( $view->post_title ) ? sprintf( __('No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
159 | + $label = empty( $view->post_title ) ? sprintf( __( 'No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
160 | 160 | |
161 | - $sub_menu_items[] = array( |
|
161 | + $sub_menu_items[ ] = array( |
|
162 | 162 | 'label' => esc_attr( $label ), |
163 | - 'url' => admin_url( 'post.php?action=edit&post='.$view->ID ), |
|
163 | + 'url' => admin_url( 'post.php?action=edit&post=' . $view->ID ), |
|
164 | 164 | ); |
165 | 165 | } |
166 | 166 | |
167 | 167 | // If there were no items added, then let's create the parent menu |
168 | - if( $sub_menu_items ) { |
|
168 | + if ( $sub_menu_items ) { |
|
169 | 169 | |
170 | - $sub_menu_items[] = array( |
|
170 | + $sub_menu_items[ ] = array( |
|
171 | 171 | 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
172 | 172 | 'link_class' => 'gv-create-view', |
173 | 173 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
@@ -176,14 +176,14 @@ discard block |
||
176 | 176 | ); |
177 | 177 | |
178 | 178 | // Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown |
179 | - $sub_menu_items[] = array( |
|
179 | + $sub_menu_items[ ] = array( |
|
180 | 180 | 'url' => '#', |
181 | 181 | 'label' => '', |
182 | 182 | 'menu_class' => 'hidden', |
183 | 183 | 'capabilities' => '', |
184 | 184 | ); |
185 | 185 | |
186 | - $menu_items['gravityview'] = array( |
|
186 | + $menu_items[ 'gravityview' ] = array( |
|
187 | 187 | 'label' => __( 'Connected Views', 'gravityview' ), |
188 | 188 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
189 | 189 | 'title' => __( 'GravityView Views using this form as a data source', 'gravityview' ), |
@@ -212,8 +212,8 @@ discard block |
||
212 | 212 | $add = array( 'captcha', 'page' ); |
213 | 213 | |
214 | 214 | // Don't allowing editing the following values: |
215 | - if( $context === 'edit' ) { |
|
216 | - $add[] = 'post_id'; |
|
215 | + if ( $context === 'edit' ) { |
|
216 | + $add[ ] = 'post_id'; |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | $return = array_merge( $array, $add ); |
@@ -236,32 +236,32 @@ discard block |
||
236 | 236 | foreach ( $default_args as $key => $arg ) { |
237 | 237 | |
238 | 238 | // If an arg has `tooltip` defined, but it's false, don't display a tooltip |
239 | - if( isset( $arg['tooltip'] ) && empty( $arg['tooltip'] ) ) { continue; } |
|
239 | + if ( isset( $arg[ 'tooltip' ] ) && empty( $arg[ 'tooltip' ] ) ) { continue; } |
|
240 | 240 | |
241 | 241 | // By default, use `tooltip` if defined. |
242 | - $tooltip = empty( $arg['tooltip'] ) ? NULL : $arg['tooltip']; |
|
242 | + $tooltip = empty( $arg[ 'tooltip' ] ) ? NULL : $arg[ 'tooltip' ]; |
|
243 | 243 | |
244 | 244 | // Otherwise, use the description as a tooltip. |
245 | - if( empty( $tooltip ) && !empty( $arg['desc'] ) ) { |
|
246 | - $tooltip = $arg['desc']; |
|
245 | + if ( empty( $tooltip ) && ! empty( $arg[ 'desc' ] ) ) { |
|
246 | + $tooltip = $arg[ 'desc' ]; |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | // If there's no tooltip set, continue |
250 | - if( empty( $tooltip ) ) { |
|
250 | + if ( empty( $tooltip ) ) { |
|
251 | 251 | continue; |
252 | 252 | } |
253 | 253 | |
254 | 254 | // Add the tooltip |
255 | - $gv_tooltips[ 'gv_'.$key ] = array( |
|
256 | - 'title' => $arg['label'], |
|
255 | + $gv_tooltips[ 'gv_' . $key ] = array( |
|
256 | + 'title' => $arg[ 'label' ], |
|
257 | 257 | 'value' => $tooltip, |
258 | 258 | ); |
259 | 259 | |
260 | 260 | } |
261 | 261 | |
262 | - $gv_tooltips['gv_css_merge_tags'] = array( |
|
263 | - 'title' => __('CSS Merge Tags', 'gravityview'), |
|
264 | - 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview'), '<code>', '</code>' ) |
|
262 | + $gv_tooltips[ 'gv_css_merge_tags' ] = array( |
|
263 | + 'title' => __( 'CSS Merge Tags', 'gravityview' ), |
|
264 | + 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview' ), '<code>', '</code>' ) |
|
265 | 265 | ); |
266 | 266 | |
267 | 267 | /** |
@@ -272,9 +272,9 @@ discard block |
||
272 | 272 | |
273 | 273 | foreach ( $gv_tooltips as $key => $tooltip ) { |
274 | 274 | |
275 | - $title = empty( $tooltip['title'] ) ? '' : '<h6>'.esc_html( $tooltip['title'] ) .'</h6>'; |
|
275 | + $title = empty( $tooltip[ 'title' ] ) ? '' : '<h6>' . esc_html( $tooltip[ 'title' ] ) . '</h6>'; |
|
276 | 276 | |
277 | - $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip['value'] ) ); |
|
277 | + $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip[ 'value' ] ) ); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | return $tooltips; |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | * |
289 | 289 | * @return void |
290 | 290 | */ |
291 | - public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
291 | + public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
292 | 292 | |
293 | 293 | $output = ''; |
294 | 294 | |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | // Generate backup if label doesn't exist: `example_name` => `Example Name` |
311 | 311 | $template_id_pretty = ucwords( implode( ' ', explode( '_', $template_id ) ) ); |
312 | 312 | |
313 | - $output = $template ? $template['label'] : $template_id_pretty; |
|
313 | + $output = $template ? $template[ 'label' ] : $template_id_pretty; |
|
314 | 314 | |
315 | 315 | break; |
316 | 316 | |
@@ -351,44 +351,44 @@ discard block |
||
351 | 351 | static public function get_connected_form_links( $form, $include_form_link = true ) { |
352 | 352 | |
353 | 353 | // Either the form is empty or the form ID is 0, not yet set. |
354 | - if( empty( $form ) ) { |
|
354 | + if ( empty( $form ) ) { |
|
355 | 355 | return ''; |
356 | 356 | } |
357 | 357 | |
358 | 358 | // The $form is passed as the form ID |
359 | - if( !is_array( $form ) ) { |
|
359 | + if ( ! is_array( $form ) ) { |
|
360 | 360 | $form = gravityview_get_form( $form ); |
361 | 361 | } |
362 | 362 | |
363 | - $form_id = $form['id']; |
|
363 | + $form_id = $form[ 'id' ]; |
|
364 | 364 | $links = array(); |
365 | 365 | |
366 | - if( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
366 | + if ( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
367 | 367 | $form_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&id=%d', $form_id ) ); |
368 | - $form_link = '<strong class="gv-form-title">'.gravityview_get_link( $form_url, $form['title'], 'class=row-title' ).'</strong>'; |
|
369 | - $links[] = '<span>'.gravityview_get_link( $form_url, __('Edit Form', 'gravityview') ).'</span>'; |
|
368 | + $form_link = '<strong class="gv-form-title">' . gravityview_get_link( $form_url, $form[ 'title' ], 'class=row-title' ) . '</strong>'; |
|
369 | + $links[ ] = '<span>' . gravityview_get_link( $form_url, __( 'Edit Form', 'gravityview' ) ) . '</span>'; |
|
370 | 370 | } else { |
371 | - $form_link = '<strong class="gv-form-title">'. esc_html( $form['title'] ). '</strong>'; |
|
371 | + $form_link = '<strong class="gv-form-title">' . esc_html( $form[ 'title' ] ) . '</strong>'; |
|
372 | 372 | } |
373 | 373 | |
374 | - if( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
374 | + if ( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
375 | 375 | $entries_url = admin_url( sprintf( 'admin.php?page=gf_entries&id=%d', $form_id ) ); |
376 | - $links[] = '<span>'.gravityview_get_link( $entries_url, __('Entries', 'gravityview') ).'</span>'; |
|
376 | + $links[ ] = '<span>' . gravityview_get_link( $entries_url, __( 'Entries', 'gravityview' ) ) . '</span>'; |
|
377 | 377 | } |
378 | 378 | |
379 | - if( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
379 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
380 | 380 | $settings_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&view=settings&id=%d', $form_id ) ); |
381 | - $links[] = '<span>'.gravityview_get_link( $settings_url, __('Settings', 'gravityview'), 'title='.__('Edit settings for this form', 'gravityview') ).'</span>'; |
|
381 | + $links[ ] = '<span>' . gravityview_get_link( $settings_url, __( 'Settings', 'gravityview' ), 'title=' . __( 'Edit settings for this form', 'gravityview' ) ) . '</span>'; |
|
382 | 382 | } |
383 | 383 | |
384 | - if( GVCommon::has_cap( array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms") ) ) { |
|
384 | + if ( GVCommon::has_cap( array( "gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms" ) ) ) { |
|
385 | 385 | $preview_url = site_url( sprintf( '?gf_page=preview&id=%d', $form_id ) ); |
386 | - $links[] = '<span>'.gravityview_get_link( $preview_url, __('Preview Form', 'gravityview'), 'title='.__('Preview this form', 'gravityview') ).'</span>'; |
|
386 | + $links[ ] = '<span>' . gravityview_get_link( $preview_url, __( 'Preview Form', 'gravityview' ), 'title=' . __( 'Preview this form', 'gravityview' ) ) . '</span>'; |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | $output = ''; |
390 | 390 | |
391 | - if( !empty( $include_form_link ) ) { |
|
391 | + if ( ! empty( $include_form_link ) ) { |
|
392 | 392 | $output .= $form_link; |
393 | 393 | } |
394 | 394 | |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | */ |
401 | 401 | $links = apply_filters( 'gravityview_connected_form_links', $links, $form ); |
402 | 402 | |
403 | - $output .= '<div class="row-actions">'. implode( ' | ', $links ) .'</div>'; |
|
403 | + $output .= '<div class="row-actions">' . implode( ' | ', $links ) . '</div>'; |
|
404 | 404 | |
405 | 405 | return $output; |
406 | 406 | } |
@@ -414,8 +414,8 @@ discard block |
||
414 | 414 | // Get the date column and save it for later to add back in. |
415 | 415 | // This adds it after the Data Source column. |
416 | 416 | // This way, we don't need to do array_slice, array_merge, etc. |
417 | - $date = $columns['date']; |
|
418 | - unset( $columns['date'] ); |
|
417 | + $date = $columns[ 'date' ]; |
|
418 | + unset( $columns[ 'date' ] ); |
|
419 | 419 | |
420 | 420 | $data_source_required_caps = array( |
421 | 421 | 'gravityforms_edit_forms', |
@@ -426,14 +426,14 @@ discard block |
||
426 | 426 | 'gravityforms_preview_forms', |
427 | 427 | ); |
428 | 428 | |
429 | - if( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
430 | - $columns['gv_connected_form'] = __( 'Data Source', 'gravityview' ); |
|
429 | + if ( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
430 | + $columns[ 'gv_connected_form' ] = __( 'Data Source', 'gravityview' ); |
|
431 | 431 | } |
432 | 432 | |
433 | - $columns['gv_template'] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
433 | + $columns[ 'gv_template' ] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
434 | 434 | |
435 | 435 | // Add the date back in. |
436 | - $columns['date'] = $date; |
|
436 | + $columns[ 'date' ] = $date; |
|
437 | 437 | |
438 | 438 | return $columns; |
439 | 439 | } |
@@ -447,12 +447,12 @@ discard block |
||
447 | 447 | */ |
448 | 448 | function save_postdata( $post_id ) { |
449 | 449 | |
450 | - if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){ |
|
450 | + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
451 | 451 | return; |
452 | 452 | } |
453 | 453 | |
454 | 454 | // validate post_type |
455 | - if ( ! isset( $_POST['post_type'] ) || 'gravityview' != $_POST['post_type'] ) { |
|
455 | + if ( ! isset( $_POST[ 'post_type' ] ) || 'gravityview' != $_POST[ 'post_type' ] ) { |
|
456 | 456 | return; |
457 | 457 | } |
458 | 458 | |
@@ -467,63 +467,63 @@ discard block |
||
467 | 467 | $statii = array(); |
468 | 468 | |
469 | 469 | // check if this is a start fresh View |
470 | - if ( isset( $_POST['gravityview_select_form_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_form_nonce'], 'gravityview_select_form' ) ) { |
|
470 | + if ( isset( $_POST[ 'gravityview_select_form_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_form_nonce' ], 'gravityview_select_form' ) ) { |
|
471 | 471 | |
472 | - $form_id = !empty( $_POST['gravityview_form_id'] ) ? $_POST['gravityview_form_id'] : ''; |
|
472 | + $form_id = ! empty( $_POST[ 'gravityview_form_id' ] ) ? $_POST[ 'gravityview_form_id' ] : ''; |
|
473 | 473 | // save form id |
474 | - $statii['form_id'] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
474 | + $statii[ 'form_id' ] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
475 | 475 | |
476 | 476 | } |
477 | 477 | |
478 | - if( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii['form_id'] ) ) { |
|
478 | + if ( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii[ 'form_id' ] ) ) { |
|
479 | 479 | do_action( 'gravityview_log_error', __METHOD__ . ' - Current user does not have the capability to create a new Form.', wp_get_current_user() ); |
480 | 480 | return; |
481 | 481 | } |
482 | 482 | |
483 | 483 | // Was this a start fresh? |
484 | - if ( ! empty( $_POST['gravityview_form_id_start_fresh'] ) ) { |
|
485 | - $statii['start_fresh'] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
484 | + if ( ! empty( $_POST[ 'gravityview_form_id_start_fresh' ] ) ) { |
|
485 | + $statii[ 'start_fresh' ] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
486 | 486 | } else { |
487 | - $statii['start_fresh'] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
487 | + $statii[ 'start_fresh' ] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | // Check if we have a template id |
491 | - if ( isset( $_POST['gravityview_select_template_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_template_nonce'], 'gravityview_select_template' ) ) { |
|
491 | + if ( isset( $_POST[ 'gravityview_select_template_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_template_nonce' ], 'gravityview_select_template' ) ) { |
|
492 | 492 | |
493 | - $template_id = !empty( $_POST['gravityview_directory_template'] ) ? $_POST['gravityview_directory_template'] : ''; |
|
493 | + $template_id = ! empty( $_POST[ 'gravityview_directory_template' ] ) ? $_POST[ 'gravityview_directory_template' ] : ''; |
|
494 | 494 | |
495 | 495 | // now save template id |
496 | - $statii['directory_template'] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
496 | + $statii[ 'directory_template' ] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
497 | 497 | } |
498 | 498 | |
499 | 499 | |
500 | 500 | // save View Configuration metabox |
501 | - if ( isset( $_POST['gravityview_view_configuration_nonce'] ) && wp_verify_nonce( $_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration' ) ) { |
|
501 | + if ( isset( $_POST[ 'gravityview_view_configuration_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_view_configuration_nonce' ], 'gravityview_view_configuration' ) ) { |
|
502 | 502 | |
503 | 503 | // template settings |
504 | - if( empty( $_POST['template_settings'] ) ) { |
|
505 | - $_POST['template_settings'] = array(); |
|
504 | + if ( empty( $_POST[ 'template_settings' ] ) ) { |
|
505 | + $_POST[ 'template_settings' ] = array(); |
|
506 | 506 | } |
507 | - $statii['template_settings'] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST['template_settings'] ); |
|
507 | + $statii[ 'template_settings' ] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST[ 'template_settings' ] ); |
|
508 | 508 | |
509 | 509 | $fields = array(); |
510 | 510 | |
511 | 511 | // Directory&single Visible Fields |
512 | - if( !empty( $preset_fields ) ) { |
|
512 | + if ( ! empty( $preset_fields ) ) { |
|
513 | 513 | |
514 | 514 | $fields = $preset_fields; |
515 | 515 | |
516 | - } elseif( !empty( $_POST['gv_fields'] ) ) { |
|
516 | + } elseif ( ! empty( $_POST[ 'gv_fields' ] ) ) { |
|
517 | 517 | $fields = _gravityview_process_posted_fields(); |
518 | 518 | } |
519 | 519 | |
520 | - $statii['directory_fields'] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
520 | + $statii[ 'directory_fields' ] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
521 | 521 | |
522 | 522 | // Directory Visible Widgets |
523 | - if( empty( $_POST['widgets'] ) ) { |
|
524 | - $_POST['widgets'] = array(); |
|
523 | + if ( empty( $_POST[ 'widgets' ] ) ) { |
|
524 | + $_POST[ 'widgets' ] = array(); |
|
525 | 525 | } |
526 | - $statii['directory_widgets'] = gravityview_set_directory_widgets( $post_id, $_POST['widgets'] ); |
|
526 | + $statii[ 'directory_widgets' ] = gravityview_set_directory_widgets( $post_id, $_POST[ 'widgets' ] ); |
|
527 | 527 | |
528 | 528 | } // end save view configuration |
529 | 529 | |
@@ -533,9 +533,9 @@ discard block |
||
533 | 533 | * @param array $statii Array of statuses of the post meta saving processes. If saving worked, each key should be mapped to a value of the post ID (`directory_widgets` => `124`). If failed (or didn't change), the value will be false. |
534 | 534 | * @since 1.17.2 |
535 | 535 | */ |
536 | - do_action('gravityview_view_saved', $post_id, $statii ); |
|
536 | + do_action( 'gravityview_view_saved', $post_id, $statii ); |
|
537 | 537 | |
538 | - do_action('gravityview_log_debug', '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array_map( 'intval', $statii ) ); |
|
538 | + do_action( 'gravityview_log_debug', '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array_map( 'intval', $statii ) ); |
|
539 | 539 | } |
540 | 540 | |
541 | 541 | /** |
@@ -577,20 +577,20 @@ discard block |
||
577 | 577 | |
578 | 578 | $output = ''; |
579 | 579 | |
580 | - if( !empty( $fields ) ) { |
|
580 | + if ( ! empty( $fields ) ) { |
|
581 | 581 | |
582 | - foreach( $fields as $id => $details ) { |
|
582 | + foreach ( $fields as $id => $details ) { |
|
583 | 583 | |
584 | - if( in_array( $details['type'], (array) $blacklist_field_types ) ) { |
|
584 | + if ( in_array( $details[ 'type' ], (array)$blacklist_field_types ) ) { |
|
585 | 585 | continue; |
586 | 586 | } |
587 | 587 | |
588 | 588 | // Edit mode only allows editing the parent fields, not single inputs. |
589 | - if( $context === 'edit' && !empty( $details['parent'] ) ) { |
|
589 | + if ( $context === 'edit' && ! empty( $details[ 'parent' ] ) ) { |
|
590 | 590 | continue; |
591 | 591 | } |
592 | 592 | |
593 | - $output .= new GravityView_Admin_View_Field( $details['label'], $id, $details ); |
|
593 | + $output .= new GravityView_Admin_View_Field( $details[ 'label' ], $id, $details ); |
|
594 | 594 | |
595 | 595 | } // End foreach |
596 | 596 | } |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | echo $output; |
599 | 599 | |
600 | 600 | // For the EDIT view we only want to allow the form fields. |
601 | - if( $context === 'edit' ) { |
|
601 | + if ( $context === 'edit' ) { |
|
602 | 602 | return; |
603 | 603 | } |
604 | 604 | |
@@ -622,16 +622,16 @@ discard block |
||
622 | 622 | $additional_fields = apply_filters( 'gravityview_additional_fields', array( |
623 | 623 | array( |
624 | 624 | 'label_text' => __( '+ Add All Fields', 'gravityview' ), |
625 | - 'desc' => __('Add all the available fields at once.', 'gravityview'), |
|
625 | + 'desc' => __( 'Add all the available fields at once.', 'gravityview' ), |
|
626 | 626 | 'field_id' => 'all-fields', |
627 | 627 | 'label_type' => 'field', |
628 | 628 | 'input_type' => NULL, |
629 | 629 | 'field_options' => NULL, |
630 | 630 | 'settings_html' => NULL, |
631 | 631 | ) |
632 | - )); |
|
632 | + ) ); |
|
633 | 633 | |
634 | - if( !empty( $additional_fields )) { |
|
634 | + if ( ! empty( $additional_fields ) ) { |
|
635 | 635 | foreach ( (array)$additional_fields as $item ) { |
636 | 636 | |
637 | 637 | // Prevent items from not having index set |
@@ -642,16 +642,16 @@ discard block |
||
642 | 642 | 'input_type' => NULL, |
643 | 643 | 'field_options' => NULL, |
644 | 644 | 'settings_html' => NULL, |
645 | - )); |
|
645 | + ) ); |
|
646 | 646 | |
647 | 647 | // Backward compat. |
648 | - if( !empty( $item['field_options'] ) ) { |
|
648 | + if ( ! empty( $item[ 'field_options' ] ) ) { |
|
649 | 649 | // Use settings_html from now on. |
650 | - $item['settings_html'] = $item['field_options']; |
|
650 | + $item[ 'settings_html' ] = $item[ 'field_options' ]; |
|
651 | 651 | } |
652 | 652 | |
653 | 653 | // Render a label for each of them |
654 | - echo new GravityView_Admin_View_Field( $item['label_text'], $item['field_id'], $item ); |
|
654 | + echo new GravityView_Admin_View_Field( $item[ 'label_text' ], $item[ 'field_id' ], $item ); |
|
655 | 655 | |
656 | 656 | } |
657 | 657 | } |
@@ -664,54 +664,54 @@ discard block |
||
664 | 664 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
665 | 665 | * @return array |
666 | 666 | */ |
667 | - function get_entry_default_fields($form, $zone) { |
|
667 | + function get_entry_default_fields( $form, $zone ) { |
|
668 | 668 | |
669 | 669 | $entry_default_fields = array(); |
670 | 670 | |
671 | - if( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
671 | + if ( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
672 | 672 | |
673 | 673 | $entry_default_fields = array( |
674 | 674 | 'id' => array( |
675 | - 'label' => __('Entry ID', 'gravityview'), |
|
675 | + 'label' => __( 'Entry ID', 'gravityview' ), |
|
676 | 676 | 'type' => 'id', |
677 | - 'desc' => __('The unique ID of the entry.', 'gravityview'), |
|
677 | + 'desc' => __( 'The unique ID of the entry.', 'gravityview' ), |
|
678 | 678 | ), |
679 | 679 | 'date_created' => array( |
680 | - 'label' => __('Entry Date', 'gravityview'), |
|
681 | - 'desc' => __('The date the entry was created.', 'gravityview'), |
|
680 | + 'label' => __( 'Entry Date', 'gravityview' ), |
|
681 | + 'desc' => __( 'The date the entry was created.', 'gravityview' ), |
|
682 | 682 | 'type' => 'date_created', |
683 | 683 | ), |
684 | 684 | 'source_url' => array( |
685 | - 'label' => __('Source URL', 'gravityview'), |
|
685 | + 'label' => __( 'Source URL', 'gravityview' ), |
|
686 | 686 | 'type' => 'source_url', |
687 | - 'desc' => __('The URL of the page where the form was submitted.', 'gravityview'), |
|
687 | + 'desc' => __( 'The URL of the page where the form was submitted.', 'gravityview' ), |
|
688 | 688 | ), |
689 | 689 | 'ip' => array( |
690 | - 'label' => __('User IP', 'gravityview'), |
|
690 | + 'label' => __( 'User IP', 'gravityview' ), |
|
691 | 691 | 'type' => 'ip', |
692 | - 'desc' => __('The IP Address of the user who created the entry.', 'gravityview'), |
|
692 | + 'desc' => __( 'The IP Address of the user who created the entry.', 'gravityview' ), |
|
693 | 693 | ), |
694 | 694 | 'created_by' => array( |
695 | - 'label' => __('User', 'gravityview'), |
|
695 | + 'label' => __( 'User', 'gravityview' ), |
|
696 | 696 | 'type' => 'created_by', |
697 | - 'desc' => __('Details of the logged-in user who created the entry (if any).', 'gravityview'), |
|
697 | + 'desc' => __( 'Details of the logged-in user who created the entry (if any).', 'gravityview' ), |
|
698 | 698 | ), |
699 | 699 | |
700 | 700 | /** |
701 | 701 | * @since 1.7.2 |
702 | 702 | */ |
703 | 703 | 'other_entries' => array( |
704 | - 'label' => __('Other Entries', 'gravityview'), |
|
704 | + 'label' => __( 'Other Entries', 'gravityview' ), |
|
705 | 705 | 'type' => 'other_entries', |
706 | - 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
706 | + 'desc' => __( 'Display other entries created by the entry creator.', 'gravityview' ), |
|
707 | 707 | ), |
708 | 708 | ); |
709 | 709 | |
710 | - if( 'single' !== $zone) { |
|
710 | + if ( 'single' !== $zone ) { |
|
711 | 711 | |
712 | - $entry_default_fields['entry_link'] = array( |
|
713 | - 'label' => __('Link to Entry', 'gravityview'), |
|
714 | - 'desc' => __('A dedicated link to the single entry with customizable text.', 'gravityview'), |
|
712 | + $entry_default_fields[ 'entry_link' ] = array( |
|
713 | + 'label' => __( 'Link to Entry', 'gravityview' ), |
|
714 | + 'desc' => __( 'A dedicated link to the single entry with customizable text.', 'gravityview' ), |
|
715 | 715 | 'type' => 'entry_link', |
716 | 716 | ); |
717 | 717 | } |
@@ -721,10 +721,10 @@ discard block |
||
721 | 721 | /** |
722 | 722 | * @since 1.2 |
723 | 723 | */ |
724 | - $entry_default_fields['custom'] = array( |
|
725 | - 'label' => __('Custom Content', 'gravityview'), |
|
724 | + $entry_default_fields[ 'custom' ] = array( |
|
725 | + 'label' => __( 'Custom Content', 'gravityview' ), |
|
726 | 726 | 'type' => 'custom', |
727 | - 'desc' => __('Insert custom text or HTML.', 'gravityview'), |
|
727 | + 'desc' => __( 'Insert custom text or HTML.', 'gravityview' ), |
|
728 | 728 | ); |
729 | 729 | |
730 | 730 | /** |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | * @param string|array $form form_ID or form object |
734 | 734 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
735 | 735 | */ |
736 | - return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone); |
|
736 | + return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone ); |
|
737 | 737 | } |
738 | 738 | |
739 | 739 | /** |
@@ -744,7 +744,7 @@ discard block |
||
744 | 744 | */ |
745 | 745 | function get_available_fields( $form = '', $zone = NULL ) { |
746 | 746 | |
747 | - if( empty( $form ) ) { |
|
747 | + if ( empty( $form ) ) { |
|
748 | 748 | do_action( 'gravityview_log_error', '[get_available_fields] $form is empty' ); |
749 | 749 | return array(); |
750 | 750 | } |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | $fields = gravityview_get_form_fields( $form, true ); |
754 | 754 | |
755 | 755 | // get meta fields ( only if form was already created ) |
756 | - if( !is_array( $form ) ) { |
|
756 | + if ( ! is_array( $form ) ) { |
|
757 | 757 | $meta_fields = gravityview_get_entry_meta( $form ); |
758 | 758 | } else { |
759 | 759 | $meta_fields = array(); |
@@ -777,11 +777,11 @@ discard block |
||
777 | 777 | |
778 | 778 | $widgets = $this->get_registered_widgets(); |
779 | 779 | |
780 | - if( !empty( $widgets ) ) { |
|
780 | + if ( ! empty( $widgets ) ) { |
|
781 | 781 | |
782 | - foreach( $widgets as $id => $details ) { |
|
782 | + foreach ( $widgets as $id => $details ) { |
|
783 | 783 | |
784 | - echo new GravityView_Admin_View_Widget( $details['label'], $id, $details ); |
|
784 | + echo new GravityView_Admin_View_Widget( $details[ 'label' ], $id, $details ); |
|
785 | 785 | |
786 | 786 | } |
787 | 787 | } |
@@ -815,7 +815,7 @@ discard block |
||
815 | 815 | function render_active_areas( $template_id, $type, $zone, $rows, $values ) { |
816 | 816 | global $post; |
817 | 817 | |
818 | - if( $type === 'widget' ) { |
|
818 | + if ( $type === 'widget' ) { |
|
819 | 819 | $button_label = __( 'Add Widget', 'gravityview' ); |
820 | 820 | } else { |
821 | 821 | $button_label = __( 'Add Field', 'gravityview' ); |
@@ -824,15 +824,15 @@ discard block |
||
824 | 824 | $available_items = array(); |
825 | 825 | |
826 | 826 | // if saved values, get available fields to label everyone |
827 | - if( !empty( $values ) && ( !empty( $post->ID ) || !empty( $_POST['template_id'] ) ) ) { |
|
827 | + if ( ! empty( $values ) && ( ! empty( $post->ID ) || ! empty( $_POST[ 'template_id' ] ) ) ) { |
|
828 | 828 | |
829 | - if( !empty( $_POST['template_id'] ) ) { |
|
830 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
829 | + if ( ! empty( $_POST[ 'template_id' ] ) ) { |
|
830 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
831 | 831 | } else { |
832 | 832 | $form = gravityview_get_form_id( $post->ID ); |
833 | 833 | } |
834 | 834 | |
835 | - if( 'field' === $type ) { |
|
835 | + if ( 'field' === $type ) { |
|
836 | 836 | $available_items = $this->get_available_fields( $form, $zone ); |
837 | 837 | } else { |
838 | 838 | $available_items = $this->get_registered_widgets(); |
@@ -840,39 +840,39 @@ discard block |
||
840 | 840 | |
841 | 841 | } |
842 | 842 | |
843 | - foreach( $rows as $row ) : |
|
844 | - foreach( $row as $col => $areas ) : |
|
845 | - $column = ($col == '2-2') ? '1-2' : $col; ?> |
|
843 | + foreach ( $rows as $row ) : |
|
844 | + foreach ( $row as $col => $areas ) : |
|
845 | + $column = ( $col == '2-2' ) ? '1-2' : $col; ?> |
|
846 | 846 | |
847 | 847 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
848 | 848 | |
849 | - <?php foreach( $areas as $area ) : ?> |
|
849 | + <?php foreach ( $areas as $area ) : ?> |
|
850 | 850 | |
851 | 851 | <div class="gv-droppable-area"> |
852 | - <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>"> |
|
852 | + <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>"> |
|
853 | 853 | |
854 | 854 | <?php // render saved fields |
855 | 855 | |
856 | - if( !empty( $values[ $zone .'_'. $area['areaid'] ] ) ) { |
|
856 | + if ( ! empty( $values[ $zone . '_' . $area[ 'areaid' ] ] ) ) { |
|
857 | 857 | |
858 | - foreach( $values[ $zone .'_'. $area['areaid'] ] as $uniqid => $field ) { |
|
858 | + foreach ( $values[ $zone . '_' . $area[ 'areaid' ] ] as $uniqid => $field ) { |
|
859 | 859 | |
860 | 860 | $input_type = NULL; |
861 | - $original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ; |
|
861 | + $original_item = isset( $available_items[ $field[ 'id' ] ] ) ? $available_items[ $field[ 'id' ] ] : false; |
|
862 | 862 | |
863 | - if( !$original_item ) { |
|
863 | + if ( ! $original_item ) { |
|
864 | 864 | |
865 | - do_action('gravityview_log_error', 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array('available_items' => $available_items, 'field' => $field )); |
|
865 | + do_action( 'gravityview_log_error', 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array( 'available_items' => $available_items, 'field' => $field ) ); |
|
866 | 866 | |
867 | 867 | $original_item = $field; |
868 | 868 | } else { |
869 | 869 | |
870 | - $input_type = isset( $original_item['type'] ) ? $original_item['type'] : NULL; |
|
870 | + $input_type = isset( $original_item[ 'type' ] ) ? $original_item[ 'type' ] : NULL; |
|
871 | 871 | |
872 | 872 | } |
873 | 873 | |
874 | 874 | // Field options dialog box |
875 | - $field_options = GravityView_Render_Settings::render_field_options( $type, $template_id, $field['id'], $original_item['label'], $zone .'_'. $area['areaid'], $input_type, $uniqid, $field, $zone, $original_item ); |
|
875 | + $field_options = GravityView_Render_Settings::render_field_options( $type, $template_id, $field[ 'id' ], $original_item[ 'label' ], $zone . '_' . $area[ 'areaid' ], $input_type, $uniqid, $field, $zone, $original_item ); |
|
876 | 876 | |
877 | 877 | $item = array( |
878 | 878 | 'input_type' => $input_type, |
@@ -881,16 +881,16 @@ discard block |
||
881 | 881 | ); |
882 | 882 | |
883 | 883 | // Merge the values with the current item to pass things like widget descriptions and original field names |
884 | - if( $original_item ) { |
|
884 | + if ( $original_item ) { |
|
885 | 885 | $item = wp_parse_args( $item, $original_item ); |
886 | 886 | } |
887 | 887 | |
888 | - switch( $type ) { |
|
888 | + switch ( $type ) { |
|
889 | 889 | case 'widget': |
890 | - echo new GravityView_Admin_View_Widget( $item['label'], $field['id'], $item, $field ); |
|
890 | + echo new GravityView_Admin_View_Widget( $item[ 'label' ], $field[ 'id' ], $item, $field ); |
|
891 | 891 | break; |
892 | 892 | default: |
893 | - echo new GravityView_Admin_View_Field( $item['label'], $field['id'], $item, $field ); |
|
893 | + echo new GravityView_Admin_View_Field( $item[ 'label' ], $field[ 'id' ], $item, $field ); |
|
894 | 894 | } |
895 | 895 | |
896 | 896 | |
@@ -900,11 +900,11 @@ discard block |
||
900 | 900 | |
901 | 901 | } // End if zone is not empty ?> |
902 | 902 | |
903 | - <span class="drop-message"><?php echo sprintf(esc_attr__('"+ %s" or drag existing %ss here.', 'gravityview'), $button_label, $type ); ?></span> |
|
903 | + <span class="drop-message"><?php echo sprintf( esc_attr__( '"+ %s" or drag existing %ss here.', 'gravityview' ), $button_label, $type ); ?></span> |
|
904 | 904 | </div> |
905 | 905 | <div class="gv-droppable-area-action"> |
906 | - <a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"><?php echo '+ '.esc_html( $button_label ); ?></a> |
|
907 | - <p class="gv-droppable-area-title"><strong><?php echo esc_html( $area['title'] ); ?></strong><?php if( !empty( $area['subtitle'] ) ) { ?><span class="gv-droppable-area-subtitle"> – <?php echo esc_html( $area['subtitle'] ); ?></span><?php } ?></p> |
|
906 | + <a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"><?php echo '+ ' . esc_html( $button_label ); ?></a> |
|
907 | + <p class="gv-droppable-area-title"><strong><?php echo esc_html( $area[ 'title' ] ); ?></strong><?php if ( ! empty( $area[ 'subtitle' ] ) ) { ?><span class="gv-droppable-area-subtitle"> – <?php echo esc_html( $area[ 'subtitle' ] ); ?></span><?php } ?></p> |
|
908 | 908 | </div> |
909 | 909 | </div> |
910 | 910 | |
@@ -926,7 +926,7 @@ discard block |
||
926 | 926 | $default_widget_areas = GravityView_Plugin::get_default_widget_areas(); |
927 | 927 | |
928 | 928 | $widgets = array(); |
929 | - if( !empty( $post_id ) ) { |
|
929 | + if ( ! empty( $post_id ) ) { |
|
930 | 930 | $widgets = gravityview_get_directory_widgets( $post_id ); |
931 | 931 | } |
932 | 932 | |
@@ -956,7 +956,7 @@ discard block |
||
956 | 956 | */ |
957 | 957 | function render_directory_active_areas( $template_id = '', $context = 'single', $post_id = '', $echo = false ) { |
958 | 958 | |
959 | - if( empty( $template_id ) ) { |
|
959 | + if ( empty( $template_id ) ) { |
|
960 | 960 | do_action( 'gravityview_log_debug', '[render_directory_active_areas] $template_id is empty' ); |
961 | 961 | return ''; |
962 | 962 | } |
@@ -970,12 +970,12 @@ discard block |
||
970 | 970 | */ |
971 | 971 | $template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context ); |
972 | 972 | |
973 | - if( empty( $template_areas ) ) { |
|
973 | + if ( empty( $template_areas ) ) { |
|
974 | 974 | |
975 | 975 | do_action( 'gravityview_log_debug', '[render_directory_active_areas] No areas defined. Maybe template %s is disabled.', $template_id ); |
976 | 976 | $output = '<div>'; |
977 | - $output .= '<h2 class="description" style="font-size: 16px; margin:0">'. sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>'.$template_id.'</em>' ) .'</h2>'; |
|
978 | - $output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">'.esc_html__('The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview').'</p>'; |
|
977 | + $output .= '<h2 class="description" style="font-size: 16px; margin:0">' . sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>' . $template_id . '</em>' ) . '</h2>'; |
|
978 | + $output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">' . esc_html__( 'The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview' ) . '</p>'; |
|
979 | 979 | $output .= '</div>'; |
980 | 980 | } else { |
981 | 981 | |
@@ -990,7 +990,7 @@ discard block |
||
990 | 990 | |
991 | 991 | } |
992 | 992 | |
993 | - if( $echo ) { |
|
993 | + if ( $echo ) { |
|
994 | 994 | echo $output; |
995 | 995 | } |
996 | 996 | |
@@ -1010,26 +1010,26 @@ discard block |
||
1010 | 1010 | $is_widgets_page = ( $pagenow === 'widgets.php' ); |
1011 | 1011 | |
1012 | 1012 | // Add the GV font (with the Astronaut) |
1013 | - wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
1013 | + wp_enqueue_style( 'gravityview_global', plugins_url( 'assets/css/admin-global.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
1014 | 1014 | |
1015 | - wp_register_script( 'gravityview-jquery-cookie', plugins_url('assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version, true ); |
|
1015 | + wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
|
1016 | 1016 | |
1017 | 1017 | // Don't process any scripts below here if it's not a GravityView page. |
1018 | - if( ! gravityview_is_admin_page( $hook, 'single' ) && ! $is_widgets_page ) { |
|
1018 | + if ( ! gravityview_is_admin_page( $hook, 'single' ) && ! $is_widgets_page ) { |
|
1019 | 1019 | return; |
1020 | 1020 | } |
1021 | 1021 | |
1022 | 1022 | wp_enqueue_script( 'jquery-ui-datepicker' ); |
1023 | - wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), GravityView_Plugin::version ); |
|
1023 | + wp_enqueue_style( 'gravityview_views_datepicker', plugins_url( 'assets/css/admin-datepicker.css', GRAVITYVIEW_FILE ), GravityView_Plugin::version ); |
|
1024 | 1024 | |
1025 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
1025 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
1026 | 1026 | |
1027 | 1027 | //enqueue scripts |
1028 | 1028 | wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), GravityView_Plugin::version ); |
1029 | 1029 | |
1030 | - wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
1030 | + wp_localize_script( 'gravityview_views_scripts', 'gvGlobals', array( |
|
1031 | 1031 | 'cookiepath' => COOKIEPATH, |
1032 | - 'passed_form_id' => (bool) rgget( 'form_id' ), |
|
1032 | + 'passed_form_id' => (bool)rgget( 'form_id' ), |
|
1033 | 1033 | 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
1034 | 1034 | 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
1035 | 1035 | 'label_close' => __( 'Close', 'gravityview' ), |
@@ -1041,9 +1041,9 @@ discard block |
||
1041 | 1041 | 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
1042 | 1042 | 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
1043 | 1043 | 'remove_all_fields' => __( 'Would you like to remove all fields in this zone? (You are seeing this message because you were holding down the ALT key)', 'gravityview' ), |
1044 | - )); |
|
1044 | + ) ); |
|
1045 | 1045 | |
1046 | - wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array('dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
1046 | + wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
1047 | 1047 | |
1048 | 1048 | // Enqueue scripts needed for merge tags |
1049 | 1049 | self::enqueue_gravity_forms_scripts(); |
@@ -1068,7 +1068,7 @@ discard block |
||
1068 | 1068 | ); |
1069 | 1069 | |
1070 | 1070 | if ( wp_is_mobile() ) { |
1071 | - $scripts[] = 'jquery-touch-punch'; |
|
1071 | + $scripts[ ] = 'jquery-touch-punch'; |
|
1072 | 1072 | } |
1073 | 1073 | |
1074 | 1074 | wp_enqueue_script( $scripts ); |
@@ -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 | |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public static function no_views_text() { |
65 | 65 | |
66 | - if ( isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'] ) { |
|
66 | + if ( isset( $_REQUEST[ 'post_status' ] ) && 'trash' === $_REQUEST[ 'post_status' ] ) { |
|
67 | 67 | return __( 'No Views found in Trash', 'gravityview' ); |
68 | - } elseif( ! empty( $_GET['s'] ) ) { |
|
68 | + } elseif ( ! empty( $_GET[ 's' ] ) ) { |
|
69 | 69 | return __( 'No Views found.', 'gravityview' ); |
70 | 70 | } |
71 | 71 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $error .= ' ' . esc_html__( 'or select another form.', 'gravityview' ); |
110 | 110 | } |
111 | 111 | |
112 | - if( $error ) { |
|
112 | + if ( $error ) { |
|
113 | 113 | ?> |
114 | 114 | <div class="wp-dialog notice-warning inline error wp-clearfix"> |
115 | 115 | <?php echo gravityview_get_floaty(); ?> |
@@ -128,22 +128,22 @@ discard block |
||
128 | 128 | public function backend_actions() { |
129 | 129 | |
130 | 130 | /** @define "GRAVITYVIEW_DIR" "../" */ |
131 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.field.type.php' ); |
|
132 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.render.settings.php' ); |
|
133 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-item.php' ); |
|
134 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-field.php' ); |
|
135 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-widget.php' ); |
|
136 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-views.php' ); |
|
137 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-welcome.php' ); |
|
138 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-add-shortcode.php' ); |
|
139 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' ); |
|
131 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.field.type.php' ); |
|
132 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.render.settings.php' ); |
|
133 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-item.php' ); |
|
134 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-field.php' ); |
|
135 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-widget.php' ); |
|
136 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-views.php' ); |
|
137 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-welcome.php' ); |
|
138 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-add-shortcode.php' ); |
|
139 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' ); |
|
140 | 140 | |
141 | 141 | /** |
142 | 142 | * @action `gravityview_include_backend_actions` Triggered after all GravityView admin files are loaded |
143 | 143 | * |
144 | 144 | * Nice place to insert extensions' backend stuff |
145 | 145 | */ |
146 | - do_action('gravityview_include_backend_actions'); |
|
146 | + do_action( 'gravityview_include_backend_actions' ); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -159,12 +159,12 @@ discard block |
||
159 | 159 | |
160 | 160 | $actions = array(); |
161 | 161 | |
162 | - if( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
163 | - $actions[] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
162 | + if ( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
163 | + $actions[ ] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
164 | 164 | } |
165 | 165 | |
166 | - if( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
167 | - $actions[] = '<a href="http://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
166 | + if ( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
167 | + $actions[ ] = '<a href="http://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | return array_merge( $actions, $links ); |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | // By default, there will only be one item being modified. |
193 | 193 | // When in the `bulk_post_updated_messages` filter, there will be passed a number |
194 | 194 | // of modified items that will override this array. |
195 | - $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1 , 'locked' => 1 , 'deleted' => 1 , 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
195 | + $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1, 'locked' => 1, 'deleted' => 1, 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
196 | 196 | |
197 | 197 | // If we're starting fresh, a new form was created. |
198 | 198 | // We should let the user know this is the case. |
@@ -200,60 +200,60 @@ discard block |
||
200 | 200 | |
201 | 201 | $new_form_text = ''; |
202 | 202 | |
203 | - if( !empty( $start_fresh ) ) { |
|
203 | + if ( ! empty( $start_fresh ) ) { |
|
204 | 204 | |
205 | 205 | // Get the form that was created |
206 | 206 | $connected_form = gravityview_get_form_id( $post_id ); |
207 | 207 | |
208 | - if( !empty( $connected_form ) ) { |
|
208 | + if ( ! empty( $connected_form ) ) { |
|
209 | 209 | $form = gravityview_get_form( $connected_form ); |
210 | - $form_name = esc_attr( $form['title'] ); |
|
210 | + $form_name = esc_attr( $form[ 'title' ] ); |
|
211 | 211 | $image = self::get_floaty(); |
212 | - $new_form_text .= '<h3>'.$image.sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ).'</h3>'; |
|
213 | - $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 |
|
212 | + $new_form_text .= '<h3>' . $image . sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ) . '</h3>'; |
|
213 | + $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 | 214 | |
215 | 215 | 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. |
216 | - ', '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>'); |
|
216 | + ', '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>' ); |
|
217 | 217 | $new_form_text = wpautop( $new_form_text ); |
218 | 218 | |
219 | 219 | delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
220 | 220 | } |
221 | 221 | } |
222 | 222 | |
223 | - $messages['gravityview'] = array( |
|
223 | + $messages[ 'gravityview' ] = array( |
|
224 | 224 | 0 => '', // Unused. Messages start at index 1. |
225 | 225 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
226 | - 1 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
226 | + 1 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
227 | 227 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
228 | - 2 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
228 | + 2 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
229 | 229 | 3 => __( 'View deleted.', 'gravityview' ), |
230 | 230 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
231 | - 4 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
231 | + 4 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
232 | 232 | /* translators: %s: date and time of the revision */ |
233 | - 5 => isset( $_GET['revision'] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
233 | + 5 => isset( $_GET[ 'revision' ] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int)$_GET[ 'revision' ], false ) ) : false, |
|
234 | 234 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
235 | - 6 => sprintf(__( 'View published. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
235 | + 6 => sprintf( __( 'View published. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
236 | 236 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
237 | - 7 => sprintf(__( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
237 | + 7 => sprintf( __( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
238 | 238 | 8 => __( 'View submitted.', 'gravityview' ), |
239 | 239 | 9 => sprintf( |
240 | 240 | /* translators: Date and time the View is scheduled to be published */ |
241 | 241 | __( 'View scheduled for: %1$s.', 'gravityview' ), |
242 | 242 | // translators: Publish box date format, see http://php.net/date |
243 | - date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
243 | + date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
244 | 244 | ) . $new_form_text, |
245 | 245 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
246 | - 10 => sprintf(__( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
246 | + 10 => sprintf( __( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
247 | 247 | |
248 | 248 | /** |
249 | 249 | * These apply to `bulk_post_updated_messages` |
250 | 250 | * @file wp-admin/edit.php |
251 | 251 | */ |
252 | - 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts['updated'], 'gravityview' ), |
|
253 | - 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts['locked'], 'gravityview' ), |
|
254 | - 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts['deleted'], 'gravityview' ), |
|
255 | - 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts['trashed'], 'gravityview' ), |
|
256 | - 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts['untrashed'], 'gravityview' ), |
|
252 | + 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts[ 'updated' ], 'gravityview' ), |
|
253 | + 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts[ 'locked' ], 'gravityview' ), |
|
254 | + 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts[ 'deleted' ], 'gravityview' ), |
|
255 | + 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts[ 'trashed' ], 'gravityview' ), |
|
256 | + 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts[ 'untrashed' ], 'gravityview' ), |
|
257 | 257 | ); |
258 | 258 | |
259 | 259 | return $messages; |
@@ -313,29 +313,29 @@ discard block |
||
313 | 313 | static function is_admin_page( $hook = '', $page = NULL ) { |
314 | 314 | global $current_screen, $plugin_page, $pagenow, $post; |
315 | 315 | |
316 | - if( ! is_admin() ) { return false; } |
|
316 | + if ( ! is_admin() ) { return false; } |
|
317 | 317 | |
318 | 318 | $is_page = false; |
319 | 319 | |
320 | - $is_gv_screen = (!empty($current_screen) && isset($current_screen->post_type) && $current_screen->post_type === 'gravityview'); |
|
320 | + $is_gv_screen = ( ! empty( $current_screen ) && isset( $current_screen->post_type ) && $current_screen->post_type === 'gravityview' ); |
|
321 | 321 | |
322 | - $is_gv_post_type_get = (isset($_GET['post_type']) && $_GET['post_type'] === 'gravityview'); |
|
322 | + $is_gv_post_type_get = ( isset( $_GET[ 'post_type' ] ) && $_GET[ 'post_type' ] === 'gravityview' ); |
|
323 | 323 | |
324 | - $is_gv_settings_get = isset( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings'; |
|
324 | + $is_gv_settings_get = isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'gravityview_settings'; |
|
325 | 325 | |
326 | - if( empty( $post ) && $pagenow === 'post.php' && !empty( $_GET['post'] ) ) { |
|
327 | - $gv_post = get_post( intval( $_GET['post'] ) ); |
|
328 | - $is_gv_post_type = (!empty($gv_post) && !empty($gv_post->post_type) && $gv_post->post_type === 'gravityview'); |
|
326 | + if ( empty( $post ) && $pagenow === 'post.php' && ! empty( $_GET[ 'post' ] ) ) { |
|
327 | + $gv_post = get_post( intval( $_GET[ 'post' ] ) ); |
|
328 | + $is_gv_post_type = ( ! empty( $gv_post ) && ! empty( $gv_post->post_type ) && $gv_post->post_type === 'gravityview' ); |
|
329 | 329 | } else { |
330 | - $is_gv_post_type = (!empty($post) && !empty($post->post_type) && $post->post_type === 'gravityview'); |
|
330 | + $is_gv_post_type = ( ! empty( $post ) && ! empty( $post->post_type ) && $post->post_type === 'gravityview' ); |
|
331 | 331 | } |
332 | 332 | |
333 | - if( $is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get ) { |
|
333 | + if ( $is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get ) { |
|
334 | 334 | |
335 | 335 | // $_GET `post_type` variable |
336 | - if(in_array($pagenow, array( 'post.php' , 'post-new.php' )) ) { |
|
336 | + if ( in_array( $pagenow, array( 'post.php', 'post-new.php' ) ) ) { |
|
337 | 337 | $is_page = 'single'; |
338 | - } else if ( in_array( $plugin_page, array( 'gravityview_settings', 'gravityview_page_gravityview_settings' ) ) || ( !empty( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings' ) ) { |
|
338 | + } else if ( in_array( $plugin_page, array( 'gravityview_settings', 'gravityview_page_gravityview_settings' ) ) || ( ! empty( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'gravityview_settings' ) ) { |
|
339 | 339 | $is_page = 'settings'; |
340 | 340 | } else { |
341 | 341 | $is_page = 'views'; |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | $is_page = apply_filters( 'gravityview_is_admin_page', $is_page, $hook ); |
351 | 351 | |
352 | 352 | // If the current page is the same as the compared page |
353 | - if( !empty( $page ) ) { |
|
353 | + if ( ! empty( $page ) ) { |
|
354 | 354 | return $is_page === $page; |
355 | 355 | } |
356 | 356 | |
@@ -371,6 +371,6 @@ discard block |
||
371 | 371 | * |
372 | 372 | * @return bool|string If `false`, not a GravityView page. `true` if $page is passed and is the same as current page. Otherwise, the name of the page (`single`, `settings`, or `views`) |
373 | 373 | */ |
374 | -function gravityview_is_admin_page($hook = '', $page = NULL) { |
|
374 | +function gravityview_is_admin_page( $hook = '', $page = NULL ) { |
|
375 | 375 | return GravityView_Admin::is_admin_page( $hook, $page ); |
376 | 376 | } |
@@ -122,10 +122,10 @@ discard block |
||
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
125 | - * Uninstall all traces of GravityView |
|
126 | - * |
|
127 | - * Note: method is public because parent method is public |
|
128 | - * |
|
125 | + * Uninstall all traces of GravityView |
|
126 | + * |
|
127 | + * Note: method is public because parent method is public |
|
128 | + * |
|
129 | 129 | * @return bool |
130 | 130 | */ |
131 | 131 | public function uninstall() { |
@@ -137,53 +137,53 @@ discard block |
||
137 | 137 | $uninstaller->fire_everything(); |
138 | 138 | |
139 | 139 | /** |
140 | - * Set the path so that Gravity Forms can de-activate GravityView |
|
141 | - * @see GFAddOn::uninstall_addon |
|
142 | - * @uses deactivate_plugins() |
|
143 | - */ |
|
140 | + * Set the path so that Gravity Forms can de-activate GravityView |
|
141 | + * @see GFAddOn::uninstall_addon |
|
142 | + * @uses deactivate_plugins() |
|
143 | + */ |
|
144 | 144 | $this->_path = GRAVITYVIEW_FILE; |
145 | 145 | |
146 | 146 | return true; |
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
150 | - * Get an array of reasons why the plugin might be uninstalled |
|
151 | - * |
|
152 | - * @since 1.17.5 |
|
153 | - * |
|
150 | + * Get an array of reasons why the plugin might be uninstalled |
|
151 | + * |
|
152 | + * @since 1.17.5 |
|
153 | + * |
|
154 | 154 | * @return array Array of reasons with the label and followup questions for each uninstall reason |
155 | 155 | */ |
156 | 156 | private function get_uninstall_reasons() { |
157 | 157 | |
158 | 158 | $reasons = array( |
159 | 159 | 'will-continue' => array( |
160 | - 'label' => esc_html__( 'I am going to continue using GravityView', 'gravityview' ), |
|
161 | - ), |
|
160 | + 'label' => esc_html__( 'I am going to continue using GravityView', 'gravityview' ), |
|
161 | + ), |
|
162 | 162 | 'no-longer-need' => array( |
163 | - 'label' => esc_html__( 'I no longer need GravityView', 'gravityview' ), |
|
164 | - ), |
|
163 | + 'label' => esc_html__( 'I no longer need GravityView', 'gravityview' ), |
|
164 | + ), |
|
165 | 165 | 'doesnt-work' => array( |
166 | - 'label' => esc_html__( 'The plugin doesn\'t work', 'gravityview' ), |
|
167 | - ), |
|
166 | + 'label' => esc_html__( 'The plugin doesn\'t work', 'gravityview' ), |
|
167 | + ), |
|
168 | 168 | 'found-other' => array( |
169 | - 'label' => esc_html__( 'I found a better plugin', 'gravityview' ), |
|
170 | - 'followup' => esc_attr__('What plugin you are using, and why?', 'gravityview'), |
|
171 | - ), |
|
169 | + 'label' => esc_html__( 'I found a better plugin', 'gravityview' ), |
|
170 | + 'followup' => esc_attr__('What plugin you are using, and why?', 'gravityview'), |
|
171 | + ), |
|
172 | 172 | 'other' => array( |
173 | - 'label' => esc_html__( 'Other', 'gravityview' ), |
|
174 | - ), |
|
173 | + 'label' => esc_html__( 'Other', 'gravityview' ), |
|
174 | + ), |
|
175 | 175 | ); |
176 | 176 | |
177 | 177 | shuffle( $reasons ); |
178 | 178 | |
179 | 179 | return $reasons; |
180 | - } |
|
180 | + } |
|
181 | 181 | |
182 | 182 | /** |
183 | - * Display a feedback form when the plugin is uninstalled |
|
184 | - * |
|
185 | - * @since 1.17.5 |
|
186 | - * |
|
183 | + * Display a feedback form when the plugin is uninstalled |
|
184 | + * |
|
185 | + * @since 1.17.5 |
|
186 | + * |
|
187 | 187 | * @return string HTML of the uninstallation form |
188 | 188 | */ |
189 | 189 | public function uninstall_form() { |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | <h2><?php esc_html_e( 'Why did you uninstall GravityView?', 'gravityview' ); ?></h2> |
264 | 264 | <ul> |
265 | 265 | <?php |
266 | - $reasons = $this->get_uninstall_reasons(); |
|
266 | + $reasons = $this->get_uninstall_reasons(); |
|
267 | 267 | foreach ( $reasons as $reason ) { |
268 | 268 | printf( '<li><label><input name="reason" type="radio" value="other" data-followup="%s"> %s</label></li>', rgar( $reason, 'followup' ), rgar( $reason, 'label' ) ); |
269 | 269 | } |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | $license_key = self::getSetting('license_key'); |
432 | 432 | if( '' === $license_key ) { |
433 | 433 | $license_status = 'inactive'; |
434 | - } |
|
434 | + } |
|
435 | 435 | $license_id = empty( $license_key ) ? 'license' : $license_key; |
436 | 436 | |
437 | 437 | $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'); |
@@ -491,12 +491,12 @@ discard block |
||
491 | 491 | } |
492 | 492 | |
493 | 493 | /** |
494 | - * Add tooltip script to app settings page. Not enqueued by Gravity Forms for some reason. |
|
495 | - * |
|
496 | - * @since 1.21.5 |
|
497 | - * |
|
498 | - * @see GFAddOn::scripts() |
|
499 | - * |
|
494 | + * Add tooltip script to app settings page. Not enqueued by Gravity Forms for some reason. |
|
495 | + * |
|
496 | + * @since 1.21.5 |
|
497 | + * |
|
498 | + * @see GFAddOn::scripts() |
|
499 | + * |
|
500 | 500 | * @return array Array of scripts |
501 | 501 | */ |
502 | 502 | public function scripts() { |
@@ -505,10 +505,10 @@ discard block |
||
505 | 505 | $scripts[] = array( |
506 | 506 | 'handle' => 'gform_tooltip_init', |
507 | 507 | 'enqueue' => array( |
508 | - array( |
|
509 | - 'admin_page' => array( 'app_settings' ) |
|
510 | - ) |
|
511 | - ) |
|
508 | + array( |
|
509 | + 'admin_page' => array( 'app_settings' ) |
|
510 | + ) |
|
511 | + ) |
|
512 | 512 | ); |
513 | 513 | |
514 | 514 | return $scripts; |
@@ -528,8 +528,8 @@ discard block |
||
528 | 528 | 'version' => GravityView_Plugin::version, |
529 | 529 | "deps" => array( |
530 | 530 | 'gaddon_form_settings_css', |
531 | - 'gform_tooltip', |
|
532 | - 'gform_font_awesome', |
|
531 | + 'gform_tooltip', |
|
532 | + 'gform_font_awesome', |
|
533 | 533 | ), |
534 | 534 | 'enqueue' => array( |
535 | 535 | array( 'admin_page' => array( |
@@ -595,12 +595,12 @@ discard block |
||
595 | 595 | } |
596 | 596 | |
597 | 597 | public function app_settings_tab() { |
598 | - parent::app_settings_tab(); |
|
598 | + parent::app_settings_tab(); |
|
599 | 599 | |
600 | 600 | if ( $this->maybe_uninstall() ) { |
601 | - echo $this->uninstall_form(); |
|
601 | + echo $this->uninstall_form(); |
|
602 | 602 | } |
603 | - } |
|
603 | + } |
|
604 | 604 | |
605 | 605 | /** |
606 | 606 | * Make protected public |
@@ -723,8 +723,8 @@ discard block |
||
723 | 723 | type="' . $field['type'] . '" |
724 | 724 | name="' . esc_attr( $name ) . '" |
725 | 725 | value="' . $value . '" ' . |
726 | - implode( ' ', $attributes ) . |
|
727 | - ' />'; |
|
726 | + implode( ' ', $attributes ) . |
|
727 | + ' />'; |
|
728 | 728 | |
729 | 729 | if ( $echo ) { |
730 | 730 | echo $html; |
@@ -950,7 +950,7 @@ discard block |
||
950 | 950 | array( |
951 | 951 | 'label' => _x('Show me beta versions if they are available.', 'gravityview'), |
952 | 952 | 'value' => '1', |
953 | - 'name' => 'beta', |
|
953 | + 'name' => 'beta', |
|
954 | 954 | ), |
955 | 955 | ), |
956 | 956 | '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'), |
@@ -975,36 +975,36 @@ discard block |
||
975 | 975 | } |
976 | 976 | |
977 | 977 | |
978 | - $sections = array( |
|
979 | - array( |
|
980 | - 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __('You are running GravityView version %s', 'gravityview'), GravityView_Plugin::version ) ), |
|
981 | - 'fields' => $fields, |
|
982 | - ) |
|
983 | - ); |
|
978 | + $sections = array( |
|
979 | + array( |
|
980 | + 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __('You are running GravityView version %s', 'gravityview'), GravityView_Plugin::version ) ), |
|
981 | + 'fields' => $fields, |
|
982 | + ) |
|
983 | + ); |
|
984 | 984 | |
985 | - // custom 'update settings' button |
|
986 | - $button = array( |
|
987 | - 'class' => 'button button-primary button-hero', |
|
988 | - 'type' => 'save', |
|
989 | - ); |
|
985 | + // custom 'update settings' button |
|
986 | + $button = array( |
|
987 | + 'class' => 'button button-primary button-hero', |
|
988 | + 'type' => 'save', |
|
989 | + ); |
|
990 | 990 | |
991 | 991 | if( $disabled_attribute ) { |
992 | 992 | $button['disabled'] = $disabled_attribute; |
993 | 993 | } |
994 | 994 | |
995 | 995 | |
996 | - /** |
|
997 | - * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page |
|
998 | - * Extensions can tap in here to insert their own section and settings. |
|
999 | - * <code> |
|
1000 | - * $sections[] = array( |
|
1001 | - * 'title' => __( 'GravityView My Extension Settings', 'gravityview' ), |
|
1002 | - * 'fields' => $settings, |
|
1003 | - * ); |
|
1004 | - * </code> |
|
1005 | - * @param array $extension_settings Empty array, ready for extension settings! |
|
1006 | - */ |
|
1007 | - $extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() ); |
|
996 | + /** |
|
997 | + * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page |
|
998 | + * Extensions can tap in here to insert their own section and settings. |
|
999 | + * <code> |
|
1000 | + * $sections[] = array( |
|
1001 | + * 'title' => __( 'GravityView My Extension Settings', 'gravityview' ), |
|
1002 | + * 'fields' => $settings, |
|
1003 | + * ); |
|
1004 | + * </code> |
|
1005 | + * @param array $extension_settings Empty array, ready for extension settings! |
|
1006 | + */ |
|
1007 | + $extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() ); |
|
1008 | 1008 | |
1009 | 1009 | // If there are extensions, add a section for them |
1010 | 1010 | if ( ! empty( $extension_sections ) ) { |
@@ -1017,13 +1017,13 @@ discard block |
||
1017 | 1017 | } |
1018 | 1018 | } |
1019 | 1019 | |
1020 | - $k = count( $extension_sections ) - 1 ; |
|
1021 | - $extension_sections[ $k ]['fields'][] = $button; |
|
1020 | + $k = count( $extension_sections ) - 1 ; |
|
1021 | + $extension_sections[ $k ]['fields'][] = $button; |
|
1022 | 1022 | $sections = array_merge( $sections, $extension_sections ); |
1023 | 1023 | } else { |
1024 | - // add the 'update settings' button to the general section |
|
1025 | - $sections[0]['fields'][] = $button; |
|
1026 | - } |
|
1024 | + // add the 'update settings' button to the general section |
|
1025 | + $sections[0]['fields'][] = $button; |
|
1026 | + } |
|
1027 | 1027 | |
1028 | 1028 | return $sections; |
1029 | 1029 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if( ! class_exists('GFAddOn') ) { |
|
3 | +if ( ! class_exists( 'GFAddOn' ) ) { |
|
4 | 4 | return; |
5 | 5 | } |
6 | 6 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function __construct( $prevent_multiple_instances = '' ) { |
77 | 77 | |
78 | - if( $prevent_multiple_instances === 'get_instance' ) { |
|
78 | + if ( $prevent_multiple_instances === 'get_instance' ) { |
|
79 | 79 | return parent::__construct(); |
80 | 80 | } |
81 | 81 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public static function get_instance() { |
89 | 89 | |
90 | - if( empty( self::$instance ) ) { |
|
90 | + if ( empty( self::$instance ) ) { |
|
91 | 91 | self::$instance = new self( 'get_instance' ); |
92 | 92 | } |
93 | 93 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function current_user_can_any( $caps ) { |
108 | 108 | |
109 | - if( empty( $caps ) ) { |
|
109 | + if ( empty( $caps ) ) { |
|
110 | 110 | $caps = array( 'gravityview_full_access' ); |
111 | 111 | } |
112 | 112 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | ), |
168 | 168 | 'found-other' => array( |
169 | 169 | 'label' => esc_html__( 'I found a better plugin', 'gravityview' ), |
170 | - 'followup' => esc_attr__('What plugin you are using, and why?', 'gravityview'), |
|
170 | + 'followup' => esc_attr__( 'What plugin you are using, and why?', 'gravityview' ), |
|
171 | 171 | ), |
172 | 172 | 'other' => array( |
173 | 173 | 'label' => esc_html__( 'Other', 'gravityview' ), |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | }); |
255 | 255 | |
256 | 256 | function gv_feedback_append_error_message() { |
257 | - $('#gv-uninstall-thanks').append('<div class="notice error"><?php echo esc_js( __('There was an error sharing your feedback. Sorry! Please email us at [email protected]', 'gravityview' ) ) ?></div>'); |
|
257 | + $('#gv-uninstall-thanks').append('<div class="notice error"><?php echo esc_js( __( 'There was an error sharing your feedback. Sorry! Please email us at [email protected]', 'gravityview' ) ) ?></div>'); |
|
258 | 258 | } |
259 | 259 | }); |
260 | 260 | </script> |
@@ -271,15 +271,15 @@ discard block |
||
271 | 271 | </ul> |
272 | 272 | <div class="gv-followup widefat"> |
273 | 273 | <p><strong><label for="gv-reason-details"><?php esc_html_e( 'Comments', 'gravityview' ); ?></label></strong></p> |
274 | - <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> |
|
274 | + <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> |
|
275 | 275 | </div> |
276 | 276 | <div class="scale-description"> |
277 | - <p><strong><?php esc_html_e('How likely are you to recommend GravityView?', 'gravityview' ); ?></strong></p> |
|
277 | + <p><strong><?php esc_html_e( 'How likely are you to recommend GravityView?', 'gravityview' ); ?></strong></p> |
|
278 | 278 | <ul class="inline"> |
279 | 279 | <?php |
280 | 280 | $i = 0; |
281 | - while( $i < 11 ) { |
|
282 | - echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_'.$i.'" value="'.$i.'" type="radio"> '.$i.'</label></li>'; |
|
281 | + while ( $i < 11 ) { |
|
282 | + echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_' . $i . '" value="' . $i . '" type="radio"> ' . $i . '</label></li>'; |
|
283 | 283 | $i++; |
284 | 284 | } |
285 | 285 | ?> |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | </div> |
289 | 289 | |
290 | 290 | <div class="gv-form-field-wrapper"> |
291 | - <label><input type="checkbox" class="checkbox" name="follow_up_with_me" value="1" /> <?php esc_html_e('Please follow up with me about my feedback', 'gravityview'); ?></label> |
|
291 | + <label><input type="checkbox" class="checkbox" name="follow_up_with_me" value="1" /> <?php esc_html_e( 'Please follow up with me about my feedback', 'gravityview' ); ?></label> |
|
292 | 292 | </div> |
293 | 293 | |
294 | 294 | <div class="submit"> |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | <div id="gv-uninstall-thanks" class="notice notice-large notice-updated below-h2" style="display:none;"> |
303 | 303 | <h3 class="notice-title"><?php esc_html_e( 'Thank you for using GravityView!', 'gravityview' ); ?></h3> |
304 | 304 | <p><?php echo gravityview_get_floaty(); ?> |
305 | - <?php echo make_clickable( esc_html__('Your feedback helps us improve GravityView. If you have any questions or comments, email us: [email protected]', 'gravityview' ) ); ?> |
|
305 | + <?php echo make_clickable( esc_html__( 'Your feedback helps us improve GravityView. If you have any questions or comments, email us: [email protected]', 'gravityview' ) ); ?> |
|
306 | 306 | </p> |
307 | 307 | <div class="wp-clearfix"></div> |
308 | 308 | </div> |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | add_filter( 'gform_addon_app_settings_menu_gravityview', array( $this, 'modify_app_settings_menu_title' ) ); |
377 | 377 | |
378 | 378 | /** @since 1.7.6 */ |
379 | - add_action('network_admin_menu', array( $this, 'add_network_menu' ) ); |
|
379 | + add_action( 'network_admin_menu', array( $this, 'add_network_menu' ) ); |
|
380 | 380 | |
381 | 381 | parent::init_admin(); |
382 | 382 | } |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | */ |
391 | 391 | public function modify_app_settings_menu_title( $setting_tabs ) { |
392 | 392 | |
393 | - $setting_tabs[0]['label'] = __( 'GravityView Settings', 'gravityview'); |
|
393 | + $setting_tabs[ 0 ][ 'label' ] = __( 'GravityView Settings', 'gravityview' ); |
|
394 | 394 | |
395 | 395 | return $setting_tabs; |
396 | 396 | } |
@@ -407,11 +407,11 @@ discard block |
||
407 | 407 | */ |
408 | 408 | private function _load_license_handler() { |
409 | 409 | |
410 | - if( !empty( $this->License_Handler ) ) { |
|
410 | + if ( ! empty( $this->License_Handler ) ) { |
|
411 | 411 | return; |
412 | 412 | } |
413 | 413 | |
414 | - require_once( GRAVITYVIEW_DIR . 'includes/class-gv-license-handler.php'); |
|
414 | + require_once( GRAVITYVIEW_DIR . 'includes/class-gv-license-handler.php' ); |
|
415 | 415 | |
416 | 416 | $this->License_Handler = GV_License_Handler::get_instance( $this ); |
417 | 417 | } |
@@ -423,42 +423,42 @@ discard block |
||
423 | 423 | function license_key_notice() { |
424 | 424 | |
425 | 425 | // Only show on GravityView pages |
426 | - if( ! gravityview_is_admin_page() ) { |
|
426 | + if ( ! gravityview_is_admin_page() ) { |
|
427 | 427 | return; |
428 | 428 | } |
429 | 429 | |
430 | - $license_status = self::getSetting('license_key_status'); |
|
431 | - $license_key = self::getSetting('license_key'); |
|
432 | - if( '' === $license_key ) { |
|
430 | + $license_status = self::getSetting( 'license_key_status' ); |
|
431 | + $license_key = self::getSetting( 'license_key' ); |
|
432 | + if ( '' === $license_key ) { |
|
433 | 433 | $license_status = 'inactive'; |
434 | 434 | } |
435 | 435 | $license_id = empty( $license_key ) ? 'license' : $license_key; |
436 | 436 | |
437 | - $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'); |
|
437 | + $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' ); |
|
438 | 438 | |
439 | 439 | /** |
440 | 440 | * I wanted to remove the period from after the buttons in the string, |
441 | 441 | * but didn't want to mess up the translation strings for the translators. |
442 | 442 | */ |
443 | 443 | $message = mb_substr( $message, 0, mb_strlen( $message ) - 1 ); |
444 | - $title = __('Inactive License', 'gravityview'); |
|
444 | + $title = __( 'Inactive License', 'gravityview' ); |
|
445 | 445 | $status = ''; |
446 | 446 | $update_below = false; |
447 | 447 | $primary_button_link = admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ); |
448 | 448 | switch ( $license_status ) { |
449 | 449 | /** @since 1.17 */ |
450 | 450 | case 'expired': |
451 | - $title = __('Expired License', 'gravityview'); |
|
451 | + $title = __( 'Expired License', 'gravityview' ); |
|
452 | 452 | $status = 'expired'; |
453 | - $message = $this->get_license_handler()->strings( 'expired', self::getSetting('license_key_response') ); |
|
453 | + $message = $this->get_license_handler()->strings( 'expired', self::getSetting( 'license_key_response' ) ); |
|
454 | 454 | break; |
455 | 455 | case 'invalid': |
456 | - $title = __('Invalid License', 'gravityview'); |
|
457 | - $status = __('is invalid', 'gravityview'); |
|
456 | + $title = __( 'Invalid License', 'gravityview' ); |
|
457 | + $status = __( 'is invalid', 'gravityview' ); |
|
458 | 458 | break; |
459 | 459 | case 'deactivated': |
460 | - $status = __('is inactive', 'gravityview'); |
|
461 | - $update_below = __('Activate your license key below.', 'gravityview'); |
|
460 | + $status = __( 'is inactive', 'gravityview' ); |
|
461 | + $update_below = __( 'Activate your license key below.', 'gravityview' ); |
|
462 | 462 | break; |
463 | 463 | /** @noinspection PhpMissingBreakStatementInspection */ |
464 | 464 | case '': |
@@ -466,27 +466,27 @@ discard block |
||
466 | 466 | // break intentionally left blank |
467 | 467 | case 'inactive': |
468 | 468 | case 'site_inactive': |
469 | - $status = __('has not been activated', 'gravityview'); |
|
470 | - $update_below = __('Activate your license key below.', 'gravityview'); |
|
469 | + $status = __( 'has not been activated', 'gravityview' ); |
|
470 | + $update_below = __( 'Activate your license key below.', 'gravityview' ); |
|
471 | 471 | break; |
472 | 472 | } |
473 | - $url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content='.$license_status.'&utm_campaign=Admin%20Notice'; |
|
473 | + $url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content=' . $license_status . '&utm_campaign=Admin%20Notice'; |
|
474 | 474 | |
475 | 475 | // Show a different notice on settings page for inactive licenses (hide the buttons) |
476 | - if( $update_below && gravityview_is_admin_page( '', 'settings' ) ) { |
|
476 | + if ( $update_below && gravityview_is_admin_page( '', 'settings' ) ) { |
|
477 | 477 | $message = sprintf( $message, $status, '<div class="hidden">', '', '', '</div><a href="#" onclick="jQuery(\'#license_key\').focus(); return false;">' . $update_below . '</a>' ); |
478 | 478 | } else { |
479 | 479 | $message = sprintf( $message, $status, "\n\n" . '<a href="' . esc_url( $primary_button_link ) . '" class="button button-primary">', '</a>', '<a href="' . esc_url( $url ) . '" class="button button-secondary">', '</a>' ); |
480 | 480 | } |
481 | 481 | |
482 | - if( !empty( $status ) ) { |
|
482 | + if ( ! empty( $status ) ) { |
|
483 | 483 | GravityView_Admin_Notices::add_notice( array( |
484 | 484 | 'message' => $message, |
485 | 485 | 'class' => 'updated', |
486 | 486 | 'title' => $title, |
487 | 487 | 'cap' => 'gravityview_edit_settings', |
488 | - 'dismiss' => sha1( $license_status.'_'.$license_id ), |
|
489 | - )); |
|
488 | + 'dismiss' => sha1( $license_status . '_' . $license_id ), |
|
489 | + ) ); |
|
490 | 490 | } |
491 | 491 | } |
492 | 492 | |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | public function scripts() { |
503 | 503 | $scripts = parent::scripts(); |
504 | 504 | |
505 | - $scripts[] = array( |
|
505 | + $scripts[ ] = array( |
|
506 | 506 | 'handle' => 'gform_tooltip_init', |
507 | 507 | 'enqueue' => array( |
508 | 508 | array( |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | |
523 | 523 | $styles = parent::styles(); |
524 | 524 | |
525 | - $styles[] = array( |
|
525 | + $styles[ ] = array( |
|
526 | 526 | 'handle' => 'gravityview_settings', |
527 | 527 | 'src' => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ), |
528 | 528 | 'version' => GravityView_Plugin::version, |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | * @return void |
548 | 548 | */ |
549 | 549 | public function add_network_menu() { |
550 | - if( GravityView_Plugin::is_network_activated() ) { |
|
550 | + if ( GravityView_Plugin::is_network_activated() ) { |
|
551 | 551 | add_menu_page( __( 'Settings', 'gravityview' ), __( 'GravityView', 'gravityview' ), $this->_capabilities_app_settings, "{$this->_slug}_settings", array( $this, 'app_tab_page' ), 'none' ); |
552 | 552 | } |
553 | 553 | } |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | * If multisite and not network admin, we don't want the settings to show. |
565 | 565 | * @since 1.7.6 |
566 | 566 | */ |
567 | - $show_submenu = !is_multisite() || is_main_site() || !GravityView_Plugin::is_network_activated() || ( is_network_admin() && GravityView_Plugin::is_network_activated() ); |
|
567 | + $show_submenu = ! is_multisite() || is_main_site() || ! GravityView_Plugin::is_network_activated() || ( is_network_admin() && GravityView_Plugin::is_network_activated() ); |
|
568 | 568 | |
569 | 569 | /** |
570 | 570 | * Override whether to show the Settings menu on a per-blog basis. |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | */ |
574 | 574 | $show_submenu = apply_filters( 'gravityview/show-settings-menu', $show_submenu ); |
575 | 575 | |
576 | - if( $show_submenu ) { |
|
576 | + if ( $show_submenu ) { |
|
577 | 577 | add_submenu_page( 'edit.php?post_type=gravityview', __( 'Settings', 'gravityview' ), __( 'Settings', 'gravityview' ), $this->_capabilities_app_settings, $this->_slug . '_settings', array( $this, 'app_tab_page' ) ); |
578 | 578 | } |
579 | 579 | } |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | /** |
613 | 613 | * Backward compatibility with Redux |
614 | 614 | */ |
615 | - if( $setting_name === 'license' ) { |
|
615 | + if ( $setting_name === 'license' ) { |
|
616 | 616 | return array( |
617 | 617 | 'license' => parent::get_app_setting( 'license_key' ), |
618 | 618 | 'status' => parent::get_app_setting( 'license_key_status' ), |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | |
677 | 677 | $return = $text . $activation; |
678 | 678 | |
679 | - if( $echo ) { |
|
679 | + if ( $echo ) { |
|
680 | 680 | echo $return; |
681 | 681 | } |
682 | 682 | |
@@ -703,15 +703,15 @@ discard block |
||
703 | 703 | */ |
704 | 704 | public function settings_submit( $field, $echo = true ) { |
705 | 705 | |
706 | - $field['type'] = ( isset($field['type']) && in_array( $field['type'], array('submit','reset','button') ) ) ? $field['type'] : 'submit'; |
|
706 | + $field[ 'type' ] = ( isset( $field[ 'type' ] ) && in_array( $field[ 'type' ], array( 'submit', 'reset', 'button' ) ) ) ? $field[ 'type' ] : 'submit'; |
|
707 | 707 | |
708 | 708 | $attributes = $this->get_field_attributes( $field ); |
709 | 709 | $default_value = rgar( $field, 'value' ) ? rgar( $field, 'value' ) : rgar( $field, 'default_value' ); |
710 | - $value = $this->get_setting( $field['name'], $default_value ); |
|
710 | + $value = $this->get_setting( $field[ 'name' ], $default_value ); |
|
711 | 711 | |
712 | 712 | |
713 | - $attributes['class'] = isset( $attributes['class'] ) ? esc_attr( $attributes['class'] ) : 'button-primary gfbutton'; |
|
714 | - $name = ( $field['name'] === 'gform-settings-save' ) ? $field['name'] : '_gaddon_setting_'.$field['name']; |
|
713 | + $attributes[ 'class' ] = isset( $attributes[ 'class' ] ) ? esc_attr( $attributes[ 'class' ] ) : 'button-primary gfbutton'; |
|
714 | + $name = ( $field[ 'name' ] === 'gform-settings-save' ) ? $field[ 'name' ] : '_gaddon_setting_' . $field[ 'name' ]; |
|
715 | 715 | |
716 | 716 | if ( empty( $value ) ) { |
717 | 717 | $value = __( 'Update Settings', 'gravityview' ); |
@@ -720,7 +720,7 @@ discard block |
||
720 | 720 | $attributes = $this->get_field_attributes( $field ); |
721 | 721 | |
722 | 722 | $html = '<input |
723 | - type="' . $field['type'] . '" |
|
723 | + type="' . $field[ 'type' ] . '" |
|
724 | 724 | name="' . esc_attr( $name ) . '" |
725 | 725 | value="' . $value . '" ' . |
726 | 726 | implode( ' ', $attributes ) . |
@@ -742,12 +742,12 @@ discard block |
||
742 | 742 | * @return string |
743 | 743 | */ |
744 | 744 | public function settings_save( $field, $echo = true ) { |
745 | - $field['type'] = 'submit'; |
|
746 | - $field['name'] = 'gform-settings-save'; |
|
747 | - $field['class'] = isset( $field['class'] ) ? $field['class'] : 'button-primary gfbutton'; |
|
745 | + $field[ 'type' ] = 'submit'; |
|
746 | + $field[ 'name' ] = 'gform-settings-save'; |
|
747 | + $field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] : 'button-primary gfbutton'; |
|
748 | 748 | |
749 | 749 | if ( ! rgar( $field, 'value' ) ) { |
750 | - $field['value'] = __( 'Update Settings', 'gravityview' ); |
|
750 | + $field[ 'value' ] = __( 'Update Settings', 'gravityview' ); |
|
751 | 751 | } |
752 | 752 | |
753 | 753 | $output = $this->settings_submit( $field, false ); |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | $this->app_settings_uninstall_tab(); |
757 | 757 | $output .= ob_get_clean(); |
758 | 758 | |
759 | - if( $echo ) { |
|
759 | + if ( $echo ) { |
|
760 | 760 | echo $output; |
761 | 761 | } |
762 | 762 | |
@@ -774,8 +774,8 @@ discard block |
||
774 | 774 | parent::single_setting_label( $field ); |
775 | 775 | |
776 | 776 | // Added by GravityView |
777 | - if ( isset( $field['description'] ) ) { |
|
778 | - echo '<span class="description">'. $field['description'] .'</span>'; |
|
777 | + if ( isset( $field[ 'description' ] ) ) { |
|
778 | + echo '<span class="description">' . $field[ 'description' ] . '</span>'; |
|
779 | 779 | } |
780 | 780 | |
781 | 781 | } |
@@ -838,11 +838,11 @@ discard block |
||
838 | 838 | |
839 | 839 | // If the posted key doesn't match the activated/deactivated key (set using the Activate License button, AJAX response), |
840 | 840 | // then we assume it's changed. If it's changed, unset the status and the previous response. |
841 | - if( $local_key !== $response_key ) { |
|
841 | + if ( $local_key !== $response_key ) { |
|
842 | 842 | |
843 | - unset( $posted_settings['license_key_response'] ); |
|
844 | - unset( $posted_settings['license_key_status'] ); |
|
845 | - GFCommon::add_error_message( __('The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) ); |
|
843 | + unset( $posted_settings[ 'license_key_response' ] ); |
|
844 | + unset( $posted_settings[ 'license_key_status' ] ); |
|
845 | + GFCommon::add_error_message( __( 'The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) ); |
|
846 | 846 | } |
847 | 847 | |
848 | 848 | return $posted_settings; |
@@ -877,25 +877,25 @@ discard block |
||
877 | 877 | 'label' => __( 'License Key', 'gravityview' ), |
878 | 878 | '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' ) ), |
879 | 879 | 'type' => 'edd_license', |
880 | - 'data-pending-text' => __('Verifying license…', 'gravityview'), |
|
881 | - 'default_value' => $default_settings['license_key'], |
|
880 | + 'data-pending-text' => __( 'Verifying license…', 'gravityview' ), |
|
881 | + 'default_value' => $default_settings[ 'license_key' ], |
|
882 | 882 | 'class' => ( '' == $this->get_app_setting( 'license_key' ) ) ? 'activate code regular-text edd-license-key' : 'deactivate code regular-text edd-license-key', |
883 | 883 | ), |
884 | 884 | array( |
885 | 885 | 'name' => 'license_key_response', |
886 | - 'default_value' => $default_settings['license_key_response'], |
|
886 | + 'default_value' => $default_settings[ 'license_key_response' ], |
|
887 | 887 | 'type' => 'hidden', |
888 | 888 | ), |
889 | 889 | array( |
890 | 890 | 'name' => 'license_key_status', |
891 | - 'default_value' => $default_settings['license_key_status'], |
|
891 | + 'default_value' => $default_settings[ 'license_key_status' ], |
|
892 | 892 | 'type' => 'hidden', |
893 | 893 | ), |
894 | 894 | array( |
895 | 895 | 'name' => 'support-email', |
896 | 896 | 'type' => 'text', |
897 | 897 | 'validate' => 'email', |
898 | - 'default_value' => $default_settings['support-email'], |
|
898 | + 'default_value' => $default_settings[ 'support-email' ], |
|
899 | 899 | 'label' => __( 'Support Email', 'gravityview' ), |
900 | 900 | 'description' => __( 'In order to provide responses to your support requests, please provide your email address.', 'gravityview' ), |
901 | 901 | 'class' => 'code regular-text', |
@@ -907,53 +907,53 @@ discard block |
||
907 | 907 | 'name' => 'support_port', |
908 | 908 | 'type' => 'radio', |
909 | 909 | 'label' => __( 'Show Support Port?', 'gravityview' ), |
910 | - 'default_value' => $default_settings['support_port'], |
|
910 | + 'default_value' => $default_settings[ 'support_port' ], |
|
911 | 911 | 'horizontal' => 1, |
912 | 912 | 'choices' => array( |
913 | 913 | array( |
914 | - 'label' => _x('Show', 'Setting: Show or Hide', 'gravityview'), |
|
914 | + 'label' => _x( 'Show', 'Setting: Show or Hide', 'gravityview' ), |
|
915 | 915 | 'value' => '1', |
916 | 916 | ), |
917 | 917 | array( |
918 | - 'label' => _x('Hide', 'Setting: Show or Hide', 'gravityview'), |
|
918 | + 'label' => _x( 'Hide', 'Setting: Show or Hide', 'gravityview' ), |
|
919 | 919 | 'value' => '0', |
920 | 920 | ), |
921 | 921 | ), |
922 | - 'tooltip' => '<p><img src="' . esc_url_raw( plugins_url('assets/images/beacon.png', GRAVITYVIEW_FILE ) ) . '" alt="' . esc_attr__( 'The Support Port looks like this.', 'gravityview' ) . '" class="alignright" style="max-width:40px; margin:.5em;" />' . esc_html__('The Support Port provides quick access to how-to articles and tutorials. For administrators, it also makes it easy to contact support.', 'gravityview') . '</p>', |
|
922 | + 'tooltip' => '<p><img src="' . esc_url_raw( plugins_url( 'assets/images/beacon.png', GRAVITYVIEW_FILE ) ) . '" alt="' . esc_attr__( 'The Support Port looks like this.', 'gravityview' ) . '" class="alignright" style="max-width:40px; margin:.5em;" />' . esc_html__( 'The Support Port provides quick access to how-to articles and tutorials. For administrators, it also makes it easy to contact support.', 'gravityview' ) . '</p>', |
|
923 | 923 | 'description' => __( 'Show the Support Port on GravityView pages?', 'gravityview' ), |
924 | 924 | ), |
925 | 925 | array( |
926 | 926 | 'name' => 'no-conflict-mode', |
927 | 927 | 'type' => 'radio', |
928 | 928 | 'label' => __( 'No-Conflict Mode', 'gravityview' ), |
929 | - 'default_value' => $default_settings['no-conflict-mode'], |
|
929 | + 'default_value' => $default_settings[ 'no-conflict-mode' ], |
|
930 | 930 | 'horizontal' => 1, |
931 | 931 | 'choices' => array( |
932 | 932 | array( |
933 | - 'label' => _x('On', 'Setting: On or off', 'gravityview'), |
|
933 | + 'label' => _x( 'On', 'Setting: On or off', 'gravityview' ), |
|
934 | 934 | 'value' => '1', |
935 | 935 | ), |
936 | 936 | array( |
937 | - 'label' => _x('Off', 'Setting: On or off', 'gravityview'), |
|
937 | + 'label' => _x( 'Off', 'Setting: On or off', 'gravityview' ), |
|
938 | 938 | 'value' => '0', |
939 | 939 | ), |
940 | 940 | ), |
941 | - 'description' => __( 'Set this to ON to prevent extraneous scripts and styles from being printed on GravityView admin pages, reducing conflicts with other plugins and themes.', 'gravityview' ) . ' ' . __('If your Edit View tabs are ugly, enable this setting.', 'gravityview'), |
|
941 | + 'description' => __( 'Set this to ON to prevent extraneous scripts and styles from being printed on GravityView admin pages, reducing conflicts with other plugins and themes.', 'gravityview' ) . ' ' . __( 'If your Edit View tabs are ugly, enable this setting.', 'gravityview' ), |
|
942 | 942 | ), |
943 | 943 | array( |
944 | 944 | 'name' => 'beta', |
945 | 945 | 'type' => 'checkbox', |
946 | 946 | 'label' => __( 'Become a Beta Tester', 'gravityview' ), |
947 | - 'default_value' => $default_settings['beta'], |
|
947 | + 'default_value' => $default_settings[ 'beta' ], |
|
948 | 948 | 'horizontal' => 1, |
949 | 949 | 'choices' => array( |
950 | 950 | array( |
951 | - 'label' => _x('Show me beta versions if they are available.', 'gravityview'), |
|
951 | + 'label' => _x( 'Show me beta versions if they are available.', 'gravityview' ), |
|
952 | 952 | 'value' => '1', |
953 | 953 | 'name' => 'beta', |
954 | 954 | ), |
955 | 955 | ), |
956 | - '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'), |
|
956 | + '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' ), |
|
957 | 957 | ), |
958 | 958 | ) ); |
959 | 959 | |
@@ -964,20 +964,20 @@ discard block |
||
964 | 964 | * @since 1.7.4 |
965 | 965 | */ |
966 | 966 | foreach ( $fields as &$field ) { |
967 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : rgget('id', $field ); |
|
968 | - $field['label'] = isset( $field['label'] ) ? $field['label'] : rgget('title', $field ); |
|
969 | - $field['default_value'] = isset( $field['default_value'] ) ? $field['default_value'] : rgget('default', $field ); |
|
970 | - $field['description'] = isset( $field['description'] ) ? $field['description'] : rgget('subtitle', $field ); |
|
967 | + $field[ 'name' ] = isset( $field[ 'name' ] ) ? $field[ 'name' ] : rgget( 'id', $field ); |
|
968 | + $field[ 'label' ] = isset( $field[ 'label' ] ) ? $field[ 'label' ] : rgget( 'title', $field ); |
|
969 | + $field[ 'default_value' ] = isset( $field[ 'default_value' ] ) ? $field[ 'default_value' ] : rgget( 'default', $field ); |
|
970 | + $field[ 'description' ] = isset( $field[ 'description' ] ) ? $field[ 'description' ] : rgget( 'subtitle', $field ); |
|
971 | 971 | |
972 | - if( $disabled_attribute ) { |
|
973 | - $field['disabled'] = $disabled_attribute; |
|
972 | + if ( $disabled_attribute ) { |
|
973 | + $field[ 'disabled' ] = $disabled_attribute; |
|
974 | 974 | } |
975 | 975 | } |
976 | 976 | |
977 | 977 | |
978 | 978 | $sections = array( |
979 | 979 | array( |
980 | - 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __('You are running GravityView version %s', 'gravityview'), GravityView_Plugin::version ) ), |
|
980 | + 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), GravityView_Plugin::version ) ), |
|
981 | 981 | 'fields' => $fields, |
982 | 982 | ) |
983 | 983 | ); |
@@ -988,8 +988,8 @@ discard block |
||
988 | 988 | 'type' => 'save', |
989 | 989 | ); |
990 | 990 | |
991 | - if( $disabled_attribute ) { |
|
992 | - $button['disabled'] = $disabled_attribute; |
|
991 | + if ( $disabled_attribute ) { |
|
992 | + $button[ 'disabled' ] = $disabled_attribute; |
|
993 | 993 | } |
994 | 994 | |
995 | 995 | |
@@ -1009,20 +1009,20 @@ discard block |
||
1009 | 1009 | // If there are extensions, add a section for them |
1010 | 1010 | if ( ! empty( $extension_sections ) ) { |
1011 | 1011 | |
1012 | - if( $disabled_attribute ) { |
|
1012 | + if ( $disabled_attribute ) { |
|
1013 | 1013 | foreach ( $extension_sections as &$section ) { |
1014 | - foreach ( $section['fields'] as &$field ) { |
|
1015 | - $field['disabled'] = $disabled_attribute; |
|
1014 | + foreach ( $section[ 'fields' ] as &$field ) { |
|
1015 | + $field[ 'disabled' ] = $disabled_attribute; |
|
1016 | 1016 | } |
1017 | 1017 | } |
1018 | 1018 | } |
1019 | 1019 | |
1020 | - $k = count( $extension_sections ) - 1 ; |
|
1021 | - $extension_sections[ $k ]['fields'][] = $button; |
|
1020 | + $k = count( $extension_sections ) - 1; |
|
1021 | + $extension_sections[ $k ][ 'fields' ][ ] = $button; |
|
1022 | 1022 | $sections = array_merge( $sections, $extension_sections ); |
1023 | 1023 | } else { |
1024 | 1024 | // add the 'update settings' button to the general section |
1025 | - $sections[0]['fields'][] = $button; |
|
1025 | + $sections[ 0 ][ 'fields' ][ ] = $button; |
|
1026 | 1026 | } |
1027 | 1027 | |
1028 | 1028 | return $sections; |