Completed
Pull Request — master (#605)
by Zack
05:45
created
includes/widgets/search-widget/templates/search-field-input_text.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,10 +11,10 @@
 block discarded – undo
11 11
 ?>
12 12
 
13 13
 <div class="gv-search-box">
14
-	<?php if( ! gv_empty( $search_field['label'], false ) ) { ?>
15
-	<label for=search-box-<?php echo esc_attr( $search_field['name'] ); ?>><?php echo esc_html( $search_field['label'] ); ?></label>
14
+	<?php if (!gv_empty($search_field['label'], false)) { ?>
15
+	<label for=search-box-<?php echo esc_attr($search_field['name']); ?>><?php echo esc_html($search_field['label']); ?></label>
16 16
 	<?php } ?>
17 17
 	<p>
18
-		<input type="text" name="<?php echo esc_attr( $search_field['name'] ); ?>" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" value="<?php echo esc_attr( $search_field['value'] ); ?>">
18
+		<input type="text" name="<?php echo esc_attr($search_field['name']); ?>" id="search-box-<?php echo esc_attr($search_field['name']); ?>" value="<?php echo esc_attr($search_field['value']); ?>">
19 19
 	</p>
20 20
 </div>
21 21
\ No newline at end of file
Please login to merge, or discard this patch.
includes/widgets/search-widget/templates/search-field-link.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -39,22 +39,22 @@
 block discarded – undo
39 39
 
40 40
         <?php
41 41
 
42
-        $search_value = rgget( $search_field['name'] );
42
+		$search_value = rgget( $search_field['name'] );
43 43
 
44
-        foreach ( $search_field['choices'] as $k => $choice ) {
44
+		foreach ( $search_field['choices'] as $k => $choice ) {
45 45
 
46
-            if ( 0 != $k ) {
47
-                echo esc_html( $links_sep );
48
-            }
46
+			if ( 0 != $k ) {
47
+				echo esc_html( $links_sep );
48
+			}
49 49
 
50
-            $active = ( '' !== $search_value && in_array( $search_value, array( $choice['text'], $choice['value'] ) ) ) ? ' class="active"' : false;
50
+			$active = ( '' !== $search_value && in_array( $search_value, array( $choice['text'], $choice['value'] ) ) ) ? ' class="active"' : false;
51 51
 
52
-            if ( $active ) {
53
-                $link = remove_query_arg( array( 'pagenum', $search_field['name'] ), $base_url );
54
-            } else {
55
-                $link = add_query_arg( array( $search_field['name'] => urlencode( $choice['value'] ) ), remove_query_arg( array('pagenum'), $base_url ) );
56
-            }
57
-            ?>
52
+			if ( $active ) {
53
+				$link = remove_query_arg( array( 'pagenum', $search_field['name'] ), $base_url );
54
+			} else {
55
+				$link = add_query_arg( array( $search_field['name'] => urlencode( $choice['value'] ) ), remove_query_arg( array('pagenum'), $base_url ) );
56
+			}
57
+			?>
58 58
 
59 59
 			<a href="<?php echo esc_url_raw( $link ); ?>" <?php echo $active; ?>><?php echo esc_html( $choice['text'] ); ?></a>
60 60
 
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@  discard block
 block discarded – undo
13 13
 $base_url = GravityView_Widget_Search::get_search_form_action();
14 14
 
15 15
 // Make sure that there are choices to display
16
-if ( empty( $search_field['choices'] ) ) {
17
-	do_action( 'gravityview_log_debug', 'search-field-link.php - No choices for field' );
16
+if (empty($search_field['choices'])) {
17
+	do_action('gravityview_log_debug', 'search-field-link.php - No choices for field');
18 18
 	return;
19 19
 }
20 20
 
@@ -22,41 +22,41 @@  discard block
 block discarded – undo
22 22
  * @filter `gravityview/extension/search/links_sep` Change the label for the "Link" search bar input type
23 23
  * @param string $links_label Default: `Show only:`
24 24
  */
25
-$links_label = apply_filters( 'gravityview/extension/search/links_label', __( 'Show only:', 'gravityview' ) );
25
+$links_label = apply_filters('gravityview/extension/search/links_label', __('Show only:', 'gravityview'));
26 26
 
27 27
 /**
28 28
  * @filter `gravityview/extension/search/links_sep` Change what separates search bar "Link" input type links
29 29
  * @param string $links_sep Default: `&nbsp;|&nbsp;` Used to connect multiple links
30 30
  */
31
-$links_sep = apply_filters( 'gravityview/extension/search/links_sep', '&nbsp;|&nbsp;' );
31
+$links_sep = apply_filters('gravityview/extension/search/links_sep', '&nbsp;|&nbsp;');
32 32
 
33 33
 ?>
34 34
 
35 35
 <div class="gv-search-box">
36 36
 
37 37
 	<p class="gv-search-box-links">
38
-		<?php echo esc_html( $links_label ); ?>
38
+		<?php echo esc_html($links_label); ?>
39 39
 
40 40
         <?php
41 41
 
42
-        $search_value = rgget( $search_field['name'] );
42
+        $search_value = rgget($search_field['name']);
43 43
 
44
-        foreach ( $search_field['choices'] as $k => $choice ) {
44
+        foreach ($search_field['choices'] as $k => $choice) {
45 45
 
46
-            if ( 0 != $k ) {
47
-                echo esc_html( $links_sep );
46
+            if (0 != $k) {
47
+                echo esc_html($links_sep);
48 48
             }
49 49
 
50
-            $active = ( '' !== $search_value && in_array( $search_value, array( $choice['text'], $choice['value'] ) ) ) ? ' class="active"' : false;
50
+            $active = ('' !== $search_value && in_array($search_value, array($choice['text'], $choice['value']))) ? ' class="active"' : false;
51 51
 
52
-            if ( $active ) {
53
-                $link = remove_query_arg( array( 'pagenum', $search_field['name'] ), $base_url );
52
+            if ($active) {
53
+                $link = remove_query_arg(array('pagenum', $search_field['name']), $base_url);
54 54
             } else {
55
-                $link = add_query_arg( array( $search_field['name'] => urlencode( $choice['value'] ) ), remove_query_arg( array('pagenum'), $base_url ) );
55
+                $link = add_query_arg(array($search_field['name'] => urlencode($choice['value'])), remove_query_arg(array('pagenum'), $base_url));
56 56
             }
57 57
             ?>
58 58
 
59
-			<a href="<?php echo esc_url_raw( $link ); ?>" <?php echo $active; ?>><?php echo esc_html( $choice['text'] ); ?></a>
59
+			<a href="<?php echo esc_url_raw($link); ?>" <?php echo $active; ?>><?php echo esc_html($choice['text']); ?></a>
60 60
 
61 61
 		<?php } ?>
62 62
 	</p>
Please login to merge, or discard this patch.
includes/widgets/search-widget/templates/search-field-multiselect.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -10,22 +10,22 @@
 block discarded – undo
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-multiselect.php - No choices for field' );
13
+if (empty($search_field['choices'])) {
14
+	do_action('gravityview_log_debug', 'search-field-multiselect.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'] ); ?>" multiple>
25
-			<option value="" <?php gv_selected( '', $search_field['value'], true ); ?>>&mdash;</option>
24
+		<select name="<?php echo esc_attr($search_field['name']); ?>[]" id="search-box-<?php echo esc_attr($search_field['name']); ?>" multiple>
25
+			<option value="" <?php gv_selected('', $search_field['value'], true); ?>>&mdash;</option>
26 26
 			<?php
27
-			foreach( $search_field['choices'] as $choice ) : ?>
28
-				<option value="<?php echo esc_attr( $choice['value'] ); ?>" <?php gv_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 gv_selected($choice['value'], $search_field['value'], true); ?>><?php echo esc_html($choice['text']); ?></option>
29 29
 			<?php endforeach; ?>
30 30
 		</select>
31 31
 	</p>
Please login to merge, or discard this patch.
includes/widgets/search-widget/templates/search-field-radio.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -10,22 +10,22 @@
 block discarded – undo
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 } ?>
Please login to merge, or discard this patch.
includes/widgets/search-widget/templates/search-field-search_all.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,8 @@
 block discarded – undo
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>
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Display the search all input box
4
- *
5
- * @see class-search-widget.php
6
- */
3
+			 * Display the search all input box
4
+			 *
5
+			 * @see class-search-widget.php
6
+			 */
7 7
 
8 8
 $gravityview_view = GravityView_View::getInstance();
9 9
 $view_id = $gravityview_view->getViewId();
Please login to merge, or discard this patch.
includes/widgets/search-widget/templates/search-field-select.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -10,22 +10,22 @@
 block discarded – undo
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 ); ?>>&mdash;</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); ?>>&mdash;</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>
Please login to merge, or discard this patch.
includes/widgets/search-widget/templates/search-field-single_checkbox.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
includes/widgets/search-widget/templates/widget-search.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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>
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
includes/wordpress-widgets/class-gravityview-search-wp-widget.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -11,75 +11,75 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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( '&mdash; Select a View &mdash;', 'gravityview' ); ?></option>
188
+				<option value=""><?php esc_html_e('&mdash; Select a View &mdash;', '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
 block discarded – undo
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&hellip;', '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&hellip;', '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
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.