@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @uses GravityView_frontend::get_search_criteria() Convert the $_POST search request into a properly formatted request. |
172 | 172 | * @access public |
173 | - * @return void|boolean |
|
173 | + * @return null|false |
|
174 | 174 | */ |
175 | 175 | public function process_bulk_action() { |
176 | 176 | if ( ! class_exists( 'RGForms' ) ) { |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | * @param array|boolean $entries If array, array of entry IDs that are to be updated. If true: update all entries. |
253 | 253 | * @param int $approved Approved status. If `0`: unapproved, if not empty, `Approved` |
254 | 254 | * @param int $form_id The Gravity Forms Form ID |
255 | - * @return boolean|void |
|
255 | + * @return false|null |
|
256 | 256 | */ |
257 | 257 | private static function update_bulk( $entries, $approved, $form_id ) { |
258 | 258 | |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | * @access public |
471 | 471 | * @static |
472 | 472 | * @param mixed $form GF Form or Form ID |
473 | - * @return false|null|string Returns the input ID of the approved field. Returns NULL if no approved fields were found. Returns false if $form_id wasn't set. |
|
473 | + * @return integer Returns the input ID of the approved field. Returns NULL if no approved fields were found. Returns false if $form_id wasn't set. |
|
474 | 474 | */ |
475 | 475 | static public function get_approved_column( $form ) { |
476 | 476 |
@@ -21,12 +21,12 @@ discard block |
||
21 | 21 | function init() { |
22 | 22 | |
23 | 23 | $icon = is_admin() ? '<i class="icon gv-icon-astronaut-head"></i> ' : NULL; |
24 | - $this->title( $icon . __('GravityView', 'gravityview') ); |
|
24 | + $this->title($icon.__('GravityView', 'gravityview')); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | function get_warnings() { |
28 | 28 | |
29 | - if( is_null( $this->warnings ) ) { |
|
29 | + if (is_null($this->warnings)) { |
|
30 | 30 | $this->warnings = GravityView_Logging::get_errors(); |
31 | 31 | } |
32 | 32 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | function get_notices() { |
37 | 37 | |
38 | - if( is_null( $this->notices ) ) { |
|
38 | + if (is_null($this->notices)) { |
|
39 | 39 | $this->notices = GravityView_Logging::get_notices(); |
40 | 40 | } |
41 | 41 | |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | * @param boolean $visible {@internal Leave here for compatibility with the Debug_Bar_Panel parent class} |
52 | 52 | * @return void |
53 | 53 | */ |
54 | - function set_visible( $visible = false ) { |
|
55 | - $this->_visible = ( count( $this->get_notices() ) || count( $this->get_warnings() ) ); |
|
54 | + function set_visible($visible = false) { |
|
55 | + $this->_visible = (count($this->get_notices()) || count($this->get_warnings())); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -84,42 +84,42 @@ discard block |
||
84 | 84 | </style> |
85 | 85 | <div id='debug-bar-gravityview'>"; |
86 | 86 | |
87 | - $output .= '<img src="'.plugins_url('assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ).'" class="alignright" alt="" width="100" height="132" />'; |
|
87 | + $output .= '<img src="'.plugins_url('assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE).'" class="alignright" alt="" width="100" height="132" />'; |
|
88 | 88 | |
89 | 89 | |
90 | 90 | $warnings = $this->get_warnings(); |
91 | 91 | $notices = $this->get_notices(); |
92 | 92 | |
93 | - if(count($warnings)) { |
|
93 | + if (count($warnings)) { |
|
94 | 94 | $output .= '<h3><span>'.__('Warnings', 'gravityview').'</span></h3>'; |
95 | 95 | $output .= '<ol>'; |
96 | - foreach ( $warnings as $key => $notice) { |
|
97 | - if(empty($notice['message'])) { continue; } |
|
98 | - $output .= '<li><a href="#'.sanitize_html_class( 'gv-warning-' . $key ).'">'.strip_tags($notice['message']).'</a></li>'; |
|
96 | + foreach ($warnings as $key => $notice) { |
|
97 | + if (empty($notice['message'])) { continue; } |
|
98 | + $output .= '<li><a href="#'.sanitize_html_class('gv-warning-'.$key).'">'.strip_tags($notice['message']).'</a></li>'; |
|
99 | 99 | } |
100 | 100 | $output .= '</ol><hr />'; |
101 | 101 | } |
102 | - if(count($notices)) { |
|
102 | + if (count($notices)) { |
|
103 | 103 | $output .= '<h3><span>'.__('Logs', 'gravityview').'</span></h3>'; |
104 | 104 | $output .= '<ol>'; |
105 | - foreach ( $notices as $key => $notice) { |
|
106 | - if(empty($notice['message'])) { continue; } |
|
107 | - $output .= '<li><a href="#'.sanitize_html_class( 'gv-notice-' . $key ).'">'.strip_tags($notice['message']).'</a></li>'; |
|
105 | + foreach ($notices as $key => $notice) { |
|
106 | + if (empty($notice['message'])) { continue; } |
|
107 | + $output .= '<li><a href="#'.sanitize_html_class('gv-notice-'.$key).'">'.strip_tags($notice['message']).'</a></li>'; |
|
108 | 108 | } |
109 | 109 | $output .= '</ol><hr />'; |
110 | 110 | } |
111 | 111 | |
112 | - if ( count( $warnings ) ) { |
|
112 | + if (count($warnings)) { |
|
113 | 113 | $output .= '<h3>Warnings</h3>'; |
114 | 114 | $output .= '<ol class="debug-bar-php-list">'; |
115 | - foreach ( $warnings as $key => $notice) { $output .= $this->render_item( $notice, 'gv-warning-' . $key ); } |
|
115 | + foreach ($warnings as $key => $notice) { $output .= $this->render_item($notice, 'gv-warning-'.$key); } |
|
116 | 116 | $output .= '</ol>'; |
117 | 117 | } |
118 | 118 | |
119 | - if ( count( $notices ) ) { |
|
119 | + if (count($notices)) { |
|
120 | 120 | $output .= '<h3>Notices</h3>'; |
121 | 121 | $output .= '<ol class="debug-bar-php-list">'; |
122 | - foreach ( $notices as $key => $notice) { $output .= $this->render_item( $notice, 'gv-notice-' . $key ); } |
|
122 | + foreach ($notices as $key => $notice) { $output .= $this->render_item($notice, 'gv-notice-'.$key); } |
|
123 | 123 | $output .= '</ol>'; |
124 | 124 | } |
125 | 125 | |
@@ -134,12 +134,12 @@ discard block |
||
134 | 134 | * @return string Escaped HTML |
135 | 135 | */ |
136 | 136 | function esc_html_recursive($item) { |
137 | - if(is_object($item)) { |
|
138 | - foreach($item as $key => $value) { |
|
137 | + if (is_object($item)) { |
|
138 | + foreach ($item as $key => $value) { |
|
139 | 139 | $item->{$key} = $this->esc_html_recursive($value); |
140 | 140 | } |
141 | - } else if(is_array($item)) { |
|
142 | - foreach($item as $key => $value) { |
|
141 | + } else if (is_array($item)) { |
|
142 | + foreach ($item as $key => $value) { |
|
143 | 143 | $item[$key] = $this->esc_html_recursive($value); |
144 | 144 | } |
145 | 145 | } else { |
@@ -155,31 +155,31 @@ discard block |
||
155 | 155 | * @param string $anchor The anchor ID for the item |
156 | 156 | * @return string HTML output |
157 | 157 | */ |
158 | - function render_item( $notice, $anchor = '' ) { |
|
158 | + function render_item($notice, $anchor = '') { |
|
159 | 159 | |
160 | 160 | $output = ''; |
161 | 161 | |
162 | - if(!empty($notice['message'])) { |
|
163 | - $output .= '<a id="'.sanitize_html_class( $anchor ).'"></a>'; |
|
162 | + if (!empty($notice['message'])) { |
|
163 | + $output .= '<a id="'.sanitize_html_class($anchor).'"></a>'; |
|
164 | 164 | $output .= "<li class='debug-bar-php-notice'>"; |
165 | 165 | } |
166 | 166 | |
167 | 167 | $output .= '<div class="clear"></div>'; |
168 | 168 | |
169 | 169 | // Title |
170 | - $output .= '<div class="gravityview-debug-bar-title">'.esc_attr( $notice['message'] ).'</div>'; |
|
170 | + $output .= '<div class="gravityview-debug-bar-title">'.esc_attr($notice['message']).'</div>'; |
|
171 | 171 | |
172 | 172 | // Debugging Output |
173 | - if( empty( $notice['data'] ) ) { |
|
174 | - if( !is_null( $notice['data'] ) ) { |
|
175 | - $output .= '<em>'._x('Empty', 'Debugging output data is empty.', 'gravityview' ).'</em>'; |
|
173 | + if (empty($notice['data'])) { |
|
174 | + if (!is_null($notice['data'])) { |
|
175 | + $output .= '<em>'._x('Empty', 'Debugging output data is empty.', 'gravityview').'</em>'; |
|
176 | 176 | } |
177 | 177 | } |
178 | 178 | else { |
179 | - $output .= sprintf( '<pre>%s</pre>', print_r($this->esc_html_recursive( $notice['data'] ), true) ); |
|
179 | + $output .= sprintf('<pre>%s</pre>', print_r($this->esc_html_recursive($notice['data']), true)); |
|
180 | 180 | } |
181 | 181 | |
182 | - if(!empty($notice['message'])) { |
|
182 | + if (!empty($notice['message'])) { |
|
183 | 183 | $output .= '</li>'; |
184 | 184 | } |
185 | 185 |
@@ -1,15 +1,15 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Renders all the metaboxes on Add New / Edit View post type. |
|
4 | - * |
|
5 | - * @package GravityView |
|
6 | - * @license GPL2+ |
|
7 | - * @author Katz Web Services, Inc. |
|
8 | - * @link http://gravityview.co |
|
9 | - * @copyright Copyright 2014, Katz Web Services, Inc. |
|
10 | - * |
|
11 | - * @since 1.0.0 |
|
12 | - */ |
|
3 | + * Renders all the metaboxes on Add New / Edit View post type. |
|
4 | + * |
|
5 | + * @package GravityView |
|
6 | + * @license GPL2+ |
|
7 | + * @author Katz Web Services, Inc. |
|
8 | + * @link http://gravityview.co |
|
9 | + * @copyright Copyright 2014, Katz Web Services, Inc. |
|
10 | + * |
|
11 | + * @since 1.0.0 |
|
12 | + */ |
|
13 | 13 | |
14 | 14 | /** If this file is called directly, abort. */ |
15 | 15 | if ( ! defined( 'ABSPATH' ) ) { |
@@ -1037,15 +1037,15 @@ discard block |
||
1037 | 1037 | GFForms::register_scripts(); |
1038 | 1038 | |
1039 | 1039 | $scripts = array( |
1040 | - 'sack', |
|
1041 | - 'gform_gravityforms', |
|
1042 | - 'gform_forms', |
|
1043 | - 'gform_form_admin', |
|
1044 | - 'jquery-ui-autocomplete' |
|
1040 | + 'sack', |
|
1041 | + 'gform_gravityforms', |
|
1042 | + 'gform_forms', |
|
1043 | + 'gform_form_admin', |
|
1044 | + 'jquery-ui-autocomplete' |
|
1045 | 1045 | ); |
1046 | 1046 | |
1047 | 1047 | if ( wp_is_mobile() ) { |
1048 | - $scripts[] = 'jquery-touch-punch'; |
|
1048 | + $scripts[] = 'jquery-touch-punch'; |
|
1049 | 1049 | } |
1050 | 1050 | |
1051 | 1051 | foreach ($scripts as $script) { |
@@ -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 = 0, $context = 'single' ) { |
|
554 | + function render_available_fields($form = 0, $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,11 +585,11 @@ 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 | 595 | /** |
@@ -600,15 +600,15 @@ discard block |
||
600 | 600 | * @param string $context (default: 'single') |
601 | 601 | * @return void |
602 | 602 | */ |
603 | - public function render_additional_fields( $form = 0, $context = 'single' ) { |
|
603 | + public function render_additional_fields($form = 0, $context = 'single') { |
|
604 | 604 | |
605 | 605 | /** |
606 | 606 | * @filter `gravityview_additional_fields` non-standard Fields to show at the bottom of the field picker |
607 | 607 | * @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 |
608 | 608 | */ |
609 | - $additional_fields = apply_filters( 'gravityview_additional_fields', array( |
|
609 | + $additional_fields = apply_filters('gravityview_additional_fields', array( |
|
610 | 610 | array( |
611 | - 'label_text' => __( '+ Add All Fields', 'gravityview' ), |
|
611 | + 'label_text' => __('+ Add All Fields', 'gravityview'), |
|
612 | 612 | 'desc' => __('Add all the available fields at once.', 'gravityview'), |
613 | 613 | 'field_id' => 'all-fields', |
614 | 614 | 'label_type' => 'field', |
@@ -618,11 +618,11 @@ discard block |
||
618 | 618 | ) |
619 | 619 | )); |
620 | 620 | |
621 | - if( !empty( $additional_fields )) { |
|
622 | - foreach ( (array)$additional_fields as $item ) { |
|
621 | + if (!empty($additional_fields)) { |
|
622 | + foreach ((array)$additional_fields as $item) { |
|
623 | 623 | |
624 | 624 | // Prevent items from not having index set |
625 | - $item = wp_parse_args( $item, array( |
|
625 | + $item = wp_parse_args($item, array( |
|
626 | 626 | 'label_text' => NULL, |
627 | 627 | 'field_id' => NULL, |
628 | 628 | 'label_type' => NULL, |
@@ -632,13 +632,13 @@ discard block |
||
632 | 632 | )); |
633 | 633 | |
634 | 634 | // Backward compat. |
635 | - if( !empty( $item['field_options'] ) ) { |
|
635 | + if (!empty($item['field_options'])) { |
|
636 | 636 | // Use settings_html from now on. |
637 | 637 | $item['settings_html'] = $item['field_options']; |
638 | 638 | } |
639 | 639 | |
640 | 640 | // Render a label for each of them |
641 | - echo new GravityView_Admin_View_Field( $item['label_text'], $item['field_id'], $item ); |
|
641 | + echo new GravityView_Admin_View_Field($item['label_text'], $item['field_id'], $item); |
|
642 | 642 | |
643 | 643 | } |
644 | 644 | } |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | |
656 | 656 | $entry_default_fields = array(); |
657 | 657 | |
658 | - if( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
658 | + if (in_array($zone, array('directory', 'single'))) { |
|
659 | 659 | |
660 | 660 | $entry_default_fields = array( |
661 | 661 | 'id' => array( |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | ); |
705 | 705 | |
706 | 706 | |
707 | - if( 'single' !== $zone) { |
|
707 | + if ('single' !== $zone) { |
|
708 | 708 | |
709 | 709 | $entry_default_fields['entry_link'] = array( |
710 | 710 | 'label' => __('Link to Entry', 'gravityview'), |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | * @param string|array $form form_ID or form object |
723 | 723 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
724 | 724 | */ |
725 | - return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone); |
|
725 | + return apply_filters('gravityview_entry_default_fields', $entry_default_fields, $form, $zone); |
|
726 | 726 | } |
727 | 727 | |
728 | 728 | /** |
@@ -731,25 +731,25 @@ discard block |
||
731 | 731 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
732 | 732 | * @return array fields |
733 | 733 | */ |
734 | - function get_available_fields( $form = '', $zone = NULL ) { |
|
734 | + function get_available_fields($form = '', $zone = NULL) { |
|
735 | 735 | |
736 | - if( empty( $form ) ) { |
|
737 | - do_action( 'gravityview_log_error', '[get_available_fields] $form is empty' ); |
|
736 | + if (empty($form)) { |
|
737 | + do_action('gravityview_log_error', '[get_available_fields] $form is empty'); |
|
738 | 738 | return array(); |
739 | 739 | } |
740 | 740 | |
741 | 741 | // get form fields |
742 | - $fields = gravityview_get_form_fields( $form, true ); |
|
742 | + $fields = gravityview_get_form_fields($form, true); |
|
743 | 743 | |
744 | 744 | // get meta fields ( only if form was already created ) |
745 | - if( !is_array( $form ) ) { |
|
746 | - $meta_fields = gravityview_get_entry_meta( $form ); |
|
745 | + if (!is_array($form)) { |
|
746 | + $meta_fields = gravityview_get_entry_meta($form); |
|
747 | 747 | } else { |
748 | 748 | $meta_fields = array(); |
749 | 749 | } |
750 | 750 | |
751 | 751 | // get default fields |
752 | - $default_fields = $this->get_entry_default_fields( $form, $zone ); |
|
752 | + $default_fields = $this->get_entry_default_fields($form, $zone); |
|
753 | 753 | |
754 | 754 | //merge without loosing the keys |
755 | 755 | $fields = $fields + $meta_fields + $default_fields; |
@@ -766,11 +766,11 @@ discard block |
||
766 | 766 | |
767 | 767 | $widgets = $this->get_registered_widgets(); |
768 | 768 | |
769 | - if( !empty( $widgets ) ) { |
|
769 | + if (!empty($widgets)) { |
|
770 | 770 | |
771 | - foreach( $widgets as $id => $details ) { |
|
771 | + foreach ($widgets as $id => $details) { |
|
772 | 772 | |
773 | - echo new GravityView_Admin_View_Widget( $details['label'], $id, $details ); |
|
773 | + echo new GravityView_Admin_View_Widget($details['label'], $id, $details); |
|
774 | 774 | |
775 | 775 | } |
776 | 776 | } |
@@ -787,7 +787,7 @@ discard block |
||
787 | 787 | * @filter `gravityview_register_directory_widgets` Get the list of registered widgets. Each item is used to instantiate a GravityView_Admin_View_Widget object |
788 | 788 | * @param array $registered_widgets Empty array |
789 | 789 | */ |
790 | - $registered_widgets = apply_filters( 'gravityview_register_directory_widgets', array() ); |
|
790 | + $registered_widgets = apply_filters('gravityview_register_directory_widgets', array()); |
|
791 | 791 | |
792 | 792 | return $registered_widgets; |
793 | 793 | } |
@@ -801,67 +801,67 @@ discard block |
||
801 | 801 | * @param array $values Saved objects |
802 | 802 | * @return void |
803 | 803 | */ |
804 | - function render_active_areas( $template_id, $type, $zone, $rows, $values ) { |
|
804 | + function render_active_areas($template_id, $type, $zone, $rows, $values) { |
|
805 | 805 | global $post; |
806 | 806 | |
807 | - if( $type === 'widget' ) { |
|
808 | - $button_label = __( 'Add Widget', 'gravityview' ); |
|
807 | + if ($type === 'widget') { |
|
808 | + $button_label = __('Add Widget', 'gravityview'); |
|
809 | 809 | } else { |
810 | - $button_label = __( 'Add Field', 'gravityview' ); |
|
810 | + $button_label = __('Add Field', 'gravityview'); |
|
811 | 811 | } |
812 | 812 | |
813 | 813 | $available_items = array(); |
814 | 814 | |
815 | 815 | // if saved values, get available fields to label everyone |
816 | - if( !empty( $values ) && ( !empty( $post->ID ) || !empty( $_POST['template_id'] ) ) ) { |
|
816 | + if (!empty($values) && (!empty($post->ID) || !empty($_POST['template_id']))) { |
|
817 | 817 | |
818 | - if( !empty( $_POST['template_id'] ) ) { |
|
819 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
818 | + if (!empty($_POST['template_id'])) { |
|
819 | + $form = GravityView_Ajax::pre_get_form_fields($_POST['template_id']); |
|
820 | 820 | } else { |
821 | - $form = gravityview_get_form_id( $post->ID ); |
|
821 | + $form = gravityview_get_form_id($post->ID); |
|
822 | 822 | } |
823 | 823 | |
824 | - if( 'field' === $type ) { |
|
825 | - $available_items = $this->get_available_fields( $form, $zone ); |
|
824 | + if ('field' === $type) { |
|
825 | + $available_items = $this->get_available_fields($form, $zone); |
|
826 | 826 | } else { |
827 | 827 | $available_items = $this->get_registered_widgets(); |
828 | 828 | } |
829 | 829 | |
830 | 830 | } |
831 | 831 | |
832 | - foreach( $rows as $row ) : |
|
833 | - foreach( $row as $col => $areas ) : |
|
832 | + foreach ($rows as $row) : |
|
833 | + foreach ($row as $col => $areas) : |
|
834 | 834 | $column = ($col == '2-2') ? '1-2' : $col; ?> |
835 | 835 | |
836 | - <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
|
836 | + <div class="gv-grid-col-<?php echo esc_attr($column); ?>"> |
|
837 | 837 | |
838 | - <?php foreach( $areas as $area ) : ?> |
|
838 | + <?php foreach ($areas as $area) : ?> |
|
839 | 839 | |
840 | 840 | <div class="gv-droppable-area"> |
841 | - <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>"> |
|
841 | + <div class="active-drop active-drop-<?php echo esc_attr($type); ?>" data-areaid="<?php echo esc_attr($zone.'_'.$area['areaid']); ?>"> |
|
842 | 842 | |
843 | 843 | <?php // render saved fields |
844 | 844 | |
845 | - if( !empty( $values[ $zone .'_'. $area['areaid'] ] ) ) { |
|
845 | + if (!empty($values[$zone.'_'.$area['areaid']])) { |
|
846 | 846 | |
847 | - foreach( $values[ $zone .'_'. $area['areaid'] ] as $uniqid => $field ) { |
|
847 | + foreach ($values[$zone.'_'.$area['areaid']] as $uniqid => $field) { |
|
848 | 848 | |
849 | 849 | $input_type = NULL; |
850 | - $original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ; |
|
850 | + $original_item = isset($available_items[$field['id']]) ? $available_items[$field['id']] : false; |
|
851 | 851 | |
852 | - if( !$original_item ) { |
|
852 | + if (!$original_item) { |
|
853 | 853 | |
854 | - 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 )); |
|
854 | + 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)); |
|
855 | 855 | |
856 | 856 | $original_item = $field; |
857 | 857 | } else { |
858 | 858 | |
859 | - $input_type = isset( $original_item['type'] ) ? $original_item['type'] : NULL; |
|
859 | + $input_type = isset($original_item['type']) ? $original_item['type'] : NULL; |
|
860 | 860 | |
861 | 861 | } |
862 | 862 | |
863 | 863 | // Field options dialog box |
864 | - $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 ); |
|
864 | + $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); |
|
865 | 865 | |
866 | 866 | $item = array( |
867 | 867 | 'input_type' => $input_type, |
@@ -870,16 +870,16 @@ discard block |
||
870 | 870 | ); |
871 | 871 | |
872 | 872 | // Merge the values with the current item to pass things like widget descriptions and original field names |
873 | - if( $original_item ) { |
|
874 | - $item = wp_parse_args( $item, $original_item ); |
|
873 | + if ($original_item) { |
|
874 | + $item = wp_parse_args($item, $original_item); |
|
875 | 875 | } |
876 | 876 | |
877 | - switch( $type ) { |
|
877 | + switch ($type) { |
|
878 | 878 | case 'widget': |
879 | - echo new GravityView_Admin_View_Widget( $item['label'], $field['id'], $item, $field ); |
|
879 | + echo new GravityView_Admin_View_Widget($item['label'], $field['id'], $item, $field); |
|
880 | 880 | break; |
881 | 881 | default: |
882 | - echo new GravityView_Admin_View_Field( $item['label'], $field['id'], $item, $field ); |
|
882 | + echo new GravityView_Admin_View_Field($item['label'], $field['id'], $item, $field); |
|
883 | 883 | } |
884 | 884 | |
885 | 885 | |
@@ -889,11 +889,11 @@ discard block |
||
889 | 889 | |
890 | 890 | } // End if zone is not empty ?> |
891 | 891 | |
892 | - <span class="drop-message"><?php echo sprintf(esc_attr__('"+ %s" or drag existing %ss here.', 'gravityview'), $button_label, $type ); ?></span> |
|
892 | + <span class="drop-message"><?php echo sprintf(esc_attr__('"+ %s" or drag existing %ss here.', 'gravityview'), $button_label, $type); ?></span> |
|
893 | 893 | </div> |
894 | 894 | <div class="gv-droppable-area-action"> |
895 | - <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> |
|
896 | - <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> |
|
895 | + <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> |
|
896 | + <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> |
|
897 | 897 | </div> |
898 | 898 | </div> |
899 | 899 | |
@@ -910,13 +910,13 @@ discard block |
||
910 | 910 | * @param string $post_id Current Post ID (view) |
911 | 911 | * @return string html |
912 | 912 | */ |
913 | - function render_widgets_active_areas( $template_id = '', $zone, $post_id = '' ) { |
|
913 | + function render_widgets_active_areas($template_id = '', $zone, $post_id = '') { |
|
914 | 914 | |
915 | 915 | $default_widget_areas = GravityView_Plugin::get_default_widget_areas(); |
916 | 916 | |
917 | 917 | $widgets = array(); |
918 | - if( !empty( $post_id ) ) { |
|
919 | - $widgets = get_post_meta( $post_id, '_gravityview_directory_widgets', true ); |
|
918 | + if (!empty($post_id)) { |
|
919 | + $widgets = get_post_meta($post_id, '_gravityview_directory_widgets', true); |
|
920 | 920 | |
921 | 921 | } |
922 | 922 | |
@@ -924,7 +924,7 @@ discard block |
||
924 | 924 | ?> |
925 | 925 | |
926 | 926 | <div class="gv-grid gv-grid-pad gv-grid-border" id="directory-<?php echo $zone; ?>-widgets"> |
927 | - <?php $this->render_active_areas( $template_id, 'widget', $zone, $default_widget_areas, $widgets ); ?> |
|
927 | + <?php $this->render_active_areas($template_id, 'widget', $zone, $default_widget_areas, $widgets); ?> |
|
928 | 928 | </div> |
929 | 929 | |
930 | 930 | <?php |
@@ -944,36 +944,36 @@ discard block |
||
944 | 944 | * @param string $context (default: 'single') |
945 | 945 | * @return string HTML of the active areas |
946 | 946 | */ |
947 | - function render_directory_active_areas( $template_id = '', $context = 'single', $post_id = '', $echo = false ) { |
|
947 | + function render_directory_active_areas($template_id = '', $context = 'single', $post_id = '', $echo = false) { |
|
948 | 948 | |
949 | - if( empty( $template_id ) ) { |
|
950 | - do_action( 'gravityview_log_debug', '[render_directory_active_areas] $template_id is empty' ); |
|
949 | + if (empty($template_id)) { |
|
950 | + do_action('gravityview_log_debug', '[render_directory_active_areas] $template_id is empty'); |
|
951 | 951 | return; |
952 | 952 | } |
953 | 953 | |
954 | - $template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context ); |
|
954 | + $template_areas = apply_filters('gravityview_template_active_areas', array(), $template_id, $context); |
|
955 | 955 | |
956 | - if( empty( $template_areas ) ) { |
|
956 | + if (empty($template_areas)) { |
|
957 | 957 | |
958 | - do_action( 'gravityview_log_debug', '[render_directory_active_areas] No areas defined. Maybe template %s is disabled.', $template_id ); |
|
958 | + do_action('gravityview_log_debug', '[render_directory_active_areas] No areas defined. Maybe template %s is disabled.', $template_id); |
|
959 | 959 | $output = '<div>'; |
960 | - $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>'; |
|
960 | + $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>'; |
|
961 | 961 | $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>'; |
962 | 962 | $output .= '</div>'; |
963 | 963 | } else { |
964 | 964 | |
965 | 965 | $fields = ''; |
966 | - if ( ! empty( $post_id ) ) { |
|
967 | - $fields = gravityview_get_directory_fields( $post_id ); |
|
966 | + if (!empty($post_id)) { |
|
967 | + $fields = gravityview_get_directory_fields($post_id); |
|
968 | 968 | } |
969 | 969 | |
970 | 970 | ob_start(); |
971 | - $this->render_active_areas( $template_id, 'field', $context, $template_areas, $fields ); |
|
971 | + $this->render_active_areas($template_id, 'field', $context, $template_areas, $fields); |
|
972 | 972 | $output = ob_get_clean(); |
973 | 973 | |
974 | 974 | } |
975 | 975 | |
976 | - if( $echo ) { |
|
976 | + if ($echo) { |
|
977 | 977 | echo $output; |
978 | 978 | } |
979 | 979 | |
@@ -987,46 +987,46 @@ discard block |
||
987 | 987 | * @param mixed $hook |
988 | 988 | * @return void |
989 | 989 | */ |
990 | - static function add_scripts_and_styles( $hook ) { |
|
990 | + static function add_scripts_and_styles($hook) { |
|
991 | 991 | global $plugin_page, $pagenow; |
992 | 992 | |
993 | - $is_widgets_page = ( $pagenow === 'widgets.php' ); |
|
993 | + $is_widgets_page = ($pagenow === 'widgets.php'); |
|
994 | 994 | |
995 | 995 | // Add the GV font (with the Astronaut) |
996 | - wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
996 | + wp_enqueue_style('gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version); |
|
997 | 997 | |
998 | - wp_register_script( 'gravityview-jquery-cookie', plugins_url('includes/lib/jquery-cookie/jquery_cookie.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version, true ); |
|
998 | + wp_register_script('gravityview-jquery-cookie', plugins_url('includes/lib/jquery-cookie/jquery_cookie.js', GRAVITYVIEW_FILE), array('jquery'), GravityView_Plugin::version, true); |
|
999 | 999 | |
1000 | 1000 | // Don't process any scripts below here if it's not a GravityView page. |
1001 | - if( !gravityview_is_admin_page($hook) && !$is_widgets_page ) { return; } |
|
1001 | + if (!gravityview_is_admin_page($hook) && !$is_widgets_page) { return; } |
|
1002 | 1002 | |
1003 | 1003 | // Only enqueue the following on single pages |
1004 | - if( gravityview_is_admin_page($hook, 'single') || $is_widgets_page ) { |
|
1004 | + if (gravityview_is_admin_page($hook, 'single') || $is_widgets_page) { |
|
1005 | 1005 | |
1006 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
1007 | - wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), GravityView_Plugin::version ); |
|
1006 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
1007 | + wp_enqueue_style('gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), GravityView_Plugin::version); |
|
1008 | 1008 | |
1009 | 1009 | $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
1010 | 1010 | |
1011 | 1011 | //enqueue scripts |
1012 | - 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 ); |
|
1012 | + 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); |
|
1013 | 1013 | |
1014 | 1014 | wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
1015 | 1015 | 'cookiepath' => COOKIEPATH, |
1016 | - 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
|
1017 | - 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
|
1018 | - 'label_close' => __( 'Close', 'gravityview' ), |
|
1019 | - 'label_cancel' => __( 'Cancel', 'gravityview' ), |
|
1020 | - 'label_continue' => __( 'Continue', 'gravityview' ), |
|
1021 | - 'label_ok' => __( 'Ok', 'gravityview' ), |
|
1022 | - 'label_publisherror' => __( 'Error while creating the View for you. Check the settings or contact GravityView support.', 'gravityview' ), |
|
1023 | - 'loading_text' => esc_html__( 'Loading…', 'gravityview' ), |
|
1024 | - 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
|
1025 | - 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
|
1026 | - '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' ), |
|
1016 | + 'nonce' => wp_create_nonce('gravityview_ajaxviews'), |
|
1017 | + 'label_viewname' => __('Enter View name here', 'gravityview'), |
|
1018 | + 'label_close' => __('Close', 'gravityview'), |
|
1019 | + 'label_cancel' => __('Cancel', 'gravityview'), |
|
1020 | + 'label_continue' => __('Continue', 'gravityview'), |
|
1021 | + 'label_ok' => __('Ok', 'gravityview'), |
|
1022 | + 'label_publisherror' => __('Error while creating the View for you. Check the settings or contact GravityView support.', 'gravityview'), |
|
1023 | + 'loading_text' => esc_html__('Loading…', 'gravityview'), |
|
1024 | + 'loading_error' => esc_html__('There was an error loading dynamic content.', 'gravityview'), |
|
1025 | + 'field_loaderror' => __('Error while adding the field. Please try again or contact GravityView support.', 'gravityview'), |
|
1026 | + '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'), |
|
1027 | 1027 | )); |
1028 | 1028 | |
1029 | - wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array('dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
1029 | + wp_enqueue_style('gravityview_views_styles', plugins_url('assets/css/admin-views.css', GRAVITYVIEW_FILE), array('dashicons', 'wp-jquery-ui-dialog'), GravityView_Plugin::version); |
|
1030 | 1030 | |
1031 | 1031 | self::enqueue_gravity_forms_scripts(); |
1032 | 1032 | |
@@ -1044,26 +1044,26 @@ discard block |
||
1044 | 1044 | 'jquery-ui-autocomplete' |
1045 | 1045 | ); |
1046 | 1046 | |
1047 | - if ( wp_is_mobile() ) { |
|
1047 | + if (wp_is_mobile()) { |
|
1048 | 1048 | $scripts[] = 'jquery-touch-punch'; |
1049 | 1049 | } |
1050 | 1050 | |
1051 | 1051 | foreach ($scripts as $script) { |
1052 | - wp_enqueue_script( $script ); |
|
1052 | + wp_enqueue_script($script); |
|
1053 | 1053 | } |
1054 | 1054 | } |
1055 | 1055 | |
1056 | - function register_no_conflict( $registered ) { |
|
1056 | + function register_no_conflict($registered) { |
|
1057 | 1057 | |
1058 | 1058 | $filter = current_filter(); |
1059 | 1059 | |
1060 | - if( preg_match('/script/ism', $filter ) ) { |
|
1061 | - $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', |
|
1062 | - 'sack', 'gform_gravityforms', 'gform_forms', 'gform_form_admin', 'jquery-ui-autocomplete' ); |
|
1063 | - $registered = array_merge( $registered, $allow_scripts ); |
|
1064 | - } elseif( preg_match('/style/ism', $filter ) ) { |
|
1065 | - $allow_styles = array( 'dashicons', 'wp-jquery-ui-dialog', 'gravityview_views_styles', 'gravityview_global', 'gravityview_views_datepicker' ); |
|
1066 | - $registered = array_merge( $registered, $allow_styles ); |
|
1060 | + if (preg_match('/script/ism', $filter)) { |
|
1061 | + $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', |
|
1062 | + 'sack', 'gform_gravityforms', 'gform_forms', 'gform_form_admin', 'jquery-ui-autocomplete'); |
|
1063 | + $registered = array_merge($registered, $allow_scripts); |
|
1064 | + } elseif (preg_match('/style/ism', $filter)) { |
|
1065 | + $allow_styles = array('dashicons', 'wp-jquery-ui-dialog', 'gravityview_views_styles', 'gravityview_global', 'gravityview_views_datepicker'); |
|
1066 | + $registered = array_merge($registered, $allow_styles); |
|
1067 | 1067 | } |
1068 | 1068 | |
1069 | 1069 | return $registered; |