@@ -14,13 +14,13 @@ |
||
14 | 14 | <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"> |
15 | 15 | <?php |
16 | 16 | |
17 | - foreach( $metaboxes as $metabox ) { |
|
18 | - $class = !isset( $class ) ? 'nav-tab-active' : ''; |
|
17 | + foreach ($metaboxes as $metabox) { |
|
18 | + $class = !isset($class) ? 'nav-tab-active' : ''; |
|
19 | 19 | ?> |
20 | 20 | <li class="ui-state-default"> |
21 | - <a class="nav-tab ui-tabs-anchor <?php echo $class; ?>" href="#<?php echo esc_attr( $metabox->id ); ?>"> |
|
21 | + <a class="nav-tab ui-tabs-anchor <?php echo $class; ?>" href="#<?php echo esc_attr($metabox->id); ?>"> |
|
22 | 22 | <span class="<?php echo $metabox->icon_class_name; ?>"></span> |
23 | - <?php echo esc_html( $metabox->title ); ?> |
|
23 | + <?php echo esc_html($metabox->title); ?> |
|
24 | 24 | </a> |
25 | 25 | </li> |
26 | 26 | <?php |
@@ -1,14 +1,14 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Display the tab navigation for the Settings metabox |
|
4 | - * |
|
5 | - * @package GravityView |
|
6 | - * @subpackage Gravityview/admin/metaboxes/views |
|
7 | - * @since 1.8 |
|
8 | - * |
|
9 | - * @global GravityView_Metabox_Tab[] $metaboxes |
|
10 | - * @global WP_Post $post |
|
11 | - */ |
|
3 | + * Display the tab navigation for the Settings metabox |
|
4 | + * |
|
5 | + * @package GravityView |
|
6 | + * @subpackage Gravityview/admin/metaboxes/views |
|
7 | + * @since 1.8 |
|
8 | + * |
|
9 | + * @global GravityView_Metabox_Tab[] $metaboxes |
|
10 | + * @global WP_Post $post |
|
11 | + */ |
|
12 | 12 | |
13 | 13 | ?> |
14 | 14 | <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"> |
@@ -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,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @package GravityView |
|
4 | - * @subpackage Gravityview/admin/metaboxes/partials |
|
5 | - * @global WP_Post $post |
|
6 | - */ |
|
3 | + * @package GravityView |
|
4 | + * @subpackage Gravityview/admin/metaboxes/partials |
|
5 | + * @global WP_Post $post |
|
6 | + */ |
|
7 | 7 | global $post; |
8 | 8 | |
9 | 9 | $curr_form = gravityview_get_form_id( $post->ID ); |
@@ -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> |
@@ -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 | } |