@@ -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 |
@@ -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> |
@@ -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 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | /** If this file is called directly, abort. */ |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if (!defined('ABSPATH')) { |
|
16 | 16 | die; |
17 | 17 | } |
18 | 18 | |
@@ -20,15 +20,15 @@ discard block |
||
20 | 20 | |
21 | 21 | function __construct() { |
22 | 22 | |
23 | - add_action( 'media_buttons', array( $this, 'add_shortcode_button'), 30); |
|
23 | + add_action('media_buttons', array($this, 'add_shortcode_button'), 30); |
|
24 | 24 | |
25 | - add_action( 'admin_footer', array( $this, 'add_shortcode_popup') ); |
|
25 | + add_action('admin_footer', array($this, 'add_shortcode_popup')); |
|
26 | 26 | |
27 | 27 | // adding styles and scripts |
28 | - add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') ); |
|
28 | + add_action('admin_enqueue_scripts', array($this, 'add_scripts_and_styles')); |
|
29 | 29 | |
30 | 30 | // ajax - populate sort fields based on the selected view |
31 | - add_action( 'wp_ajax_gv_sortable_fields', array( $this, 'get_sortable_fields' ) ); |
|
31 | + add_action('wp_ajax_gv_sortable_fields', array($this, 'get_sortable_fields')); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | function is_post_editor_screen() { |
42 | 42 | global $current_screen, $pagenow; |
43 | - return !empty( $current_screen->post_type ) && 'gravityview' != $current_screen->post_type && in_array( $pagenow , array( 'post.php' , 'post-new.php' ) ); |
|
43 | + return !empty($current_screen->post_type) && 'gravityview' != $current_screen->post_type && in_array($pagenow, array('post.php', 'post-new.php')); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | * @return void |
52 | 52 | */ |
53 | 53 | function add_shortcode_button() { |
54 | - if( !$this->is_post_editor_screen() ) { |
|
54 | + if (!$this->is_post_editor_screen()) { |
|
55 | 55 | return; |
56 | 56 | } |
57 | 57 | ?> |
58 | - <a href="#TB_inline?width=480&inlineId=select_gravityview_view&width=600&height=800" class="thickbox button gform_media_link" id="add_gravityview" title="<?php esc_attr_e("Insert View", 'gravityview'); ?>"><span class="icon gv-icon-astronaut-head"></span><?php esc_html_e( 'Add View', 'gravityview' ); ?></a> |
|
58 | + <a href="#TB_inline?width=480&inlineId=select_gravityview_view&width=600&height=800" class="thickbox button gform_media_link" id="add_gravityview" title="<?php esc_attr_e("Insert View", 'gravityview'); ?>"><span class="icon gv-icon-astronaut-head"></span><?php esc_html_e('Add View', 'gravityview'); ?></a> |
|
59 | 59 | <?php |
60 | 60 | |
61 | 61 | } |
@@ -71,17 +71,17 @@ discard block |
||
71 | 71 | function add_shortcode_popup() { |
72 | 72 | global $post; |
73 | 73 | |
74 | - if( !$this->is_post_editor_screen() ) { |
|
74 | + if (!$this->is_post_editor_screen()) { |
|
75 | 75 | return; |
76 | 76 | } |
77 | 77 | |
78 | 78 | $post_type = get_post_type_object($post->post_type); |
79 | 79 | |
80 | - $views = get_posts( array('post_type' => 'gravityview', 'posts_per_page' => -1 ) ); |
|
80 | + $views = get_posts(array('post_type' => 'gravityview', 'posts_per_page' => -1)); |
|
81 | 81 | |
82 | 82 | // If there are no views set up yet, we get outta here. |
83 | - if( empty( $views ) ) { |
|
84 | - echo '<div id="select_gravityview_view"><div class="wrap">'. GravityView_Post_Types::no_views_text() .'</div></div>'; |
|
83 | + if (empty($views)) { |
|
84 | + echo '<div id="select_gravityview_view"><div class="wrap">'.GravityView_Post_Types::no_views_text().'</div></div>'; |
|
85 | 85 | return; |
86 | 86 | } |
87 | 87 | |
@@ -90,18 +90,18 @@ discard block |
||
90 | 90 | <form action="#" method="get" id="select_gravityview_view_form"> |
91 | 91 | <div class="wrap"> |
92 | 92 | |
93 | - <h2 class=""><?php esc_html_e( 'Embed a View', 'gravityview' ); ?></h2> |
|
94 | - <p class="subtitle"><?php printf( esc_attr ( __( 'Use this form to embed a View into this %s. %sLearn more about using shortcodes.%s', 'gravityview') ), $post_type->labels->singular_name, '<a href="http://gravityview.co/support/documentation/202934188/" target="_blank">', '</a>' ); ?></p> |
|
93 | + <h2 class=""><?php esc_html_e('Embed a View', 'gravityview'); ?></h2> |
|
94 | + <p class="subtitle"><?php printf(esc_attr(__('Use this form to embed a View into this %s. %sLearn more about using shortcodes.%s', 'gravityview')), $post_type->labels->singular_name, '<a href="http://gravityview.co/support/documentation/202934188/" target="_blank">', '</a>'); ?></p> |
|
95 | 95 | |
96 | 96 | <div> |
97 | - <h3><label for="gravityview_id"><?php esc_html_e( 'Select a View', 'gravityview' ); ?></label></h3> |
|
97 | + <h3><label for="gravityview_id"><?php esc_html_e('Select a View', 'gravityview'); ?></label></h3> |
|
98 | 98 | |
99 | 99 | <select name="gravityview_id" id="gravityview_id"> |
100 | - <option value=""><?php esc_html_e( '— Select a View to Insert —', 'gravityview' ); ?></option> |
|
100 | + <option value=""><?php esc_html_e('— Select a View to Insert —', 'gravityview'); ?></option> |
|
101 | 101 | <?php |
102 | - foreach( $views as $view ) { |
|
103 | - $title = empty( $view->post_title ) ? __('(no title)', 'gravityview') : $view->post_title; |
|
104 | - echo '<option value="'. $view->ID .'">'. esc_html( sprintf('%s #%d', $title, $view->ID ) ) .'</option>'; |
|
102 | + foreach ($views as $view) { |
|
103 | + $title = empty($view->post_title) ? __('(no title)', 'gravityview') : $view->post_title; |
|
104 | + echo '<option value="'.$view->ID.'">'.esc_html(sprintf('%s #%d', $title, $view->ID)).'</option>'; |
|
105 | 105 | } |
106 | 106 | ?> |
107 | 107 | </select> |
@@ -109,24 +109,24 @@ discard block |
||
109 | 109 | |
110 | 110 | <table class="form-table hide-if-js"> |
111 | 111 | |
112 | - <caption><?php esc_html_e( 'View Settings', 'gravityview' ); ?></caption> |
|
112 | + <caption><?php esc_html_e('View Settings', 'gravityview'); ?></caption> |
|
113 | 113 | |
114 | 114 | <?php |
115 | 115 | |
116 | - $settings = GravityView_View_Data::get_default_args( true ); |
|
116 | + $settings = GravityView_View_Data::get_default_args(true); |
|
117 | 117 | |
118 | - foreach ( $settings as $key => $setting ) { |
|
118 | + foreach ($settings as $key => $setting) { |
|
119 | 119 | |
120 | - if( empty( $setting['show_in_shortcode'] ) ) { continue; } |
|
120 | + if (empty($setting['show_in_shortcode'])) { continue; } |
|
121 | 121 | |
122 | - GravityView_Render_Settings::render_setting_row( $key, array(), NULL, 'gravityview_%s', 'gravityview_%s' ); |
|
122 | + GravityView_Render_Settings::render_setting_row($key, array(), NULL, 'gravityview_%s', 'gravityview_%s'); |
|
123 | 123 | } |
124 | 124 | ?> |
125 | 125 | |
126 | 126 | </table> |
127 | 127 | |
128 | 128 | <div class="submit"> |
129 | - <input type="submit" class="button button-primary button-large alignleft hide-if-js" value="<?php esc_attr_e('Insert View', 'gravityview' ); ?>" id="insert_gravityview_view" /> |
|
129 | + <input type="submit" class="button button-primary button-large alignleft hide-if-js" value="<?php esc_attr_e('Insert View', 'gravityview'); ?>" id="insert_gravityview_view" /> |
|
130 | 130 | <input class="button button-secondary alignright" type="submit" onclick="tb_remove(); return false;" value="<?php esc_attr_e("Cancel", 'gravityview'); ?>" /> |
131 | 131 | </div> |
132 | 132 | |
@@ -149,32 +149,32 @@ discard block |
||
149 | 149 | */ |
150 | 150 | function add_scripts_and_styles() { |
151 | 151 | |
152 | - if( ! $this->is_post_editor_screen() ) { |
|
152 | + if (!$this->is_post_editor_screen()) { |
|
153 | 153 | return; |
154 | 154 | } |
155 | 155 | |
156 | - wp_enqueue_style( 'dashicons' ); |
|
156 | + wp_enqueue_style('dashicons'); |
|
157 | 157 | |
158 | 158 | // date picker |
159 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
159 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
160 | 160 | |
161 | 161 | $protocol = is_ssl() ? 'https://' : 'http://'; |
162 | 162 | |
163 | - wp_enqueue_style( 'jquery-ui-datepicker', $protocol.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css', array(), GravityView_Plugin::version ); |
|
163 | + wp_enqueue_style('jquery-ui-datepicker', $protocol.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css', array(), GravityView_Plugin::version); |
|
164 | 164 | |
165 | 165 | //enqueue styles |
166 | - wp_register_style( 'gravityview_postedit_styles', plugins_url('assets/css/admin-post-edit.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
167 | - wp_enqueue_style( 'gravityview_postedit_styles' ); |
|
166 | + wp_register_style('gravityview_postedit_styles', plugins_url('assets/css/admin-post-edit.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version); |
|
167 | + wp_enqueue_style('gravityview_postedit_styles'); |
|
168 | 168 | |
169 | 169 | $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
170 | 170 | |
171 | 171 | // custom js |
172 | - wp_register_script( 'gravityview_postedit_scripts', plugins_url('assets/js/admin-post-edit'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery', 'jquery-ui-datepicker' ), GravityView_Plugin::version ); |
|
173 | - wp_enqueue_script( 'gravityview_postedit_scripts' ); |
|
172 | + wp_register_script('gravityview_postedit_scripts', plugins_url('assets/js/admin-post-edit'.$script_debug.'.js', GRAVITYVIEW_FILE), array('jquery', 'jquery-ui-datepicker'), GravityView_Plugin::version); |
|
173 | + wp_enqueue_script('gravityview_postedit_scripts'); |
|
174 | 174 | wp_localize_script('gravityview_postedit_scripts', 'gvGlobals', array( |
175 | - 'nonce' => wp_create_nonce( 'gravityview_ajaxaddshortcode'), |
|
176 | - 'loading_text' => esc_html__( 'Loading…', 'gravityview' ), |
|
177 | - 'alert_1' => esc_html__( 'Please select a View', 'gravityview'), |
|
175 | + 'nonce' => wp_create_nonce('gravityview_ajaxaddshortcode'), |
|
176 | + 'loading_text' => esc_html__('Loading…', 'gravityview'), |
|
177 | + 'alert_1' => esc_html__('Please select a View', 'gravityview'), |
|
178 | 178 | )); |
179 | 179 | |
180 | 180 | } |
@@ -191,27 +191,27 @@ discard block |
||
191 | 191 | function get_sortable_fields() { |
192 | 192 | |
193 | 193 | // Not properly formatted request |
194 | - if ( empty( $_POST['viewid'] ) || !is_numeric( $_POST['viewid'] ) ) { |
|
195 | - exit( false ); |
|
194 | + if (empty($_POST['viewid']) || !is_numeric($_POST['viewid'])) { |
|
195 | + exit(false); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | // Not valid request |
199 | - if( empty( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxaddshortcode' ) ) { |
|
200 | - exit( false ); |
|
199 | + if (empty($_POST['nonce']) || !wp_verify_nonce($_POST['nonce'], 'gravityview_ajaxaddshortcode')) { |
|
200 | + exit(false); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | $viewid = (int)$_POST['viewid']; |
204 | 204 | |
205 | 205 | // fetch form id assigned to the view |
206 | - $formid = gravityview_get_form_id( $viewid ); |
|
206 | + $formid = gravityview_get_form_id($viewid); |
|
207 | 207 | |
208 | 208 | // Get the default sort field for the view |
209 | - $sort_field = gravityview_get_template_setting( $viewid, 'sort_field' ); |
|
209 | + $sort_field = gravityview_get_template_setting($viewid, 'sort_field'); |
|
210 | 210 | |
211 | 211 | // Generate the output `<option>`s |
212 | - $response = gravityview_get_sortable_fields( $formid, $sort_field ); |
|
212 | + $response = gravityview_get_sortable_fields($formid, $sort_field); |
|
213 | 213 | |
214 | - exit( $response ); |
|
214 | + exit($response); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | } |
@@ -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 | } |
@@ -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 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | /** If this file is called directly, abort. */ |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if (!defined('ABSPATH')) { |
|
16 | 16 | die; |
17 | 17 | } |
18 | 18 | |
@@ -22,40 +22,40 @@ discard block |
||
22 | 22 | |
23 | 23 | function __construct() { |
24 | 24 | |
25 | - add_action( 'save_post', array( $this, 'save_postdata' ) ); |
|
25 | + add_action('save_post', array($this, 'save_postdata')); |
|
26 | 26 | |
27 | 27 | // set the blacklist field types across the entire plugin |
28 | - add_filter( 'gravityview_blacklist_field_types', array( $this, 'default_field_blacklist' ), 10, 2 ); |
|
28 | + add_filter('gravityview_blacklist_field_types', array($this, 'default_field_blacklist'), 10, 2); |
|
29 | 29 | |
30 | 30 | // Tooltips |
31 | - add_filter( 'gform_tooltips', array( $this, 'tooltips') ); |
|
31 | + add_filter('gform_tooltips', array($this, 'tooltips')); |
|
32 | 32 | |
33 | 33 | // adding styles and scripts |
34 | - add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles'), 999 ); |
|
35 | - add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
36 | - add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
37 | - add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
38 | - add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
39 | - |
|
40 | - add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas'), 10, 4 ); |
|
41 | - add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas'), 10, 3 ); |
|
42 | - add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields'), 10, 2 ); |
|
43 | - add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets') ); |
|
44 | - add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas'), 10, 5 ); |
|
34 | + add_action('admin_enqueue_scripts', array('GravityView_Admin_Views', 'add_scripts_and_styles'), 999); |
|
35 | + add_filter('gform_noconflict_styles', array($this, 'register_no_conflict')); |
|
36 | + add_filter('gform_noconflict_scripts', array($this, 'register_no_conflict')); |
|
37 | + add_filter('gravityview_noconflict_styles', array($this, 'register_no_conflict')); |
|
38 | + add_filter('gravityview_noconflict_scripts', array($this, 'register_no_conflict')); |
|
39 | + |
|
40 | + add_action('gravityview_render_directory_active_areas', array($this, 'render_directory_active_areas'), 10, 4); |
|
41 | + add_action('gravityview_render_widgets_active_areas', array($this, 'render_widgets_active_areas'), 10, 3); |
|
42 | + add_action('gravityview_render_available_fields', array($this, 'render_available_fields'), 10, 2); |
|
43 | + add_action('gravityview_render_available_widgets', array($this, 'render_available_widgets')); |
|
44 | + add_action('gravityview_render_active_areas', array($this, 'render_active_areas'), 10, 5); |
|
45 | 45 | |
46 | 46 | // @todo check if this hook is needed.. |
47 | 47 | //add_action( 'gravityview_render_field_options', array( $this, 'render_field_options'), 10, 9 ); |
48 | 48 | |
49 | 49 | // Add Connected Form column |
50 | - add_filter('manage_gravityview_posts_columns' , array( $this, 'add_post_type_columns' ) ); |
|
50 | + add_filter('manage_gravityview_posts_columns', array($this, 'add_post_type_columns')); |
|
51 | 51 | |
52 | - add_filter( 'gform_toolbar_menu', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 ); |
|
52 | + add_filter('gform_toolbar_menu', array('GravityView_Admin_Views', 'gform_toolbar_menu'), 10, 2); |
|
53 | 53 | |
54 | - add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content'), 10, 2 ); |
|
54 | + add_action('manage_gravityview_posts_custom_column', array($this, 'add_custom_column_content'), 10, 2); |
|
55 | 55 | |
56 | - add_action( 'restrict_manage_posts', array( $this, 'add_view_dropdown' ) ); |
|
56 | + add_action('restrict_manage_posts', array($this, 'add_view_dropdown')); |
|
57 | 57 | |
58 | - add_action( 'pre_get_posts', array( $this, 'filter_pre_get_posts_by_gravityview_form_id' ) ); |
|
58 | + add_action('pre_get_posts', array($this, 'filter_pre_get_posts_by_gravityview_form_id')); |
|
59 | 59 | |
60 | 60 | } |
61 | 61 | |
@@ -63,42 +63,42 @@ discard block |
||
63 | 63 | * @since 1.15 |
64 | 64 | * @param WP_Query $query |
65 | 65 | */ |
66 | - public function filter_pre_get_posts_by_gravityview_form_id( &$query ) { |
|
66 | + public function filter_pre_get_posts_by_gravityview_form_id(&$query) { |
|
67 | 67 | global $pagenow; |
68 | 68 | |
69 | - if ( !is_admin() ) { |
|
69 | + if (!is_admin()) { |
|
70 | 70 | return; |
71 | 71 | } |
72 | 72 | |
73 | - if( 'edit.php' !== $pagenow || ! rgget( 'gravityview_form_id' ) || ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
73 | + if ('edit.php' !== $pagenow || !rgget('gravityview_form_id') || !isset($query->query_vars['post_type'])) { |
|
74 | 74 | return; |
75 | 75 | } |
76 | 76 | |
77 | - if ( $query->query_vars[ 'post_type' ] == 'gravityview' ) { |
|
78 | - $query->set( 'meta_query', array( |
|
77 | + if ($query->query_vars['post_type'] == 'gravityview') { |
|
78 | + $query->set('meta_query', array( |
|
79 | 79 | array( |
80 | 80 | 'key' => '_gravityview_form_id', |
81 | - 'value' => rgget( 'gravityview_form_id' ), |
|
81 | + 'value' => rgget('gravityview_form_id'), |
|
82 | 82 | ) |
83 | - ) ); |
|
83 | + )); |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | |
87 | 87 | function add_view_dropdown() { |
88 | 88 | $current_screen = get_current_screen(); |
89 | 89 | |
90 | - if( 'gravityview' !== $current_screen->post_type ) { |
|
90 | + if ('gravityview' !== $current_screen->post_type) { |
|
91 | 91 | return; |
92 | 92 | } |
93 | 93 | |
94 | 94 | $forms = gravityview_get_forms(); |
95 | - $current_form = rgget( 'gravityview_form_id' ); |
|
95 | + $current_form = rgget('gravityview_form_id'); |
|
96 | 96 | // If there are no forms to select, show no forms. |
97 | - if( !empty( $forms ) ) { ?> |
|
97 | + if (!empty($forms)) { ?> |
|
98 | 98 | <select name="gravityview_form_id" id="gravityview_form_id"> |
99 | - <option value="" <?php selected( '', $current_form, true ); ?>><?php esc_html_e( 'All forms', 'gravityview' ); ?></option> |
|
100 | - <?php foreach( $forms as $form ) { ?> |
|
101 | - <option value="<?php echo $form['id']; ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option> |
|
99 | + <option value="" <?php selected('', $current_form, true); ?>><?php esc_html_e('All forms', 'gravityview'); ?></option> |
|
100 | + <?php foreach ($forms as $form) { ?> |
|
101 | + <option value="<?php echo $form['id']; ?>" <?php selected($form['id'], $current_form, true); ?>><?php echo esc_html($form['title']); ?></option> |
|
102 | 102 | <?php } ?> |
103 | 103 | </select> |
104 | 104 | <?php } |
@@ -109,18 +109,18 @@ discard block |
||
109 | 109 | * @deprecated since 1.2 |
110 | 110 | * Start using GravityView_Render_Settings::render_setting_row |
111 | 111 | */ |
112 | - public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) { |
|
113 | - _deprecated_function( 'GravityView_Admin_Views::render_setting_row', '1.1.7', 'GravityView_Render_Settings::render_setting_row' ); |
|
114 | - GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name , $id ); |
|
112 | + public static function render_setting_row($key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s') { |
|
113 | + _deprecated_function('GravityView_Admin_Views::render_setting_row', '1.1.7', 'GravityView_Render_Settings::render_setting_row'); |
|
114 | + GravityView_Render_Settings::render_setting_row($key, $current_settings, $override_input, $name, $id); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
118 | 118 | * @deprecated since 1.2 |
119 | 119 | * Start using GravityView_Render_Settings::render_field_option |
120 | 120 | */ |
121 | - public static function render_field_option( $name = '', $option, $curr_value = NULL ) { |
|
122 | - _deprecated_function( 'GravityView_Admin_Views::render_field_option', '1.1.7', 'GravityView_Render_Settings::render_field_option' ); |
|
123 | - return GravityView_Render_Settings::render_field_option( $name, $option, $curr_value ); |
|
121 | + public static function render_field_option($name = '', $option, $curr_value = NULL) { |
|
122 | + _deprecated_function('GravityView_Admin_Views::render_field_option', '1.1.7', 'GravityView_Render_Settings::render_field_option'); |
|
123 | + return GravityView_Render_Settings::render_field_option($name, $option, $curr_value); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | |
@@ -130,31 +130,31 @@ discard block |
||
130 | 130 | * @param int $id ID of the current Gravity form |
131 | 131 | * @return array Modified array |
132 | 132 | */ |
133 | - static function gform_toolbar_menu( $menu_items = array(), $id = NULL ) { |
|
133 | + static function gform_toolbar_menu($menu_items = array(), $id = NULL) { |
|
134 | 134 | |
135 | - $connected_views = gravityview_get_connected_views( $id ); |
|
135 | + $connected_views = gravityview_get_connected_views($id); |
|
136 | 136 | |
137 | - if( empty( $connected_views ) ) { |
|
137 | + if (empty($connected_views)) { |
|
138 | 138 | return $menu_items; |
139 | 139 | } |
140 | 140 | |
141 | 141 | $sub_menu_items = array(); |
142 | - foreach ( (array)$connected_views as $view ) { |
|
142 | + foreach ((array)$connected_views as $view) { |
|
143 | 143 | |
144 | - if( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
144 | + if (!GVCommon::has_cap('edit_gravityview', $view->ID)) { |
|
145 | 145 | continue; |
146 | 146 | } |
147 | 147 | |
148 | - $label = empty( $view->post_title ) ? sprintf( __('No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
148 | + $label = empty($view->post_title) ? sprintf(__('No Title (View #%d)', 'gravityview'), $view->ID) : $view->post_title; |
|
149 | 149 | |
150 | 150 | $sub_menu_items[] = array( |
151 | - 'label' => esc_attr( $label ), |
|
152 | - 'url' => admin_url( 'post.php?action=edit&post='.$view->ID ), |
|
151 | + 'label' => esc_attr($label), |
|
152 | + 'url' => admin_url('post.php?action=edit&post='.$view->ID), |
|
153 | 153 | ); |
154 | 154 | } |
155 | 155 | |
156 | 156 | // If there were no items added, then let's create the parent menu |
157 | - if( $sub_menu_items ) { |
|
157 | + if ($sub_menu_items) { |
|
158 | 158 | |
159 | 159 | // Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown |
160 | 160 | $sub_menu_items[] = array( |
@@ -165,16 +165,16 @@ discard block |
||
165 | 165 | ); |
166 | 166 | |
167 | 167 | $menu_items['gravityview'] = array( |
168 | - 'label' => __( 'Connected Views', 'gravityview' ), |
|
168 | + 'label' => __('Connected Views', 'gravityview'), |
|
169 | 169 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
170 | - 'title' => __( 'GravityView Views using this form as a data source', 'gravityview' ), |
|
170 | + 'title' => __('GravityView Views using this form as a data source', 'gravityview'), |
|
171 | 171 | 'url' => '#', |
172 | 172 | 'onclick' => 'return false;', |
173 | 173 | 'menu_class' => 'gv_connected_forms gf_form_toolbar_settings', |
174 | - 'link_class' => ( 1 === 1 ? '' : 'gf_toolbar_disabled' ), |
|
174 | + 'link_class' => (1 === 1 ? '' : 'gf_toolbar_disabled'), |
|
175 | 175 | 'sub_menu_items' => $sub_menu_items, |
176 | 176 | 'priority' => 0, |
177 | - 'capabilities' => array( 'edit_gravityviews' ), |
|
177 | + 'capabilities' => array('edit_gravityviews'), |
|
178 | 178 | ); |
179 | 179 | } |
180 | 180 | |
@@ -189,16 +189,16 @@ discard block |
||
189 | 189 | * @access public |
190 | 190 | * @return array Default blacklist fields merged with existing blacklist fields |
191 | 191 | */ |
192 | - function default_field_blacklist( $array = array(), $context = NULL ) { |
|
192 | + function default_field_blacklist($array = array(), $context = NULL) { |
|
193 | 193 | |
194 | - $add = array( 'captcha', 'page' ); |
|
194 | + $add = array('captcha', 'page'); |
|
195 | 195 | |
196 | 196 | // Don't allowing editing the following values: |
197 | - if( $context === 'edit' ) { |
|
197 | + if ($context === 'edit') { |
|
198 | 198 | $add[] = 'post_id'; |
199 | 199 | } |
200 | 200 | |
201 | - $return = array_merge( $array, $add ); |
|
201 | + $return = array_merge($array, $add); |
|
202 | 202 | |
203 | 203 | return $return; |
204 | 204 | } |
@@ -208,33 +208,33 @@ discard block |
||
208 | 208 | * @param array $tooltips Array of Gravity Forms tooltips |
209 | 209 | * @return array Modified tooltips array |
210 | 210 | */ |
211 | - public function tooltips( $tooltips = array() ) { |
|
211 | + public function tooltips($tooltips = array()) { |
|
212 | 212 | |
213 | 213 | $gv_tooltips = array(); |
214 | 214 | |
215 | 215 | // Generate tooltips for View settings |
216 | - $default_args = GravityView_View_Data::get_default_args( true ); |
|
216 | + $default_args = GravityView_View_Data::get_default_args(true); |
|
217 | 217 | |
218 | - foreach ( $default_args as $key => $arg ) { |
|
218 | + foreach ($default_args as $key => $arg) { |
|
219 | 219 | |
220 | 220 | // If an arg has `tooltip` defined, but it's false, don't display a tooltip |
221 | - if( isset( $arg['tooltip'] ) && empty( $arg['tooltip'] ) ) { continue; } |
|
221 | + if (isset($arg['tooltip']) && empty($arg['tooltip'])) { continue; } |
|
222 | 222 | |
223 | 223 | // By default, use `tooltip` if defined. |
224 | - $tooltip = empty( $arg['tooltip'] ) ? NULL : $arg['tooltip']; |
|
224 | + $tooltip = empty($arg['tooltip']) ? NULL : $arg['tooltip']; |
|
225 | 225 | |
226 | 226 | // Otherwise, use the description as a tooltip. |
227 | - if( empty( $tooltip ) && !empty( $arg['desc'] ) ) { |
|
227 | + if (empty($tooltip) && !empty($arg['desc'])) { |
|
228 | 228 | $tooltip = $arg['desc']; |
229 | 229 | } |
230 | 230 | |
231 | 231 | // If there's no tooltip set, continue |
232 | - if( empty( $tooltip ) ) { |
|
232 | + if (empty($tooltip)) { |
|
233 | 233 | continue; |
234 | 234 | } |
235 | 235 | |
236 | 236 | // Add the tooltip |
237 | - $gv_tooltips[ 'gv_'.$key ] = array( |
|
237 | + $gv_tooltips['gv_'.$key] = array( |
|
238 | 238 | 'title' => $arg['label'], |
239 | 239 | 'value' => $tooltip, |
240 | 240 | ); |
@@ -243,20 +243,20 @@ discard block |
||
243 | 243 | |
244 | 244 | $gv_tooltips['gv_css_merge_tags'] = array( |
245 | 245 | 'title' => __('CSS Merge Tags', 'gravityview'), |
246 | - 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview'), '<code>', '</code>' ) |
|
246 | + 'value' => sprintf(__('Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview'), '<code>', '</code>') |
|
247 | 247 | ); |
248 | 248 | |
249 | 249 | /** |
250 | 250 | * @filter `gravityview_tooltips` The tooltips GravityView adds to the Gravity Forms tooltip array |
251 | 251 | * @param array $gv_tooltips Associative array with unique keys containing array of `title` and `value` keys, as expected by `gform_tooltips` filter |
252 | 252 | */ |
253 | - $gv_tooltips = apply_filters( 'gravityview_tooltips', $gv_tooltips ); |
|
253 | + $gv_tooltips = apply_filters('gravityview_tooltips', $gv_tooltips); |
|
254 | 254 | |
255 | - foreach ( $gv_tooltips as $key => $tooltip ) { |
|
255 | + foreach ($gv_tooltips as $key => $tooltip) { |
|
256 | 256 | |
257 | - $title = empty( $tooltip['title'] ) ? '' : '<h6>'.esc_html( $tooltip['title'] ) .'</h6>'; |
|
257 | + $title = empty($tooltip['title']) ? '' : '<h6>'.esc_html($tooltip['title']).'</h6>'; |
|
258 | 258 | |
259 | - $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip['value'] ) ); |
|
259 | + $tooltips[$key] = $title.wpautop(esc_html($tooltip['value'])); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | return $tooltips; |
@@ -270,27 +270,27 @@ discard block |
||
270 | 270 | * |
271 | 271 | * @return void |
272 | 272 | */ |
273 | - public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
273 | + public function add_custom_column_content($column_name = NULL, $post_id) { |
|
274 | 274 | |
275 | 275 | $output = ''; |
276 | 276 | |
277 | - switch ( $column_name ) { |
|
277 | + switch ($column_name) { |
|
278 | 278 | case 'gv_template': |
279 | 279 | |
280 | - $template_id = gravityview_get_template_id( $post_id ); |
|
280 | + $template_id = gravityview_get_template_id($post_id); |
|
281 | 281 | |
282 | 282 | // All Views should have a connected form. If it doesn't, that's not right. |
283 | - if ( empty( $template_id ) ) { |
|
284 | - do_action( 'gravityview_log_error', sprintf( __METHOD__ . ' View ID %s does not have a connected template.', $post_id ) ); |
|
283 | + if (empty($template_id)) { |
|
284 | + do_action('gravityview_log_error', sprintf(__METHOD__.' View ID %s does not have a connected template.', $post_id)); |
|
285 | 285 | break; |
286 | 286 | } |
287 | 287 | |
288 | 288 | $templates = gravityview_get_registered_templates(); |
289 | 289 | |
290 | - $template = isset( $templates[ $template_id ] ) ? $templates[ $template_id ] : false; |
|
290 | + $template = isset($templates[$template_id]) ? $templates[$template_id] : false; |
|
291 | 291 | |
292 | 292 | // Generate backup if label doesn't exist: `example_name` => `Example Name` |
293 | - $template_id_pretty = ucwords( implode( ' ', explode( '_', $template_id ) ) ); |
|
293 | + $template_id_pretty = ucwords(implode(' ', explode('_', $template_id))); |
|
294 | 294 | |
295 | 295 | $output = $template ? $template['label'] : $template_id_pretty; |
296 | 296 | |
@@ -298,24 +298,24 @@ discard block |
||
298 | 298 | |
299 | 299 | case 'gv_connected_form': |
300 | 300 | |
301 | - $form_id = gravityview_get_form_id( $post_id ); |
|
301 | + $form_id = gravityview_get_form_id($post_id); |
|
302 | 302 | |
303 | 303 | // All Views should have a connected form. If it doesn't, that's not right. |
304 | - if ( empty( $form_id ) ) { |
|
305 | - do_action( 'gravityview_log_error', sprintf( '[add_data_source_column_content] View ID %s does not have a connected GF form.', $post_id ) ); |
|
306 | - $output = __( 'Not connected.', 'gravityview' ); |
|
304 | + if (empty($form_id)) { |
|
305 | + do_action('gravityview_log_error', sprintf('[add_data_source_column_content] View ID %s does not have a connected GF form.', $post_id)); |
|
306 | + $output = __('Not connected.', 'gravityview'); |
|
307 | 307 | break; |
308 | 308 | } |
309 | 309 | |
310 | - $form = gravityview_get_form( $form_id ); |
|
310 | + $form = gravityview_get_form($form_id); |
|
311 | 311 | |
312 | - if ( ! $form ) { |
|
313 | - do_action( 'gravityview_log_error', sprintf( '[add_data_source_column_content] Connected form not found: Form #%d', $form_id ) ); |
|
312 | + if (!$form) { |
|
313 | + do_action('gravityview_log_error', sprintf('[add_data_source_column_content] Connected form not found: Form #%d', $form_id)); |
|
314 | 314 | |
315 | - $output = __( 'The connected form can not be found; it may no longer exist.', 'gravityview' ); |
|
315 | + $output = __('The connected form can not be found; it may no longer exist.', 'gravityview'); |
|
316 | 316 | } |
317 | 317 | |
318 | - $output = self::get_connected_form_links( $form ); |
|
318 | + $output = self::get_connected_form_links($form); |
|
319 | 319 | |
320 | 320 | break; |
321 | 321 | } |
@@ -330,47 +330,47 @@ discard block |
||
330 | 330 | * @param boolean $include_form_link Whether to include the bold name of the form in the output |
331 | 331 | * @return string HTML links |
332 | 332 | */ |
333 | - static public function get_connected_form_links( $form, $include_form_link = true ) { |
|
333 | + static public function get_connected_form_links($form, $include_form_link = true) { |
|
334 | 334 | |
335 | 335 | // Either the form is empty or the form ID is 0, not yet set. |
336 | - if( empty( $form ) ) { |
|
336 | + if (empty($form)) { |
|
337 | 337 | return ''; |
338 | 338 | } |
339 | 339 | |
340 | 340 | // The $form is passed as the form ID |
341 | - if( !is_array( $form ) ) { |
|
342 | - $form = gravityview_get_form( $form ); |
|
341 | + if (!is_array($form)) { |
|
342 | + $form = gravityview_get_form($form); |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | $form_id = $form['id']; |
346 | 346 | $links = array(); |
347 | 347 | |
348 | - if( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
349 | - $form_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&id=%d', $form_id ) ); |
|
350 | - $form_link = '<strong class="gv-form-title">'.gravityview_get_link( $form_url, $form['title'], 'class=row-title' ).'</strong>'; |
|
351 | - $links[] = '<span>'.gravityview_get_link( $form_url, __('Edit Form', 'gravityview') ).'</span>'; |
|
348 | + if (GVCommon::has_cap('gravityforms_edit_forms')) { |
|
349 | + $form_url = admin_url(sprintf('admin.php?page=gf_edit_forms&id=%d', $form_id)); |
|
350 | + $form_link = '<strong class="gv-form-title">'.gravityview_get_link($form_url, $form['title'], 'class=row-title').'</strong>'; |
|
351 | + $links[] = '<span>'.gravityview_get_link($form_url, __('Edit Form', 'gravityview')).'</span>'; |
|
352 | 352 | } else { |
353 | - $form_link = '<strong class="gv-form-title">'. esc_html( $form['title'] ). '</strong>'; |
|
353 | + $form_link = '<strong class="gv-form-title">'.esc_html($form['title']).'</strong>'; |
|
354 | 354 | } |
355 | 355 | |
356 | - if( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
357 | - $entries_url = admin_url( sprintf( 'admin.php?page=gf_entries&id=%d', $form_id ) ); |
|
358 | - $links[] = '<span>'.gravityview_get_link( $entries_url, __('Entries', 'gravityview') ).'</span>'; |
|
356 | + if (GVCommon::has_cap('gravityforms_view_entries')) { |
|
357 | + $entries_url = admin_url(sprintf('admin.php?page=gf_entries&id=%d', $form_id)); |
|
358 | + $links[] = '<span>'.gravityview_get_link($entries_url, __('Entries', 'gravityview')).'</span>'; |
|
359 | 359 | } |
360 | 360 | |
361 | - if( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
362 | - $settings_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&view=settings&id=%d', $form_id ) ); |
|
363 | - $links[] = '<span>'.gravityview_get_link( $settings_url, __('Settings', 'gravityview'), 'title='.__('Edit settings for this form', 'gravityview') ).'</span>'; |
|
361 | + if (GVCommon::has_cap(array('gravityforms_edit_settings', 'gravityview_view_settings'))) { |
|
362 | + $settings_url = admin_url(sprintf('admin.php?page=gf_edit_forms&view=settings&id=%d', $form_id)); |
|
363 | + $links[] = '<span>'.gravityview_get_link($settings_url, __('Settings', 'gravityview'), 'title='.__('Edit settings for this form', 'gravityview')).'</span>'; |
|
364 | 364 | } |
365 | 365 | |
366 | - if( GVCommon::has_cap( array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms") ) ) { |
|
367 | - $preview_url = site_url( sprintf( '?gf_page=preview&id=%d', $form_id ) ); |
|
368 | - $links[] = '<span>'.gravityview_get_link( $preview_url, __('Preview Form', 'gravityview'), 'title='.__('Preview this form', 'gravityview') ).'</span>'; |
|
366 | + if (GVCommon::has_cap(array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms"))) { |
|
367 | + $preview_url = site_url(sprintf('?gf_page=preview&id=%d', $form_id)); |
|
368 | + $links[] = '<span>'.gravityview_get_link($preview_url, __('Preview Form', 'gravityview'), 'title='.__('Preview this form', 'gravityview')).'</span>'; |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | $output = ''; |
372 | 372 | |
373 | - if( !empty( $include_form_link ) ) { |
|
373 | + if (!empty($include_form_link)) { |
|
374 | 374 | $output .= $form_link; |
375 | 375 | } |
376 | 376 | |
@@ -380,9 +380,9 @@ discard block |
||
380 | 380 | * @param array $links Links to show |
381 | 381 | * @param array $form Gravity Forms form array |
382 | 382 | */ |
383 | - $links = apply_filters( 'gravityview_connected_form_links', $links, $form ); |
|
383 | + $links = apply_filters('gravityview_connected_form_links', $links, $form); |
|
384 | 384 | |
385 | - $output .= '<div class="row-actions">'. implode( ' | ', $links ) .'</div>'; |
|
385 | + $output .= '<div class="row-actions">'.implode(' | ', $links).'</div>'; |
|
386 | 386 | |
387 | 387 | return $output; |
388 | 388 | } |
@@ -391,13 +391,13 @@ discard block |
||
391 | 391 | * Add the Data Source column to the Views page |
392 | 392 | * @param array $columns Columns array |
393 | 393 | */ |
394 | - public function add_post_type_columns( $columns ) { |
|
394 | + public function add_post_type_columns($columns) { |
|
395 | 395 | |
396 | 396 | // Get the date column and save it for later to add back in. |
397 | 397 | // This adds it after the Data Source column. |
398 | 398 | // This way, we don't need to do array_slice, array_merge, etc. |
399 | 399 | $date = $columns['date']; |
400 | - unset( $columns['date'] ); |
|
400 | + unset($columns['date']); |
|
401 | 401 | |
402 | 402 | $data_source_required_caps = array( |
403 | 403 | 'gravityforms_edit_forms', |
@@ -408,11 +408,11 @@ discard block |
||
408 | 408 | 'gravityforms_preview_forms', |
409 | 409 | ); |
410 | 410 | |
411 | - if( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
412 | - $columns['gv_connected_form'] = __( 'Data Source', 'gravityview' ); |
|
411 | + if (GVCommon::has_cap($data_source_required_caps)) { |
|
412 | + $columns['gv_connected_form'] = __('Data Source', 'gravityview'); |
|
413 | 413 | } |
414 | 414 | |
415 | - $columns['gv_template'] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
415 | + $columns['gv_template'] = _x('Template', 'Column title that shows what template is being used for Views', 'gravityview'); |
|
416 | 416 | |
417 | 417 | // Add the date back in. |
418 | 418 | $columns['date'] = $date; |
@@ -427,91 +427,91 @@ discard block |
||
427 | 427 | * @param int $post_id Currently saved Post ID |
428 | 428 | * @return void |
429 | 429 | */ |
430 | - function save_postdata( $post_id ) { |
|
430 | + function save_postdata($post_id) { |
|
431 | 431 | |
432 | - if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){ |
|
432 | + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { |
|
433 | 433 | return; |
434 | 434 | } |
435 | 435 | |
436 | 436 | // validate post_type |
437 | - if ( ! isset( $_POST['post_type'] ) || 'gravityview' != $_POST['post_type'] ) { |
|
437 | + if (!isset($_POST['post_type']) || 'gravityview' != $_POST['post_type']) { |
|
438 | 438 | return; |
439 | 439 | } |
440 | 440 | |
441 | 441 | // validate user can edit and save View |
442 | - if ( ! GVCommon::has_cap( 'edit_gravityview', $post_id ) ) { |
|
443 | - do_action( 'gravityview_log_error', __METHOD__ . ' - Current user does not have the capability to edit View #' . $post_id, wp_get_current_user() ); |
|
442 | + if (!GVCommon::has_cap('edit_gravityview', $post_id)) { |
|
443 | + do_action('gravityview_log_error', __METHOD__.' - Current user does not have the capability to edit View #'.$post_id, wp_get_current_user()); |
|
444 | 444 | return; |
445 | 445 | } |
446 | 446 | |
447 | - do_action( 'gravityview_log_debug', '[save_postdata] Saving View post type.', $_POST ); |
|
447 | + do_action('gravityview_log_debug', '[save_postdata] Saving View post type.', $_POST); |
|
448 | 448 | |
449 | 449 | $statii = array(); |
450 | 450 | |
451 | 451 | // check if this is a start fresh View |
452 | - if ( isset( $_POST['gravityview_select_form_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_form_nonce'], 'gravityview_select_form' ) ) { |
|
452 | + if (isset($_POST['gravityview_select_form_nonce']) && wp_verify_nonce($_POST['gravityview_select_form_nonce'], 'gravityview_select_form')) { |
|
453 | 453 | |
454 | - $form_id = !empty( $_POST['gravityview_form_id'] ) ? $_POST['gravityview_form_id'] : ''; |
|
454 | + $form_id = !empty($_POST['gravityview_form_id']) ? $_POST['gravityview_form_id'] : ''; |
|
455 | 455 | // save form id |
456 | - $statii['form_id'] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
456 | + $statii['form_id'] = update_post_meta($post_id, '_gravityview_form_id', $form_id); |
|
457 | 457 | |
458 | 458 | } |
459 | 459 | |
460 | - if( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii['form_id'] ) ) { |
|
461 | - do_action( 'gravityview_log_error', __METHOD__ . ' - Current user does not have the capability to create a new Form.', wp_get_current_user() ); |
|
460 | + if (false === GVCommon::has_cap('gravityforms_create_form') && empty($statii['form_id'])) { |
|
461 | + do_action('gravityview_log_error', __METHOD__.' - Current user does not have the capability to create a new Form.', wp_get_current_user()); |
|
462 | 462 | return; |
463 | 463 | } |
464 | 464 | |
465 | 465 | // Was this a start fresh? |
466 | - if ( ! empty( $_POST['gravityview_form_id_start_fresh'] ) ) { |
|
467 | - $statii['start_fresh'] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
466 | + if (!empty($_POST['gravityview_form_id_start_fresh'])) { |
|
467 | + $statii['start_fresh'] = add_post_meta($post_id, '_gravityview_start_fresh', 1); |
|
468 | 468 | } else { |
469 | - $statii['start_fresh'] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
469 | + $statii['start_fresh'] = delete_post_meta($post_id, '_gravityview_start_fresh'); |
|
470 | 470 | } |
471 | 471 | |
472 | 472 | // Check if we have a template id |
473 | - if ( isset( $_POST['gravityview_select_template_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_template_nonce'], 'gravityview_select_template' ) ) { |
|
473 | + if (isset($_POST['gravityview_select_template_nonce']) && wp_verify_nonce($_POST['gravityview_select_template_nonce'], 'gravityview_select_template')) { |
|
474 | 474 | |
475 | - $template_id = !empty( $_POST['gravityview_directory_template'] ) ? $_POST['gravityview_directory_template'] : ''; |
|
475 | + $template_id = !empty($_POST['gravityview_directory_template']) ? $_POST['gravityview_directory_template'] : ''; |
|
476 | 476 | |
477 | 477 | // now save template id |
478 | - $statii['directory_template'] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
478 | + $statii['directory_template'] = update_post_meta($post_id, '_gravityview_directory_template', $template_id); |
|
479 | 479 | } |
480 | 480 | |
481 | 481 | |
482 | 482 | // save View Configuration metabox |
483 | - if ( isset( $_POST['gravityview_view_configuration_nonce'] ) && wp_verify_nonce( $_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration' ) ) { |
|
483 | + if (isset($_POST['gravityview_view_configuration_nonce']) && wp_verify_nonce($_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration')) { |
|
484 | 484 | |
485 | 485 | // template settings |
486 | - if( empty( $_POST['template_settings'] ) ) { |
|
486 | + if (empty($_POST['template_settings'])) { |
|
487 | 487 | $_POST['template_settings'] = array(); |
488 | 488 | } |
489 | - $statii['template_settings'] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST['template_settings'] ); |
|
489 | + $statii['template_settings'] = update_post_meta($post_id, '_gravityview_template_settings', $_POST['template_settings']); |
|
490 | 490 | |
491 | 491 | $fields = array(); |
492 | 492 | |
493 | 493 | // Directory&single Visible Fields |
494 | - if( !empty( $preset_fields ) ) { |
|
494 | + if (!empty($preset_fields)) { |
|
495 | 495 | |
496 | 496 | $fields = $preset_fields; |
497 | 497 | |
498 | - } elseif( !empty( $_POST['fields'] ) ) { |
|
498 | + } elseif (!empty($_POST['fields'])) { |
|
499 | 499 | |
500 | - if( !is_array( $_POST['fields'] ) ) { |
|
500 | + if (!is_array($_POST['fields'])) { |
|
501 | 501 | |
502 | 502 | // Fields are passed as a jQuery-serialized array, created in admin-views.js in the serializeForm method |
503 | 503 | // Not using parse_str due to max_input_vars limitation |
504 | 504 | $fields_holder = array(); |
505 | - GVCommon::gv_parse_str( $_POST['fields'], $fields_holder ); |
|
505 | + GVCommon::gv_parse_str($_POST['fields'], $fields_holder); |
|
506 | 506 | |
507 | - if( isset( $fields_holder['fields'] ) ) { |
|
507 | + if (isset($fields_holder['fields'])) { |
|
508 | 508 | |
509 | 509 | // When parsed, there's a m |
510 | 510 | $fields = $fields_holder['fields']; |
511 | 511 | |
512 | 512 | } else { |
513 | 513 | |
514 | - do_action('gravityview_log_error', '[save_postdata] No `fields` key was found after parsing $fields string', $fields_holder ); |
|
514 | + do_action('gravityview_log_error', '[save_postdata] No `fields` key was found after parsing $fields string', $fields_holder); |
|
515 | 515 | |
516 | 516 | } |
517 | 517 | |
@@ -522,24 +522,24 @@ discard block |
||
522 | 522 | } |
523 | 523 | } |
524 | 524 | |
525 | - $statii['directory_fields'] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
525 | + $statii['directory_fields'] = update_post_meta($post_id, '_gravityview_directory_fields', $fields); |
|
526 | 526 | |
527 | 527 | // Directory Visible Widgets |
528 | - if( empty( $_POST['widgets'] ) ) { |
|
528 | + if (empty($_POST['widgets'])) { |
|
529 | 529 | $_POST['widgets'] = array(); |
530 | 530 | } |
531 | - $statii['directory_widgets'] = update_post_meta( $post_id, '_gravityview_directory_widgets', $_POST['widgets'] ); |
|
531 | + $statii['directory_widgets'] = update_post_meta($post_id, '_gravityview_directory_widgets', $_POST['widgets']); |
|
532 | 532 | |
533 | 533 | } // end save view configuration |
534 | 534 | |
535 | - do_action('gravityview_log_debug', '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array_map( 'intval', $statii ) ); |
|
535 | + do_action('gravityview_log_debug', '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array_map('intval', $statii)); |
|
536 | 536 | } |
537 | 537 | |
538 | 538 | /** |
539 | 539 | * @deprecated 1.1.6 |
540 | 540 | */ |
541 | 541 | function render_label() { |
542 | - _deprecated_function( 'GravityView_Admin_Views::render_label()', '1.1.6', 'Use the GravityView_Admin_View_Field class instead.' ); |
|
542 | + _deprecated_function('GravityView_Admin_Views::render_label()', '1.1.6', 'Use the GravityView_Admin_View_Field class instead.'); |
|
543 | 543 | } |
544 | 544 | |
545 | 545 | /** |
@@ -551,33 +551,33 @@ discard block |
||
551 | 551 | * @param string $context (default: 'single') |
552 | 552 | * @return void |
553 | 553 | */ |
554 | - function render_available_fields( $form = '', $context = 'single' ) { |
|
554 | + function render_available_fields($form = '', $context = 'single') { |
|
555 | 555 | |
556 | 556 | /** |
557 | 557 | * @filter `gravityview_blacklist_field_types` Modify the types of fields that shouldn't be shown in a View. |
558 | 558 | * @param[in,out] array $blacklist_field_types Array of field types to block for this context. |
559 | 559 | * @param[in] string $context View context ('single', 'directory', or 'edit') |
560 | 560 | */ |
561 | - $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array(), $context ); |
|
561 | + $blacklist_field_types = apply_filters('gravityview_blacklist_field_types', array(), $context); |
|
562 | 562 | |
563 | - $fields = $this->get_available_fields( $form, $context ); |
|
563 | + $fields = $this->get_available_fields($form, $context); |
|
564 | 564 | |
565 | 565 | $output = ''; |
566 | 566 | |
567 | - if( !empty( $fields ) ) { |
|
567 | + if (!empty($fields)) { |
|
568 | 568 | |
569 | - foreach( $fields as $id => $details ) { |
|
569 | + foreach ($fields as $id => $details) { |
|
570 | 570 | |
571 | - if( in_array( $details['type'], $blacklist_field_types ) ) { |
|
571 | + if (in_array($details['type'], $blacklist_field_types)) { |
|
572 | 572 | continue; |
573 | 573 | } |
574 | 574 | |
575 | 575 | // Edit mode only allows editing the parent fields, not single inputs. |
576 | - if( $context === 'edit' && !empty( $details['parent'] ) ) { |
|
576 | + if ($context === 'edit' && !empty($details['parent'])) { |
|
577 | 577 | continue; |
578 | 578 | } |
579 | 579 | |
580 | - $output .= new GravityView_Admin_View_Field( $details['label'], $id, $details ); |
|
580 | + $output .= new GravityView_Admin_View_Field($details['label'], $id, $details); |
|
581 | 581 | |
582 | 582 | } // End foreach |
583 | 583 | } |
@@ -585,22 +585,22 @@ discard block |
||
585 | 585 | echo $output; |
586 | 586 | |
587 | 587 | // For the EDIT view we only want to allow the form fields. |
588 | - if( $context === 'edit' ) { |
|
588 | + if ($context === 'edit') { |
|
589 | 589 | return; |
590 | 590 | } |
591 | 591 | |
592 | - $this->render_additional_fields( $form, $context ); |
|
592 | + $this->render_additional_fields($form, $context); |
|
593 | 593 | } |
594 | 594 | |
595 | - function render_additional_fields( $form, $context ) { |
|
595 | + function render_additional_fields($form, $context) { |
|
596 | 596 | |
597 | 597 | /** |
598 | 598 | * @filter `gravityview_additional_fields` non-standard Fields to show at the bottom of the field picker |
599 | 599 | * @param array $additional_fields Associative array of field arrays, with `label_text`, `desc`, `field_id`, `label_type`, `input_type`, `field_options`, and `settings_html` keys |
600 | 600 | */ |
601 | - $additional_fields = apply_filters( 'gravityview_additional_fields', array( |
|
601 | + $additional_fields = apply_filters('gravityview_additional_fields', array( |
|
602 | 602 | array( |
603 | - 'label_text' => __( '+ Add All Fields', 'gravityview' ), |
|
603 | + 'label_text' => __('+ Add All Fields', 'gravityview'), |
|
604 | 604 | 'desc' => __('Add all the available fields at once.', 'gravityview'), |
605 | 605 | 'field_id' => 'all-fields', |
606 | 606 | 'label_type' => 'field', |
@@ -610,11 +610,11 @@ discard block |
||
610 | 610 | ) |
611 | 611 | )); |
612 | 612 | |
613 | - if( !empty( $additional_fields )) { |
|
614 | - foreach ( (array)$additional_fields as $item ) { |
|
613 | + if (!empty($additional_fields)) { |
|
614 | + foreach ((array)$additional_fields as $item) { |
|
615 | 615 | |
616 | 616 | // Prevent items from not having index set |
617 | - $item = wp_parse_args( $item, array( |
|
617 | + $item = wp_parse_args($item, array( |
|
618 | 618 | 'label_text' => NULL, |
619 | 619 | 'field_id' => NULL, |
620 | 620 | 'label_type' => NULL, |
@@ -624,13 +624,13 @@ discard block |
||
624 | 624 | )); |
625 | 625 | |
626 | 626 | // Backward compat. |
627 | - if( !empty( $item['field_options'] ) ) { |
|
627 | + if (!empty($item['field_options'])) { |
|
628 | 628 | // Use settings_html from now on. |
629 | 629 | $item['settings_html'] = $item['field_options']; |
630 | 630 | } |
631 | 631 | |
632 | 632 | // Render a label for each of them |
633 | - echo new GravityView_Admin_View_Field( $item['label_text'], $item['field_id'], $item ); |
|
633 | + echo new GravityView_Admin_View_Field($item['label_text'], $item['field_id'], $item); |
|
634 | 634 | |
635 | 635 | } |
636 | 636 | } |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | |
648 | 648 | $entry_default_fields = array(); |
649 | 649 | |
650 | - if( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
650 | + if (in_array($zone, array('directory', 'single'))) { |
|
651 | 651 | |
652 | 652 | $entry_default_fields = array( |
653 | 653 | 'id' => array( |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | ); |
697 | 697 | |
698 | 698 | |
699 | - if( 'single' !== $zone) { |
|
699 | + if ('single' !== $zone) { |
|
700 | 700 | |
701 | 701 | $entry_default_fields['entry_link'] = array( |
702 | 702 | 'label' => __('Link to Entry', 'gravityview'), |
@@ -714,7 +714,7 @@ discard block |
||
714 | 714 | * @param string|array $form form_ID or form object |
715 | 715 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
716 | 716 | */ |
717 | - return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone); |
|
717 | + return apply_filters('gravityview_entry_default_fields', $entry_default_fields, $form, $zone); |
|
718 | 718 | } |
719 | 719 | |
720 | 720 | /** |
@@ -723,25 +723,25 @@ discard block |
||
723 | 723 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
724 | 724 | * @return array fields |
725 | 725 | */ |
726 | - function get_available_fields( $form = '', $zone = NULL ) { |
|
726 | + function get_available_fields($form = '', $zone = NULL) { |
|
727 | 727 | |
728 | - if( empty( $form ) ) { |
|
729 | - do_action( 'gravityview_log_error', '[get_available_fields] $form is empty' ); |
|
728 | + if (empty($form)) { |
|
729 | + do_action('gravityview_log_error', '[get_available_fields] $form is empty'); |
|
730 | 730 | return array(); |
731 | 731 | } |
732 | 732 | |
733 | 733 | // get form fields |
734 | - $fields = gravityview_get_form_fields( $form, true ); |
|
734 | + $fields = gravityview_get_form_fields($form, true); |
|
735 | 735 | |
736 | 736 | // get meta fields ( only if form was already created ) |
737 | - if( !is_array( $form ) ) { |
|
738 | - $meta_fields = gravityview_get_entry_meta( $form ); |
|
737 | + if (!is_array($form)) { |
|
738 | + $meta_fields = gravityview_get_entry_meta($form); |
|
739 | 739 | } else { |
740 | 740 | $meta_fields = array(); |
741 | 741 | } |
742 | 742 | |
743 | 743 | // get default fields |
744 | - $default_fields = $this->get_entry_default_fields( $form, $zone ); |
|
744 | + $default_fields = $this->get_entry_default_fields($form, $zone); |
|
745 | 745 | |
746 | 746 | //merge without loosing the keys |
747 | 747 | $fields = $fields + $meta_fields + $default_fields; |
@@ -758,11 +758,11 @@ discard block |
||
758 | 758 | |
759 | 759 | $widgets = $this->get_registered_widgets(); |
760 | 760 | |
761 | - if( !empty( $widgets ) ) { |
|
761 | + if (!empty($widgets)) { |
|
762 | 762 | |
763 | - foreach( $widgets as $id => $details ) { |
|
763 | + foreach ($widgets as $id => $details) { |
|
764 | 764 | |
765 | - echo new GravityView_Admin_View_Widget( $details['label'], $id, $details ); |
|
765 | + echo new GravityView_Admin_View_Widget($details['label'], $id, $details); |
|
766 | 766 | |
767 | 767 | } |
768 | 768 | } |
@@ -779,7 +779,7 @@ discard block |
||
779 | 779 | * @filter `gravityview_register_directory_widgets` Get the list of registered widgets. Each item is used to instantiate a GravityView_Admin_View_Widget object |
780 | 780 | * @param array $registered_widgets Empty array |
781 | 781 | */ |
782 | - $registered_widgets = apply_filters( 'gravityview_register_directory_widgets', array() ); |
|
782 | + $registered_widgets = apply_filters('gravityview_register_directory_widgets', array()); |
|
783 | 783 | |
784 | 784 | return $registered_widgets; |
785 | 785 | } |
@@ -792,67 +792,67 @@ discard block |
||
792 | 792 | * @param array $values Saved objects |
793 | 793 | * @return void |
794 | 794 | */ |
795 | - function render_active_areas( $template_id, $type, $zone, $rows, $values ) { |
|
795 | + function render_active_areas($template_id, $type, $zone, $rows, $values) { |
|
796 | 796 | global $post; |
797 | 797 | |
798 | - if( $type === 'widget' ) { |
|
799 | - $button_label = __( 'Add Widget', 'gravityview' ); |
|
798 | + if ($type === 'widget') { |
|
799 | + $button_label = __('Add Widget', 'gravityview'); |
|
800 | 800 | } else { |
801 | - $button_label = __( 'Add Field', 'gravityview' ); |
|
801 | + $button_label = __('Add Field', 'gravityview'); |
|
802 | 802 | } |
803 | 803 | |
804 | 804 | $available_items = array(); |
805 | 805 | |
806 | 806 | // if saved values, get available fields to label everyone |
807 | - if( !empty( $values ) && ( !empty( $post->ID ) || !empty( $_POST['template_id'] ) ) ) { |
|
807 | + if (!empty($values) && (!empty($post->ID) || !empty($_POST['template_id']))) { |
|
808 | 808 | |
809 | - if( !empty( $_POST['template_id'] ) ) { |
|
810 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
809 | + if (!empty($_POST['template_id'])) { |
|
810 | + $form = GravityView_Ajax::pre_get_form_fields($_POST['template_id']); |
|
811 | 811 | } else { |
812 | - $form = gravityview_get_form_id( $post->ID ); |
|
812 | + $form = gravityview_get_form_id($post->ID); |
|
813 | 813 | } |
814 | 814 | |
815 | - if( 'field' === $type ) { |
|
816 | - $available_items = $this->get_available_fields( $form, $zone ); |
|
815 | + if ('field' === $type) { |
|
816 | + $available_items = $this->get_available_fields($form, $zone); |
|
817 | 817 | } else { |
818 | 818 | $available_items = $this->get_registered_widgets(); |
819 | 819 | } |
820 | 820 | |
821 | 821 | } |
822 | 822 | |
823 | - foreach( $rows as $row ) : |
|
824 | - foreach( $row as $col => $areas ) : |
|
823 | + foreach ($rows as $row) : |
|
824 | + foreach ($row as $col => $areas) : |
|
825 | 825 | $column = ($col == '2-2') ? '1-2' : $col; ?> |
826 | 826 | |
827 | - <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
|
827 | + <div class="gv-grid-col-<?php echo esc_attr($column); ?>"> |
|
828 | 828 | |
829 | - <?php foreach( $areas as $area ) : ?> |
|
829 | + <?php foreach ($areas as $area) : ?> |
|
830 | 830 | |
831 | 831 | <div class="gv-droppable-area"> |
832 | - <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>"> |
|
832 | + <div class="active-drop active-drop-<?php echo esc_attr($type); ?>" data-areaid="<?php echo esc_attr($zone.'_'.$area['areaid']); ?>"> |
|
833 | 833 | |
834 | 834 | <?php // render saved fields |
835 | 835 | |
836 | - if( !empty( $values[ $zone .'_'. $area['areaid'] ] ) ) { |
|
836 | + if (!empty($values[$zone.'_'.$area['areaid']])) { |
|
837 | 837 | |
838 | - foreach( $values[ $zone .'_'. $area['areaid'] ] as $uniqid => $field ) { |
|
838 | + foreach ($values[$zone.'_'.$area['areaid']] as $uniqid => $field) { |
|
839 | 839 | |
840 | 840 | $input_type = NULL; |
841 | - $original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ; |
|
841 | + $original_item = isset($available_items[$field['id']]) ? $available_items[$field['id']] : false; |
|
842 | 842 | |
843 | - if( !$original_item ) { |
|
843 | + if (!$original_item) { |
|
844 | 844 | |
845 | - do_action('gravityview_log_error', 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array('available_items' => $available_items, 'field' => $field )); |
|
845 | + do_action('gravityview_log_error', 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array('available_items' => $available_items, 'field' => $field)); |
|
846 | 846 | |
847 | 847 | $original_item = $field; |
848 | 848 | } else { |
849 | 849 | |
850 | - $input_type = isset( $original_item['type'] ) ? $original_item['type'] : NULL; |
|
850 | + $input_type = isset($original_item['type']) ? $original_item['type'] : NULL; |
|
851 | 851 | |
852 | 852 | } |
853 | 853 | |
854 | 854 | // Field options dialog box |
855 | - $field_options = GravityView_Render_Settings::render_field_options( $type, $template_id, $field['id'], $original_item['label'], $zone .'_'. $area['areaid'], $input_type, $uniqid, $field, $zone, $original_item ); |
|
855 | + $field_options = GravityView_Render_Settings::render_field_options($type, $template_id, $field['id'], $original_item['label'], $zone.'_'.$area['areaid'], $input_type, $uniqid, $field, $zone, $original_item); |
|
856 | 856 | |
857 | 857 | $item = array( |
858 | 858 | 'input_type' => $input_type, |
@@ -861,16 +861,16 @@ discard block |
||
861 | 861 | ); |
862 | 862 | |
863 | 863 | // Merge the values with the current item to pass things like widget descriptions and original field names |
864 | - if( $original_item ) { |
|
865 | - $item = wp_parse_args( $item, $original_item ); |
|
864 | + if ($original_item) { |
|
865 | + $item = wp_parse_args($item, $original_item); |
|
866 | 866 | } |
867 | 867 | |
868 | - switch( $type ) { |
|
868 | + switch ($type) { |
|
869 | 869 | case 'widget': |
870 | - echo new GravityView_Admin_View_Widget( $item['label'], $field['id'], $item, $field ); |
|
870 | + echo new GravityView_Admin_View_Widget($item['label'], $field['id'], $item, $field); |
|
871 | 871 | break; |
872 | 872 | default: |
873 | - echo new GravityView_Admin_View_Field( $item['label'], $field['id'], $item, $field ); |
|
873 | + echo new GravityView_Admin_View_Field($item['label'], $field['id'], $item, $field); |
|
874 | 874 | } |
875 | 875 | |
876 | 876 | |
@@ -880,11 +880,11 @@ discard block |
||
880 | 880 | |
881 | 881 | } // End if zone is not empty ?> |
882 | 882 | |
883 | - <span class="drop-message"><?php echo sprintf(esc_attr__('"+ %s" or drag existing %ss here.', 'gravityview'), $button_label, $type ); ?></span> |
|
883 | + <span class="drop-message"><?php echo sprintf(esc_attr__('"+ %s" or drag existing %ss here.', 'gravityview'), $button_label, $type); ?></span> |
|
884 | 884 | </div> |
885 | 885 | <div class="gv-droppable-area-action"> |
886 | - <a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"><?php echo '+ '.esc_html( $button_label ); ?></a> |
|
887 | - <p class="gv-droppable-area-title"><strong><?php echo esc_html( $area['title'] ); ?></strong><?php if( !empty( $area['subtitle'] ) ) { ?><span class="gv-droppable-area-subtitle"> – <?php echo esc_html( $area['subtitle'] ); ?></span><?php } ?></p> |
|
886 | + <a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr($type); ?>" data-areaid="<?php echo esc_attr($zone.'_'.$area['areaid']); ?>" data-context="<?php echo esc_attr($zone); ?>"><?php echo '+ '.esc_html($button_label); ?></a> |
|
887 | + <p class="gv-droppable-area-title"><strong><?php echo esc_html($area['title']); ?></strong><?php if (!empty($area['subtitle'])) { ?><span class="gv-droppable-area-subtitle"> – <?php echo esc_html($area['subtitle']); ?></span><?php } ?></p> |
|
888 | 888 | </div> |
889 | 889 | </div> |
890 | 890 | |
@@ -901,13 +901,13 @@ discard block |
||
901 | 901 | * @param string $post_id Current Post ID (view) |
902 | 902 | * @return string html |
903 | 903 | */ |
904 | - function render_widgets_active_areas( $template_id = '', $zone, $post_id = '' ) { |
|
904 | + function render_widgets_active_areas($template_id = '', $zone, $post_id = '') { |
|
905 | 905 | |
906 | 906 | $default_widget_areas = GravityView_Plugin::get_default_widget_areas(); |
907 | 907 | |
908 | 908 | $widgets = array(); |
909 | - if( !empty( $post_id ) ) { |
|
910 | - $widgets = get_post_meta( $post_id, '_gravityview_directory_widgets', true ); |
|
909 | + if (!empty($post_id)) { |
|
910 | + $widgets = get_post_meta($post_id, '_gravityview_directory_widgets', true); |
|
911 | 911 | |
912 | 912 | } |
913 | 913 | |
@@ -915,7 +915,7 @@ discard block |
||
915 | 915 | ?> |
916 | 916 | |
917 | 917 | <div class="gv-grid gv-grid-pad gv-grid-border" id="directory-<?php echo $zone; ?>-widgets"> |
918 | - <?php $this->render_active_areas( $template_id, 'widget', $zone, $default_widget_areas, $widgets ); ?> |
|
918 | + <?php $this->render_active_areas($template_id, 'widget', $zone, $default_widget_areas, $widgets); ?> |
|
919 | 919 | </div> |
920 | 920 | |
921 | 921 | <?php |
@@ -935,36 +935,36 @@ discard block |
||
935 | 935 | * @param string $context (default: 'single') |
936 | 936 | * @return string HTML of the active areas |
937 | 937 | */ |
938 | - function render_directory_active_areas( $template_id = '', $context = 'single', $post_id = '', $echo = false ) { |
|
938 | + function render_directory_active_areas($template_id = '', $context = 'single', $post_id = '', $echo = false) { |
|
939 | 939 | |
940 | - if( empty( $template_id ) ) { |
|
941 | - do_action( 'gravityview_log_debug', '[render_directory_active_areas] $template_id is empty' ); |
|
940 | + if (empty($template_id)) { |
|
941 | + do_action('gravityview_log_debug', '[render_directory_active_areas] $template_id is empty'); |
|
942 | 942 | return; |
943 | 943 | } |
944 | 944 | |
945 | - $template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context ); |
|
945 | + $template_areas = apply_filters('gravityview_template_active_areas', array(), $template_id, $context); |
|
946 | 946 | |
947 | - if( empty( $template_areas ) ) { |
|
947 | + if (empty($template_areas)) { |
|
948 | 948 | |
949 | - do_action( 'gravityview_log_debug', '[render_directory_active_areas] No areas defined. Maybe template %s is disabled.', $template_id ); |
|
949 | + do_action('gravityview_log_debug', '[render_directory_active_areas] No areas defined. Maybe template %s is disabled.', $template_id); |
|
950 | 950 | $output = '<div>'; |
951 | - $output .= '<h2 class="description" style="font-size: 16px; margin:0">'. sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>'.$template_id.'</em>' ) .'</h2>'; |
|
951 | + $output .= '<h2 class="description" style="font-size: 16px; margin:0">'.sprintf(esc_html__('This View is configured using the %s View type, which is disabled.', 'gravityview'), '<em>'.$template_id.'</em>').'</h2>'; |
|
952 | 952 | $output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">'.esc_html__('The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview').'</p>'; |
953 | 953 | $output .= '</div>'; |
954 | 954 | } else { |
955 | 955 | |
956 | 956 | $fields = ''; |
957 | - if ( ! empty( $post_id ) ) { |
|
958 | - $fields = gravityview_get_directory_fields( $post_id ); |
|
957 | + if (!empty($post_id)) { |
|
958 | + $fields = gravityview_get_directory_fields($post_id); |
|
959 | 959 | } |
960 | 960 | |
961 | 961 | ob_start(); |
962 | - $this->render_active_areas( $template_id, 'field', $context, $template_areas, $fields ); |
|
962 | + $this->render_active_areas($template_id, 'field', $context, $template_areas, $fields); |
|
963 | 963 | $output = ob_get_clean(); |
964 | 964 | |
965 | 965 | } |
966 | 966 | |
967 | - if( $echo ) { |
|
967 | + if ($echo) { |
|
968 | 968 | echo $output; |
969 | 969 | } |
970 | 970 | |
@@ -978,46 +978,46 @@ discard block |
||
978 | 978 | * @param mixed $hook |
979 | 979 | * @return void |
980 | 980 | */ |
981 | - static function add_scripts_and_styles( $hook ) { |
|
981 | + static function add_scripts_and_styles($hook) { |
|
982 | 982 | global $plugin_page, $pagenow; |
983 | 983 | |
984 | - $is_widgets_page = ( $pagenow === 'widgets.php' ); |
|
984 | + $is_widgets_page = ($pagenow === 'widgets.php'); |
|
985 | 985 | |
986 | 986 | // Add the GV font (with the Astronaut) |
987 | - wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
987 | + wp_enqueue_style('gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version); |
|
988 | 988 | |
989 | - wp_register_script( 'gravityview-jquery-cookie', plugins_url('includes/lib/jquery-cookie/jquery_cookie.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version, true ); |
|
989 | + wp_register_script('gravityview-jquery-cookie', plugins_url('includes/lib/jquery-cookie/jquery_cookie.js', GRAVITYVIEW_FILE), array('jquery'), GravityView_Plugin::version, true); |
|
990 | 990 | |
991 | 991 | // Don't process any scripts below here if it's not a GravityView page. |
992 | - if( !gravityview_is_admin_page($hook) && !$is_widgets_page ) { return; } |
|
992 | + if (!gravityview_is_admin_page($hook) && !$is_widgets_page) { return; } |
|
993 | 993 | |
994 | 994 | // Only enqueue the following on single pages |
995 | - if( gravityview_is_admin_page($hook, 'single') || $is_widgets_page ) { |
|
995 | + if (gravityview_is_admin_page($hook, 'single') || $is_widgets_page) { |
|
996 | 996 | |
997 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
998 | - wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), GravityView_Plugin::version ); |
|
997 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
998 | + wp_enqueue_style('gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), GravityView_Plugin::version); |
|
999 | 999 | |
1000 | 1000 | $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
1001 | 1001 | |
1002 | 1002 | //enqueue scripts |
1003 | - wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), GravityView_Plugin::version ); |
|
1003 | + wp_enqueue_script('gravityview_views_scripts', plugins_url('assets/js/admin-views'.$script_debug.'.js', GRAVITYVIEW_FILE), array('jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore'), GravityView_Plugin::version); |
|
1004 | 1004 | |
1005 | 1005 | wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
1006 | 1006 | 'cookiepath' => COOKIEPATH, |
1007 | - 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
|
1008 | - 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
|
1009 | - 'label_close' => __( 'Close', 'gravityview' ), |
|
1010 | - 'label_cancel' => __( 'Cancel', 'gravityview' ), |
|
1011 | - 'label_continue' => __( 'Continue', 'gravityview' ), |
|
1012 | - 'label_ok' => __( 'Ok', 'gravityview' ), |
|
1013 | - 'label_publisherror' => __( 'Error while creating the View for you. Check the settings or contact GravityView support.', 'gravityview' ), |
|
1014 | - 'loading_text' => esc_html__( 'Loading…', 'gravityview' ), |
|
1015 | - 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
|
1016 | - 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
|
1017 | - 'remove_all_fields' => __( 'Would you like to remove all fields in this zone? (You are seeing this message because you were holding down the ALT key)', 'gravityview' ), |
|
1007 | + 'nonce' => wp_create_nonce('gravityview_ajaxviews'), |
|
1008 | + 'label_viewname' => __('Enter View name here', 'gravityview'), |
|
1009 | + 'label_close' => __('Close', 'gravityview'), |
|
1010 | + 'label_cancel' => __('Cancel', 'gravityview'), |
|
1011 | + 'label_continue' => __('Continue', 'gravityview'), |
|
1012 | + 'label_ok' => __('Ok', 'gravityview'), |
|
1013 | + 'label_publisherror' => __('Error while creating the View for you. Check the settings or contact GravityView support.', 'gravityview'), |
|
1014 | + 'loading_text' => esc_html__('Loading…', 'gravityview'), |
|
1015 | + 'loading_error' => esc_html__('There was an error loading dynamic content.', 'gravityview'), |
|
1016 | + 'field_loaderror' => __('Error while adding the field. Please try again or contact GravityView support.', 'gravityview'), |
|
1017 | + 'remove_all_fields' => __('Would you like to remove all fields in this zone? (You are seeing this message because you were holding down the ALT key)', 'gravityview'), |
|
1018 | 1018 | )); |
1019 | 1019 | |
1020 | - wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array('dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
1020 | + wp_enqueue_style('gravityview_views_styles', plugins_url('assets/css/admin-views.css', GRAVITYVIEW_FILE), array('dashicons', 'wp-jquery-ui-dialog'), GravityView_Plugin::version); |
|
1021 | 1021 | |
1022 | 1022 | self::enqueue_gravity_forms_scripts(); |
1023 | 1023 | |
@@ -1035,25 +1035,25 @@ discard block |
||
1035 | 1035 | 'jquery-ui-autocomplete' |
1036 | 1036 | ); |
1037 | 1037 | |
1038 | - if ( wp_is_mobile() ) |
|
1038 | + if (wp_is_mobile()) |
|
1039 | 1039 | $scripts[] = 'jquery-touch-punch'; |
1040 | 1040 | |
1041 | 1041 | foreach ($scripts as $script) { |
1042 | - wp_enqueue_script( $script ); |
|
1042 | + wp_enqueue_script($script); |
|
1043 | 1043 | } |
1044 | 1044 | } |
1045 | 1045 | |
1046 | - function register_no_conflict( $registered ) { |
|
1046 | + function register_no_conflict($registered) { |
|
1047 | 1047 | |
1048 | 1048 | $filter = current_filter(); |
1049 | 1049 | |
1050 | - if( preg_match('/script/ism', $filter ) ) { |
|
1051 | - $allow_scripts = array( 'jquery-ui-core', 'jquery-ui-dialog', 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'gravityview_views_scripts', 'gravityview-support', 'gravityview-jquery-cookie', 'gravityview_views_datepicker', |
|
1052 | - 'sack', 'gform_gravityforms', 'gform_forms', 'gform_form_admin', 'jquery-ui-autocomplete' ); |
|
1053 | - $registered = array_merge( $registered, $allow_scripts ); |
|
1054 | - } elseif( preg_match('/style/ism', $filter ) ) { |
|
1055 | - $allow_styles = array( 'dashicons', 'wp-jquery-ui-dialog', 'gravityview_views_styles', 'gravityview_global', 'gravityview_views_datepicker' ); |
|
1056 | - $registered = array_merge( $registered, $allow_styles ); |
|
1050 | + if (preg_match('/script/ism', $filter)) { |
|
1051 | + $allow_scripts = array('jquery-ui-core', 'jquery-ui-dialog', 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'gravityview_views_scripts', 'gravityview-support', 'gravityview-jquery-cookie', 'gravityview_views_datepicker', |
|
1052 | + 'sack', 'gform_gravityforms', 'gform_forms', 'gform_form_admin', 'jquery-ui-autocomplete'); |
|
1053 | + $registered = array_merge($registered, $allow_scripts); |
|
1054 | + } elseif (preg_match('/style/ism', $filter)) { |
|
1055 | + $allow_styles = array('dashicons', 'wp-jquery-ui-dialog', 'gravityview_views_styles', 'gravityview_global', 'gravityview_views_datepicker'); |
|
1056 | + $registered = array_merge($registered, $allow_styles); |
|
1057 | 1057 | } |
1058 | 1058 | |
1059 | 1059 | return $registered; |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly |
15 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
15 | +if (!defined('ABSPATH')) exit; |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * GravityView_Welcome Class |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | * @since 1.0 |
35 | 35 | */ |
36 | 36 | public function __construct() { |
37 | - add_action( 'admin_menu', array( $this, 'admin_menus'), 200 ); |
|
38 | - add_action( 'admin_head', array( $this, 'admin_head' ) ); |
|
39 | - add_action( 'admin_init', array( $this, 'welcome' ) ); |
|
40 | - add_filter( 'gravityview_is_admin_page', array( $this, 'is_dashboard_page'), 10, 2 ); |
|
37 | + add_action('admin_menu', array($this, 'admin_menus'), 200); |
|
38 | + add_action('admin_head', array($this, 'admin_head')); |
|
39 | + add_action('admin_init', array($this, 'welcome')); |
|
40 | + add_filter('gravityview_is_admin_page', array($this, 'is_dashboard_page'), 10, 2); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -57,27 +57,27 @@ discard block |
||
57 | 57 | __('Getting Started', 'gravityview'), |
58 | 58 | $this->minimum_capability, |
59 | 59 | 'gv-getting-started', |
60 | - array( $this, 'getting_started_screen' ) |
|
60 | + array($this, 'getting_started_screen') |
|
61 | 61 | ); |
62 | 62 | |
63 | 63 | // Changelog Page |
64 | 64 | add_submenu_page( |
65 | 65 | 'edit.php?post_type=gravityview', |
66 | - __( 'Changelog', 'gravityview' ), |
|
67 | - __( 'Changelog', 'gravityview' ), |
|
66 | + __('Changelog', 'gravityview'), |
|
67 | + __('Changelog', 'gravityview'), |
|
68 | 68 | $this->minimum_capability, |
69 | 69 | 'gv-changelog', |
70 | - array( $this, 'changelog_screen' ) |
|
70 | + array($this, 'changelog_screen') |
|
71 | 71 | ); |
72 | 72 | |
73 | 73 | // Credits Page |
74 | 74 | add_submenu_page( |
75 | 75 | 'edit.php?post_type=gravityview', |
76 | - __( 'Credits', 'gravityview' ), |
|
77 | - __( 'Credits', 'gravityview' ), |
|
76 | + __('Credits', 'gravityview'), |
|
77 | + __('Credits', 'gravityview'), |
|
78 | 78 | $this->minimum_capability, |
79 | 79 | 'gv-credits', |
80 | - array( $this, 'credits_screen' ) |
|
80 | + array($this, 'credits_screen') |
|
81 | 81 | ); |
82 | 82 | |
83 | 83 | } |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | public function is_dashboard_page($is_page = false, $hook = NULL) { |
91 | 91 | global $plugin_page; |
92 | 92 | |
93 | - if($is_page) { return $is_page; } |
|
93 | + if ($is_page) { return $is_page; } |
|
94 | 94 | |
95 | - return in_array( $plugin_page, array( 'gv-about', 'gv-credits', 'gv-getting-started' ) ); |
|
95 | + return in_array($plugin_page, array('gv-about', 'gv-credits', 'gv-getting-started')); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -105,10 +105,10 @@ discard block |
||
105 | 105 | public function admin_head() { |
106 | 106 | global $plugin_page; |
107 | 107 | |
108 | - remove_submenu_page( 'edit.php?post_type=gravityview', 'gv-credits' ); |
|
109 | - remove_submenu_page( 'edit.php?post_type=gravityview', 'gv-changelog' ); |
|
108 | + remove_submenu_page('edit.php?post_type=gravityview', 'gv-credits'); |
|
109 | + remove_submenu_page('edit.php?post_type=gravityview', 'gv-changelog'); |
|
110 | 110 | |
111 | - if( !$this->is_dashboard_page() ) { return; } |
|
111 | + if (!$this->is_dashboard_page()) { return; } |
|
112 | 112 | |
113 | 113 | ?> |
114 | 114 | <style type="text/css" media="screen"> |
@@ -139,23 +139,23 @@ discard block |
||
139 | 139 | global $plugin_page; |
140 | 140 | |
141 | 141 | // Don't fetch -beta, etc. |
142 | - list( $display_version ) = explode( '-', GravityView_Plugin::version ); |
|
142 | + list($display_version) = explode('-', GravityView_Plugin::version); |
|
143 | 143 | |
144 | - $selected = !empty( $plugin_page ) ? $plugin_page : 'gv-getting-started'; |
|
144 | + $selected = !empty($plugin_page) ? $plugin_page : 'gv-getting-started'; |
|
145 | 145 | ?> |
146 | 146 | |
147 | - <h1><img class="alignleft" src="<?php echo plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ); ?>" width="100" height="132" /><?php printf( esc_html__( 'Welcome to GravityView %s', 'gravityview' ), $display_version ); ?></h1> |
|
148 | - <div class="about-text"><?php esc_html_e( 'Thank you for installing GravityView. Beautifully display your Gravity Forms entries.', 'gravityview' ); ?></div> |
|
147 | + <h1><img class="alignleft" src="<?php echo plugins_url('assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE); ?>" width="100" height="132" /><?php printf(esc_html__('Welcome to GravityView %s', 'gravityview'), $display_version); ?></h1> |
|
148 | + <div class="about-text"><?php esc_html_e('Thank you for installing GravityView. Beautifully display your Gravity Forms entries.', 'gravityview'); ?></div> |
|
149 | 149 | |
150 | 150 | <h2 class="nav-tab-wrapper clear"> |
151 | - <a class="nav-tab <?php echo $selected == 'gv-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-getting-started', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>"> |
|
152 | - <?php _e( "Getting Started", 'gravityview' ); ?> |
|
151 | + <a class="nav-tab <?php echo $selected == 'gv-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'gv-getting-started', 'post_type' => 'gravityview'), 'edit.php'))); ?>"> |
|
152 | + <?php _e("Getting Started", 'gravityview'); ?> |
|
153 | 153 | </a> |
154 | - <a class="nav-tab <?php echo $selected == 'gv-changelog' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-changelog', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>"> |
|
155 | - <?php _e( "List of Changes", 'gravityview' ); ?> |
|
154 | + <a class="nav-tab <?php echo $selected == 'gv-changelog' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'gv-changelog', 'post_type' => 'gravityview'), 'edit.php'))); ?>"> |
|
155 | + <?php _e("List of Changes", 'gravityview'); ?> |
|
156 | 156 | </a> |
157 | - <a class="nav-tab <?php echo $selected == 'gv-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-credits', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>"> |
|
158 | - <?php _e( 'Credits', 'gravityview' ); ?> |
|
157 | + <a class="nav-tab <?php echo $selected == 'gv-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'gv-credits', 'post_type' => 'gravityview'), 'edit.php'))); ?>"> |
|
158 | + <?php _e('Credits', 'gravityview'); ?> |
|
159 | 159 | </a> |
160 | 160 | </h2> |
161 | 161 | <?php |
@@ -205,14 +205,14 @@ discard block |
||
205 | 205 | |
206 | 206 | <div class="last-feature"> |
207 | 207 | <h2>Embed Views in Posts & Pages</h2> |
208 | - <p><img src="<?php echo plugins_url( 'assets/images/screenshots/add-view-button.png', GRAVITYVIEW_FILE ); ?>" class="gv-welcome-screenshots" height="35" width="97" />Views don’t need to be embedded in a post or page, but you can if you want. Embed Views using the "Add View" button above your content editor.</p> |
|
208 | + <p><img src="<?php echo plugins_url('assets/images/screenshots/add-view-button.png', GRAVITYVIEW_FILE); ?>" class="gv-welcome-screenshots" height="35" width="97" />Views don’t need to be embedded in a post or page, but you can if you want. Embed Views using the "Add View" button above your content editor.</p> |
|
209 | 209 | </div> |
210 | 210 | |
211 | 211 | </div> |
212 | 212 | |
213 | 213 | <div class="feature-section clear"> |
214 | 214 | <h2>Configure Multiple Entry, Single Entry, and Edit Entry Layouts</h2> |
215 | - <p><img src="<?php echo plugins_url( 'assets/images/screenshots/add-field.png', GRAVITYVIEW_FILE ); ?>" alt="Add a field dialog box" class="gv-welcome-screenshots" />You can configure what fields are displayed in <strong>Multiple Entry</strong>, <strong>Single Entry</strong>, and <strong>Edit Entry</strong> modes. These can be configured by clicking on the tabs in "View Configuration."</p> |
|
215 | + <p><img src="<?php echo plugins_url('assets/images/screenshots/add-field.png', GRAVITYVIEW_FILE); ?>" alt="Add a field dialog box" class="gv-welcome-screenshots" />You can configure what fields are displayed in <strong>Multiple Entry</strong>, <strong>Single Entry</strong>, and <strong>Edit Entry</strong> modes. These can be configured by clicking on the tabs in "View Configuration."</p> |
|
216 | 216 | |
217 | 217 | <ul class="ul-disc"> |
218 | 218 | <li>Click "+ Add Field" to add a field to a zone</li> |
@@ -254,23 +254,23 @@ discard block |
||
254 | 254 | |
255 | 255 | <div class="changelog point-releases"> |
256 | 256 | |
257 | - <h2 class="subtitle" style="text-align: center;"><?php esc_html_e('What’s New', 'gravityview' ); ?></h2> |
|
257 | + <h2 class="subtitle" style="text-align: center;"><?php esc_html_e('What’s New', 'gravityview'); ?></h2> |
|
258 | 258 | |
259 | 259 | <div class="feature-section col two-col" style="margin-top:0"> |
260 | 260 | <div class="col col-1"> |
261 | - <div class="media-container" style="min-height:81px; border: none;"><img src="<?php echo plugins_url( 'assets/images/screenshots/caps.png', GRAVITYVIEW_FILE ); ?>" alt="Icons representing capabilities"></div> |
|
261 | + <div class="media-container" style="min-height:81px; border: none;"><img src="<?php echo plugins_url('assets/images/screenshots/caps.png', GRAVITYVIEW_FILE); ?>" alt="Icons representing capabilities"></div> |
|
262 | 262 | <h4 class="higher">Capability Management</h4> |
263 | 263 | <p>Manage what users and roles have access to GravityView functionality. <a href="http://docs.gravityview.co/article/311-gravityview-capabilities">See what capabilities are available</a>.</p> |
264 | 264 | |
265 | - <div class="media-container" style="margin-top: 2em; min-height:80px;"><img src="<?php echo plugins_url( 'assets/images/screenshots/get.png', GRAVITYVIEW_FILE ); ?>" alt=""></div> |
|
265 | + <div class="media-container" style="margin-top: 2em; min-height:80px;"><img src="<?php echo plugins_url('assets/images/screenshots/get.png', GRAVITYVIEW_FILE); ?>" alt=""></div> |
|
266 | 266 | <h4 class="higher">The <code>{get}</code> Merge Tag</h4> |
267 | 267 | <p>Pass data using URLs and create even more powerful integrations with GravityView. <a href="http://docs.gravityview.co/article/314-the-get-merge-tag">Learn how to use <code>{get}</code></a>.</p> |
268 | 268 | </div> |
269 | 269 | |
270 | 270 | <div class="col col-2 last-feature"> |
271 | - <div class="media-container" style="min-height:81px; border: none;"><img src="<?php echo plugins_url( 'assets/images/screenshots/support-port.png', GRAVITYVIEW_FILE ); ?>" alt="The Support Port"></div> |
|
271 | + <div class="media-container" style="min-height:81px; border: none;"><img src="<?php echo plugins_url('assets/images/screenshots/support-port.png', GRAVITYVIEW_FILE); ?>" alt="The Support Port"></div> |
|
272 | 272 | <h4 class="higher">Support Port</h4> |
273 | - <p>Users can easily search GravityView help docs. Administrators can use it to contact support. Just click the <img src="<?php echo plugins_url( 'assets/images/screenshots/beacon.png', GRAVITYVIEW_FILE ); ?>" width="16" alt="The Support Port icon looks like a question mark"> icon on GravityView screens to activate.</p> |
|
273 | + <p>Users can easily search GravityView help docs. Administrators can use it to contact support. Just click the <img src="<?php echo plugins_url('assets/images/screenshots/beacon.png', GRAVITYVIEW_FILE); ?>" width="16" alt="The Support Port icon looks like a question mark"> icon on GravityView screens to activate.</p> |
|
274 | 274 | </div> |
275 | 275 | </div> |
276 | 276 | |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | |
620 | 620 | <?php $this->tabs(); ?> |
621 | 621 | |
622 | - <p class="about-description"><?php _e( 'GravityView is brought to you by:', 'gravityview' ); ?></p> |
|
622 | + <p class="about-description"><?php _e('GravityView is brought to you by:', 'gravityview'); ?></p> |
|
623 | 623 | |
624 | 624 | <div class="feature-section col two-col"> |
625 | 625 | |
@@ -627,14 +627,14 @@ discard block |
||
627 | 627 | <h2>Zack Katz</h2> |
628 | 628 | <h4 style="font-weight:0; margin-top:0">Project Lead & Developer</h4> |
629 | 629 | <p></p> |
630 | - <p><img style="float:left; margin: 0 15px 10px 0;" src="<?php echo plugins_url( 'assets/images/zack.jpg', GRAVITYVIEW_FILE ); ?>" width="94" height="94" />Zack has been developing integrations with Gravity Forms since 2009. He is the President of Katz Web Services and lives with his wife (and cat) in Denver, Colorado.</p> |
|
630 | + <p><img style="float:left; margin: 0 15px 10px 0;" src="<?php echo plugins_url('assets/images/zack.jpg', GRAVITYVIEW_FILE); ?>" width="94" height="94" />Zack has been developing integrations with Gravity Forms since 2009. He is the President of Katz Web Services and lives with his wife (and cat) in Denver, Colorado.</p> |
|
631 | 631 | <p><a href="https://katz.co">View Zack’s website</a></p> |
632 | 632 | </div> |
633 | 633 | |
634 | 634 | <div class="col last-feature"> |
635 | 635 | <h2>Luis Godinho</h2> |
636 | 636 | <h4 style="font-weight:0; margin-top:0">Developer & Support</h4> |
637 | - <p><img style="margin: 0 15px 10px 0;" class="alignleft avatar" src="<?php echo plugins_url( 'assets/images/luis.jpg', GRAVITYVIEW_FILE ); ?>" width="94" height="94" />Luis is a WordPress developer passionate about WordPress. He is a co-founder and partner of GOMO, a digital agency located in Lisbon, Portugal.</p> |
|
637 | + <p><img style="margin: 0 15px 10px 0;" class="alignleft avatar" src="<?php echo plugins_url('assets/images/luis.jpg', GRAVITYVIEW_FILE); ?>" width="94" height="94" />Luis is a WordPress developer passionate about WordPress. He is a co-founder and partner of GOMO, a digital agency located in Lisbon, Portugal.</p> |
|
638 | 638 | <p><a href="http://tinygod.pt">View Luis’s website</a></p> |
639 | 639 | </div> |
640 | 640 | |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | |
645 | 645 | <div class="feature-section"> |
646 | 646 | <div> |
647 | - <h2><?php esc_attr_e( 'Contributors', 'gravityview' ); ?></h2> |
|
647 | + <h2><?php esc_attr_e('Contributors', 'gravityview'); ?></h2> |
|
648 | 648 | |
649 | 649 | <ul class="wp-people-group"> |
650 | 650 | <li class="wp-person">Bengali translation by <a href="https://www.transifex.com/accounts/profile/tareqhi/">@tareqhi</a></li> |
@@ -665,8 +665,8 @@ discard block |
||
665 | 665 | <li class="wp-person">Code contributions by <a href="https://github.com/ryanduff">@ryanduff</a> and <a href="https://github.com/dmlinn">@dmlinn</a></li> |
666 | 666 | </ul> |
667 | 667 | |
668 | - <h4><?php esc_attr_e( 'Want to contribute?', 'gravityview' ); ?></h4> |
|
669 | - <p><?php echo sprintf( esc_attr__( 'If you want to contribute to the code, %syou can on Github%s. If your contributions are accepted, you will be thanked here.', 'gravityview'), '<a href="https://github.com/katzwebservices/GravityView">', '</a>' ); ?></p> |
|
668 | + <h4><?php esc_attr_e('Want to contribute?', 'gravityview'); ?></h4> |
|
669 | + <p><?php echo sprintf(esc_attr__('If you want to contribute to the code, %syou can on Github%s. If your contributions are accepted, you will be thanked here.', 'gravityview'), '<a href="https://github.com/katzwebservices/GravityView">', '</a>'); ?></p> |
|
670 | 670 | </div> |
671 | 671 | </div> |
672 | 672 | |
@@ -705,34 +705,34 @@ discard block |
||
705 | 705 | global $plugin_page; |
706 | 706 | |
707 | 707 | // Bail if we're just editing the plugin |
708 | - if( $plugin_page === 'plugin-editor.php' ) { return; } |
|
708 | + if ($plugin_page === 'plugin-editor.php') { return; } |
|
709 | 709 | |
710 | 710 | // Bail if no activation redirect |
711 | - if ( ! get_transient( '_gv_activation_redirect' ) ) { return; } |
|
711 | + if (!get_transient('_gv_activation_redirect')) { return; } |
|
712 | 712 | |
713 | 713 | // Delete the redirect transient |
714 | - delete_transient( '_gv_activation_redirect' ); |
|
714 | + delete_transient('_gv_activation_redirect'); |
|
715 | 715 | |
716 | - $upgrade = get_option( 'gv_version_upgraded_from' ); |
|
716 | + $upgrade = get_option('gv_version_upgraded_from'); |
|
717 | 717 | |
718 | 718 | // Don't do anything if they've already seen the new version info |
719 | - if( $upgrade === GravityView_Plugin::version ) { |
|
719 | + if ($upgrade === GravityView_Plugin::version) { |
|
720 | 720 | return; |
721 | 721 | } |
722 | 722 | |
723 | 723 | // Add "Upgraded From" Option |
724 | - update_option( 'gv_version_upgraded_from', GravityView_Plugin::version ); |
|
724 | + update_option('gv_version_upgraded_from', GravityView_Plugin::version); |
|
725 | 725 | |
726 | 726 | // Bail if activating from network, or bulk |
727 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { return; } |
|
727 | + if (is_network_admin() || isset($_GET['activate-multi'])) { return; } |
|
728 | 728 | |
729 | 729 | // First time install |
730 | - if( ! $upgrade ) { |
|
731 | - wp_safe_redirect( admin_url( 'edit.php?post_type=gravityview&page=gv-getting-started' ) ); exit; |
|
730 | + if (!$upgrade) { |
|
731 | + wp_safe_redirect(admin_url('edit.php?post_type=gravityview&page=gv-getting-started')); exit; |
|
732 | 732 | } |
733 | 733 | // Update |
734 | 734 | else { |
735 | - wp_safe_redirect( admin_url( 'edit.php?post_type=gravityview&page=gv-changelog' ) ); exit; |
|
735 | + wp_safe_redirect(admin_url('edit.php?post_type=gravityview&page=gv-changelog')); exit; |
|
736 | 736 | } |
737 | 737 | } |
738 | 738 | } |