@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | |
137 | 137 | if( empty( $connected_views ) ) { |
138 | 138 | |
139 | - $menu_items['gravityview'] = array( |
|
139 | + $menu_items['gravityview'] = array( |
|
140 | 140 | 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
141 | 141 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
142 | 142 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
@@ -167,13 +167,13 @@ discard block |
||
167 | 167 | // If there were no items added, then let's create the parent menu |
168 | 168 | if( $sub_menu_items ) { |
169 | 169 | |
170 | - $sub_menu_items[] = array( |
|
171 | - 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
|
172 | - 'link_class' => 'gv-create-view', |
|
173 | - 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
|
174 | - 'url' => admin_url( 'post-new.php?post_type=gravityview&form_id=' . $id ), |
|
175 | - 'capabilities' => array( 'edit_gravityviews' ), |
|
176 | - ); |
|
170 | + $sub_menu_items[] = array( |
|
171 | + 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
|
172 | + 'link_class' => 'gv-create-view', |
|
173 | + 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
|
174 | + 'url' => admin_url( 'post-new.php?post_type=gravityview&form_id=' . $id ), |
|
175 | + 'capabilities' => array( 'edit_gravityviews' ), |
|
176 | + ); |
|
177 | 177 | |
178 | 178 | // Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown |
179 | 179 | $sub_menu_items[] = array( |
@@ -549,12 +549,12 @@ discard block |
||
549 | 549 | * Render html for displaying available fields based on a Form ID |
550 | 550 | * $blacklist_field_types - contains the field types which are not proper to be shown in a directory. |
551 | 551 | * |
552 | - * @see GravityView_Ajax::get_available_fields_html() Triggers `gravityview_render_available_fields` action |
|
552 | + * @see GravityView_Ajax::get_available_fields_html() Triggers `gravityview_render_available_fields` action |
|
553 | 553 | * @access public |
554 | - * |
|
554 | + * |
|
555 | 555 | * @param int $form Gravity Forms Form ID (default: '') |
556 | 556 | * @param string $context (default: 'single') |
557 | - * |
|
557 | + * |
|
558 | 558 | * @return void |
559 | 559 | */ |
560 | 560 | function render_available_fields( $form = 0, $context = 'single' ) { |
@@ -702,12 +702,12 @@ discard block |
||
702 | 702 | /** |
703 | 703 | * @since 1.7.2 |
704 | 704 | */ |
705 | - 'other_entries' => array( |
|
706 | - 'label' => __('Other Entries', 'gravityview'), |
|
707 | - 'type' => 'other_entries', |
|
708 | - 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
709 | - ), |
|
710 | - ); |
|
705 | + 'other_entries' => array( |
|
706 | + 'label' => __('Other Entries', 'gravityview'), |
|
707 | + 'type' => 'other_entries', |
|
708 | + 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
709 | + ), |
|
710 | + ); |
|
711 | 711 | |
712 | 712 | if( 'single' !== $zone) { |
713 | 713 | |
@@ -1024,7 +1024,7 @@ discard block |
||
1024 | 1024 | |
1025 | 1025 | wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
1026 | 1026 | 'cookiepath' => COOKIEPATH, |
1027 | - 'passed_form_id' => (bool) rgget( 'form_id' ), |
|
1027 | + 'passed_form_id' => (bool) rgget( 'form_id' ), |
|
1028 | 1028 | 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
1029 | 1029 | 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
1030 | 1030 | 'label_close' => __( 'Close', 'gravityview' ), |
@@ -1049,15 +1049,15 @@ discard block |
||
1049 | 1049 | GFForms::register_scripts(); |
1050 | 1050 | |
1051 | 1051 | $scripts = array( |
1052 | - 'sack', |
|
1053 | - 'gform_gravityforms', |
|
1054 | - 'gform_forms', |
|
1055 | - 'gform_form_admin', |
|
1056 | - 'jquery-ui-autocomplete' |
|
1052 | + 'sack', |
|
1053 | + 'gform_gravityforms', |
|
1054 | + 'gform_forms', |
|
1055 | + 'gform_form_admin', |
|
1056 | + 'jquery-ui-autocomplete' |
|
1057 | 1057 | ); |
1058 | 1058 | |
1059 | 1059 | if ( wp_is_mobile() ) { |
1060 | - $scripts[] = 'jquery-touch-punch'; |
|
1060 | + $scripts[] = 'jquery-touch-punch'; |
|
1061 | 1061 | } |
1062 | 1062 | |
1063 | 1063 | foreach ($scripts as $script) { |
@@ -28,30 +28,30 @@ discard block |
||
28 | 28 | add_filter( 'gravityview_blacklist_field_types', array( $this, 'default_field_blacklist' ), 10, 2 ); |
29 | 29 | |
30 | 30 | // Tooltips |
31 | - add_filter( 'gform_tooltips', array( $this, 'tooltips') ); |
|
31 | + add_filter( 'gform_tooltips', array( $this, 'tooltips' ) ); |
|
32 | 32 | |
33 | 33 | // adding styles and scripts |
34 | - add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles'), 999 ); |
|
35 | - add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
36 | - add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
37 | - add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
38 | - add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
39 | - |
|
40 | - add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas'), 10, 4 ); |
|
41 | - add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas'), 10, 3 ); |
|
42 | - add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields'), 10, 2 ); |
|
43 | - add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets') ); |
|
44 | - add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas'), 10, 5 ); |
|
34 | + add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles' ), 999 ); |
|
35 | + add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
36 | + add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
37 | + add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
38 | + add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
39 | + |
|
40 | + add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas' ), 10, 4 ); |
|
41 | + add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas' ), 10, 3 ); |
|
42 | + add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields' ), 10, 2 ); |
|
43 | + add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets' ) ); |
|
44 | + add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas' ), 10, 5 ); |
|
45 | 45 | |
46 | 46 | // @todo check if this hook is needed.. |
47 | 47 | //add_action( 'gravityview_render_field_options', array( $this, 'render_field_options'), 10, 9 ); |
48 | 48 | |
49 | 49 | // Add Connected Form column |
50 | - add_filter('manage_gravityview_posts_columns' , array( $this, 'add_post_type_columns' ) ); |
|
50 | + add_filter( 'manage_gravityview_posts_columns', array( $this, 'add_post_type_columns' ) ); |
|
51 | 51 | |
52 | 52 | add_filter( 'gform_toolbar_menu', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 ); |
53 | 53 | |
54 | - add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content'), 10, 2 ); |
|
54 | + add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content' ), 10, 2 ); |
|
55 | 55 | |
56 | 56 | add_action( 'restrict_manage_posts', array( $this, 'add_view_dropdown' ) ); |
57 | 57 | |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | public function filter_pre_get_posts_by_gravityview_form_id( &$query ) { |
67 | 67 | global $pagenow; |
68 | 68 | |
69 | - if ( !is_admin() ) { |
|
69 | + if ( ! is_admin() ) { |
|
70 | 70 | return; |
71 | 71 | } |
72 | 72 | |
73 | - if( 'edit.php' !== $pagenow || ! rgget( 'gravityview_form_id' ) || ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
73 | + if ( 'edit.php' !== $pagenow || ! rgget( 'gravityview_form_id' ) || ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
74 | 74 | return; |
75 | 75 | } |
76 | 76 | |
@@ -87,18 +87,18 @@ discard block |
||
87 | 87 | function add_view_dropdown() { |
88 | 88 | $current_screen = get_current_screen(); |
89 | 89 | |
90 | - if( 'gravityview' !== $current_screen->post_type ) { |
|
90 | + if ( 'gravityview' !== $current_screen->post_type ) { |
|
91 | 91 | return; |
92 | 92 | } |
93 | 93 | |
94 | 94 | $forms = gravityview_get_forms(); |
95 | 95 | $current_form = rgget( 'gravityview_form_id' ); |
96 | 96 | // If there are no forms to select, show no forms. |
97 | - if( !empty( $forms ) ) { ?> |
|
97 | + if ( ! empty( $forms ) ) { ?> |
|
98 | 98 | <select name="gravityview_form_id" id="gravityview_form_id"> |
99 | 99 | <option value="" <?php selected( '', $current_form, true ); ?>><?php esc_html_e( 'All forms', 'gravityview' ); ?></option> |
100 | - <?php foreach( $forms as $form ) { ?> |
|
101 | - <option value="<?php echo $form['id']; ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option> |
|
100 | + <?php foreach ( $forms as $form ) { ?> |
|
101 | + <option value="<?php echo $form[ 'id' ]; ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option> |
|
102 | 102 | <?php } ?> |
103 | 103 | </select> |
104 | 104 | <?php } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) { |
113 | 113 | _deprecated_function( 'GravityView_Admin_Views::render_setting_row', '1.1.7', 'GravityView_Render_Settings::render_setting_row' ); |
114 | - GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name , $id ); |
|
114 | + GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name, $id ); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -134,9 +134,9 @@ discard block |
||
134 | 134 | |
135 | 135 | $connected_views = gravityview_get_connected_views( $id ); |
136 | 136 | |
137 | - if( empty( $connected_views ) ) { |
|
137 | + if ( empty( $connected_views ) ) { |
|
138 | 138 | |
139 | - $menu_items['gravityview'] = array( |
|
139 | + $menu_items[ 'gravityview' ] = array( |
|
140 | 140 | 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
141 | 141 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
142 | 142 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
@@ -152,22 +152,22 @@ discard block |
||
152 | 152 | $sub_menu_items = array(); |
153 | 153 | foreach ( (array)$connected_views as $view ) { |
154 | 154 | |
155 | - if( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
155 | + if ( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
156 | 156 | continue; |
157 | 157 | } |
158 | 158 | |
159 | - $label = empty( $view->post_title ) ? sprintf( __('No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
159 | + $label = empty( $view->post_title ) ? sprintf( __( 'No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
160 | 160 | |
161 | - $sub_menu_items[] = array( |
|
161 | + $sub_menu_items[ ] = array( |
|
162 | 162 | 'label' => esc_attr( $label ), |
163 | - 'url' => admin_url( 'post.php?action=edit&post='.$view->ID ), |
|
163 | + 'url' => admin_url( 'post.php?action=edit&post=' . $view->ID ), |
|
164 | 164 | ); |
165 | 165 | } |
166 | 166 | |
167 | 167 | // If there were no items added, then let's create the parent menu |
168 | - if( $sub_menu_items ) { |
|
168 | + if ( $sub_menu_items ) { |
|
169 | 169 | |
170 | - $sub_menu_items[] = array( |
|
170 | + $sub_menu_items[ ] = array( |
|
171 | 171 | 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
172 | 172 | 'link_class' => 'gv-create-view', |
173 | 173 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
@@ -176,14 +176,14 @@ discard block |
||
176 | 176 | ); |
177 | 177 | |
178 | 178 | // Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown |
179 | - $sub_menu_items[] = array( |
|
179 | + $sub_menu_items[ ] = array( |
|
180 | 180 | 'url' => '#', |
181 | 181 | 'label' => '', |
182 | 182 | 'menu_class' => 'hidden', |
183 | 183 | 'capabilities' => '', |
184 | 184 | ); |
185 | 185 | |
186 | - $menu_items['gravityview'] = array( |
|
186 | + $menu_items[ 'gravityview' ] = array( |
|
187 | 187 | 'label' => __( 'Connected Views', 'gravityview' ), |
188 | 188 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
189 | 189 | 'title' => __( 'GravityView Views using this form as a data source', 'gravityview' ), |
@@ -212,8 +212,8 @@ discard block |
||
212 | 212 | $add = array( 'captcha', 'page' ); |
213 | 213 | |
214 | 214 | // Don't allowing editing the following values: |
215 | - if( $context === 'edit' ) { |
|
216 | - $add[] = 'post_id'; |
|
215 | + if ( $context === 'edit' ) { |
|
216 | + $add[ ] = 'post_id'; |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | $return = array_merge( $array, $add ); |
@@ -236,32 +236,32 @@ discard block |
||
236 | 236 | foreach ( $default_args as $key => $arg ) { |
237 | 237 | |
238 | 238 | // If an arg has `tooltip` defined, but it's false, don't display a tooltip |
239 | - if( isset( $arg['tooltip'] ) && empty( $arg['tooltip'] ) ) { continue; } |
|
239 | + if ( isset( $arg[ 'tooltip' ] ) && empty( $arg[ 'tooltip' ] ) ) { continue; } |
|
240 | 240 | |
241 | 241 | // By default, use `tooltip` if defined. |
242 | - $tooltip = empty( $arg['tooltip'] ) ? NULL : $arg['tooltip']; |
|
242 | + $tooltip = empty( $arg[ 'tooltip' ] ) ? NULL : $arg[ 'tooltip' ]; |
|
243 | 243 | |
244 | 244 | // Otherwise, use the description as a tooltip. |
245 | - if( empty( $tooltip ) && !empty( $arg['desc'] ) ) { |
|
246 | - $tooltip = $arg['desc']; |
|
245 | + if ( empty( $tooltip ) && ! empty( $arg[ 'desc' ] ) ) { |
|
246 | + $tooltip = $arg[ 'desc' ]; |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | // If there's no tooltip set, continue |
250 | - if( empty( $tooltip ) ) { |
|
250 | + if ( empty( $tooltip ) ) { |
|
251 | 251 | continue; |
252 | 252 | } |
253 | 253 | |
254 | 254 | // Add the tooltip |
255 | - $gv_tooltips[ 'gv_'.$key ] = array( |
|
256 | - 'title' => $arg['label'], |
|
255 | + $gv_tooltips[ 'gv_' . $key ] = array( |
|
256 | + 'title' => $arg[ 'label' ], |
|
257 | 257 | 'value' => $tooltip, |
258 | 258 | ); |
259 | 259 | |
260 | 260 | } |
261 | 261 | |
262 | - $gv_tooltips['gv_css_merge_tags'] = array( |
|
263 | - 'title' => __('CSS Merge Tags', 'gravityview'), |
|
264 | - 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview'), '<code>', '</code>' ) |
|
262 | + $gv_tooltips[ 'gv_css_merge_tags' ] = array( |
|
263 | + 'title' => __( 'CSS Merge Tags', 'gravityview' ), |
|
264 | + 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview' ), '<code>', '</code>' ) |
|
265 | 265 | ); |
266 | 266 | |
267 | 267 | /** |
@@ -272,9 +272,9 @@ discard block |
||
272 | 272 | |
273 | 273 | foreach ( $gv_tooltips as $key => $tooltip ) { |
274 | 274 | |
275 | - $title = empty( $tooltip['title'] ) ? '' : '<h6>'.esc_html( $tooltip['title'] ) .'</h6>'; |
|
275 | + $title = empty( $tooltip[ 'title' ] ) ? '' : '<h6>' . esc_html( $tooltip[ 'title' ] ) . '</h6>'; |
|
276 | 276 | |
277 | - $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip['value'] ) ); |
|
277 | + $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip[ 'value' ] ) ); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | return $tooltips; |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | * |
289 | 289 | * @return void |
290 | 290 | */ |
291 | - public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
291 | + public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
292 | 292 | |
293 | 293 | $output = ''; |
294 | 294 | |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | // Generate backup if label doesn't exist: `example_name` => `Example Name` |
311 | 311 | $template_id_pretty = ucwords( implode( ' ', explode( '_', $template_id ) ) ); |
312 | 312 | |
313 | - $output = $template ? $template['label'] : $template_id_pretty; |
|
313 | + $output = $template ? $template[ 'label' ] : $template_id_pretty; |
|
314 | 314 | |
315 | 315 | break; |
316 | 316 | |
@@ -351,44 +351,44 @@ discard block |
||
351 | 351 | static public function get_connected_form_links( $form, $include_form_link = true ) { |
352 | 352 | |
353 | 353 | // Either the form is empty or the form ID is 0, not yet set. |
354 | - if( empty( $form ) ) { |
|
354 | + if ( empty( $form ) ) { |
|
355 | 355 | return ''; |
356 | 356 | } |
357 | 357 | |
358 | 358 | // The $form is passed as the form ID |
359 | - if( !is_array( $form ) ) { |
|
359 | + if ( ! is_array( $form ) ) { |
|
360 | 360 | $form = gravityview_get_form( $form ); |
361 | 361 | } |
362 | 362 | |
363 | - $form_id = $form['id']; |
|
363 | + $form_id = $form[ 'id' ]; |
|
364 | 364 | $links = array(); |
365 | 365 | |
366 | - if( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
366 | + if ( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
367 | 367 | $form_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&id=%d', $form_id ) ); |
368 | - $form_link = '<strong class="gv-form-title">'.gravityview_get_link( $form_url, $form['title'], 'class=row-title' ).'</strong>'; |
|
369 | - $links[] = '<span>'.gravityview_get_link( $form_url, __('Edit Form', 'gravityview') ).'</span>'; |
|
368 | + $form_link = '<strong class="gv-form-title">' . gravityview_get_link( $form_url, $form[ 'title' ], 'class=row-title' ) . '</strong>'; |
|
369 | + $links[ ] = '<span>' . gravityview_get_link( $form_url, __( 'Edit Form', 'gravityview' ) ) . '</span>'; |
|
370 | 370 | } else { |
371 | - $form_link = '<strong class="gv-form-title">'. esc_html( $form['title'] ). '</strong>'; |
|
371 | + $form_link = '<strong class="gv-form-title">' . esc_html( $form[ 'title' ] ) . '</strong>'; |
|
372 | 372 | } |
373 | 373 | |
374 | - if( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
374 | + if ( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
375 | 375 | $entries_url = admin_url( sprintf( 'admin.php?page=gf_entries&id=%d', $form_id ) ); |
376 | - $links[] = '<span>'.gravityview_get_link( $entries_url, __('Entries', 'gravityview') ).'</span>'; |
|
376 | + $links[ ] = '<span>' . gravityview_get_link( $entries_url, __( 'Entries', 'gravityview' ) ) . '</span>'; |
|
377 | 377 | } |
378 | 378 | |
379 | - if( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
379 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
380 | 380 | $settings_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&view=settings&id=%d', $form_id ) ); |
381 | - $links[] = '<span>'.gravityview_get_link( $settings_url, __('Settings', 'gravityview'), 'title='.__('Edit settings for this form', 'gravityview') ).'</span>'; |
|
381 | + $links[ ] = '<span>' . gravityview_get_link( $settings_url, __( 'Settings', 'gravityview' ), 'title=' . __( 'Edit settings for this form', 'gravityview' ) ) . '</span>'; |
|
382 | 382 | } |
383 | 383 | |
384 | - if( GVCommon::has_cap( array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms") ) ) { |
|
384 | + if ( GVCommon::has_cap( array( "gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms" ) ) ) { |
|
385 | 385 | $preview_url = site_url( sprintf( '?gf_page=preview&id=%d', $form_id ) ); |
386 | - $links[] = '<span>'.gravityview_get_link( $preview_url, __('Preview Form', 'gravityview'), 'title='.__('Preview this form', 'gravityview') ).'</span>'; |
|
386 | + $links[ ] = '<span>' . gravityview_get_link( $preview_url, __( 'Preview Form', 'gravityview' ), 'title=' . __( 'Preview this form', 'gravityview' ) ) . '</span>'; |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | $output = ''; |
390 | 390 | |
391 | - if( !empty( $include_form_link ) ) { |
|
391 | + if ( ! empty( $include_form_link ) ) { |
|
392 | 392 | $output .= $form_link; |
393 | 393 | } |
394 | 394 | |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | */ |
401 | 401 | $links = apply_filters( 'gravityview_connected_form_links', $links, $form ); |
402 | 402 | |
403 | - $output .= '<div class="row-actions">'. implode( ' | ', $links ) .'</div>'; |
|
403 | + $output .= '<div class="row-actions">' . implode( ' | ', $links ) . '</div>'; |
|
404 | 404 | |
405 | 405 | return $output; |
406 | 406 | } |
@@ -414,8 +414,8 @@ discard block |
||
414 | 414 | // Get the date column and save it for later to add back in. |
415 | 415 | // This adds it after the Data Source column. |
416 | 416 | // This way, we don't need to do array_slice, array_merge, etc. |
417 | - $date = $columns['date']; |
|
418 | - unset( $columns['date'] ); |
|
417 | + $date = $columns[ 'date' ]; |
|
418 | + unset( $columns[ 'date' ] ); |
|
419 | 419 | |
420 | 420 | $data_source_required_caps = array( |
421 | 421 | 'gravityforms_edit_forms', |
@@ -426,14 +426,14 @@ discard block |
||
426 | 426 | 'gravityforms_preview_forms', |
427 | 427 | ); |
428 | 428 | |
429 | - if( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
430 | - $columns['gv_connected_form'] = __( 'Data Source', 'gravityview' ); |
|
429 | + if ( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
430 | + $columns[ 'gv_connected_form' ] = __( 'Data Source', 'gravityview' ); |
|
431 | 431 | } |
432 | 432 | |
433 | - $columns['gv_template'] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
433 | + $columns[ 'gv_template' ] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
434 | 434 | |
435 | 435 | // Add the date back in. |
436 | - $columns['date'] = $date; |
|
436 | + $columns[ 'date' ] = $date; |
|
437 | 437 | |
438 | 438 | return $columns; |
439 | 439 | } |
@@ -447,12 +447,12 @@ discard block |
||
447 | 447 | */ |
448 | 448 | function save_postdata( $post_id ) { |
449 | 449 | |
450 | - if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){ |
|
450 | + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
451 | 451 | return; |
452 | 452 | } |
453 | 453 | |
454 | 454 | // validate post_type |
455 | - if ( ! isset( $_POST['post_type'] ) || 'gravityview' != $_POST['post_type'] ) { |
|
455 | + if ( ! isset( $_POST[ 'post_type' ] ) || 'gravityview' != $_POST[ 'post_type' ] ) { |
|
456 | 456 | return; |
457 | 457 | } |
458 | 458 | |
@@ -467,63 +467,63 @@ discard block |
||
467 | 467 | $statii = array(); |
468 | 468 | |
469 | 469 | // check if this is a start fresh View |
470 | - if ( isset( $_POST['gravityview_select_form_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_form_nonce'], 'gravityview_select_form' ) ) { |
|
470 | + if ( isset( $_POST[ 'gravityview_select_form_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_form_nonce' ], 'gravityview_select_form' ) ) { |
|
471 | 471 | |
472 | - $form_id = !empty( $_POST['gravityview_form_id'] ) ? $_POST['gravityview_form_id'] : ''; |
|
472 | + $form_id = ! empty( $_POST[ 'gravityview_form_id' ] ) ? $_POST[ 'gravityview_form_id' ] : ''; |
|
473 | 473 | // save form id |
474 | - $statii['form_id'] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
474 | + $statii[ 'form_id' ] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
475 | 475 | |
476 | 476 | } |
477 | 477 | |
478 | - if( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii['form_id'] ) ) { |
|
478 | + if ( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii[ 'form_id' ] ) ) { |
|
479 | 479 | do_action( 'gravityview_log_error', __METHOD__ . ' - Current user does not have the capability to create a new Form.', wp_get_current_user() ); |
480 | 480 | return; |
481 | 481 | } |
482 | 482 | |
483 | 483 | // Was this a start fresh? |
484 | - if ( ! empty( $_POST['gravityview_form_id_start_fresh'] ) ) { |
|
485 | - $statii['start_fresh'] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
484 | + if ( ! empty( $_POST[ 'gravityview_form_id_start_fresh' ] ) ) { |
|
485 | + $statii[ 'start_fresh' ] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
486 | 486 | } else { |
487 | - $statii['start_fresh'] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
487 | + $statii[ 'start_fresh' ] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | // Check if we have a template id |
491 | - if ( isset( $_POST['gravityview_select_template_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_template_nonce'], 'gravityview_select_template' ) ) { |
|
491 | + if ( isset( $_POST[ 'gravityview_select_template_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_template_nonce' ], 'gravityview_select_template' ) ) { |
|
492 | 492 | |
493 | - $template_id = !empty( $_POST['gravityview_directory_template'] ) ? $_POST['gravityview_directory_template'] : ''; |
|
493 | + $template_id = ! empty( $_POST[ 'gravityview_directory_template' ] ) ? $_POST[ 'gravityview_directory_template' ] : ''; |
|
494 | 494 | |
495 | 495 | // now save template id |
496 | - $statii['directory_template'] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
496 | + $statii[ 'directory_template' ] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
497 | 497 | } |
498 | 498 | |
499 | 499 | |
500 | 500 | // save View Configuration metabox |
501 | - if ( isset( $_POST['gravityview_view_configuration_nonce'] ) && wp_verify_nonce( $_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration' ) ) { |
|
501 | + if ( isset( $_POST[ 'gravityview_view_configuration_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_view_configuration_nonce' ], 'gravityview_view_configuration' ) ) { |
|
502 | 502 | |
503 | 503 | // template settings |
504 | - if( empty( $_POST['template_settings'] ) ) { |
|
505 | - $_POST['template_settings'] = array(); |
|
504 | + if ( empty( $_POST[ 'template_settings' ] ) ) { |
|
505 | + $_POST[ 'template_settings' ] = array(); |
|
506 | 506 | } |
507 | - $statii['template_settings'] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST['template_settings'] ); |
|
507 | + $statii[ 'template_settings' ] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST[ 'template_settings' ] ); |
|
508 | 508 | |
509 | 509 | $fields = array(); |
510 | 510 | |
511 | 511 | // Directory&single Visible Fields |
512 | - if( !empty( $preset_fields ) ) { |
|
512 | + if ( ! empty( $preset_fields ) ) { |
|
513 | 513 | |
514 | 514 | $fields = $preset_fields; |
515 | 515 | |
516 | - } elseif( !empty( $_POST['gv_fields'] ) ) { |
|
516 | + } elseif ( ! empty( $_POST[ 'gv_fields' ] ) ) { |
|
517 | 517 | $fields = _gravityview_process_posted_fields(); |
518 | 518 | } |
519 | 519 | |
520 | - $statii['directory_fields'] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
520 | + $statii[ 'directory_fields' ] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
521 | 521 | |
522 | 522 | // Directory Visible Widgets |
523 | - if( empty( $_POST['widgets'] ) ) { |
|
524 | - $_POST['widgets'] = array(); |
|
523 | + if ( empty( $_POST[ 'widgets' ] ) ) { |
|
524 | + $_POST[ 'widgets' ] = array(); |
|
525 | 525 | } |
526 | - $statii['directory_widgets'] = gravityview_set_directory_widgets( $post_id, $_POST['widgets'] ); |
|
526 | + $statii[ 'directory_widgets' ] = gravityview_set_directory_widgets( $post_id, $_POST[ 'widgets' ] ); |
|
527 | 527 | |
528 | 528 | } // end save view configuration |
529 | 529 | |
@@ -533,9 +533,9 @@ discard block |
||
533 | 533 | * @param array $statii Array of statuses of the post meta saving processes. If saving worked, each key should be mapped to a value of the post ID (`directory_widgets` => `124`). If failed (or didn't change), the value will be false. |
534 | 534 | * @since 1.17.2 |
535 | 535 | */ |
536 | - do_action('gravityview_view_saved', $post_id, $statii ); |
|
536 | + do_action( 'gravityview_view_saved', $post_id, $statii ); |
|
537 | 537 | |
538 | - do_action('gravityview_log_debug', '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array_map( 'intval', $statii ) ); |
|
538 | + do_action( 'gravityview_log_debug', '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array_map( 'intval', $statii ) ); |
|
539 | 539 | } |
540 | 540 | |
541 | 541 | /** |
@@ -570,20 +570,20 @@ discard block |
||
570 | 570 | |
571 | 571 | $output = ''; |
572 | 572 | |
573 | - if( !empty( $fields ) ) { |
|
573 | + if ( ! empty( $fields ) ) { |
|
574 | 574 | |
575 | - foreach( $fields as $id => $details ) { |
|
575 | + foreach ( $fields as $id => $details ) { |
|
576 | 576 | |
577 | - if( in_array( $details['type'], $blacklist_field_types ) ) { |
|
577 | + if ( in_array( $details[ 'type' ], $blacklist_field_types ) ) { |
|
578 | 578 | continue; |
579 | 579 | } |
580 | 580 | |
581 | 581 | // Edit mode only allows editing the parent fields, not single inputs. |
582 | - if( $context === 'edit' && !empty( $details['parent'] ) ) { |
|
582 | + if ( $context === 'edit' && ! empty( $details[ 'parent' ] ) ) { |
|
583 | 583 | continue; |
584 | 584 | } |
585 | 585 | |
586 | - $output .= new GravityView_Admin_View_Field( $details['label'], $id, $details ); |
|
586 | + $output .= new GravityView_Admin_View_Field( $details[ 'label' ], $id, $details ); |
|
587 | 587 | |
588 | 588 | } // End foreach |
589 | 589 | } |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | echo $output; |
592 | 592 | |
593 | 593 | // For the EDIT view we only want to allow the form fields. |
594 | - if( $context === 'edit' ) { |
|
594 | + if ( $context === 'edit' ) { |
|
595 | 595 | return; |
596 | 596 | } |
597 | 597 | |
@@ -615,16 +615,16 @@ discard block |
||
615 | 615 | $additional_fields = apply_filters( 'gravityview_additional_fields', array( |
616 | 616 | array( |
617 | 617 | 'label_text' => __( '+ Add All Fields', 'gravityview' ), |
618 | - 'desc' => __('Add all the available fields at once.', 'gravityview'), |
|
618 | + 'desc' => __( 'Add all the available fields at once.', 'gravityview' ), |
|
619 | 619 | 'field_id' => 'all-fields', |
620 | 620 | 'label_type' => 'field', |
621 | 621 | 'input_type' => NULL, |
622 | 622 | 'field_options' => NULL, |
623 | 623 | 'settings_html' => NULL, |
624 | 624 | ) |
625 | - )); |
|
625 | + ) ); |
|
626 | 626 | |
627 | - if( !empty( $additional_fields )) { |
|
627 | + if ( ! empty( $additional_fields ) ) { |
|
628 | 628 | foreach ( (array)$additional_fields as $item ) { |
629 | 629 | |
630 | 630 | // Prevent items from not having index set |
@@ -635,16 +635,16 @@ discard block |
||
635 | 635 | 'input_type' => NULL, |
636 | 636 | 'field_options' => NULL, |
637 | 637 | 'settings_html' => NULL, |
638 | - )); |
|
638 | + ) ); |
|
639 | 639 | |
640 | 640 | // Backward compat. |
641 | - if( !empty( $item['field_options'] ) ) { |
|
641 | + if ( ! empty( $item[ 'field_options' ] ) ) { |
|
642 | 642 | // Use settings_html from now on. |
643 | - $item['settings_html'] = $item['field_options']; |
|
643 | + $item[ 'settings_html' ] = $item[ 'field_options' ]; |
|
644 | 644 | } |
645 | 645 | |
646 | 646 | // Render a label for each of them |
647 | - echo new GravityView_Admin_View_Field( $item['label_text'], $item['field_id'], $item ); |
|
647 | + echo new GravityView_Admin_View_Field( $item[ 'label_text' ], $item[ 'field_id' ], $item ); |
|
648 | 648 | |
649 | 649 | } |
650 | 650 | } |
@@ -657,63 +657,63 @@ discard block |
||
657 | 657 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
658 | 658 | * @return array |
659 | 659 | */ |
660 | - function get_entry_default_fields($form, $zone) { |
|
660 | + function get_entry_default_fields( $form, $zone ) { |
|
661 | 661 | |
662 | 662 | $entry_default_fields = array(); |
663 | 663 | |
664 | - if( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
664 | + if ( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
665 | 665 | |
666 | 666 | $entry_default_fields = array( |
667 | 667 | 'id' => array( |
668 | - 'label' => __('Entry ID', 'gravityview'), |
|
668 | + 'label' => __( 'Entry ID', 'gravityview' ), |
|
669 | 669 | 'type' => 'id', |
670 | - 'desc' => __('The unique ID of the entry.', 'gravityview'), |
|
670 | + 'desc' => __( 'The unique ID of the entry.', 'gravityview' ), |
|
671 | 671 | ), |
672 | 672 | 'date_created' => array( |
673 | - 'label' => __('Entry Date', 'gravityview'), |
|
674 | - 'desc' => __('The date the entry was created.', 'gravityview'), |
|
673 | + 'label' => __( 'Entry Date', 'gravityview' ), |
|
674 | + 'desc' => __( 'The date the entry was created.', 'gravityview' ), |
|
675 | 675 | 'type' => 'date_created', |
676 | 676 | ), |
677 | 677 | 'source_url' => array( |
678 | - 'label' => __('Source URL', 'gravityview'), |
|
678 | + 'label' => __( 'Source URL', 'gravityview' ), |
|
679 | 679 | 'type' => 'source_url', |
680 | - 'desc' => __('The URL of the page where the form was submitted.', 'gravityview'), |
|
680 | + 'desc' => __( 'The URL of the page where the form was submitted.', 'gravityview' ), |
|
681 | 681 | ), |
682 | 682 | 'ip' => array( |
683 | - 'label' => __('User IP', 'gravityview'), |
|
683 | + 'label' => __( 'User IP', 'gravityview' ), |
|
684 | 684 | 'type' => 'ip', |
685 | - 'desc' => __('The IP Address of the user who created the entry.', 'gravityview'), |
|
685 | + 'desc' => __( 'The IP Address of the user who created the entry.', 'gravityview' ), |
|
686 | 686 | ), |
687 | 687 | 'created_by' => array( |
688 | - 'label' => __('User', 'gravityview'), |
|
688 | + 'label' => __( 'User', 'gravityview' ), |
|
689 | 689 | 'type' => 'created_by', |
690 | - 'desc' => __('Details of the logged-in user who created the entry (if any).', 'gravityview'), |
|
690 | + 'desc' => __( 'Details of the logged-in user who created the entry (if any).', 'gravityview' ), |
|
691 | 691 | ), |
692 | 692 | |
693 | 693 | /** |
694 | 694 | * @since 1.2 |
695 | 695 | */ |
696 | 696 | 'custom' => array( |
697 | - 'label' => __('Custom Content', 'gravityview'), |
|
697 | + 'label' => __( 'Custom Content', 'gravityview' ), |
|
698 | 698 | 'type' => 'custom', |
699 | - 'desc' => __('Insert custom text or HTML.', 'gravityview'), |
|
699 | + 'desc' => __( 'Insert custom text or HTML.', 'gravityview' ), |
|
700 | 700 | ), |
701 | 701 | |
702 | 702 | /** |
703 | 703 | * @since 1.7.2 |
704 | 704 | */ |
705 | 705 | 'other_entries' => array( |
706 | - 'label' => __('Other Entries', 'gravityview'), |
|
706 | + 'label' => __( 'Other Entries', 'gravityview' ), |
|
707 | 707 | 'type' => 'other_entries', |
708 | - 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
708 | + 'desc' => __( 'Display other entries created by the entry creator.', 'gravityview' ), |
|
709 | 709 | ), |
710 | 710 | ); |
711 | 711 | |
712 | - if( 'single' !== $zone) { |
|
712 | + if ( 'single' !== $zone ) { |
|
713 | 713 | |
714 | - $entry_default_fields['entry_link'] = array( |
|
715 | - 'label' => __('Link to Entry', 'gravityview'), |
|
716 | - 'desc' => __('A dedicated link to the single entry with customizable text.', 'gravityview'), |
|
714 | + $entry_default_fields[ 'entry_link' ] = array( |
|
715 | + 'label' => __( 'Link to Entry', 'gravityview' ), |
|
716 | + 'desc' => __( 'A dedicated link to the single entry with customizable text.', 'gravityview' ), |
|
717 | 717 | 'type' => 'entry_link', |
718 | 718 | ); |
719 | 719 | } |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | * @param string|array $form form_ID or form object |
728 | 728 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
729 | 729 | */ |
730 | - return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone); |
|
730 | + return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone ); |
|
731 | 731 | } |
732 | 732 | |
733 | 733 | /** |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | */ |
739 | 739 | function get_available_fields( $form = '', $zone = NULL ) { |
740 | 740 | |
741 | - if( empty( $form ) ) { |
|
741 | + if ( empty( $form ) ) { |
|
742 | 742 | do_action( 'gravityview_log_error', '[get_available_fields] $form is empty' ); |
743 | 743 | return array(); |
744 | 744 | } |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | $fields = gravityview_get_form_fields( $form, true ); |
748 | 748 | |
749 | 749 | // get meta fields ( only if form was already created ) |
750 | - if( !is_array( $form ) ) { |
|
750 | + if ( ! is_array( $form ) ) { |
|
751 | 751 | $meta_fields = gravityview_get_entry_meta( $form ); |
752 | 752 | } else { |
753 | 753 | $meta_fields = array(); |
@@ -771,11 +771,11 @@ discard block |
||
771 | 771 | |
772 | 772 | $widgets = $this->get_registered_widgets(); |
773 | 773 | |
774 | - if( !empty( $widgets ) ) { |
|
774 | + if ( ! empty( $widgets ) ) { |
|
775 | 775 | |
776 | - foreach( $widgets as $id => $details ) { |
|
776 | + foreach ( $widgets as $id => $details ) { |
|
777 | 777 | |
778 | - echo new GravityView_Admin_View_Widget( $details['label'], $id, $details ); |
|
778 | + echo new GravityView_Admin_View_Widget( $details[ 'label' ], $id, $details ); |
|
779 | 779 | |
780 | 780 | } |
781 | 781 | } |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | function render_active_areas( $template_id, $type, $zone, $rows, $values ) { |
810 | 810 | global $post; |
811 | 811 | |
812 | - if( $type === 'widget' ) { |
|
812 | + if ( $type === 'widget' ) { |
|
813 | 813 | $button_label = __( 'Add Widget', 'gravityview' ); |
814 | 814 | } else { |
815 | 815 | $button_label = __( 'Add Field', 'gravityview' ); |
@@ -818,15 +818,15 @@ discard block |
||
818 | 818 | $available_items = array(); |
819 | 819 | |
820 | 820 | // if saved values, get available fields to label everyone |
821 | - if( !empty( $values ) && ( !empty( $post->ID ) || !empty( $_POST['template_id'] ) ) ) { |
|
821 | + if ( ! empty( $values ) && ( ! empty( $post->ID ) || ! empty( $_POST[ 'template_id' ] ) ) ) { |
|
822 | 822 | |
823 | - if( !empty( $_POST['template_id'] ) ) { |
|
824 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
823 | + if ( ! empty( $_POST[ 'template_id' ] ) ) { |
|
824 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
825 | 825 | } else { |
826 | 826 | $form = gravityview_get_form_id( $post->ID ); |
827 | 827 | } |
828 | 828 | |
829 | - if( 'field' === $type ) { |
|
829 | + if ( 'field' === $type ) { |
|
830 | 830 | $available_items = $this->get_available_fields( $form, $zone ); |
831 | 831 | } else { |
832 | 832 | $available_items = $this->get_registered_widgets(); |
@@ -834,39 +834,39 @@ discard block |
||
834 | 834 | |
835 | 835 | } |
836 | 836 | |
837 | - foreach( $rows as $row ) : |
|
838 | - foreach( $row as $col => $areas ) : |
|
839 | - $column = ($col == '2-2') ? '1-2' : $col; ?> |
|
837 | + foreach ( $rows as $row ) : |
|
838 | + foreach ( $row as $col => $areas ) : |
|
839 | + $column = ( $col == '2-2' ) ? '1-2' : $col; ?> |
|
840 | 840 | |
841 | 841 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
842 | 842 | |
843 | - <?php foreach( $areas as $area ) : ?> |
|
843 | + <?php foreach ( $areas as $area ) : ?> |
|
844 | 844 | |
845 | 845 | <div class="gv-droppable-area"> |
846 | - <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>"> |
|
846 | + <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>"> |
|
847 | 847 | |
848 | 848 | <?php // render saved fields |
849 | 849 | |
850 | - if( !empty( $values[ $zone .'_'. $area['areaid'] ] ) ) { |
|
850 | + if ( ! empty( $values[ $zone . '_' . $area[ 'areaid' ] ] ) ) { |
|
851 | 851 | |
852 | - foreach( $values[ $zone .'_'. $area['areaid'] ] as $uniqid => $field ) { |
|
852 | + foreach ( $values[ $zone . '_' . $area[ 'areaid' ] ] as $uniqid => $field ) { |
|
853 | 853 | |
854 | 854 | $input_type = NULL; |
855 | - $original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ; |
|
855 | + $original_item = isset( $available_items[ $field[ 'id' ] ] ) ? $available_items[ $field[ 'id' ] ] : false; |
|
856 | 856 | |
857 | - if( !$original_item ) { |
|
857 | + if ( ! $original_item ) { |
|
858 | 858 | |
859 | - 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 )); |
|
859 | + 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 ) ); |
|
860 | 860 | |
861 | 861 | $original_item = $field; |
862 | 862 | } else { |
863 | 863 | |
864 | - $input_type = isset( $original_item['type'] ) ? $original_item['type'] : NULL; |
|
864 | + $input_type = isset( $original_item[ 'type' ] ) ? $original_item[ 'type' ] : NULL; |
|
865 | 865 | |
866 | 866 | } |
867 | 867 | |
868 | 868 | // Field options dialog box |
869 | - $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 ); |
|
869 | + $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 ); |
|
870 | 870 | |
871 | 871 | $item = array( |
872 | 872 | 'input_type' => $input_type, |
@@ -875,16 +875,16 @@ discard block |
||
875 | 875 | ); |
876 | 876 | |
877 | 877 | // Merge the values with the current item to pass things like widget descriptions and original field names |
878 | - if( $original_item ) { |
|
878 | + if ( $original_item ) { |
|
879 | 879 | $item = wp_parse_args( $item, $original_item ); |
880 | 880 | } |
881 | 881 | |
882 | - switch( $type ) { |
|
882 | + switch ( $type ) { |
|
883 | 883 | case 'widget': |
884 | - echo new GravityView_Admin_View_Widget( $item['label'], $field['id'], $item, $field ); |
|
884 | + echo new GravityView_Admin_View_Widget( $item[ 'label' ], $field[ 'id' ], $item, $field ); |
|
885 | 885 | break; |
886 | 886 | default: |
887 | - echo new GravityView_Admin_View_Field( $item['label'], $field['id'], $item, $field ); |
|
887 | + echo new GravityView_Admin_View_Field( $item[ 'label' ], $field[ 'id' ], $item, $field ); |
|
888 | 888 | } |
889 | 889 | |
890 | 890 | |
@@ -894,11 +894,11 @@ discard block |
||
894 | 894 | |
895 | 895 | } // End if zone is not empty ?> |
896 | 896 | |
897 | - <span class="drop-message"><?php echo sprintf(esc_attr__('"+ %s" or drag existing %ss here.', 'gravityview'), $button_label, $type ); ?></span> |
|
897 | + <span class="drop-message"><?php echo sprintf( esc_attr__( '"+ %s" or drag existing %ss here.', 'gravityview' ), $button_label, $type ); ?></span> |
|
898 | 898 | </div> |
899 | 899 | <div class="gv-droppable-area-action"> |
900 | - <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> |
|
901 | - <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> |
|
900 | + <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> |
|
901 | + <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> |
|
902 | 902 | </div> |
903 | 903 | </div> |
904 | 904 | |
@@ -920,7 +920,7 @@ discard block |
||
920 | 920 | $default_widget_areas = GravityView_Plugin::get_default_widget_areas(); |
921 | 921 | |
922 | 922 | $widgets = array(); |
923 | - if( !empty( $post_id ) ) { |
|
923 | + if ( ! empty( $post_id ) ) { |
|
924 | 924 | $widgets = gravityview_get_directory_widgets( $post_id ); |
925 | 925 | } |
926 | 926 | |
@@ -950,7 +950,7 @@ discard block |
||
950 | 950 | */ |
951 | 951 | function render_directory_active_areas( $template_id = '', $context = 'single', $post_id = '', $echo = false ) { |
952 | 952 | |
953 | - if( empty( $template_id ) ) { |
|
953 | + if ( empty( $template_id ) ) { |
|
954 | 954 | do_action( 'gravityview_log_debug', '[render_directory_active_areas] $template_id is empty' ); |
955 | 955 | return ''; |
956 | 956 | } |
@@ -964,12 +964,12 @@ discard block |
||
964 | 964 | */ |
965 | 965 | $template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context ); |
966 | 966 | |
967 | - if( empty( $template_areas ) ) { |
|
967 | + if ( empty( $template_areas ) ) { |
|
968 | 968 | |
969 | 969 | do_action( 'gravityview_log_debug', '[render_directory_active_areas] No areas defined. Maybe template %s is disabled.', $template_id ); |
970 | 970 | $output = '<div>'; |
971 | - $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>'; |
|
972 | - $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>'; |
|
971 | + $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>'; |
|
972 | + $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>'; |
|
973 | 973 | $output .= '</div>'; |
974 | 974 | } else { |
975 | 975 | |
@@ -984,7 +984,7 @@ discard block |
||
984 | 984 | |
985 | 985 | } |
986 | 986 | |
987 | - if( $echo ) { |
|
987 | + if ( $echo ) { |
|
988 | 988 | echo $output; |
989 | 989 | } |
990 | 990 | |
@@ -1004,27 +1004,27 @@ discard block |
||
1004 | 1004 | $is_widgets_page = ( $pagenow === 'widgets.php' ); |
1005 | 1005 | |
1006 | 1006 | // Add the GV font (with the Astronaut) |
1007 | - wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
1007 | + wp_enqueue_style( 'gravityview_global', plugins_url( 'assets/css/admin-global.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
1008 | 1008 | |
1009 | - wp_register_script( 'gravityview-jquery-cookie', plugins_url('assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version, true ); |
|
1009 | + wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
|
1010 | 1010 | |
1011 | 1011 | // Don't process any scripts below here if it's not a GravityView page. |
1012 | - if( !gravityview_is_admin_page($hook) && !$is_widgets_page ) { return; } |
|
1012 | + if ( ! gravityview_is_admin_page( $hook ) && ! $is_widgets_page ) { return; } |
|
1013 | 1013 | |
1014 | 1014 | // Only enqueue the following on single pages |
1015 | - if( gravityview_is_admin_page($hook, 'single') || $is_widgets_page ) { |
|
1015 | + if ( gravityview_is_admin_page( $hook, 'single' ) || $is_widgets_page ) { |
|
1016 | 1016 | |
1017 | 1017 | wp_enqueue_script( 'jquery-ui-datepicker' ); |
1018 | - wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), GravityView_Plugin::version ); |
|
1018 | + wp_enqueue_style( 'gravityview_views_datepicker', plugins_url( 'assets/css/admin-datepicker.css', GRAVITYVIEW_FILE ), GravityView_Plugin::version ); |
|
1019 | 1019 | |
1020 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
1020 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
1021 | 1021 | |
1022 | 1022 | //enqueue scripts |
1023 | 1023 | 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 ); |
1024 | 1024 | |
1025 | - wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
1025 | + wp_localize_script( 'gravityview_views_scripts', 'gvGlobals', array( |
|
1026 | 1026 | 'cookiepath' => COOKIEPATH, |
1027 | - 'passed_form_id' => (bool) rgget( 'form_id' ), |
|
1027 | + 'passed_form_id' => (bool)rgget( 'form_id' ), |
|
1028 | 1028 | 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
1029 | 1029 | 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
1030 | 1030 | 'label_close' => __( 'Close', 'gravityview' ), |
@@ -1036,9 +1036,9 @@ discard block |
||
1036 | 1036 | 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
1037 | 1037 | 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
1038 | 1038 | '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' ), |
1039 | - )); |
|
1039 | + ) ); |
|
1040 | 1040 | |
1041 | - wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array('dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
1041 | + wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
1042 | 1042 | |
1043 | 1043 | self::enqueue_gravity_forms_scripts(); |
1044 | 1044 | |
@@ -1057,10 +1057,10 @@ discard block |
||
1057 | 1057 | ); |
1058 | 1058 | |
1059 | 1059 | if ( wp_is_mobile() ) { |
1060 | - $scripts[] = 'jquery-touch-punch'; |
|
1060 | + $scripts[ ] = 'jquery-touch-punch'; |
|
1061 | 1061 | } |
1062 | 1062 | |
1063 | - foreach ($scripts as $script) { |
|
1063 | + foreach ( $scripts as $script ) { |
|
1064 | 1064 | wp_enqueue_script( $script ); |
1065 | 1065 | } |
1066 | 1066 | } |
@@ -4,10 +4,10 @@ discard block |
||
4 | 4 | |
5 | 5 | function __construct() { |
6 | 6 | |
7 | - if( ! is_admin() ) { return; } |
|
7 | + if ( ! is_admin() ) { return; } |
|
8 | 8 | |
9 | 9 | // If Gravity Forms isn't active or compatibile, stop loading |
10 | - if( false === GravityView_Compatibility::is_valid() ) { |
|
10 | + if ( false === GravityView_Compatibility::is_valid() ) { |
|
11 | 11 | return; |
12 | 12 | } |
13 | 13 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-migrate.php' ); |
26 | 26 | |
27 | 27 | // Don't load tooltips if on Gravity Forms, otherwise it overrides translations |
28 | - if( class_exists( 'GFCommon' ) && class_exists( 'GFForms' ) && !GFForms::is_gravity_page() ) { |
|
28 | + if ( class_exists( 'GFCommon' ) && class_exists( 'GFForms' ) && ! GFForms::is_gravity_page() ) { |
|
29 | 29 | require_once( GFCommon::get_base_path() . '/tooltips.php' ); |
30 | 30 | } |
31 | 31 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) ); |
54 | 54 | add_filter( 'bulk_post_updated_messages', array( $this, 'post_updated_messages' ) ); |
55 | 55 | |
56 | - add_filter( 'plugin_action_links_'. plugin_basename( GRAVITYVIEW_FILE ) , array( $this, 'plugin_action_links' ) ); |
|
56 | + add_filter( 'plugin_action_links_' . plugin_basename( GRAVITYVIEW_FILE ), array( $this, 'plugin_action_links' ) ); |
|
57 | 57 | |
58 | 58 | add_action( 'plugins_loaded', array( $this, 'backend_actions' ), 100 ); |
59 | 59 | |
@@ -68,22 +68,22 @@ discard block |
||
68 | 68 | public function backend_actions() { |
69 | 69 | |
70 | 70 | /** @define "GRAVITYVIEW_DIR" "../" */ |
71 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.field.type.php' ); |
|
72 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.render.settings.php' ); |
|
73 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-item.php' ); |
|
74 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-field.php' ); |
|
75 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-widget.php' ); |
|
76 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-views.php' ); |
|
77 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-welcome.php' ); |
|
78 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-add-shortcode.php' ); |
|
79 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' ); |
|
71 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.field.type.php' ); |
|
72 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.render.settings.php' ); |
|
73 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-item.php' ); |
|
74 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-field.php' ); |
|
75 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-widget.php' ); |
|
76 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-views.php' ); |
|
77 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-welcome.php' ); |
|
78 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-add-shortcode.php' ); |
|
79 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' ); |
|
80 | 80 | |
81 | 81 | /** |
82 | 82 | * @action `gravityview_include_backend_actions` Triggered after all GravityView admin files are loaded |
83 | 83 | * |
84 | 84 | * Nice place to insert extensions' backend stuff |
85 | 85 | */ |
86 | - do_action('gravityview_include_backend_actions'); |
|
86 | + do_action( 'gravityview_include_backend_actions' ); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -99,12 +99,12 @@ discard block |
||
99 | 99 | |
100 | 100 | $actions = array(); |
101 | 101 | |
102 | - if( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
103 | - $actions[] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
102 | + if ( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
103 | + $actions[ ] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
104 | 104 | } |
105 | 105 | |
106 | - if( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
107 | - $actions[] = '<a href="http://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
106 | + if ( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
107 | + $actions[ ] = '<a href="http://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | return array_merge( $actions, $links ); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | // By default, there will only be one item being modified. |
133 | 133 | // When in the `bulk_post_updated_messages` filter, there will be passed a number |
134 | 134 | // of modified items that will override this array. |
135 | - $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1 , 'locked' => 1 , 'deleted' => 1 , 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
135 | + $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1, 'locked' => 1, 'deleted' => 1, 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
136 | 136 | |
137 | 137 | // If we're starting fresh, a new form was created. |
138 | 138 | // We should let the user know this is the case. |
@@ -140,60 +140,60 @@ discard block |
||
140 | 140 | |
141 | 141 | $new_form_text = ''; |
142 | 142 | |
143 | - if( !empty( $start_fresh ) ) { |
|
143 | + if ( ! empty( $start_fresh ) ) { |
|
144 | 144 | |
145 | 145 | // Get the form that was created |
146 | 146 | $connected_form = gravityview_get_form_id( $post_id ); |
147 | 147 | |
148 | - if( !empty( $connected_form ) ) { |
|
148 | + if ( ! empty( $connected_form ) ) { |
|
149 | 149 | $form = gravityview_get_form( $connected_form ); |
150 | - $form_name = esc_attr( $form['title'] ); |
|
150 | + $form_name = esc_attr( $form[ 'title' ] ); |
|
151 | 151 | $image = self::get_floaty(); |
152 | - $new_form_text .= '<h3>'.$image.sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ).'</h3>'; |
|
153 | - $new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s |
|
152 | + $new_form_text .= '<h3>' . $image . sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ) . '</h3>'; |
|
153 | + $new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s |
|
154 | 154 | |
155 | 155 | You can %sedit the form%s in Gravity Forms and the updated fields will be available here. Don’t forget to %scustomize the form settings%s. |
156 | - ', 'gravityview' ), '<strong>', '</strong>', '<a href="'.site_url( '?gf_page=preview&id='.$connected_form ).'">', '</a>', '<code>[gravityform id="'.$connected_form.'" name="'.$form_name.'"]</code>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&id='.$connected_form ).'">', '</a>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&view=settings&id='.$connected_form ).'">', '</a>'); |
|
156 | + ', 'gravityview' ), '<strong>', '</strong>', '<a href="' . site_url( '?gf_page=preview&id=' . $connected_form ) . '">', '</a>', '<code>[gravityform id="' . $connected_form . '" name="' . $form_name . '"]</code>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&id=' . $connected_form ) . '">', '</a>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&view=settings&id=' . $connected_form ) . '">', '</a>' ); |
|
157 | 157 | $new_form_text = wpautop( $new_form_text ); |
158 | 158 | |
159 | 159 | delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
163 | - $messages['gravityview'] = array( |
|
163 | + $messages[ 'gravityview' ] = array( |
|
164 | 164 | 0 => '', // Unused. Messages start at index 1. |
165 | 165 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
166 | - 1 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
166 | + 1 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
167 | 167 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
168 | - 2 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
168 | + 2 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
169 | 169 | 3 => __( 'View deleted.', 'gravityview' ), |
170 | 170 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
171 | - 4 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
171 | + 4 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
172 | 172 | /* translators: %s: date and time of the revision */ |
173 | - 5 => isset( $_GET['revision'] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
173 | + 5 => isset( $_GET[ 'revision' ] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int)$_GET[ 'revision' ], false ) ) : false, |
|
174 | 174 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
175 | - 6 => sprintf(__( 'View published. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
175 | + 6 => sprintf( __( 'View published. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
176 | 176 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
177 | - 7 => sprintf(__( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
177 | + 7 => sprintf( __( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
178 | 178 | 8 => __( 'View submitted.', 'gravityview' ), |
179 | 179 | 9 => sprintf( |
180 | 180 | /* translators: Date and time the View is scheduled to be published */ |
181 | 181 | __( 'View scheduled for: %1$s.', 'gravityview' ), |
182 | 182 | // translators: Publish box date format, see http://php.net/date |
183 | - date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
183 | + date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
184 | 184 | ) . $new_form_text, |
185 | 185 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
186 | - 10 => sprintf(__( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
186 | + 10 => sprintf( __( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
187 | 187 | |
188 | 188 | /** |
189 | 189 | * These apply to `bulk_post_updated_messages` |
190 | 190 | * @file wp-admin/edit.php |
191 | 191 | */ |
192 | - 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts['updated'], 'gravityview' ), |
|
193 | - 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts['locked'], 'gravityview' ), |
|
194 | - 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts['deleted'], 'gravityview' ), |
|
195 | - 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts['trashed'], 'gravityview' ), |
|
196 | - 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts['untrashed'], 'gravityview' ), |
|
192 | + 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts[ 'updated' ], 'gravityview' ), |
|
193 | + 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts[ 'locked' ], 'gravityview' ), |
|
194 | + 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts[ 'deleted' ], 'gravityview' ), |
|
195 | + 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts[ 'trashed' ], 'gravityview' ), |
|
196 | + 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts[ 'untrashed' ], 'gravityview' ), |
|
197 | 197 | ); |
198 | 198 | |
199 | 199 | return $messages; |
@@ -253,29 +253,29 @@ discard block |
||
253 | 253 | static function is_admin_page( $hook = '', $page = NULL ) { |
254 | 254 | global $current_screen, $plugin_page, $pagenow, $post; |
255 | 255 | |
256 | - if( ! is_admin() ) { return false; } |
|
256 | + if ( ! is_admin() ) { return false; } |
|
257 | 257 | |
258 | 258 | $is_page = false; |
259 | 259 | |
260 | - $is_gv_screen = (!empty($current_screen) && isset($current_screen->post_type) && $current_screen->post_type === 'gravityview'); |
|
260 | + $is_gv_screen = ( ! empty( $current_screen ) && isset( $current_screen->post_type ) && $current_screen->post_type === 'gravityview' ); |
|
261 | 261 | |
262 | - $is_gv_post_type_get = (isset($_GET['post_type']) && $_GET['post_type'] === 'gravityview'); |
|
262 | + $is_gv_post_type_get = ( isset( $_GET[ 'post_type' ] ) && $_GET[ 'post_type' ] === 'gravityview' ); |
|
263 | 263 | |
264 | - $is_gv_settings_get = isset( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings'; |
|
264 | + $is_gv_settings_get = isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'gravityview_settings'; |
|
265 | 265 | |
266 | - if( empty( $post ) && $pagenow === 'post.php' && !empty( $_GET['post'] ) ) { |
|
267 | - $gv_post = get_post( intval( $_GET['post'] ) ); |
|
268 | - $is_gv_post_type = (!empty($gv_post) && !empty($gv_post->post_type) && $gv_post->post_type === 'gravityview'); |
|
266 | + if ( empty( $post ) && $pagenow === 'post.php' && ! empty( $_GET[ 'post' ] ) ) { |
|
267 | + $gv_post = get_post( intval( $_GET[ 'post' ] ) ); |
|
268 | + $is_gv_post_type = ( ! empty( $gv_post ) && ! empty( $gv_post->post_type ) && $gv_post->post_type === 'gravityview' ); |
|
269 | 269 | } else { |
270 | - $is_gv_post_type = (!empty($post) && !empty($post->post_type) && $post->post_type === 'gravityview'); |
|
270 | + $is_gv_post_type = ( ! empty( $post ) && ! empty( $post->post_type ) && $post->post_type === 'gravityview' ); |
|
271 | 271 | } |
272 | 272 | |
273 | - if( $is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get ) { |
|
273 | + if ( $is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get ) { |
|
274 | 274 | |
275 | 275 | // $_GET `post_type` variable |
276 | - if(in_array($pagenow, array( 'post.php' , 'post-new.php' )) ) { |
|
276 | + if ( in_array( $pagenow, array( 'post.php', 'post-new.php' ) ) ) { |
|
277 | 277 | $is_page = 'single'; |
278 | - } else if ( in_array( $plugin_page, array( 'gravityview_settings', 'gravityview_page_gravityview_settings' ) ) || ( !empty( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings' ) ) { |
|
278 | + } else if ( in_array( $plugin_page, array( 'gravityview_settings', 'gravityview_page_gravityview_settings' ) ) || ( ! empty( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'gravityview_settings' ) ) { |
|
279 | 279 | $is_page = 'settings'; |
280 | 280 | } else { |
281 | 281 | $is_page = 'views'; |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | $is_page = apply_filters( 'gravityview_is_admin_page', $is_page, $hook ); |
291 | 291 | |
292 | 292 | // If the current page is the same as the compared page |
293 | - if( !empty( $page ) ) { |
|
293 | + if ( ! empty( $page ) ) { |
|
294 | 294 | return $is_page === $page; |
295 | 295 | } |
296 | 296 | |
@@ -311,6 +311,6 @@ discard block |
||
311 | 311 | * |
312 | 312 | * @return bool|string|void If `false`, not a GravityView page. `true` if $page is passed and is the same as current page. Otherwise, the name of the page (`single`, `settings`, or `views`) |
313 | 313 | */ |
314 | -function gravityview_is_admin_page($hook = '', $page = NULL) { |
|
314 | +function gravityview_is_admin_page( $hook = '', $page = NULL ) { |
|
315 | 315 | return GravityView_Admin::is_admin_page( $hook, $page ); |
316 | 316 | } |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | * |
266 | 266 | * @uses GravityView_frontend::get_search_criteria() Convert the $_POST search request into a properly formatted request. |
267 | 267 | * @access public |
268 | - * @return void|boolean |
|
268 | + * @return false|null |
|
269 | 269 | */ |
270 | 270 | public function process_bulk_action() { |
271 | 271 | |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | * @since 1.18 Moved to GravityView_Entry_Approval::get_approved_column |
363 | 363 | * @see GravityView_Entry_Approval::get_approved_column |
364 | 364 | * |
365 | - * @param mixed $form GF Form or Form ID |
|
365 | + * @param integer $form GF Form or Form ID |
|
366 | 366 | * @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. |
367 | 367 | */ |
368 | 368 | static public function get_approved_column( $form ) { |
@@ -346,14 +346,14 @@ discard block |
||
346 | 346 | /** |
347 | 347 | * update_approved function. |
348 | 348 | * |
349 | - * @since 1.18 Moved to GravityView_Entry_Approval::update_approved |
|
349 | + * @since 1.18 Moved to GravityView_Entry_Approval::update_approved |
|
350 | 350 | * @see GravityView_Entry_Approval::update_approved |
351 | - * |
|
351 | + * |
|
352 | 352 | * @param int $entry_id (default: 0) |
353 | 353 | * @param int $approved (default: 0) |
354 | 354 | * @param int $form_id (default: 0) |
355 | 355 | * @param int $approvedcolumn (default: 0) |
356 | - * |
|
356 | + * |
|
357 | 357 | * @return boolean True: It worked; False: it failed |
358 | 358 | */ |
359 | 359 | public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) { |
@@ -363,9 +363,9 @@ discard block |
||
363 | 363 | /** |
364 | 364 | * Calculate the approve field.input id |
365 | 365 | * |
366 | - * @since 1.18 Moved to GravityView_Entry_Approval::get_approved_column |
|
367 | - * @see GravityView_Entry_Approval::get_approved_column |
|
368 | - * |
|
366 | + * @since 1.18 Moved to GravityView_Entry_Approval::get_approved_column |
|
367 | + * @see GravityView_Entry_Approval::get_approved_column |
|
368 | + * |
|
369 | 369 | * @param mixed $form GF Form or Form ID |
370 | 370 | * @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. |
371 | 371 | */ |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | 'bulk_actions' => $this->get_bulk_actions( $form_id ), |
488 | 488 | 'bulk_message' => $this->bulk_update_message, |
489 | 489 | 'unapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('unapproved'), |
490 | - 'approve_title' => GravityView_Entry_Approval_Status::get_title_attr('disapproved'), |
|
490 | + 'approve_title' => GravityView_Entry_Approval_Status::get_title_attr('disapproved'), |
|
491 | 491 | 'disapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('approved'), |
492 | 492 | 'column_title' => __( 'Show entry in directory view?', 'gravityview'), |
493 | 493 | 'column_link' => esc_url( $this->get_sort_link( $form_id ) ), |
@@ -496,11 +496,11 @@ discard block |
||
496 | 496 | } |
497 | 497 | |
498 | 498 | /** |
499 | - * Generate a link to sort by approval status (if there is an Approve/Disapprove field) |
|
500 | - * |
|
501 | - * Note: Sorting by approval will never be great because it's not possible currently to declare the sorting as |
|
502 | - * numeric, but it does group the approved entries together. |
|
503 | - * |
|
499 | + * Generate a link to sort by approval status (if there is an Approve/Disapprove field) |
|
500 | + * |
|
501 | + * Note: Sorting by approval will never be great because it's not possible currently to declare the sorting as |
|
502 | + * numeric, but it does group the approved entries together. |
|
503 | + * |
|
504 | 504 | * @param int $form_id |
505 | 505 | * |
506 | 506 | * @return string Sorting link |
@@ -510,20 +510,20 @@ discard block |
||
510 | 510 | $approved_column_id = self::get_approved_column( $form_id ); |
511 | 511 | |
512 | 512 | if( ! $approved_column_id ) { |
513 | - return ''; |
|
514 | - } |
|
513 | + return ''; |
|
514 | + } |
|
515 | 515 | |
516 | - $order = ( 'desc' === rgget('order') ) ? 'asc' : 'desc'; |
|
516 | + $order = ( 'desc' === rgget('order') ) ? 'asc' : 'desc'; |
|
517 | 517 | |
518 | - $args = array( |
|
519 | - 'orderby' => $approved_column_id, |
|
520 | - 'order' => $order, |
|
521 | - ); |
|
518 | + $args = array( |
|
519 | + 'orderby' => $approved_column_id, |
|
520 | + 'order' => $order, |
|
521 | + ); |
|
522 | 522 | |
523 | - $link = add_query_arg( $args ); |
|
523 | + $link = add_query_arg( $args ); |
|
524 | 524 | |
525 | 525 | return $link; |
526 | - } |
|
526 | + } |
|
527 | 527 | |
528 | 528 | /** |
529 | 529 | * Get an array of options to be added to the Gravity Forms "Bulk action" dropdown in a "GravityView" option group |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | /** gf_entries page - entries table screen */ |
45 | 45 | |
46 | 46 | // capture bulk actions |
47 | - add_action( 'gform_loaded', array( $this, 'process_bulk_action') ); |
|
47 | + add_action( 'gform_loaded', array( $this, 'process_bulk_action' ) ); |
|
48 | 48 | |
49 | 49 | // add hidden field with approve status |
50 | 50 | add_action( 'gform_entries_first_column_actions', array( $this, 'add_entry_approved_hidden_input' ), 1, 5 ); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | add_filter( 'gravityview_tooltips', array( $this, 'tooltips' ) ); |
53 | 53 | |
54 | 54 | // adding styles and scripts |
55 | - add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') ); |
|
55 | + add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) ); |
|
56 | 56 | // bypass Gravity Forms no-conflict mode |
57 | 57 | add_filter( 'gform_noconflict_scripts', array( $this, 'register_gform_noconflict_script' ) ); |
58 | 58 | add_filter( 'gform_noconflict_styles', array( $this, 'register_gform_noconflict_style' ) ); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * @param bool $show_filter_links True: show the "approved"/"disapproved" filter links. False: hide them. |
82 | 82 | * @param array $form GF Form object of current form |
83 | 83 | */ |
84 | - if( false === apply_filters( 'gravityview/approve_entries/show_filter_links_entry_list', true, $form ) ) { |
|
84 | + if ( false === apply_filters( 'gravityview/approve_entries/show_filter_links_entry_list', true, $form ) ) { |
|
85 | 85 | return $filter_links; |
86 | 86 | } |
87 | 87 | |
@@ -102,19 +102,19 @@ discard block |
||
102 | 102 | $approved_count = $disapproved_count = 0; |
103 | 103 | |
104 | 104 | // Only count if necessary |
105 | - if( $include_counts ) { |
|
106 | - $approved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_approved ) ) ); |
|
107 | - $disapproved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_disapproved ) ) ); |
|
105 | + if ( $include_counts ) { |
|
106 | + $approved_count = count( gravityview_get_entry_ids( $form[ 'id' ], array( 'status' => 'active', 'field_filters' => $field_filters_approved ) ) ); |
|
107 | + $disapproved_count = count( gravityview_get_entry_ids( $form[ 'id' ], array( 'status' => 'active', 'field_filters' => $field_filters_disapproved ) ) ); |
|
108 | 108 | } |
109 | 109 | |
110 | - $filter_links[] = array( |
|
110 | + $filter_links[ ] = array( |
|
111 | 111 | 'id' => 'gv_approved', |
112 | 112 | 'field_filters' => $field_filters_approved, |
113 | 113 | 'count' => $approved_count, |
114 | 114 | 'label' => GravityView_Entry_Approval_Status::get_label( GravityView_Entry_Approval_Status::APPROVED ), |
115 | 115 | ); |
116 | 116 | |
117 | - $filter_links[] = array( |
|
117 | + $filter_links[ ] = array( |
|
118 | 118 | 'id' => 'gv_disapproved', |
119 | 119 | 'field_filters' => $field_filters_disapproved, |
120 | 120 | 'count' => $disapproved_count, |
@@ -133,9 +133,9 @@ discard block |
||
133 | 133 | */ |
134 | 134 | function tooltips( $tooltips ) { |
135 | 135 | |
136 | - $tooltips['form_gravityview_fields'] = array( |
|
137 | - 'title' => __('GravityView Fields', 'gravityview'), |
|
138 | - 'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview'), |
|
136 | + $tooltips[ 'form_gravityview_fields' ] = array( |
|
137 | + 'title' => __( 'GravityView Fields', 'gravityview' ), |
|
138 | + 'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview' ), |
|
139 | 139 | ); |
140 | 140 | |
141 | 141 | return $tooltips; |
@@ -246,15 +246,15 @@ discard block |
||
246 | 246 | |
247 | 247 | $gv_bulk_action = false; |
248 | 248 | |
249 | - if( version_compare( GFForms::$version, '2.0', '>=' ) ) { |
|
250 | - $bulk_action = ( '-1' !== rgpost('action') ) ? rgpost('action') : rgpost('action2'); |
|
249 | + if ( version_compare( GFForms::$version, '2.0', '>=' ) ) { |
|
250 | + $bulk_action = ( '-1' !== rgpost( 'action' ) ) ? rgpost( 'action' ) : rgpost( 'action2' ); |
|
251 | 251 | } else { |
252 | 252 | // GF 1.9.x - Bulk action 2 is the bottom bulk action select form. |
253 | - $bulk_action = rgpost('bulk_action') ? rgpost('bulk_action') : rgpost('bulk_action2'); |
|
253 | + $bulk_action = rgpost( 'bulk_action' ) ? rgpost( 'bulk_action' ) : rgpost( 'bulk_action2' ); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | // Check the $bulk_action value against GV actions, see if they're the same. I hate strpos(). |
257 | - if( ! empty( $bulk_action ) && preg_match( '/^('. implode( '|', $this->bulk_action_prefixes ) .')/ism', $bulk_action ) ) { |
|
257 | + if ( ! empty( $bulk_action ) && preg_match( '/^(' . implode( '|', $this->bulk_action_prefixes ) . ')/ism', $bulk_action ) ) { |
|
258 | 258 | $gv_bulk_action = $bulk_action; |
259 | 259 | } |
260 | 260 | |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | |
280 | 280 | // gforms_entry_list is the nonce that confirms we're on the right page |
281 | 281 | // gforms_update_note is sent when bulk editing entry notes. We don't want to process then. |
282 | - if ( $bulk_action && rgpost('gforms_entry_list') && empty( $_POST['gforms_update_note'] ) ) { |
|
282 | + if ( $bulk_action && rgpost( 'gforms_entry_list' ) && empty( $_POST[ 'gforms_update_note' ] ) ) { |
|
283 | 283 | |
284 | 284 | check_admin_referer( 'gforms_entry_list', 'gforms_entry_list' ); |
285 | 285 | |
@@ -297,13 +297,13 @@ discard block |
||
297 | 297 | } |
298 | 298 | |
299 | 299 | // All entries are set to be updated, not just the visible ones |
300 | - if ( ! empty( $_POST['all_entries'] ) ) { |
|
300 | + if ( ! empty( $_POST[ 'all_entries' ] ) ) { |
|
301 | 301 | |
302 | 302 | // Convert the current entry search into GF-formatted search criteria |
303 | 303 | $search = array( |
304 | - 'search_field' => isset( $_POST['f'] ) ? $_POST['f'][0] : 0, |
|
305 | - 'search_value' => isset( $_POST['v'][0] ) ? $_POST['v'][0] : '', |
|
306 | - 'search_operator' => isset( $_POST['o'][0] ) ? $_POST['o'][0] : 'contains', |
|
304 | + 'search_field' => isset( $_POST[ 'f' ] ) ? $_POST[ 'f' ][ 0 ] : 0, |
|
305 | + 'search_value' => isset( $_POST[ 'v' ][ 0 ] ) ? $_POST[ 'v' ][ 0 ] : '', |
|
306 | + 'search_operator' => isset( $_POST[ 'o' ][ 0 ] ) ? $_POST[ 'o' ][ 0 ] : 'contains', |
|
307 | 307 | ); |
308 | 308 | |
309 | 309 | $search_criteria = GravityView_frontend::get_search_criteria( $search, $form_id ); |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | } else { |
315 | 315 | |
316 | 316 | // Changed from 'lead' to 'entry' in 2.0 |
317 | - $entries = isset( $_POST['lead'] ) ? $_POST['lead'] : $_POST['entry']; |
|
317 | + $entries = isset( $_POST[ 'lead' ] ) ? $_POST[ 'lead' ] : $_POST[ 'entry' ]; |
|
318 | 318 | |
319 | 319 | } |
320 | 320 | |
@@ -326,15 +326,15 @@ discard block |
||
326 | 326 | $entry_count = count( $entries ) > 1 ? sprintf( __( '%d entries', 'gravityview' ), count( $entries ) ) : __( '1 entry', 'gravityview' ); |
327 | 327 | |
328 | 328 | switch ( $approved_status ) { |
329 | - case $this->bulk_action_prefixes['approve']: |
|
329 | + case $this->bulk_action_prefixes[ 'approve' ]: |
|
330 | 330 | GravityView_Entry_Approval::update_bulk( $entries, GravityView_Entry_Approval_Status::APPROVED, $form_id ); |
331 | 331 | $this->bulk_update_message = sprintf( __( '%s approved.', 'gravityview' ), $entry_count ); |
332 | 332 | break; |
333 | - case $this->bulk_action_prefixes['unapprove']: |
|
333 | + case $this->bulk_action_prefixes[ 'unapprove' ]: |
|
334 | 334 | GravityView_Entry_Approval::update_bulk( $entries, GravityView_Entry_Approval_Status::UNAPPROVED, $form_id ); |
335 | 335 | $this->bulk_update_message = sprintf( __( '%s unapproved.', 'gravityview' ), $entry_count ); |
336 | 336 | break; |
337 | - case $this->bulk_action_prefixes['disapprove']: |
|
337 | + case $this->bulk_action_prefixes[ 'disapprove' ]: |
|
338 | 338 | GravityView_Entry_Approval::update_bulk( $entries, GravityView_Entry_Approval_Status::DISAPPROVED, $form_id ); |
339 | 339 | $this->bulk_update_message = sprintf( __( '%s disapproved.', 'gravityview' ), $entry_count ); |
340 | 340 | break; |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | * |
357 | 357 | * @return boolean True: It worked; False: it failed |
358 | 358 | */ |
359 | - public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) { |
|
359 | + public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0 ) { |
|
360 | 360 | return GravityView_Entry_Approval::update_approved( $entry_id, $approved, $form_id, $approvedcolumn ); |
361 | 361 | } |
362 | 362 | |
@@ -386,20 +386,20 @@ discard block |
||
386 | 386 | * |
387 | 387 | * @return void |
388 | 388 | */ |
389 | - static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) { |
|
389 | + static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) { |
|
390 | 390 | |
391 | - if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry['id'] ) ) { |
|
391 | + if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry[ 'id' ] ) ) { |
|
392 | 392 | return; |
393 | 393 | } |
394 | 394 | |
395 | - if( empty( $entry['id'] ) ) { |
|
395 | + if ( empty( $entry[ 'id' ] ) ) { |
|
396 | 396 | return; |
397 | 397 | } |
398 | 398 | |
399 | 399 | $status_value = GravityView_Entry_Approval::get_entry_status( $entry, 'value' ); |
400 | 400 | |
401 | - if( $status_value ) { |
|
402 | - echo '<input type="hidden" class="entry_approval" id="entry_approved_'. $entry['id'] .'" value="' . esc_attr( $status_value ) . '" />'; |
|
401 | + if ( $status_value ) { |
|
402 | + echo '<input type="hidden" class="entry_approval" id="entry_approved_' . $entry[ 'id' ] . '" value="' . esc_attr( $status_value ) . '" />'; |
|
403 | 403 | } |
404 | 404 | } |
405 | 405 | |
@@ -412,10 +412,10 @@ discard block |
||
412 | 412 | */ |
413 | 413 | private function get_form_id() { |
414 | 414 | |
415 | - $form_id = GFForms::get('id'); |
|
415 | + $form_id = GFForms::get( 'id' ); |
|
416 | 416 | |
417 | 417 | // If there are no forms identified, use the first form. That's how GF does it. |
418 | - if( empty( $form_id ) && class_exists('RGFormsModel') ) { |
|
418 | + if ( empty( $form_id ) && class_exists( 'RGFormsModel' ) ) { |
|
419 | 419 | $form_id = $this->get_first_form_id(); |
420 | 420 | } |
421 | 421 | |
@@ -435,14 +435,14 @@ discard block |
||
435 | 435 | |
436 | 436 | $forms = RGFormsModel::get_forms( null, 'title' ); |
437 | 437 | |
438 | - if( ! isset( $forms[0] ) ) { |
|
438 | + if ( ! isset( $forms[ 0 ] ) ) { |
|
439 | 439 | do_action( 'gravityview_log_error', __METHOD__ . ': No forms were found' ); |
440 | 440 | return 0; |
441 | 441 | } |
442 | 442 | |
443 | - $first_form = $forms[0]; |
|
443 | + $first_form = $forms[ 0 ]; |
|
444 | 444 | |
445 | - $form_id = is_object( $forms[0] ) ? $first_form->id : $first_form['id']; |
|
445 | + $form_id = is_object( $forms[ 0 ] ) ? $first_form->id : $first_form[ 'id' ]; |
|
446 | 446 | |
447 | 447 | return intval( $form_id ); |
448 | 448 | } |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | |
451 | 451 | function add_scripts_and_styles( $hook ) { |
452 | 452 | |
453 | - if( ! class_exists( 'RGForms' ) ) { |
|
453 | + if ( ! class_exists( 'RGForms' ) ) { |
|
454 | 454 | |
455 | 455 | do_action( 'gravityview_log_error', 'GravityView_Admin_ApproveEntries[add_scripts_and_styles] RGForms does not exist.' ); |
456 | 456 | |
@@ -459,25 +459,25 @@ discard block |
||
459 | 459 | |
460 | 460 | // enqueue styles & scripts gf_entries |
461 | 461 | // But only if we're on the main Entries page, not on reports pages |
462 | - if( GFForms::get_page() !== 'entry_list' ) { |
|
462 | + if ( GFForms::get_page() !== 'entry_list' ) { |
|
463 | 463 | return; |
464 | 464 | } |
465 | 465 | |
466 | 466 | $form_id = $this->get_form_id(); |
467 | 467 | |
468 | 468 | // Things are broken; no forms were found |
469 | - if( empty( $form_id ) ) { |
|
469 | + if ( empty( $form_id ) ) { |
|
470 | 470 | return; |
471 | 471 | } |
472 | 472 | |
473 | - wp_enqueue_style( 'gravityview_entries_list', plugins_url('assets/css/admin-entries-list.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
473 | + wp_enqueue_style( 'gravityview_entries_list', plugins_url( 'assets/css/admin-entries-list.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
474 | 474 | |
475 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
475 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
476 | 476 | |
477 | - wp_enqueue_script( 'gravityview_gf_entries_scripts', plugins_url('assets/js/admin-entries-list'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version ); |
|
477 | + wp_enqueue_script( 'gravityview_gf_entries_scripts', plugins_url( 'assets/js/admin-entries-list' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version ); |
|
478 | 478 | |
479 | 479 | wp_localize_script( 'gravityview_gf_entries_scripts', 'gvGlobals', array( |
480 | - 'nonce' => wp_create_nonce( 'gravityview_entry_approval'), |
|
480 | + 'nonce' => wp_create_nonce( 'gravityview_entry_approval' ), |
|
481 | 481 | 'form_id' => $form_id, |
482 | 482 | 'show_column' => (int)$this->show_approve_entry_column( $form_id ), |
483 | 483 | 'add_bulk_action' => (int)GVCommon::has_cap( 'gravityview_moderate_entries' ), |
@@ -486,10 +486,10 @@ discard block |
||
486 | 486 | 'status_unapproved' => GravityView_Entry_Approval_Status::UNAPPROVED, |
487 | 487 | 'bulk_actions' => $this->get_bulk_actions( $form_id ), |
488 | 488 | 'bulk_message' => $this->bulk_update_message, |
489 | - 'unapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('unapproved'), |
|
490 | - 'approve_title' => GravityView_Entry_Approval_Status::get_title_attr('disapproved'), |
|
491 | - 'disapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('approved'), |
|
492 | - 'column_title' => __( 'Show entry in directory view?', 'gravityview'), |
|
489 | + 'unapprove_title' => GravityView_Entry_Approval_Status::get_title_attr( 'unapproved' ), |
|
490 | + 'approve_title' => GravityView_Entry_Approval_Status::get_title_attr( 'disapproved' ), |
|
491 | + 'disapprove_title' => GravityView_Entry_Approval_Status::get_title_attr( 'approved' ), |
|
492 | + 'column_title' => __( 'Show entry in directory view?', 'gravityview' ), |
|
493 | 493 | 'column_link' => esc_url( $this->get_sort_link( $form_id ) ), |
494 | 494 | ) ); |
495 | 495 | |
@@ -509,11 +509,11 @@ discard block |
||
509 | 509 | |
510 | 510 | $approved_column_id = self::get_approved_column( $form_id ); |
511 | 511 | |
512 | - if( ! $approved_column_id ) { |
|
512 | + if ( ! $approved_column_id ) { |
|
513 | 513 | return ''; |
514 | 514 | } |
515 | 515 | |
516 | - $order = ( 'desc' === rgget('order') ) ? 'asc' : 'desc'; |
|
516 | + $order = ( 'desc' === rgget( 'order' ) ) ? 'asc' : 'desc'; |
|
517 | 517 | |
518 | 518 | $args = array( |
519 | 519 | 'orderby' => $approved_column_id, |
@@ -539,16 +539,16 @@ discard block |
||
539 | 539 | $bulk_actions = array( |
540 | 540 | 'GravityView' => array( |
541 | 541 | array( |
542 | - 'label' => GravityView_Entry_Approval_Status::get_string('approved', 'action'), |
|
543 | - 'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['approve'], $form_id ), |
|
542 | + 'label' => GravityView_Entry_Approval_Status::get_string( 'approved', 'action' ), |
|
543 | + 'value' => sprintf( '%s-%d', $this->bulk_action_prefixes[ 'approve' ], $form_id ), |
|
544 | 544 | ), |
545 | 545 | array( |
546 | - 'label' => GravityView_Entry_Approval_Status::get_string('disapproved', 'action'), |
|
547 | - 'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['disapprove'], $form_id ), |
|
546 | + 'label' => GravityView_Entry_Approval_Status::get_string( 'disapproved', 'action' ), |
|
547 | + 'value' => sprintf( '%s-%d', $this->bulk_action_prefixes[ 'disapprove' ], $form_id ), |
|
548 | 548 | ), |
549 | 549 | array( |
550 | - 'label' => GravityView_Entry_Approval_Status::get_string('unapproved', 'action'), |
|
551 | - 'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['unapprove'], $form_id ), |
|
550 | + 'label' => GravityView_Entry_Approval_Status::get_string( 'unapproved', 'action' ), |
|
551 | + 'value' => sprintf( '%s-%d', $this->bulk_action_prefixes[ 'unapprove' ], $form_id ), |
|
552 | 552 | ), |
553 | 553 | ), |
554 | 554 | ); |
@@ -565,8 +565,8 @@ discard block |
||
565 | 565 | // Sanitize the values, just to be sure. |
566 | 566 | foreach ( $bulk_actions as $key => $group ) { |
567 | 567 | foreach ( $group as $i => $action ) { |
568 | - $bulk_actions[ $key ][ $i ]['label'] = esc_html( $bulk_actions[ $key ][ $i ]['label'] ); |
|
569 | - $bulk_actions[ $key ][ $i ]['value'] = esc_attr( $bulk_actions[ $key ][ $i ]['value'] ); |
|
568 | + $bulk_actions[ $key ][ $i ][ 'label' ] = esc_html( $bulk_actions[ $key ][ $i ][ 'label' ] ); |
|
569 | + $bulk_actions[ $key ][ $i ][ 'value' ] = esc_attr( $bulk_actions[ $key ][ $i ][ 'value' ] ); |
|
570 | 570 | } |
571 | 571 | } |
572 | 572 | |
@@ -591,13 +591,13 @@ discard block |
||
591 | 591 | * @since 1.7.2 |
592 | 592 | * @param boolean $hide_if_no_connections |
593 | 593 | */ |
594 | - $hide_if_no_connections = apply_filters('gravityview/approve_entries/hide-if-no-connections', false ); |
|
594 | + $hide_if_no_connections = apply_filters( 'gravityview/approve_entries/hide-if-no-connections', false ); |
|
595 | 595 | |
596 | - if( $hide_if_no_connections ) { |
|
596 | + if ( $hide_if_no_connections ) { |
|
597 | 597 | |
598 | 598 | $connected_views = gravityview_get_connected_views( $form_id ); |
599 | 599 | |
600 | - if( empty( $connected_views ) ) { |
|
600 | + if ( empty( $connected_views ) ) { |
|
601 | 601 | $show_approve_column = false; |
602 | 602 | } |
603 | 603 | } |
@@ -607,18 +607,18 @@ discard block |
||
607 | 607 | * @param boolean $show_approve_column Whether the column will be shown |
608 | 608 | * @param int $form_id The ID of the Gravity Forms form for which entries are being shown |
609 | 609 | */ |
610 | - $show_approve_column = apply_filters('gravityview/approve_entries/show-column', $show_approve_column, $form_id ); |
|
610 | + $show_approve_column = apply_filters( 'gravityview/approve_entries/show-column', $show_approve_column, $form_id ); |
|
611 | 611 | |
612 | 612 | return $show_approve_column; |
613 | 613 | } |
614 | 614 | |
615 | 615 | function register_gform_noconflict_script( $scripts ) { |
616 | - $scripts[] = 'gravityview_gf_entries_scripts'; |
|
616 | + $scripts[ ] = 'gravityview_gf_entries_scripts'; |
|
617 | 617 | return $scripts; |
618 | 618 | } |
619 | 619 | |
620 | 620 | function register_gform_noconflict_style( $styles ) { |
621 | - $styles[] = 'gravityview_entries_list'; |
|
621 | + $styles[ ] = 'gravityview_entries_list'; |
|
622 | 622 | return $styles; |
623 | 623 | } |
624 | 624 |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | private function __construct() {} |
86 | 86 | |
87 | 87 | private function initialize() { |
88 | - add_action( 'wp', array( $this, 'parse_content'), 11 ); |
|
88 | + add_action( 'wp', array( $this, 'parse_content' ), 11 ); |
|
89 | 89 | add_filter( 'parse_query', array( $this, 'parse_query_fix_frontpage' ), 10 ); |
90 | - add_action( 'template_redirect', array( $this, 'set_entry_data'), 1 ); |
|
90 | + add_action( 'template_redirect', array( $this, 'set_entry_data' ), 1 ); |
|
91 | 91 | |
92 | 92 | // Enqueue scripts and styles after GravityView_Template::register_styles() |
93 | 93 | add_action( 'wp_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 20 ); |
@@ -234,15 +234,15 @@ discard block |
||
234 | 234 | |
235 | 235 | $this->context_view_id = $view_id; |
236 | 236 | |
237 | - } elseif ( isset( $_GET['gvid'] ) && $this->getGvOutputData()->has_multiple_views() ) { |
|
237 | + } elseif ( isset( $_GET[ 'gvid' ] ) && $this->getGvOutputData()->has_multiple_views() ) { |
|
238 | 238 | /** |
239 | 239 | * used on a has_multiple_views context |
240 | 240 | * @see GravityView_API::entry_link |
241 | 241 | * @see GravityView_View_Data::getInstance()->has_multiple_views() |
242 | 242 | */ |
243 | - $this->context_view_id = $_GET['gvid']; |
|
243 | + $this->context_view_id = $_GET[ 'gvid' ]; |
|
244 | 244 | |
245 | - } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
245 | + } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
246 | 246 | $array_keys = array_keys( $this->getGvOutputData()->get_views() ); |
247 | 247 | $this->context_view_id = array_pop( $array_keys ); |
248 | 248 | unset( $array_keys ); |
@@ -277,24 +277,24 @@ discard block |
||
277 | 277 | global $wp_rewrite; |
278 | 278 | |
279 | 279 | $is_front_page = ( $query->is_home || $query->is_page ); |
280 | - $show_on_front = ( 'page' === get_option('show_on_front') ); |
|
281 | - $front_page_id = get_option('page_on_front'); |
|
280 | + $show_on_front = ( 'page' === get_option( 'show_on_front' ) ); |
|
281 | + $front_page_id = get_option( 'page_on_front' ); |
|
282 | 282 | |
283 | - if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
283 | + if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
284 | 284 | |
285 | 285 | // Force to be an array, potentially a query string ( entry=16 ) |
286 | 286 | $_query = wp_parse_args( $query->query ); |
287 | 287 | |
288 | 288 | // pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename. |
289 | - if ( isset( $_query['pagename'] ) && '' === $_query['pagename'] ) { |
|
290 | - unset( $_query['pagename'] ); |
|
289 | + if ( isset( $_query[ 'pagename' ] ) && '' === $_query[ 'pagename' ] ) { |
|
290 | + unset( $_query[ 'pagename' ] ); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | // this is where will break from core wordpress |
294 | 294 | $ignore = array( 'preview', 'page', 'paged', 'cpage' ); |
295 | 295 | $endpoints = rgobj( $wp_rewrite, 'endpoints' ); |
296 | - foreach ( (array) $endpoints as $endpoint ) { |
|
297 | - $ignore[] = $endpoint[1]; |
|
296 | + foreach ( (array)$endpoints as $endpoint ) { |
|
297 | + $ignore[ ] = $endpoint[ 1 ]; |
|
298 | 298 | } |
299 | 299 | unset( $endpoints ); |
300 | 300 | |
@@ -304,21 +304,21 @@ discard block |
||
304 | 304 | // - The query includes keys that are associated with registered endpoints. `entry`, for example. |
305 | 305 | if ( empty( $_query ) || ! array_diff( array_keys( $_query ), $ignore ) ) { |
306 | 306 | |
307 | - $qv =& $query->query_vars; |
|
307 | + $qv = & $query->query_vars; |
|
308 | 308 | |
309 | 309 | // Prevent redirect when on the single entry endpoint |
310 | - if( self::is_single_entry() ) { |
|
310 | + if ( self::is_single_entry() ) { |
|
311 | 311 | add_filter( 'redirect_canonical', '__return_false' ); |
312 | 312 | } |
313 | 313 | |
314 | 314 | $query->is_page = true; |
315 | 315 | $query->is_home = false; |
316 | - $qv['page_id'] = $front_page_id; |
|
316 | + $qv[ 'page_id' ] = $front_page_id; |
|
317 | 317 | |
318 | 318 | // Correct <!--nextpage--> for page_on_front |
319 | - if ( ! empty( $qv['paged'] ) ) { |
|
320 | - $qv['page'] = $qv['paged']; |
|
321 | - unset( $qv['paged'] ); |
|
319 | + if ( ! empty( $qv[ 'paged' ] ) ) { |
|
320 | + $qv[ 'page' ] = $qv[ 'paged' ]; |
|
321 | + unset( $qv[ 'paged' ] ); |
|
322 | 322 | } |
323 | 323 | } |
324 | 324 | |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | global $post; |
337 | 337 | |
338 | 338 | // If in admin and NOT AJAX request, get outta here. |
339 | - if ( GravityView_Plugin::is_admin() ) { |
|
339 | + if ( GravityView_Plugin::is_admin() ) { |
|
340 | 340 | return; |
341 | 341 | } |
342 | 342 | |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | |
349 | 349 | $this->setIsGravityviewPostType( get_post_type( $post ) === 'gravityview' ); |
350 | 350 | |
351 | - $post_id = $this->getPostId() ? $this->getPostId() : (isset( $post ) ? $post->ID : null ); |
|
351 | + $post_id = $this->getPostId() ? $this->getPostId() : ( isset( $post ) ? $post->ID : null ); |
|
352 | 352 | $this->setPostId( $post_id ); |
353 | 353 | $post_has_shortcode = ! empty( $post->post_content ) ? gravityview_has_shortcode_r( $post->post_content, 'gravityview' ) : false; |
354 | 354 | $this->setPostHasShortcode( $this->isGravityviewPostType() ? null : ! empty( $post_has_shortcode ) ); |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | |
385 | 385 | $search_method = GravityView_Widget_Search::getInstance()->get_search_method(); |
386 | 386 | |
387 | - if( 'post' === $search_method ) { |
|
387 | + if ( 'post' === $search_method ) { |
|
388 | 388 | $get = $_POST; |
389 | 389 | } else { |
390 | 390 | $get = $_GET; |
@@ -440,20 +440,20 @@ discard block |
||
440 | 440 | * @param boolean $in_the_loop Whether to apply the filter to the menu title and the meta tag <title> - outside the loop |
441 | 441 | * @param array $entry Current entry |
442 | 442 | */ |
443 | - $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop' , in_the_loop(), $entry ); |
|
443 | + $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop', in_the_loop(), $entry ); |
|
444 | 444 | |
445 | 445 | if ( ! $apply_outside_loop ) { |
446 | 446 | return $title; |
447 | 447 | } |
448 | 448 | |
449 | 449 | // User reported WooCommerce doesn't pass two args. |
450 | - if ( empty( $passed_post_id ) ) { |
|
450 | + if ( empty( $passed_post_id ) ) { |
|
451 | 451 | return $title; |
452 | 452 | } |
453 | 453 | |
454 | 454 | // Don't modify the title for anything other than the current view/post. |
455 | 455 | // This is true for embedded shortcodes and Views. |
456 | - if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) { |
|
456 | + if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) { |
|
457 | 457 | return $title; |
458 | 458 | } |
459 | 459 | |
@@ -463,19 +463,19 @@ discard block |
||
463 | 463 | $view_meta = $this->getGvOutputData()->get_view( $context_view_id ); |
464 | 464 | } else { |
465 | 465 | foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) { |
466 | - if ( intval( $view_data['form_id'] ) === intval( $entry['form_id'] ) ) { |
|
466 | + if ( intval( $view_data[ 'form_id' ] ) === intval( $entry[ 'form_id' ] ) ) { |
|
467 | 467 | $view_meta = $view_data; |
468 | 468 | break; |
469 | 469 | } |
470 | 470 | } |
471 | 471 | } |
472 | 472 | |
473 | - if ( ! empty( $view_meta['atts']['single_title'] ) ) { |
|
473 | + if ( ! empty( $view_meta[ 'atts' ][ 'single_title' ] ) ) { |
|
474 | 474 | |
475 | - $title = $view_meta['atts']['single_title']; |
|
475 | + $title = $view_meta[ 'atts' ][ 'single_title' ]; |
|
476 | 476 | |
477 | 477 | // We are allowing HTML in the fields, so no escaping the output |
478 | - $title = GravityView_API::replace_variables( $title, $view_meta['form'], $entry ); |
|
478 | + $title = GravityView_API::replace_variables( $title, $view_meta[ 'form' ], $entry ); |
|
479 | 479 | |
480 | 480 | $title = do_shortcode( $title ); |
481 | 481 | } |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | public function render_view( $passed_args ) { |
577 | 577 | |
578 | 578 | // validate attributes |
579 | - if ( empty( $passed_args['id'] ) ) { |
|
579 | + if ( empty( $passed_args[ 'id' ] ) ) { |
|
580 | 580 | do_action( 'gravityview_log_error', '[render_view] Returning; no ID defined.', $passed_args ); |
581 | 581 | return null; |
582 | 582 | } |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | return null; |
599 | 599 | } |
600 | 600 | |
601 | - $view_id = $passed_args['id']; |
|
601 | + $view_id = $passed_args[ 'id' ]; |
|
602 | 602 | |
603 | 603 | $view_data = $this->getGvOutputData()->get_view( $view_id, $passed_args ); |
604 | 604 | |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | $passed_args = array_filter( $passed_args, 'strlen' ); |
612 | 612 | |
613 | 613 | //Override shortcode args over View template settings |
614 | - $atts = wp_parse_args( $passed_args, $view_data['atts'] ); |
|
614 | + $atts = wp_parse_args( $passed_args, $view_data[ 'atts' ] ); |
|
615 | 615 | |
616 | 616 | do_action( 'gravityview_log_debug', '[render_view] Arguments after merging with View settings: ', $atts ); |
617 | 617 | |
@@ -634,14 +634,14 @@ discard block |
||
634 | 634 | * @since 1.15 |
635 | 635 | * @since 1.17.2 Added check for if a user has no caps but is logged in (member of multisite, but not any site). Treat as if logged-out. |
636 | 636 | */ |
637 | - if( is_user_logged_in() && ! ( empty( wp_get_current_user()->caps ) && empty( wp_get_current_user()->roles ) ) && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
637 | + if ( is_user_logged_in() && ! ( empty( wp_get_current_user()->caps ) && empty( wp_get_current_user()->roles ) ) && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
638 | 638 | |
639 | 639 | do_action( 'gravityview_log_debug', sprintf( '%s Returning: View %d is not visible by current user.', __METHOD__, $view_id ) ); |
640 | 640 | |
641 | 641 | return null; |
642 | 642 | } |
643 | 643 | |
644 | - if( $this->isGravityviewPostType() ) { |
|
644 | + if ( $this->isGravityviewPostType() ) { |
|
645 | 645 | |
646 | 646 | /** |
647 | 647 | * @filter `gravityview_direct_access` Should Views be directly accessible, or only visible using the shortcode? |
@@ -653,9 +653,9 @@ discard block |
||
653 | 653 | */ |
654 | 654 | $direct_access = apply_filters( 'gravityview_direct_access', true, $view_id ); |
655 | 655 | |
656 | - $embed_only = ! empty( $atts['embed_only'] ); |
|
656 | + $embed_only = ! empty( $atts[ 'embed_only' ] ); |
|
657 | 657 | |
658 | - if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
658 | + if ( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
659 | 659 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
660 | 660 | } |
661 | 661 | } |
@@ -670,7 +670,7 @@ discard block |
||
670 | 670 | |
671 | 671 | $gravityview_view = new GravityView_View( $view_data ); |
672 | 672 | |
673 | - $post_id = ! empty( $atts['post_id'] ) ? intval( $atts['post_id'] ) : $this->getPostId(); |
|
673 | + $post_id = ! empty( $atts[ 'post_id' ] ) ? intval( $atts[ 'post_id' ] ) : $this->getPostId(); |
|
674 | 674 | |
675 | 675 | $gravityview_view->setPostId( $post_id ); |
676 | 676 | |
@@ -680,20 +680,20 @@ discard block |
||
680 | 680 | do_action( 'gravityview_log_debug', '[render_view] Executing Directory View' ); |
681 | 681 | |
682 | 682 | //fetch template and slug |
683 | - $view_slug = apply_filters( 'gravityview_template_slug_'. $view_data['template_id'], 'table', 'directory' ); |
|
683 | + $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'directory' ); |
|
684 | 684 | |
685 | 685 | do_action( 'gravityview_log_debug', '[render_view] View template slug: ', $view_slug ); |
686 | 686 | |
687 | 687 | /** |
688 | 688 | * Disable fetching initial entries for views that don't need it (DataTables) |
689 | 689 | */ |
690 | - $get_entries = apply_filters( 'gravityview_get_view_entries_'.$view_slug, true ); |
|
690 | + $get_entries = apply_filters( 'gravityview_get_view_entries_' . $view_slug, true ); |
|
691 | 691 | |
692 | 692 | /** |
693 | 693 | * Hide View data until search is performed |
694 | 694 | * @since 1.5.4 |
695 | 695 | */ |
696 | - if ( ! empty( $atts['hide_until_searched'] ) && ! $this->isSearch() ) { |
|
696 | + if ( ! empty( $atts[ 'hide_until_searched' ] ) && ! $this->isSearch() ) { |
|
697 | 697 | $gravityview_view->setHideUntilSearched( true ); |
698 | 698 | $get_entries = false; |
699 | 699 | } |
@@ -701,23 +701,23 @@ discard block |
||
701 | 701 | |
702 | 702 | if ( $get_entries ) { |
703 | 703 | |
704 | - if ( ! empty( $atts['sort_columns'] ) ) { |
|
704 | + if ( ! empty( $atts[ 'sort_columns' ] ) ) { |
|
705 | 705 | // add filter to enable column sorting |
706 | - add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ) , 100, 3 ); |
|
706 | + add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ), 100, 3 ); |
|
707 | 707 | } |
708 | 708 | |
709 | - $view_entries = self::get_view_entries( $atts, $view_data['form_id'] ); |
|
709 | + $view_entries = self::get_view_entries( $atts, $view_data[ 'form_id' ] ); |
|
710 | 710 | |
711 | - do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries['count'], sizeof( $view_entries['entries'] ) ) ); |
|
711 | + do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries[ 'count' ], sizeof( $view_entries[ 'entries' ] ) ) ); |
|
712 | 712 | |
713 | 713 | } else { |
714 | 714 | |
715 | 715 | $view_entries = array( 'count' => null, 'entries' => null, 'paging' => null ); |
716 | 716 | |
717 | - do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_'.$view_slug.'` is false' ); |
|
717 | + do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_' . $view_slug . '` is false' ); |
|
718 | 718 | } |
719 | 719 | |
720 | - $gravityview_view->setPaging( $view_entries['paging'] ); |
|
720 | + $gravityview_view->setPaging( $view_entries[ 'paging' ] ); |
|
721 | 721 | $gravityview_view->setContext( 'directory' ); |
722 | 722 | $sections = array( 'header', 'body', 'footer' ); |
723 | 723 | |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | * @action `gravityview_render_entry_{View ID}` Before rendering a single entry for a specific View ID |
732 | 732 | * @since 1.17 |
733 | 733 | */ |
734 | - do_action( 'gravityview_render_entry_'.$view_data['id'] ); |
|
734 | + do_action( 'gravityview_render_entry_' . $view_data[ 'id' ] ); |
|
735 | 735 | |
736 | 736 | $entry = $this->getEntry(); |
737 | 737 | |
@@ -758,20 +758,20 @@ discard block |
||
758 | 758 | // We're in single view, but the view being processed is not the same view the single entry belongs to. |
759 | 759 | // important: do not remove this as it prevents fake attempts of displaying entries from other views/forms |
760 | 760 | if ( $this->getGvOutputData()->has_multiple_views() && $view_id != $this->get_context_view_id() ) { |
761 | - do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: '. $view_id ); |
|
761 | + do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: ' . $view_id ); |
|
762 | 762 | return null; |
763 | 763 | } |
764 | 764 | |
765 | 765 | //fetch template and slug |
766 | - $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data['template_id'], 'table', 'single' ); |
|
766 | + $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'single' ); |
|
767 | 767 | do_action( 'gravityview_log_debug', '[render_view] View single template slug: ', $view_slug ); |
768 | 768 | |
769 | 769 | //fetch entry detail |
770 | - $view_entries['count'] = 1; |
|
771 | - $view_entries['entries'][] = $entry; |
|
772 | - do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries['entries'] ); |
|
770 | + $view_entries[ 'count' ] = 1; |
|
771 | + $view_entries[ 'entries' ][ ] = $entry; |
|
772 | + do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries[ 'entries' ] ); |
|
773 | 773 | |
774 | - $back_link_label = isset( $atts['back_link_label'] ) ? $atts['back_link_label'] : null; |
|
774 | + $back_link_label = isset( $atts[ 'back_link_label' ] ) ? $atts[ 'back_link_label' ] : null; |
|
775 | 775 | |
776 | 776 | // set back link label |
777 | 777 | $gravityview_view->setBackLinkLabel( $back_link_label ); |
@@ -781,11 +781,11 @@ discard block |
||
781 | 781 | } |
782 | 782 | |
783 | 783 | // add template style |
784 | - self::add_style( $view_data['template_id'] ); |
|
784 | + self::add_style( $view_data[ 'template_id' ] ); |
|
785 | 785 | |
786 | 786 | // Prepare to render view and set vars |
787 | - $gravityview_view->setEntries( $view_entries['entries'] ); |
|
788 | - $gravityview_view->setTotalEntries( $view_entries['count'] ); |
|
787 | + $gravityview_view->setEntries( $view_entries[ 'entries' ] ); |
|
788 | + $gravityview_view->setTotalEntries( $view_entries[ 'count' ] ); |
|
789 | 789 | |
790 | 790 | // If Edit |
791 | 791 | if ( 'edit' === gravityview_get_context() ) { |
@@ -798,11 +798,11 @@ discard block |
||
798 | 798 | |
799 | 799 | } else { |
800 | 800 | // finaly we'll render some html |
801 | - $sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data['template_id'] ); |
|
801 | + $sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data[ 'template_id' ] ); |
|
802 | 802 | |
803 | 803 | do_action( 'gravityview_log_debug', '[render_view] Sections to render: ', $sections ); |
804 | 804 | foreach ( $sections as $section ) { |
805 | - do_action( 'gravityview_log_debug', '[render_view] Rendering '. $section . ' section.' ); |
|
805 | + do_action( 'gravityview_log_debug', '[render_view] Rendering ' . $section . ' section.' ); |
|
806 | 806 | $gravityview_view->render( $view_slug, $section, false ); |
807 | 807 | } |
808 | 808 | } |
@@ -856,7 +856,7 @@ discard block |
||
856 | 856 | $datetime_format = 'Y-m-d H:i:s'; |
857 | 857 | $search_is_outside_view_bounds = false; |
858 | 858 | |
859 | - if( ! empty( $search_criteria[ $key ] ) ) { |
|
859 | + if ( ! empty( $search_criteria[ $key ] ) ) { |
|
860 | 860 | |
861 | 861 | $search_date = strtotime( $search_criteria[ $key ] ); |
862 | 862 | |
@@ -884,14 +884,14 @@ discard block |
||
884 | 884 | if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) { |
885 | 885 | |
886 | 886 | // Then we override the search and re-set the start date |
887 | - $return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true ); |
|
887 | + $return_search_criteria[ $key ] = date_i18n( $datetime_format, $date, true ); |
|
888 | 888 | } |
889 | 889 | } |
890 | 890 | } |
891 | 891 | |
892 | - if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) { |
|
892 | + if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) { |
|
893 | 893 | // The start date is AFTER the end date. This will result in no results, but let's not force the issue. |
894 | - if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) { |
|
894 | + if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) { |
|
895 | 895 | do_action( 'gravityview_log_error', __METHOD__ . ' Invalid search: the start date is after the end date.', $return_search_criteria ); |
896 | 896 | } |
897 | 897 | } |
@@ -909,14 +909,14 @@ discard block |
||
909 | 909 | */ |
910 | 910 | public static function process_search_only_approved( $args, $search_criteria ) { |
911 | 911 | |
912 | - if ( ! empty( $args['show_only_approved'] ) ) { |
|
912 | + if ( ! empty( $args[ 'show_only_approved' ] ) ) { |
|
913 | 913 | |
914 | - $search_criteria['field_filters'][] = array( |
|
914 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
915 | 915 | 'key' => GravityView_Entry_Approval::meta_key, |
916 | 916 | 'value' => GravityView_Entry_Approval_Status::Approved |
917 | 917 | ); |
918 | 918 | |
919 | - $search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met |
|
919 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met |
|
920 | 920 | |
921 | 921 | do_action( 'gravityview_log_debug', '[process_search_only_approved] Search Criteria if show only approved: ', $search_criteria ); |
922 | 922 | } |
@@ -943,12 +943,12 @@ discard block |
||
943 | 943 | */ |
944 | 944 | public static function is_entry_approved( $entry, $args = array() ) { |
945 | 945 | |
946 | - if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) { |
|
946 | + if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) { |
|
947 | 947 | // is implicitly approved if entry is null or View settings doesn't require to check for approval |
948 | 948 | return true; |
949 | 949 | } |
950 | 950 | |
951 | - $is_approved = gform_get_meta( $entry['id'], GravityView_Entry_Approval::meta_key ); |
|
951 | + $is_approved = gform_get_meta( $entry[ 'id' ], GravityView_Entry_Approval::meta_key ); |
|
952 | 952 | |
953 | 953 | return GravityView_Entry_Approval_Status::is_approved( $is_approved ); |
954 | 954 | } |
@@ -982,26 +982,26 @@ discard block |
||
982 | 982 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', $search_criteria ); |
983 | 983 | |
984 | 984 | // implicity search |
985 | - if ( ! empty( $args['search_value'] ) ) { |
|
985 | + if ( ! empty( $args[ 'search_value' ] ) ) { |
|
986 | 986 | |
987 | 987 | // Search operator options. Options: `is` or `contains` |
988 | - $operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains'; |
|
988 | + $operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains'; |
|
989 | 989 | |
990 | - $search_criteria['field_filters'][] = array( |
|
990 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
991 | 991 | 'key' => rgget( 'search_field', $args ), // The field ID to search |
992 | - 'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes. |
|
992 | + 'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes. |
|
993 | 993 | 'operator' => $operator, |
994 | 994 | ); |
995 | 995 | } |
996 | 996 | |
997 | - if( $search_criteria !== $original_search_criteria ) { |
|
997 | + if ( $search_criteria !== $original_search_criteria ) { |
|
998 | 998 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after implicity search: ', $search_criteria ); |
999 | 999 | } |
1000 | 1000 | |
1001 | 1001 | // Handle setting date range |
1002 | 1002 | $search_criteria = self::process_search_dates( $args, $search_criteria ); |
1003 | 1003 | |
1004 | - if( $search_criteria !== $original_search_criteria ) { |
|
1004 | + if ( $search_criteria !== $original_search_criteria ) { |
|
1005 | 1005 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after date params: ', $search_criteria ); |
1006 | 1006 | } |
1007 | 1007 | |
@@ -1012,7 +1012,7 @@ discard block |
||
1012 | 1012 | * @filter `gravityview_status` Modify entry status requirements to be included in search results. |
1013 | 1013 | * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash` |
1014 | 1014 | */ |
1015 | - $search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args ); |
|
1015 | + $search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args ); |
|
1016 | 1016 | |
1017 | 1017 | return $search_criteria; |
1018 | 1018 | } |
@@ -1058,16 +1058,16 @@ discard block |
||
1058 | 1058 | $search_criteria = self::get_search_criteria( $args, $form_id ); |
1059 | 1059 | |
1060 | 1060 | // Paging & offset |
1061 | - $page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : apply_filters( 'gravityview_default_page_size', 25 ); |
|
1061 | + $page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : apply_filters( 'gravityview_default_page_size', 25 ); |
|
1062 | 1062 | |
1063 | 1063 | if ( -1 === $page_size ) { |
1064 | 1064 | $page_size = PHP_INT_MAX; |
1065 | 1065 | } |
1066 | 1066 | |
1067 | - if ( isset( $args['offset'] ) ) { |
|
1068 | - $offset = intval( $args['offset'] ); |
|
1067 | + if ( isset( $args[ 'offset' ] ) ) { |
|
1068 | + $offset = intval( $args[ 'offset' ] ); |
|
1069 | 1069 | } else { |
1070 | - $curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] ); |
|
1070 | + $curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] ); |
|
1071 | 1071 | $offset = ( $curr_page - 1 ) * $page_size; |
1072 | 1072 | } |
1073 | 1073 | |
@@ -1085,7 +1085,7 @@ discard block |
||
1085 | 1085 | 'search_criteria' => $search_criteria, |
1086 | 1086 | 'sorting' => $sorting, |
1087 | 1087 | 'paging' => $paging, |
1088 | - 'cache' => isset( $args['cache'] ) ? $args['cache'] : true, |
|
1088 | + 'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true, |
|
1089 | 1089 | ); |
1090 | 1090 | |
1091 | 1091 | /** |
@@ -1110,7 +1110,7 @@ discard block |
||
1110 | 1110 | * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys. |
1111 | 1111 | * @param array $args View configuration args. |
1112 | 1112 | */ |
1113 | - $parameters = apply_filters( 'gravityview_get_entries_'.$args['id'], $parameters, $args, $form_id ); |
|
1113 | + $parameters = apply_filters( 'gravityview_get_entries_' . $args[ 'id' ], $parameters, $args, $form_id ); |
|
1114 | 1114 | |
1115 | 1115 | do_action( 'gravityview_log_debug', __METHOD__ . ': $parameters passed to gravityview_get_entries(): ', $parameters ); |
1116 | 1116 | |
@@ -1150,8 +1150,8 @@ discard block |
||
1150 | 1150 | */ |
1151 | 1151 | public static function updateViewSorting( $args, $form_id ) { |
1152 | 1152 | $sorting = array(); |
1153 | - $sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : rgar( $args, 'sort_field' ); |
|
1154 | - $sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : rgar( $args, 'sort_direction' ); |
|
1153 | + $sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : rgar( $args, 'sort_field' ); |
|
1154 | + $sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : rgar( $args, 'sort_direction' ); |
|
1155 | 1155 | |
1156 | 1156 | $sort_field_id = self::_override_sorting_id_by_field_type( $sort_field_id, $form_id ); |
1157 | 1157 | |
@@ -1191,7 +1191,7 @@ discard block |
||
1191 | 1191 | |
1192 | 1192 | $sort_field = GFFormsModel::get_field( $form, $sort_field_id ); |
1193 | 1193 | |
1194 | - switch ( $sort_field['type'] ) { |
|
1194 | + switch ( $sort_field[ 'type' ] ) { |
|
1195 | 1195 | |
1196 | 1196 | case 'address': |
1197 | 1197 | // Sorting by full address |
@@ -1208,7 +1208,7 @@ discard block |
||
1208 | 1208 | */ |
1209 | 1209 | $address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); |
1210 | 1210 | |
1211 | - switch( strtolower( $address_part ) ){ |
|
1211 | + switch ( strtolower( $address_part ) ) { |
|
1212 | 1212 | case 'street': |
1213 | 1213 | $sort_field_id .= '.1'; |
1214 | 1214 | break; |
@@ -1288,7 +1288,7 @@ discard block |
||
1288 | 1288 | */ |
1289 | 1289 | $single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); |
1290 | 1290 | |
1291 | - if ( empty( $single_entry ) ){ |
|
1291 | + if ( empty( $single_entry ) ) { |
|
1292 | 1292 | return false; |
1293 | 1293 | } else { |
1294 | 1294 | return $single_entry; |
@@ -1315,7 +1315,7 @@ discard block |
||
1315 | 1315 | * Don't enqueue the scripts or styles if it's not going to be displayed. |
1316 | 1316 | * @since 1.15 |
1317 | 1317 | */ |
1318 | - if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
1318 | + if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
1319 | 1319 | continue; |
1320 | 1320 | } |
1321 | 1321 | |
@@ -1324,19 +1324,19 @@ discard block |
||
1324 | 1324 | $css_dependencies = array(); |
1325 | 1325 | |
1326 | 1326 | // If the thickbox is enqueued, add dependencies |
1327 | - if ( ! empty( $data['atts']['lightbox'] ) ) { |
|
1327 | + if ( ! empty( $data[ 'atts' ][ 'lightbox' ] ) ) { |
|
1328 | 1328 | |
1329 | 1329 | /** |
1330 | 1330 | * @filter `gravity_view_lightbox_script` Override the lightbox script to enqueue. Default: `thickbox` |
1331 | 1331 | * @param string $script_slug If you want to use a different lightbox script, return the name of it here. |
1332 | 1332 | */ |
1333 | - $js_dependencies[] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
1333 | + $js_dependencies[ ] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
1334 | 1334 | |
1335 | 1335 | /** |
1336 | 1336 | * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox` |
1337 | 1337 | * @param string $script_slug If you want to use a different lightbox script, return the name of its CSS file here. |
1338 | 1338 | */ |
1339 | - $css_dependencies[] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
1339 | + $css_dependencies[ ] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
1340 | 1340 | } |
1341 | 1341 | |
1342 | 1342 | /** |
@@ -1344,25 +1344,25 @@ discard block |
||
1344 | 1344 | * @see https://github.com/katzwebservices/GravityView/issues/536 |
1345 | 1345 | * @since 1.15 |
1346 | 1346 | */ |
1347 | - if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) { |
|
1348 | - $css_dependencies[] = 'dashicons'; |
|
1347 | + if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) { |
|
1348 | + $css_dependencies[ ] = 'dashicons'; |
|
1349 | 1349 | } |
1350 | 1350 | |
1351 | 1351 | wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
1352 | 1352 | |
1353 | 1353 | $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
1354 | 1354 | |
1355 | - wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ) , GravityView_Plugin::version, true ); |
|
1355 | + wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ), GravityView_Plugin::version, true ); |
|
1356 | 1356 | |
1357 | 1357 | wp_enqueue_script( 'gravityview-fe-view' ); |
1358 | 1358 | |
1359 | - if ( ! empty( $data['atts']['sort_columns'] ) ) { |
|
1359 | + if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) { |
|
1360 | 1360 | wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' ); |
1361 | 1361 | } |
1362 | 1362 | |
1363 | 1363 | $this->enqueue_default_style( $css_dependencies ); |
1364 | 1364 | |
1365 | - self::add_style( $data['template_id'] ); |
|
1365 | + self::add_style( $data[ 'template_id' ] ); |
|
1366 | 1366 | } |
1367 | 1367 | |
1368 | 1368 | if ( 'wp_print_footer_scripts' === current_filter() ) { |
@@ -1424,7 +1424,7 @@ discard block |
||
1424 | 1424 | } elseif ( empty( $template_id ) ) { |
1425 | 1425 | do_action( 'gravityview_log_error', '[add_style] Cannot add template style; template_id is empty' ); |
1426 | 1426 | } else { |
1427 | - do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_'.$template_id ) ); |
|
1427 | + do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_' . $template_id ) ); |
|
1428 | 1428 | } |
1429 | 1429 | |
1430 | 1430 | } |
@@ -1449,11 +1449,11 @@ discard block |
||
1449 | 1449 | * Not a table-based template; don't add sort icons |
1450 | 1450 | * @since 1.12 |
1451 | 1451 | */ |
1452 | - if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
1452 | + if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
1453 | 1453 | return $label; |
1454 | 1454 | } |
1455 | 1455 | |
1456 | - if ( ! $this->is_field_sortable( $field['id'], $form ) ) { |
|
1456 | + if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) { |
|
1457 | 1457 | return $label; |
1458 | 1458 | } |
1459 | 1459 | |
@@ -1461,29 +1461,29 @@ discard block |
||
1461 | 1461 | |
1462 | 1462 | $class = 'gv-sort'; |
1463 | 1463 | |
1464 | - $sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] ); |
|
1464 | + $sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] ); |
|
1465 | 1465 | |
1466 | 1466 | $sort_args = array( |
1467 | - 'sort' => $field['id'], |
|
1467 | + 'sort' => $field[ 'id' ], |
|
1468 | 1468 | 'dir' => 'asc', |
1469 | 1469 | ); |
1470 | 1470 | |
1471 | - if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) { |
|
1471 | + if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) { |
|
1472 | 1472 | //toggle sorting direction. |
1473 | - if ( 'asc' === $sorting['direction'] ) { |
|
1474 | - $sort_args['dir'] = 'desc'; |
|
1473 | + if ( 'asc' === $sorting[ 'direction' ] ) { |
|
1474 | + $sort_args[ 'dir' ] = 'desc'; |
|
1475 | 1475 | $class .= ' gv-icon-sort-desc'; |
1476 | 1476 | } else { |
1477 | - $sort_args['dir'] = 'asc'; |
|
1477 | + $sort_args[ 'dir' ] = 'asc'; |
|
1478 | 1478 | $class .= ' gv-icon-sort-asc'; |
1479 | 1479 | } |
1480 | 1480 | } else { |
1481 | 1481 | $class .= ' gv-icon-caret-up-down'; |
1482 | 1482 | } |
1483 | 1483 | |
1484 | - $url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) ); |
|
1484 | + $url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) ); |
|
1485 | 1485 | |
1486 | - return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a> '. $label; |
|
1486 | + return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a> ' . $label; |
|
1487 | 1487 | |
1488 | 1488 | } |
1489 | 1489 | |
@@ -1501,7 +1501,7 @@ discard block |
||
1501 | 1501 | |
1502 | 1502 | $field_type = $field_id; |
1503 | 1503 | |
1504 | - if( is_numeric( $field_id ) ) { |
|
1504 | + if ( is_numeric( $field_id ) ) { |
|
1505 | 1505 | $field = GFFormsModel::get_field( $form, $field_id ); |
1506 | 1506 | $field_type = $field->type; |
1507 | 1507 | } |
@@ -1524,7 +1524,7 @@ discard block |
||
1524 | 1524 | return false; |
1525 | 1525 | } |
1526 | 1526 | |
1527 | - return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
1527 | + return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
1528 | 1528 | |
1529 | 1529 | } |
1530 | 1530 |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | $disapproved_result = $wpdb->query( $wpdb->prepare( $sql, GravityView_Entry_Approval_Status::DISAPPROVED, '0' ) ); |
65 | 65 | |
66 | - if( false === $approved_result || false === $disapproved_result ) { |
|
66 | + if ( false === $approved_result || false === $disapproved_result ) { |
|
67 | 67 | do_action( 'gravityview_log_error', __METHOD__ . ': There was an error processing the query.', $wpdb->last_error ); |
68 | 68 | } else { |
69 | 69 | // All done: Meta values are migrated |
@@ -96,11 +96,11 @@ discard block |
||
96 | 96 | $redux_settings = $this->get_redux_settings(); |
97 | 97 | |
98 | 98 | // No need to process |
99 | - if( false === $redux_settings ) { |
|
99 | + if ( false === $redux_settings ) { |
|
100 | 100 | return; |
101 | 101 | } |
102 | 102 | |
103 | - if( empty( $redux_settings['license_key_status'] ) ) { |
|
103 | + if ( empty( $redux_settings[ 'license_key_status' ] ) ) { |
|
104 | 104 | $redux_settings = $this->get_redux_license_status( $redux_settings ); |
105 | 105 | } |
106 | 106 | |
@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | GravityView_Settings::get_instance()->update_app_settings( $updated_settings ); |
115 | 115 | |
116 | 116 | // And now remove the previous option, so this is a one-time thing. |
117 | - delete_option('gravityview_settings'); |
|
118 | - delete_option('gravityview_settings-transients'); |
|
117 | + delete_option( 'gravityview_settings' ); |
|
118 | + delete_option( 'gravityview_settings-transients' ); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
@@ -131,16 +131,16 @@ discard block |
||
131 | 131 | |
132 | 132 | $data = array( |
133 | 133 | 'edd_action' => 'check_license', |
134 | - 'license' => rgget('license_key', $redux_settings ), |
|
134 | + 'license' => rgget( 'license_key', $redux_settings ), |
|
135 | 135 | 'update' => false, |
136 | 136 | 'format' => 'object', |
137 | 137 | ); |
138 | 138 | |
139 | 139 | $license_call = GravityView_Settings::get_instance()->get_license_handler()->license_call( $data ); |
140 | 140 | |
141 | - if( is_object( $license_call ) && isset( $license_call->license ) ) { |
|
142 | - $redux_settings['license_key_status'] = $license_call->license; |
|
143 | - $redux_settings['license_key_response'] = json_encode( $license_call ); |
|
141 | + if ( is_object( $license_call ) && isset( $license_call->license ) ) { |
|
142 | + $redux_settings[ 'license_key_status' ] = $license_call->license; |
|
143 | + $redux_settings[ 'license_key_response' ] = json_encode( $license_call ); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | return $redux_settings; |
@@ -154,10 +154,10 @@ discard block |
||
154 | 154 | function get_redux_settings() { |
155 | 155 | |
156 | 156 | // Previous settings set by Redux |
157 | - $redux_option = get_option('gravityview_settings'); |
|
157 | + $redux_option = get_option( 'gravityview_settings' ); |
|
158 | 158 | |
159 | 159 | // No Redux settings? Don't proceed. |
160 | - if( false === $redux_option ) { |
|
160 | + if ( false === $redux_option ) { |
|
161 | 161 | return false; |
162 | 162 | } |
163 | 163 | |
@@ -167,21 +167,21 @@ discard block |
||
167 | 167 | 'no-conflict-mode' => ( rgget( 'no-conflict-mode', $redux_option ) ? '1' : '0' ), |
168 | 168 | ); |
169 | 169 | |
170 | - if( $license_array = rgget( 'license', $redux_option ) ) { |
|
170 | + if ( $license_array = rgget( 'license', $redux_option ) ) { |
|
171 | 171 | |
172 | - $redux_settings['license_key'] = $license_key = rgget( 'license', $license_array ); |
|
172 | + $redux_settings[ 'license_key' ] = $license_key = rgget( 'license', $license_array ); |
|
173 | 173 | |
174 | - $redux_last_changed_values = get_option('gravityview_settings-transients'); |
|
174 | + $redux_last_changed_values = get_option( 'gravityview_settings-transients' ); |
|
175 | 175 | |
176 | 176 | // This contains the last response for license validation |
177 | - if( !empty( $redux_last_changed_values ) && $saved_values = rgget( 'changed_values', $redux_last_changed_values ) ) { |
|
177 | + if ( ! empty( $redux_last_changed_values ) && $saved_values = rgget( 'changed_values', $redux_last_changed_values ) ) { |
|
178 | 178 | |
179 | - $saved_license = rgget('license', $saved_values ); |
|
179 | + $saved_license = rgget( 'license', $saved_values ); |
|
180 | 180 | |
181 | 181 | // Only use the last-saved values if they are for the same license |
182 | - if( $saved_license && rgget( 'license', $saved_license ) === $license_key ) { |
|
183 | - $redux_settings['license_key_status'] = rgget( 'status', $saved_license ); |
|
184 | - $redux_settings['license_key_response'] = rgget( 'response', $saved_license ); |
|
182 | + if ( $saved_license && rgget( 'license', $saved_license ) === $license_key ) { |
|
183 | + $redux_settings[ 'license_key_status' ] = rgget( 'status', $saved_license ); |
|
184 | + $redux_settings[ 'license_key_response' ] = rgget( 'response', $saved_license ); |
|
185 | 185 | } |
186 | 186 | } |
187 | 187 | } |
@@ -193,8 +193,8 @@ discard block |
||
193 | 193 | /** ---- Migrate from old search widget to new search widget ---- */ |
194 | 194 | function update_search_on_views() { |
195 | 195 | |
196 | - if( !class_exists('GravityView_Widget_Search') ) { |
|
197 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/search-widget/class-search-widget.php' ); |
|
196 | + if ( ! class_exists( 'GravityView_Widget_Search' ) ) { |
|
197 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/search-widget/class-search-widget.php' ); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | // Loop through all the views |
@@ -206,20 +206,20 @@ discard block |
||
206 | 206 | |
207 | 207 | $views = get_posts( $query_args ); |
208 | 208 | |
209 | - foreach( $views as $view ) { |
|
209 | + foreach ( $views as $view ) { |
|
210 | 210 | |
211 | 211 | $widgets = gravityview_get_directory_widgets( $view->ID ); |
212 | 212 | $search_fields = null; |
213 | 213 | |
214 | - if( empty( $widgets ) || !is_array( $widgets ) ) { continue; } |
|
214 | + if ( empty( $widgets ) || ! is_array( $widgets ) ) { continue; } |
|
215 | 215 | |
216 | 216 | do_action( 'gravityview_log_debug', '[GravityView_Migrate/update_search_on_views] Loading View ID: ', $view->ID ); |
217 | 217 | |
218 | - foreach( $widgets as $area => $ws ) { |
|
219 | - foreach( $ws as $k => $widget ) { |
|
220 | - if( $widget['id'] !== 'search_bar' ) { continue; } |
|
218 | + foreach ( $widgets as $area => $ws ) { |
|
219 | + foreach ( $ws as $k => $widget ) { |
|
220 | + if ( $widget[ 'id' ] !== 'search_bar' ) { continue; } |
|
221 | 221 | |
222 | - if( is_null( $search_fields ) ) { |
|
222 | + if ( is_null( $search_fields ) ) { |
|
223 | 223 | $search_fields = $this->get_search_fields( $view->ID ); |
224 | 224 | } |
225 | 225 | |
@@ -227,24 +227,24 @@ discard block |
||
227 | 227 | // [search_free] => 1 |
228 | 228 | // [search_date] => 1 |
229 | 229 | $search_generic = array(); |
230 | - if( !empty( $widget['search_free'] ) ) { |
|
231 | - $search_generic[] = array( 'field' => 'search_all', 'input' => 'input_text' ); |
|
230 | + if ( ! empty( $widget[ 'search_free' ] ) ) { |
|
231 | + $search_generic[ ] = array( 'field' => 'search_all', 'input' => 'input_text' ); |
|
232 | 232 | } |
233 | - if( !empty( $widget['search_date'] ) ) { |
|
234 | - $search_generic[] = array( 'field' => 'entry_date', 'input' => 'date' ); |
|
233 | + if ( ! empty( $widget[ 'search_date' ] ) ) { |
|
234 | + $search_generic[ ] = array( 'field' => 'entry_date', 'input' => 'date' ); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | $search_config = array_merge( $search_generic, $search_fields ); |
238 | 238 | |
239 | 239 | // don't throw '[]' when json_encode an empty array |
240 | - if( empty( $search_config ) ) { |
|
240 | + if ( empty( $search_config ) ) { |
|
241 | 241 | $search_config = ''; |
242 | 242 | } else { |
243 | 243 | $search_config = json_encode( $search_config ); |
244 | 244 | } |
245 | 245 | |
246 | - $widgets[ $area ][ $k ]['search_fields'] = $search_config; |
|
247 | - $widgets[ $area ][ $k ]['search_layout'] = 'horizontal'; |
|
246 | + $widgets[ $area ][ $k ][ 'search_fields' ] = $search_config; |
|
247 | + $widgets[ $area ][ $k ][ 'search_layout' ] = 'horizontal'; |
|
248 | 248 | |
249 | 249 | do_action( 'gravityview_log_debug', '[GravityView_Migrate/update_search_on_views] Updated Widget: ', $widgets[ $area ][ $k ] ); |
250 | 250 | } |
@@ -272,26 +272,26 @@ discard block |
||
272 | 272 | // check view fields' settings |
273 | 273 | $fields = gravityview_get_directory_fields( $view_id, false ); |
274 | 274 | |
275 | - if( !empty( $fields ) && is_array( $fields ) ) { |
|
275 | + if ( ! empty( $fields ) && is_array( $fields ) ) { |
|
276 | 276 | |
277 | - foreach( $fields as $t => $fs ) { |
|
277 | + foreach ( $fields as $t => $fs ) { |
|
278 | 278 | |
279 | - foreach( $fs as $k => $field ) { |
|
279 | + foreach ( $fs as $k => $field ) { |
|
280 | 280 | // is field a search_filter ? |
281 | - if( empty( $field['search_filter'] ) ) { continue; } |
|
281 | + if ( empty( $field[ 'search_filter' ] ) ) { continue; } |
|
282 | 282 | |
283 | 283 | // get field type & calculate the input type (by default) |
284 | - $form_field = gravityview_get_field( $form, $field['id'] ); |
|
284 | + $form_field = gravityview_get_field( $form, $field[ 'id' ] ); |
|
285 | 285 | |
286 | - if( empty( $form_field['type'] ) ) { |
|
286 | + if ( empty( $form_field[ 'type' ] ) ) { |
|
287 | 287 | continue; |
288 | 288 | } |
289 | 289 | |
290 | 290 | // depending on the field type assign a group of possible search field types |
291 | - $type = GravityView_Widget_Search::get_search_input_types( $field['id'], $form_field['type'] ); |
|
291 | + $type = GravityView_Widget_Search::get_search_input_types( $field[ 'id' ], $form_field[ 'type' ] ); |
|
292 | 292 | |
293 | 293 | // add field to config |
294 | - $search_fields[] = array( 'field' => $field['id'], 'input' => $type ); |
|
294 | + $search_fields[ ] = array( 'field' => $field[ 'id' ], 'input' => $type ); |
|
295 | 295 | |
296 | 296 | } |
297 | 297 | } |
@@ -57,7 +57,7 @@ |
||
57 | 57 | |
58 | 58 | $table_name = GFFormsModel::get_lead_meta_table_name(); |
59 | 59 | |
60 | - $sql = "UPDATE {$table_name} SET `meta_value` = %s WHERE `meta_key` = 'is_approved' AND `meta_value` = %s"; |
|
60 | + $sql = "update {$table_name} SET `meta_value` = %s WHERE `meta_key` = 'is_approved' AND `meta_value` = %s"; |
|
61 | 61 | |
62 | 62 | $approved_result = $wpdb->query( $wpdb->prepare( $sql, GravityView_Entry_Approval_Status::APPROVED, 'Approved' ) ); |
63 | 63 |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | * @param int $entry_id ID of the Gravity Forms entry |
325 | 325 | * @param string $status String whether entry is approved or not. `0` for not approved, `Approved` for approved. |
326 | 326 | * @param int $form_id ID of the form of the entry being updated. Improves query performance. |
327 | - * @param string $approvedcolumn Gravity Forms Field ID |
|
327 | + * @param integer $approvedcolumn Gravity Forms Field ID |
|
328 | 328 | * |
329 | 329 | * @return true|WP_Error |
330 | 330 | */ |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | * @access public |
417 | 417 | * @static |
418 | 418 | * @param mixed $form GF Form or Form ID |
419 | - * @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. |
|
419 | + * @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. |
|
420 | 420 | */ |
421 | 421 | static public function get_approved_column( $form ) { |
422 | 422 |
@@ -39,13 +39,13 @@ discard block |
||
39 | 39 | private function add_hooks() { |
40 | 40 | |
41 | 41 | // in case entry is edited (on admin or frontend) |
42 | - add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2); |
|
42 | + add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2 ); |
|
43 | 43 | |
44 | 44 | // when using the User opt-in field, check on entry submission |
45 | 45 | add_action( 'gform_after_submission', array( $this, 'after_submission' ), 10, 2 ); |
46 | 46 | |
47 | 47 | // process ajax approve entry requests |
48 | - add_action('wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved')); |
|
48 | + add_action( 'wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved' ) ); |
|
49 | 49 | |
50 | 50 | } |
51 | 51 | |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public static function get_entry_status( $entry, $value_or_label = 'label' ) { |
64 | 64 | |
65 | - $entry_id = is_array( $entry ) ? $entry['id'] : GVCommon::get_entry_id( $entry ); |
|
65 | + $entry_id = is_array( $entry ) ? $entry[ 'id' ] : GVCommon::get_entry_id( $entry ); |
|
66 | 66 | |
67 | 67 | $status = gform_get_meta( $entry_id, self::meta_key ); |
68 | 68 | |
69 | 69 | $status = GravityView_Entry_Approval_Status::maybe_convert_status( $status ); |
70 | 70 | |
71 | - if( 'value' === $value_or_label ) { |
|
71 | + if ( 'value' === $value_or_label ) { |
|
72 | 72 | return $status; |
73 | 73 | } |
74 | 74 | |
@@ -93,16 +93,16 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function ajax_update_approved() { |
95 | 95 | |
96 | - $form_id = intval( rgpost('form_id') ); |
|
96 | + $form_id = intval( rgpost( 'form_id' ) ); |
|
97 | 97 | |
98 | - $entry_id = GVCommon::get_entry_id( rgpost('entry_slug') ); |
|
98 | + $entry_id = GVCommon::get_entry_id( rgpost( 'entry_slug' ) ); |
|
99 | 99 | |
100 | - $approval_status = rgpost('approved'); |
|
100 | + $approval_status = rgpost( 'approved' ); |
|
101 | 101 | |
102 | - $nonce = rgpost('nonce'); |
|
102 | + $nonce = rgpost( 'nonce' ); |
|
103 | 103 | |
104 | 104 | // Valid status |
105 | - if( ! GravityView_Entry_Approval_Status::is_valid( $approval_status ) ) { |
|
105 | + if ( ! GravityView_Entry_Approval_Status::is_valid( $approval_status ) ) { |
|
106 | 106 | |
107 | 107 | do_action( 'gravityview_log_error', __METHOD__ . ': Invalid approval status', $_POST ); |
108 | 108 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | |
134 | 134 | do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' ); |
135 | 135 | |
136 | - $result = new WP_Error( 'Missing Cap: gravityview_moderate_entries', __( 'You do not have permission to edit this entry.', 'gravityview') ); |
|
136 | + $result = new WP_Error( 'Missing Cap: gravityview_moderate_entries', __( 'You do not have permission to edit this entry.', 'gravityview' ) ); |
|
137 | 137 | |
138 | 138 | } |
139 | 139 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | * @param $form array Gravity Forms form object |
167 | 167 | */ |
168 | 168 | public function after_submission( $entry, $form ) { |
169 | - $this->after_update_entry_update_approved_meta( $form , $entry['id'] ); |
|
169 | + $this->after_update_entry_update_approved_meta( $form, $entry[ 'id' ] ); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
@@ -180,18 +180,18 @@ discard block |
||
180 | 180 | */ |
181 | 181 | public function after_update_entry_update_approved_meta( $form, $entry_id = NULL ) { |
182 | 182 | |
183 | - $approved_column = self::get_approved_column( $form['id'] ); |
|
183 | + $approved_column = self::get_approved_column( $form[ 'id' ] ); |
|
184 | 184 | |
185 | 185 | /** |
186 | 186 | * If the form doesn't contain the approve field, don't assume anything. |
187 | 187 | */ |
188 | - if( empty( $approved_column ) ) { |
|
188 | + if ( empty( $approved_column ) ) { |
|
189 | 189 | return; |
190 | 190 | } |
191 | 191 | |
192 | 192 | $entry = GFAPI::get_entry( $entry_id ); |
193 | 193 | |
194 | - self::update_approved_meta( $entry_id, $entry[ (string)$approved_column ], $form['id'] ); |
|
194 | + self::update_approved_meta( $entry_id, $entry[ (string)$approved_column ], $form[ 'id' ] ); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | /** |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | |
231 | 231 | $success = true; |
232 | 232 | foreach ( $entries as $entry_id ) { |
233 | - $update_success = self::update_approved( (int) $entry_id, $approved, $form_id, $approved_column_id ); |
|
233 | + $update_success = self::update_approved( (int)$entry_id, $approved, $form_id, $approved_column_id ); |
|
234 | 234 | |
235 | 235 | if ( ! $update_success ) { |
236 | 236 | $success = false; |
@@ -256,12 +256,12 @@ discard block |
||
256 | 256 | */ |
257 | 257 | public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0 ) { |
258 | 258 | |
259 | - if( !class_exists( 'GFAPI' ) ) { |
|
259 | + if ( ! class_exists( 'GFAPI' ) ) { |
|
260 | 260 | do_action( 'gravityview_log_error', __METHOD__ . 'GFAPI does not exist' ); |
261 | 261 | return false; |
262 | 262 | } |
263 | 263 | |
264 | - if( ! GravityView_Entry_Approval_Status::is_valid( $approved ) ) { |
|
264 | + if ( ! GravityView_Entry_Approval_Status::is_valid( $approved ) ) { |
|
265 | 265 | do_action( 'gravityview_log_error', __METHOD__ . ': Not a valid approval value.' ); |
266 | 266 | return false; |
267 | 267 | } |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | // If the form has an Approve/Reject field, update that value |
279 | 279 | $result = self::update_approved_column( $entry_id, $approved, $form_id, $approvedcolumn ); |
280 | 280 | |
281 | - if( is_wp_error( $result ) ) { |
|
281 | + if ( is_wp_error( $result ) ) { |
|
282 | 282 | do_action( 'gravityview_log_error', __METHOD__ . sprintf( ' - Entry approval not updated: %s', $result->get_error_message() ) ); |
283 | 283 | return false; |
284 | 284 | } |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | |
291 | 291 | // add note to entry if approval field updating worked or there was no approved field |
292 | 292 | // There's no validation for the meta |
293 | - if( true === $result ) { |
|
293 | + if ( true === $result ) { |
|
294 | 294 | |
295 | 295 | // Add an entry note |
296 | 296 | self::add_approval_status_updated_note( $entry_id, $approved ); |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | |
344 | 344 | $note_id = false; |
345 | 345 | |
346 | - if( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) { |
|
346 | + if ( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) { |
|
347 | 347 | |
348 | 348 | $current_user = wp_get_current_user(); |
349 | 349 | |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | */ |
366 | 366 | private static function update_approved_column( $entry_id = 0, $status = '0', $form_id = 0, $approvedcolumn = 0 ) { |
367 | 367 | |
368 | - if( empty( $approvedcolumn ) ) { |
|
368 | + if ( empty( $approvedcolumn ) ) { |
|
369 | 369 | $approvedcolumn = self::get_approved_column( $form_id ); |
370 | 370 | } |
371 | 371 | |
@@ -413,16 +413,16 @@ discard block |
||
413 | 413 | private static function update_approved_meta( $entry_id, $status, $form_id = 0 ) { |
414 | 414 | |
415 | 415 | if ( ! GravityView_Entry_Approval_Status::is_valid( $status ) ) { |
416 | - do_action('gravityview_log_error', __METHOD__ . ': $is_approved not valid value', $status ); |
|
416 | + do_action( 'gravityview_log_error', __METHOD__ . ': $is_approved not valid value', $status ); |
|
417 | 417 | return; |
418 | 418 | } |
419 | 419 | |
420 | 420 | $status = GravityView_Entry_Approval_Status::maybe_convert_status( $status ); |
421 | 421 | |
422 | 422 | // update entry meta |
423 | - if( function_exists('gform_update_meta') ) { |
|
423 | + if ( function_exists( 'gform_update_meta' ) ) { |
|
424 | 424 | |
425 | - if( GravityView_Entry_Approval_Status::is_unapproved( $status ) ) { |
|
425 | + if ( GravityView_Entry_Approval_Status::is_unapproved( $status ) ) { |
|
426 | 426 | gform_delete_meta( $entry_id, self::meta_key ); |
427 | 427 | } else { |
428 | 428 | gform_update_meta( $entry_id, self::meta_key, $status, $form_id ); |
@@ -445,11 +445,11 @@ discard block |
||
445 | 445 | * @since 1.18 Added "unapproved" |
446 | 446 | * @param int $entry_id ID of the Gravity Forms entry |
447 | 447 | */ |
448 | - do_action( 'gravityview/approve_entries/' . $action , $entry_id ); |
|
448 | + do_action( 'gravityview/approve_entries/' . $action, $entry_id ); |
|
449 | 449 | |
450 | 450 | } else { |
451 | 451 | |
452 | - do_action('gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' ); |
|
452 | + do_action( 'gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' ); |
|
453 | 453 | |
454 | 454 | } |
455 | 455 | } |
@@ -464,29 +464,29 @@ discard block |
||
464 | 464 | */ |
465 | 465 | static public function get_approved_column( $form ) { |
466 | 466 | |
467 | - if( empty( $form ) ) { |
|
467 | + if ( empty( $form ) ) { |
|
468 | 468 | return null; |
469 | 469 | } |
470 | 470 | |
471 | - if( !is_array( $form ) ) { |
|
471 | + if ( ! is_array( $form ) ) { |
|
472 | 472 | $form = GVCommon::get_form( $form ); |
473 | 473 | } |
474 | 474 | |
475 | - foreach( $form['fields'] as $key => $field ) { |
|
475 | + foreach ( $form[ 'fields' ] as $key => $field ) { |
|
476 | 476 | |
477 | - $field = (array) $field; |
|
477 | + $field = (array)$field; |
|
478 | 478 | |
479 | - if( !empty( $field['gravityview_approved'] ) ) { |
|
480 | - if( !empty($field['inputs'][0]['id']) ) { |
|
481 | - return $field['inputs'][0]['id']; |
|
479 | + if ( ! empty( $field[ 'gravityview_approved' ] ) ) { |
|
480 | + if ( ! empty( $field[ 'inputs' ][ 0 ][ 'id' ] ) ) { |
|
481 | + return $field[ 'inputs' ][ 0 ][ 'id' ]; |
|
482 | 482 | } |
483 | 483 | } |
484 | 484 | |
485 | 485 | // Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work.. |
486 | - if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) { |
|
487 | - foreach ( $field['inputs'] as $key2 => $input ) { |
|
488 | - if ( strtolower( $input['label'] ) == 'approved' ) { |
|
489 | - return $input['id']; |
|
486 | + if ( 'checkbox' == $field[ 'type' ] && isset( $field[ 'inputs' ] ) && is_array( $field[ 'inputs' ] ) ) { |
|
487 | + foreach ( $field[ 'inputs' ] as $key2 => $input ) { |
|
488 | + if ( strtolower( $input[ 'label' ] ) == 'approved' ) { |
|
489 | + return $input[ 'id' ]; |
|
490 | 490 | } |
491 | 491 | } |
492 | 492 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public static function getInstance() { |
74 | 74 | |
75 | - if( empty( self::$instance ) ) { |
|
75 | + if ( empty( self::$instance ) ) { |
|
76 | 76 | self::$instance = new self; |
77 | 77 | } |
78 | 78 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | self::require_files(); |
85 | 85 | |
86 | - if( ! GravityView_Compatibility::is_valid() ) { |
|
86 | + if ( ! GravityView_Compatibility::is_valid() ) { |
|
87 | 87 | return; |
88 | 88 | } |
89 | 89 | |
@@ -98,14 +98,14 @@ discard block |
||
98 | 98 | */ |
99 | 99 | private static function require_files() { |
100 | 100 | require_once( GRAVITYVIEW_DIR . 'includes/helper-functions.php' ); |
101 | - require_once( GRAVITYVIEW_DIR . 'includes/class-common.php'); |
|
102 | - require_once( GRAVITYVIEW_DIR . 'includes/connector-functions.php'); |
|
101 | + require_once( GRAVITYVIEW_DIR . 'includes/class-common.php' ); |
|
102 | + require_once( GRAVITYVIEW_DIR . 'includes/connector-functions.php' ); |
|
103 | 103 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-compatibility.php' ); |
104 | 104 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-roles-capabilities.php' ); |
105 | 105 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-admin-notices.php' ); |
106 | - require_once( GRAVITYVIEW_DIR .'includes/class-admin.php' ); |
|
107 | - require_once( GRAVITYVIEW_DIR . 'includes/class-post-types.php'); |
|
108 | - require_once( GRAVITYVIEW_DIR . 'includes/class-cache.php'); |
|
106 | + require_once( GRAVITYVIEW_DIR . 'includes/class-admin.php' ); |
|
107 | + require_once( GRAVITYVIEW_DIR . 'includes/class-post-types.php' ); |
|
108 | + require_once( GRAVITYVIEW_DIR . 'includes/class-cache.php' ); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -138,22 +138,22 @@ discard block |
||
138 | 138 | } |
139 | 139 | |
140 | 140 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-approval-status.php' ); |
141 | - include_once( GRAVITYVIEW_DIR .'includes/class-gravityview-entry-approval.php' ); |
|
141 | + include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-approval.php' ); |
|
142 | 142 | |
143 | - include_once( GRAVITYVIEW_DIR .'includes/class-gravityview-entry-notes.php' ); |
|
144 | - include_once( GRAVITYVIEW_DIR .'includes/load-plugin-and-theme-hooks.php' ); |
|
143 | + include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-notes.php' ); |
|
144 | + include_once( GRAVITYVIEW_DIR . 'includes/load-plugin-and-theme-hooks.php' ); |
|
145 | 145 | |
146 | 146 | // Load Extensions |
147 | 147 | // @todo: Convert to a scan of the directory or a method where this all lives |
148 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/edit-entry/class-edit-entry.php' ); |
|
149 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/delete-entry/class-delete-entry.php' ); |
|
150 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/entry-notes/class-gravityview-field-notes.php' ); |
|
148 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/edit-entry/class-edit-entry.php' ); |
|
149 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/delete-entry/class-delete-entry.php' ); |
|
150 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/entry-notes/class-gravityview-field-notes.php' ); |
|
151 | 151 | |
152 | 152 | // Load WordPress Widgets |
153 | - include_once( GRAVITYVIEW_DIR .'includes/wordpress-widgets/register-wordpress-widgets.php' ); |
|
153 | + include_once( GRAVITYVIEW_DIR . 'includes/wordpress-widgets/register-wordpress-widgets.php' ); |
|
154 | 154 | |
155 | 155 | // Load GravityView Widgets |
156 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/register-gravityview-widgets.php' ); |
|
156 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/register-gravityview-widgets.php' ); |
|
157 | 157 | |
158 | 158 | // Add oEmbed |
159 | 159 | include_once( GRAVITYVIEW_DIR . 'includes/class-oembed.php' ); |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | include_once( GRAVITYVIEW_DIR . 'includes/class-frontend-views.php' ); |
167 | 167 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-admin-bar.php' ); |
168 | 168 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-list.php' ); |
169 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-merge-tags.php'); /** @since 1.8.4 */ |
|
169 | + include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-merge-tags.php' ); /** @since 1.8.4 */ |
|
170 | 170 | include_once( GRAVITYVIEW_DIR . 'includes/class-data.php' ); |
171 | 171 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-shortcode.php' ); |
172 | 172 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-link-shortcode.php' ); |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * @return bool |
182 | 182 | */ |
183 | 183 | public static function is_network_activated() { |
184 | - return is_multisite() && ( function_exists('is_plugin_active_for_network') && is_plugin_active_for_network( 'gravityview/gravityview.php' ) ); |
|
184 | + return is_multisite() && ( function_exists( 'is_plugin_active_for_network' ) && is_plugin_active_for_network( 'gravityview/gravityview.php' ) ); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | * @since 1.7.5.1 |
247 | 247 | */ |
248 | 248 | public static function include_widget_class() { |
249 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget.php' ); |
|
249 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget.php' ); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | } |
269 | 269 | if ( ! $loaded ) { |
270 | 270 | $locale = apply_filters( 'plugin_locale', get_locale(), 'gravityview' ); |
271 | - $mofile = dirname( __FILE__ ) . '/languages/gravityview-'. $locale .'.mo'; |
|
271 | + $mofile = dirname( __FILE__ ) . '/languages/gravityview-' . $locale . '.mo'; |
|
272 | 272 | load_textdomain( 'gravityview', $mofile ); |
273 | 273 | } |
274 | 274 | |
@@ -299,12 +299,12 @@ discard block |
||
299 | 299 | */ |
300 | 300 | public function frontend_actions( $force = false ) { |
301 | 301 | |
302 | - if( self::is_admin() && ! $force ) { return; } |
|
302 | + if ( self::is_admin() && ! $force ) { return; } |
|
303 | 303 | |
304 | 304 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-image.php' ); |
305 | - include_once( GRAVITYVIEW_DIR .'includes/class-template.php' ); |
|
306 | - include_once( GRAVITYVIEW_DIR .'includes/class-api.php' ); |
|
307 | - include_once( GRAVITYVIEW_DIR .'includes/class-frontend-views.php' ); |
|
305 | + include_once( GRAVITYVIEW_DIR . 'includes/class-template.php' ); |
|
306 | + include_once( GRAVITYVIEW_DIR . 'includes/class-api.php' ); |
|
307 | + include_once( GRAVITYVIEW_DIR . 'includes/class-frontend-views.php' ); |
|
308 | 308 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-change-entry-creator.php' ); |
309 | 309 | |
310 | 310 | |
@@ -329,8 +329,8 @@ discard block |
||
329 | 329 | */ |
330 | 330 | public static function get_default_widget_areas() { |
331 | 331 | $default_areas = array( |
332 | - array( '1-1' => array( array( 'areaid' => 'top', 'title' => __('Top', 'gravityview' ) , 'subtitle' => '' ) ) ), |
|
333 | - array( '1-2' => array( array( 'areaid' => 'left', 'title' => __('Left', 'gravityview') , 'subtitle' => '' ) ), '2-2' => array( array( 'areaid' => 'right', 'title' => __('Right', 'gravityview') , 'subtitle' => '' ) ) ), |
|
332 | + array( '1-1' => array( array( 'areaid' => 'top', 'title' => __( 'Top', 'gravityview' ), 'subtitle' => '' ) ) ), |
|
333 | + array( '1-2' => array( array( 'areaid' => 'left', 'title' => __( 'Left', 'gravityview' ), 'subtitle' => '' ) ), '2-2' => array( array( 'areaid' => 'right', 'title' => __( 'Right', 'gravityview' ), 'subtitle' => '' ) ) ), |
|
334 | 334 | ); |
335 | 335 | |
336 | 336 | /** |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | * @param mixed $data Additional data to display |
349 | 349 | * @return void |
350 | 350 | */ |
351 | - public static function log_debug( $message, $data = null ){ |
|
351 | + public static function log_debug( $message, $data = null ) { |
|
352 | 352 | /** |
353 | 353 | * @action `gravityview_log_debug` Log a debug message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
354 | 354 | * @param string $message Message to display |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | * @param string $message log message |
363 | 363 | * @return void |
364 | 364 | */ |
365 | - public static function log_error( $message, $data = null ){ |
|
365 | + public static function log_error( $message, $data = null ) { |
|
366 | 366 | /** |
367 | 367 | * @action `gravityview_log_error` Log an error message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
368 | 368 | * @param string $message Error message to display |
@@ -373,4 +373,4 @@ discard block |
||
373 | 373 | |
374 | 374 | } // end class GravityView_Plugin |
375 | 375 | |
376 | -add_action('plugins_loaded', array('GravityView_Plugin', 'getInstance'), 1); |
|
376 | +add_action( 'plugins_loaded', array( 'GravityView_Plugin', 'getInstance' ), 1 ); |
@@ -20,12 +20,12 @@ 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 | 31 | add_action( 'wp_ajax_gv_sortable_fields', array( $this, 'get_sortable_fields' ) ); |
@@ -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 | |
@@ -55,15 +55,15 @@ discard block |
||
55 | 55 | /** |
56 | 56 | * @since 1.15.3 |
57 | 57 | */ |
58 | - if( ! GVCommon::has_cap( array( 'publish_gravityviews' ) ) ) { |
|
58 | + if ( ! GVCommon::has_cap( array( 'publish_gravityviews' ) ) ) { |
|
59 | 59 | return; |
60 | 60 | } |
61 | 61 | |
62 | - if( !$this->is_post_editor_screen() ) { |
|
62 | + if ( ! $this->is_post_editor_screen() ) { |
|
63 | 63 | return; |
64 | 64 | } |
65 | 65 | ?> |
66 | - <a href="#TB_inline?width=600&height=800&inlineId=select_gravityview_view" class="thickbox hide-if-no-js 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> |
|
66 | + <a href="#TB_inline?width=600&height=800&inlineId=select_gravityview_view" class="thickbox hide-if-no-js 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> |
|
67 | 67 | <?php |
68 | 68 | |
69 | 69 | } |
@@ -79,16 +79,16 @@ discard block |
||
79 | 79 | function add_shortcode_popup() { |
80 | 80 | global $post; |
81 | 81 | |
82 | - if( !$this->is_post_editor_screen() ) { |
|
82 | + if ( ! $this->is_post_editor_screen() ) { |
|
83 | 83 | return; |
84 | 84 | } |
85 | 85 | |
86 | - $post_type = get_post_type_object($post->post_type); |
|
86 | + $post_type = get_post_type_object( $post->post_type ); |
|
87 | 87 | |
88 | - $views = get_posts( array('post_type' => 'gravityview', 'posts_per_page' => -1 ) ); |
|
88 | + $views = get_posts( array( 'post_type' => 'gravityview', 'posts_per_page' => -1 ) ); |
|
89 | 89 | |
90 | 90 | // If there are no views set up yet, we get outta here. |
91 | - if( empty( $views ) ) { |
|
91 | + if ( empty( $views ) ) { |
|
92 | 92 | echo '<div id="select_gravityview_view"><div class="wrap">' . GravityView_Admin::no_views_text() . '</div></div>'; |
93 | 93 | return; |
94 | 94 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | <div class="wrap"> |
100 | 100 | |
101 | 101 | <h2 class=""><?php esc_html_e( 'Embed a View', 'gravityview' ); ?></h2> |
102 | - <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://docs.gravityview.co/article/73-using-the-shortcode" target="_blank" rel="noopener noreferrer">', '</a>' ); ?></p> |
|
102 | + <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://docs.gravityview.co/article/73-using-the-shortcode" target="_blank" rel="noopener noreferrer">', '</a>' ); ?></p> |
|
103 | 103 | |
104 | 104 | <div> |
105 | 105 | <h3><label for="gravityview_id"><?php esc_html_e( 'Select a View', 'gravityview' ); ?></label></h3> |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | <select name="gravityview_id" id="gravityview_id"> |
108 | 108 | <option value=""><?php esc_html_e( '— Select a View to Insert —', 'gravityview' ); ?></option> |
109 | 109 | <?php |
110 | - foreach( $views as $view ) { |
|
111 | - $title = empty( $view->post_title ) ? __('(no title)', 'gravityview') : $view->post_title; |
|
112 | - echo '<option value="'. $view->ID .'">'. esc_html( sprintf('%s #%d', $title, $view->ID ) ) .'</option>'; |
|
110 | + foreach ( $views as $view ) { |
|
111 | + $title = empty( $view->post_title ) ? __( '(no title)', 'gravityview' ) : $view->post_title; |
|
112 | + echo '<option value="' . $view->ID . '">' . esc_html( sprintf( '%s #%d', $title, $view->ID ) ) . '</option>'; |
|
113 | 113 | } |
114 | 114 | ?> |
115 | 115 | </select> |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | foreach ( $settings as $key => $setting ) { |
127 | 127 | |
128 | - if( empty( $setting['show_in_shortcode'] ) ) { continue; } |
|
128 | + if ( empty( $setting[ 'show_in_shortcode' ] ) ) { continue; } |
|
129 | 129 | |
130 | 130 | GravityView_Render_Settings::render_setting_row( $key, array(), NULL, 'gravityview_%s', 'gravityview_%s' ); |
131 | 131 | } |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | </table> |
135 | 135 | |
136 | 136 | <div class="submit"> |
137 | - <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" /> |
|
138 | - <input class="button button-secondary alignright" type="submit" onclick="tb_remove(); return false;" value="<?php esc_attr_e("Cancel", 'gravityview'); ?>" /> |
|
137 | + <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" /> |
|
138 | + <input class="button button-secondary alignright" type="submit" onclick="tb_remove(); return false;" value="<?php esc_attr_e( "Cancel", 'gravityview' ); ?>" /> |
|
139 | 139 | </div> |
140 | 140 | |
141 | 141 | </div> |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | function add_scripts_and_styles() { |
158 | 158 | |
159 | - if( ! $this->is_post_editor_screen() ) { |
|
159 | + if ( ! $this->is_post_editor_screen() ) { |
|
160 | 160 | return; |
161 | 161 | } |
162 | 162 | |
@@ -167,22 +167,22 @@ discard block |
||
167 | 167 | |
168 | 168 | $protocol = is_ssl() ? 'https://' : 'http://'; |
169 | 169 | |
170 | - 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 ); |
|
170 | + 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 ); |
|
171 | 171 | |
172 | 172 | //enqueue styles |
173 | - wp_register_style( 'gravityview_postedit_styles', plugins_url('assets/css/admin-post-edit.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
173 | + wp_register_style( 'gravityview_postedit_styles', plugins_url( 'assets/css/admin-post-edit.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
174 | 174 | wp_enqueue_style( 'gravityview_postedit_styles' ); |
175 | 175 | |
176 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
176 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
177 | 177 | |
178 | 178 | // custom js |
179 | - 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 ); |
|
179 | + 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 ); |
|
180 | 180 | wp_enqueue_script( 'gravityview_postedit_scripts' ); |
181 | - wp_localize_script('gravityview_postedit_scripts', 'gvGlobals', array( |
|
182 | - 'nonce' => wp_create_nonce( 'gravityview_ajaxaddshortcode'), |
|
181 | + wp_localize_script( 'gravityview_postedit_scripts', 'gvGlobals', array( |
|
182 | + 'nonce' => wp_create_nonce( 'gravityview_ajaxaddshortcode' ), |
|
183 | 183 | 'loading_text' => esc_html__( 'Loading…', 'gravityview' ), |
184 | - 'alert_1' => esc_html__( 'Please select a View', 'gravityview'), |
|
185 | - )); |
|
184 | + 'alert_1' => esc_html__( 'Please select a View', 'gravityview' ), |
|
185 | + ) ); |
|
186 | 186 | |
187 | 187 | } |
188 | 188 | |
@@ -198,16 +198,16 @@ discard block |
||
198 | 198 | function get_sortable_fields() { |
199 | 199 | |
200 | 200 | // Not properly formatted request |
201 | - if ( empty( $_POST['viewid'] ) || !is_numeric( $_POST['viewid'] ) ) { |
|
201 | + if ( empty( $_POST[ 'viewid' ] ) || ! is_numeric( $_POST[ 'viewid' ] ) ) { |
|
202 | 202 | exit( false ); |
203 | 203 | } |
204 | 204 | |
205 | 205 | // Not valid request |
206 | - if( empty( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxaddshortcode' ) ) { |
|
206 | + if ( empty( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxaddshortcode' ) ) { |
|
207 | 207 | exit( false ); |
208 | 208 | } |
209 | 209 | |
210 | - $viewid = (int)$_POST['viewid']; |
|
210 | + $viewid = (int)$_POST[ 'viewid' ]; |
|
211 | 211 | |
212 | 212 | // fetch form id assigned to the view |
213 | 213 | $formid = gravityview_get_form_id( $viewid ); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | function __construct( ) { |
14 | 14 | |
15 | - $name = __('GravityView Recent Entries', 'gravityview'); |
|
15 | + $name = __( 'GravityView Recent Entries', 'gravityview' ); |
|
16 | 16 | |
17 | 17 | $widget_options = array( |
18 | 18 | 'description' => __( 'Display the most recent entries for a View', 'gravityview' ), |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | private function initialize() { |
27 | 27 | |
28 | - add_action('admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts') ); |
|
28 | + add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); |
|
29 | 29 | |
30 | 30 | add_action( 'wp_ajax_gv_get_view_merge_tag_data', array( $this, 'ajax_get_view_merge_tag_data' ) ); |
31 | 31 | |
@@ -38,21 +38,21 @@ discard block |
||
38 | 38 | */ |
39 | 39 | function ajax_get_view_merge_tag_data() { |
40 | 40 | |
41 | - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajax_widget' ) ) { |
|
41 | + if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajax_widget' ) ) { |
|
42 | 42 | exit( false ); |
43 | 43 | } |
44 | 44 | |
45 | - $form_id = gravityview_get_form_id( $_POST['view_id'] ); |
|
45 | + $form_id = gravityview_get_form_id( $_POST[ 'view_id' ] ); |
|
46 | 46 | |
47 | 47 | $form = RGFormsModel::get_form_meta( $form_id ); |
48 | 48 | |
49 | 49 | $output = array( |
50 | 50 | 'form' => array( |
51 | - 'id' => $form['id'], |
|
52 | - 'title' => $form['title'], |
|
53 | - 'fields' => $form['fields'], |
|
51 | + 'id' => $form[ 'id' ], |
|
52 | + 'title' => $form[ 'title' ], |
|
53 | + 'fields' => $form[ 'fields' ], |
|
54 | 54 | ), |
55 | - 'mergeTags' => GFCommon::get_merge_tags( $form['fields'], '', false ), |
|
55 | + 'mergeTags' => GFCommon::get_merge_tags( $form[ 'fields' ], '', false ), |
|
56 | 56 | ); |
57 | 57 | |
58 | 58 | echo json_encode( $output ); |
@@ -68,19 +68,19 @@ discard block |
||
68 | 68 | function admin_enqueue_scripts() { |
69 | 69 | global $pagenow; |
70 | 70 | |
71 | - if( $pagenow === 'widgets.php' ) { |
|
71 | + if ( $pagenow === 'widgets.php' ) { |
|
72 | 72 | |
73 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
73 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
74 | 74 | |
75 | 75 | GravityView_Admin_Views::enqueue_gravity_forms_scripts(); |
76 | 76 | |
77 | - wp_enqueue_script( 'gravityview_widgets', plugins_url('assets/js/admin-widgets'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery', 'gform_gravityforms' ), GravityView_Plugin::version ); |
|
77 | + wp_enqueue_script( 'gravityview_widgets', plugins_url( 'assets/js/admin-widgets' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery', 'gform_gravityforms' ), GravityView_Plugin::version ); |
|
78 | 78 | |
79 | 79 | wp_localize_script( 'gravityview_widgets', 'GVWidgets', array( |
80 | 80 | 'nonce' => wp_create_nonce( 'gravityview_ajax_widget' ) |
81 | - )); |
|
81 | + ) ); |
|
82 | 82 | |
83 | - wp_enqueue_style( 'gravityview_views_styles', plugins_url('assets/css/admin-views.css', GRAVITYVIEW_FILE), array('dashicons' ), GravityView_Plugin::version ); |
|
83 | + wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons' ), GravityView_Plugin::version ); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | } |
@@ -95,19 +95,19 @@ discard block |
||
95 | 95 | function widget( $args, $instance ) { |
96 | 96 | |
97 | 97 | // Don't have the Customizer render too soon. |
98 | - if( empty( $instance['view_id'] ) ) { |
|
98 | + if ( empty( $instance[ 'view_id' ] ) ) { |
|
99 | 99 | return; |
100 | 100 | } |
101 | 101 | |
102 | - $args['id'] = ( isset( $args['id'] ) ) ? $args['id'] : 'gv_recent_entries'; |
|
103 | - $instance['title'] = ( isset( $instance['title'] ) ) ? $instance['title'] : ''; |
|
102 | + $args[ 'id' ] = ( isset( $args[ 'id' ] ) ) ? $args[ 'id' ] : 'gv_recent_entries'; |
|
103 | + $instance[ 'title' ] = ( isset( $instance[ 'title' ] ) ) ? $instance[ 'title' ] : ''; |
|
104 | 104 | |
105 | - $title = apply_filters( 'widget_title', $instance[ 'title' ], $instance, $args['id'] ); |
|
105 | + $title = apply_filters( 'widget_title', $instance[ 'title' ], $instance, $args[ 'id' ] ); |
|
106 | 106 | |
107 | - echo $args['before_widget']; |
|
107 | + echo $args[ 'before_widget' ]; |
|
108 | 108 | |
109 | - if ( !empty( $title ) ) { |
|
110 | - echo $args['before_title'] . $title . $args['after_title']; |
|
109 | + if ( ! empty( $title ) ) { |
|
110 | + echo $args[ 'before_title' ] . $title . $args[ 'after_title' ]; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | do_action( 'gravityview/widget/recent-entries/after_widget', $args, $instance ); |
129 | 129 | |
130 | - echo $args['after_widget']; |
|
130 | + echo $args[ 'after_widget' ]; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | */ |
142 | 142 | private function get_output( $instance ) { |
143 | 143 | |
144 | - $form_id = gravityview_get_form_id( $instance['view_id'] ); |
|
144 | + $form_id = gravityview_get_form_id( $instance[ 'view_id' ] ); |
|
145 | 145 | |
146 | 146 | $form = gravityview_get_form( $form_id ); |
147 | 147 | |
@@ -151,13 +151,13 @@ discard block |
||
151 | 151 | * @since 1.6.1 |
152 | 152 | * @var int $entry_link_post_id The ID to use as the parent post for the entry |
153 | 153 | */ |
154 | - $entry_link_post_id = ( empty( $instance['error_post_id'] ) && !empty( $instance['post_id'] ) ) ? $instance['post_id'] : $instance['view_id']; |
|
154 | + $entry_link_post_id = ( empty( $instance[ 'error_post_id' ] ) && ! empty( $instance[ 'post_id' ] ) ) ? $instance[ 'post_id' ] : $instance[ 'view_id' ]; |
|
155 | 155 | |
156 | 156 | /** |
157 | 157 | * Generate list output |
158 | 158 | * @since 1.7.2 |
159 | 159 | */ |
160 | - $List = new GravityView_Entry_List( $entries, $entry_link_post_id, $form, $instance['link_format'], $instance['after_link'], 'recent-entries-widget' ); |
|
160 | + $List = new GravityView_Entry_List( $entries, $entry_link_post_id, $form, $instance[ 'link_format' ], $instance[ 'after_link' ], 'recent-entries-widget' ); |
|
161 | 161 | |
162 | 162 | $output = $List->get_output(); |
163 | 163 | |
@@ -182,30 +182,30 @@ discard block |
||
182 | 182 | private function get_entries( $instance, $form_id ) { |
183 | 183 | |
184 | 184 | // Get the settings for the View ID |
185 | - $view_settings = gravityview_get_template_settings( $instance['view_id'] ); |
|
185 | + $view_settings = gravityview_get_template_settings( $instance[ 'view_id' ] ); |
|
186 | 186 | |
187 | 187 | // Set the context view ID to avoid conflicts with the Advanced Filter extension. |
188 | - $criteria['context_view_id'] = $instance['view_id']; |
|
188 | + $criteria[ 'context_view_id' ] = $instance[ 'view_id' ]; |
|
189 | 189 | |
190 | - $instance['limit'] = isset( $instance['limit'] ) ? $instance['limit'] : 10; |
|
191 | - $view_settings['id'] = $instance['view_id']; |
|
192 | - $view_settings['page_size'] = $instance['limit']; |
|
190 | + $instance[ 'limit' ] = isset( $instance[ 'limit' ] ) ? $instance[ 'limit' ] : 10; |
|
191 | + $view_settings[ 'id' ] = $instance[ 'view_id' ]; |
|
192 | + $view_settings[ 'page_size' ] = $instance[ 'limit' ]; |
|
193 | 193 | |
194 | 194 | // Prepare paging criteria |
195 | - $criteria['paging'] = array( |
|
195 | + $criteria[ 'paging' ] = array( |
|
196 | 196 | 'offset' => 0, |
197 | - 'page_size' => $instance['limit'] |
|
197 | + 'page_size' => $instance[ 'limit' ] |
|
198 | 198 | ); |
199 | 199 | |
200 | 200 | // Prepare Search Criteria |
201 | - $criteria['search_criteria'] = array( 'field_filters' => array() ); |
|
202 | - $criteria['search_criteria'] = GravityView_frontend::process_search_only_approved( $view_settings, $criteria['search_criteria']); |
|
203 | - $criteria['search_criteria']['status'] = apply_filters( 'gravityview_status', 'active', $view_settings ); |
|
201 | + $criteria[ 'search_criteria' ] = array( 'field_filters' => array() ); |
|
202 | + $criteria[ 'search_criteria' ] = GravityView_frontend::process_search_only_approved( $view_settings, $criteria[ 'search_criteria' ] ); |
|
203 | + $criteria[ 'search_criteria' ][ 'status' ] = apply_filters( 'gravityview_status', 'active', $view_settings ); |
|
204 | 204 | |
205 | 205 | /** |
206 | 206 | * Modify the search parameters before the entries are fetched |
207 | 207 | */ |
208 | - $criteria = apply_filters('gravityview/widget/recent-entries/criteria', $criteria, $instance, $form_id ); |
|
208 | + $criteria = apply_filters( 'gravityview/widget/recent-entries/criteria', $criteria, $instance, $form_id ); |
|
209 | 209 | |
210 | 210 | $results = GVCommon::get_entries( $form_id, $criteria ); |
211 | 211 | |
@@ -226,23 +226,23 @@ discard block |
||
226 | 226 | $instance = $new_instance; |
227 | 227 | |
228 | 228 | // Force positive number |
229 | - $instance['limit'] = empty( $instance['limit'] ) ? 10 : absint( $instance['limit'] ); |
|
229 | + $instance[ 'limit' ] = empty( $instance[ 'limit' ] ) ? 10 : absint( $instance[ 'limit' ] ); |
|
230 | 230 | |
231 | - $instance['view_id'] = intval( $instance['view_id'] ); |
|
231 | + $instance[ 'view_id' ] = intval( $instance[ 'view_id' ] ); |
|
232 | 232 | |
233 | - $instance['link_format'] = trim( rtrim( $instance['link_format'] ) ); |
|
233 | + $instance[ 'link_format' ] = trim( rtrim( $instance[ 'link_format' ] ) ); |
|
234 | 234 | |
235 | - $instance['link_format'] = empty( $instance['link_format'] ) ? $old_instance['link_format'] : $instance['link_format']; |
|
235 | + $instance[ 'link_format' ] = empty( $instance[ 'link_format' ] ) ? $old_instance[ 'link_format' ] : $instance[ 'link_format' ]; |
|
236 | 236 | |
237 | - $instance['post_id'] = empty( $instance['post_id'] ) ? '' : intval( $instance['post_id'] ); |
|
237 | + $instance[ 'post_id' ] = empty( $instance[ 'post_id' ] ) ? '' : intval( $instance[ 'post_id' ] ); |
|
238 | 238 | |
239 | - $is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance['post_id'], $instance['view_id'] ); |
|
239 | + $is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance[ 'post_id' ], $instance[ 'view_id' ] ); |
|
240 | 240 | |
241 | 241 | //check if post_id is a valid post with embedded View |
242 | - $instance['error_post_id'] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL; |
|
242 | + $instance[ 'error_post_id' ] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL; |
|
243 | 243 | |
244 | 244 | // Share that the widget isn't brand new |
245 | - $instance['updated'] = 1; |
|
245 | + $instance[ 'updated' ] = 1; |
|
246 | 246 | |
247 | 247 | /** |
248 | 248 | * Modify the updated instance. This will allow for validating any added instance settings externally. |
@@ -264,22 +264,22 @@ discard block |
||
264 | 264 | |
265 | 265 | // Set up some default widget settings. |
266 | 266 | $defaults = array( |
267 | - 'title' => __('Recent Entries', 'gravityview'), |
|
267 | + 'title' => __( 'Recent Entries', 'gravityview' ), |
|
268 | 268 | 'view_id' => NULL, |
269 | 269 | 'post_id' => NULL, |
270 | 270 | 'limit' => 10, |
271 | - 'link_format' => __('Entry #{entry_id}', 'gravityview'), |
|
271 | + 'link_format' => __( 'Entry #{entry_id}', 'gravityview' ), |
|
272 | 272 | 'after_link' => '' |
273 | 273 | ); |
274 | 274 | |
275 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
275 | + $instance = wp_parse_args( (array)$instance, $defaults ); |
|
276 | 276 | |
277 | 277 | ?> |
278 | 278 | |
279 | 279 | <!-- Title --> |
280 | 280 | <p> |
281 | 281 | <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:', 'gravityview' ) ?></label> |
282 | - <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" /> |
|
282 | + <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance[ 'title' ] ); ?>" /> |
|
283 | 283 | </p> |
284 | 284 | |
285 | 285 | <!-- Download --> |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | $views = get_posts( $args ); |
293 | 293 | |
294 | 294 | // If there are no views set up yet, we get outta here. |
295 | - if( empty( $views ) ) { |
|
295 | + if ( empty( $views ) ) { |
|
296 | 296 | echo '<div id="select_gravityview_view"><div class="wrap">' . GravityView_Admin::no_views_text() . '</div></div>'; |
297 | 297 | return; |
298 | 298 | } |
@@ -304,10 +304,10 @@ discard block |
||
304 | 304 | * Display errors generated for invalid embed IDs |
305 | 305 | * @see GravityView_View_Data::is_valid_embed_id |
306 | 306 | */ |
307 | - if( isset( $instance['updated'] ) && empty( $instance['view_id'] ) ) { |
|
307 | + if ( isset( $instance[ 'updated' ] ) && empty( $instance[ 'view_id' ] ) ) { |
|
308 | 308 | ?> |
309 | 309 | <div class="error inline hide-on-view-change"> |
310 | - <p><?php esc_html_e('Please select a View to search.', 'gravityview'); ?></p> |
|
310 | + <p><?php esc_html_e( 'Please select a View to search.', 'gravityview' ); ?></p> |
|
311 | 311 | </div> |
312 | 312 | <?php |
313 | 313 | unset ( $error ); |
@@ -315,14 +315,14 @@ discard block |
||
315 | 315 | ?> |
316 | 316 | |
317 | 317 | <p> |
318 | - <label for="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>"><?php esc_html_e('Select a View', 'gravityview'); ?></label> |
|
318 | + <label for="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>"><?php esc_html_e( 'Select a View', 'gravityview' ); ?></label> |
|
319 | 319 | <select class="widefat gv-recent-entries-select-view" name="<?php echo esc_attr( $this->get_field_name( 'view_id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>"> |
320 | 320 | <option value=""><?php esc_html_e( '— Select a View as Entries Source —', 'gravityview' ); ?></option> |
321 | 321 | <?php |
322 | 322 | |
323 | - foreach( $views as $view ) { |
|
324 | - $title = empty( $view->post_title ) ? __('(no title)', 'gravityview') : $view->post_title; |
|
325 | - echo '<option value="'. $view->ID .'"'.selected( absint( $instance['view_id'] ), $view->ID ).'>'. esc_html( sprintf('%s #%d', $title, $view->ID ) ) .'</option>'; |
|
323 | + foreach ( $views as $view ) { |
|
324 | + $title = empty( $view->post_title ) ? __( '(no title)', 'gravityview' ) : $view->post_title; |
|
325 | + echo '<option value="' . $view->ID . '"' . selected( absint( $instance[ 'view_id' ] ), $view->ID ) . '>' . esc_html( sprintf( '%s #%d', $title, $view->ID ) ) . '</option>'; |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | ?> |
@@ -334,10 +334,10 @@ discard block |
||
334 | 334 | * Display errors generated for invalid embed IDs |
335 | 335 | * @see GravityView_View_Data::is_valid_embed_id |
336 | 336 | */ |
337 | - if( !empty( $instance['error_post_id'] ) ) { |
|
337 | + if ( ! empty( $instance[ 'error_post_id' ] ) ) { |
|
338 | 338 | ?> |
339 | 339 | <div class="error inline"> |
340 | - <p><?php echo $instance['error_post_id']; ?></p> |
|
340 | + <p><?php echo $instance[ 'error_post_id' ]; ?></p> |
|
341 | 341 | </div> |
342 | 342 | <?php |
343 | 343 | unset ( $error ); |
@@ -345,11 +345,11 @@ discard block |
||
345 | 345 | ?> |
346 | 346 | |
347 | 347 | <p> |
348 | - <label for="<?php echo $this->get_field_id('post_id'); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label> |
|
349 | - <input class="code" size="3" id="<?php echo $this->get_field_id('post_id'); ?>" name="<?php echo $this->get_field_name('post_id'); ?>" type="text" value="<?php echo esc_attr( $instance['post_id'] ); ?>" /> |
|
348 | + <label for="<?php echo $this->get_field_id( 'post_id' ); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label> |
|
349 | + <input class="code" size="3" id="<?php echo $this->get_field_id( 'post_id' ); ?>" name="<?php echo $this->get_field_name( 'post_id' ); ?>" type="text" value="<?php echo esc_attr( $instance[ 'post_id' ] ); ?>" /> |
|
350 | 350 | <span class="howto"><?php |
351 | - esc_html_e('To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' ); |
|
352 | - echo ' '.gravityview_get_link('http://docs.gravityview.co/article/222-the-search-widget', __('Learn more…', 'gravityview' ), 'target=_blank' ); |
|
351 | + esc_html_e( 'To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' ); |
|
352 | + echo ' ' . gravityview_get_link( 'http://docs.gravityview.co/article/222-the-search-widget', __( 'Learn more…', 'gravityview' ), 'target=_blank' ); |
|
353 | 353 | ?></span> |
354 | 354 | </p> |
355 | 355 | |
@@ -357,21 +357,21 @@ discard block |
||
357 | 357 | <label for="<?php echo $this->get_field_id( 'limit' ); ?>"> |
358 | 358 | <span><?php _e( 'Number of entries to show:', 'gravityview' ); ?></span> |
359 | 359 | </label> |
360 | - <input class="code" id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="number" value="<?php echo intval( $instance['limit'] ); ?>" size="3" /> |
|
360 | + <input class="code" id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="number" value="<?php echo intval( $instance[ 'limit' ] ); ?>" size="3" /> |
|
361 | 361 | </p> |
362 | 362 | |
363 | 363 | <p> |
364 | 364 | <label for="<?php echo $this->get_field_id( 'link_format' ); ?>"> |
365 | 365 | <span><?php _e( 'Entry link text (required)', 'gravityview' ); ?></span> |
366 | 366 | </label> |
367 | - <input id="<?php echo $this->get_field_id( 'link_format' ); ?>" name="<?php echo $this->get_field_name( 'link_format' ); ?>" type="text" value="<?php echo esc_attr( $instance['link_format'] ); ?>" class="widefat merge-tag-support mt-position-right mt-hide_all_fields" /> |
|
367 | + <input id="<?php echo $this->get_field_id( 'link_format' ); ?>" name="<?php echo $this->get_field_name( 'link_format' ); ?>" type="text" value="<?php echo esc_attr( $instance[ 'link_format' ] ); ?>" class="widefat merge-tag-support mt-position-right mt-hide_all_fields" /> |
|
368 | 368 | </p> |
369 | 369 | |
370 | 370 | <p> |
371 | 371 | <label for="<?php echo $this->get_field_id( 'after_link' ); ?>"> |
372 | 372 | <span><?php _e( 'Text or HTML to display after the link (optional)', 'gravityview' ); ?></span> |
373 | 373 | </label> |
374 | - <textarea id="<?php echo $this->get_field_id( 'after_link' ); ?>" name="<?php echo $this->get_field_name( 'after_link' ); ?>" rows="5" class="widefat code merge-tag-support mt-position-right mt-hide_all_fields"><?php echo esc_textarea( $instance['after_link'] ); ?></textarea> |
|
374 | + <textarea id="<?php echo $this->get_field_id( 'after_link' ); ?>" name="<?php echo $this->get_field_name( 'after_link' ); ?>" rows="5" class="widefat code merge-tag-support mt-position-right mt-hide_all_fields"><?php echo esc_textarea( $instance[ 'after_link' ] ); ?></textarea> |
|
375 | 375 | </p> |
376 | 376 | |
377 | 377 | <?php |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | * @param GravityView_Recent_Entries_Widget $this WP_Widget object |
382 | 382 | * @param array $instance Current widget instance |
383 | 383 | */ |
384 | - do_action( 'gravityview_recent_entries_widget_form' , $this, $instance ); |
|
384 | + do_action( 'gravityview_recent_entries_widget_form', $this, $instance ); |
|
385 | 385 | |
386 | 386 | ?> |
387 | 387 |