@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @file select-template.php |
|
4 | - * @package GravityView |
|
5 | - * @subpackage Gravityview/admin/metaboxes/partials |
|
6 | - * @global WP_Post $post |
|
7 | - */ |
|
3 | + * @file select-template.php |
|
4 | + * @package GravityView |
|
5 | + * @subpackage Gravityview/admin/metaboxes/partials |
|
6 | + * @global WP_Post $post |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | global $post; |
10 | 10 |
@@ -9,40 +9,40 @@ |
||
9 | 9 | global $post; |
10 | 10 | |
11 | 11 | // Use nonce for verification |
12 | -wp_nonce_field( 'gravityview_select_template', 'gravityview_select_template_nonce' ); |
|
12 | +wp_nonce_field('gravityview_select_template', 'gravityview_select_template_nonce'); |
|
13 | 13 | |
14 | 14 | //current value |
15 | -$current_template = gravityview_get_template_id( $post->ID ); |
|
15 | +$current_template = gravityview_get_template_id($post->ID); |
|
16 | 16 | |
17 | 17 | $templates = gravityview_get_registered_templates(); |
18 | 18 | |
19 | 19 | // current input |
20 | 20 | ?> |
21 | -<input type="hidden" id="gravityview_directory_template" name="gravityview_directory_template" value="<?php echo esc_attr( $current_template ); ?>" /> |
|
21 | +<input type="hidden" id="gravityview_directory_template" name="gravityview_directory_template" value="<?php echo esc_attr($current_template); ?>" /> |
|
22 | 22 | |
23 | 23 | <?php // list all the available templates (type= fresh or custom ) ?> |
24 | 24 | <div class="gv-grid"> |
25 | - <?php foreach( $templates as $id => $template ) { |
|
26 | - $selected = ( $id == $current_template ) ? ' gv-selected' : ''; ?> |
|
25 | + <?php foreach ($templates as $id => $template) { |
|
26 | + $selected = ($id == $current_template) ? ' gv-selected' : ''; ?> |
|
27 | 27 | |
28 | 28 | <div class="gv-grid-col-1-3"> |
29 | - <div class="gv-view-types-module<?php echo $selected; ?>" data-filter="<?php echo esc_attr( $template['type'] ); ?>"> |
|
29 | + <div class="gv-view-types-module<?php echo $selected; ?>" data-filter="<?php echo esc_attr($template['type']); ?>"> |
|
30 | 30 | <div class="gv-view-types-hover"> |
31 | 31 | <div> |
32 | - <?php if( !empty( $template['buy_source'] ) ) { ?> |
|
33 | - <p><a href="<?php echo esc_url( $template['buy_source'] ); ?>" class="button-primary button-buy-now"><?php esc_html_e( 'Buy Now', 'gravityview'); ?></a></p> |
|
32 | + <?php if (!empty($template['buy_source'])) { ?> |
|
33 | + <p><a href="<?php echo esc_url($template['buy_source']); ?>" class="button-primary button-buy-now"><?php esc_html_e('Buy Now', 'gravityview'); ?></a></p> |
|
34 | 34 | <?php } else { ?> |
35 | - <p><a href="#gv_select_template" class="button button-large button-primary" data-templateid="<?php echo esc_attr( $id ); ?>"><?php esc_html_e( 'Select', 'gravityview'); ?></a></p> |
|
36 | - <?php if( !empty( $template['preview'] ) ) { ?> |
|
37 | - <a href="<?php echo esc_url( $template['preview'] ); ?>" rel="external" class="gv-site-preview"><i class="dashicons dashicons-admin-links" title="<?php esc_html_e( 'View a live demo of this preset', 'gravityview'); ?>"></i></a> |
|
35 | + <p><a href="#gv_select_template" class="button button-large button-primary" data-templateid="<?php echo esc_attr($id); ?>"><?php esc_html_e('Select', 'gravityview'); ?></a></p> |
|
36 | + <?php if (!empty($template['preview'])) { ?> |
|
37 | + <a href="<?php echo esc_url($template['preview']); ?>" rel="external" class="gv-site-preview"><i class="dashicons dashicons-admin-links" title="<?php esc_html_e('View a live demo of this preset', 'gravityview'); ?>"></i></a> |
|
38 | 38 | <?php } ?> |
39 | 39 | <?php } ?> |
40 | 40 | </div> |
41 | 41 | </div> |
42 | 42 | <div class="gv-view-types-normal"> |
43 | - <img src="<?php echo esc_url( $template['logo'] ); ?>" alt="<?php echo esc_attr( $template['label'] ); ?>"> |
|
44 | - <h5><?php echo esc_attr( $template['label'] ); ?></h5> |
|
45 | - <p class="description"><?php echo esc_attr( $template['description'] ); ?></p> |
|
43 | + <img src="<?php echo esc_url($template['logo']); ?>" alt="<?php echo esc_attr($template['label']); ?>"> |
|
44 | + <h5><?php echo esc_attr($template['label']); ?></h5> |
|
45 | + <p class="description"><?php echo esc_attr($template['description']); ?></p> |
|
46 | 46 | </div> |
47 | 47 | </div> |
48 | 48 | </div> |
@@ -9,9 +9,9 @@ |
||
9 | 9 | ?> |
10 | 10 | <div class="misc-pub-section gv-shortcode misc-pub-section-last"> |
11 | 11 | <i class="dashicons dashicons-editor-code"></i> |
12 | - <span><?php esc_html_e( 'Embed Shortcode', 'gravityview' ); ?></span> |
|
12 | + <span><?php esc_html_e('Embed Shortcode', 'gravityview'); ?></span> |
|
13 | 13 | <div> |
14 | 14 | <input type="text" readonly="readonly" value="[gravityview id='<?php echo $post->ID; ?>']" class="code widefat" /> |
15 | - <span class="howto"><?php esc_html_e( 'Add this shortcode to a post or page to embed this view.', 'gravityview' ); ?></span> |
|
15 | + <span class="howto"><?php esc_html_e('Add this shortcode to a post or page to embed this view.', 'gravityview'); ?></span> |
|
16 | 16 | </div> |
17 | 17 | </div> |
18 | 18 | \ No newline at end of file |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @package GravityView |
|
4 | - * @subpackage Gravityview/admin/metaboxes/partials |
|
5 | - * @global $post |
|
6 | - */ |
|
3 | + * @package GravityView |
|
4 | + * @subpackage Gravityview/admin/metaboxes/partials |
|
5 | + * @global $post |
|
6 | + */ |
|
7 | 7 | |
8 | 8 | global $post; |
9 | 9 | ?> |
@@ -7,15 +7,15 @@ |
||
7 | 7 | global $post; |
8 | 8 | |
9 | 9 | // View template settings |
10 | -$current_settings = gravityview_get_template_settings( $post->ID ); |
|
10 | +$current_settings = gravityview_get_template_settings($post->ID); |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 | |
14 | 14 | <table class="form-table striped"><?php |
15 | 15 | |
16 | - GravityView_Render_Settings::render_setting_row( 'single_title', $current_settings ); |
|
16 | + GravityView_Render_Settings::render_setting_row('single_title', $current_settings); |
|
17 | 17 | |
18 | - GravityView_Render_Settings::render_setting_row( 'back_link_label', $current_settings ); |
|
18 | + GravityView_Render_Settings::render_setting_row('back_link_label', $current_settings); |
|
19 | 19 | |
20 | 20 | ?> |
21 | 21 | </table> |
22 | 22 | \ No newline at end of file |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @package GravityView |
|
4 | - * @subpackage Gravityview/admin/metaboxes/views |
|
5 | - * @global $post |
|
6 | - */ |
|
3 | + * @package GravityView |
|
4 | + * @subpackage Gravityview/admin/metaboxes/views |
|
5 | + * @global $post |
|
6 | + */ |
|
7 | 7 | global $post; |
8 | 8 | |
9 | 9 | $curr_form = gravityview_get_form_id( $post->ID ); |
@@ -6,47 +6,47 @@ |
||
6 | 6 | */ |
7 | 7 | global $post; |
8 | 8 | |
9 | -$curr_form = gravityview_get_form_id( $post->ID ); |
|
9 | +$curr_form = gravityview_get_form_id($post->ID); |
|
10 | 10 | |
11 | 11 | // View template settings |
12 | -$current_settings = gravityview_get_template_settings( $post->ID ); |
|
12 | +$current_settings = gravityview_get_template_settings($post->ID); |
|
13 | 13 | |
14 | 14 | ?> |
15 | 15 | <table class="form-table striped"> |
16 | 16 | |
17 | 17 | <?php |
18 | 18 | |
19 | - do_action( 'gravityview_metabox_sort_filter_before', $current_settings ); |
|
19 | + do_action('gravityview_metabox_sort_filter_before', $current_settings); |
|
20 | 20 | |
21 | 21 | // Begin Sort fields |
22 | - do_action( 'gravityview_metabox_sort_before', $current_settings ); |
|
22 | + do_action('gravityview_metabox_sort_before', $current_settings); |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * @since 1.7 |
26 | 26 | */ |
27 | - GravityView_Render_Settings::render_setting_row( 'sort_columns', $current_settings ); |
|
27 | + GravityView_Render_Settings::render_setting_row('sort_columns', $current_settings); |
|
28 | 28 | |
29 | - $sort_fields_input = '<select name="template_settings[sort_field]" id="gravityview_sort_field">'.gravityview_get_sortable_fields( $curr_form, $current_settings['sort_field'] ).'</select>'; |
|
29 | + $sort_fields_input = '<select name="template_settings[sort_field]" id="gravityview_sort_field">'.gravityview_get_sortable_fields($curr_form, $current_settings['sort_field']).'</select>'; |
|
30 | 30 | |
31 | - GravityView_Render_Settings::render_setting_row( 'sort_field', $current_settings, $sort_fields_input ); |
|
31 | + GravityView_Render_Settings::render_setting_row('sort_field', $current_settings, $sort_fields_input); |
|
32 | 32 | |
33 | - GravityView_Render_Settings::render_setting_row( 'sort_direction', $current_settings ); |
|
33 | + GravityView_Render_Settings::render_setting_row('sort_direction', $current_settings); |
|
34 | 34 | |
35 | 35 | |
36 | 36 | // End Sort fields |
37 | - do_action( 'gravityview_metabox_sort_after', $current_settings ); |
|
37 | + do_action('gravityview_metabox_sort_after', $current_settings); |
|
38 | 38 | |
39 | 39 | // Begin Filter fields |
40 | - do_action( 'gravityview_metabox_filter_before', $current_settings ); |
|
40 | + do_action('gravityview_metabox_filter_before', $current_settings); |
|
41 | 41 | |
42 | - GravityView_Render_Settings::render_setting_row( 'start_date', $current_settings ); |
|
42 | + GravityView_Render_Settings::render_setting_row('start_date', $current_settings); |
|
43 | 43 | |
44 | - GravityView_Render_Settings::render_setting_row( 'end_date', $current_settings ); |
|
44 | + GravityView_Render_Settings::render_setting_row('end_date', $current_settings); |
|
45 | 45 | |
46 | 46 | // End Filter fields |
47 | - do_action( 'gravityview_metabox_filter_after', $current_settings ); |
|
47 | + do_action('gravityview_metabox_filter_after', $current_settings); |
|
48 | 48 | |
49 | - do_action( 'gravityview_metabox_sort_filter_after', $current_settings ); |
|
49 | + do_action('gravityview_metabox_sort_filter_after', $current_settings); |
|
50 | 50 | |
51 | 51 | ?> |
52 | 52 |
@@ -1,42 +1,42 @@ discard block |
||
1 | 1 | <div id="gv-view-configuration-tabs"> |
2 | 2 | |
3 | 3 | <ul class="nav-tab-wrapper"> |
4 | - <li><a href="#directory-view" class="nav-tab"><i class="dashicons dashicons-admin-page"></i> <?php esc_html_e( 'Multiple Entries', 'gravityview' ); ?></a></li> |
|
5 | - <li><a href="#single-view" class="nav-tab"><i class="dashicons dashicons-media-default"></i> <?php esc_html_e( 'Single Entry', 'gravityview' ); ?></a></li> |
|
6 | - <li><a href="#edit-view" class="nav-tab"><i class="dashicons dashicons-welcome-write-blog"></i> <?php esc_html_e( 'Edit Entry', 'gravityview' ); ?></a></li> |
|
4 | + <li><a href="#directory-view" class="nav-tab"><i class="dashicons dashicons-admin-page"></i> <?php esc_html_e('Multiple Entries', 'gravityview'); ?></a></li> |
|
5 | + <li><a href="#single-view" class="nav-tab"><i class="dashicons dashicons-media-default"></i> <?php esc_html_e('Single Entry', 'gravityview'); ?></a></li> |
|
6 | + <li><a href="#edit-view" class="nav-tab"><i class="dashicons dashicons-welcome-write-blog"></i> <?php esc_html_e('Edit Entry', 'gravityview'); ?></a></li> |
|
7 | 7 | </ul> |
8 | 8 | |
9 | 9 | <div id="directory-view"> |
10 | 10 | |
11 | 11 | <div id="directory-fields" class="gv-section"> |
12 | 12 | |
13 | - <h4><?php esc_html_e( 'Above Entries Widgets', 'gravityview'); ?> <span><?php esc_html_e( 'These widgets will be shown above entries.', 'gravityview'); ?></span></h4> |
|
13 | + <h4><?php esc_html_e('Above Entries Widgets', 'gravityview'); ?> <span><?php esc_html_e('These widgets will be shown above entries.', 'gravityview'); ?></span></h4> |
|
14 | 14 | |
15 | - <?php do_action('gravityview_render_widgets_active_areas', $curr_template, 'header', $post->ID ); ?> |
|
15 | + <?php do_action('gravityview_render_widgets_active_areas', $curr_template, 'header', $post->ID); ?> |
|
16 | 16 | |
17 | - <h4><?php esc_html_e( 'Entries Fields', 'gravityview'); ?> <span><?php esc_html_e( 'These fields will be shown for each entry.', 'gravityview'); ?></span></h4> |
|
17 | + <h4><?php esc_html_e('Entries Fields', 'gravityview'); ?> <span><?php esc_html_e('These fields will be shown for each entry.', 'gravityview'); ?></span></h4> |
|
18 | 18 | |
19 | 19 | <div id="directory-active-fields" class="gv-grid gv-grid-pad gv-grid-border"> |
20 | - <?php if(!empty( $curr_template ) ) { |
|
21 | - do_action('gravityview_render_directory_active_areas', $curr_template, 'directory', $post->ID, true ); |
|
20 | + <?php if (!empty($curr_template)) { |
|
21 | + do_action('gravityview_render_directory_active_areas', $curr_template, 'directory', $post->ID, true); |
|
22 | 22 | } ?> |
23 | 23 | </div> |
24 | 24 | |
25 | - <h4><?php esc_html_e( 'Below Entries Widgets', 'gravityview'); ?> <span><?php esc_html_e( 'These widgets will be shown below entries.', 'gravityview'); ?></span></h4> |
|
25 | + <h4><?php esc_html_e('Below Entries Widgets', 'gravityview'); ?> <span><?php esc_html_e('These widgets will be shown below entries.', 'gravityview'); ?></span></h4> |
|
26 | 26 | |
27 | - <?php do_action('gravityview_render_widgets_active_areas', $curr_template, 'footer', $post->ID ); ?> |
|
27 | + <?php do_action('gravityview_render_widgets_active_areas', $curr_template, 'footer', $post->ID); ?> |
|
28 | 28 | |
29 | 29 | |
30 | 30 | <?php // list of available fields to be shown in the popup ?> |
31 | 31 | <div id="directory-available-fields" class="hide-if-js gv-tooltip"> |
32 | 32 | <span class="close"><i class="dashicons dashicons-dismiss"></i></span> |
33 | - <?php do_action('gravityview_render_available_fields', $curr_form, 'directory' ); ?> |
|
33 | + <?php do_action('gravityview_render_available_fields', $curr_form, 'directory'); ?> |
|
34 | 34 | </div> |
35 | 35 | |
36 | 36 | <?php // list of available widgets to be shown in the popup ?> |
37 | 37 | <div id="directory-available-widgets" class="hide-if-js gv-tooltip"> |
38 | 38 | <span class="close"><i class="dashicons dashicons-dismiss"></i></span> |
39 | - <?php do_action('gravityview_render_available_widgets' ); ?> |
|
39 | + <?php do_action('gravityview_render_available_widgets'); ?> |
|
40 | 40 | </div> |
41 | 41 | |
42 | 42 | </div> |
@@ -52,17 +52,17 @@ discard block |
||
52 | 52 | |
53 | 53 | <div id="single-fields" class="gv-section"> |
54 | 54 | |
55 | - <h4><?php esc_html_e( 'These fields will be shown in Single Entry view.', 'gravityview'); ?></h4> |
|
55 | + <h4><?php esc_html_e('These fields will be shown in Single Entry view.', 'gravityview'); ?></h4> |
|
56 | 56 | |
57 | 57 | <div id="single-active-fields" class="gv-grid gv-grid-pad gv-grid-border"> |
58 | - <?php if(!empty( $curr_template ) ) { |
|
59 | - do_action('gravityview_render_directory_active_areas', $curr_template, 'single', $post->ID, true ); |
|
58 | + <?php if (!empty($curr_template)) { |
|
59 | + do_action('gravityview_render_directory_active_areas', $curr_template, 'single', $post->ID, true); |
|
60 | 60 | } ?> |
61 | 61 | </div> |
62 | 62 | |
63 | 63 | <div id="single-available-fields" class="hide-if-js gv-tooltip"> |
64 | 64 | <span class="close"><i class="dashicons dashicons-dismiss"></i></span> |
65 | - <?php do_action('gravityview_render_available_fields', $curr_form, 'single' ); ?> |
|
65 | + <?php do_action('gravityview_render_available_fields', $curr_form, 'single'); ?> |
|
66 | 66 | </div> |
67 | 67 | |
68 | 68 | </div> |
@@ -73,17 +73,17 @@ discard block |
||
73 | 73 | |
74 | 74 | <div id="edit-fields" class="gv-section"> |
75 | 75 | |
76 | - <h4><?php esc_html_e( 'Fields shown when editing an entry.', 'gravityview'); ?> <span><?php esc_html_e('If not configured, all form fields will be displayed.', 'gravityview'); ?></span></h4> |
|
76 | + <h4><?php esc_html_e('Fields shown when editing an entry.', 'gravityview'); ?> <span><?php esc_html_e('If not configured, all form fields will be displayed.', 'gravityview'); ?></span></h4> |
|
77 | 77 | |
78 | 78 | <div id="edit-active-fields" class="gv-grid gv-grid-pad gv-grid-border"> |
79 | 79 | <?php |
80 | - do_action('gravityview_render_directory_active_areas', apply_filters( 'gravityview/template/edit', 'default_table_edit' ), 'edit', $post->ID, true ); |
|
80 | + do_action('gravityview_render_directory_active_areas', apply_filters('gravityview/template/edit', 'default_table_edit'), 'edit', $post->ID, true); |
|
81 | 81 | ?> |
82 | 82 | </div> |
83 | 83 | |
84 | 84 | <div id="edit-available-fields" class="hide-if-js gv-tooltip"> |
85 | 85 | <span class="close"><i class="dashicons dashicons-dismiss"></i></span> |
86 | - <?php do_action('gravityview_render_available_fields', $curr_form, 'edit' ); ?> |
|
86 | + <?php do_action('gravityview_render_available_fields', $curr_form, 'edit'); ?> |
|
87 | 87 | </div> |
88 | 88 | |
89 | 89 | </div> |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @package GravityView |
|
4 | - * @subpackage Gravityview/admin/metaboxes/views |
|
5 | - * @global $post |
|
6 | - */ |
|
3 | + * @package GravityView |
|
4 | + * @subpackage Gravityview/admin/metaboxes/views |
|
5 | + * @global $post |
|
6 | + */ |
|
7 | 7 | global $post; |
8 | 8 | |
9 | 9 | $curr_form = gravityview_get_form_id( $post->ID ); |
@@ -6,10 +6,10 @@ discard block |
||
6 | 6 | */ |
7 | 7 | global $post; |
8 | 8 | |
9 | -$curr_form = gravityview_get_form_id( $post->ID ); |
|
9 | +$curr_form = gravityview_get_form_id($post->ID); |
|
10 | 10 | |
11 | 11 | // View template settings |
12 | -$current_settings = gravityview_get_template_settings( $post->ID ); |
|
12 | +$current_settings = gravityview_get_template_settings($post->ID); |
|
13 | 13 | |
14 | 14 | ?> |
15 | 15 | |
@@ -17,32 +17,32 @@ discard block |
||
17 | 17 | |
18 | 18 | <?php |
19 | 19 | |
20 | - GravityView_Render_Settings::render_setting_row( 'page_size', $current_settings ); |
|
20 | + GravityView_Render_Settings::render_setting_row('page_size', $current_settings); |
|
21 | 21 | |
22 | - GravityView_Render_Settings::render_setting_row( 'lightbox', $current_settings ); |
|
22 | + GravityView_Render_Settings::render_setting_row('lightbox', $current_settings); |
|
23 | 23 | |
24 | - GravityView_Render_Settings::render_setting_row( 'show_only_approved', $current_settings ); |
|
24 | + GravityView_Render_Settings::render_setting_row('show_only_approved', $current_settings); |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * @since 1.5.4 |
28 | 28 | */ |
29 | - GravityView_Render_Settings::render_setting_row( 'hide_until_searched', $current_settings ); |
|
29 | + GravityView_Render_Settings::render_setting_row('hide_until_searched', $current_settings); |
|
30 | 30 | |
31 | - GravityView_Render_Settings::render_setting_row( 'hide_empty', $current_settings ); |
|
31 | + GravityView_Render_Settings::render_setting_row('hide_empty', $current_settings); |
|
32 | 32 | |
33 | - GravityView_Render_Settings::render_setting_row( 'user_edit', $current_settings ); |
|
33 | + GravityView_Render_Settings::render_setting_row('user_edit', $current_settings); |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * @since 1.5.1 |
37 | 37 | */ |
38 | - GravityView_Render_Settings::render_setting_row( 'user_delete', $current_settings ); |
|
38 | + GravityView_Render_Settings::render_setting_row('user_delete', $current_settings); |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * @since 1.15.2 |
42 | 42 | */ |
43 | - GravityView_Render_Settings::render_setting_row( 'embed_only', $current_settings ); |
|
43 | + GravityView_Render_Settings::render_setting_row('embed_only', $current_settings); |
|
44 | 44 | |
45 | - do_action( 'gravityview_admin_directory_settings', $current_settings ); |
|
45 | + do_action('gravityview_admin_directory_settings', $current_settings); |
|
46 | 46 | |
47 | 47 | ?> |
48 | 48 |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | |
322 | 322 | if( class_exists( 'GravityView_Entry_Notes' ) ){ |
323 | 323 | global $current_user; |
324 | - get_currentuserinfo(); |
|
324 | + get_currentuserinfo(); |
|
325 | 325 | GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $current_user->display_name, $note ); |
326 | 326 | } |
327 | 327 | |
@@ -356,12 +356,12 @@ discard block |
||
356 | 356 | |
357 | 357 | $approvedcolumn = self::get_approved_column( $form['id'] ); |
358 | 358 | |
359 | - /** |
|
360 | - * If the form doesn't contain the approve field, don't assume anything. |
|
361 | - */ |
|
362 | - if( empty( $approvedcolumn ) ) { |
|
363 | - return; |
|
364 | - } |
|
359 | + /** |
|
360 | + * If the form doesn't contain the approve field, don't assume anything. |
|
361 | + */ |
|
362 | + if( empty( $approvedcolumn ) ) { |
|
363 | + return; |
|
364 | + } |
|
365 | 365 | |
366 | 366 | $entry = GFAPI::get_entry( $entry_id ); |
367 | 367 | |
@@ -474,17 +474,17 @@ discard block |
||
474 | 474 | */ |
475 | 475 | static public function get_approved_column( $form ) { |
476 | 476 | |
477 | - if( empty( $form ) ) { |
|
478 | - return null; |
|
479 | - } |
|
477 | + if( empty( $form ) ) { |
|
478 | + return null; |
|
479 | + } |
|
480 | 480 | |
481 | - if( !is_array( $form ) ) { |
|
482 | - $form = GVCommon::get_form( $form ); |
|
483 | - } |
|
481 | + if( !is_array( $form ) ) { |
|
482 | + $form = GVCommon::get_form( $form ); |
|
483 | + } |
|
484 | 484 | |
485 | 485 | foreach( $form['fields'] as $key => $field ) { |
486 | 486 | |
487 | - $field = (array) $field; |
|
487 | + $field = (array) $field; |
|
488 | 488 | |
489 | 489 | if( !empty( $field['gravityview_approved'] ) ) { |
490 | 490 | if( !empty($field['inputs'][0]['id']) ) { |
@@ -492,14 +492,14 @@ discard block |
||
492 | 492 | } |
493 | 493 | } |
494 | 494 | |
495 | - // Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work.. |
|
496 | - if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) { |
|
497 | - foreach ( $field['inputs'] as $key2 => $input ) { |
|
498 | - if ( strtolower( $input['label'] ) == 'approved' ) { |
|
499 | - return $input['id']; |
|
500 | - } |
|
501 | - } |
|
502 | - } |
|
495 | + // Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work.. |
|
496 | + if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) { |
|
497 | + foreach ( $field['inputs'] as $key2 => $input ) { |
|
498 | + if ( strtolower( $input['label'] ) == 'approved' ) { |
|
499 | + return $input['id']; |
|
500 | + } |
|
501 | + } |
|
502 | + } |
|
503 | 503 | } |
504 | 504 | |
505 | 505 | return null; |
@@ -27,29 +27,29 @@ discard block |
||
27 | 27 | /** Edit Gravity Form page */ |
28 | 28 | |
29 | 29 | // Add button to left menu |
30 | - add_filter( 'gform_add_field_buttons', array( $this, 'add_field_buttons' ) ); |
|
30 | + add_filter('gform_add_field_buttons', array($this, 'add_field_buttons')); |
|
31 | 31 | // Set defaults |
32 | - add_action( 'gform_editor_js_set_default_values', array( $this, 'set_defaults' ) ); |
|
32 | + add_action('gform_editor_js_set_default_values', array($this, 'set_defaults')); |
|
33 | 33 | |
34 | 34 | /** gf_entries page - entries table screen */ |
35 | 35 | |
36 | 36 | // capture bulk actions |
37 | - add_action( 'init', array( $this, 'process_bulk_action') ); |
|
37 | + add_action('init', array($this, 'process_bulk_action')); |
|
38 | 38 | // add hidden field with approve status |
39 | - add_action( 'gform_entries_first_column', array( $this, 'add_entry_approved_hidden_input' ), 1, 5 ); |
|
39 | + add_action('gform_entries_first_column', array($this, 'add_entry_approved_hidden_input'), 1, 5); |
|
40 | 40 | // process ajax approve entry requests |
41 | - add_action('wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved')); |
|
41 | + add_action('wp_ajax_gv_update_approved', array($this, 'ajax_update_approved')); |
|
42 | 42 | |
43 | 43 | // in case entry is edited (on admin or frontend) |
44 | - add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2); |
|
44 | + add_action('gform_after_update_entry', array($this, 'after_update_entry_update_approved_meta'), 10, 2); |
|
45 | 45 | |
46 | - add_filter( 'gravityview_tooltips', array( $this, 'tooltips' ) ); |
|
46 | + add_filter('gravityview_tooltips', array($this, 'tooltips')); |
|
47 | 47 | |
48 | 48 | // adding styles and scripts |
49 | - add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') ); |
|
49 | + add_action('admin_enqueue_scripts', array($this, 'add_scripts_and_styles')); |
|
50 | 50 | // bypass Gravity Forms no-conflict mode |
51 | - add_filter( 'gform_noconflict_scripts', array( $this, 'register_gform_noconflict_script' ) ); |
|
52 | - add_filter( 'gform_noconflict_styles', array( $this, 'register_gform_noconflict_style' ) ); |
|
51 | + add_filter('gform_noconflict_scripts', array($this, 'register_gform_noconflict_script')); |
|
52 | + add_filter('gform_noconflict_styles', array($this, 'register_gform_noconflict_style')); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | * |
60 | 60 | * @return array Tooltips array with GravityView fields tooltip |
61 | 61 | */ |
62 | - function tooltips( $tooltips ) { |
|
62 | + function tooltips($tooltips) { |
|
63 | 63 | |
64 | 64 | $tooltips['form_gravityview_fields'] = array( |
65 | 65 | 'title' => __('GravityView Fields', 'gravityview'), |
66 | - 'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview'), |
|
66 | + 'value' => __('Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview'), |
|
67 | 67 | ); |
68 | 68 | |
69 | 69 | return $tooltips; |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @param mixed $field_groups |
78 | 78 | * @return array Array of fields |
79 | 79 | */ |
80 | - function add_field_buttons( $field_groups ) { |
|
80 | + function add_field_buttons($field_groups) { |
|
81 | 81 | |
82 | 82 | $gravityview_fields = array( |
83 | 83 | 'name' => 'gravityview_fields', |
@@ -85,20 +85,20 @@ discard block |
||
85 | 85 | 'fields' => array( |
86 | 86 | array( |
87 | 87 | 'class' => 'button', |
88 | - 'value' => __( 'Approve/Reject', 'gravityview' ), |
|
88 | + 'value' => __('Approve/Reject', 'gravityview'), |
|
89 | 89 | 'onclick' => "StartAddField('gravityviewapproved_admin');", |
90 | 90 | 'data-type' => 'gravityviewapproved_admin' |
91 | 91 | ), |
92 | 92 | array( |
93 | 93 | 'class' => 'button', |
94 | - 'value' => __( 'User Opt-In', 'gravityview' ), |
|
94 | + 'value' => __('User Opt-In', 'gravityview'), |
|
95 | 95 | 'onclick' => "StartAddField('gravityviewapproved');", |
96 | 96 | 'data-type' => 'gravityviewapproved' |
97 | 97 | ), |
98 | 98 | ) |
99 | 99 | ); |
100 | 100 | |
101 | - array_push( $field_groups, $gravityview_fields ); |
|
101 | + array_push($field_groups, $gravityview_fields); |
|
102 | 102 | |
103 | 103 | return $field_groups; |
104 | 104 | } |
@@ -115,16 +115,16 @@ discard block |
||
115 | 115 | function set_defaults() { |
116 | 116 | ?> |
117 | 117 | case 'gravityviewapproved_admin': |
118 | - field.label = "<?php _e( 'Approved? (Admin-only)', 'gravityview' ); ?>"; |
|
118 | + field.label = "<?php _e('Approved? (Admin-only)', 'gravityview'); ?>"; |
|
119 | 119 | |
120 | - field.adminLabel = "<?php _e( 'Approved?', 'gravityview' ); ?>"; |
|
120 | + field.adminLabel = "<?php _e('Approved?', 'gravityview'); ?>"; |
|
121 | 121 | field.adminOnly = true; |
122 | 122 | |
123 | 123 | field.choices = null; |
124 | 124 | field.inputs = null; |
125 | 125 | |
126 | 126 | if( !field.choices ) { |
127 | - field.choices = new Array( new Choice("<?php _e( 'Approved', 'gravityview' ); ?>") ); |
|
127 | + field.choices = new Array( new Choice("<?php _e('Approved', 'gravityview'); ?>") ); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | field.inputs = new Array(); |
@@ -137,9 +137,9 @@ discard block |
||
137 | 137 | |
138 | 138 | break; |
139 | 139 | case 'gravityviewapproved': |
140 | - field.label = "<?php _e( 'Show Entry on Website', 'gravityview' ); ?>"; |
|
140 | + field.label = "<?php _e('Show Entry on Website', 'gravityview'); ?>"; |
|
141 | 141 | |
142 | - field.adminLabel = "<?php _e( 'Opt-In', 'gravityview' ); ?>"; |
|
142 | + field.adminLabel = "<?php _e('Opt-In', 'gravityview'); ?>"; |
|
143 | 143 | field.adminOnly = false; |
144 | 144 | |
145 | 145 | field.choices = null; |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | |
148 | 148 | if( !field.choices ) { |
149 | 149 | field.choices = new Array( |
150 | - new Choice("<?php _e( 'Yes, display my entry on the website', 'gravityview' ); ?>") |
|
150 | + new Choice("<?php _e('Yes, display my entry on the website', 'gravityview'); ?>") |
|
151 | 151 | ); |
152 | 152 | } |
153 | 153 | |
@@ -173,17 +173,17 @@ discard block |
||
173 | 173 | * @return void|boolean |
174 | 174 | */ |
175 | 175 | public function process_bulk_action() { |
176 | - if ( ! class_exists( 'RGForms' ) ) { |
|
176 | + if (!class_exists('RGForms')) { |
|
177 | 177 | return; |
178 | 178 | } |
179 | 179 | |
180 | 180 | // gforms_update_note is sent when bulk editing entry notes. We don't want to process then. |
181 | - if ( 'bulk' === RGForms::post( 'action' ) && empty( $_POST['gforms_update_note'] ) ) { |
|
181 | + if ('bulk' === RGForms::post('action') && empty($_POST['gforms_update_note'])) { |
|
182 | 182 | |
183 | - check_admin_referer( 'gforms_entry_list', 'gforms_entry_list' ); |
|
183 | + check_admin_referer('gforms_entry_list', 'gforms_entry_list'); |
|
184 | 184 | |
185 | 185 | // The action is formatted like: approve-16 or disapprove-16, where the first word is the name of the action and the second is the ID of the form. Bulk action 2 is the bottom bulk action select form. |
186 | - $bulk_action = ! empty( $_POST['bulk_action'] ) ? $_POST['bulk_action'] : $_POST['bulk_action2']; |
|
186 | + $bulk_action = !empty($_POST['bulk_action']) ? $_POST['bulk_action'] : $_POST['bulk_action2']; |
|
187 | 187 | |
188 | 188 | /** |
189 | 189 | * The extra '-' is to make sure that there are at *least* two items in array. |
@@ -191,27 +191,27 @@ discard block |
||
191 | 191 | */ |
192 | 192 | $bulk_action .= '-'; |
193 | 193 | |
194 | - list( $approved_status, $form_id ) = explode( '-', $bulk_action ); |
|
194 | + list($approved_status, $form_id) = explode('-', $bulk_action); |
|
195 | 195 | |
196 | - if ( empty( $form_id ) ) { |
|
197 | - do_action( 'gravityview_log_error', '[process_bulk_action] Form ID is empty from parsing bulk action.', $bulk_action ); |
|
196 | + if (empty($form_id)) { |
|
197 | + do_action('gravityview_log_error', '[process_bulk_action] Form ID is empty from parsing bulk action.', $bulk_action); |
|
198 | 198 | return false; |
199 | 199 | } |
200 | 200 | |
201 | 201 | // All entries are set to be updated, not just the visible ones |
202 | - if ( ! empty( $_POST['all_entries'] ) ) { |
|
202 | + if (!empty($_POST['all_entries'])) { |
|
203 | 203 | |
204 | 204 | // Convert the current entry search into GF-formatted search criteria |
205 | 205 | $search = array( |
206 | - 'search_field' => isset( $_POST['f'] ) ? $_POST['f'][0] : 0, |
|
207 | - 'search_value' => isset( $_POST['v'][0] ) ? $_POST['v'][0] : '', |
|
208 | - 'search_operator' => isset( $_POST['o'][0] ) ? $_POST['o'][0] : 'contains', |
|
206 | + 'search_field' => isset($_POST['f']) ? $_POST['f'][0] : 0, |
|
207 | + 'search_value' => isset($_POST['v'][0]) ? $_POST['v'][0] : '', |
|
208 | + 'search_operator' => isset($_POST['o'][0]) ? $_POST['o'][0] : 'contains', |
|
209 | 209 | ); |
210 | 210 | |
211 | - $search_criteria = GravityView_frontend::get_search_criteria( $search, $form_id ); |
|
211 | + $search_criteria = GravityView_frontend::get_search_criteria($search, $form_id); |
|
212 | 212 | |
213 | 213 | // Get all the entry IDs for the form |
214 | - $entries = gravityview_get_entry_ids( $form_id, $search_criteria ); |
|
214 | + $entries = gravityview_get_entry_ids($form_id, $search_criteria); |
|
215 | 215 | |
216 | 216 | } else { |
217 | 217 | |
@@ -219,22 +219,22 @@ discard block |
||
219 | 219 | |
220 | 220 | } |
221 | 221 | |
222 | - if ( empty( $entries ) ) { |
|
223 | - do_action( 'gravityview_log_error', '[process_bulk_action] Entries are empty' ); |
|
222 | + if (empty($entries)) { |
|
223 | + do_action('gravityview_log_error', '[process_bulk_action] Entries are empty'); |
|
224 | 224 | return false; |
225 | 225 | } |
226 | 226 | |
227 | - $entry_count = count( $entries ) > 1 ? sprintf( __( '%d entries', 'gravityview' ), count( $entries ) ) : __( '1 entry', 'gravityview' ); |
|
227 | + $entry_count = count($entries) > 1 ? sprintf(__('%d entries', 'gravityview'), count($entries)) : __('1 entry', 'gravityview'); |
|
228 | 228 | |
229 | - switch ( $approved_status ) { |
|
229 | + switch ($approved_status) { |
|
230 | 230 | case 'approve': |
231 | - self::update_bulk( $entries, 1, $form_id ); |
|
232 | - $this->bulk_update_message = sprintf( __( '%s approved.', 'gravityview' ), $entry_count ); |
|
231 | + self::update_bulk($entries, 1, $form_id); |
|
232 | + $this->bulk_update_message = sprintf(__('%s approved.', 'gravityview'), $entry_count); |
|
233 | 233 | break; |
234 | 234 | |
235 | 235 | case 'unapprove': |
236 | - self::update_bulk( $entries, 0, $form_id ); |
|
237 | - $this->bulk_update_message = sprintf( __( '%s disapproved.', 'gravityview' ), $entry_count ); |
|
236 | + self::update_bulk($entries, 0, $form_id); |
|
237 | + $this->bulk_update_message = sprintf(__('%s disapproved.', 'gravityview'), $entry_count); |
|
238 | 238 | break; |
239 | 239 | } |
240 | 240 | } |
@@ -254,25 +254,25 @@ discard block |
||
254 | 254 | * @param int $form_id The Gravity Forms Form ID |
255 | 255 | * @return boolean|void |
256 | 256 | */ |
257 | - private static function update_bulk( $entries, $approved, $form_id ) { |
|
257 | + private static function update_bulk($entries, $approved, $form_id) { |
|
258 | 258 | |
259 | - if( empty($entries) || ( $entries !== true && !is_array($entries) ) ) { |
|
260 | - do_action( 'gravityview_log_error', __METHOD__ . ' Entries were empty or malformed.', $entries ); |
|
259 | + if (empty($entries) || ($entries !== true && !is_array($entries))) { |
|
260 | + do_action('gravityview_log_error', __METHOD__.' Entries were empty or malformed.', $entries); |
|
261 | 261 | return false; |
262 | 262 | } |
263 | 263 | |
264 | - if( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
265 | - do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' ); |
|
264 | + if (!GVCommon::has_cap('gravityview_moderate_entries')) { |
|
265 | + do_action('gravityview_log_error', __METHOD__.' User does not have the `gravityview_moderate_entries` capability.'); |
|
266 | 266 | return false; |
267 | 267 | } |
268 | 268 | |
269 | - $approved = empty( $approved ) ? 0 : 'Approved'; |
|
269 | + $approved = empty($approved) ? 0 : 'Approved'; |
|
270 | 270 | |
271 | 271 | // calculate approved field id |
272 | - $approved_column_id = self::get_approved_column( $form_id ); |
|
272 | + $approved_column_id = self::get_approved_column($form_id); |
|
273 | 273 | |
274 | - foreach( $entries as $entry_id ) { |
|
275 | - self::update_approved( (int)$entry_id, $approved, $form_id, $approved_column_id ); |
|
274 | + foreach ($entries as $entry_id) { |
|
275 | + self::update_approved((int)$entry_id, $approved, $form_id, $approved_column_id); |
|
276 | 276 | } |
277 | 277 | } |
278 | 278 | |
@@ -290,39 +290,39 @@ discard block |
||
290 | 290 | * @param int $approvedcolumn (default: 0) |
291 | 291 | * @return boolean True: It worked; False: it failed |
292 | 292 | */ |
293 | - public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) { |
|
293 | + public static function update_approved($entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) { |
|
294 | 294 | |
295 | - if( !class_exists( 'GFAPI' ) ) { |
|
296 | - do_action( 'gravityview_log_error', __METHOD__ . 'GFAPI does not exist' ); |
|
295 | + if (!class_exists('GFAPI')) { |
|
296 | + do_action('gravityview_log_error', __METHOD__.'GFAPI does not exist'); |
|
297 | 297 | return false; |
298 | 298 | } |
299 | 299 | |
300 | - if( empty( $approvedcolumn ) ) { |
|
301 | - $approvedcolumn = self::get_approved_column( $form_id ); |
|
300 | + if (empty($approvedcolumn)) { |
|
301 | + $approvedcolumn = self::get_approved_column($form_id); |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | //get the entry |
305 | - $entry = GFAPI::get_entry( $entry_id ); |
|
305 | + $entry = GFAPI::get_entry($entry_id); |
|
306 | 306 | |
307 | 307 | //update entry |
308 | - $entry[ (string)$approvedcolumn ] = $approved; |
|
308 | + $entry[(string)$approvedcolumn] = $approved; |
|
309 | 309 | |
310 | 310 | /** @var bool|WP_Error $result */ |
311 | - $result = GFAPI::update_entry( $entry ); |
|
311 | + $result = GFAPI::update_entry($entry); |
|
312 | 312 | |
313 | 313 | /** |
314 | 314 | * GFAPI::update_entry() doesn't trigger `gform_after_update_entry`, so we trigger updating the meta ourselves. |
315 | 315 | */ |
316 | - self::update_approved_meta( $entry_id, $approved ); |
|
316 | + self::update_approved_meta($entry_id, $approved); |
|
317 | 317 | |
318 | 318 | // add note to entry |
319 | - if( $result === true ) { |
|
320 | - $note = empty( $approved ) ? __( 'Disapproved the Entry for GravityView', 'gravityview' ) : __( 'Approved the Entry for GravityView', 'gravityview' ); |
|
319 | + if ($result === true) { |
|
320 | + $note = empty($approved) ? __('Disapproved the Entry for GravityView', 'gravityview') : __('Approved the Entry for GravityView', 'gravityview'); |
|
321 | 321 | |
322 | - if( class_exists( 'GravityView_Entry_Notes' ) ){ |
|
322 | + if (class_exists('GravityView_Entry_Notes')) { |
|
323 | 323 | global $current_user; |
324 | 324 | get_currentuserinfo(); |
325 | - GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $current_user->display_name, $note ); |
|
325 | + GravityView_Entry_Notes::add_note($entry_id, $current_user->ID, $current_user->display_name, $note); |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | /** |
@@ -330,11 +330,11 @@ discard block |
||
330 | 330 | * @see class-cache.php |
331 | 331 | * @since 1.5.1 |
332 | 332 | */ |
333 | - do_action( 'gravityview_clear_form_cache', $form_id ); |
|
333 | + do_action('gravityview_clear_form_cache', $form_id); |
|
334 | 334 | |
335 | - } else if( is_wp_error( $result ) ) { |
|
335 | + } else if (is_wp_error($result)) { |
|
336 | 336 | |
337 | - do_action( 'gravityview_log_error', __METHOD__ . sprintf( ' - Entry approval not updated: %s', $result->get_error_message() ) ); |
|
337 | + do_action('gravityview_log_error', __METHOD__.sprintf(' - Entry approval not updated: %s', $result->get_error_message())); |
|
338 | 338 | |
339 | 339 | $result = false; |
340 | 340 | } |
@@ -352,20 +352,20 @@ discard block |
||
352 | 352 | * @param int $entry_id ID of the Gravity Forms entry |
353 | 353 | * @return void |
354 | 354 | */ |
355 | - public static function after_update_entry_update_approved_meta( $form, $entry_id = NULL ) { |
|
355 | + public static function after_update_entry_update_approved_meta($form, $entry_id = NULL) { |
|
356 | 356 | |
357 | - $approvedcolumn = self::get_approved_column( $form['id'] ); |
|
357 | + $approvedcolumn = self::get_approved_column($form['id']); |
|
358 | 358 | |
359 | 359 | /** |
360 | 360 | * If the form doesn't contain the approve field, don't assume anything. |
361 | 361 | */ |
362 | - if( empty( $approvedcolumn ) ) { |
|
362 | + if (empty($approvedcolumn)) { |
|
363 | 363 | return; |
364 | 364 | } |
365 | 365 | |
366 | - $entry = GFAPI::get_entry( $entry_id ); |
|
366 | + $entry = GFAPI::get_entry($entry_id); |
|
367 | 367 | |
368 | - self::update_approved_meta( $entry_id, $entry[ (string)$approvedcolumn ] ); |
|
368 | + self::update_approved_meta($entry_id, $entry[(string)$approvedcolumn]); |
|
369 | 369 | |
370 | 370 | } |
371 | 371 | |
@@ -378,12 +378,12 @@ discard block |
||
378 | 378 | * |
379 | 379 | * @return void |
380 | 380 | */ |
381 | - private static function update_approved_meta( $entry_id, $is_approved ) { |
|
381 | + private static function update_approved_meta($entry_id, $is_approved) { |
|
382 | 382 | |
383 | 383 | // update entry meta |
384 | - if( function_exists('gform_update_meta') ) { |
|
384 | + if (function_exists('gform_update_meta')) { |
|
385 | 385 | |
386 | - gform_update_meta( $entry_id, 'is_approved', $is_approved ); |
|
386 | + gform_update_meta($entry_id, 'is_approved', $is_approved); |
|
387 | 387 | |
388 | 388 | /** |
389 | 389 | * @action `gravityview/approve_entries/updated` Triggered when an entry approval is updated |
@@ -391,16 +391,16 @@ discard block |
||
391 | 391 | * @param int $entry_id ID of the Gravity Forms entry |
392 | 392 | * @param string $is_approved String whether entry is approved or not. `0` for not approved, `Approved` for approved. |
393 | 393 | */ |
394 | - do_action( 'gravityview/approve_entries/updated', $entry_id, $is_approved ); |
|
394 | + do_action('gravityview/approve_entries/updated', $entry_id, $is_approved); |
|
395 | 395 | |
396 | - if( empty( $is_approved ) ) { |
|
396 | + if (empty($is_approved)) { |
|
397 | 397 | |
398 | 398 | /** |
399 | 399 | * @action `gravityview/approve_entries/disapproved` Triggered when an entry is rejected |
400 | 400 | * @since 1.7.6.1 |
401 | 401 | * @param int $entry_id ID of the Gravity Forms entry |
402 | 402 | */ |
403 | - do_action( 'gravityview/approve_entries/disapproved', $entry_id ); |
|
403 | + do_action('gravityview/approve_entries/disapproved', $entry_id); |
|
404 | 404 | |
405 | 405 | } else { |
406 | 406 | |
@@ -409,13 +409,13 @@ discard block |
||
409 | 409 | * @since 1.7.6.1 |
410 | 410 | * @param int $entry_id ID of the Gravity Forms entry |
411 | 411 | */ |
412 | - do_action( 'gravityview/approve_entries/approved', $entry_id ); |
|
412 | + do_action('gravityview/approve_entries/approved', $entry_id); |
|
413 | 413 | |
414 | 414 | } |
415 | 415 | |
416 | 416 | } else { |
417 | 417 | |
418 | - do_action('gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' ); |
|
418 | + do_action('gravityview_log_error', __METHOD__.' - `gform_update_meta` does not exist.'); |
|
419 | 419 | |
420 | 420 | } |
421 | 421 | } |
@@ -427,40 +427,40 @@ discard block |
||
427 | 427 | */ |
428 | 428 | public function ajax_update_approved() { |
429 | 429 | |
430 | - if( empty( $_POST['entry_id'] ) || empty( $_POST['form_id'] ) ) { |
|
430 | + if (empty($_POST['entry_id']) || empty($_POST['form_id'])) { |
|
431 | 431 | |
432 | - do_action( 'gravityview_log_error', __METHOD__ . ' entry_id or form_id are empty.', $_POST ); |
|
432 | + do_action('gravityview_log_error', __METHOD__.' entry_id or form_id are empty.', $_POST); |
|
433 | 433 | |
434 | 434 | $result = false; |
435 | 435 | } |
436 | 436 | |
437 | - else if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxgfentries' ) ) { |
|
437 | + else if (!isset($_POST['nonce']) || !wp_verify_nonce($_POST['nonce'], 'gravityview_ajaxgfentries')) { |
|
438 | 438 | |
439 | - do_action( 'gravityview_log_error', __METHOD__ . ' Security check failed.', $_POST ); |
|
439 | + do_action('gravityview_log_error', __METHOD__.' Security check failed.', $_POST); |
|
440 | 440 | |
441 | 441 | $result = false; |
442 | 442 | } |
443 | 443 | |
444 | - else if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST['entry_id'] ) ) { |
|
444 | + else if (!GVCommon::has_cap('gravityview_moderate_entries', $_POST['entry_id'])) { |
|
445 | 445 | |
446 | - do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' ); |
|
446 | + do_action('gravityview_log_error', __METHOD__.' User does not have the `gravityview_moderate_entries` capability.'); |
|
447 | 447 | |
448 | 448 | $result = false; |
449 | 449 | } |
450 | 450 | |
451 | 451 | else { |
452 | 452 | |
453 | - $result = self::update_approved( $_POST['entry_id'], $_POST['approved'], $_POST['form_id'] ); |
|
453 | + $result = self::update_approved($_POST['entry_id'], $_POST['approved'], $_POST['form_id']); |
|
454 | 454 | |
455 | - if( is_wp_error( $result ) ) { |
|
455 | + if (is_wp_error($result)) { |
|
456 | 456 | /** @var WP_Error $result */ |
457 | - do_action( 'gravityview_log_error', __METHOD__ .' Error updating approval: ' . $result->get_error_message() ); |
|
457 | + do_action('gravityview_log_error', __METHOD__.' Error updating approval: '.$result->get_error_message()); |
|
458 | 458 | $result = false; |
459 | 459 | } |
460 | 460 | |
461 | 461 | } |
462 | 462 | |
463 | - exit( $result ); |
|
463 | + exit($result); |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | |
@@ -472,30 +472,30 @@ discard block |
||
472 | 472 | * @param mixed $form GF Form or Form ID |
473 | 473 | * @return false|null|string Returns the input ID of the approved field. Returns NULL if no approved fields were found. Returns false if $form_id wasn't set. |
474 | 474 | */ |
475 | - static public function get_approved_column( $form ) { |
|
475 | + static public function get_approved_column($form) { |
|
476 | 476 | |
477 | - if( empty( $form ) ) { |
|
477 | + if (empty($form)) { |
|
478 | 478 | return null; |
479 | 479 | } |
480 | 480 | |
481 | - if( !is_array( $form ) ) { |
|
482 | - $form = GVCommon::get_form( $form ); |
|
481 | + if (!is_array($form)) { |
|
482 | + $form = GVCommon::get_form($form); |
|
483 | 483 | } |
484 | 484 | |
485 | - foreach( $form['fields'] as $key => $field ) { |
|
485 | + foreach ($form['fields'] as $key => $field) { |
|
486 | 486 | |
487 | - $field = (array) $field; |
|
487 | + $field = (array)$field; |
|
488 | 488 | |
489 | - if( !empty( $field['gravityview_approved'] ) ) { |
|
490 | - if( !empty($field['inputs'][0]['id']) ) { |
|
489 | + if (!empty($field['gravityview_approved'])) { |
|
490 | + if (!empty($field['inputs'][0]['id'])) { |
|
491 | 491 | return $field['inputs'][0]['id']; |
492 | 492 | } |
493 | 493 | } |
494 | 494 | |
495 | 495 | // Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work.. |
496 | - if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) { |
|
497 | - foreach ( $field['inputs'] as $key2 => $input ) { |
|
498 | - if ( strtolower( $input['label'] ) == 'approved' ) { |
|
496 | + if ('checkbox' == $field['type'] && isset($field['inputs']) && is_array($field['inputs'])) { |
|
497 | + foreach ($field['inputs'] as $key2 => $input) { |
|
498 | + if (strtolower($input['label']) == 'approved') { |
|
499 | 499 | return $input['id']; |
500 | 500 | } |
501 | 501 | } |
@@ -507,70 +507,70 @@ discard block |
||
507 | 507 | |
508 | 508 | |
509 | 509 | |
510 | - static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) { |
|
510 | + static public function add_entry_approved_hidden_input($form_id, $field_id, $value, $entry, $query_string) { |
|
511 | 511 | |
512 | - if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry['id'] ) ) { |
|
512 | + if (!GVCommon::has_cap('gravityview_moderate_entries', $entry['id'])) { |
|
513 | 513 | return; |
514 | 514 | } |
515 | 515 | |
516 | - if( empty( $entry['id'] ) ) { |
|
516 | + if (empty($entry['id'])) { |
|
517 | 517 | return; |
518 | 518 | } |
519 | 519 | |
520 | - if( gform_get_meta( $entry['id'], 'is_approved' ) ) { |
|
521 | - echo '<input type="hidden" class="entry_approved" id="entry_approved_'. $entry['id'] .'" value="true" />'; |
|
520 | + if (gform_get_meta($entry['id'], 'is_approved')) { |
|
521 | + echo '<input type="hidden" class="entry_approved" id="entry_approved_'.$entry['id'].'" value="true" />'; |
|
522 | 522 | } |
523 | 523 | } |
524 | 524 | |
525 | 525 | |
526 | 526 | |
527 | 527 | |
528 | - function add_scripts_and_styles( $hook ) { |
|
528 | + function add_scripts_and_styles($hook) { |
|
529 | 529 | |
530 | - if( !class_exists( 'RGForms' ) ) { |
|
530 | + if (!class_exists('RGForms')) { |
|
531 | 531 | |
532 | - do_action( 'gravityview_log_error', 'GravityView_Admin_ApproveEntries[add_scripts_and_styles] RGForms does not exist.' ); |
|
532 | + do_action('gravityview_log_error', 'GravityView_Admin_ApproveEntries[add_scripts_and_styles] RGForms does not exist.'); |
|
533 | 533 | |
534 | 534 | return; |
535 | 535 | } |
536 | 536 | |
537 | 537 | // enqueue styles & scripts gf_entries |
538 | 538 | // But only if we're on the main Entries page, not on reports pages |
539 | - if( RGForms::get_page() === 'entry_list' ) { |
|
539 | + if (RGForms::get_page() === 'entry_list') { |
|
540 | 540 | |
541 | 541 | $form_id = RGForms::get('id'); |
542 | 542 | |
543 | 543 | // If there are no forms identified, use the first form. That's how GF does it. |
544 | - if( empty( $form_id ) && class_exists('RGFormsModel') ) { |
|
544 | + if (empty($form_id) && class_exists('RGFormsModel')) { |
|
545 | 545 | $forms = gravityview_get_forms(); |
546 | - if( !empty( $forms ) ) { |
|
546 | + if (!empty($forms)) { |
|
547 | 547 | $form_id = $forms[0]['id']; |
548 | 548 | } |
549 | 549 | } |
550 | 550 | |
551 | - $approvedcolumn = self::get_approved_column( $form_id ); |
|
551 | + $approvedcolumn = self::get_approved_column($form_id); |
|
552 | 552 | |
553 | - wp_register_style( 'gravityview_entries_list', plugins_url('assets/css/admin-entries-list.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
554 | - wp_enqueue_style( 'gravityview_entries_list' ); |
|
553 | + wp_register_style('gravityview_entries_list', plugins_url('assets/css/admin-entries-list.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version); |
|
554 | + wp_enqueue_style('gravityview_entries_list'); |
|
555 | 555 | |
556 | 556 | $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
557 | 557 | |
558 | - wp_register_script( 'gravityview_gf_entries_scripts', plugins_url('assets/js/admin-entries-list'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version ); |
|
559 | - wp_enqueue_script( 'gravityview_gf_entries_scripts' ); |
|
558 | + wp_register_script('gravityview_gf_entries_scripts', plugins_url('assets/js/admin-entries-list'.$script_debug.'.js', GRAVITYVIEW_FILE), array('jquery'), GravityView_Plugin::version); |
|
559 | + wp_enqueue_script('gravityview_gf_entries_scripts'); |
|
560 | 560 | |
561 | - wp_localize_script( 'gravityview_gf_entries_scripts', 'gvGlobals', array( |
|
562 | - 'nonce' => wp_create_nonce( 'gravityview_ajaxgfentries'), |
|
561 | + wp_localize_script('gravityview_gf_entries_scripts', 'gvGlobals', array( |
|
562 | + 'nonce' => wp_create_nonce('gravityview_ajaxgfentries'), |
|
563 | 563 | 'form_id' => $form_id, |
564 | - 'show_column' => (int)$this->show_approve_entry_column( $form_id ), |
|
565 | - 'add_bulk_action' => (int)GVCommon::has_cap( 'gravityview_moderate_entries' ), |
|
566 | - 'label_approve' => __( 'Approve', 'gravityview' ) , |
|
567 | - 'label_disapprove' => __( 'Disapprove', 'gravityview' ), |
|
564 | + 'show_column' => (int)$this->show_approve_entry_column($form_id), |
|
565 | + 'add_bulk_action' => (int)GVCommon::has_cap('gravityview_moderate_entries'), |
|
566 | + 'label_approve' => __('Approve', 'gravityview'), |
|
567 | + 'label_disapprove' => __('Disapprove', 'gravityview'), |
|
568 | 568 | 'bulk_message' => $this->bulk_update_message, |
569 | - 'approve_title' => __( 'Entry not approved for directory viewing. Click to approve this entry.', 'gravityview'), |
|
570 | - 'unapprove_title' => __( 'Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview'), |
|
571 | - 'column_title' => __( 'Show entry in directory view?', 'gravityview'), |
|
572 | - 'column_link' => esc_url( add_query_arg( array('sort' => $approvedcolumn) ) ), |
|
573 | - ) ); |
|
569 | + 'approve_title' => __('Entry not approved for directory viewing. Click to approve this entry.', 'gravityview'), |
|
570 | + 'unapprove_title' => __('Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview'), |
|
571 | + 'column_title' => __('Show entry in directory view?', 'gravityview'), |
|
572 | + 'column_link' => esc_url(add_query_arg(array('sort' => $approvedcolumn))), |
|
573 | + )); |
|
574 | 574 | |
575 | 575 | } |
576 | 576 | |
@@ -585,22 +585,22 @@ discard block |
||
585 | 585 | * |
586 | 586 | * @return bool True: Show column; False: hide column |
587 | 587 | */ |
588 | - private function show_approve_entry_column( $form_id ) { |
|
588 | + private function show_approve_entry_column($form_id) { |
|
589 | 589 | |
590 | - $show_approve_column = GVCommon::has_cap( 'gravityview_moderate_entries' ); |
|
590 | + $show_approve_column = GVCommon::has_cap('gravityview_moderate_entries'); |
|
591 | 591 | |
592 | 592 | /** |
593 | 593 | * @filter `gravityview/approve_entries/hide-if-no-connections` Return true to hide reject/approve if there are no connected Views |
594 | 594 | * @since 1.7.2 |
595 | 595 | * @param boolean $hide_if_no_connections |
596 | 596 | */ |
597 | - $hide_if_no_connections = apply_filters('gravityview/approve_entries/hide-if-no-connections', false ); |
|
597 | + $hide_if_no_connections = apply_filters('gravityview/approve_entries/hide-if-no-connections', false); |
|
598 | 598 | |
599 | - if( $hide_if_no_connections ) { |
|
599 | + if ($hide_if_no_connections) { |
|
600 | 600 | |
601 | - $connected_views = gravityview_get_connected_views( $form_id ); |
|
601 | + $connected_views = gravityview_get_connected_views($form_id); |
|
602 | 602 | |
603 | - if( empty( $connected_views ) ) { |
|
603 | + if (empty($connected_views)) { |
|
604 | 604 | $show_approve_column = false; |
605 | 605 | } |
606 | 606 | } |
@@ -610,17 +610,17 @@ discard block |
||
610 | 610 | * @param boolean $show_approve_column Whether the column will be shown |
611 | 611 | * @param int $form_id The ID of the Gravity Forms form for which entries are being shown |
612 | 612 | */ |
613 | - $show_approve_column = apply_filters('gravityview/approve_entries/show-column', $show_approve_column, $form_id ); |
|
613 | + $show_approve_column = apply_filters('gravityview/approve_entries/show-column', $show_approve_column, $form_id); |
|
614 | 614 | |
615 | 615 | return $show_approve_column; |
616 | 616 | } |
617 | 617 | |
618 | - function register_gform_noconflict_script( $scripts ) { |
|
618 | + function register_gform_noconflict_script($scripts) { |
|
619 | 619 | $scripts[] = 'gravityview_gf_entries_scripts'; |
620 | 620 | return $scripts; |
621 | 621 | } |
622 | 622 | |
623 | - function register_gform_noconflict_style( $styles ) { |
|
623 | + function register_gform_noconflict_style($styles) { |
|
624 | 624 | $styles[] = 'gravityview_entries_list'; |
625 | 625 | return $styles; |
626 | 626 | } |
@@ -432,23 +432,17 @@ |
||
432 | 432 | do_action( 'gravityview_log_error', __METHOD__ . ' entry_id or form_id are empty.', $_POST ); |
433 | 433 | |
434 | 434 | $result = false; |
435 | - } |
|
436 | - |
|
437 | - else if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxgfentries' ) ) { |
|
435 | + } else if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxgfentries' ) ) { |
|
438 | 436 | |
439 | 437 | do_action( 'gravityview_log_error', __METHOD__ . ' Security check failed.', $_POST ); |
440 | 438 | |
441 | 439 | $result = false; |
442 | - } |
|
443 | - |
|
444 | - else if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST['entry_id'] ) ) { |
|
440 | + } else if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST['entry_id'] ) ) { |
|
445 | 441 | |
446 | 442 | do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' ); |
447 | 443 | |
448 | 444 | $result = false; |
449 | - } |
|
450 | - |
|
451 | - else { |
|
445 | + } else { |
|
452 | 446 | |
453 | 447 | $result = self::update_approved( $_POST['entry_id'], $_POST['approved'], $_POST['form_id'] ); |
454 | 448 |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @uses GravityView_frontend::get_search_criteria() Convert the $_POST search request into a properly formatted request. |
172 | 172 | * @access public |
173 | - * @return void|boolean |
|
173 | + * @return null|false |
|
174 | 174 | */ |
175 | 175 | public function process_bulk_action() { |
176 | 176 | if ( ! class_exists( 'RGForms' ) ) { |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | * @param array|boolean $entries If array, array of entry IDs that are to be updated. If true: update all entries. |
253 | 253 | * @param int $approved Approved status. If `0`: unapproved, if not empty, `Approved` |
254 | 254 | * @param int $form_id The Gravity Forms Form ID |
255 | - * @return boolean|void |
|
255 | + * @return false|null |
|
256 | 256 | */ |
257 | 257 | private static function update_bulk( $entries, $approved, $form_id ) { |
258 | 258 | |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | * @access public |
471 | 471 | * @static |
472 | 472 | * @param mixed $form GF Form or Form ID |
473 | - * @return false|null|string Returns the input ID of the approved field. Returns NULL if no approved fields were found. Returns false if $form_id wasn't set. |
|
473 | + * @return integer Returns the input ID of the approved field. Returns NULL if no approved fields were found. Returns false if $form_id wasn't set. |
|
474 | 474 | */ |
475 | 475 | static public function get_approved_column( $form ) { |
476 | 476 |
@@ -11,29 +11,29 @@ discard block |
||
11 | 11 | $field_info_items = array(); |
12 | 12 | |
13 | 13 | // Fields with IDs, not like Source URL or Entry ID |
14 | - if( is_numeric( $this->id ) ) { |
|
14 | + if (is_numeric($this->id)) { |
|
15 | 15 | |
16 | - $field_type_title = GFCommon::get_field_type_title( $this->item['input_type'] ); |
|
16 | + $field_type_title = GFCommon::get_field_type_title($this->item['input_type']); |
|
17 | 17 | |
18 | 18 | $field_info_items[] = array( |
19 | - 'value' => sprintf( __('Type: %s', 'gravityview'), $field_type_title ) |
|
19 | + 'value' => sprintf(__('Type: %s', 'gravityview'), $field_type_title) |
|
20 | 20 | ); |
21 | 21 | |
22 | 22 | $field_info_items[] = array( |
23 | - 'value' => sprintf( __('Field ID: %s', 'gravityview'), $this->id ), |
|
23 | + 'value' => sprintf(__('Field ID: %s', 'gravityview'), $this->id), |
|
24 | 24 | ); |
25 | 25 | |
26 | 26 | } |
27 | 27 | |
28 | - if( !empty( $this->item['desc'] ) ) { |
|
28 | + if (!empty($this->item['desc'])) { |
|
29 | 29 | $field_info_items[] = array( |
30 | 30 | 'value' => $this->item['desc'] |
31 | 31 | ); |
32 | 32 | } |
33 | 33 | |
34 | - if( !empty( $this->item['adminLabel'] ) ) { |
|
34 | + if (!empty($this->item['adminLabel'])) { |
|
35 | 35 | $field_info_items[] = array( |
36 | - 'value' => sprintf( __('Admin Label: %s', 'gravityview' ), $this->item['adminLabel'] ), |
|
36 | + 'value' => sprintf(__('Admin Label: %s', 'gravityview'), $this->item['adminLabel']), |
|
37 | 37 | 'class' => 'gv-sublabel' |
38 | 38 | ); |
39 | 39 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $field_info = ''; |
53 | 53 | $field_info_items = array(); |
54 | 54 | |
55 | - if( !empty( $this->item['description'] ) ) { |
|
55 | + if (!empty($this->item['description'])) { |
|
56 | 56 | |
57 | 57 | $field_info_items[] = array( |
58 | 58 | 'value' => $this->item['description'] |
@@ -77,16 +77,16 @@ discard block |
||
77 | 77 | private $label_type; |
78 | 78 | protected $item; |
79 | 79 | |
80 | - function __construct( $title = '', $field_id, $item = array(), $settings = array() ) { |
|
80 | + function __construct($title = '', $field_id, $item = array(), $settings = array()) { |
|
81 | 81 | |
82 | 82 | // Backward compat |
83 | - if( !empty( $item['type'] ) ) { |
|
83 | + if (!empty($item['type'])) { |
|
84 | 84 | $item['input_type'] = $item['type']; |
85 | - unset( $item['type'] ); |
|
85 | + unset($item['type']); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | // Prevent items from not having index set |
89 | - $item = wp_parse_args( $item, array( |
|
89 | + $item = wp_parse_args($item, array( |
|
90 | 90 | 'label_text' => $title, |
91 | 91 | 'field_id' => NULL, |
92 | 92 | 'parent_label' => NULL, |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * @param boolean $html Display HTML output? If yes, output is wrapped in spans. If no, plaintext. |
130 | 130 | * @return string|null If empty, return null. Otherwise, return output HTML/text. |
131 | 131 | */ |
132 | - protected function get_item_info( $html = true ) { |
|
132 | + protected function get_item_info($html = true) { |
|
133 | 133 | |
134 | 134 | $output = NULL; |
135 | 135 | $field_info_items = $this->additional_info(); |
@@ -139,27 +139,27 @@ discard block |
||
139 | 139 | * @param array $field_info_items Additional information to display in a field |
140 | 140 | * @param GravityView_Admin_View_Field $this Field shown in the admin |
141 | 141 | */ |
142 | - $field_info_items = apply_filters( 'gravityview_admin_label_item_info', $field_info_items, $this ); |
|
142 | + $field_info_items = apply_filters('gravityview_admin_label_item_info', $field_info_items, $this); |
|
143 | 143 | |
144 | - if( $html ) { |
|
144 | + if ($html) { |
|
145 | 145 | |
146 | - foreach ( $field_info_items as $item ) { |
|
147 | - $class = isset($item['class']) ? sanitize_html_class( $item['class'] ).' description' : 'description'; |
|
146 | + foreach ($field_info_items as $item) { |
|
147 | + $class = isset($item['class']) ? sanitize_html_class($item['class']).' description' : 'description'; |
|
148 | 148 | // Add the title in case the value's long, in which case, it'll be truncated by CSS. |
149 | 149 | $output .= '<span class="'.$class.'">'; |
150 | - $output .= esc_html( $item['value'] ); |
|
150 | + $output .= esc_html($item['value']); |
|
151 | 151 | $output .= '</span>'; |
152 | 152 | } |
153 | 153 | |
154 | 154 | } else { |
155 | 155 | |
156 | - $values = wp_list_pluck( $field_info_items, 'value' ); |
|
156 | + $values = wp_list_pluck($field_info_items, 'value'); |
|
157 | 157 | |
158 | - $output = esc_html( implode(', ', $values) ); |
|
158 | + $output = esc_html(implode(', ', $values)); |
|
159 | 159 | |
160 | 160 | } |
161 | 161 | |
162 | - return empty( $output ) ? NULL : $output; |
|
162 | + return empty($output) ? NULL : $output; |
|
163 | 163 | |
164 | 164 | } |
165 | 165 | |
@@ -176,47 +176,47 @@ discard block |
||
176 | 176 | |
177 | 177 | // $settings_html will just be hidden inputs if empty. Otherwise, it'll have an <ul>. Ugly hack, I know. |
178 | 178 | // TODO: Un-hack this |
179 | - $hide_settings_link = ( empty( $this->item['settings_html'] ) || strpos( $this->item['settings_html'], '<!-- No Options -->') > 0 ) ? 'hide-if-js' : ''; |
|
180 | - $settings_link = sprintf( '<a href="#settings" class="dashicons-admin-generic dashicons %s" title="%s"></a>', $hide_settings_link, esc_attr( $settings_title ) ); |
|
179 | + $hide_settings_link = (empty($this->item['settings_html']) || strpos($this->item['settings_html'], '<!-- No Options -->') > 0) ? 'hide-if-js' : ''; |
|
180 | + $settings_link = sprintf('<a href="#settings" class="dashicons-admin-generic dashicons %s" title="%s"></a>', $hide_settings_link, esc_attr($settings_title)); |
|
181 | 181 | |
182 | 182 | // Should we show the icon that the field is being used as a link to single entry? |
183 | - $hide_show_as_link_class = empty( $this->settings['show_as_link'] ) ? 'hide-if-js' : ''; |
|
184 | - $show_as_link = '<span class="dashicons dashicons-admin-links '.$hide_show_as_link_class.'" title="'.esc_attr( $single_link_title ).'"></span>'; |
|
183 | + $hide_show_as_link_class = empty($this->settings['show_as_link']) ? 'hide-if-js' : ''; |
|
184 | + $show_as_link = '<span class="dashicons dashicons-admin-links '.$hide_show_as_link_class.'" title="'.esc_attr($single_link_title).'"></span>'; |
|
185 | 185 | |
186 | 186 | // When a field label is empty, use the Field ID |
187 | - $label = empty( $this->title ) ? sprintf( _x('Field #%s (No Label)', 'Label in field picker for empty label', 'gravityview'), $this->id ) : $this->title; |
|
187 | + $label = empty($this->title) ? sprintf(_x('Field #%s (No Label)', 'Label in field picker for empty label', 'gravityview'), $this->id) : $this->title; |
|
188 | 188 | |
189 | 189 | // If there's a custom label, and show label is checked, use that as the field heading |
190 | - if( !empty( $this->settings['custom_label'] ) && !empty( $this->settings['show_label'] ) ) { |
|
190 | + if (!empty($this->settings['custom_label']) && !empty($this->settings['show_label'])) { |
|
191 | 191 | $label = $this->settings['custom_label']; |
192 | - } else if( !empty( $this->item['customLabel'] ) ) { |
|
192 | + } else if (!empty($this->item['customLabel'])) { |
|
193 | 193 | $label = $this->item['customLabel']; |
194 | 194 | } |
195 | 195 | |
196 | 196 | $output = '<h5 class="selectable gfield field-id-'.esc_attr($this->id).'">'; |
197 | 197 | |
198 | - $label = esc_attr( $label ); |
|
198 | + $label = esc_attr($label); |
|
199 | 199 | |
200 | - if( !empty( $this->item['parent'] ) ) { |
|
201 | - $label .= ' <small>('.esc_attr( $this->item['parent']['label'] ) .')</small>'; |
|
200 | + if (!empty($this->item['parent'])) { |
|
201 | + $label .= ' <small>('.esc_attr($this->item['parent']['label']).')</small>'; |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | // Name of field / widget |
205 | - $output .= '<span class="gv-field-label" data-original-title="'.esc_attr( $label ).'" title="'. $this->get_item_info( false ) .'">'. $label . '</span>'; |
|
205 | + $output .= '<span class="gv-field-label" data-original-title="'.esc_attr($label).'" title="'.$this->get_item_info(false).'">'.$label.'</span>'; |
|
206 | 206 | |
207 | 207 | |
208 | - $output .= '<span class="gv-field-controls">'.$settings_link.$show_as_link.'<a href="#remove" class="dashicons-dismiss dashicons" title="'.esc_attr( $delete_title ) .'"></a></span>'; |
|
208 | + $output .= '<span class="gv-field-controls">'.$settings_link.$show_as_link.'<a href="#remove" class="dashicons-dismiss dashicons" title="'.esc_attr($delete_title).'"></a></span>'; |
|
209 | 209 | |
210 | 210 | // Displays only in the field/widget picker. |
211 | - if( $field_info = $this->get_item_info() ) { |
|
211 | + if ($field_info = $this->get_item_info()) { |
|
212 | 212 | $output .= '<span class="gv-field-info">'.$field_info.'</span>'; |
213 | 213 | } |
214 | 214 | |
215 | 215 | $output .= '</h5>'; |
216 | 216 | |
217 | - $container_class = !empty( $this->item['parent'] ) ? ' gv-child-field' : ''; |
|
217 | + $container_class = !empty($this->item['parent']) ? ' gv-child-field' : ''; |
|
218 | 218 | |
219 | - $output = '<div data-fieldid="'.esc_attr($this->id).'" data-inputtype="'.esc_attr( $this->item['input_type'] ).'" class="gv-fields'.$container_class.'">'.$output.$this->item['settings_html'].'</div>'; |
|
219 | + $output = '<div data-fieldid="'.esc_attr($this->id).'" data-inputtype="'.esc_attr($this->item['input_type']).'" class="gv-fields'.$container_class.'">'.$output.$this->item['settings_html'].'</div>'; |
|
220 | 220 | |
221 | 221 | return $output; |
222 | 222 | } |
@@ -215,39 +215,39 @@ discard block |
||
215 | 215 | } |
216 | 216 | |
217 | 217 | $wp_allowed_scripts = array( |
218 | - 'common', |
|
219 | - 'admin-bar', |
|
220 | - 'autosave', |
|
221 | - 'post', |
|
218 | + 'common', |
|
219 | + 'admin-bar', |
|
220 | + 'autosave', |
|
221 | + 'post', |
|
222 | 222 | 'inline-edit-post', |
223 | - 'utils', |
|
224 | - 'svg-painter', |
|
225 | - 'wp-auth-check', |
|
226 | - 'heartbeat', |
|
223 | + 'utils', |
|
224 | + 'svg-painter', |
|
225 | + 'wp-auth-check', |
|
226 | + 'heartbeat', |
|
227 | 227 | 'media-editor', |
228 | 228 | 'media-upload', |
229 | - 'thickbox', |
|
229 | + 'thickbox', |
|
230 | 230 | 'wp-color-picker', |
231 | 231 | |
232 | - // Settings |
|
232 | + // Settings |
|
233 | 233 | 'gv-admin-edd-license', |
234 | 234 | |
235 | - // Common |
|
236 | - 'select2-js', |
|
237 | - 'qtip-js', |
|
235 | + // Common |
|
236 | + 'select2-js', |
|
237 | + 'qtip-js', |
|
238 | 238 | |
239 | - // jQuery |
|
239 | + // jQuery |
|
240 | 240 | 'jquery', |
241 | - 'jquery-ui-core', |
|
242 | - 'jquery-ui-sortable', |
|
243 | - 'jquery-ui-datepicker', |
|
244 | - 'jquery-ui-dialog', |
|
245 | - 'jquery-ui-slider', |
|
241 | + 'jquery-ui-core', |
|
242 | + 'jquery-ui-sortable', |
|
243 | + 'jquery-ui-datepicker', |
|
244 | + 'jquery-ui-dialog', |
|
245 | + 'jquery-ui-slider', |
|
246 | 246 | 'jquery-ui-dialog', |
247 | 247 | 'jquery-ui-tabs', |
248 | 248 | 'jquery-ui-draggable', |
249 | 249 | 'jquery-ui-droppable', |
250 | - 'jquery-ui-accordion', |
|
250 | + 'jquery-ui-accordion', |
|
251 | 251 | ); |
252 | 252 | |
253 | 253 | $this->remove_conflicts( $wp_scripts, $wp_allowed_scripts, 'scripts' ); |
@@ -281,23 +281,23 @@ discard block |
||
281 | 281 | return; |
282 | 282 | } |
283 | 283 | |
284 | - $wp_allowed_styles = array( |
|
285 | - 'admin-bar', |
|
286 | - 'colors', |
|
287 | - 'ie', |
|
288 | - 'wp-auth-check', |
|
289 | - 'media-views', |
|
284 | + $wp_allowed_styles = array( |
|
285 | + 'admin-bar', |
|
286 | + 'colors', |
|
287 | + 'ie', |
|
288 | + 'wp-auth-check', |
|
289 | + 'media-views', |
|
290 | 290 | 'thickbox', |
291 | 291 | 'dashicons', |
292 | - 'wp-jquery-ui-dialog', |
|
293 | - 'jquery-ui-sortable', |
|
292 | + 'wp-jquery-ui-dialog', |
|
293 | + 'jquery-ui-sortable', |
|
294 | 294 | |
295 | - // Settings |
|
296 | - 'gravityview_settings', |
|
295 | + // Settings |
|
296 | + 'gravityview_settings', |
|
297 | 297 | |
298 | - // @todo qTip styles not loading for some reason! |
|
299 | - 'jquery-qtip.js', |
|
300 | - ); |
|
298 | + // @todo qTip styles not loading for some reason! |
|
299 | + 'jquery-qtip.js', |
|
300 | + ); |
|
301 | 301 | |
302 | 302 | $this->remove_conflicts( $wp_styles, $wp_allowed_styles, 'styles' ); |
303 | 303 | |
@@ -317,32 +317,32 @@ discard block |
||
317 | 317 | */ |
318 | 318 | private function remove_conflicts( &$wp_objects, $required_objects, $type = 'scripts' ) { |
319 | 319 | |
320 | - /** |
|
321 | - * @filter `gravityview_noconflict_{$type}` Modify the list of no conflict scripts or styles\n |
|
322 | - * Filter is `gravityview_noconflict_scripts` or `gravityview_noconflict_styles` |
|
323 | - * @param array $required_objects |
|
324 | - */ |
|
325 | - $required_objects = apply_filters( "gravityview_noconflict_{$type}", $required_objects ); |
|
326 | - |
|
327 | - //reset queue |
|
328 | - $queue = array(); |
|
329 | - foreach( $wp_objects->queue as $object ) { |
|
330 | - if( in_array( $object, $required_objects ) || preg_match('/gravityview|gf_|gravityforms/ism', $object ) ) { |
|
331 | - $queue[] = $object; |
|
332 | - } |
|
333 | - } |
|
334 | - $wp_objects->queue = $queue; |
|
335 | - |
|
336 | - $required_objects = $this->add_script_dependencies( $wp_objects->registered, $required_objects ); |
|
337 | - |
|
338 | - //unregistering scripts |
|
339 | - $registered = array(); |
|
340 | - foreach( $wp_objects->registered as $handle => $script_registration ){ |
|
341 | - if( in_array( $handle, $required_objects ) ){ |
|
342 | - $registered[ $handle ] = $script_registration; |
|
343 | - } |
|
344 | - } |
|
345 | - $wp_objects->registered = $registered; |
|
320 | + /** |
|
321 | + * @filter `gravityview_noconflict_{$type}` Modify the list of no conflict scripts or styles\n |
|
322 | + * Filter is `gravityview_noconflict_scripts` or `gravityview_noconflict_styles` |
|
323 | + * @param array $required_objects |
|
324 | + */ |
|
325 | + $required_objects = apply_filters( "gravityview_noconflict_{$type}", $required_objects ); |
|
326 | + |
|
327 | + //reset queue |
|
328 | + $queue = array(); |
|
329 | + foreach( $wp_objects->queue as $object ) { |
|
330 | + if( in_array( $object, $required_objects ) || preg_match('/gravityview|gf_|gravityforms/ism', $object ) ) { |
|
331 | + $queue[] = $object; |
|
332 | + } |
|
333 | + } |
|
334 | + $wp_objects->queue = $queue; |
|
335 | + |
|
336 | + $required_objects = $this->add_script_dependencies( $wp_objects->registered, $required_objects ); |
|
337 | + |
|
338 | + //unregistering scripts |
|
339 | + $registered = array(); |
|
340 | + foreach( $wp_objects->registered as $handle => $script_registration ){ |
|
341 | + if( in_array( $handle, $required_objects ) ){ |
|
342 | + $registered[ $handle ] = $script_registration; |
|
343 | + } |
|
344 | + } |
|
345 | + $wp_objects->registered = $registered; |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | /** |
@@ -405,7 +405,6 @@ discard block |
||
405 | 405 | * |
406 | 406 | * @deprecated since 1.12 |
407 | 407 | * @see GravityView_Compatibility::get_plugin_status() |
408 | - |
|
409 | 408 | * @return boolean|string True: plugin is active; False: plugin file doesn't exist at path; 'inactive' it's inactive |
410 | 409 | */ |
411 | 410 | static function get_plugin_status( $location = '' ) { |
@@ -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 | |
@@ -22,22 +22,22 @@ discard block |
||
22 | 22 | private function include_required_files() { |
23 | 23 | |
24 | 24 | // Migrate Class |
25 | - require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-migrate.php' ); |
|
25 | + require_once(GRAVITYVIEW_DIR.'includes/class-gravityview-migrate.php'); |
|
26 | 26 | |
27 | 27 | // Don't load tooltips if on Gravity Forms, otherwise it overrides translations |
28 | - if( class_exists( 'GFCommon' ) && class_exists( 'GFForms' ) && !GFForms::is_gravity_page() ) { |
|
29 | - require_once( GFCommon::get_base_path() . '/tooltips.php' ); |
|
28 | + if (class_exists('GFCommon') && class_exists('GFForms') && !GFForms::is_gravity_page()) { |
|
29 | + require_once(GFCommon::get_base_path().'/tooltips.php'); |
|
30 | 30 | } |
31 | 31 | |
32 | - require_once( GRAVITYVIEW_DIR . 'includes/admin/metaboxes/class-gravityview-admin-metaboxes.php' ); |
|
33 | - require_once( GRAVITYVIEW_DIR . 'includes/admin/entry-list.php' ); |
|
34 | - require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-change-entry-creator.php' ); |
|
32 | + require_once(GRAVITYVIEW_DIR.'includes/admin/metaboxes/class-gravityview-admin-metaboxes.php'); |
|
33 | + require_once(GRAVITYVIEW_DIR.'includes/admin/entry-list.php'); |
|
34 | + require_once(GRAVITYVIEW_DIR.'includes/class-gravityview-change-entry-creator.php'); |
|
35 | 35 | |
36 | 36 | /** @since 1.15 **/ |
37 | - require_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-support-port.php' ); |
|
37 | + require_once(GRAVITYVIEW_DIR.'includes/admin/class-gravityview-support-port.php'); |
|
38 | 38 | |
39 | 39 | /** @since 1.6 */ |
40 | - require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-admin-duplicate-view.php' ); |
|
40 | + require_once(GRAVITYVIEW_DIR.'includes/class-gravityview-admin-duplicate-view.php'); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -47,21 +47,21 @@ discard block |
||
47 | 47 | private function add_hooks() { |
48 | 48 | |
49 | 49 | // Filter Admin messages |
50 | - add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) ); |
|
51 | - add_filter( 'bulk_post_updated_messages', array( $this, 'post_updated_messages' ) ); |
|
50 | + add_filter('post_updated_messages', array($this, 'post_updated_messages')); |
|
51 | + add_filter('bulk_post_updated_messages', array($this, 'post_updated_messages')); |
|
52 | 52 | |
53 | - add_filter( 'plugin_action_links_'. plugin_basename( GRAVITYVIEW_FILE ) , array( $this, 'plugin_action_links' ) ); |
|
53 | + add_filter('plugin_action_links_'.plugin_basename(GRAVITYVIEW_FILE), array($this, 'plugin_action_links')); |
|
54 | 54 | |
55 | - add_action( 'plugins_loaded', array( $this, 'backend_actions' ), 100 ); |
|
55 | + add_action('plugins_loaded', array($this, 'backend_actions'), 100); |
|
56 | 56 | |
57 | 57 | //Hooks for no-conflict functionality |
58 | - add_action( 'wp_print_scripts', array( $this, 'no_conflict_scripts' ), 1000); |
|
59 | - add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_scripts' ), 9); |
|
58 | + add_action('wp_print_scripts', array($this, 'no_conflict_scripts'), 1000); |
|
59 | + add_action('admin_print_footer_scripts', array($this, 'no_conflict_scripts'), 9); |
|
60 | 60 | |
61 | - add_action( 'wp_print_styles', array( $this, 'no_conflict_styles' ), 1000); |
|
62 | - add_action( 'admin_print_styles', array( $this, 'no_conflict_styles' ), 11); |
|
63 | - add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_styles' ), 1); |
|
64 | - add_action( 'admin_footer', array( $this, 'no_conflict_styles' ), 1); |
|
61 | + add_action('wp_print_styles', array($this, 'no_conflict_styles'), 1000); |
|
62 | + add_action('admin_print_styles', array($this, 'no_conflict_styles'), 11); |
|
63 | + add_action('admin_print_footer_scripts', array($this, 'no_conflict_styles'), 1); |
|
64 | + add_action('admin_footer', array($this, 'no_conflict_styles'), 1); |
|
65 | 65 | |
66 | 66 | } |
67 | 67 | |
@@ -74,13 +74,13 @@ discard block |
||
74 | 74 | public function backend_actions() { |
75 | 75 | |
76 | 76 | /** @define "GRAVITYVIEW_DIR" "../" */ |
77 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.field.type.php' ); |
|
78 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.render.settings.php' ); |
|
79 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-label.php' ); |
|
80 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-views.php' ); |
|
81 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-welcome.php' ); |
|
82 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-add-shortcode.php' ); |
|
83 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' ); |
|
77 | + include_once(GRAVITYVIEW_DIR.'includes/admin/class.field.type.php'); |
|
78 | + include_once(GRAVITYVIEW_DIR.'includes/admin/class.render.settings.php'); |
|
79 | + include_once(GRAVITYVIEW_DIR.'includes/class-admin-label.php'); |
|
80 | + include_once(GRAVITYVIEW_DIR.'includes/class-admin-views.php'); |
|
81 | + include_once(GRAVITYVIEW_DIR.'includes/class-admin-welcome.php'); |
|
82 | + include_once(GRAVITYVIEW_DIR.'includes/class-admin-add-shortcode.php'); |
|
83 | + include_once(GRAVITYVIEW_DIR.'includes/class-admin-approve-entries.php'); |
|
84 | 84 | |
85 | 85 | /** |
86 | 86 | * @action `gravityview_include_backend_actions` Triggered after all GravityView admin files are loaded |
@@ -99,19 +99,19 @@ discard block |
||
99 | 99 | * @param array $links Array of action links under GravityView on the plugin page |
100 | 100 | * @return array Action links with Settings and Support included, if the user has the appropriate caps |
101 | 101 | */ |
102 | - public static function plugin_action_links( $links ) { |
|
102 | + public static function plugin_action_links($links) { |
|
103 | 103 | |
104 | 104 | $actions = array(); |
105 | 105 | |
106 | - if( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
107 | - $actions[] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
106 | + if (GVCommon::has_cap('gravityview_view_settings')) { |
|
107 | + $actions[] = sprintf('<a href="%s">%s</a>', admin_url('edit.php?post_type=gravityview&page=gravityview_settings'), esc_html__('Settings', 'gravityview')); |
|
108 | 108 | } |
109 | 109 | |
110 | - if( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
111 | - $actions[] = '<a href="http://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
110 | + if (GVCommon::has_cap('gravityview_support_port')) { |
|
111 | + $actions[] = '<a href="http://docs.gravityview.co">'.esc_html__('Support', 'gravityview').'</a>'; |
|
112 | 112 | } |
113 | 113 | |
114 | - return array_merge( $actions, $links ); |
|
114 | + return array_merge($actions, $links); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -128,70 +128,70 @@ discard block |
||
128 | 128 | * @param array $messages Existing messages |
129 | 129 | * @return array Messages with GravityView views! |
130 | 130 | */ |
131 | - function post_updated_messages( $messages, $bulk_counts = NULL ) { |
|
131 | + function post_updated_messages($messages, $bulk_counts = NULL) { |
|
132 | 132 | global $post; |
133 | 133 | |
134 | - $post_id = isset($_GET['post']) ? intval($_GET['post']) : ( is_object( $post ) && isset( $post->ID ) ? $post->ID : NULL ); |
|
134 | + $post_id = isset($_GET['post']) ? intval($_GET['post']) : (is_object($post) && isset($post->ID) ? $post->ID : NULL); |
|
135 | 135 | |
136 | 136 | // By default, there will only be one item being modified. |
137 | 137 | // When in the `bulk_post_updated_messages` filter, there will be passed a number |
138 | 138 | // of modified items that will override this array. |
139 | - $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1 , 'locked' => 1 , 'deleted' => 1 , 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
139 | + $bulk_counts = is_null($bulk_counts) ? array('updated' => 1, 'locked' => 1, 'deleted' => 1, 'trashed' => 1, 'untrashed' => 1) : $bulk_counts; |
|
140 | 140 | |
141 | 141 | |
142 | 142 | // If we're starting fresh, a new form was created. |
143 | 143 | // We should let the user know this is the case. |
144 | - $start_fresh = get_post_meta( $post_id, '_gravityview_start_fresh', true ); |
|
144 | + $start_fresh = get_post_meta($post_id, '_gravityview_start_fresh', true); |
|
145 | 145 | |
146 | 146 | $new_form_text = ''; |
147 | 147 | |
148 | - if( !empty( $start_fresh ) ) { |
|
148 | + if (!empty($start_fresh)) { |
|
149 | 149 | |
150 | 150 | // Get the form that was created |
151 | - $connected_form = gravityview_get_form_id( $post_id ); |
|
151 | + $connected_form = gravityview_get_form_id($post_id); |
|
152 | 152 | |
153 | - if( !empty( $connected_form ) ) { |
|
154 | - $form = gravityview_get_form( $connected_form ); |
|
155 | - $form_name = esc_attr( $form['title'] ); |
|
153 | + if (!empty($connected_form)) { |
|
154 | + $form = gravityview_get_form($connected_form); |
|
155 | + $form_name = esc_attr($form['title']); |
|
156 | 156 | $image = self::get_floaty(); |
157 | - $new_form_text .= '<h3>'.$image.sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ).'</h3>'; |
|
158 | - $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 |
|
157 | + $new_form_text .= '<h3>'.$image.sprintf(__('A new form was created for this View: "%s"', 'gravityview'), $form_name).'</h3>'; |
|
158 | + $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 |
|
159 | 159 | |
160 | 160 | 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. |
161 | - ', '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>'); |
|
162 | - $new_form_text = wpautop( $new_form_text ); |
|
161 | + ', '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>'); |
|
162 | + $new_form_text = wpautop($new_form_text); |
|
163 | 163 | |
164 | - delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
164 | + delete_post_meta($post_id, '_gravityview_start_fresh'); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | |
168 | 168 | $messages['gravityview'] = array( |
169 | 169 | 0 => '', // Unused. Messages start at index 1. |
170 | - 1 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
171 | - 2 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
172 | - 3 => __( 'View deleted.', 'gravityview' ), |
|
173 | - 4 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
170 | + 1 => sprintf(__('View updated. %sView on website.%s', 'gravityview'), '<a href="'.get_permalink($post_id).'">', '</a>'), |
|
171 | + 2 => sprintf(__('View updated. %sView on website.%s', 'gravityview'), '<a href="'.get_permalink($post_id).'">', '</a>'), |
|
172 | + 3 => __('View deleted.', 'gravityview'), |
|
173 | + 4 => sprintf(__('View updated. %sView on website.%s', 'gravityview'), '<a href="'.get_permalink($post_id).'">', '</a>'), |
|
174 | 174 | /* translators: %s: date and time of the revision */ |
175 | - 5 => isset( $_GET['revision'] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
176 | - 6 => sprintf(__( 'View published. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
177 | - 7 => sprintf(__( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
178 | - 8 => __( 'View submitted.', 'gravityview' ), |
|
175 | + 5 => isset($_GET['revision']) ? sprintf(__('View restored to revision from %s', 'gravityview'), wp_post_revision_title((int)$_GET['revision'], false)) : false, |
|
176 | + 6 => sprintf(__('View published. %sView on website.%s', 'gravityview'), '<a href="'.get_permalink($post_id).'">', '</a>').$new_form_text, |
|
177 | + 7 => sprintf(__('View saved. %sView on website.%s', 'gravityview'), '<a href="'.get_permalink($post_id).'">', '</a>').$new_form_text, |
|
178 | + 8 => __('View submitted.', 'gravityview'), |
|
179 | 179 | 9 => sprintf( |
180 | - __( 'View scheduled for: %1$s.', 'gravityview' ), |
|
180 | + __('View scheduled for: %1$s.', 'gravityview'), |
|
181 | 181 | // translators: Publish box date format, see http://php.net/date |
182 | - date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
183 | - ) . $new_form_text, |
|
184 | - 10 => sprintf(__( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
182 | + date_i18n(__('M j, Y @ G:i', 'gravityview'), strtotime((isset($post->post_date) ? $post->post_date : NULL))) |
|
183 | + ).$new_form_text, |
|
184 | + 10 => sprintf(__('View draft updated. %sView on website.%s', 'gravityview'), '<a href="'.get_permalink($post_id).'">', '</a>'), |
|
185 | 185 | |
186 | 186 | /** |
187 | 187 | * These apply to `bulk_post_updated_messages` |
188 | 188 | * @file wp-admin/edit.php |
189 | 189 | */ |
190 | - 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts['updated'], 'gravityview' ), |
|
191 | - 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts['locked'], 'gravityview' ), |
|
192 | - 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts['deleted'], 'gravityview' ), |
|
193 | - 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts['trashed'], 'gravityview' ), |
|
194 | - 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts['untrashed'], 'gravityview' ), |
|
190 | + 'updated' => _n('%s View updated.', '%s Views updated.', $bulk_counts['updated'], 'gravityview'), |
|
191 | + 'locked' => _n('%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts['locked'], 'gravityview'), |
|
192 | + 'deleted' => _n('%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts['deleted'], 'gravityview'), |
|
193 | + 'trashed' => _n('%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts['trashed'], 'gravityview'), |
|
194 | + 'untrashed' => _n('%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts['untrashed'], 'gravityview'), |
|
195 | 195 | ); |
196 | 196 | |
197 | 197 | return $messages; |
@@ -204,13 +204,13 @@ discard block |
||
204 | 204 | function no_conflict_scripts() { |
205 | 205 | global $wp_scripts; |
206 | 206 | |
207 | - if( ! gravityview_is_admin_page() ) { |
|
207 | + if (!gravityview_is_admin_page()) { |
|
208 | 208 | return; |
209 | 209 | } |
210 | 210 | |
211 | 211 | $no_conflict_mode = GravityView_Settings::getSetting('no-conflict-mode'); |
212 | 212 | |
213 | - if( empty( $no_conflict_mode ) ) { |
|
213 | + if (empty($no_conflict_mode)) { |
|
214 | 214 | return; |
215 | 215 | } |
216 | 216 | |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | 'jquery-ui-accordion', |
251 | 251 | ); |
252 | 252 | |
253 | - $this->remove_conflicts( $wp_scripts, $wp_allowed_scripts, 'scripts' ); |
|
253 | + $this->remove_conflicts($wp_scripts, $wp_allowed_scripts, 'scripts'); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | /** |
@@ -260,16 +260,16 @@ discard block |
||
260 | 260 | function no_conflict_styles() { |
261 | 261 | global $wp_styles; |
262 | 262 | |
263 | - if( ! gravityview_is_admin_page() ) { |
|
263 | + if (!gravityview_is_admin_page()) { |
|
264 | 264 | return; |
265 | 265 | } |
266 | 266 | |
267 | 267 | // Dequeue other jQuery styles even if no-conflict is off. |
268 | 268 | // Terrible-looking tabs help no one. |
269 | - if( !empty( $wp_styles->registered ) ) { |
|
269 | + if (!empty($wp_styles->registered)) { |
|
270 | 270 | foreach ($wp_styles->registered as $key => $style) { |
271 | - if( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) { |
|
272 | - wp_dequeue_style( $key ); |
|
271 | + if (preg_match('/^(?:wp\-)?jquery/ism', $key)) { |
|
272 | + wp_dequeue_style($key); |
|
273 | 273 | } |
274 | 274 | } |
275 | 275 | } |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | $no_conflict_mode = GravityView_Settings::getSetting('no-conflict-mode'); |
278 | 278 | |
279 | 279 | // If no conflict is off, jQuery will suffice. |
280 | - if( empty( $no_conflict_mode ) ) { |
|
280 | + if (empty($no_conflict_mode)) { |
|
281 | 281 | return; |
282 | 282 | } |
283 | 283 | |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | 'jquery-qtip.js', |
300 | 300 | ); |
301 | 301 | |
302 | - $this->remove_conflicts( $wp_styles, $wp_allowed_styles, 'styles' ); |
|
302 | + $this->remove_conflicts($wp_styles, $wp_allowed_styles, 'styles'); |
|
303 | 303 | |
304 | 304 | /** |
305 | 305 | * @action `gravityview_remove_conflicts_after` Runs after no-conflict styles are removed. You can re-add styles here. |
@@ -315,31 +315,31 @@ discard block |
||
315 | 315 | * @param string $type Either 'styles' or 'scripts' |
316 | 316 | * @return void |
317 | 317 | */ |
318 | - private function remove_conflicts( &$wp_objects, $required_objects, $type = 'scripts' ) { |
|
318 | + private function remove_conflicts(&$wp_objects, $required_objects, $type = 'scripts') { |
|
319 | 319 | |
320 | 320 | /** |
321 | 321 | * @filter `gravityview_noconflict_{$type}` Modify the list of no conflict scripts or styles\n |
322 | 322 | * Filter is `gravityview_noconflict_scripts` or `gravityview_noconflict_styles` |
323 | 323 | * @param array $required_objects |
324 | 324 | */ |
325 | - $required_objects = apply_filters( "gravityview_noconflict_{$type}", $required_objects ); |
|
325 | + $required_objects = apply_filters("gravityview_noconflict_{$type}", $required_objects); |
|
326 | 326 | |
327 | 327 | //reset queue |
328 | 328 | $queue = array(); |
329 | - foreach( $wp_objects->queue as $object ) { |
|
330 | - if( in_array( $object, $required_objects ) || preg_match('/gravityview|gf_|gravityforms/ism', $object ) ) { |
|
329 | + foreach ($wp_objects->queue as $object) { |
|
330 | + if (in_array($object, $required_objects) || preg_match('/gravityview|gf_|gravityforms/ism', $object)) { |
|
331 | 331 | $queue[] = $object; |
332 | 332 | } |
333 | 333 | } |
334 | 334 | $wp_objects->queue = $queue; |
335 | 335 | |
336 | - $required_objects = $this->add_script_dependencies( $wp_objects->registered, $required_objects ); |
|
336 | + $required_objects = $this->add_script_dependencies($wp_objects->registered, $required_objects); |
|
337 | 337 | |
338 | 338 | //unregistering scripts |
339 | 339 | $registered = array(); |
340 | - foreach( $wp_objects->registered as $handle => $script_registration ){ |
|
341 | - if( in_array( $handle, $required_objects ) ){ |
|
342 | - $registered[ $handle ] = $script_registration; |
|
340 | + foreach ($wp_objects->registered as $handle => $script_registration) { |
|
341 | + if (in_array($handle, $required_objects)) { |
|
342 | + $registered[$handle] = $script_registration; |
|
343 | 343 | } |
344 | 344 | } |
345 | 345 | $wp_objects->registered = $registered; |
@@ -356,16 +356,16 @@ discard block |
||
356 | 356 | //gets all dependent scripts linked to the $scripts array passed |
357 | 357 | do { |
358 | 358 | $dependents = array(); |
359 | - foreach ( $scripts as $script ) { |
|
360 | - $deps = isset( $registered[ $script ] ) && is_array( $registered[ $script ]->deps ) ? $registered[ $script ]->deps : array(); |
|
361 | - foreach ( $deps as $dep ) { |
|
362 | - if ( ! in_array( $dep, $scripts ) && ! in_array( $dep, $dependents ) ) { |
|
359 | + foreach ($scripts as $script) { |
|
360 | + $deps = isset($registered[$script]) && is_array($registered[$script]->deps) ? $registered[$script]->deps : array(); |
|
361 | + foreach ($deps as $dep) { |
|
362 | + if (!in_array($dep, $scripts) && !in_array($dep, $dependents)) { |
|
363 | 363 | $dependents[] = $dep; |
364 | 364 | } |
365 | 365 | } |
366 | 366 | } |
367 | - $scripts = array_merge( $scripts, $dependents ); |
|
368 | - } while ( ! empty( $dependents ) ); |
|
367 | + $scripts = array_merge($scripts, $dependents); |
|
368 | + } while (!empty($dependents)); |
|
369 | 369 | |
370 | 370 | return $scripts; |
371 | 371 | } |
@@ -385,8 +385,8 @@ discard block |
||
385 | 385 | * @deprecated since 1.12 |
386 | 386 | * @param array $notice Array with `class` and `message` keys. The message is not escaped. |
387 | 387 | */ |
388 | - public static function add_notice( $notice = array() ) { |
|
389 | - GravityView_Admin_Notices::add_notice( $notice ); |
|
388 | + public static function add_notice($notice = array()) { |
|
389 | + GravityView_Admin_Notices::add_notice($notice); |
|
390 | 390 | } |
391 | 391 | |
392 | 392 | /** |
@@ -408,8 +408,8 @@ discard block |
||
408 | 408 | |
409 | 409 | * @return boolean|string True: plugin is active; False: plugin file doesn't exist at path; 'inactive' it's inactive |
410 | 410 | */ |
411 | - static function get_plugin_status( $location = '' ) { |
|
412 | - return GravityView_Compatibility::get_plugin_status( $location ); |
|
411 | + static function get_plugin_status($location = '') { |
|
412 | + return GravityView_Compatibility::get_plugin_status($location); |
|
413 | 413 | } |
414 | 414 | |
415 | 415 | /** |
@@ -421,10 +421,10 @@ discard block |
||
421 | 421 | * |
422 | 422 | * @return bool|string|void 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`) |
423 | 423 | */ |
424 | - static function is_admin_page( $hook = '', $page = NULL ) { |
|
424 | + static function is_admin_page($hook = '', $page = NULL) { |
|
425 | 425 | global $current_screen, $plugin_page, $pagenow, $post; |
426 | 426 | |
427 | - if( ! is_admin() ) { return false; } |
|
427 | + if (!is_admin()) { return false; } |
|
428 | 428 | |
429 | 429 | $is_page = false; |
430 | 430 | |
@@ -432,21 +432,21 @@ discard block |
||
432 | 432 | |
433 | 433 | $is_gv_post_type_get = (isset($_GET['post_type']) && $_GET['post_type'] === 'gravityview'); |
434 | 434 | |
435 | - $is_gv_settings_get = isset( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings'; |
|
435 | + $is_gv_settings_get = isset($_GET['page']) && $_GET['page'] === 'gravityview_settings'; |
|
436 | 436 | |
437 | - if( empty( $post ) && $pagenow === 'post.php' && !empty( $_GET['post'] ) ) { |
|
438 | - $gv_post = get_post( intval( $_GET['post'] ) ); |
|
437 | + if (empty($post) && $pagenow === 'post.php' && !empty($_GET['post'])) { |
|
438 | + $gv_post = get_post(intval($_GET['post'])); |
|
439 | 439 | $is_gv_post_type = (!empty($gv_post) && !empty($gv_post->post_type) && $gv_post->post_type === 'gravityview'); |
440 | 440 | } else { |
441 | 441 | $is_gv_post_type = (!empty($post) && !empty($post->post_type) && $post->post_type === 'gravityview'); |
442 | 442 | } |
443 | 443 | |
444 | - if( $is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get ) { |
|
444 | + if ($is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get) { |
|
445 | 445 | |
446 | 446 | // $_GET `post_type` variable |
447 | - if(in_array($pagenow, array( 'post.php' , 'post-new.php' )) ) { |
|
447 | + if (in_array($pagenow, array('post.php', 'post-new.php'))) { |
|
448 | 448 | $is_page = 'single'; |
449 | - } else if ( in_array( $plugin_page, array( 'gravityview_settings', 'gravityview_page_gravityview_settings' ) ) || ( !empty( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings' ) ) { |
|
449 | + } else if (in_array($plugin_page, array('gravityview_settings', 'gravityview_page_gravityview_settings')) || (!empty($_GET['page']) && $_GET['page'] === 'gravityview_settings')) { |
|
450 | 450 | $is_page = 'settings'; |
451 | 451 | } else { |
452 | 452 | $is_page = 'views'; |
@@ -458,10 +458,10 @@ discard block |
||
458 | 458 | * @param[in,out] string|bool $is_page If false, no. If string, the name of the page (`single`, `settings`, or `views`) |
459 | 459 | * @param[in] string $hook The name of the page to check against. Is passed to the method. |
460 | 460 | */ |
461 | - $is_page = apply_filters( 'gravityview_is_admin_page', $is_page, $hook ); |
|
461 | + $is_page = apply_filters('gravityview_is_admin_page', $is_page, $hook); |
|
462 | 462 | |
463 | 463 | // If the current page is the same as the compared page |
464 | - if( !empty( $page ) ) { |
|
464 | + if (!empty($page)) { |
|
465 | 465 | return $is_page === $page; |
466 | 466 | } |
467 | 467 | |
@@ -473,5 +473,5 @@ discard block |
||
473 | 473 | new GravityView_Admin; |
474 | 474 | |
475 | 475 | function gravityview_is_admin_page($hook = '', $page = NULL) { |
476 | - return GravityView_Admin::is_admin_page( $hook, $page ); |
|
476 | + return GravityView_Admin::is_admin_page($hook, $page); |
|
477 | 477 | } |