Completed
Push — develop ( 40b6cc...bd6ad5 )
by Zack
04:49
created
includes/admin/metaboxes/views/shortcode-hint.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@
 block discarded – undo
9 9
 ?>
10 10
 <div class="misc-pub-section gv-shortcode misc-pub-section-last">
11 11
 	<i class="dashicons dashicons-editor-code"></i>
12
-	<span><?php esc_html_e( 'Embed Shortcode', 'gravityview' ); ?></span>
12
+	<span><?php esc_html_e('Embed Shortcode', 'gravityview'); ?></span>
13 13
 	<div>
14 14
 		<input type="text" readonly="readonly" value="[gravityview id='<?php echo $post->ID; ?>']" class="code widefat" />
15
-		<span class="howto"><?php esc_html_e( 'Add this shortcode to a post or page to embed this view.', 'gravityview' ); ?></span>
15
+		<span class="howto"><?php esc_html_e('Add this shortcode to a post or page to embed this view.', 'gravityview'); ?></span>
16 16
 	</div>
17 17
 </div>
18 18
\ No newline at end of file
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
- * @package GravityView
4
- * @subpackage Gravityview/admin/metaboxes/partials
5
- * @global $post
6
- */
3
+				 * @package GravityView
4
+				 * @subpackage Gravityview/admin/metaboxes/partials
5
+				 * @global $post
6
+				 */
7 7
 
8 8
 global $post;
9 9
 ?>
Please login to merge, or discard this patch.
includes/admin/metaboxes/views/single-entry.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@
 block discarded – undo
7 7
 global $post;
8 8
 
9 9
 // View template settings
10
-$current_settings = gravityview_get_template_settings( $post->ID );
10
+$current_settings = gravityview_get_template_settings($post->ID);
11 11
 
12 12
 ?>
13 13
 
14 14
 <table class="form-table striped"><?php
15 15
 
16
-	GravityView_Render_Settings::render_setting_row( 'single_title', $current_settings );
16
+	GravityView_Render_Settings::render_setting_row('single_title', $current_settings);
17 17
 
18
-	GravityView_Render_Settings::render_setting_row( 'back_link_label', $current_settings );
18
+	GravityView_Render_Settings::render_setting_row('back_link_label', $current_settings);
19 19
 
20 20
 	?>
21 21
 </table>
22 22
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/metaboxes/views/sort-filter.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -6,47 +6,47 @@
 block discarded – undo
6 6
  */
7 7
 global $post;
8 8
 
9
-$curr_form = gravityview_get_form_id( $post->ID );
9
+$curr_form = gravityview_get_form_id($post->ID);
10 10
 
11 11
 // View template settings
12
-$current_settings = gravityview_get_template_settings( $post->ID );
12
+$current_settings = gravityview_get_template_settings($post->ID);
13 13
 
14 14
 ?>
15 15
 <table class="form-table striped">
16 16
 
17 17
 	<?php
18 18
 
19
-	do_action( 'gravityview_metabox_sort_filter_before', $current_settings );
19
+	do_action('gravityview_metabox_sort_filter_before', $current_settings);
20 20
 
21 21
 	// Begin Sort fields
22
-	do_action( 'gravityview_metabox_sort_before', $current_settings );
22
+	do_action('gravityview_metabox_sort_before', $current_settings);
23 23
 
24 24
 	/**
25 25
 	 * @since 1.7
26 26
 	 */
27
-	GravityView_Render_Settings::render_setting_row( 'sort_columns', $current_settings );
27
+	GravityView_Render_Settings::render_setting_row('sort_columns', $current_settings);
28 28
 
29
-	$sort_fields_input = '<select name="template_settings[sort_field]" id="gravityview_sort_field">'.gravityview_get_sortable_fields( $curr_form, $current_settings['sort_field'] ).'</select>';
29
+	$sort_fields_input = '<select name="template_settings[sort_field]" id="gravityview_sort_field">'.gravityview_get_sortable_fields($curr_form, $current_settings['sort_field']).'</select>';
30 30
 
31
-	GravityView_Render_Settings::render_setting_row( 'sort_field', $current_settings, $sort_fields_input );
31
+	GravityView_Render_Settings::render_setting_row('sort_field', $current_settings, $sort_fields_input);
32 32
 
33
-	GravityView_Render_Settings::render_setting_row( 'sort_direction', $current_settings );
33
+	GravityView_Render_Settings::render_setting_row('sort_direction', $current_settings);
34 34
 
35 35
 
36 36
 	// End Sort fields
37
-	do_action( 'gravityview_metabox_sort_after', $current_settings );
37
+	do_action('gravityview_metabox_sort_after', $current_settings);
38 38
 
39 39
 	// Begin Filter fields
40
-	do_action( 'gravityview_metabox_filter_before', $current_settings );
40
+	do_action('gravityview_metabox_filter_before', $current_settings);
41 41
 
42
-	GravityView_Render_Settings::render_setting_row( 'start_date', $current_settings );
42
+	GravityView_Render_Settings::render_setting_row('start_date', $current_settings);
43 43
 
44
-	GravityView_Render_Settings::render_setting_row( 'end_date', $current_settings );
44
+	GravityView_Render_Settings::render_setting_row('end_date', $current_settings);
45 45
 
46 46
 	// End Filter fields
47
-	do_action( 'gravityview_metabox_filter_after', $current_settings );
47
+	do_action('gravityview_metabox_filter_after', $current_settings);
48 48
 
49
-	do_action( 'gravityview_metabox_sort_filter_after', $current_settings );
49
+	do_action('gravityview_metabox_sort_filter_after', $current_settings);
50 50
 
51 51
 	?>
52 52
 
Please login to merge, or discard this patch.
includes/admin/metaboxes/views/view-configuration.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1,42 +1,42 @@  discard block
 block discarded – undo
1 1
 <div id="gv-view-configuration-tabs">
2 2
 
3 3
 	<ul class="nav-tab-wrapper">
4
-		<li><a href="#directory-view" class="nav-tab"><i class="dashicons dashicons-admin-page"></i> <?php esc_html_e( 'Multiple Entries', 'gravityview' ); ?></a></li>
5
-		<li><a href="#single-view" class="nav-tab"><i class="dashicons dashicons-media-default"></i> <?php esc_html_e( 'Single Entry', 'gravityview' ); ?></a></li>
6
-		<li><a href="#edit-view" class="nav-tab"><i class="dashicons dashicons-welcome-write-blog"></i> <?php esc_html_e( 'Edit Entry', 'gravityview' ); ?></a></li>
4
+		<li><a href="#directory-view" class="nav-tab"><i class="dashicons dashicons-admin-page"></i> <?php esc_html_e('Multiple Entries', 'gravityview'); ?></a></li>
5
+		<li><a href="#single-view" class="nav-tab"><i class="dashicons dashicons-media-default"></i> <?php esc_html_e('Single Entry', 'gravityview'); ?></a></li>
6
+		<li><a href="#edit-view" class="nav-tab"><i class="dashicons dashicons-welcome-write-blog"></i> <?php esc_html_e('Edit Entry', 'gravityview'); ?></a></li>
7 7
 	</ul>
8 8
 
9 9
 	<div id="directory-view">
10 10
 
11 11
 		<div id="directory-fields" class="gv-section">
12 12
 
13
-			<h4><?php esc_html_e( 'Above Entries Widgets', 'gravityview'); ?> <span><?php esc_html_e( 'These widgets will be shown above entries.', 'gravityview'); ?></span></h4>
13
+			<h4><?php esc_html_e('Above Entries Widgets', 'gravityview'); ?> <span><?php esc_html_e('These widgets will be shown above entries.', 'gravityview'); ?></span></h4>
14 14
 
15
-			<?php do_action('gravityview_render_widgets_active_areas', $curr_template, 'header', $post->ID ); ?>
15
+			<?php do_action('gravityview_render_widgets_active_areas', $curr_template, 'header', $post->ID); ?>
16 16
 
17
-			<h4><?php esc_html_e( 'Entries Fields', 'gravityview'); ?> <span><?php esc_html_e( 'These fields will be shown for each entry.', 'gravityview'); ?></span></h4>
17
+			<h4><?php esc_html_e('Entries Fields', 'gravityview'); ?> <span><?php esc_html_e('These fields will be shown for each entry.', 'gravityview'); ?></span></h4>
18 18
 
19 19
 			<div id="directory-active-fields" class="gv-grid gv-grid-pad gv-grid-border">
