@@ -10,22 +10,22 @@ |
||
10 | 10 | $search_field = $gravityview_view->search_field; |
11 | 11 | |
12 | 12 | // Make sure that there are choices to display |
13 | -if( empty( $search_field['choices'] ) ) { |
|
14 | - do_action('gravityview_log_debug', 'search-field-radio.php - No choices for field' ); |
|
13 | +if (empty($search_field['choices'])) { |
|
14 | + do_action('gravityview_log_debug', 'search-field-radio.php - No choices for field'); |
|
15 | 15 | return; |
16 | 16 | } |
17 | 17 | |
18 | 18 | ?> |
19 | 19 | <div class="gv-search-box"> |
20 | - <?php if( ! gv_empty( $search_field['label'], false ) ) { ?> |
|
21 | - <label for=search-box-<?php echo esc_attr( $search_field['name'] ); ?>><?php echo esc_html( $search_field['label'] ); ?></label> |
|
20 | + <?php if (!gv_empty($search_field['label'], false)) { ?> |
|
21 | + <label for=search-box-<?php echo esc_attr($search_field['name']); ?>><?php echo esc_html($search_field['label']); ?></label> |
|
22 | 22 | <?php } ?> |
23 | 23 | <p> |
24 | - <?php foreach( $search_field['choices'] as $choice ) { ?> |
|
24 | + <?php foreach ($search_field['choices'] as $choice) { ?> |
|
25 | 25 | |
26 | - <label for="search-box-<?php echo sanitize_html_class( $search_field['name'].$choice['value'].$choice['text'] ); ?>" class="gv-check-radio"> |
|
27 | - <input type="radio" name="<?php echo esc_attr( $search_field['name'] ); ?>" value="<?php echo esc_attr( $choice['value'] ); ?>" id="search-box-<?php echo sanitize_html_class( $search_field['name'].$choice['value'].$choice['text'] ); ?>" <?php checked( $choice['value'], $search_field['value'], true ); ?>> |
|
28 | - <?php echo esc_html( $choice['text'] ); ?> |
|
26 | + <label for="search-box-<?php echo sanitize_html_class($search_field['name'].$choice['value'].$choice['text']); ?>" class="gv-check-radio"> |
|
27 | + <input type="radio" name="<?php echo esc_attr($search_field['name']); ?>" value="<?php echo esc_attr($choice['value']); ?>" id="search-box-<?php echo sanitize_html_class($search_field['name'].$choice['value'].$choice['text']); ?>" <?php checked($choice['value'], $search_field['value'], true); ?>> |
|
28 | + <?php echo esc_html($choice['text']); ?> |
|
29 | 29 | </label> |
30 | 30 | |
31 | 31 | <?php } ?> |
@@ -14,8 +14,8 @@ |
||
14 | 14 | |
15 | 15 | <div class="gv-search-box"> |
16 | 16 | <div class="gv-search"> |
17 | - <?php if( ! gv_empty( $label, false ) ) { ?> |
|
18 | - <label for="gv_search_<?php echo $view_id; ?>"><?php echo esc_html( $label ); ?></label> |
|
17 | + <?php if (!gv_empty($label, false)) { ?> |
|
18 | + <label for="gv_search_<?php echo $view_id; ?>"><?php echo esc_html($label); ?></label> |
|
19 | 19 | <?php } ?> |
20 | 20 | <p><input type="text" name="gv_search" id="gv_search_<?php echo $view_id; ?>" value="<?php echo $value; ?>" /></p> |
21 | 21 | </div> |
@@ -10,22 +10,22 @@ |
||
10 | 10 | $search_field = $gravityview_view->search_field; |
11 | 11 | |
12 | 12 | // Make sure that there are choices to display |
13 | -if( empty( $search_field['choices'] ) ) { |
|
14 | - do_action('gravityview_log_debug', 'search-field-select.php - No choices for field' ); |
|
13 | +if (empty($search_field['choices'])) { |
|
14 | + do_action('gravityview_log_debug', 'search-field-select.php - No choices for field'); |
|
15 | 15 | return; |
16 | 16 | } |
17 | 17 | |
18 | 18 | ?> |
19 | 19 | <div class="gv-search-box"> |
20 | - <?php if( ! gv_empty( $search_field['label'], false ) ) { ?> |
|
21 | - <label for=search-box-<?php echo esc_attr( $search_field['name'] ); ?>><?php echo esc_html( $search_field['label'] ); ?></label> |
|
20 | + <?php if (!gv_empty($search_field['label'], false)) { ?> |
|
21 | + <label for=search-box-<?php echo esc_attr($search_field['name']); ?>><?php echo esc_html($search_field['label']); ?></label> |
|
22 | 22 | <?php } ?> |
23 | 23 | <p> |
24 | - <select name="<?php echo esc_attr( $search_field['name'] ); ?>" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"> |
|
25 | - <option value="" <?php selected( '', $search_field['value'], true ); ?>>—</option> |
|
24 | + <select name="<?php echo esc_attr($search_field['name']); ?>" id="search-box-<?php echo esc_attr($search_field['name']); ?>"> |
|
25 | + <option value="" <?php selected('', $search_field['value'], true); ?>>—</option> |
|
26 | 26 | <?php |
27 | - foreach( $search_field['choices'] as $choice ) : ?> |
|
28 | - <option value="<?php echo esc_attr( $choice['value'] ); ?>" <?php selected( $choice['value'], $search_field['value'], true ); ?>><?php echo esc_html( $choice['text'] ); ?></option> |
|
27 | + foreach ($search_field['choices'] as $choice) : ?> |
|
28 | + <option value="<?php echo esc_attr($choice['value']); ?>" <?php selected($choice['value'], $search_field['value'], true); ?>><?php echo esc_html($choice['text']); ?></option> |
|
29 | 29 | <?php endforeach; ?> |
30 | 30 | </select> |
31 | 31 | </p> |
@@ -12,8 +12,8 @@ |
||
12 | 12 | ?> |
13 | 13 | |
14 | 14 | <div class="gv-search-box"> |
15 | - <label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" class="gv-check-radio"> |
|
16 | - <input type="checkbox" name="<?php echo esc_attr( $search_field['name'] ); ?>" value="1" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" <?php checked( '1', $search_field['value'], true ); ?>> |
|
17 | - <?php if( ! gv_empty( $search_field['label'], false ) ) { echo esc_html( $search_field['label'] ); } ?> |
|
15 | + <label for="search-box-<?php echo esc_attr($search_field['name']); ?>" class="gv-check-radio"> |
|
16 | + <input type="checkbox" name="<?php echo esc_attr($search_field['name']); ?>" value="1" id="search-box-<?php echo esc_attr($search_field['name']); ?>" <?php checked('1', $search_field['value'], true); ?>> |
|
17 | + <?php if (!gv_empty($search_field['label'], false)) { echo esc_html($search_field['label']); } ?> |
|
18 | 18 | </label> |
19 | 19 | </div> |
20 | 20 | \ No newline at end of file |
@@ -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> |
@@ -15,19 +15,19 @@ discard block |
||
15 | 15 | $name = __('GravityView Recent Entries', 'gravityview'); |
16 | 16 | |
17 | 17 | $widget_options = array( |
18 | - 'description' => __( 'Display the most recent entries for a View', 'gravityview' ), |
|
18 | + 'description' => __('Display the most recent entries for a View', 'gravityview'), |
|
19 | 19 | ); |
20 | 20 | |
21 | - parent::__construct( 'gv_recent_entries', $name, $widget_options ); |
|
21 | + parent::__construct('gv_recent_entries', $name, $widget_options); |
|
22 | 22 | |
23 | 23 | $this->initialize(); |
24 | 24 | } |
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 | - add_action( 'wp_ajax_gv_get_view_merge_tag_data', array( $this, 'ajax_get_view_merge_tag_data' ) ); |
|
30 | + add_action('wp_ajax_gv_get_view_merge_tag_data', array($this, 'ajax_get_view_merge_tag_data')); |
|
31 | 31 | |
32 | 32 | } |
33 | 33 | |
@@ -38,13 +38,13 @@ 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' ) ) { |
|
42 | - exit( false ); |
|
41 | + if (!isset($_POST['nonce']) || !wp_verify_nonce($_POST['nonce'], 'gravityview_ajax_widget')) { |
|
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 | - $form = RGFormsModel::get_form_meta( $form_id ); |
|
47 | + $form = RGFormsModel::get_form_meta($form_id); |
|
48 | 48 | |
49 | 49 | $output = array( |
50 | 50 | 'form' => array( |
@@ -52,10 +52,10 @@ discard block |
||
52 | 52 | 'title' => $form['title'], |
53 | 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 | - echo json_encode( $output ); |
|
58 | + echo json_encode($output); |
|
59 | 59 | |
60 | 60 | exit; |
61 | 61 | } |
@@ -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 | 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 | - wp_localize_script( 'gravityview_widgets', 'GVWidgets', array( |
|
80 | - 'nonce' => wp_create_nonce( 'gravityview_ajax_widget' ) |
|
79 | + wp_localize_script('gravityview_widgets', 'GVWidgets', array( |
|
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 | } |
@@ -92,22 +92,22 @@ discard block |
||
92 | 92 | * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget. |
93 | 93 | * @param array $instance The settings for the particular instance of the widget. |
94 | 94 | */ |
95 | - function widget( $args, $instance ) { |
|
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 | 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 | /** |
@@ -115,17 +115,17 @@ discard block |
||
115 | 115 | * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget. |
116 | 116 | * @param array $instance The settings for the particular instance of the widget. |
117 | 117 | */ |
118 | - do_action( 'gravityview/widget/recent-entries/before_widget', $args, $instance ); |
|
118 | + do_action('gravityview/widget/recent-entries/before_widget', $args, $instance); |
|
119 | 119 | |
120 | 120 | // Print the entry list |
121 | - echo $this->get_output( $instance ); |
|
121 | + echo $this->get_output($instance); |
|
122 | 122 | |
123 | 123 | /** |
124 | 124 | * @action `gravityview/widget/recent-entries/after_widget` After recent entries are displayed in the WordPress widget |
125 | 125 | * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget. |
126 | 126 | * @param array $instance The settings for the particular instance of the widget. |
127 | 127 | */ |
128 | - do_action( 'gravityview/widget/recent-entries/after_widget', $args, $instance ); |
|
128 | + do_action('gravityview/widget/recent-entries/after_widget', $args, $instance); |
|
129 | 129 | |
130 | 130 | echo $args['after_widget']; |
131 | 131 | } |
@@ -139,25 +139,25 @@ discard block |
||
139 | 139 | * |
140 | 140 | * @return string |
141 | 141 | */ |
142 | - private function get_output( $instance ) { |
|
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 | - $form = gravityview_get_form( $form_id ); |
|
146 | + $form = gravityview_get_form($form_id); |
|
147 | 147 | |
148 | - $entries = $this->get_entries( $instance, $form_id ); |
|
148 | + $entries = $this->get_entries($instance, $form_id); |
|
149 | 149 | |
150 | 150 | /** |
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 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | * @param string $output HTML to be displayed |
167 | 167 | * @param array $instance Widget settings |
168 | 168 | */ |
169 | - $output = apply_filters( 'gravityview/widget/recent-entries/output', $output, $instance ); |
|
169 | + $output = apply_filters('gravityview/widget/recent-entries/output', $output, $instance); |
|
170 | 170 | |
171 | 171 | return $output; |
172 | 172 | } |
@@ -179,15 +179,15 @@ discard block |
||
179 | 179 | * |
180 | 180 | * @return array $entries Multidimensional array of Gravity Forms entries |
181 | 181 | */ |
182 | - private function get_entries( $instance, $form_id ) { |
|
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 | 188 | $criteria['context_view_id'] = $instance['view_id']; |
189 | 189 | |
190 | - $instance['limit'] = isset( $instance['limit'] ) ? $instance['limit'] : 10; |
|
190 | + $instance['limit'] = isset($instance['limit']) ? $instance['limit'] : 10; |
|
191 | 191 | $view_settings['id'] = $instance['view_id']; |
192 | 192 | $view_settings['page_size'] = $instance['limit']; |
193 | 193 | |
@@ -198,16 +198,16 @@ discard block |
||
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 | - $results = GVCommon::get_entries( $form_id, $criteria ); |
|
210 | + $results = GVCommon::get_entries($form_id, $criteria); |
|
211 | 211 | |
212 | 212 | return $results; |
213 | 213 | } |
@@ -221,28 +221,28 @@ discard block |
||
221 | 221 | * |
222 | 222 | * @return array Calculated widget settings after processing |
223 | 223 | */ |
224 | - public function update( $new_instance, $old_instance ) { |
|
224 | + public function update($new_instance, $old_instance) { |
|
225 | 225 | |
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. |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | * @param array $new_instance Widget form settings after update |
252 | 252 | * @param array $old_instance Widget form settings before update |
253 | 253 | */ |
254 | - $instance = apply_filters( 'gravityview/widget/update', $instance, $new_instance, $old_instance ); |
|
254 | + $instance = apply_filters('gravityview/widget/update', $instance, $new_instance, $old_instance); |
|
255 | 255 | |
256 | 256 | return $instance; |
257 | 257 | } |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | * @since 1.6 |
261 | 261 | * @see WP_Widget::form() |
262 | 262 | */ |
263 | - public function form( $instance ) { |
|
263 | + public function form($instance) { |
|
264 | 264 | |
265 | 265 | // Set up some default widget settings. |
266 | 266 | $defaults = array( |
@@ -272,14 +272,14 @@ discard block |
||
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 | - <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'] ); ?>" /> |
|
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']); ?>" /> |
|
283 | 283 | </p> |
284 | 284 | |
285 | 285 | <!-- Download --> |
@@ -289,11 +289,11 @@ discard block |
||
289 | 289 | 'posts_per_page' => -1, |
290 | 290 | 'post_status' => 'publish', |
291 | 291 | ); |
292 | - $views = get_posts( $args ); |
|
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 ) ) { |
|
296 | - echo '<div id="select_gravityview_view"><div class="wrap">'. GravityView_Post_Types::no_views_text() .'</div></div>'; |
|
295 | + if (empty($views)) { |
|
296 | + echo '<div id="select_gravityview_view"><div class="wrap">'.GravityView_Post_Types::no_views_text().'</div></div>'; |
|
297 | 297 | return; |
298 | 298 | } |
299 | 299 | |
@@ -304,25 +304,25 @@ 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 | 310 | <p><?php esc_html_e('Please select a View to search.', 'gravityview'); ?></p> |
311 | 311 | </div> |
312 | 312 | <?php |
313 | - unset ( $error ); |
|
313 | + unset ($error); |
|
314 | 314 | } |
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> |
|
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 | - <option value=""><?php esc_html_e( '— Select a View as Entries Source —', 'gravityview' ); ?></option> |
|
318 | + <label for="<?php echo esc_attr($this->get_field_id('view_id')); ?>"><?php esc_html_e('Select a View', 'gravityview'); ?></label> |
|
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 | + <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,44 +334,44 @@ 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 | 340 | <p><?php echo $instance['error_post_id']; ?></p> |
341 | 341 | </div> |
342 | 342 | <?php |
343 | - unset ( $error ); |
|
343 | + unset ($error); |
|
344 | 344 | } |
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 | |
356 | 356 | <p> |
357 | - <label for="<?php echo $this->get_field_id( 'limit' ); ?>"> |
|
358 | - <span><?php _e( 'Number of entries to show:', 'gravityview' ); ?></span> |
|
357 | + <label for="<?php echo $this->get_field_id('limit'); ?>"> |
|
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 | - <label for="<?php echo $this->get_field_id( 'link_format' ); ?>"> |
|
365 | - <span><?php _e( 'Entry link text (required)', 'gravityview' ); ?></span> |
|
364 | + <label for="<?php echo $this->get_field_id('link_format'); ?>"> |
|
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 | - <label for="<?php echo $this->get_field_id( 'after_link' ); ?>"> |
|
372 | - <span><?php _e( 'Text or HTML to display after the link (optional)', 'gravityview' ); ?></span> |
|
371 | + <label for="<?php echo $this->get_field_id('after_link'); ?>"> |
|
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,14 +381,14 @@ 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 | |
388 | 388 | <script> |
389 | 389 | // When the widget is saved or added, refresh the Merge Tags (here for backward compatibility) |
390 | 390 | // WordPress 3.9 added widget-added and widget-updated actions |
391 | - jQuery('#<?php echo $this->get_field_id( 'view_id' ); ?>').trigger( 'change' ); |
|
391 | + jQuery('#<?php echo $this->get_field_id('view_id'); ?>').trigger( 'change' ); |
|
392 | 392 | </script> |
393 | 393 | <?php } |
394 | 394 |
@@ -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 |
@@ -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 | } |