@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | ?> |
15 | 15 | |
16 | -<form class="gv-widget-search <?php echo GravityView_Widget_Search::get_search_class(); ?>" method="get" action="<?php echo esc_url( GravityView_Widget_Search::get_search_form_action() ); ?>"> |
|
16 | +<form class="gv-widget-search <?php echo GravityView_Widget_Search::get_search_class(); ?>" method="get" action="<?php echo esc_url(GravityView_Widget_Search::get_search_form_action()); ?>"> |
|
17 | 17 | |
18 | 18 | <?php |
19 | 19 | |
@@ -21,14 +21,14 @@ discard block |
||
21 | 21 | * @action `gravityview_search_widget_fields_before` Inside the `<form>` tag of the GravityView search form, before inputs are rendered |
22 | 22 | * @param GravityView_Widget_Search $this GravityView Widget instance |
23 | 23 | */ |
24 | - do_action( 'gravityview_search_widget_fields_before', $this ); |
|
24 | + do_action('gravityview_search_widget_fields_before', $this); |
|
25 | 25 | |
26 | - foreach( $this->search_fields as $search_field ) { |
|
26 | + foreach ($this->search_fields as $search_field) { |
|
27 | 27 | $gravityview_view->search_field = $search_field; |
28 | - $this->render( 'search-field', $search_field['input'], false ); |
|
28 | + $this->render('search-field', $search_field['input'], false); |
|
29 | 29 | |
30 | 30 | // show/hide the search button if there are input type fields |
31 | - if( !$has_inputs && $search_field['input'] != 'link' ) { |
|
31 | + if (!$has_inputs && $search_field['input'] != 'link') { |
|
32 | 32 | $has_inputs = true; |
33 | 33 | } |
34 | 34 | } |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | * @action `gravityview_search_widget_fields_after` Inside the `<form>` tag of the GravityView search form, after inputs are rendered |
38 | 38 | * @param GravityView_Widget_Search $this GravityView Widget instance |
39 | 39 | */ |
40 | - do_action( 'gravityview_search_widget_fields_after', $this ); |
|
40 | + do_action('gravityview_search_widget_fields_after', $this); |
|
41 | 41 | |
42 | - if( $has_inputs ) { ?> |
|
42 | + if ($has_inputs) { ?> |
|
43 | 43 | <div class="gv-search-box gv-search-box-submit"> |
44 | 44 | <?php |
45 | 45 | |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | GravityView_Widget_Search::the_clear_search_button(); |
48 | 48 | |
49 | 49 | ?> |
50 | - <input type="hidden" name="mode" value="<?php echo esc_attr( $gravityview_view->search_mode ); ?>" /> |
|
51 | - <input type="submit" class="button gv-search-button" id="gv_search_button_<?php echo $view_id; ?>" value="<?php esc_attr_e( 'Search', 'gravityview' ); ?>" /> |
|
50 | + <input type="hidden" name="mode" value="<?php echo esc_attr($gravityview_view->search_mode); ?>" /> |
|
51 | + <input type="submit" class="button gv-search-button" id="gv_search_button_<?php echo $view_id; ?>" value="<?php esc_attr_e('Search', 'gravityview'); ?>" /> |
|
52 | 52 | </div> |
53 | 53 | <?php } ?> |
54 | 54 | </form> |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Display the Search widget |
|
4 | - * |
|
5 | - * @see class-search-widget.php |
|
6 | - */ |
|
3 | + * Display the Search widget |
|
4 | + * |
|
5 | + * @see class-search-widget.php |
|
6 | + */ |
|
7 | 7 | |
8 | 8 | $gravityview_view = GravityView_View::getInstance(); |
9 | 9 |
@@ -11,75 +11,75 @@ discard block |
||
11 | 11 | |
12 | 12 | $widget_ops = array( |
13 | 13 | 'classname' => 'widget_gravityview_search', |
14 | - 'description' => __( 'A search form for a specific GravityView.', 'gravityview') |
|
14 | + 'description' => __('A search form for a specific GravityView.', 'gravityview') |
|
15 | 15 | ); |
16 | 16 | |
17 | 17 | $widget_display = array( |
18 | 18 | 'width' => 650 |
19 | 19 | ); |
20 | 20 | |
21 | - parent::__construct( 'gravityview_search', __( 'GravityView Search', 'gravityview' ), $widget_ops, $widget_display ); |
|
21 | + parent::__construct('gravityview_search', __('GravityView Search', 'gravityview'), $widget_ops, $widget_display); |
|
22 | 22 | |
23 | 23 | $this->load_required_files(); |
24 | 24 | |
25 | 25 | $gravityview_widget = GravityView_Widget_Search::getInstance(); |
26 | 26 | |
27 | 27 | // frontend - filter entries |
28 | - add_filter( 'gravityview_fe_search_criteria', array( $gravityview_widget, 'filter_entries' ), 10, 1 ); |
|
28 | + add_filter('gravityview_fe_search_criteria', array($gravityview_widget, 'filter_entries'), 10, 1); |
|
29 | 29 | |
30 | 30 | // frontend - add template path |
31 | - add_filter( 'gravityview_template_paths', array( $gravityview_widget, 'add_template_path' ) ); |
|
31 | + add_filter('gravityview_template_paths', array($gravityview_widget, 'add_template_path')); |
|
32 | 32 | |
33 | - unset( $gravityview_widget ); |
|
33 | + unset($gravityview_widget); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | private function load_required_files() { |
37 | - if( !class_exists( 'GravityView_Widget_Search' ) ) { |
|
37 | + if (!class_exists('GravityView_Widget_Search')) { |
|
38 | 38 | gravityview_register_gravityview_widgets(); |
39 | 39 | } |
40 | 40 | } |
41 | 41 | |
42 | - public function widget( $args, $instance ) { |
|
42 | + public function widget($args, $instance) { |
|
43 | 43 | |
44 | 44 | // Don't show unless a View ID has been set. |
45 | - if( empty( $instance['view_id'] ) ) { |
|
45 | + if (empty($instance['view_id'])) { |
|
46 | 46 | |
47 | - do_action('gravityview_log_debug', sprintf( '%s[widget]: No View ID has been defined. Not showing the widget.', get_class($this)), $instance ); |
|
47 | + do_action('gravityview_log_debug', sprintf('%s[widget]: No View ID has been defined. Not showing the widget.', get_class($this)), $instance); |
|
48 | 48 | |
49 | 49 | return; |
50 | 50 | } |
51 | 51 | |
52 | 52 | /** This filter is documented in wp-includes/default-widgets.php */ |
53 | - $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); |
|
53 | + $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); |
|
54 | 54 | |
55 | 55 | echo $args['before_widget']; |
56 | 56 | |
57 | - if ( $title ) { |
|
58 | - echo $args['before_title'] . $title . $args['after_title']; |
|
57 | + if ($title) { |
|
58 | + echo $args['before_title'].$title.$args['after_title']; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | // @todo Add to the widget configuration form |
62 | - $instance['search_layout'] = apply_filters( 'gravityview/widget/search/layout', 'vertical', $instance ); |
|
62 | + $instance['search_layout'] = apply_filters('gravityview/widget/search/layout', 'vertical', $instance); |
|
63 | 63 | |
64 | 64 | $instance['context'] = 'wp_widget'; |
65 | 65 | |
66 | 66 | // form |
67 | - $instance['form_id'] = GVCommon::get_meta_form_id( $instance['view_id'] ); |
|
68 | - $instance['form'] = GVCommon::get_form( $instance['form_id'] ); |
|
67 | + $instance['form_id'] = GVCommon::get_meta_form_id($instance['view_id']); |
|
68 | + $instance['form'] = GVCommon::get_form($instance['form_id']); |
|
69 | 69 | |
70 | 70 | // We don't want to overwrite existing context, etc. |
71 | 71 | $previous_view = GravityView_View::getInstance(); |
72 | 72 | |
73 | 73 | /** @hack */ |
74 | - new GravityView_View( $instance ); |
|
74 | + new GravityView_View($instance); |
|
75 | 75 | |
76 | - GravityView_Widget_Search::getInstance()->render_frontend( $instance ); |
|
76 | + GravityView_Widget_Search::getInstance()->render_frontend($instance); |
|
77 | 77 | |
78 | 78 | /** |
79 | 79 | * Restore previous View context |
80 | 80 | * @hack |
81 | 81 | */ |
82 | - new GravityView_View( $previous_view ); |
|
82 | + new GravityView_View($previous_view); |
|
83 | 83 | |
84 | 84 | echo $args['after_widget']; |
85 | 85 | } |
@@ -87,11 +87,11 @@ discard block |
||
87 | 87 | /** |
88 | 88 | * @inheritDoc |
89 | 89 | */ |
90 | - public function update( $new_instance, $old_instance ) { |
|
90 | + public function update($new_instance, $old_instance) { |
|
91 | 91 | |
92 | 92 | $instance = $old_instance; |
93 | 93 | |
94 | - if( $this->is_preview() ) { |
|
94 | + if ($this->is_preview()) { |
|
95 | 95 | //Oh! Sorry but still not fully compatible with customizer |
96 | 96 | return $instance; |
97 | 97 | } |
@@ -104,21 +104,21 @@ discard block |
||
104 | 104 | 'search_clear' => 0 |
105 | 105 | ); |
106 | 106 | |
107 | - $new_instance = wp_parse_args( (array) $new_instance, $defaults ); |
|
107 | + $new_instance = wp_parse_args((array)$new_instance, $defaults); |
|
108 | 108 | |
109 | - $instance['title'] = strip_tags( $new_instance['title'] ); |
|
110 | - $instance['view_id'] = absint( $new_instance['view_id'] ); |
|
109 | + $instance['title'] = strip_tags($new_instance['title']); |
|
110 | + $instance['view_id'] = absint($new_instance['view_id']); |
|
111 | 111 | $instance['search_fields'] = $new_instance['search_fields']; |
112 | 112 | $instance['post_id'] = $new_instance['post_id']; |
113 | 113 | $instance['search_clear'] = $new_instance['search_clear']; |
114 | 114 | |
115 | - $is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $new_instance['post_id'], $instance['view_id'] ); |
|
115 | + $is_valid_embed_id = GravityView_View_Data::is_valid_embed_id($new_instance['post_id'], $instance['view_id']); |
|
116 | 116 | |
117 | 117 | //check if post_id is a valid post with embedded View |
118 | - $instance['error_post_id'] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL; |
|
118 | + $instance['error_post_id'] = is_wp_error($is_valid_embed_id) ? $is_valid_embed_id->get_error_message() : NULL; |
|
119 | 119 | |
120 | 120 | // Share that the widget isn't brand new |
121 | - $instance['updated'] = 1; |
|
121 | + $instance['updated'] = 1; |
|
122 | 122 | |
123 | 123 | return $instance; |
124 | 124 | } |
@@ -126,14 +126,14 @@ discard block |
||
126 | 126 | /** |
127 | 127 | * @inheritDoc |
128 | 128 | */ |
129 | - public function form( $instance ) { |
|
129 | + public function form($instance) { |
|
130 | 130 | |
131 | 131 | // @todo Make compatible with Customizer |
132 | - if( $this->is_preview() ) { |
|
132 | + if ($this->is_preview()) { |
|
133 | 133 | |
134 | - $warning = sprintf( esc_html__( 'This widget is not configurable from this screen. Please configure it on the %sWidgets page%s.', 'gravityview' ), '<a href="'.admin_url('widgets.php').'">', '</a>' ); |
|
134 | + $warning = sprintf(esc_html__('This widget is not configurable from this screen. Please configure it on the %sWidgets page%s.', 'gravityview'), '<a href="'.admin_url('widgets.php').'">', '</a>'); |
|
135 | 135 | |
136 | - echo wpautop( GravityView_Admin::get_floaty() . $warning ); |
|
136 | + echo wpautop(GravityView_Admin::get_floaty().$warning); |
|
137 | 137 | |
138 | 138 | return; |
139 | 139 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | 'search_clear' => 0 |
147 | 147 | ); |
148 | 148 | |
149 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
149 | + $instance = wp_parse_args((array)$instance, $defaults); |
|
150 | 150 | |
151 | 151 | $title = $instance['title']; |
152 | 152 | $view_id = $instance['view_id']; |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $views = GVCommon::get_all_views(); |
158 | 158 | |
159 | 159 | // If there are no views set up yet, we get outta here. |
160 | - if( empty( $views ) ) { ?> |
|
160 | + if (empty($views)) { ?> |
|
161 | 161 | <div id="select_gravityview_view"> |
162 | 162 | <div class="wrap"><?php echo GravityView_Post_Types::no_views_text(); ?></div> |
163 | 163 | </div> |
@@ -165,31 +165,31 @@ discard block |
||
165 | 165 | } |
166 | 166 | ?> |
167 | 167 | |
168 | - <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'gravityview'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p> |
|
168 | + <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'gravityview'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></label></p> |
|
169 | 169 | |
170 | 170 | <?php |
171 | 171 | /** |
172 | 172 | * Display errors generated for invalid embed IDs |
173 | 173 | * @see GravityView_View_Data::is_valid_embed_id |
174 | 174 | */ |
175 | - if( isset( $instance['updated'] ) && empty( $instance['view_id'] ) ) { |
|
175 | + if (isset($instance['updated']) && empty($instance['view_id'])) { |
|
176 | 176 | ?> |
177 | 177 | <div class="error inline hide-on-view-change"> |
178 | 178 | <p><?php esc_html_e('Please select a View to search.', 'gravityview'); ?></p> |
179 | 179 | </div> |
180 | 180 | <?php |
181 | - unset ( $error ); |
|
181 | + unset ($error); |
|
182 | 182 | } |
183 | 183 | ?> |
184 | 184 | |
185 | 185 | <p> |
186 | - <label for="gravityview_view_id"><?php _e( 'View:', 'gravityview' ); ?></label> |
|
186 | + <label for="gravityview_view_id"><?php _e('View:', 'gravityview'); ?></label> |
|
187 | 187 | <select id="gravityview_view_id" name="<?php echo $this->get_field_name('view_id'); ?>" class="widefat"> |
188 | - <option value=""><?php esc_html_e( '— Select a View —', 'gravityview' ); ?></option> |
|
188 | + <option value=""><?php esc_html_e('— Select a View —', 'gravityview'); ?></option> |
|
189 | 189 | <?php |
190 | - foreach( $views as $view_option ) { |
|
191 | - $title = empty( $view_option->post_title ) ? __('(no title)', 'gravityview') : $view_option->post_title; |
|
192 | - echo '<option value="'. $view_option->ID .'" ' . selected( esc_attr( $view_id ), $view_option->ID, false ) . '>'. esc_html( sprintf('%s #%d', $title, $view_option->ID ) ) .'</option>'; |
|
190 | + foreach ($views as $view_option) { |
|
191 | + $title = empty($view_option->post_title) ? __('(no title)', 'gravityview') : $view_option->post_title; |
|
192 | + echo '<option value="'.$view_option->ID.'" '.selected(esc_attr($view_id), $view_option->ID, false).'>'.esc_html(sprintf('%s #%d', $title, $view_option->ID)).'</option>'; |
|
193 | 193 | } |
194 | 194 | ?> |
195 | 195 | </select> |
@@ -201,38 +201,38 @@ discard block |
||
201 | 201 | * Display errors generated for invalid embed IDs |
202 | 202 | * @see GravityView_View_Data::is_valid_embed_id |
203 | 203 | */ |
204 | - if( !empty( $instance['error_post_id'] ) ) { |
|
204 | + if (!empty($instance['error_post_id'])) { |
|
205 | 205 | ?> |
206 | 206 | <div class="error inline"> |
207 | 207 | <p><?php echo $instance['error_post_id']; ?></p> |
208 | 208 | </div> |
209 | 209 | <?php |
210 | - unset ( $error ); |
|
210 | + unset ($error); |
|
211 | 211 | } |
212 | 212 | ?> |
213 | 213 | |
214 | 214 | <p> |
215 | - <label for="<?php echo $this->get_field_id('post_id'); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label> |
|
216 | - <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( $post_id ); ?>" /> |
|
215 | + <label for="<?php echo $this->get_field_id('post_id'); ?>"><?php esc_html_e('If Embedded, Page ID:', 'gravityview'); ?></label> |
|
216 | + <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($post_id); ?>" /> |
|
217 | 217 | <span class="howto"><?php |
218 | - 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' ); |
|
219 | - echo ' '.gravityview_get_link('http://docs.gravityview.co/article/222-the-search-widget', __('Learn more…', 'gravityview' ), 'target=_blank' ); |
|
218 | + 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'); |
|
219 | + echo ' '.gravityview_get_link('http://docs.gravityview.co/article/222-the-search-widget', __('Learn more…', 'gravityview'), 'target=_blank'); |
|
220 | 220 | ?></span> |
221 | 221 | </p> |
222 | 222 | |
223 | 223 | <p> |
224 | - <label for="<?php echo $this->get_field_id('search_clear'); ?>"><?php esc_html_e( 'Show Clear button', 'gravityview' ); ?>:</label> |
|
224 | + <label for="<?php echo $this->get_field_id('search_clear'); ?>"><?php esc_html_e('Show Clear button', 'gravityview'); ?>:</label> |
|
225 | 225 | <input name="<?php echo $this->get_field_name('search_clear'); ?>" type="hidden" value="0"> |
226 | - <input id="<?php echo $this->get_field_id('search_clear'); ?>" name="<?php echo $this->get_field_name('search_clear'); ?>" type="checkbox" class="checkbox" value="1" <?php checked( $search_clear, 1, true ); ?>> |
|
226 | + <input id="<?php echo $this->get_field_id('search_clear'); ?>" name="<?php echo $this->get_field_name('search_clear'); ?>" type="checkbox" class="checkbox" value="1" <?php checked($search_clear, 1, true); ?>> |
|
227 | 227 | </p> |
228 | 228 | |
229 | 229 | <hr /> |
230 | 230 | |
231 | 231 | <?php // @todo: move style to CSS ?> |
232 | 232 | <div style="margin-bottom: 1em;"> |
233 | - <label class="screen-reader-text" for="<?php echo $this->get_field_id('search_fields'); ?>"><?php _e( 'Searchable fields:', 'gravityview' ); ?></label> |
|
233 | + <label class="screen-reader-text" for="<?php echo $this->get_field_id('search_fields'); ?>"><?php _e('Searchable fields:', 'gravityview'); ?></label> |
|
234 | 234 | <div class="gv-widget-search-fields" title="<?php esc_html_e('Search Fields', 'gravityview'); ?>"> |
235 | - <input id="<?php echo $this->get_field_id('search_fields'); ?>" name="<?php echo $this->get_field_name('search_fields'); ?>" type="hidden" value="<?php echo esc_attr( $search_fields ); ?>" class="gv-search-fields-value"> |
|
235 | + <input id="<?php echo $this->get_field_id('search_fields'); ?>" name="<?php echo $this->get_field_name('search_fields'); ?>" type="hidden" value="<?php echo esc_attr($search_fields); ?>" class="gv-search-fields-value"> |
|
236 | 236 | </div> |
237 | 237 | |
238 | 238 | </div> |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | <script> |
241 | 241 | // When the widget is saved or added, refresh the Merge Tags (here for backward compatibility) |
242 | 242 | // WordPress 3.9 added widget-added and widget-updated actions |
243 | - jQuery('#<?php echo $this->get_field_id( 'view_id' ); ?>').trigger( 'change' ); |
|
243 | + jQuery('#<?php echo $this->get_field_id('view_id'); ?>').trigger( 'change' ); |
|
244 | 244 | </script> |
245 | 245 | <?php |
246 | 246 | } |
@@ -21,14 +21,14 @@ |
||
21 | 21 | function gravityview_register_widgets() { |
22 | 22 | |
23 | 23 | /** @define "GRAVITYVIEW_DIR" "../../" */ |
24 | - require_once( GRAVITYVIEW_DIR . 'includes/wordpress-widgets/class-gravityview-recent-entries-widget.php' ); |
|
24 | + require_once(GRAVITYVIEW_DIR.'includes/wordpress-widgets/class-gravityview-recent-entries-widget.php'); |
|
25 | 25 | |
26 | - register_widget( 'GravityView_Recent_Entries_Widget' ); |
|
26 | + register_widget('GravityView_Recent_Entries_Widget'); |
|
27 | 27 | |
28 | - require_once( GRAVITYVIEW_DIR . 'includes/wordpress-widgets/class-gravityview-search-wp-widget.php' ); |
|
28 | + require_once(GRAVITYVIEW_DIR.'includes/wordpress-widgets/class-gravityview-search-wp-widget.php'); |
|
29 | 29 | |
30 | - register_widget( 'GravityView_Search_WP_Widget' ); |
|
30 | + register_widget('GravityView_Search_WP_Widget'); |
|
31 | 31 | |
32 | 32 | } |
33 | 33 | |
34 | -add_action( 'widgets_init', 'gravityview_register_widgets' ); |
|
35 | 34 | \ No newline at end of file |
35 | +add_action('widgets_init', 'gravityview_register_widgets'); |
|
36 | 36 | \ No newline at end of file |
@@ -25,7 +25,7 @@ |
||
25 | 25 | if( !isset( $field_settings['show_map_link'] ) || !empty( $field_settings['show_map_link'] ) ){ |
26 | 26 | |
27 | 27 | // Add the map link as another line |
28 | - $value_with_newline .= "\n" . gravityview_get_map_link( $value_with_newline ); |
|
28 | + $value_with_newline .= "\n" . gravityview_get_map_link( $value_with_newline ); |
|
29 | 29 | |
30 | 30 | } |
31 | 31 |
@@ -9,31 +9,31 @@ |
||
9 | 9 | |
10 | 10 | $gravityview_view = GravityView_View::getInstance(); |
11 | 11 | |
12 | -extract( $gravityview_view->getCurrentField() ); |
|
12 | +extract($gravityview_view->getCurrentField()); |
|
13 | 13 | |
14 | 14 | // If it's the full address |
15 | -if( floor( $field_id ) === floatval( $field_id ) ) { |
|
15 | +if (floor($field_id) === floatval($field_id)) { |
|
16 | 16 | |
17 | 17 | // @todo Implement the `gform_disable_address_map_link` filter (boolean) added in GF 1.9 to enable/disable map link |
18 | 18 | // Use Gravity Forms' method to get the full address. |
19 | 19 | // Pass the `text` parameter so the map link isn't added like when passing `html` |
20 | - $value_with_newline = GFCommon::get_lead_field_display( $field, $value, "", false, 'text' ); |
|
20 | + $value_with_newline = GFCommon::get_lead_field_display($field, $value, "", false, 'text'); |
|
21 | 21 | |
22 | - if( empty( $value_with_newline ) ) { return; } |
|
22 | + if (empty($value_with_newline)) { return; } |
|
23 | 23 | |
24 | 24 | // Add map link if it's not set (default, back compat) or if it's set to yes |
25 | - if( !isset( $field_settings['show_map_link'] ) || !empty( $field_settings['show_map_link'] ) ){ |
|
25 | + if (!isset($field_settings['show_map_link']) || !empty($field_settings['show_map_link'])) { |
|
26 | 26 | |
27 | 27 | // Add the map link as another line |
28 | - $value_with_newline .= "\n" . gravityview_get_map_link( $value_with_newline ); |
|
28 | + $value_with_newline .= "\n".gravityview_get_map_link($value_with_newline); |
|
29 | 29 | |
30 | 30 | } |
31 | 31 | |
32 | 32 | // Full address without the "Map It" link |
33 | - echo str_replace("\n", '<br />', $value_with_newline ); |
|
33 | + echo str_replace("\n", '<br />', $value_with_newline); |
|
34 | 34 | |
35 | 35 | } else { |
36 | 36 | |
37 | - echo gravityview_get_field_value( $entry, $field_id, $display_value ); |
|
37 | + echo gravityview_get_field_value($entry, $field_id, $display_value); |
|
38 | 38 | |
39 | 39 | } |
@@ -9,9 +9,9 @@ discard block |
||
9 | 9 | |
10 | 10 | $gravityview_view = GravityView_View::getInstance(); |
11 | 11 | |
12 | -extract( $gravityview_view->getCurrentField() ); |
|
12 | +extract($gravityview_view->getCurrentField()); |
|
13 | 13 | |
14 | -if( in_array( $field['type'], array( 'radio', 'checkbox' ) ) && !empty( $entry[ $field_id ] ) ) { |
|
14 | +if (in_array($field['type'], array('radio', 'checkbox')) && !empty($entry[$field_id])) { |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * @filter `gravityview_field_tick` Change the output for a checkbox "check" symbol. Default is dashicons-yes icon |
@@ -20,10 +20,10 @@ discard block |
||
20 | 20 | * @param array $entry Gravity Forms entry array |
21 | 21 | * @param array $field GravityView field array |
22 | 22 | */ |
23 | - $output = apply_filters( 'gravityview_field_tick', '<span class="dashicons dashicons-yes"></span>', $entry, $field); |
|
23 | + $output = apply_filters('gravityview_field_tick', '<span class="dashicons dashicons-yes"></span>', $entry, $field); |
|
24 | 24 | |
25 | 25 | } else { |
26 | - $output = gravityview_get_field_value( $entry, $field_id, $display_value ); |
|
26 | + $output = gravityview_get_field_value($entry, $field_id, $display_value); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | echo $output; |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Checkbox field output |
|
4 | - * |
|
5 | - * @package GravityView |
|
6 | - * @subpackage GravityView/templates/fields |
|
7 | - * |
|
8 | - */ |
|
3 | + * Checkbox field output |
|
4 | + * |
|
5 | + * @package GravityView |
|
6 | + * @subpackage GravityView/templates/fields |
|
7 | + * |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | $gravityview_view = GravityView_View::getInstance(); |
11 | 11 |
@@ -8,10 +8,10 @@ discard block |
||
8 | 8 | |
9 | 9 | $gravityview_view = GravityView_View::getInstance(); |
10 | 10 | |
11 | -extract( $gravityview_view->getCurrentField() ); |
|
11 | +extract($gravityview_view->getCurrentField()); |
|
12 | 12 | |
13 | 13 | // There was no logged in user. |
14 | -if( empty( $value ) ) { |
|
14 | +if (empty($value)) { |
|
15 | 15 | return; |
16 | 16 | } |
17 | 17 | |
@@ -19,6 +19,6 @@ discard block |
||
19 | 19 | $User = get_userdata($value); |
20 | 20 | |
21 | 21 | // Display the user data, based on the settings `id`, `username`, or `display_name` |
22 | -$name_display = empty( $field_settings['name_display'] ) ? 'display_name' : $field_settings['name_display']; |
|
22 | +$name_display = empty($field_settings['name_display']) ? 'display_name' : $field_settings['name_display']; |
|
23 | 23 | |
24 | 24 | echo $User->{$name_display}; |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Display the created_by field type |
|
4 | - * |
|
5 | - * @package GravityView |
|
6 | - * @subpackage GravityView/templates/fields |
|
7 | - */ |
|
3 | + * Display the created_by field type |
|
4 | + * |
|
5 | + * @package GravityView |
|
6 | + * @subpackage GravityView/templates/fields |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | $gravityview_view = GravityView_View::getInstance(); |
10 | 10 |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | |
10 | 10 | $gravityview_view = GravityView_View::getInstance(); |
11 | 11 | |
12 | -extract( $gravityview_view->getCurrentField() ); |
|
12 | +extract($gravityview_view->getCurrentField()); |
|
13 | 13 | |
14 | 14 | // Make sure the class is loaded in DataTables |
15 | -if( !class_exists( 'GFFormDisplay' ) ) { |
|
16 | - include_once( GFCommon::get_base_path() . '/form_display.php' ); |
|
15 | +if (!class_exists('GFFormDisplay')) { |
|
16 | + include_once(GFCommon::get_base_path().'/form_display.php'); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | // Tell the renderer not to wrap this field in an anchor tag. |
@@ -24,22 +24,22 @@ discard block |
||
24 | 24 | * @since 1.6.2 |
25 | 25 | * @param string $content HTML content of field |
26 | 26 | */ |
27 | -$field_settings['content'] = apply_filters( 'gravityview/fields/custom/content_before', $field_settings['content'] ); |
|
27 | +$field_settings['content'] = apply_filters('gravityview/fields/custom/content_before', $field_settings['content']); |
|
28 | 28 | |
29 | -$field_settings['content'] = trim( rtrim( $field_settings['content'] ) ); |
|
29 | +$field_settings['content'] = trim(rtrim($field_settings['content'])); |
|
30 | 30 | |
31 | 31 | // No custom content |
32 | -if( empty( $field_settings['content'] ) ) { |
|
32 | +if (empty($field_settings['content'])) { |
|
33 | 33 | return; |
34 | 34 | } |
35 | 35 | |
36 | 36 | // Replace the variables |
37 | -$content = GravityView_API::replace_variables( $field_settings['content'], $form, $entry ); |
|
37 | +$content = GravityView_API::replace_variables($field_settings['content'], $form, $entry); |
|
38 | 38 | |
39 | 39 | // Add paragraphs? |
40 | -if( !empty( $field_settings['wpautop'] ) ) { |
|
40 | +if (!empty($field_settings['wpautop'])) { |
|
41 | 41 | |
42 | - $content = wpautop( $content ); |
|
42 | + $content = wpautop($content); |
|
43 | 43 | |
44 | 44 | } |
45 | 45 | |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | * @since 1.6.2 |
49 | 49 | * @param string $content HTML content of field |
50 | 50 | */ |
51 | -$content = apply_filters( 'gravityview/fields/custom/content_after', $content ); |
|
51 | +$content = apply_filters('gravityview/fields/custom/content_after', $content); |
|
52 | 52 | |
53 | 53 | // Enqueue scripts needed for Gravity Form display, if form shortcode exists. |
54 | 54 | // Also runs `do_shortcode()` |
55 | -echo GFCommon::gform_do_shortcode( $content ); |
|
55 | +echo GFCommon::gform_do_shortcode($content); |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Display the HTML field type |
|
4 | - * |
|
5 | - * @package GravityView |
|
6 | - * @subpackage GravityView/templates/fields |
|
7 | - * @since 1.2 |
|
8 | - */ |
|
3 | + * Display the HTML field type |
|
4 | + * |
|
5 | + * @package GravityView |
|
6 | + * @subpackage GravityView/templates/fields |
|
7 | + * @since 1.2 |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | $gravityview_view = GravityView_View::getInstance(); |
11 | 11 |
@@ -8,30 +8,30 @@ discard block |
||
8 | 8 | |
9 | 9 | $gravityview_view = GravityView_View::getInstance(); |
10 | 10 | |
11 | -extract( $gravityview_view->getCurrentField() ); |
|
11 | +extract($gravityview_view->getCurrentField()); |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Unix Epoch probably isn't what you're looking for. |
15 | 15 | * @since 1.7 |
16 | 16 | */ |
17 | -if( $value === '1970-01-01' ) { |
|
17 | +if ($value === '1970-01-01') { |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Return false to show value. Use `__return_false` callback. |
21 | 21 | */ |
22 | - $hide_epoch = apply_filters( 'gravityview/fields/date/hide_epoch', true ); |
|
22 | + $hide_epoch = apply_filters('gravityview/fields/date/hide_epoch', true); |
|
23 | 23 | |
24 | - if( $hide_epoch ) { |
|
24 | + if ($hide_epoch) { |
|
25 | 25 | return; |
26 | 26 | } |
27 | 27 | } |
28 | 28 | |
29 | -if( !empty( $field_settings ) && !empty( $field_settings['date_display'] ) && !empty( $value )) { |
|
29 | +if (!empty($field_settings) && !empty($field_settings['date_display']) && !empty($value)) { |
|
30 | 30 | |
31 | 31 | // If there is a custom PHP date format passed via the date_display setting, |
32 | 32 | // use PHP's date format |
33 | 33 | $format = $field_settings['date_display']; |
34 | - $output = date_i18n( $format, strtotime( $value ) ); |
|
34 | + $output = date_i18n($format, strtotime($value)); |
|
35 | 35 | |
36 | 36 | } else { |
37 | 37 | |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | * @see https://codex.wordpress.org/Formatting_Date_and_Time |
41 | 41 | * @param null|string Date Format (default: $field->dateFormat) |
42 | 42 | */ |
43 | - $format = apply_filters( 'gravityview_date_format', rgar($field, "dateFormat") ); |
|
44 | - $output = GFCommon::date_display( $value, $format ); |
|
43 | + $format = apply_filters('gravityview_date_format', rgar($field, "dateFormat")); |
|
44 | + $output = GFCommon::date_display($value, $format); |
|
45 | 45 | |
46 | 46 | } |
47 | 47 |
@@ -8,17 +8,17 @@ discard block |
||
8 | 8 | |
9 | 9 | $gravityview_view = GravityView_View::getInstance(); |
10 | 10 | |
11 | -extract( $gravityview_view->getCurrentField() ); |
|
11 | +extract($gravityview_view->getCurrentField()); |
|
12 | 12 | |
13 | 13 | // If there's no email, don't bother continuing. |
14 | -if( empty( $value ) ) { |
|
14 | +if (empty($value)) { |
|
15 | 15 | return; |
16 | 16 | } |
17 | 17 | |
18 | 18 | // Default: plain email, no link |
19 | 19 | $output = $value; |
20 | 20 | |
21 | -if( !isset( $field_settings['emailmailto'] ) || !empty( $field_settings['emailmailto'] ) ) { |
|
21 | +if (!isset($field_settings['emailmailto']) || !empty($field_settings['emailmailto'])) { |
|
22 | 22 | |
23 | 23 | $params = array(); |
24 | 24 | |
@@ -26,28 +26,28 @@ discard block |
||
26 | 26 | $link = 'mailto:'.$value; |
27 | 27 | |
28 | 28 | // Is the subject set? |
29 | - if( !empty( $field_settings['emailsubject'] ) ) { |
|
29 | + if (!empty($field_settings['emailsubject'])) { |
|
30 | 30 | |
31 | - $subject = GravityView_API::replace_variables( $field_settings['emailsubject'], $form, $entry ); |
|
31 | + $subject = GravityView_API::replace_variables($field_settings['emailsubject'], $form, $entry); |
|
32 | 32 | |
33 | - $params[] = 'subject='.str_replace('+', '%20', urlencode( $subject ) ); |
|
33 | + $params[] = 'subject='.str_replace('+', '%20', urlencode($subject)); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | // Is the body set? |
37 | - if( !empty( $field_settings['emailbody'] ) ) { |
|
37 | + if (!empty($field_settings['emailbody'])) { |
|
38 | 38 | |
39 | - $body = GravityView_API::replace_variables( $field_settings['emailbody'], $form, $entry ); |
|
39 | + $body = GravityView_API::replace_variables($field_settings['emailbody'], $form, $entry); |
|
40 | 40 | |
41 | - $params[] = 'body='.str_replace('+', '%20', urlencode( $body ) ); |
|
41 | + $params[] = 'body='.str_replace('+', '%20', urlencode($body)); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | // If the subject and body have been set, use them |
45 | - if( !empty( $params) ) { |
|
46 | - $link .= '?'.implode( '&', $params ); |
|
45 | + if (!empty($params)) { |
|
46 | + $link .= '?'.implode('&', $params); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | // Generate the link HTML |
50 | - $output = gravityview_get_link( $link, $value ); |
|
50 | + $output = gravityview_get_link($link, $value); |
|
51 | 51 | |
52 | 52 | } |
53 | 53 | |
@@ -56,12 +56,12 @@ discard block |
||
56 | 56 | * @since 1.1.6 |
57 | 57 | * @var boolean |
58 | 58 | */ |
59 | -$prevent_encrypt = apply_filters( 'gravityview_email_prevent_encrypt', false ); |
|
59 | +$prevent_encrypt = apply_filters('gravityview_email_prevent_encrypt', false); |
|
60 | 60 | |
61 | 61 | // If encrypting the link |
62 | -if( !empty( $field_settings['emailencrypt'] ) && !$prevent_encrypt ) { |
|
62 | +if (!empty($field_settings['emailencrypt']) && !$prevent_encrypt) { |
|
63 | 63 | |
64 | - $output = GVCommon::js_encrypt( $output ); |
|
64 | + $output = GVCommon::js_encrypt($output); |
|
65 | 65 | |
66 | 66 | } |
67 | 67 |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Display the Email field type |
|
4 | - * |
|
5 | - * @package GravityView |
|
6 | - * @subpackage GravityView/templates/fields |
|
7 | - */ |
|
3 | + * Display the Email field type |
|
4 | + * |
|
5 | + * @package GravityView |
|
6 | + * @subpackage GravityView/templates/fields |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | $gravityview_view = GravityView_View::getInstance(); |
10 | 10 |