20
-				<?php if(!empty( $curr_template ) ) {
21
-					do_action('gravityview_render_directory_active_areas', $curr_template, 'directory', $post->ID, true );
20
+				<?php if (!empty($curr_template)) {
21
+					do_action('gravityview_render_directory_active_areas', $curr_template, 'directory', $post->ID, true);
22 22
 				} ?>
23 23
 			</div>
24 24
 
25
-			<h4><?php esc_html_e( 'Below Entries Widgets', 'gravityview'); ?> <span><?php esc_html_e( 'These widgets will be shown below entries.', 'gravityview'); ?></span></h4>
25
+			<h4><?php esc_html_e('Below Entries Widgets', 'gravityview'); ?> <span><?php esc_html_e('These widgets will be shown below entries.', 'gravityview'); ?></span></h4>
26 26
 
27
-			<?php do_action('gravityview_render_widgets_active_areas', $curr_template, 'footer', $post->ID ); ?>
27
+			<?php do_action('gravityview_render_widgets_active_areas', $curr_template, 'footer', $post->ID); ?>
28 28
 
29 29
 
30 30
 			<?php // list of available fields to be shown in the popup ?>
31 31
 			<div id="directory-available-fields" class="hide-if-js gv-tooltip">
32 32
 				<span class="close"><i class="dashicons dashicons-dismiss"></i></span>
33
-				<?php do_action('gravityview_render_available_fields', $curr_form, 'directory' ); ?>
33
+				<?php do_action('gravityview_render_available_fields', $curr_form, 'directory'); ?>
34 34
 			</div>
35 35
 
36 36
 			<?php // list of available widgets to be shown in the popup ?>
37 37
 			<div id="directory-available-widgets" class="hide-if-js gv-tooltip">
38 38
 				<span class="close"><i class="dashicons dashicons-dismiss"></i></span>
39
-				<?php do_action('gravityview_render_available_widgets' ); ?>
39
+				<?php do_action('gravityview_render_available_widgets'); ?>
40 40
 			</div>
41 41
 
42 42
 		</div>
@@ -52,17 +52,17 @@  discard block
 block discarded – undo
52 52
 
53 53
 		<div id="single-fields" class="gv-section">
54 54
 
55
-			<h4><?php esc_html_e( 'These fields will be shown in Single Entry view.', 'gravityview'); ?></h4>
55
+			<h4><?php esc_html_e('These fields will be shown in Single Entry view.', 'gravityview'); ?></h4>
56 56
 
57 57
 			<div id="single-active-fields" class="gv-grid gv-grid-pad gv-grid-border">
58
-				<?php if(!empty( $curr_template ) ) {
59
-					do_action('gravityview_render_directory_active_areas', $curr_template, 'single', $post->ID, true );
58
+				<?php if (!empty($curr_template)) {
59
+					do_action('gravityview_render_directory_active_areas', $curr_template, 'single', $post->ID, true);
60 60
 				} ?>
61 61
 			</div>
62 62
 
63 63
 			<div id="single-available-fields" class="hide-if-js gv-tooltip">
64 64
 				<span class="close"><i class="dashicons dashicons-dismiss"></i></span>
65
-				<?php do_action('gravityview_render_available_fields', $curr_form, 'single' ); ?>
65
+				<?php do_action('gravityview_render_available_fields', $curr_form, 'single'); ?>
66 66
 			</div>
67 67
 
68 68
 		</div>
@@ -73,17 +73,17 @@  discard block
 block discarded – undo
73 73
 
74 74
 		<div id="edit-fields" class="gv-section">
75 75
 
76
-			<h4><?php esc_html_e( 'Fields shown when editing an entry.', 'gravityview'); ?> <span><?php esc_html_e('If not configured, all form fields will be displayed.', 'gravityview'); ?></span></h4>
76
+			<h4><?php esc_html_e('Fields shown when editing an entry.', 'gravityview'); ?> <span><?php esc_html_e('If not configured, all form fields will be displayed.', 'gravityview'); ?></span></h4>
77 77
 
78 78
 			<div id="edit-active-fields" class="gv-grid gv-grid-pad gv-grid-border">
79 79
 				<?php
80
-				do_action('gravityview_render_directory_active_areas', apply_filters( 'gravityview/template/edit', 'default_table_edit' ), 'edit', $post->ID, true );
80
+				do_action('gravityview_render_directory_active_areas', apply_filters('gravityview/template/edit', 'default_table_edit'), 'edit', $post->ID, true);
81 81
 				?>
82 82
 			</div>
83 83
 
84 84
 			<div id="edit-available-fields" class="hide-if-js gv-tooltip">
85 85
 				<span class="close"><i class="dashicons dashicons-dismiss"></i></span>
86
-				<?php do_action('gravityview_render_available_fields', $curr_form, 'edit' ); ?>
86
+				<?php do_action('gravityview_render_available_fields', $curr_form, 'edit'); ?>
87 87
 			</div>
88 88
 
89 89
 		</div>
Please login to merge, or discard this patch.
includes/admin/metaboxes/views/view-settings.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -6,10 +6,10 @@  discard block
 block discarded – undo
6 6
  */
7 7
 global $post;
8 8
 
9
-$curr_form = gravityview_get_form_id( $post->ID );
9
+$curr_form = gravityview_get_form_id($post->ID);
10 10
 
11 11
 // View template settings
12
-$current_settings = gravityview_get_template_settings( $post->ID );
12
+$current_settings = gravityview_get_template_settings($post->ID);
13 13
 
14 14
 ?>
15 15
 
@@ -17,32 +17,32 @@  discard block
 block discarded – undo
17 17
 
18 18
 	<?php
19 19
 
20
-	GravityView_Render_Settings::render_setting_row( 'page_size', $current_settings );
20
+	GravityView_Render_Settings::render_setting_row('page_size', $current_settings);
21 21
 
22
-	GravityView_Render_Settings::render_setting_row( 'lightbox', $current_settings );
22
+	GravityView_Render_Settings::render_setting_row('lightbox', $current_settings);
23 23
 
24
-	GravityView_Render_Settings::render_setting_row( 'show_only_approved', $current_settings );
24
+	GravityView_Render_Settings::render_setting_row('show_only_approved', $current_settings);
25 25
 
26 26
 	/**
27 27
 	 * @since 1.5.4
28 28
 	 */
29
-	GravityView_Render_Settings::render_setting_row( 'hide_until_searched', $current_settings );
29
+	GravityView_Render_Settings::render_setting_row('hide_until_searched', $current_settings);
30 30
 
31
-	GravityView_Render_Settings::render_setting_row( 'hide_empty', $current_settings );
31
+	GravityView_Render_Settings::render_setting_row('hide_empty', $current_settings);
32 32
 
33
-	GravityView_Render_Settings::render_setting_row( 'user_edit', $current_settings );
33
+	GravityView_Render_Settings::render_setting_row('user_edit', $current_settings);
34 34
 
35 35
 	/**
36 36
 	 * @since  1.5.1
37 37
 	 */
38
-	GravityView_Render_Settings::render_setting_row( 'user_delete', $current_settings );
38
+	GravityView_Render_Settings::render_setting_row('user_delete', $current_settings);
39 39
 
40 40
 	/**
41 41
 	 * @since 1.15.2
42 42
 	 */
43
-	GravityView_Render_Settings::render_setting_row( 'embed_only', $current_settings );
43
+	GravityView_Render_Settings::render_setting_row('embed_only', $current_settings);
44 44
 
45
-	do_action( 'gravityview_admin_directory_settings', $current_settings );
45
+	do_action('gravityview_admin_directory_settings', $current_settings);
46 46
 
47 47
 	?>
48 48
 
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
- * @package GravityView
4
- * @subpackage Gravityview/admin/metaboxes/views
5
- * @global $post
6
- */
3
+	 * @package GravityView
4
+	 * @subpackage Gravityview/admin/metaboxes/views
5
+	 * @global $post
6
+	 */
7 7
 global $post;
8 8
 
9 9
 $curr_form = gravityview_get_form_id( $post->ID );
Please login to merge, or discard this patch.
includes/class-admin-label.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -11,29 +11,29 @@  discard block
 block discarded – undo
11 11
 		$field_info_items = array();
12 12
 
13 13
 		// Fields with IDs, not like Source URL or Entry ID
14
-		if( is_numeric( $this->id ) ) {
14
+		if (is_numeric($this->id)) {
15 15
 
16
-			$field_type_title = GFCommon::get_field_type_title( $this->item['input_type'] );
16
+			$field_type_title = GFCommon::get_field_type_title($this->item['input_type']);
17 17
 
18 18
 			$field_info_items[] = array(
19
-				'value' => sprintf( __('Type: %s', 'gravityview'), $field_type_title )
19
+				'value' => sprintf(__('Type: %s', 'gravityview'), $field_type_title)
20 20
 			);
21 21
 
22 22
 			$field_info_items[] = array(
23
-				'value' => sprintf( __('Field ID: %s', 'gravityview'), $this->id ),
23
+				'value' => sprintf(__('Field ID: %s', 'gravityview'), $this->id),
24 24
 			);
25 25
 
26 26
 		}
27 27
 
28
-		if( !empty( $this->item['desc'] ) ) {
28
+		if (!empty($this->item['desc'])) {
29 29
 			$field_info_items[] = array(
30 30
 				'value' => $this->item['desc']
31 31
 			);
32 32
 		}
33 33
 
34
-		if( !empty( $this->item['adminLabel'] ) ) {
34
+		if (!empty($this->item['adminLabel'])) {
35 35
 			$field_info_items[] = array(
36
-				'value' => sprintf( __('Admin Label: %s', 'gravityview' ), $this->item['adminLabel'] ),
36
+				'value' => sprintf(__('Admin Label: %s', 'gravityview'), $this->item['adminLabel']),
37 37
 				'class'	=> 'gv-sublabel'
38 38
 			);
39 39
 		}
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 		$field_info = '';
53 53
 		$field_info_items = array();
54 54
 
55
-		if( !empty( $this->item['description'] ) ) {
55
+		if (!empty($this->item['description'])) {
56 56
 
57 57
 			$field_info_items[] = array(
58 58
 				'value' => $this->item['description']
@@ -77,16 +77,16 @@  discard block
 block discarded – undo
77 77
 	private   $label_type;
78 78
 	protected $item;
79 79
 
80
-	function __construct( $title = '', $field_id, $item = array(), $settings = array() ) {
80
+	function __construct($title = '', $field_id, $item = array(), $settings = array()) {
81 81
 
82 82
 		// Backward compat
83
-		if( !empty( $item['type'] ) ) {
83
+		if (!empty($item['type'])) {
84 84
 			$item['input_type'] = $item['type'];
85
-			unset( $item['type'] );
85
+			unset($item['type']);
86 86
 		}
87 87
 
88 88
 		// Prevent items from not having index set
89
-		$item = wp_parse_args( $item, array(
89
+		$item = wp_parse_args($item, array(
90 90
 			'label_text' => $title,
91 91
 			'field_id' => NULL,
92 92
 			'parent_label' => NULL,
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	 * @param  boolean $html Display HTML output? If yes, output is wrapped in spans. If no, plaintext.
130 130
 	 * @return string|null        If empty, return null. Otherwise, return output HTML/text.
131 131
 	 */
132
-	protected function get_item_info( $html = true ) {
132
+	protected function get_item_info($html = true) {
133 133
 
134 134
 		$output = NULL;
135 135
 		$field_info_items = $this->additional_info();
@@ -139,27 +139,27 @@  discard block
 block discarded – undo
139 139
 		 * @param array $field_info_items Additional information to display in a field
140 140
 		 * @param GravityView_Admin_View_Field $this Field shown in the admin
141 141
 		 */
142
-		$field_info_items = apply_filters( 'gravityview_admin_label_item_info', $field_info_items, $this );
142
+		$field_info_items = apply_filters('gravityview_admin_label_item_info', $field_info_items, $this);
143 143
 
144
-		if( $html ) {
144
+		if ($html) {
145 145
 
146
-			foreach ( $field_info_items as $item ) {
147
-				$class = isset($item['class']) ? sanitize_html_class( $item['class'] ).' description' : 'description';
146
+			foreach ($field_info_items as $item) {
147
+				$class = isset($item['class']) ? sanitize_html_class($item['class']).' description' : 'description';
148 148
 				// Add the title in case the value's long, in which case, it'll be truncated by CSS.
149 149
 				$output .= '<span class="'.$class.'">';
150
-				$output .= esc_html( $item['value'] );
150
+				$output .= esc_html($item['value']);
151 151
 				$output .= '</span>';
152 152
 			}
153 153
 
154 154
 		} else {
155 155
 
156
-			$values = wp_list_pluck( $field_info_items, 'value' );
156
+			$values = wp_list_pluck($field_info_items, 'value');
157 157
 
158
-			$output = esc_html( implode(', ', $values) );
158
+			$output = esc_html(implode(', ', $values));
159 159
 
160 160
 		}
161 161
 
162
-		return empty( $output ) ? NULL : $output;
162
+		return empty($output) ? NULL : $output;
163 163
 
164 164
 	}
165 165
 
@@ -176,47 +176,47 @@  discard block
 block discarded – undo
176 176
 
177 177
 		// $settings_html will just be hidden inputs if empty. Otherwise, it'll have an <ul>. Ugly hack, I know.
178 178
 		// TODO: Un-hack this
179
-		$hide_settings_link = ( empty( $this->item['settings_html'] ) || strpos( $this->item['settings_html'], '<!-- No Options -->') > 0 ) ? 'hide-if-js' : '';
180
-		$settings_link = sprintf( '<a href="#settings" class="dashicons-admin-generic dashicons %s" title="%s"></a>', $hide_settings_link, esc_attr( $settings_title ) );
179
+		$hide_settings_link = (empty($this->item['settings_html']) || strpos($this->item['settings_html'], '<!-- No Options -->') > 0) ? 'hide-if-js' : '';
180
+		$settings_link = sprintf('<a href="#settings" class="dashicons-admin-generic dashicons %s" title="%s"></a>', $hide_settings_link, esc_attr($settings_title));
181 181
 
182 182
 		// Should we show the icon that the field is being used as a link to single entry?
183
-		$hide_show_as_link_class = empty( $this->settings['show_as_link'] ) ? 'hide-if-js' : '';
184
-		$show_as_link = '<span class="dashicons dashicons-admin-links '.$hide_show_as_link_class.'" title="'.esc_attr( $single_link_title ).'"></span>';
183
+		$hide_show_as_link_class = empty($this->settings['show_as_link']) ? 'hide-if-js' : '';
184
+		$show_as_link = '<span class="dashicons dashicons-admin-links '.$hide_show_as_link_class.'" title="'.esc_attr($single_link_title).'"></span>';
185 185
 
186 186
 		// When a field label is empty, use the Field ID
187
-		$label = empty( $this->title ) ? sprintf( _x('Field #%s (No Label)', 'Label in field picker for empty label', 'gravityview'), $this->id ) : $this->title;
187
+		$label = empty($this->title) ? sprintf(_x('Field #%s (No Label)', 'Label in field picker for empty label', 'gravityview'), $this->id) : $this->title;
188 188
 
189 189
 		// If there's a custom label, and show label is checked, use that as the field heading
190
-		if( !empty( $this->settings['custom_label'] ) && !empty( $this->settings['show_label'] ) ) {
190
+		if (!empty($this->settings['custom_label']) && !empty($this->settings['show_label'])) {
191 191
 			$label = $this->settings['custom_label'];
192
-		} else if( !empty( $this->item['customLabel'] ) ) {
192
+		} else if (!empty($this->item['customLabel'])) {
193 193
 			$label = $this->item['customLabel'];
194 194
 		}
195 195
 
196 196
 		$output = '<h5 class="selectable gfield field-id-'.esc_attr($this->id).'">';
197 197
 
198
-		$label = esc_attr( $label );
198
+		$label = esc_attr($label);
199 199
 
200
-		if( !empty( $this->item['parent'] ) ) {
201
-			$label .= ' <small>('.esc_attr( $this->item['parent']['label'] ) .')</small>';
200
+		if (!empty($this->item['parent'])) {
201
+			$label .= ' <small>('.esc_attr($this->item['parent']['label']).')</small>';
202 202
 		}
203 203
 
204 204
 		// Name of field / widget
205
-		$output .= '<span class="gv-field-label" data-original-title="'.esc_attr( $label ).'" title="'. $this->get_item_info( false ) .'">'. $label . '</span>';
205
+		$output .= '<span class="gv-field-label" data-original-title="'.esc_attr($label).'" title="'.$this->get_item_info(false).'">'.$label.'</span>';
206 206
 
207 207
 
208
-		$output .= '<span class="gv-field-controls">'.$settings_link.$show_as_link.'<a href="#remove" class="dashicons-dismiss dashicons" title="'.esc_attr( $delete_title ) .'"></a></span>';
208
+		$output .= '<span class="gv-field-controls">'.$settings_link.$show_as_link.'<a href="#remove" class="dashicons-dismiss dashicons" title="'.esc_attr($delete_title).'"></a></span>';
209 209
 
210 210
 		// Displays only in the field/widget picker.
211
-		if( $field_info = $this->get_item_info() ) {
211
+		if ($field_info = $this->get_item_info()) {
212 212
 			$output .= '<span class="gv-field-info">'.$field_info.'</span>';
213 213
 		}
214 214
 
215 215
 		$output .= '</h5>';
216 216
 
217
-		$container_class = !empty( $this->item['parent'] ) ? ' gv-child-field' : '';
217
+		$container_class = !empty($this->item['parent']) ? ' gv-child-field' : '';
218 218
 
219
-		$output = '<div data-fieldid="'.esc_attr($this->id).'" data-inputtype="'.esc_attr( $this->item['input_type'] ).'" class="gv-fields'.$container_class.'">'.$output.$this->item['settings_html'].'</div>';
219
+		$output = '<div data-fieldid="'.esc_attr($this->id).'" data-inputtype="'.esc_attr($this->item['input_type']).'" class="gv-fields'.$container_class.'">'.$output.$this->item['settings_html'].'</div>';
220 220
 
221 221
 		return $output;
222 222
 	}
Please login to merge, or discard this patch.
includes/class-admin-welcome.php 2 patches
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly
15
-if ( ! defined( 'ABSPATH' ) ) exit;
15
+if (!defined('ABSPATH')) exit;
16 16
 
17 17
 /**
18 18
  * GravityView_Welcome Class
@@ -34,10 +34,10 @@  discard block
 block discarded – undo
34 34
 	 * @since 1.0
35 35
 	 */
36 36
 	public function __construct() {
37
-		add_action( 'admin_menu', array( $this, 'admin_menus'), 200 );
38
-		add_action( 'admin_head', array( $this, 'admin_head' ) );
39
-		add_action( 'admin_init', array( $this, 'welcome'    ) );
40
-		add_filter( 'gravityview_is_admin_page', array( $this, 'is_dashboard_page'), 10, 2 );
37
+		add_action('admin_menu', array($this, 'admin_menus'), 200);
38
+		add_action('admin_head', array($this, 'admin_head'));
39
+		add_action('admin_init', array($this, 'welcome'));
40
+		add_filter('gravityview_is_admin_page', array($this, 'is_dashboard_page'), 10, 2);
41 41
 	}
42 42
 
43 43
 	/**
@@ -57,27 +57,27 @@  discard block
 block discarded – undo
57 57
 			__('Getting Started', 'gravityview'),
58 58
 			$this->minimum_capability,
59 59
 			'gv-getting-started',
60
-			array( $this, 'getting_started_screen' )
60
+			array($this, 'getting_started_screen')
61 61
 		);
62 62
 
63 63
 		// Changelog Page
64 64
 		add_submenu_page(
65 65
 			'edit.php?post_type=gravityview',
66
-			__( 'Changelog', 'gravityview' ),
67
-			__( 'Changelog', 'gravityview' ),
66
+			__('Changelog', 'gravityview'),
67
+			__('Changelog', 'gravityview'),
68 68
 			$this->minimum_capability,
69 69
 			'gv-changelog',
70
-			array( $this, 'changelog_screen' )
70
+			array($this, 'changelog_screen')
71 71
 		);
72 72
 
73 73
 		// Credits Page
74 74
 		add_submenu_page(
75 75
 			'edit.php?post_type=gravityview',
76
-			__( 'Credits', 'gravityview' ),
77
-			__( 'Credits', 'gravityview' ),
76
+			__('Credits', 'gravityview'),
77
+			__('Credits', 'gravityview'),
78 78
 			$this->minimum_capability,
79 79
 			'gv-credits',
80
-			array( $this, 'credits_screen' )
80
+			array($this, 'credits_screen')
81 81
 		);
82 82
 
83 83
 	}
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
 	public function is_dashboard_page($is_page = false, $hook = NULL) {
91 91
 		global $plugin_page;
92 92
 
93
-		if($is_page) { return $is_page; }
93
+		if ($is_page) { return $is_page; }
94 94
 
95
-		return in_array( $plugin_page, array( 'gv-about', 'gv-credits', 'gv-getting-started' ) );
95
+		return in_array($plugin_page, array('gv-about', 'gv-credits', 'gv-getting-started'));
96 96
 	}
97 97
 
98 98
 	/**
@@ -105,10 +105,10 @@  discard block
 block discarded – undo
105 105
 	public function admin_head() {
106 106
 		global $plugin_page;
107 107
 
108
-		remove_submenu_page( 'edit.php?post_type=gravityview', 'gv-credits' );
109
-		remove_submenu_page( 'edit.php?post_type=gravityview', 'gv-changelog' );
108
+		remove_submenu_page('edit.php?post_type=gravityview', 'gv-credits');
109
+		remove_submenu_page('edit.php?post_type=gravityview', 'gv-changelog');
110 110
 
111
-		if( !$this->is_dashboard_page() ) { return; }
111
+		if (!$this->is_dashboard_page()) { return; }
112 112
 
113 113
 		?>
114 114
 		<style type="text/css" media="screen">
@@ -139,23 +139,23 @@  discard block
 block discarded – undo
139 139
 		global $plugin_page;
140 140
 
141 141
 		// Don't fetch -beta, etc.
142
-		list( $display_version ) = explode( '-', GravityView_Plugin::version );
142
+		list($display_version) = explode('-', GravityView_Plugin::version);
143 143
 
144
-		$selected = !empty( $plugin_page ) ? $plugin_page : 'gv-getting-started';
144
+		$selected = !empty($plugin_page) ? $plugin_page : 'gv-getting-started';
145 145
 		?>
146 146
 
147
-		<h1><img class="alignleft" src="<?php echo plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ); ?>" width="100" height="132" /><?php printf( esc_html__( 'Welcome to GravityView %s', 'gravityview' ), $display_version ); ?></h1>
148
-		<div class="about-text"><?php esc_html_e( 'Thank you for installing GravityView. Beautifully display your Gravity Forms entries.', 'gravityview' ); ?></div>
147
+		<h1><img class="alignleft" src="<?php echo plugins_url('assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE); ?>" width="100" height="132" /><?php printf(esc_html__('Welcome to GravityView %s', 'gravityview'), $display_version); ?></h1>
148
+		<div class="about-text"><?php esc_html_e('Thank you for installing GravityView. Beautifully display your Gravity Forms entries.', 'gravityview'); ?></div>
149 149
 
150 150
 		<h2 class="nav-tab-wrapper clear">
151
-			<a class="nav-tab <?php echo $selected == 'gv-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-getting-started', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>">
152
-				<?php _e( "Getting Started", 'gravityview' ); ?>
151
+			<a class="nav-tab <?php echo $selected == 'gv-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'gv-getting-started', 'post_type' => 'gravityview'), 'edit.php'))); ?>">
152
+				<?php _e("Getting Started", 'gravityview'); ?>
153 153
 			</a>
154
-			<a class="nav-tab <?php echo $selected == 'gv-changelog' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-changelog', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>">
155
-				<?php _e( "List of Changes", 'gravityview' ); ?>
154
+			<a class="nav-tab <?php echo $selected == 'gv-changelog' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'gv-changelog', 'post_type' => 'gravityview'), 'edit.php'))); ?>">
155
+				<?php _e("List of Changes", 'gravityview'); ?>
156 156
 			</a>
157
-			<a class="nav-tab <?php echo $selected == 'gv-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-credits', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>">
158
-				<?php _e( 'Credits', 'gravityview' ); ?>
157
+			<a class="nav-tab <?php echo $selected == 'gv-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'gv-credits', 'post_type' => 'gravityview'), 'edit.php'))); ?>">
158
+				<?php _e('Credits', 'gravityview'); ?>
159 159
 			</a>
160 160
 		</h2>
161 161
 		<?php
@@ -205,14 +205,14 @@  discard block
 block discarded – undo
205 205
 
206 206
 				<div class="last-feature">
207 207
 				<h2>Embed Views in Posts &amp; Pages</h2>
208
-					<p><img src="<?php echo plugins_url( 'assets/images/screenshots/add-view-button.png', GRAVITYVIEW_FILE ); ?>" class="gv-welcome-screenshots" height="35" width="97" />Views don&rsquo;t need to be embedded in a post or page, but you can if you want. Embed Views using the "Add View" button above your content editor.</p>
208
+					<p><img src="<?php echo plugins_url('assets/images/screenshots/add-view-button.png', GRAVITYVIEW_FILE); ?>" class="gv-welcome-screenshots" height="35" width="97" />Views don&rsquo;t need to be embedded in a post or page, but you can if you want. Embed Views using the "Add View" button above your content editor.</p>
209 209
 				</div>
210 210
 
211 211
 			</div>
212 212
 
213 213
 			<div class="feature-section clear">
214 214
 				<h2>Configure Multiple Entry, Single Entry, and Edit Entry Layouts</h2>
215
-				<p><img src="<?php echo plugins_url( 'assets/images/screenshots/add-field.png', GRAVITYVIEW_FILE ); ?>" alt="Add a field dialog box" class="gv-welcome-screenshots" />You can configure what fields are displayed in <strong>Multiple Entry</strong>, <strong>Single Entry</strong>, and <strong>Edit Entry</strong> modes. These can be configured by clicking on the tabs in "View Configuration."</p>
215
+				<p><img src="<?php echo plugins_url('assets/images/screenshots/add-field.png', GRAVITYVIEW_FILE); ?>" alt="Add a field dialog box" class="gv-welcome-screenshots" />You can configure what fields are displayed in <strong>Multiple Entry</strong>, <strong>Single Entry</strong>, and <strong>Edit Entry</strong> modes. These can be configured by clicking on the tabs in "View Configuration."</p>
216 216
 
217 217
 				<ul class="ul-disc">
218 218
 					<li>Click "+ Add Field" to add a field to a zone</li>
@@ -254,23 +254,23 @@  discard block
 block discarded – undo
254 254
 
255 255
 			<div class="changelog point-releases">
256 256
 
257
-				<h2 class="subtitle" style="text-align: center;"><?php esc_html_e('What&rsquo;s New', 'gravityview' ); ?></h2>
257
+				<h2 class="subtitle" style="text-align: center;"><?php esc_html_e('What&rsquo;s New', 'gravityview'); ?></h2>
258 258
 
259 259
 				<div class="feature-section col two-col" style="margin-top:0">
260 260
 					<div class="col col-1">
261
-						<div class="media-container" style="min-height:81px; border: none;"><img src="<?php echo plugins_url( 'assets/images/screenshots/caps.png', GRAVITYVIEW_FILE ); ?>" alt="Icons representing capabilities"></div>
261
+						<div class="media-container" style="min-height:81px; border: none;"><img src="<?php echo plugins_url('assets/images/screenshots/caps.png', GRAVITYVIEW_FILE); ?>" alt="Icons representing capabilities"></div>
262 262
 						<h4 class="higher">Capability Management</h4>
263 263
 						<p>Manage what users and roles have access to GravityView functionality. <a href="http://docs.gravityview.co/article/311-gravityview-capabilities">See what capabilities are available</a>.</p>
264 264
 
265
-						<div class="media-container" style="margin-top: 2em; min-height:80px;"><img src="<?php echo plugins_url( 'assets/images/screenshots/get.png', GRAVITYVIEW_FILE ); ?>" alt=""></div>
265
+						<div class="media-container" style="margin-top: 2em; min-height:80px;"><img src="<?php echo plugins_url('assets/images/screenshots/get.png', GRAVITYVIEW_FILE); ?>" alt=""></div>
266 266
 						<h4 class="higher">The <code>{get}</code> Merge Tag</h4>
267 267
 						<p>Pass data using URLs and create even more powerful integrations with GravityView. <a href="http://docs.gravityview.co/article/314-the-get-merge-tag">Learn how to use <code>{get}</code></a>.</p>
268 268
 					</div>
269 269
 
270 270
 					<div class="col col-2 last-feature">
271
-						<div class="media-container" style="min-height:81px; border: none;"><img src="<?php echo plugins_url( 'assets/images/screenshots/support-port.png', GRAVITYVIEW_FILE ); ?>" alt="The Support Port"></div>
271
+						<div class="media-container" style="min-height:81px; border: none;"><img src="<?php echo plugins_url('assets/images/screenshots/support-port.png', GRAVITYVIEW_FILE); ?>" alt="The Support Port"></div>
272 272
 						<h4 class="higher">Support Port</h4>
273
-						<p>Users can easily search GravityView help docs. Administrators can use it to contact support. Just click the <img src="<?php echo plugins_url( 'assets/images/screenshots/beacon.png', GRAVITYVIEW_FILE ); ?>" width="16" alt="The Support Port icon looks like a question mark"> icon on GravityView screens to activate.</p>
273
+						<p>Users can easily search GravityView help docs. Administrators can use it to contact support. Just click the <img src="<?php echo plugins_url('assets/images/screenshots/beacon.png', GRAVITYVIEW_FILE); ?>" width="16" alt="The Support Port icon looks like a question mark"> icon on GravityView screens to activate.</p>
274 274
 					</div>
275 275
 				</div>
276 276
 
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
 
620 620
 			<?php $this->tabs(); ?>
621 621
 
622
-			<p class="about-description"><?php _e( 'GravityView is brought to you by:', 'gravityview' ); ?></p>
622
+			<p class="about-description"><?php _e('GravityView is brought to you by:', 'gravityview'); ?></p>
623 623
 
624 624
 			<div class="feature-section col two-col">
625 625
 
@@ -627,14 +627,14 @@  discard block
 block discarded – undo
627 627
 					<h2>Zack Katz</h2>
628 628
 					<h4 style="font-weight:0; margin-top:0">Project Lead &amp; Developer</h4>
629 629
 					<p></p>
630
-					<p><img style="float:left; margin: 0 15px 10px 0;" src="<?php echo plugins_url( 'assets/images/zack.jpg', GRAVITYVIEW_FILE ); ?>" width="94" height="94" />Zack has been developing integrations with Gravity Forms since 2009. He is the President of Katz Web Services and lives with his wife (and cat) in Denver, Colorado.</p>
630
+					<p><img style="float:left; margin: 0 15px 10px 0;" src="<?php echo plugins_url('assets/images/zack.jpg', GRAVITYVIEW_FILE); ?>" width="94" height="94" />Zack has been developing integrations with Gravity Forms since 2009. He is the President of Katz Web Services and lives with his wife (and cat) in Denver, Colorado.</p>
631 631
 					<p><a href="https://katz.co">View Zack&rsquo;s website</a></p>
632 632
 				</div>
633 633
 
634 634
 				<div class="col last-feature">
635 635
 					<h2>Luis Godinho</h2>
636 636
 					<h4 style="font-weight:0; margin-top:0">Developer &amp; Support</h4>
637
-					<p><img style="margin: 0 15px 10px 0;"  class="alignleft avatar" src="<?php echo plugins_url( 'assets/images/luis.jpg', GRAVITYVIEW_FILE ); ?>" width="94" height="94" />Luis is a WordPress developer passionate about WordPress. He is a co-founder and partner of GOMO, a digital agency located in Lisbon, Portugal.</p>
637
+					<p><img style="margin: 0 15px 10px 0;"  class="alignleft avatar" src="<?php echo plugins_url('assets/images/luis.jpg', GRAVITYVIEW_FILE); ?>" width="94" height="94" />Luis is a WordPress developer passionate about WordPress. He is a co-founder and partner of GOMO, a digital agency located in Lisbon, Portugal.</p>
638 638
 					<p><a href="http://tinygod.pt">View Luis&rsquo;s website</a></p>
639 639
 				</div>
640 640
 
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
 
645 645
 			<div class="feature-section">
646 646
 				<div>
647
-					<h2><?php esc_attr_e( 'Contributors', 'gravityview' ); ?></h2>
647
+					<h2><?php esc_attr_e('Contributors', 'gravityview'); ?></h2>
648 648
 
649 649
 					<ul class="wp-people-group">
650 650
 						<li class="wp-person">Bengali translation by <a href="https://www.transifex.com/accounts/profile/tareqhi/">@tareqhi</a></li>
@@ -665,8 +665,8 @@  discard block
 block discarded – undo
665 665
 						<li class="wp-person">Code contributions by <a href="https://github.com/ryanduff">@ryanduff</a> and <a href="https://github.com/dmlinn">@dmlinn</a></li>
666 666
 					</ul>
667 667
 
668
-					<h4><?php esc_attr_e( 'Want to contribute?', 'gravityview' ); ?></h4>
669
-					<p><?php echo sprintf( esc_attr__( 'If you want to contribute to the code, %syou can on Github%s. If your contributions are accepted, you will be thanked here.', 'gravityview'), '<a href="https://github.com/katzwebservices/GravityView">', '</a>' ); ?></p>
668
+					<h4><?php esc_attr_e('Want to contribute?', 'gravityview'); ?></h4>
669
+					<p><?php echo sprintf(esc_attr__('If you want to contribute to the code, %syou can on Github%s. If your contributions are accepted, you will be thanked here.', 'gravityview'), '<a href="https://github.com/katzwebservices/GravityView">', '</a>'); ?></p>
670 670
 				</div>
671 671
 			</div>
672 672
 
@@ -705,34 +705,34 @@  discard block
 block discarded – undo
705 705
 		global $plugin_page;
706 706
 
707 707
 		// Bail if we're just editing the plugin
708
-		if( $plugin_page === 'plugin-editor.php' ) { return; }
708
+		if ($plugin_page === 'plugin-editor.php') { return; }
709 709
 
710 710
 		// Bail if no activation redirect
711
-		if ( ! get_transient( '_gv_activation_redirect' ) ) { return; }
711
+		if (!get_transient('_gv_activation_redirect')) { return; }
712 712
 
713 713
 		// Delete the redirect transient
714
-		delete_transient( '_gv_activation_redirect' );
714
+		delete_transient('_gv_activation_redirect');
715 715
 
716
-		$upgrade = get_option( 'gv_version_upgraded_from' );
716
+		$upgrade = get_option('gv_version_upgraded_from');
717 717
 
718 718
 		// Don't do anything if they've already seen the new version info
719
-		if( $upgrade === GravityView_Plugin::version ) {
719
+		if ($upgrade === GravityView_Plugin::version) {
720 720
 			return;
721 721
 		}
722 722
 
723 723
 		// Add "Upgraded From" Option
724
-		update_option( 'gv_version_upgraded_from', GravityView_Plugin::version );
724
+		update_option('gv_version_upgraded_from', GravityView_Plugin::version);
725 725
 
726 726
 		// Bail if activating from network, or bulk
727
-		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { return; }
727
+		if (is_network_admin() || isset($_GET['activate-multi'])) { return; }
728 728
 
729 729
 		// First time install
730
-		if( ! $upgrade ) {
731
-			wp_safe_redirect( admin_url( 'edit.php?post_type=gravityview&page=gv-getting-started' ) ); exit;
730
+		if (!$upgrade) {
731
+			wp_safe_redirect(admin_url('edit.php?post_type=gravityview&page=gv-getting-started')); exit;
732 732
 		}
733 733
 		// Update
734 734
 		else {
735
-			wp_safe_redirect( admin_url( 'edit.php?post_type=gravityview&page=gv-changelog' ) ); exit;
735
+			wp_safe_redirect(admin_url('edit.php?post_type=gravityview&page=gv-changelog')); exit;
736 736
 		}
737 737
 	}
738 738
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,9 @@
 block discarded – undo
4 4
 //set_site_transient( 'update_plugins', null );
5 5
 
6 6
 // Exit if accessed directly
7
-if ( ! defined( 'ABSPATH' ) ) exit;
7
+if ( ! defined( 'ABSPATH' ) ) {
8
+	exit;
9
+}
8 10
 
9 11
 /**
10 12
  * Allows plugins to use their own update API.
Please login to merge, or discard this patch.
includes/class-api.php 3 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -146,20 +146,20 @@  discard block
 block discarded – undo
146 146
 
147 147
 		if( !empty( $field['custom_class'] ) ) {
148 148
 
149
-            $custom_class = $field['custom_class'];
149
+			$custom_class = $field['custom_class'];
150 150
 
151
-            if( !empty( $entry ) ) {
151
+			if( !empty( $entry ) ) {
152 152
 
153
-                // We want the merge tag to be formatted as a class. The merge tag may be
154
-                // replaced by a multiple-word value that should be output as a single class.
155
-                // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager`
156
-                add_filter('gform_merge_tag_filter', 'sanitize_html_class');
153
+				// We want the merge tag to be formatted as a class. The merge tag may be
154
+				// replaced by a multiple-word value that should be output as a single class.
155
+				// "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager`
156
+				add_filter('gform_merge_tag_filter', 'sanitize_html_class');
157 157
 
158
-                $custom_class = self::replace_variables( $custom_class, $form, $entry);
158
+				$custom_class = self::replace_variables( $custom_class, $form, $entry);
159 159
 
160
-                // And then we want life to return to normal
161
-                remove_filter('gform_merge_tag_filter', 'sanitize_html_class');
162
-            }
160
+				// And then we want life to return to normal
161
+				remove_filter('gform_merge_tag_filter', 'sanitize_html_class');
162
+			}
163 163
 
164 164
 			// And now we want the spaces to be handled nicely.
165 165
 			$classes[] = gravityview_sanitize_html_class( $custom_class );
@@ -591,29 +591,29 @@  discard block
 block discarded – undo
591 591
 		return sanitize_title( $slug );
592 592
 	}
593 593
 
594
-    /**
595
-     * If using the entry custom slug feature, make sure the new entries have the custom slug created and saved as meta
596
-     *
597
-     * Triggered by add_action( 'gform_entry_created', array( 'GravityView_API', 'entry_create_custom_slug' ), 10, 2 );
598
-     *
599
-     * @param $entry array Gravity Forms entry object
600
-     * @param $form array Gravity Forms form object
601
-     */
602
-    public static function entry_create_custom_slug( $entry, $form ) {
603
-        /**
604
-         * @filter `gravityview_custom_entry_slug` On entry creation, check if we are using the custom entry slug feature and update the meta
605
-         * @param boolean $custom Should we process the custom entry slug?
606
-         */
607
-        $custom = apply_filters( 'gravityview_custom_entry_slug', false );
608
-        if( $custom ) {
609
-            // create the gravityview_unique_id and save it
594
+	/**
595
+	 * If using the entry custom slug feature, make sure the new entries have the custom slug created and saved as meta
596
+	 *
597
+	 * Triggered by add_action( 'gform_entry_created', array( 'GravityView_API', 'entry_create_custom_slug' ), 10, 2 );
598
+	 *
599
+	 * @param $entry array Gravity Forms entry object
600
+	 * @param $form array Gravity Forms form object
601
+	 */
602
+	public static function entry_create_custom_slug( $entry, $form ) {
603
+		/**
604
+		 * @filter `gravityview_custom_entry_slug` On entry creation, check if we are using the custom entry slug feature and update the meta
605
+		 * @param boolean $custom Should we process the custom entry slug?
606
+		 */
607
+		$custom = apply_filters( 'gravityview_custom_entry_slug', false );
608
+		if( $custom ) {
609
+			// create the gravityview_unique_id and save it
610 610
 
611
-            // Get the entry hash
612
-            $hash = self::get_custom_entry_slug( $entry['id'], $entry );
613
-            gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash );
611
+			// Get the entry hash
612
+			$hash = self::get_custom_entry_slug( $entry['id'], $entry );
613
+			gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash );
614 614
 
615
-        }
616
-    }
615
+		}
616
+	}
617 617
 
618 618
 
619 619
 
@@ -851,7 +851,7 @@  discard block
 block discarded – undo
851 851
 
852 852
 			// If there was an error, continue to the next term.
853 853
 			if ( is_wp_error( $term_link ) ) {
854
-			    continue;
854
+				continue;
855 855
 			}
856 856
 
857 857
 			$output[] = gravityview_get_link( $term_link, esc_html( $term->name ) );
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -214,7 +214,6 @@  discard block
 block discarded – undo
214 214
 	 *
215 215
 	 * @access public
216 216
 	 * @param array $entry
217
-	 * @param integer $field
218 217
 	 * @return null|string
219 218
 	 */
220 219
 	public static function field_value( $entry, $field_settings, $format = 'html' ) {
@@ -967,7 +966,7 @@  discard block
 block discarded – undo
967 966
  * Get the current View ID being rendered
968 967
  *
969 968
  * @global GravityView_View $gravityview_view
970
- * @return string View context "directory" or "single"
969
+ * @return integer View context "directory" or "single"
971 970
  */
972 971
 function gravityview_get_view_id() {
973 972
 	return GravityView_View::getInstance()->getViewId();
Please login to merge, or discard this patch.
Spacing   +224 added lines, -224 removed lines patch added patch discarded remove patch
@@ -23,36 +23,36 @@  discard block
 block discarded – undo
23 23
 	 * @param boolean $force_show_label Whether to always show the label, regardless of field settings
24 24
 	 * @return string
25 25
 	 */
26
-	public static function field_label( $field, $entry = array(), $force_show_label = false ) {
26
+	public static function field_label($field, $entry = array(), $force_show_label = false) {
27 27
 		$gravityview_view = GravityView_View::getInstance();
28 28
 
29 29
 		$form = $gravityview_view->getForm();
30 30
 
31 31
 		$label = '';
32 32
 
33
-		if( !empty( $field['show_label'] ) || $force_show_label ) {
33
+		if (!empty($field['show_label']) || $force_show_label) {
34 34
 
35 35
 			$label = $field['label'];
36 36
 
37 37
 			// Support Gravity Forms 1.9+
38
-			if( class_exists( 'GF_Field' ) ) {
38
+			if (class_exists('GF_Field')) {
39 39
 
40
-				$field_object = RGFormsModel::get_field( $form, $field['id'] );
40
+				$field_object = RGFormsModel::get_field($form, $field['id']);
41 41
 
42
-				if( $field_object ) {
42
+				if ($field_object) {
43 43
 
44
-					$input = GFFormsModel::get_input( $field_object, $field['id'] );
44
+					$input = GFFormsModel::get_input($field_object, $field['id']);
45 45
 
46 46
 					// This is a complex field, with labels on a per-input basis
47
-					if( $input ) {
47
+					if ($input) {
48 48
 
49 49
 						// Does the input have a custom label on a per-input basis? Otherwise, default label.
50
-						$label = ! empty( $input['customLabel'] ) ? $input['customLabel'] : $input['label'];
50
+						$label = !empty($input['customLabel']) ? $input['customLabel'] : $input['label'];
51 51
 
52 52
 					} else {
53 53
 
54 54
 						// This is a field with one label
55
-						$label = $field_object->get_field_label( true, $field['label'] );
55
+						$label = $field_object->get_field_label(true, $field['label']);
56 56
 
57 57
 					}
58 58
 
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
 			}
62 62
 
63 63
 			// Use Gravity Forms label by default, but if a custom label is defined in GV, use it.
64
-			if ( !empty( $field['custom_label'] ) ) {
64
+			if (!empty($field['custom_label'])) {
65 65
 
66
-				$label = self::replace_variables( $field['custom_label'], $form, $entry );
66
+				$label = self::replace_variables($field['custom_label'], $form, $entry);
67 67
 
68 68
 			}
69 69
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 			 * @param[in,out] string $appended_content Content you can add after a label. Empty by default.
73 73
 			 * @param[in] array $field GravityView field array
74 74
 			 */
75
-			$label .= apply_filters( 'gravityview_render_after_label', '', $field );
75
+			$label .= apply_filters('gravityview_render_after_label', '', $field);
76 76
 
77 77
 		} // End $field['show_label']
78 78
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 		 * @param[in] array $form Gravity Forms form array
85 85
 		 * @param[in] array $entry Gravity Forms entry array
86 86
 		 */
87
-		$label = apply_filters( 'gravityview/template/field_label', $label, $field, $form, $entry );
87
+		$label = apply_filters('gravityview/template/field_label', $label, $field, $form, $entry);
88 88
 
89 89
 		return $label;
90 90
 	}
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
 	 * @param  array      $entry        GF Entry array
100 100
 	 * @return string                  Text with variables maybe replaced
101 101
 	 */
102
-	public static function replace_variables($text, $form, $entry ) {
103
-		return GravityView_Merge_Tags::replace_variables( $text, $form, $entry );
102
+	public static function replace_variables($text, $form, $entry) {
103
+		return GravityView_Merge_Tags::replace_variables($text, $form, $entry);
104 104
 	}
105 105
 
106 106
 	/**
@@ -113,19 +113,19 @@  discard block
 block discarded – undo
113 113
 	 *
114 114
 	 * @return string|null If not empty, string in $format format. Otherwise, null.
115 115
 	 */
116
-	public static function field_width( $field, $format = '%d%%' ) {
116
+	public static function field_width($field, $format = '%d%%') {
117 117
 
118 118
 		$width = NULL;
119 119
 
120
-		if( !empty( $field['width'] ) ) {
121
-			$width = absint( $field['width'] );
120
+		if (!empty($field['width'])) {
121
+			$width = absint($field['width']);
122 122
 
123 123
 			// If using percentages, limit to 100%
124
-			if( '%d%%' === $format && $width > 100 ) {
124
+			if ('%d%%' === $format && $width > 100) {
125 125
 				$width = 100;
126 126
 			}
127 127
 
128
-			$width = sprintf( $format, $width );
128
+			$width = sprintf($format, $width);
129 129
 		}
130 130
 
131 131
 		return $width;
@@ -139,38 +139,38 @@  discard block
 block discarded – undo
139 139
 	 * @param mixed $field
140 140
 	 * @return string
141 141
 	 */
142
-	public static function field_class( $field, $form = NULL, $entry = NULL ) {
142
+	public static function field_class($field, $form = NULL, $entry = NULL) {
143 143
 		$gravityview_view = GravityView_View::getInstance();
144 144
 
145 145
 		$classes = array();
146 146
 
147
-		if( !empty( $field['custom_class'] ) ) {
147
+		if (!empty($field['custom_class'])) {
148 148
 
149 149
             $custom_class = $field['custom_class'];
150 150
 
151
-            if( !empty( $entry ) ) {
151
+            if (!empty($entry)) {
152 152
 
153 153
                 // We want the merge tag to be formatted as a class. The merge tag may be
154 154
                 // replaced by a multiple-word value that should be output as a single class.
155 155
                 // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager`
156 156
                 add_filter('gform_merge_tag_filter', 'sanitize_html_class');
157 157
 
158
-                $custom_class = self::replace_variables( $custom_class, $form, $entry);
158
+                $custom_class = self::replace_variables($custom_class, $form, $entry);
159 159
 
160 160
                 // And then we want life to return to normal
161 161
                 remove_filter('gform_merge_tag_filter', 'sanitize_html_class');
162 162
             }
163 163
 
164 164
 			// And now we want the spaces to be handled nicely.
165
-			$classes[] = gravityview_sanitize_html_class( $custom_class );
165
+			$classes[] = gravityview_sanitize_html_class($custom_class);
166 166
 
167 167
 		}
168 168
 
169
-		if(!empty($field['id'])) {
170
-			if( !empty( $form ) && !empty( $form['id'] ) ) {
169
+		if (!empty($field['id'])) {
170
+			if (!empty($form) && !empty($form['id'])) {
171 171
 				$form_id = '-'.$form['id'];
172 172
 			} else {
173
-				$form_id = $gravityview_view->getFormId() ? '-'. $gravityview_view->getFormId() : '';
173
+				$form_id = $gravityview_view->getFormId() ? '-'.$gravityview_view->getFormId() : '';
174 174
 			}
175 175
 
176 176
 			$classes[] = 'gv-field'.$form_id.'-'.$field['id'];
@@ -191,21 +191,21 @@  discard block
 block discarded – undo
191 191
 	 * @param array $entry Gravity Forms entry array
192 192
 	 * @return string Sanitized unique HTML `id` attribute for the field
193 193
 	 */
194
-	public static function field_html_attr_id( $field, $form = array(), $entry = array() ) {
194
+	public static function field_html_attr_id($field, $form = array(), $entry = array()) {
195 195
 		$gravityview_view = GravityView_View::getInstance();
196 196
 		$id = $field['id'];
197 197
 
198
-		if ( ! empty( $id ) ) {
199
-			if ( ! empty( $form ) && ! empty( $form['id'] ) ) {
200
-				$form_id = '-' . $form['id'];
198
+		if (!empty($id)) {
199
+			if (!empty($form) && !empty($form['id'])) {
200
+				$form_id = '-'.$form['id'];
201 201
 			} else {
202
-				$form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : '';
202
+				$form_id = $gravityview_view->getFormId() ? '-'.$gravityview_view->getFormId() : '';
203 203
 			}
204 204
 
205
-			$id = 'gv-field' . $form_id . '-' . $field['id'];
205
+			$id = 'gv-field'.$form_id.'-'.$field['id'];
206 206
 		}
207 207
 
208
-		return esc_attr( $id );
208
+		return esc_attr($id);
209 209
 	}
210 210
 
211 211
 
@@ -217,15 +217,15 @@  discard block
 block discarded – undo
217 217
 	 * @param integer $field
218 218
 	 * @return null|string
219 219
 	 */
220
-	public static function field_value( $entry, $field_settings, $format = 'html' ) {
220
+	public static function field_value($entry, $field_settings, $format = 'html') {
221 221
 
222
-		if( empty( $entry['form_id'] ) || empty( $field_settings['id'] ) ) {
222
+		if (empty($entry['form_id']) || empty($field_settings['id'])) {
223 223
 			return NULL;
224 224
 		}
225 225
 
226 226
 		$gravityview_view = GravityView_View::getInstance();
227 227
 
228
-		if( class_exists( 'GFCache' ) ) {
228
+		if (class_exists('GFCache')) {
229 229
 			/**
230 230
 			 * Gravity Forms' GFCache function was thrashing the database, causing double the amount of time for the field_value() method to run.
231 231
 			 *
@@ -240,18 +240,18 @@  discard block
 block discarded – undo
240 240
 			 * @param boolean false Tell Gravity Forms not to store this as a transient
241 241
 			 * @param  int 0 Time to store the value. 0 is maximum amount of time possible.
242 242
 			 */
243
-			GFCache::set( "GFFormsModel::get_lead_field_value_" . $entry["id"] . "_" . $field_settings["id"], false, false, 0 );
243
+			GFCache::set("GFFormsModel::get_lead_field_value_".$entry["id"]."_".$field_settings["id"], false, false, 0);
244 244
 		}
245 245
 
246 246
 		$field_id = $field_settings['id'];
247 247
 
248 248
 		$form = $gravityview_view->getForm();
249 249
 
250
-		$field = gravityview_get_field( $form, $field_id );
250
+		$field = gravityview_get_field($form, $field_id);
251 251
 
252 252
 		$field_type = RGFormsModel::get_input_type($field);
253 253
 
254
-		if( $field_type ) {
254
+		if ($field_type) {
255 255
 			$field_type = $field['type'];
256 256
 			$value = RGFormsModel::get_lead_field_value($entry, $field);
257 257
 		} else {
@@ -266,15 +266,15 @@  discard block
 block discarded – undo
266 266
 
267 267
 		$display_value = GFCommon::get_lead_field_display($field, $value, $entry["currency"], false, $format);
268 268
 
269
-		if( $errors = ob_get_clean() ) {
270
-			do_action( 'gravityview_log_error', 'GravityView_API[field_value] Errors when calling GFCommon::get_lead_field_display()', $errors );
269
+		if ($errors = ob_get_clean()) {
270
+			do_action('gravityview_log_error', 'GravityView_API[field_value] Errors when calling GFCommon::get_lead_field_display()', $errors);
271 271
 		}
272 272
 
273 273
 		$display_value = apply_filters("gform_entry_field_value", $display_value, $field, $entry, $form);
274 274
 
275 275
 		// prevent the use of merge_tags for non-admin fields
276
-		if( !empty( $field['adminOnly'] ) ) {
277
-			$display_value = self::replace_variables( $display_value, $form, $entry );
276
+		if (!empty($field['adminOnly'])) {
277
+			$display_value = self::replace_variables($display_value, $form, $entry);
278 278
 		}
279 279
 
280 280
 		// Check whether the field exists in /includes/fields/{$field_type}.php
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 		$field_path = $gravityview_view->locate_template("fields/{$field_type}.php");
283 283
 
284 284
 		// Set the field data to be available in the templates
285
-		$gravityview_view->setCurrentField( array(
285
+		$gravityview_view->setCurrentField(array(
286 286
 			'form' => $form,
287 287
 			'field_id' => $field_id,
288 288
 			'field' => $field,
@@ -294,13 +294,13 @@  discard block
 block discarded – undo
294 294
 			'field_type' => $field_type, /** {@since 1.6} **/
295 295
 		));
296 296
 
297
-		if( ! empty( $field_path ) ) {
297
+		if (!empty($field_path)) {
298 298
 
299
-			do_action( 'gravityview_log_debug', sprintf('[field_value] Rendering %s', $field_path ) );
299
+			do_action('gravityview_log_debug', sprintf('[field_value] Rendering %s', $field_path));
300 300
 
301 301
 			ob_start();
302 302
 
303
-			load_template( $field_path, false );
303
+			load_template($field_path, false);
304 304
 
305 305
 			$output = ob_get_clean();
306 306
 
@@ -319,11 +319,11 @@  discard block
 block discarded – undo
319 319
 		 * Fields can override this by modifying the field data variable inside the field. See /templates/fields/post_image.php for an example.
320 320
 		 *
321 321
 		 */
322
-		if( !empty( $field_settings['show_as_link'] ) ) {
322
+		if (!empty($field_settings['show_as_link'])) {
323 323
 
324
-			$link_atts = empty( $field_settings['new_window'] ) ? array() : array( 'target' => '_blank' );
324
+			$link_atts = empty($field_settings['new_window']) ? array() : array('target' => '_blank');
325 325
 
326
-			$output = self::entry_link_html( $entry, $output, $link_atts, $field_settings );
326
+			$output = self::entry_link_html($entry, $output, $link_atts, $field_settings);
327 327
 
328 328
 		}
329 329
 
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 		 * @param array  $entry The GF entry array
335 335
 		 * @param  array $field_settings Settings for the particular GV field
336 336
 		 */
337
-		$output = apply_filters( 'gravityview_field_entry_value_'.$field_type, $output, $entry, $field_settings, $gravityview_view->getCurrentField() );
337
+		$output = apply_filters('gravityview_field_entry_value_'.$field_type, $output, $entry, $field_settings, $gravityview_view->getCurrentField());
338 338
 
339 339
 		/**
340 340
 		 * @filter `gravityview_field_entry_value` Modify the field value output for all field types
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 		 * @param  array $field_settings Settings for the particular GV field
344 344
 		 * @param array $field_data  {@since 1.6}
345 345
 		 */
346
-		$output = apply_filters( 'gravityview_field_entry_value', $output, $entry, $field_settings, $gravityview_view->getCurrentField() );
346
+		$output = apply_filters('gravityview_field_entry_value', $output, $entry, $field_settings, $gravityview_view->getCurrentField());
347 347
 
348 348
 		return $output;
349 349
 	}
@@ -357,18 +357,18 @@  discard block
 block discarded – undo
357 357
 	 * @param array $entry Gravity Forms entry array
358 358
 	 * @param array $field_settings Array of field settings. Optional, but passed to the `gravityview_field_entry_link` filter
359 359
 	 */
360
-	public static function entry_link_html( $entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array() ) {
360
+	public static function entry_link_html($entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array()) {
361 361
 
362
-		if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry['id'] ) ) {
362
+		if (empty($entry) || !is_array($entry) || !isset($entry['id'])) {
363 363
 
364
-			do_action( 'gravityview_log_debug', 'GravityView_API[entry_link_tag] Entry not defined; returning null', $entry );
364
+			do_action('gravityview_log_debug', 'GravityView_API[entry_link_tag] Entry not defined; returning null', $entry);
365 365
 
366 366
 			return NULL;
367 367
 		}
368 368
 
369
-		$href = self::entry_link( $entry );
369
+		$href = self::entry_link($entry);
370 370
 
371
-		$link = gravityview_get_link( $href, $anchor_text, $passed_tag_atts );
371
+		$link = gravityview_get_link($href, $anchor_text, $passed_tag_atts);
372 372
 
373 373
 		/**
374 374
 		 * @filter `gravityview_field_entry_link` Modify the link HTML
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 		 * @param array  $entry The GF entry array
378 378
 		 * @param  array $field_settings Settings for the particular GV field
379 379
 		 */
380
-		$output = apply_filters( 'gravityview_field_entry_link', $link, $href, $entry, $field_settings );
380
+		$output = apply_filters('gravityview_field_entry_link', $link, $href, $entry, $field_settings);
381 381
 
382 382
 		return $output;
383 383
 	}
@@ -392,11 +392,11 @@  discard block
 block discarded – undo
392 392
 
393 393
 		$is_search = false;
394 394
 
395
-		if( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) {
395
+		if ($gravityview_view && ($gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search)) {
396 396
 			$is_search = true;
397 397
 		}
398 398
 
399
-		if($is_search) {
399
+		if ($is_search) {
400 400
 			$output = __('This search returned no results.', 'gravityview');
401 401
 		} else {
402 402
 			$output = __('No entries match your request.', 'gravityview');
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 		 * @param string $output The existing "No Entries" text
408 408
 		 * @param boolean $is_search Is the current page a search result, or just a multiple entries screen?
409 409
 		 */
410
-		$output = apply_filters( 'gravitview_no_entries_text', $output, $is_search);
410
+		$output = apply_filters('gravitview_no_entries_text', $output, $is_search);
411 411
 
412 412
 		return $wpautop ? wpautop($output) : $output;
413 413
 	}
@@ -421,42 +421,42 @@  discard block
 block discarded – undo
421 421
 	 * @param boolean $add_query_args Add pagination and sorting arguments
422 422
 	 * @return string      Permalink to multiple entries view
423 423
 	 */
424
-	public static function directory_link( $post_id = NULL, $add_query_args = true ) {
424
+	public static function directory_link($post_id = NULL, $add_query_args = true) {
425 425
 		global $post;
426 426
 
427 427
 		$gravityview_view = GravityView_View::getInstance();
428 428
 
429
-		if( empty( $post_id ) ) {
429
+		if (empty($post_id)) {
430 430
 
431 431
 			$post_id = false;
432 432
 
433 433
 			// DataTables passes the Post ID
434
-			if( defined('DOING_AJAX') && DOING_AJAX ) {
434
+			if (defined('DOING_AJAX') && DOING_AJAX) {
435 435
 
436
-				$post_id = isset( $_POST['post_id'] ) ? (int)$_POST['post_id'] : false;
436
+				$post_id = isset($_POST['post_id']) ? (int)$_POST['post_id'] : false;
437 437
 
438 438
 			} else {
439 439
 
440 440
 				// The Post ID has been passed via the shortcode
441
-				if( !empty( $gravityview_view ) && $gravityview_view->getPostId() ) {
441
+				if (!empty($gravityview_view) && $gravityview_view->getPostId()) {
442 442
 
443 443
 					$post_id = $gravityview_view->getPostId();
444 444
 
445 445
 				} else {
446 446
 
447 447
 					// This is a GravityView post type
448
-					if( GravityView_frontend::getInstance()->isGravityviewPostType() ) {
448
+					if (GravityView_frontend::getInstance()->isGravityviewPostType()) {
449 449
 
450
-						$post_id = isset( $gravityview_view ) ? $gravityview_view->getViewId() : $post->ID;
450
+						$post_id = isset($gravityview_view) ? $gravityview_view->getViewId() : $post->ID;
451 451
 
452 452
 					} else {
453 453
 
454 454
 						// This is an embedded GravityView; use the embedded post's ID as the base.
455
-						if( GravityView_frontend::getInstance()->isPostHasShortcode() && is_a( $post, 'WP_Post' ) ) {
455
+						if (GravityView_frontend::getInstance()->isPostHasShortcode() && is_a($post, 'WP_Post')) {
456 456
 
457 457
 							$post_id = $post->ID;
458 458
 
459
-						} elseif( $gravityview_view->getViewId() ) {
459
+						} elseif ($gravityview_view->getViewId()) {
460 460
 
461 461
 							// The GravityView has been embedded in a widget or in a template, and
462 462
 							// is not in the current content. Thus, we defer to the View's own ID.
@@ -471,39 +471,39 @@  discard block
 block discarded – undo
471 471
 		}
472 472
 
473 473
 		// No post ID, get outta here.
474
-		if( empty( $post_id ) ) {
474
+		if (empty($post_id)) {
475 475
 			return NULL;
476 476
 		}
477 477
 
478 478
 		// If we've saved the permalink in memory, use it
479 479
 		// @since 1.3
480
-		$link = wp_cache_get( 'gv_directory_link_'.$post_id );
480
+		$link = wp_cache_get('gv_directory_link_'.$post_id);
481 481
 
482
-		if( empty( $link ) ) {
482
+		if (empty($link)) {
483 483
 
484
-			$link = get_permalink( $post_id );
484
+			$link = get_permalink($post_id);
485 485
 
486 486
 			// If not yet saved, cache the permalink.
487 487
 			// @since 1.3
488
-			wp_cache_set( 'gv_directory_link_'.$post_id, $link );
488
+			wp_cache_set('gv_directory_link_'.$post_id, $link);
489 489
 
490 490
 		}
491 491
 
492 492
 		// Deal with returning to proper pagination for embedded views
493
-		if( $link && $add_query_args ) {
493
+		if ($link && $add_query_args) {
494 494
 
495 495
 			$args = array();
496 496
 
497
-			if( $pagenum = rgget('pagenum') ) {
498
-				$args['pagenum'] = intval( $pagenum );
497
+			if ($pagenum = rgget('pagenum')) {
498
+				$args['pagenum'] = intval($pagenum);
499 499
 			}
500 500
 
501
-			if( $sort = rgget('sort') ) {
501
+			if ($sort = rgget('sort')) {
502 502
 				$args['sort'] = $sort;
503 503
 				$args['dir'] = rgget('dir');
504 504
 			}
505 505
 
506
-			$link = add_query_arg( $args, $link );
506
+			$link = add_query_arg($args, $link);
507 507
 		}
508 508
 
509 509
 		return $link;
@@ -520,10 +520,10 @@  discard block
 block discarded – undo
520 520
 	 * @param  array  $entry        Entry data passed to provide additional information when generating the hash. Optional - don't rely on it being available.
521 521
 	 * @return string               Hashed unique value for entry
522 522
 	 */
523
-	private static function get_custom_entry_slug( $id, $entry = array() ) {
523
+	private static function get_custom_entry_slug($id, $entry = array()) {
524 524
 
525 525
 		// Generate an unique hash to use as the default value
526
-		$slug = substr( wp_hash( $id, 'gravityview'.$id ), 0, 8 );
526
+		$slug = substr(wp_hash($id, 'gravityview'.$id), 0, 8);
527 527
 
528 528
 		/**
529 529
 		 * @filter `gravityview_entry_slug` Modify the unique hash ID generated, if you want to improve usability or change the format. This will allow for custom URLs, such as `{entryid}-{first-name}` or even, if unique, `{first-name}-{last-name}`
@@ -531,14 +531,14 @@  discard block
 block discarded – undo
531 531
 		 * @param  string $id The entry ID
532 532
 		 * @param  array $entry Entry data array. May be empty.
533 533
 		 */
534
-		$slug = apply_filters( 'gravityview_entry_slug', $slug, $id, $entry );
534
+		$slug = apply_filters('gravityview_entry_slug', $slug, $id, $entry);
535 535
 
536 536
 		// Make sure we have something - use the original ID as backup.
537
-		if( empty( $slug ) ) {
537
+		if (empty($slug)) {
538 538
 			$slug = $id;
539 539
 		}
540 540
 
541
-		return sanitize_title( $slug );
541
+		return sanitize_title($slug);
542 542
 	}
543 543
 
544 544
 	/**
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 	 * @param  array  $entry        Gravity Forms Entry array, optional. Used only to provide data to customize the `gravityview_entry_slug` filter
553 553
 	 * @return string               Unique slug ID, passed through `sanitize_title()`
554 554
 	 */
555
-	public static function get_entry_slug( $id_or_string, $entry = array() ) {
555
+	public static function get_entry_slug($id_or_string, $entry = array()) {
556 556
 
557 557
 		/**
558 558
 		 * Default: use the entry ID as the unique identifier
@@ -563,32 +563,32 @@  discard block
 block discarded – undo
563 563
 		 * @filter `gravityview_custom_entry_slug` Whether to enable and use custom entry slugs.
564 564
 		 * @param boolean True: Allow for slugs based on entry values. False: always use entry IDs (default)
565 565
 		 */
566
-		$custom = apply_filters('gravityview_custom_entry_slug', false );
566
+		$custom = apply_filters('gravityview_custom_entry_slug', false);
567 567
 
568 568
 		// If we're using custom slug...
569
-		if ( $custom ) {
569
+		if ($custom) {
570 570
 
571 571
 			// Get the entry hash
572
-			$hash = self::get_custom_entry_slug( $id_or_string, $entry );
572
+			$hash = self::get_custom_entry_slug($id_or_string, $entry);
573 573
 
574 574
 			// See if the entry already has a hash set
575
-			$value = gform_get_meta( $id_or_string, 'gravityview_unique_id' );
575
+			$value = gform_get_meta($id_or_string, 'gravityview_unique_id');
576 576
 
577 577
 			// If it does have a hash set, and the hash is expected, use it.
578 578
 			// This check allows users to change the hash structure using the
579 579
 			// gravityview_entry_hash filter and have the old hashes expire.
580
-			if( empty( $value ) || $value !== $hash ) {
580
+			if (empty($value) || $value !== $hash) {
581 581
 
582
-				gform_update_meta( $id_or_string, 'gravityview_unique_id', $hash );
582
+				gform_update_meta($id_or_string, 'gravityview_unique_id', $hash);
583 583
 
584 584
 			}
585 585
 
586 586
 			$slug = $hash;
587 587
 
588
-			unset( $value, $hash );
588
+			unset($value, $hash);
589 589
 		}
590 590
 
591
-		return sanitize_title( $slug );
591
+		return sanitize_title($slug);
592 592
 	}
593 593
 
594 594
     /**
@@ -599,18 +599,18 @@  discard block
 block discarded – undo
599 599
      * @param $entry array Gravity Forms entry object
600 600
      * @param $form array Gravity Forms form object
601 601
      */
602
-    public static function entry_create_custom_slug( $entry, $form ) {
602
+    public static function entry_create_custom_slug($entry, $form) {
603 603
         /**
604 604
          * @filter `gravityview_custom_entry_slug` On entry creation, check if we are using the custom entry slug feature and update the meta
605 605
          * @param boolean $custom Should we process the custom entry slug?
606 606
          */
607
-        $custom = apply_filters( 'gravityview_custom_entry_slug', false );
608
-        if( $custom ) {
607
+        $custom = apply_filters('gravityview_custom_entry_slug', false);
608
+        if ($custom) {
609 609
             // create the gravityview_unique_id and save it
610 610
 
611 611
             // Get the entry hash
612
-            $hash = self::get_custom_entry_slug( $entry['id'], $entry );
613
-            gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash );
612
+            $hash = self::get_custom_entry_slug($entry['id'], $entry);
613
+            gform_update_meta($entry['id'], 'gravityview_unique_id', $hash);
614 614
 
615 615
         }
616 616
     }
@@ -625,55 +625,55 @@  discard block
 block discarded – undo
625 625
 	 * @param boolean $add_directory_args True: Add args to help return to directory; False: only include args required to get to entry {@since 1.7.3}
626 626
 	 * @return string          Link to the entry with the directory parent slug
627 627
 	 */
628
-	public static function entry_link( $entry, $post_id = NULL, $add_directory_args = true ) {
628
+	public static function entry_link($entry, $post_id = NULL, $add_directory_args = true) {
629 629
 
630
-		if( ! empty( $entry ) && ! is_array( $entry ) ) {
631
-			$entry = GVCommon::get_entry( $entry );
632
-		} else if( empty( $entry ) ) {
630
+		if (!empty($entry) && !is_array($entry)) {
631
+			$entry = GVCommon::get_entry($entry);
632
+		} else if (empty($entry)) {
633 633
 			$entry = GravityView_frontend::getInstance()->getEntry();
634 634
 		}
635 635
 
636 636
 		// Second parameter used to be passed as $field; this makes sure it's not an array
637
-		if( !is_numeric( $post_id ) ) {
637
+		if (!is_numeric($post_id)) {
638 638
 			$post_id = NULL;
639 639
 		}
640 640
 
641 641
 		// Get the permalink to the View
642
-		$directory_link = self::directory_link( $post_id, false );
642
+		$directory_link = self::directory_link($post_id, false);
643 643
 
644 644
 		// No post ID? Get outta here.
645
-		if( empty( $directory_link ) ) {
645
+		if (empty($directory_link)) {
646 646
 			return '';
647 647
 		}
648 648
 
649 649
 		$query_arg_name = GravityView_Post_Types::get_entry_var_name();
650 650
 
651
-		$entry_slug = self::get_entry_slug( $entry['id'], $entry );
651
+		$entry_slug = self::get_entry_slug($entry['id'], $entry);
652 652
 
653
-		if( get_option('permalink_structure') && !is_preview() ) {
653
+		if (get_option('permalink_structure') && !is_preview()) {
654 654
 
655 655
 			$args = array();
656 656
 
657
-			$directory_link = trailingslashit( $directory_link ) . $query_arg_name . '/'. $entry_slug .'/';
657
+			$directory_link = trailingslashit($directory_link).$query_arg_name.'/'.$entry_slug.'/';
658 658
 
659 659
 		} else {
660 660
 
661
-			$args = array( $query_arg_name => $entry_slug );
661
+			$args = array($query_arg_name => $entry_slug);
662 662
 		}
663 663
 
664 664
 		/**
665 665
 		 * @since 1.7.3
666 666
 		 */
667
-		if( $add_directory_args ) {
667
+		if ($add_directory_args) {
668 668
 
669
-			if( !empty( $_GET['pagenum'] ) ) {
670
-				$args['pagenum'] = intval( $_GET['pagenum'] );
669
+			if (!empty($_GET['pagenum'])) {
670
+				$args['pagenum'] = intval($_GET['pagenum']);
671 671
 			}
672 672
 
673 673
 			/**
674 674
 			 * @since 1.7
675 675
 			 */
676
-			if( $sort = rgget('sort') ) {
676
+			if ($sort = rgget('sort')) {
677 677
 				$args['sort'] = $sort;
678 678
 				$args['dir'] = rgget('dir');
679 679
 			}
@@ -685,11 +685,11 @@  discard block
 block discarded – undo
685 685
 		 * has the view id so that Advanced Filters can be applied correctly when rendering the single view
686 686
 		 * @see GravityView_frontend::get_context_view_id()
687 687
 		 */
688
-		if( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) {
688
+		if (class_exists('GravityView_View_Data') && GravityView_View_Data::getInstance()->has_multiple_views()) {
689 689
 			$args['gvid'] = gravityview_get_view_id();
690 690
 		}
691 691
 
692
-		return add_query_arg( $args, $directory_link );
692
+		return add_query_arg($args, $directory_link);
693 693
 
694 694
 	}
695 695
 
@@ -699,54 +699,54 @@  discard block
 block discarded – undo
699 699
 
700 700
 // inside loop functions
701 701
 
702
-function gv_label( $field, $entry = NULL ) {
703
-	return GravityView_API::field_label( $field, $entry );
702
+function gv_label($field, $entry = NULL) {
703
+	return GravityView_API::field_label($field, $entry);
704 704
 }
705 705
 
706
-function gv_class( $field, $form = NULL, $entry = array() ) {
707
-	return GravityView_API::field_class( $field, $form, $entry  );
706
+function gv_class($field, $form = NULL, $entry = array()) {
707
+	return GravityView_API::field_class($field, $form, $entry);
708 708
 }
709 709
 
710
-function gv_container_class( $class = '' ) {
710
+function gv_container_class($class = '') {
711 711
 
712 712
 	$default = ' gv-container';
713 713
 
714
-	if( GravityView_View::getInstance()->isHideUntilSearched() ) {
714
+	if (GravityView_View::getInstance()->isHideUntilSearched()) {
715 715
 		$default .= ' hidden';
716 716
 	}
717 717
 
718
-	$class = apply_filters( 'gravityview/render/container/class', $class . $default );
718
+	$class = apply_filters('gravityview/render/container/class', $class.$default);
719 719
 
720
-	$class = gravityview_sanitize_html_class( $class );
720
+	$class = gravityview_sanitize_html_class($class);
721 721
 
722 722
 	echo $class;
723 723
 }
724 724
 
725
-function gv_value( $entry, $field ) {
725
+function gv_value($entry, $field) {
726 726
 
727
-	$value = GravityView_API::field_value( $entry, $field );
727
+	$value = GravityView_API::field_value($entry, $field);
728 728
 
729
-	if( $value === '') {
729
+	if ($value === '') {
730 730
 		/**
731 731
 		 * @filter `gravityview_empty_value` What to display when a field is empty
732 732
 		 * @param string $value (empty string)
733 733
 		 */
734
-		$value = apply_filters( 'gravityview_empty_value', '' );
734
+		$value = apply_filters('gravityview_empty_value', '');
735 735
 	}
736 736
 
737 737
 	return $value;
738 738
 }
739 739
 
740
-function gv_directory_link( $post = NULL, $add_pagination = true ) {
741
-	return GravityView_API::directory_link( $post, $add_pagination );
740
+function gv_directory_link($post = NULL, $add_pagination = true) {
741
+	return GravityView_API::directory_link($post, $add_pagination);
742 742
 }
743 743
 
744
-function gv_entry_link( $entry, $post_id = NULL ) {
745
-	return GravityView_API::entry_link( $entry, $post_id );
744
+function gv_entry_link($entry, $post_id = NULL) {
745
+	return GravityView_API::entry_link($entry, $post_id);
746 746
 }
747 747
 
748 748
 function gv_no_results($wpautop = true) {
749
-	return GravityView_API::no_results( $wpautop );
749
+	return GravityView_API::no_results($wpautop);
750 750
 }
751 751
 
752 752
 /**
@@ -758,21 +758,21 @@  discard block
 block discarded – undo
758 758
 
759 759
 	$href = gv_directory_link();
760 760
 
761
-	if( empty( $href ) ) { return NULL; }
761
+	if (empty($href)) { return NULL; }
762 762
 
763 763
 	// calculate link label
764 764
 	$gravityview_view = GravityView_View::getInstance();
765 765
 
766
-	$label = $gravityview_view->getBackLinkLabel() ? $gravityview_view->getBackLinkLabel() : __( '&larr; Go back', 'gravityview' );
766
+	$label = $gravityview_view->getBackLinkLabel() ? $gravityview_view->getBackLinkLabel() : __('&larr; Go back', 'gravityview');
767 767
 
768 768
 	/**
769 769
 	 * @filter `gravityview_go_back_label` Modify the back link text
770 770
 	 * @since 1.0.9
771 771
 	 * @param string $label Existing label text
772 772
 	 */
773
-	$label = apply_filters( 'gravityview_go_back_label', $label );
773
+	$label = apply_filters('gravityview_go_back_label', $label);
774 774
 
775
-	$link = gravityview_get_link( $href, esc_html( $label ), array(
775
+	$link = gravityview_get_link($href, esc_html($label), array(
776 776
 		'data-viewid' => $gravityview_view->getViewId()
777 777
 	));
778 778
 
@@ -791,9 +791,9 @@  discard block
 block discarded – undo
791 791
  * @param  string 	$display_value The value generated by Gravity Forms
792 792
  * @return string                Value
793 793
  */
794
-function gravityview_get_field_value( $entry, $field_id, $display_value ) {
794
+function gravityview_get_field_value($entry, $field_id, $display_value) {
795 795
 
796
-	if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) {
796
+	if (floatval($field_id) === floor(floatval($field_id))) {
797 797
 
798 798
 		// For the complete field value as generated by Gravity Forms
799 799
 		return $display_value;
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
 	} else {
802 802
 
803 803
 		// For one part of the address (City, ZIP, etc.)
804
-		return isset( $entry[ $field_id ] ) ? $entry[ $field_id ] : '';
804
+		return isset($entry[$field_id]) ? $entry[$field_id] : '';
805 805
 
806 806
 	}
807 807
 
@@ -817,48 +817,48 @@  discard block
 block discarded – undo
817 817
  * @param  string      $taxonomy Type of term (`post_tag` or `category`)
818 818
  * @return string                CSV of linked terms
819 819
  */
820
-function gravityview_convert_value_to_term_list( $value, $taxonomy = 'post_tag' ) {
820
+function gravityview_convert_value_to_term_list($value, $taxonomy = 'post_tag') {
821 821
 
822 822
 	$output = array();
823 823
 
824
-	$terms = explode( ', ', $value );
824
+	$terms = explode(', ', $value);
825 825
 
826
-	foreach ($terms as $term_name ) {
826
+	foreach ($terms as $term_name) {
827 827
 
828 828
 		// If we're processing a category,
829
-		if( $taxonomy === 'category' ) {
829
+		if ($taxonomy === 'category') {
830 830
 
831 831
 			// Use rgexplode to prevent errors if : doesn't exist
832
-			list( $term_name, $term_id ) = rgexplode( ':', $value, 2 );
832
+			list($term_name, $term_id) = rgexplode(':', $value, 2);
833 833
 
834 834
 			// The explode was succesful; we have the category ID
835
-			if( !empty( $term_id )) {
836
-				$term = get_term_by( 'id', $term_id, $taxonomy );
835
+			if (!empty($term_id)) {
836
+				$term = get_term_by('id', $term_id, $taxonomy);
837 837
 			} else {
838 838
 			// We have to fall back to the name
839
-				$term = get_term_by( 'name', $term_name, $taxonomy );
839
+				$term = get_term_by('name', $term_name, $taxonomy);
840 840
 			}
841 841
 
842 842
 		} else {
843 843
 			// Use the name of the tag to get the full term information
844
-			$term = get_term_by( 'name', $term_name, $taxonomy );
844
+			$term = get_term_by('name', $term_name, $taxonomy);
845 845
 		}
846 846
 
847 847
 		// There's still a tag/category here.
848
-		if( $term ) {
848
+		if ($term) {
849 849
 
850
-			$term_link = get_term_link( $term, $taxonomy );
850
+			$term_link = get_term_link($term, $taxonomy);
851 851
 
852 852
 			// If there was an error, continue to the next term.
853
-			if ( is_wp_error( $term_link ) ) {
853
+			if (is_wp_error($term_link)) {
854 854
 			    continue;
855 855
 			}
856 856
 
857
-			$output[] = gravityview_get_link( $term_link, esc_html( $term->name ) );
857
+			$output[] = gravityview_get_link($term_link, esc_html($term->name));
858 858
 		}
859 859
 	}
860 860
 
861
-	return implode(', ', $output );
861
+	return implode(', ', $output);
862 862
 }
863 863
 
864 864
 /**
@@ -868,12 +868,12 @@  discard block
 block discarded – undo
868 868
  * @param  string      $taxonomy Taxonomy of term to fetch.
869 869
  * @return string                String with terms
870 870
  */
871
-function gravityview_get_the_term_list( $post_id, $link = true, $taxonomy = 'post_tag' ) {
871
+function gravityview_get_the_term_list($post_id, $link = true, $taxonomy = 'post_tag') {
872 872
 
873
-	$output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' );
873
+	$output = get_the_term_list($post_id, $taxonomy, NULL, ', ');
874 874
 
875
-	if( empty( $link ) ) {
876
-		return strip_tags( $output);
875
+	if (empty($link)) {
876
+		return strip_tags($output);
877 877
 	}
878 878
 
879 879
 	return $output;
@@ -892,17 +892,17 @@  discard block
 block discarded – undo
892 892
 	$fe = GravityView_frontend::getInstance();
893 893
 
894 894
 	// Solve problem when loading content via admin-ajax.php
895
-	if( ! $fe->getGvOutputData() ) {
895
+	if (!$fe->getGvOutputData()) {
896 896
 
897
-		do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not defined; parsing content.' );
897
+		do_action('gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not defined; parsing content.');
898 898
 
899 899
 		$fe->parse_content();
900 900
 	}
901 901
 
902 902
 	// Make 100% sure that we're dealing with a properly called situation
903
-	if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) {
903
+	if (!is_a($fe->getGvOutputData(), 'GravityView_View_Data')) {
904 904
 
905
-		do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not an object or get_view not callable.', $fe->getGvOutputData() );
905
+		do_action('gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not an object or get_view not callable.', $fe->getGvOutputData());
906 906
 
907 907
 		return array();
908 908
 	}
@@ -916,18 +916,18 @@  discard block
 block discarded – undo
916 916
  * @see  GravityView_View_Data::get_view()
917 917
  * @return array View data with `id`, `view_id`, `form_id`, `template_id`, `atts`, `fields`, `widgets`, `form` keys.
918 918
  */
919
-function gravityview_get_current_view_data( $view_id = 0 ) {
919
+function gravityview_get_current_view_data($view_id = 0) {
920 920
 
921 921
 	$fe = GravityView_frontend::getInstance();
922 922
 
923
-	if( ! $fe->getGvOutputData() ) { return array(); }
923
+	if (!$fe->getGvOutputData()) { return array(); }
924 924
 
925 925
 	// If not set, grab the current view ID
926
-	if( empty( $view_id ) ) {
926
+	if (empty($view_id)) {
927 927
 		$view_id = $fe->get_context_view_id();
928 928
 	}
929 929
 
930
-	return $fe->getGvOutputData()->get_view( $view_id );
930
+	return $fe->getGvOutputData()->get_view($view_id);
931 931
 }
932 932
 
933 933
 // Templates' hooks
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
 	 * @action `gravityview_before` Display content before a View. Used to render widget areas. Rendered outside the View container `<div>`
937 937
 	 * @param int $view_id The ID of the View being displayed
938 938
 	 */
939
-	do_action( 'gravityview_before', gravityview_get_view_id() );
939
+	do_action('gravityview_before', gravityview_get_view_id());
940 940
 }
941 941
 
942 942
 function gravityview_header() {
@@ -944,7 +944,7 @@  discard block
 block discarded – undo
944 944
 	 * @action `gravityview_header` Prepend content to the View container `<div>`
945 945
 	 * @param int $view_id The ID of the View being displayed
946 946
 	 */
947
-	do_action( 'gravityview_header', gravityview_get_view_id() );
947
+	do_action('gravityview_header', gravityview_get_view_id());
948 948
 }
949 949
 
950 950
 function gravityview_footer() {
@@ -952,7 +952,7 @@  discard block
 block discarded – undo
952 952
 	 * @action `gravityview_after` Display content after a View. Used to render footer widget areas. Rendered outside the View container `<div>`
953 953
 	 * @param int $view_id The ID of the View being displayed
954 954
 	 */
955
-	do_action( 'gravityview_footer', gravityview_get_view_id() );
955
+	do_action('gravityview_footer', gravityview_get_view_id());
956 956
 }
957 957
 
958 958
 function gravityview_after() {
@@ -960,7 +960,7 @@  discard block
 block discarded – undo
960 960
 	 * @action `gravityview_after` Append content to the View container `<div>`
961 961
 	 * @param int $view_id The ID of the View being displayed
962 962
 	 */
963
-	do_action( 'gravityview_after', gravityview_get_view_id() );
963
+	do_action('gravityview_after', gravityview_get_view_id());
964 964
 }
965 965
 
966 966
 /**
@@ -986,13 +986,13 @@  discard block
 block discarded – undo
986 986
 	 * The Edit Entry functionality overrides this value.
987 987
 	 * @param boolean $is_edit_entry
988 988
 	 */
989
-	$is_edit_entry = apply_filters( 'gravityview_is_edit_entry', false );
989
+	$is_edit_entry = apply_filters('gravityview_is_edit_entry', false);
990 990
 
991
-	if( $is_edit_entry ) {
991
+	if ($is_edit_entry) {
992 992
 		$context = 'edit';
993
-	} else if( class_exists( 'GravityView_frontend' ) && $single = GravityView_frontend::is_single_entry() ) {
993
+	} else if (class_exists('GravityView_frontend') && $single = GravityView_frontend::is_single_entry()) {
994 994
 		$context = 'single';
995
-	} else if( class_exists( 'GravityView_View' ) ) {
995
+	} else if (class_exists('GravityView_View')) {
996 996
 		$context = GravityView_View::getInstance()->getContext();
997 997
 	}
998 998
 
@@ -1017,18 +1017,18 @@  discard block
 block discarded – undo
1017 1017
  * @param  string $gv_class Field class to add to the output HTML
1018 1018
  * @return array           Array of file output, with `file_path` and `html` keys (see comments above)
1019 1019
  */
1020
-function gravityview_get_files_array( $value, $gv_class = '' ) {
1020
+function gravityview_get_files_array($value, $gv_class = '') {
1021 1021
 	/** @define "GRAVITYVIEW_DIR" "../" */
1022 1022
 
1023
-	if( !class_exists( 'GravityView_Field' ) ) {
1024
-		include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' );
1023
+	if (!class_exists('GravityView_Field')) {
1024
+		include_once(GRAVITYVIEW_DIR.'includes/fields/class-gravityview-field.php');
1025 1025
 	}
1026 1026
 
1027
-	if( !class_exists( 'GravityView_Field_FileUpload' ) ) {
1028
-		include_once( GRAVITYVIEW_DIR .'includes/fields/fileupload.php' );
1027
+	if (!class_exists('GravityView_Field_FileUpload')) {
1028
+		include_once(GRAVITYVIEW_DIR.'includes/fields/fileupload.php');
1029 1029
 	}
1030 1030
 
1031
-	return GravityView_Field_FileUpload::get_files_array( $value, $gv_class );
1031
+	return GravityView_Field_FileUpload::get_files_array($value, $gv_class);
1032 1032
 }
1033 1033
 
1034 1034
 /**
@@ -1042,16 +1042,16 @@  discard block
 block discarded – undo
1042 1042
  * @param  string $address Address
1043 1043
  * @return string          URL of link to map of address
1044 1044
  */
1045
-function gravityview_get_map_link( $address ) {
1045
+function gravityview_get_map_link($address) {
1046 1046
 
1047
-	$address_qs = str_replace( array( '<br />', "\n" ), ' ', $address ); // Replace \n with spaces
1048
-	$address_qs = urlencode( $address_qs );
1047
+	$address_qs = str_replace(array('<br />', "\n"), ' ', $address); // Replace \n with spaces
1048
+	$address_qs = urlencode($address_qs);
1049 1049
 
1050 1050
 	$url = "https://maps.google.com/maps?q={$address_qs}";
1051 1051
 
1052
-	$link_text = esc_html__( 'Map It', 'gravityview' );
1052
+	$link_text = esc_html__('Map It', 'gravityview');
1053 1053
 
1054
-	$link = gravityview_get_link( $url, $link_text, 'class=map-it-link' );
1054
+	$link = gravityview_get_link($url, $link_text, 'class=map-it-link');
1055 1055
 
1056 1056
 	/**
1057 1057
 	 * @filter `gravityview_map_link` Modify the map link generated. You can use a different mapping service, for example.
@@ -1059,7 +1059,7 @@  discard block
 block discarded – undo
1059 1059
 	 * @param[in] string $address Address to generate link for
1060 1060
 	 * @param[in] string $url URL generated by the function
1061 1061
 	 */
1062
-	$link = apply_filters( 'gravityview_map_link', $link, $address, $url );
1062
+	$link = apply_filters('gravityview_map_link', $link, $address, $url);
1063 1063
 
1064 1064
 	return $link;
1065 1065
 }
@@ -1080,7 +1080,7 @@  discard block
 block discarded – undo
1080 1080
  * @param  array $passed_args Associative array with field data. `field` and `form` are required.
1081 1081
  * @return string Field output. If empty value and hide empty is true, return empty.
1082 1082
  */
1083
-function gravityview_field_output( $passed_args ) {
1083
+function gravityview_field_output($passed_args) {
1084 1084
 	$defaults = array(
1085 1085
 		'entry' => null,
1086 1086
 		'field' => null,
@@ -1092,7 +1092,7 @@  discard block
 block discarded – undo
1092 1092
 		'zone_id' => null,
1093 1093
 	);
1094 1094
 
1095
-	$args = wp_parse_args( $passed_args, $defaults );
1095
+	$args = wp_parse_args($passed_args, $defaults);
1096 1096
 
1097 1097
 	/**
1098 1098
 	 * @filter `gravityview/field_output/args` Modify the args before generation begins
@@ -1100,15 +1100,15 @@  discard block
 block discarded – undo
1100 1100
 	 * @param array $args Associative array; `field` and `form` is required.
1101 1101
 	 * @param array $passed_args Original associative array with field data. `field` and `form` are required.
1102 1102
 	 */
1103
-	$args = apply_filters( 'gravityview/field_output/args', $args, $passed_args );
1103
+	$args = apply_filters('gravityview/field_output/args', $args, $passed_args);
1104 1104
 
1105 1105
 	// Required fields.
1106
-	if ( empty( $args['field'] ) || empty( $args['form'] ) ) {
1107
-		do_action( 'gravityview_log_error', '[gravityview_field_output] Field or form are empty.', $args );
1106
+	if (empty($args['field']) || empty($args['form'])) {
1107
+		do_action('gravityview_log_error', '[gravityview_field_output] Field or form are empty.', $args);
1108 1108
 		return '';
1109 1109
 	}
1110 1110
 
1111
-	$entry = empty( $args['entry'] ) ? array() : $args['entry'];
1111
+	$entry = empty($args['entry']) ? array() : $args['entry'];
1112 1112
 
1113 1113
 	/**
1114 1114
 	 * Create the content variables for replacing.
@@ -1124,36 +1124,36 @@  discard block
 block discarded – undo
1124 1124
 		'field_id' => '',
1125 1125
 	);
1126 1126
 
1127
-	$context['value'] = gv_value( $entry, $args['field'] );
1127
+	$context['value'] = gv_value($entry, $args['field']);
1128 1128
 
1129 1129
 	// If the value is empty and we're hiding empty, return empty.
1130
-	if ( $context['value'] === '' && ! empty( $args['hide_empty'] ) ) {
1130
+	if ($context['value'] === '' && !empty($args['hide_empty'])) {
1131 1131
 		return '';
1132 1132
 	}
1133 1133
 
1134
-	if ( $context['value'] !== '' && ! empty( $args['wpautop'] ) ) {
1135
-		$context['value'] = wpautop( $context['value'] );
1134
+	if ($context['value'] !== '' && !empty($args['wpautop'])) {
1135
+		$context['value'] = wpautop($context['value']);
1136 1136
 	}
1137 1137
 
1138 1138
 	// Get width setting, if exists
1139
-	$context['width'] = GravityView_API::field_width( $args['field'] );
1139
+	$context['width'] = GravityView_API::field_width($args['field']);
1140 1140
 
1141 1141
 	// If replacing with CSS inline formatting, let's do it.
1142
-	$context['width:style'] = GravityView_API::field_width( $args['field'], 'width:' . $context['width'] . '%;' );
1142
+	$context['width:style'] = GravityView_API::field_width($args['field'], 'width:'.$context['width'].'%;');
1143 1143
 
1144 1144
 	// Grab the Class using `gv_class`
1145
-	$context['class'] = gv_class( $args['field'], $args['form'], $entry );
1146
-	$context['field_id'] = GravityView_API::field_html_attr_id( $args['field'], $args['form'], $entry );
1145
+	$context['class'] = gv_class($args['field'], $args['form'], $entry);
1146
+	$context['field_id'] = GravityView_API::field_html_attr_id($args['field'], $args['form'], $entry);
1147 1147
 
1148 1148
 	// Get field label if needed
1149
-	if ( ! empty( $args['label_markup'] ) ) {
1150
-		$context['label'] = str_replace( array( '{{label}}', '{{ label }}' ), '<span class="gv-field-label">{{ label_value }}</span>', $args['label_markup'] );
1149
+	if (!empty($args['label_markup'])) {
1150
+		$context['label'] = str_replace(array('{{label}}', '{{ label }}'), '<span class="gv-field-label">{{ label_value }}</span>', $args['label_markup']);
1151 1151
 	}
1152 1152
 
1153 1153
 	// Default Label value
1154
-	$context['label_value'] = gv_label( $args['field'], $entry );
1154
+	$context['label_value'] = gv_label($args['field'], $entry);
1155 1155
 
1156
-	if ( empty( $context['label'] ) && ! empty( $context['label_value'] ) ){
1156
+	if (empty($context['label']) && !empty($context['label_value'])) {
1157 1157
 		$context['label'] = '<span class="gv-field-label">{{ label_value }}</span>';
1158 1158
 	}
1159 1159
 
@@ -1163,37 +1163,37 @@  discard block
 block discarded – undo
1163 1163
 	 * @param string $markup The HTML for the markup
1164 1164
 	 * @param array $args All args for the field output
1165 1165
 	 */
1166
-	$html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args );
1166
+	$html = apply_filters('gravityview/field_output/pre_html', $args['markup'], $args);
1167 1167
 
1168 1168
 	/**
1169 1169
 	 * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders
1170 1170
 	 * @since 1.11
1171 1171
 	 * @param string $open_tag Open tag for template content placeholders. Default: `{{`
1172 1172
 	 */
1173
-	$open_tag = apply_filters( 'gravityview/field_output/open_tag', '{{', $args );
1173
+	$open_tag = apply_filters('gravityview/field_output/open_tag', '{{', $args);
1174 1174
 
1175 1175
 	/**
1176 1176
 	 * @filter `gravityview/field_output/close_tag` Modify the closing tags for the template content placeholders
1177 1177
 	 * @since 1.11
1178 1178
 	 * @param string $close_tag Close tag for template content placeholders. Default: `}}`
1179 1179
 	 */
1180
-	$close_tag = apply_filters( 'gravityview/field_output/close_tag', '}}', $args );
1180
+	$close_tag = apply_filters('gravityview/field_output/close_tag', '}}', $args);
1181 1181
 
1182 1182
 	/**
1183 1183
 	 * Loop through each of the tags to replace and replace both `{{tag}}` and `{{ tag }}` with the values
1184 1184
 	 * @since 1.11
1185 1185
 	 */
1186
-	foreach ( $context as $tag => $value ) {
1186
+	foreach ($context as $tag => $value) {
1187 1187
 
1188 1188
 		// If the tag doesn't exist just skip it
1189
-		if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){
1189
+		if (false === strpos($html, $open_tag.$tag.$close_tag) && false === strpos($html, $open_tag.' '.$tag.' '.$close_tag)) {
1190 1190
 			continue;
1191 1191
 		}
1192 1192
 
1193 1193
 		// Array to search
1194 1194
 		$search = array(
1195
-			$open_tag . $tag . $close_tag,
1196
-			$open_tag . ' ' . $tag . ' ' . $close_tag,
1195
+			$open_tag.$tag.$close_tag,
1196
+			$open_tag.' '.$tag.' '.$close_tag,
1197 1197
 		);
1198 1198
 
1199 1199
 		/**
@@ -1202,26 +1202,26 @@  discard block
 block discarded – undo
1202 1202
 		 * @param string $value The content to be shown instead of the {{tag}} placeholder
1203 1203
 		 * @param array $args Arguments passed to the function
1204 1204
 		 */
1205
-		$value = apply_filters( 'gravityview/field_output/context/' . $tag, $value, $args );
1205
+		$value = apply_filters('gravityview/field_output/context/'.$tag, $value, $args);
1206 1206
 
1207 1207
 		// Finally do the replace
1208
-		$html = str_replace( $search, $value, $html );
1208
+		$html = str_replace($search, $value, $html);
1209 1209
 	}
1210 1210
 
1211 1211
 	/**
1212 1212
 	 * @todo  Depricate `gravityview_field_output`
1213 1213
 	 */
1214
-	$html = apply_filters( 'gravityview_field_output', $html, $args );
1214
+	$html = apply_filters('gravityview_field_output', $html, $args);
1215 1215
 
1216 1216
 	/**
1217 1217
 	 * @filter `gravityview/field_output/html` Modify field HTML output
1218 1218
 	 * @param string $html Existing HTML output
1219 1219
 	 * @param array $args Arguments passed to the function
1220 1220
 	 */
1221
-	$html = apply_filters( 'gravityview/field_output/html', $html, $args );
1221
+	$html = apply_filters('gravityview/field_output/html', $html, $args);
1222 1222
 
1223 1223
 	// Just free up a tiny amount of memory
1224
-	unset( $value, $args, $passed_args, $entry, $context, $search, $open_tag, $tag, $close_tag );
1224
+	unset($value, $args, $passed_args, $entry, $context, $search, $open_tag, $tag, $close_tag);
1225 1225
 
1226 1226
 	return $html;
1227 1227
 }
@@ -1239,18 +1239,18 @@  discard block
 block discarded – undo
1239 1239
  *
1240 1240
  * @return string html attribute or empty string
1241 1241
  */
1242
-function gv_selected( $value, $current, $echo = true, $type = 'selected' ) {
1242
+function gv_selected($value, $current, $echo = true, $type = 'selected') {
1243 1243
 
1244 1244
 	$output = '';
1245
-	if( is_array( $current ) ) {
1246
-		if( in_array( $value, $current ) ) {
1247
-			$output = __checked_selected_helper( true, true, false, $type );
1245
+	if (is_array($current)) {
1246
+		if (in_array($value, $current)) {
1247
+			$output = __checked_selected_helper(true, true, false, $type);
1248 1248
 		}
1249 1249
 	} else {
1250
-		$output = __checked_selected_helper( $value, $current, false, $type );
1250
+		$output = __checked_selected_helper($value, $current, false, $type);
1251 1251
 	}
1252 1252
 
1253
-	if( $echo ) {
1253
+	if ($echo) {
1254 1254
 		echo $output;
1255 1255
 	}
1256 1256
 
Please login to merge, or discard this patch.
includes/class-cache.php 1 patch
Spacing   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -32,18 +32,18 @@  discard block
 block discarded – undo
32 32
 	 * @since 1.13.1
33 33
 	 * @var array Columns in the database for leads
34 34
 	 */
35
-	private $lead_db_columns = array( 'id', 'form_id', 'post_id', 'date_created', 'is_starred', 'is_read', 'ip', 'source_url', 'user_agent', 'currency', 'payment_status', 'payment_date', 'payment_amount', 'transaction_id', 'is_fulfilled', 'created_by', 'transaction_type', 'status' );
35
+	private $lead_db_columns = array('id', 'form_id', 'post_id', 'date_created', 'is_starred', 'is_read', 'ip', 'source_url', 'user_agent', 'currency', 'payment_status', 'payment_date', 'payment_amount', 'transaction_id', 'is_fulfilled', 'created_by', 'transaction_type', 'status');
36 36
 
37 37
 	/**
38 38
 	 *
39 39
 	 * @param array|int $form_ids Form ID or array of form IDs used in a request
40 40
 	 * @param array $args Extra request parameters used to generate the query. This is used to generate the unique transient key.
41 41
 	 */
42
-	function __construct( $form_ids = NULL, $args = array() ) {
42
+	function __construct($form_ids = NULL, $args = array()) {
43 43
 
44 44
 		$this->add_hooks();
45 45
 
46
-		if ( ! is_null( $form_ids ) ) {
46
+		if (!is_null($form_ids)) {
47 47
 
48 48
 			$this->form_ids = $form_ids;
49 49
 
@@ -59,31 +59,31 @@  discard block
 block discarded – undo
59 59
 	function add_hooks() {
60 60
 
61 61
 		// Schedule cleanup of expired transients
62
-		add_action( 'wp', array( $this, 'schedule_transient_cleanup' ) );
62
+		add_action('wp', array($this, 'schedule_transient_cleanup'));
63 63
 
64 64
 		// Hook in to the scheduled cleanup, if scheduled
65
-		add_action( 'gravityview-expired-transients', array( $this, 'delete_expired_transients' ) );
65
+		add_action('gravityview-expired-transients', array($this, 'delete_expired_transients'));
66 66
 
67 67
 		// Trigger this when you need to prevent any results from being cached with forms that have been modified
68
-		add_action( 'gravityview_clear_form_cache', array( $this, 'blacklist_add' ) );
68
+		add_action('gravityview_clear_form_cache', array($this, 'blacklist_add'));
69 69
 
70 70
 		/**
71 71
 		 * @since 1.14
72 72
 		 */
73
-		add_action( 'gravityview_clear_entry_cache', array( $this, 'entry_status_changed' ) );
73
+		add_action('gravityview_clear_entry_cache', array($this, 'entry_status_changed'));
74 74
 
75
-		add_action( 'gform_after_update_entry', array( $this, 'entry_updated' ), 10, 2 );
75
+		add_action('gform_after_update_entry', array($this, 'entry_updated'), 10, 2);
76 76
 
77
-		add_action( 'gform_entry_created', array( $this, 'entry_created' ), 10, 2 );
77
+		add_action('gform_entry_created', array($this, 'entry_created'), 10, 2);
78 78
 
79 79
 		/**
80 80
 		 * @see RGFormsModel::update_lead_property() Trigger when any entry property changes
81 81
 		 */
82
-		foreach( $this->lead_db_columns as $column ) {
83
-			add_action( 'gform_update_' . $column, array( $this, 'entry_status_changed' ), 10, 3 );
82
+		foreach ($this->lead_db_columns as $column) {
83
+			add_action('gform_update_'.$column, array($this, 'entry_status_changed'), 10, 3);
84 84
 		}
85 85
 
86
-		add_action( 'gform_delete_lead', array( $this, 'entry_status_changed' ), 10 );
86
+		add_action('gform_delete_lead', array($this, 'entry_status_changed'), 10);
87 87
 	}
88 88
 
89 89
 	/**
@@ -99,22 +99,22 @@  discard block
 block discarded – undo
99 99
 	 *
100 100
 	 * @return void
101 101
 	 */
102
-	public function entry_status_changed( $lead_id, $property_value = '', $previous_value = '' ) {
102
+	public function entry_status_changed($lead_id, $property_value = '', $previous_value = '') {
103 103
 
104 104
 		/** @var array $entry */
105
-		$entry = GFAPI::get_entry( $lead_id );
105
+		$entry = GFAPI::get_entry($lead_id);
106 106
 
107
-		if ( is_wp_error( $entry ) ) {
107
+		if (is_wp_error($entry)) {
108 108
 
109 109
 			/** @var WP_Error $entry */
110
-			do_action( 'gravityview_log_error', __METHOD__ . ' Could not retrieve entry ' . $lead_id . ' to delete it: ' . $entry->get_error_message() );
110
+			do_action('gravityview_log_error', __METHOD__.' Could not retrieve entry '.$lead_id.' to delete it: '.$entry->get_error_message());
111 111
 
112 112
 			return;
113 113
 		}
114 114
 
115
-		do_action( 'gravityview_log_debug', __METHOD__ . ' adding form ' . $entry['form_id'] . ' to blacklist because entry #' . $lead_id . ' was deleted', array( 'value' => $property_value, 'previous' => $previous_value ) );
115
+		do_action('gravityview_log_debug', __METHOD__.' adding form '.$entry['form_id'].' to blacklist because entry #'.$lead_id.' was deleted', array('value' => $property_value, 'previous' => $previous_value));
116 116
 		
117
-		$this->blacklist_add( $entry['form_id'] );
117
+		$this->blacklist_add($entry['form_id']);
118 118
 	}
119 119
 
120 120
 	/**
@@ -125,11 +125,11 @@  discard block
 block discarded – undo
125 125
 	 *
126 126
 	 * @return void
127 127
 	 */
128
-	public function entry_updated( $form, $lead_id ) {
128
+	public function entry_updated($form, $lead_id) {
129 129
 
130
-		do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_updated] adding form ' . $form['id'] . ' to blacklist because entry #' . $lead_id . ' was updated' );
130
+		do_action('gravityview_log_debug', 'GravityView_Cache[entry_updated] adding form '.$form['id'].' to blacklist because entry #'.$lead_id.' was updated');
131 131
 
132
-		$this->blacklist_add( $form['id'] );
132
+		$this->blacklist_add($form['id']);
133 133
 	}
134 134
 
135 135
 	/**
@@ -142,11 +142,11 @@  discard block
 block discarded – undo
142 142
 	 *
143 143
 	 * @return void
144 144
 	 */
145
-	public function entry_created( $entry, $form ) {
145
+	public function entry_created($entry, $form) {
146 146
 
147
-		do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_created] adding form ' . $form['id'] . ' to blacklist because entry #' . $entry['id'] . ' was created' );
147
+		do_action('gravityview_log_debug', 'GravityView_Cache[entry_created] adding form '.$form['id'].' to blacklist because entry #'.$entry['id'].' was created');
148 148
 
149
-		$this->blacklist_add( $form['id'] );
149
+		$this->blacklist_add($form['id']);
150 150
 	}
151 151
 
152 152
 	/**
@@ -156,20 +156,20 @@  discard block
 block discarded – undo
156 156
 	 *
157 157
 	 * @return string           Prefix for the cache string used in set_key()
158 158
 	 */
159
-	protected function get_cache_key_prefix( $form_ids = NULL ) {
159
+	protected function get_cache_key_prefix($form_ids = NULL) {
160 160
 
161
-		if ( is_null( $form_ids ) ) {
161
+		if (is_null($form_ids)) {
162 162
 			$form_ids = $this->form_ids;
163 163
 		}
164 164
 
165 165
 		// Normally just one form, but supports multiple forms
166 166
 		//
167 167
 		// Array of IDs 12, 5, 14 would result in `f-12f-5f-14`
168
-		$forms = 'f:' . implode( '&f:', (array) $form_ids );
168
+		$forms = 'f:'.implode('&f:', (array)$form_ids);
169 169
 
170 170
 		// Prefix for transient keys
171 171
 		// Now the prefix would be: `gv-cache-f-12f-5f-14`
172
-		return 'gv-cache-' . $forms . '-';
172
+		return 'gv-cache-'.$forms.'-';
173 173
 
174 174
 	}
175 175
 
@@ -179,17 +179,17 @@  discard block
 block discarded – undo
179 179
 	protected function set_key() {
180 180
 
181 181
 		// Don't set key if no forms have been set.
182
-		if ( empty( $this->form_ids ) ) {
182
+		if (empty($this->form_ids)) {
183 183
 			return;
184 184
 		}
185 185
 
186
-		$key = $this->get_cache_key_prefix() . sha1( serialize( $this->args ) );
186
+		$key = $this->get_cache_key_prefix().sha1(serialize($this->args));
187 187
 
188 188
 		// The transient name column can handle up to 64 characters.
189 189
 		// The `_transient_timeout_` prefix that is prepended to the string is 11 characters.
190 190
 		// 64 - 19 = 45
191 191
 		// We make sure the key isn't too long or else WP doesn't store data.
192
-		$this->key = substr( $key, 0, 45 );
192
+		$this->key = substr($key, 0, 45);
193 193
 	}
194 194
 
195 195
 	/**
@@ -210,24 +210,24 @@  discard block
 block discarded – undo
210 210
 	 *
211 211
 	 * @return boolean           False if value was not updated and true if value was updated.
212 212
 	 */
213
-	public function blacklist_add( $form_ids ) {
213
+	public function blacklist_add($form_ids) {
214 214
 
215
-		$blacklist = get_option( self::BLACKLIST_OPTION_NAME, array() );
215
+		$blacklist = get_option(self::BLACKLIST_OPTION_NAME, array());
216 216
 
217
-		$form_ids = is_array( $form_ids ) ? $form_ids : array( $form_ids );
217
+		$form_ids = is_array($form_ids) ? $form_ids : array($form_ids);
218 218
 
219
-		do_action( 'gravityview_log_debug', 'GravityView_Cache[blacklist_add] Adding form IDs to cache blacklist', array(
219
+		do_action('gravityview_log_debug', 'GravityView_Cache[blacklist_add] Adding form IDs to cache blacklist', array(
220 220
 			'$form_ids'  => $form_ids,
221 221
 			'$blacklist' => $blacklist
222
-		) );
222
+		));
223 223
 
224 224
 		// Add the passed form IDs
225
-		$blacklist = array_merge( $blacklist, $form_ids );
225
+		$blacklist = array_merge($blacklist, $form_ids);
226 226
 
227 227
 		// Don't duplicate
228
-		$blacklist = array_unique( $blacklist );
228
+		$blacklist = array_unique($blacklist);
229 229
 
230
-		return update_option( self::BLACKLIST_OPTION_NAME, $blacklist );
230
+		return update_option(self::BLACKLIST_OPTION_NAME, $blacklist);
231 231
 
232 232
 	}
233 233
 
@@ -238,19 +238,19 @@  discard block
 block discarded – undo
238 238
 	 *
239 239
 	 * @return boolean           Whether the removal was successful
240 240
 	 */
241
-	public function blacklist_remove( $form_ids ) {
241
+	public function blacklist_remove($form_ids) {
242 242
 
243
-		$blacklist = get_option( self::BLACKLIST_OPTION_NAME, array() );
243
+		$blacklist = get_option(self::BLACKLIST_OPTION_NAME, array());
244 244
 
245
-		$updated_list = array_diff( $blacklist, (array) $form_ids );
245
+		$updated_list = array_diff($blacklist, (array)$form_ids);
246 246
 
247
-		do_action( 'gravityview_log_debug', 'GravityView_Cache[blacklist_remove] Removing form IDs from cache blacklist', array(
247
+		do_action('gravityview_log_debug', 'GravityView_Cache[blacklist_remove] Removing form IDs from cache blacklist', array(
248 248
 			'$form_ids'     => $form_ids,
249 249
 			'$blacklist'    => $blacklist,
250 250
 			'$updated_list' => $updated_list
251
-		) );
251
+		));
252 252
 
253
-		return update_option( self::BLACKLIST_OPTION_NAME, $updated_list );
253
+		return update_option(self::BLACKLIST_OPTION_NAME, $updated_list);
254 254
 	}
255 255
 
256 256
 
@@ -261,25 +261,25 @@  discard block
 block discarded – undo
261 261
 	 *
262 262
 	 * @return [type] [description]
263 263
 	 */
264
-	function in_blacklist( $form_ids = NULL ) {
264
+	function in_blacklist($form_ids = NULL) {
265 265
 
266
-		$blacklist = get_option( self::BLACKLIST_OPTION_NAME, array() );
266
+		$blacklist = get_option(self::BLACKLIST_OPTION_NAME, array());
267 267
 
268 268
 		// Use object var if exists
269
-		$form_ids = is_null( $form_ids ) ? $this->form_ids : $form_ids;
269
+		$form_ids = is_null($form_ids) ? $this->form_ids : $form_ids;
270 270
 
271
-		if ( empty( $form_ids ) ) {
271
+		if (empty($form_ids)) {
272 272
 
273
-			do_action( 'gravityview_log_debug', 'GravityView_Cache[in_blacklist] Did not add form to blacklist; empty form ID', $form_ids );
273
+			do_action('gravityview_log_debug', 'GravityView_Cache[in_blacklist] Did not add form to blacklist; empty form ID', $form_ids);
274 274
 
275 275
 			return false;
276 276
 		}
277 277
 
278
-		foreach ( (array) $form_ids as $form_id ) {
278
+		foreach ((array)$form_ids as $form_id) {
279 279
 
280
-			if ( in_array( $form_id, $blacklist ) ) {
280
+			if (in_array($form_id, $blacklist)) {
281 281
 
282
-				do_action( 'gravityview_log_debug', 'GravityView_Cache[in_blacklist] Form #' . esc_attr( $form_id ) . ' is in the cache blacklist' );
282
+				do_action('gravityview_log_debug', 'GravityView_Cache[in_blacklist] Form #'.esc_attr($form_id).' is in the cache blacklist');
283 283
 
284 284
 				return true;
285 285
 			}
@@ -296,35 +296,35 @@  discard block
 block discarded – undo
296 296
 	 *
297 297
 	 * @return mixed      False: Not using cache or cache was a WP_Error object; NULL: no results found; Mixed: cache value
298 298
 	 */
299
-	public function get( $key = NULL ) {
299
+	public function get($key = NULL) {
300 300
 
301
-		$key = is_null( $key ) ? $this->key : $key;
301
+		$key = is_null($key) ? $this->key : $key;
302 302
 
303
-		if ( ! $this->use_cache() ) {
303
+		if (!$this->use_cache()) {
304 304
 
305
-			do_action( 'gravityview_log_debug', 'GravityView_Cache[get] Not using cached results because of GravityView_Cache->use_cache() results' );
305
+			do_action('gravityview_log_debug', 'GravityView_Cache[get] Not using cached results because of GravityView_Cache->use_cache() results');
306 306
 
307 307
 			return false;
308 308
 		}
309 309
 
310
-		do_action( 'gravityview_log_debug', 'GravityView_Cache[get] Fetching request with transient key ' . $key );
310
+		do_action('gravityview_log_debug', 'GravityView_Cache[get] Fetching request with transient key '.$key);
311 311
 
312
-		$result = get_transient( $key );
312
+		$result = get_transient($key);
313 313
 
314
-		if ( is_wp_error( $result ) ) {
314
+		if (is_wp_error($result)) {
315 315
 
316
-			do_action( 'gravityview_log_debug', 'GravityView_Cache[get] Fetching request resulted in error:', $result );
316
+			do_action('gravityview_log_debug', 'GravityView_Cache[get] Fetching request resulted in error:', $result);
317 317
 
318 318
 			return false;
319 319
 
320
-		} elseif ( $result ) {
320
+		} elseif ($result) {
321 321
 
322
-			do_action( 'gravityview_log_debug', 'GravityView_Cache[get] Cached results found for  transient key ' . $key );
322
+			do_action('gravityview_log_debug', 'GravityView_Cache[get] Cached results found for  transient key '.$key);
323 323
 
324 324
 			return $result;
325 325
 		}
326 326
 
327
-		do_action( 'gravityview_log_debug', 'GravityView_Cache[get] No cached results found for  transient key ' . $key );
327
+		do_action('gravityview_log_debug', 'GravityView_Cache[get] No cached results found for  transient key '.$key);
328 328
 
329 329
 		return NULL;
330 330
 
@@ -338,24 +338,24 @@  discard block
 block discarded – undo
338 338
 	 * @param [type] $content     [description]
339 339
 	 * @param [type] $filter_name Name used to modify the cache time. Will be set to `gravityview_cache_time_{$filter_name}`.
340 340
 	 */
341
-	public function set( $content, $filter_name = '' ) {
341
+	public function set($content, $filter_name = '') {
342 342
 
343 343
 		// Don't cache empty results
344
-		if ( ! empty( $content ) ) {
344
+		if (!empty($content)) {
345 345
 
346 346
 			/**
347 347
 			 * @filter `gravityview_cache_time_{$filter_name}` Modify the cache time for a type of cache
348 348
 			 * @param int $time_in_seconds Default: `DAY_IN_SECONDS`
349 349
 			 */
350
-			$cache_time = (int) apply_filters( 'gravityview_cache_time_' . $filter_name, DAY_IN_SECONDS );
350
+			$cache_time = (int)apply_filters('gravityview_cache_time_'.$filter_name, DAY_IN_SECONDS);
351 351
 
352
-			do_action( 'gravityview_log_debug', 'GravityView_Cache[set] Setting cache with transient key ' . $this->key . ' for ' . $cache_time . ' seconds' );
352
+			do_action('gravityview_log_debug', 'GravityView_Cache[set] Setting cache with transient key '.$this->key.' for '.$cache_time.' seconds');
353 353
 
354
-			return set_transient( $this->key, $content, $cache_time );
354
+			return set_transient($this->key, $content, $cache_time);
355 355
 
356 356
 		}
357 357
 
358
-		do_action( 'gravityview_log_debug', 'GravityView_Cache[set] Cache not set; content is empty' );
358
+		do_action('gravityview_log_debug', 'GravityView_Cache[set] Cache not set; content is empty');
359 359
 
360 360
 		return false;
361 361
 
@@ -371,39 +371,39 @@  discard block
 block discarded – undo
371 371
 	 *
372 372
 	 * @return [type]           [description]
373 373
 	 */
374
-	public function delete( $form_ids = NULL ) {
374
+	public function delete($form_ids = NULL) {
375 375
 		global $wpdb;
376 376
 
377 377
 		// Use object var if exists
378
-		$form_ids = is_null( $form_ids ) ? $this->form_ids : $form_ids;
378
+		$form_ids = is_null($form_ids) ? $this->form_ids : $form_ids;
379 379
 
380
-		if ( empty( $form_ids ) ) {
381
-			do_action( 'gravityview_log_debug', 'GravityView_Cache[delete] Did not delete cache; empty form IDs' );
380
+		if (empty($form_ids)) {
381
+			do_action('gravityview_log_debug', 'GravityView_Cache[delete] Did not delete cache; empty form IDs');
382 382
 
383 383
 			return;
384 384
 		}
385 385
 
386
-		foreach ( (array) $form_ids as $form_id ) {
386
+		foreach ((array)$form_ids as $form_id) {
387 387
 
388
-			$key = $this->get_cache_key_prefix( $form_id );
388
+			$key = $this->get_cache_key_prefix($form_id);
389 389
 
390 390
 			// WordPress 4.0+
391
-			if ( is_callable( array( $wpdb, 'esc_like' ) ) ) {
392
-				$key = $wpdb->esc_like( $key );
391
+			if (is_callable(array($wpdb, 'esc_like'))) {
392
+				$key = $wpdb->esc_like($key);
393 393
 			} else {
394
-				$key = like_escape( $key );
394
+				$key = like_escape($key);
395 395
 			}
396 396
 
397
-			$key = "%" . $key . "%";
397
+			$key = "%".$key."%";
398 398
 
399
-			$sql = $wpdb->prepare( "DELETE FROM {$wpdb->options} WHERE `option_name` LIKE %s", $key );
399
+			$sql = $wpdb->prepare("DELETE FROM {$wpdb->options} WHERE `option_name` LIKE %s", $key);
400 400
 
401
-			$result = $wpdb->query( $sql );
401
+			$result = $wpdb->query($sql);
402 402
 
403
-			do_action( 'gravityview_log_debug', 'GravityView_Cache[delete] Deleting cache for form #' . $form_id, array(
403
+			do_action('gravityview_log_debug', 'GravityView_Cache[delete] Deleting cache for form #'.$form_id, array(
404 404
 				$sql,
405
-				sprintf( 'Deleted results: %d', $result )
406
-			) );
405
+				sprintf('Deleted results: %d', $result)
406
+			));
407 407
 		}
408 408
 
409 409
 	}
@@ -421,14 +421,14 @@  discard block
 block discarded – undo
421 421
 		 * @filter `gravityview_cleanup_transients` Override GravityView cleanup of transients by setting this to false
422 422
 		 * @param boolean $cleanup Whether to run the GravityView auto-cleanup of transients. Default: `true`
423 423
 		 */
424
-		$cleanup = apply_filters( 'gravityview_cleanup_transients', true );
424
+		$cleanup = apply_filters('gravityview_cleanup_transients', true);
425 425
 
426
-		if ( ! $cleanup ) {
426
+		if (!$cleanup) {
427 427
 			return;
428 428
 		}
429 429
 
430
-		if ( ! wp_next_scheduled( 'gravityview-expired-transients' ) ) {
431
-			wp_schedule_event( time(), 'daily', 'gravityview-expired-transients' );
430
+		if (!wp_next_scheduled('gravityview-expired-transients')) {
431
+			wp_schedule_event(time(), 'daily', 'gravityview-expired-transients');
432 432
 		}
433 433
 	}
434 434
 
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 		$threshold = time() - 60;
454 454
 
455 455
 		// get table name for options on specified blog
456
-		$table = $wpdb->get_blog_prefix( $blog_id ) . 'options';
456
+		$table = $wpdb->get_blog_prefix($blog_id).'options';
457 457
 
458 458
 		// delete expired transients, using the paired timeout record to find them
459 459
 		$sql = "
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 			and t1.option_value < '$threshold'
465 465
 		";
466 466
 
467
-		$num_results = $wpdb->query( $sql );
467
+		$num_results = $wpdb->query($sql);
468 468
 
469 469
 		// delete orphaned transient expirations
470 470
 		// also delete NextGEN Gallery 2.x display cache timeout aliases
@@ -479,9 +479,9 @@  discard block
 block discarded – undo
479 479
 			and option_value < '$threshold'
480 480
 		";
481 481
 
482
-		$num_results += $wpdb->query( $sql );
482
+		$num_results += $wpdb->query($sql);
483 483
 
484
-		do_action( 'gravityview_log_debug', 'GravityView_Cache[delete_expired_transients] Deleted ' . $num_results . ' expired transient records from the database' );
484
+		do_action('gravityview_log_debug', 'GravityView_Cache[delete_expired_transients] Deleted '.$num_results.' expired transient records from the database');
485 485
 	}
486 486
 
487 487
 	/**
@@ -495,11 +495,11 @@  discard block
 block discarded – undo
495 495
 
496 496
 		$use_cache = true;
497 497
 
498
-		if ( GVCommon::has_cap( 'edit_gravityviews' ) ) {
498
+		if (GVCommon::has_cap('edit_gravityviews')) {
499 499
 
500
-			if ( isset( $_GET['cache'] ) || isset( $_GET['nocache'] ) ) {
500
+			if (isset($_GET['cache']) || isset($_GET['nocache'])) {
501 501
 
502
-				do_action( 'gravityview_log_debug', 'GravityView_Cache[use_cache] Not using cache: ?cache or ?nocache is in the URL' );
502
+				do_action('gravityview_log_debug', 'GravityView_Cache[use_cache] Not using cache: ?cache or ?nocache is in the URL');
503 503
 
504 504
 				$use_cache = false;
505 505
 			}
@@ -507,13 +507,13 @@  discard block
 block discarded – undo
507 507
 		}
508 508
 
509 509
 		// Has the form been flagged as having changed items in it?
510
-		if ( $this->in_blacklist() ) {
510
+		if ($this->in_blacklist()) {
511 511
 
512 512
 			// Delete caches for all items with form IDs XYZ
513
-			$this->delete( $this->form_ids );
513
+			$this->delete($this->form_ids);
514 514
 
515 515
 			// Remove the form from
516
-			$this->blacklist_remove( $this->form_ids );
516
+			$this->blacklist_remove($this->form_ids);
517 517
 
518 518
 		}
519 519
 
@@ -524,9 +524,9 @@  discard block
 block discarded – undo
524 524
 		 * @param[out,in]  boolean $use_cache Previous setting
525 525
 		 * @param[out] GravityView_Cache $this The GravityView_Cache object
526 526
 		 */
527
-		$use_cache = apply_filters( 'gravityview_use_cache', $use_cache, $this );
527
+		$use_cache = apply_filters('gravityview_use_cache', $use_cache, $this);
528 528
 
529
-		return (boolean) $use_cache;
529
+		return (boolean)$use_cache;
530 530
 	}
531 531
 
532 532
 }
Please login to merge, or discard this patch.