Completed
Pull Request — master (#605)
by Zack
05:22
created
includes/admin/metaboxes/views/view-settings.php 2 patches
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.
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.
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-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.
includes/class-common.php 3 patches
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -213,13 +213,13 @@  discard block
 block discarded – undo
213 213
 
214 214
 				if ( $add_default_properties && ! empty( $field['inputs'] ) ) {
215 215
 					foreach ( $field['inputs'] as $input ) {
216
-                        /**
217
-                         * @hack
218
-                         * In case of email/email confirmation, the input for email has the same id as the parent field
219
-                         */
220
-                        if( 'email' == rgar( $field, 'type' ) && false === strpos( $input['id'], '.' ) ) {
221
-                            continue;
222
-                        }
216
+						/**
217
+						 * @hack
218
+						 * In case of email/email confirmation, the input for email has the same id as the parent field
219
+						 */
220
+						if( 'email' == rgar( $field, 'type' ) && false === strpos( $input['id'], '.' ) ) {
221
+							continue;
222
+						}
223 223
 						$fields[ (string)$input['id'] ] = array(
224 224
 							'label' => rgar( $input, 'label' ),
225 225
 							'customLabel' => rgar( $input, 'customLabel' ),
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 		} elseif ( 'delete' === RGForms::get( 'action' ) ) {
467 467
 			$criteria['context_view_id'] = isset( $_GET['view_id'] ) ? $_GET['view_id'] : null;
468 468
 		} elseif( !isset( $criteria['context_view_id'] ) ) {
469
-            // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget)
469
+			// Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget)
470 470
 			$criteria['context_view_id'] = null;
471 471
 		}
472 472
 
@@ -1082,7 +1082,7 @@  discard block
 block discarded – undo
1082 1082
 			),
1083 1083
 		);
1084 1084
 
1085
-        $fields = $date_created + $fields;
1085
+		$fields = $date_created + $fields;
1086 1086
 
1087 1087
 		$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL );
1088 1088
 
@@ -1094,13 +1094,13 @@  discard block
 block discarded – undo
1094 1094
 			}
1095 1095
 		}
1096 1096
 
1097
-        /**
1098
-         * @filter `gravityview/common/sortable_fields` Filter the sortable fields
1099
-         * @since 1.12
1100
-         * @param array $fields Sub-set of GF form fields that are sortable
1101
-         * @param int $formid The Gravity Forms form ID that the fields are from
1102
-         */
1103
-        $fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid );
1097
+		/**
1098
+		 * @filter `gravityview/common/sortable_fields` Filter the sortable fields
1099
+		 * @since 1.12
1100
+		 * @param array $fields Sub-set of GF form fields that are sortable
1101
+		 * @param int $formid The Gravity Forms form ID that the fields are from
1102
+		 */
1103
+		$fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid );
1104 1104
 
1105 1105
 		return $fields;
1106 1106
 	}
@@ -1365,17 +1365,17 @@  discard block
 block discarded – undo
1365 1365
 	}
1366 1366
 
1367 1367
 
1368
-    /**
1369
-     * Display updated/error notice
1370
-     *
1371
-     * @param string $notice text/HTML of notice
1372
-     * @param string $class CSS class for notice (`updated` or `error`)
1373
-     *
1374
-     * @return string
1375
-     */
1376
-    public static function generate_notice( $notice, $class = '' ) {
1377
-        return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1378
-    }
1368
+	/**
1369
+	 * Display updated/error notice
1370
+	 *
1371
+	 * @param string $notice text/HTML of notice
1372
+	 * @param string $class CSS class for notice (`updated` or `error`)
1373
+	 *
1374
+	 * @return string
1375
+	 */
1376
+	public static function generate_notice( $notice, $class = '' ) {
1377
+		return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1378
+	}
1379 1379
 
1380 1380
 
1381 1381
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -167,7 +167,6 @@  discard block
 block discarded – undo
167 167
 	 * Returns the list of available forms
168 168
 	 *
169 169
 	 * @access public
170
-	 * @param mixed $form_id
171 170
 	 * @return array Empty array if GFAPI isn't available or no forms. Otherwise, associative array with id, title keys
172 171
 	 */
173 172
 	public static function get_forms() {
@@ -188,7 +187,7 @@  discard block
 block discarded – undo
188 187
 	 * Return array of fields' id and label, for a given Form ID
189 188
 	 *
190 189
 	 * @access public
191
-	 * @param string|array $form_id (default: '') or $form object
190
+	 * @param string|array $form (default: '') or $form object
192 191
 	 * @return array
193 192
 	 */
194 193
 	public static function get_form_fields( $form = '', $add_default_properties = false, $include_parent_field = true ) {
Please login to merge, or discard this patch.
Spacing   +316 added lines, -316 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 /** If this file is called directly, abort. */
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if (!defined('ABSPATH')) {
16 16
 	die;
17 17
 }
18 18
 
@@ -25,18 +25,18 @@  discard block
 block discarded – undo
25 25
 	 * @param mixed $form_id
26 26
 	 * @return mixed False: no form ID specified or Gravity Forms isn't active. Array: Form returned from Gravity Forms
27 27
 	 */
28
-	public static function get_form( $form_id ) {
29
-		if ( empty( $form_id ) ) {
28
+	public static function get_form($form_id) {
29
+		if (empty($form_id)) {
30 30
 			return false;
31 31
 		}
32 32
 
33 33
 		// Only get_form_meta is cached. ::facepalm::
34
-		if ( class_exists( 'RGFormsModel' ) ) {
35
-			return GFFormsModel::get_form_meta( $form_id );
34
+		if (class_exists('RGFormsModel')) {
35
+			return GFFormsModel::get_form_meta($form_id);
36 36
 		}
37 37
 
38
-		if ( class_exists( 'GFAPI' ) ) {
39
-			return GFAPI::get_form( $form_id );
38
+		if (class_exists('GFAPI')) {
39
+			return GFAPI::get_form($form_id);
40 40
 		}
41 41
 
42 42
 		return false;
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
 	 *
56 56
 	 * @return bool True: user has at least one passed capability; False: user does not have any defined capabilities
57 57
 	 */
58
-	public static function has_cap( $caps = '', $object_id = null, $user_id = null ) {
59
-		return GravityView_Roles_Capabilities::has_cap( $caps, $object_id, $user_id );
58
+	public static function has_cap($caps = '', $object_id = null, $user_id = null) {
59
+		return GravityView_Roles_Capabilities::has_cap($caps, $object_id, $user_id);
60 60
 	}
61 61
 
62 62
 	/**
@@ -67,14 +67,14 @@  discard block
 block discarded – undo
67 67
 	 * @param array|GF_Fields $field Gravity Forms field or array
68 68
 	 * @return array Array version of $field
69 69
 	 */
70
-	public static function get_field_array( $field ) {
70
+	public static function get_field_array($field) {
71 71
 
72
-		if ( class_exists( 'GF_Fields' ) ) {
72
+		if (class_exists('GF_Fields')) {
73 73
 
74
-			$field_object = GF_Fields::create( $field );
74
+			$field_object = GF_Fields::create($field);
75 75
 
76 76
 			// Convert the field object in 1.9 to an array for backward compatibility
77
-			$field_array = get_object_vars( $field_object );
77
+			$field_array = get_object_vars($field_object);
78 78
 
79 79
 		} else {
80 80
 			$field_array = $field;
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 *
94 94
 	 * @return array Array of Views as `WP_Post`. Empty array if none found.
95 95
 	 */
96
-	public static function get_all_views( $args = array() ) {
96
+	public static function get_all_views($args = array()) {
97 97
 
98 98
 		$default_params = array(
99 99
 			'post_type' => 'gravityview',
@@ -101,15 +101,15 @@  discard block
 block discarded – undo
101 101
 			'post_status' => 'publish',
102 102
 		);
103 103
 
104
-		$params = wp_parse_args( $args, $default_params );
104
+		$params = wp_parse_args($args, $default_params);
105 105
 
106 106
 		/**
107 107
 		 * @filter `gravityview/get_all_views/params` Modify the parameters sent to get all views.
108 108
 		 * @param[in,out]  array $params Array of parameters to pass to `get_posts()`
109 109
 		 */
110
-		$views_params = apply_filters( 'gravityview/get_all_views/params', $params );
110
+		$views_params = apply_filters('gravityview/get_all_views/params', $params);
111 111
 
112
-		$views = get_posts( $views_params );
112
+		$views = get_posts($views_params);
113 113
 
114 114
 		return $views;
115 115
 	}
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
 	 * @param  int|string $entry_slug Entry slug
121 121
 	 * @return array           Gravity Forms form array
122 122
 	 */
123
-	public static function get_form_from_entry_id( $entry_slug ) {
123
+	public static function get_form_from_entry_id($entry_slug) {
124 124
 
125
-		$entry = self::get_entry( $entry_slug, true );
125
+		$entry = self::get_entry($entry_slug, true);
126 126
 
127
-		$form = self::get_form( $entry['form_id'] );
127
+		$form = self::get_form($entry['form_id']);
128 128
 
129 129
 		return $form;
130 130
 	}
@@ -138,13 +138,13 @@  discard block
 block discarded – undo
138 138
 	 *
139 139
 	 * @return bool|GF_Field[]
140 140
 	 */
141
-	public static function has_product_field( $form = array() ) {
141
+	public static function has_product_field($form = array()) {
142 142
 
143
-		$product_fields = apply_filters( 'gform_product_field_types', array( 'option', 'quantity', 'product', 'total', 'shipping', 'calculation', 'price' ) );
143
+		$product_fields = apply_filters('gform_product_field_types', array('option', 'quantity', 'product', 'total', 'shipping', 'calculation', 'price'));
144 144
 
145
-		$fields = GFAPI::get_fields_by_type( $form, $product_fields );
145
+		$fields = GFAPI::get_fields_by_type($form, $product_fields);
146 146
 
147
-		return empty( $fields ) ? false : $fields;
147
+		return empty($fields) ? false : $fields;
148 148
 	}
149 149
 
150 150
 	/**
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 * @param  string $slug The entry slug, as returned by GravityView_API::get_entry_slug()
155 155
 	 * @return int|null       The entry ID, if exists; `NULL` if not
156 156
 	 */
157
-	public static function get_entry_id_from_slug( $slug ) {
157
+	public static function get_entry_id_from_slug($slug) {
158 158
 		global $wpdb;
159 159
 
160 160
 		$search_criteria = array(
@@ -173,9 +173,9 @@  discard block
 block discarded – undo
173 173
 			'page_size' => 1,
174 174
 		);
175 175
 
176
-		$results = GFAPI::get_entries( 0, $search_criteria, null, $paging );
176
+		$results = GFAPI::get_entries(0, $search_criteria, null, $paging);
177 177
 
178
-		$result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null;
178
+		$result = (!empty($results) && !empty($results[0]['id'])) ? $results[0]['id'] : null;
179 179
 
180 180
 		return $result;
181 181
 	}
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
 	 */
191 191
 	public static function get_forms() {
192 192
 		$forms = array();
193
-		if ( class_exists( 'GFAPI' ) ) {
193
+		if (class_exists('GFAPI')) {
194 194
 			$gf_forms = GFAPI::get_forms();
195
-			foreach ( $gf_forms as $form ) {
195
+			foreach ($gf_forms as $form) {
196 196
 				$forms[] = array(
197 197
 					'id' => $form['id'],
198 198
 					'title' => $form['title'],
@@ -209,10 +209,10 @@  discard block
 block discarded – undo
209 209
 	 * @param string|array $form_id (default: '') or $form object
210 210
 	 * @return array
211 211
 	 */
212
-	public static function get_form_fields( $form = '', $add_default_properties = false, $include_parent_field = true ) {
212
+	public static function get_form_fields($form = '', $add_default_properties = false, $include_parent_field = true) {
213 213
 
214
-		if ( ! is_array( $form ) ) {
215
-			$form = self::get_form( $form );
214
+		if (!is_array($form)) {
215
+			$form = self::get_form($form);
216 216
 		}
217 217
 
218 218
 		$fields = array();
@@ -222,56 +222,56 @@  discard block
 block discarded – undo
222 222
 		$has_poll_fields = false;
223 223
 
224 224
 		// If GF_Field exists, we're using GF 1.9+, where add_default_properties has been deprecated.
225
-		if ( false === class_exists( 'GF_Field' ) && $add_default_properties ) {
226
-			$form = RGFormsModel::add_default_properties( $form );
225
+		if (false === class_exists('GF_Field') && $add_default_properties) {
226
+			$form = RGFormsModel::add_default_properties($form);
227 227
 		}
228 228
 
229
-		if ( $form ) {
230
-			foreach ( $form['fields'] as $field ) {
231
-				if ( $include_parent_field || empty( $field['inputs'] ) ) {
232
-					$fields[ $field['id'] ] = array(
233
-						'label' => rgar( $field, 'label' ),
229
+		if ($form) {
230
+			foreach ($form['fields'] as $field) {
231
+				if ($include_parent_field || empty($field['inputs'])) {
232
+					$fields[$field['id']] = array(
233
+						'label' => rgar($field, 'label'),
234 234
 						'parent' => null,
235
-						'type' => rgar( $field, 'type' ),
236
-						'adminLabel' => rgar( $field, 'adminLabel' ),
237
-						'adminOnly' => rgar( $field, 'adminOnly' ),
235
+						'type' => rgar($field, 'type'),
236
+						'adminLabel' => rgar($field, 'adminLabel'),
237
+						'adminOnly' => rgar($field, 'adminOnly'),
238 238
 					);
239 239
 				}
240 240
 
241
-				if ( $add_default_properties && ! empty( $field['inputs'] ) ) {
242
-					foreach ( $field['inputs'] as $input ) {
241
+				if ($add_default_properties && !empty($field['inputs'])) {
242
+					foreach ($field['inputs'] as $input) {
243 243
                         /**
244 244
                          * @hack
245 245
                          * In case of email/email confirmation, the input for email has the same id as the parent field
246 246
                          */
247
-                        if( 'email' == rgar( $field, 'type' ) && false === strpos( $input['id'], '.' ) ) {
247
+                        if ('email' == rgar($field, 'type') && false === strpos($input['id'], '.')) {
248 248
                             continue;
249 249
                         }
250
-						$fields[ (string)$input['id'] ] = array(
251
-							'label' => rgar( $input, 'label' ),
252
-							'customLabel' => rgar( $input, 'customLabel' ),
250
+						$fields[(string)$input['id']] = array(
251
+							'label' => rgar($input, 'label'),
252
+							'customLabel' => rgar($input, 'customLabel'),
253 253
 							'parent' => $field,
254
-							'type' => rgar( $field, 'type' ),
255
-							'adminLabel' => rgar( $field, 'adminLabel' ),
256
-							'adminOnly' => rgar( $field, 'adminOnly' ),
254
+							'type' => rgar($field, 'type'),
255
+							'adminLabel' => rgar($field, 'adminLabel'),
256
+							'adminOnly' => rgar($field, 'adminOnly'),
257 257
 						);
258 258
 					}
259 259
 				}
260 260
 
261 261
 				/** @since 1.14 */
262
-				if( 'list' === $field['type'] && !empty( $field['enableColumns'] ) ) {
262
+				if ('list' === $field['type'] && !empty($field['enableColumns'])) {
263 263
 
264
-					foreach ( (array)$field['choices'] as $key => $input ) {
264
+					foreach ((array)$field['choices'] as $key => $input) {
265 265
 
266
-						$input_id = sprintf( '%d.%d', $field['id'], $key ); // {field_id}.{column_key}
266
+						$input_id = sprintf('%d.%d', $field['id'], $key); // {field_id}.{column_key}
267 267
 
268
-						$fields[ $input_id ] = array(
269
-							'label'       => rgar( $input, 'text' ),
268
+						$fields[$input_id] = array(
269
+							'label'       => rgar($input, 'text'),
270 270
 							'customLabel' => '',
271 271
 							'parent'      => $field,
272
-							'type'        => rgar( $field, 'type' ),
273
-							'adminLabel'  => rgar( $field, 'adminLabel' ),
274
-							'adminOnly'   => rgar( $field, 'adminOnly' ),
272
+							'type'        => rgar($field, 'type'),
273
+							'adminLabel'  => rgar($field, 'adminLabel'),
274
+							'adminOnly'   => rgar($field, 'adminOnly'),
275 275
 						);
276 276
 					}
277 277
 				}
@@ -279,27 +279,27 @@  discard block
 block discarded – undo
279 279
 				/**
280 280
 				 * @since 1.8
281 281
 				 */
282
-				if( 'quiz' === $field['type'] ) {
282
+				if ('quiz' === $field['type']) {
283 283
 					$has_quiz_fields = true;
284 284
 				}
285 285
 
286 286
 				/**
287 287
 				 * @since 1.8
288 288
 				 */
289
-				if( 'poll' === $field['type'] ) {
289
+				if ('poll' === $field['type']) {
290 290
 					$has_poll_fields = true;
291 291
 				}
292 292
 
293
-				if( GFCommon::is_product_field( $field['type'] ) ){
293
+				if (GFCommon::is_product_field($field['type'])) {
294 294
 					$has_product_fields = true;
295 295
 				}
296 296
 
297 297
 				/**
298 298
 				 * @hack Version 1.9
299 299
 				 */
300
-				$field_for_is_post_field = class_exists( 'GF_Fields' ) ? (object) $field : (array) $field;
300
+				$field_for_is_post_field = class_exists('GF_Fields') ? (object)$field : (array)$field;
301 301
 
302
-				if ( GFCommon::is_post_field( $field_for_is_post_field ) ) {
302
+				if (GFCommon::is_post_field($field_for_is_post_field)) {
303 303
 					$has_post_fields = true;
304 304
 				}
305 305
 			}
@@ -308,19 +308,19 @@  discard block
 block discarded – undo
308 308
 		/**
309 309
 		 * @since 1.7
310 310
 		 */
311
-		if ( $has_post_fields ) {
311
+		if ($has_post_fields) {
312 312
 			$fields['post_id'] = array(
313
-				'label' => __( 'Post ID', 'gravityview' ),
313
+				'label' => __('Post ID', 'gravityview'),
314 314
 				'type' => 'post_id',
315 315
 			);
316 316
 		}
317 317
 
318
-		if ( $has_product_fields ) {
318
+		if ($has_product_fields) {
319 319
 
320
-			$payment_fields = GravityView_Fields::get_all( 'pricing' );
320
+			$payment_fields = GravityView_Fields::get_all('pricing');
321 321
 
322
-			foreach ( $payment_fields as $payment_field ) {
323
-				if( isset( $fields["{$payment_field->name}"] ) ) {
322
+			foreach ($payment_fields as $payment_field) {
323
+				if (isset($fields["{$payment_field->name}"])) {
324 324
 					continue;
325 325
 				}
326 326
 				$fields["{$payment_field->name}"] = array(
@@ -334,27 +334,27 @@  discard block
 block discarded – undo
334 334
 		/**
335 335
 		 * @since 1.8
336 336
 		 */
337
-		if( $has_quiz_fields ) {
337
+		if ($has_quiz_fields) {
338 338
 
339
-			$fields['gquiz_score']   = array(
340
-				'label' => __( 'Quiz Score Total', 'gravityview' ),
339
+			$fields['gquiz_score'] = array(
340
+				'label' => __('Quiz Score Total', 'gravityview'),
341 341
 				'type'  => 'quiz_score',
342
-				'desc'  => __( 'Displays the number of correct Quiz answers the user submitted.', 'gravityview' ),
342
+				'desc'  => __('Displays the number of correct Quiz answers the user submitted.', 'gravityview'),
343 343
 			);
344 344
 			$fields['gquiz_percent'] = array(
345
-				'label' => __( 'Quiz Percentage Grade', 'gravityview' ),
345
+				'label' => __('Quiz Percentage Grade', 'gravityview'),
346 346
 				'type'  => 'quiz_percent',
347
-				'desc'  => __( 'Displays the percentage of correct Quiz answers the user submitted.', 'gravityview' ),
347
+				'desc'  => __('Displays the percentage of correct Quiz answers the user submitted.', 'gravityview'),
348 348
 			);
349
-			$fields['gquiz_grade']   = array(
350
-				'label' => __( 'Quiz Letter Grade', 'gravityview' ),
349
+			$fields['gquiz_grade'] = array(
350
+				'label' => __('Quiz Letter Grade', 'gravityview'),
351 351
 				'type'  => 'quiz_grade',
352
-				'desc'  => __( 'Displays the Grade the user achieved based on Letter Grading configured in the Quiz Settings.', 'gravityview' ),
352
+				'desc'  => __('Displays the Grade the user achieved based on Letter Grading configured in the Quiz Settings.', 'gravityview'),
353 353
 			);
354 354
 			$fields['gquiz_is_pass'] = array(
355
-				'label' => __( 'Quiz Pass/Fail', 'gravityview' ),
355
+				'label' => __('Quiz Pass/Fail', 'gravityview'),
356 356
 				'type'  => 'quiz_is_pass',
357
-				'desc'  => __( 'Displays either Passed or Failed based on the Pass/Fail settings configured in the Quiz Settings.', 'gravityview' ),
357
+				'desc'  => __('Displays either Passed or Failed based on the Pass/Fail settings configured in the Quiz Settings.', 'gravityview'),
358 358
 			);
359 359
 		}
360 360
 
@@ -367,15 +367,15 @@  discard block
 block discarded – undo
367 367
 	 * @param  string $form_id (default: '')
368 368
 	 * @return array
369 369
 	 */
370
-	public static function get_entry_meta( $form_id, $only_default_column = true ) {
370
+	public static function get_entry_meta($form_id, $only_default_column = true) {
371 371
 
372
-		$extra_fields = GFFormsModel::get_entry_meta( $form_id );
372
+		$extra_fields = GFFormsModel::get_entry_meta($form_id);
373 373
 
374 374
 		$fields = array();
375 375
 
376
-		foreach ( $extra_fields as $key => $field ){
377
-			if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) {
378
-				$fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' );
376
+		foreach ($extra_fields as $key => $field) {
377
+			if (!empty($only_default_column) && !empty($field['is_default_column'])) {
378
+				$fields[$key] = array('label' => $field['label'], 'type' => 'entry_meta');
379 379
 			}
380 380
 		}
381 381
 
@@ -391,13 +391,13 @@  discard block
 block discarded – undo
391 391
 	 * @since  1.1.6
392 392
 	 * @return array|void          Array of entry IDs. Void if Gravity Forms isn't active.
393 393
 	 */
394
-	public static function get_entry_ids( $form_id, $search_criteria = array() ) {
394
+	public static function get_entry_ids($form_id, $search_criteria = array()) {
395 395
 
396
-		if ( ! class_exists( 'GFFormsModel' ) ) {
396
+		if (!class_exists('GFFormsModel')) {
397 397
 			return;
398 398
 		}
399 399
 
400
-		return GFFormsModel::search_lead_ids( $form_id, $search_criteria );
400
+		return GFFormsModel::search_lead_ids($form_id, $search_criteria);
401 401
 	}
402 402
 
403 403
 	/**
@@ -409,33 +409,33 @@  discard block
 block discarded – undo
409 409
 	 * @param array $form_ids array Gravity Forms form IDs
410 410
 	 * @return array
411 411
 	 */
412
-	public static function calculate_get_entries_criteria( $passed_criteria = array(), $form_ids = array() ) {
412
+	public static function calculate_get_entries_criteria($passed_criteria = array(), $form_ids = array()) {
413 413
 
414 414
 		$search_criteria_defaults = array(
415 415
 			'search_criteria' => null,
416 416
 			'sorting' => null,
417 417
 			'paging' => null,
418
-			'cache' => (isset( $passed_criteria['cache'] ) ? $passed_criteria['cache'] : true),
418
+			'cache' => (isset($passed_criteria['cache']) ? $passed_criteria['cache'] : true),
419 419
 		);
420 420
 
421
-		$criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults );
421
+		$criteria = wp_parse_args($passed_criteria, $search_criteria_defaults);
422 422
 
423
-		if ( ! empty( $criteria['search_criteria']['field_filters'] ) ) {
424
-			foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) {
423
+		if (!empty($criteria['search_criteria']['field_filters'])) {
424
+			foreach ($criteria['search_criteria']['field_filters'] as &$filter) {
425 425
 
426
-				if ( ! is_array( $filter ) ) {
426
+				if (!is_array($filter)) {
427 427
 					continue;
428 428
 				}
429 429
 
430 430
 				// By default, we want searches to be wildcard for each field.
431
-				$filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator'];
431
+				$filter['operator'] = empty($filter['operator']) ? 'contains' : $filter['operator'];
432 432
 
433 433
 				/**
434 434
 				 * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc)
435 435
 				 * @param string $operator Existing search operator
436 436
 				 * @param array $filter array with `key`, `value`, `operator`, `type` keys
437 437
 				 */
438
-				$filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter );
438
+				$filter['operator'] = apply_filters('gravityview_search_operator', $filter['operator'], $filter);
439 439
 			}
440 440
 		}
441 441
 
@@ -443,32 +443,32 @@  discard block
 block discarded – undo
443 443
 		 * Prepare date formats to be in Gravity Forms DB format;
444 444
 		 * $passed_criteria may include date formats incompatible with Gravity Forms.
445 445
 		 */
446
-		foreach ( array('start_date', 'end_date' ) as $key ) {
446
+		foreach (array('start_date', 'end_date') as $key) {
447 447
 
448
-			if ( ! empty( $criteria['search_criteria'][ $key ] ) ) {
448
+			if (!empty($criteria['search_criteria'][$key])) {
449 449
 
450 450
 				// Use date_create instead of new DateTime so it returns false if invalid date format.
451
-				$date = date_create( $criteria['search_criteria'][ $key ] );
451
+				$date = date_create($criteria['search_criteria'][$key]);
452 452
 
453
-				if ( $date ) {
453
+				if ($date) {
454 454
 					// Gravity Forms wants dates in the `Y-m-d H:i:s` format.
455
-					$criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' );
455
+					$criteria['search_criteria'][$key] = $date->format('Y-m-d H:i:s');
456 456
 				} else {
457 457
 					// If it's an invalid date, unset it. Gravity Forms freaks out otherwise.
458
-					unset( $criteria['search_criteria'][ $key ] );
458
+					unset($criteria['search_criteria'][$key]);
459 459
 
460
-					do_action( 'gravityview_log_error', '[filter_get_entries_criteria] '.$key.' Date format not valid:', $criteria['search_criteria'][ $key ] );
460
+					do_action('gravityview_log_error', '[filter_get_entries_criteria] '.$key.' Date format not valid:', $criteria['search_criteria'][$key]);
461 461
 				}
462 462
 			}
463 463
 		}
464 464
 
465 465
 
466 466
 		// When multiple views are embedded, OR single entry, calculate the context view id and send it to the advanced filter
467
-		if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() || GravityView_frontend::getInstance()->getSingleEntry() ) {
467
+		if (class_exists('GravityView_View_Data') && GravityView_View_Data::getInstance()->has_multiple_views() || GravityView_frontend::getInstance()->getSingleEntry()) {
468 468
 			$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
469
-		} elseif ( 'delete' === RGForms::get( 'action' ) ) {
470
-			$criteria['context_view_id'] = isset( $_GET['view_id'] ) ? $_GET['view_id'] : null;
471
-		} elseif( !isset( $criteria['context_view_id'] ) ) {
469
+		} elseif ('delete' === RGForms::get('action')) {
470
+			$criteria['context_view_id'] = isset($_GET['view_id']) ? $_GET['view_id'] : null;
471
+		} elseif (!isset($criteria['context_view_id'])) {
472 472
             // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget)
473 473
 			$criteria['context_view_id'] = null;
474 474
 		}
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 		 * @param array $form_ids Forms to search
480 480
 		 * @param int $view_id ID of the view being used to search
481 481
 		 */
482
-		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] );
482
+		$criteria = apply_filters('gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id']);
483 483
 
484 484
 		return (array)$criteria;
485 485
 
@@ -497,35 +497,35 @@  discard block
 block discarded – undo
497 497
 	 * @param mixed &$total Optional. An output parameter containing the total number of entries. Pass a non-null value to generate the total count. (default: null)
498 498
 	 * @return mixed False: Error fetching entries. Array: Multi-dimensional array of Gravity Forms entry arrays
499 499
 	 */
500
-	public static function get_entries( $form_ids = null, $passed_criteria = null, &$total = null ) {
500
+	public static function get_entries($form_ids = null, $passed_criteria = null, &$total = null) {
501 501
 
502 502
 		// Filter the criteria before query (includes Adv Filter)
503
-		$criteria = self::calculate_get_entries_criteria( $passed_criteria, $form_ids );
503
+		$criteria = self::calculate_get_entries_criteria($passed_criteria, $form_ids);
504 504
 
505
-		do_action( 'gravityview_log_debug', '[gravityview_get_entries] Final Parameters', $criteria );
505
+		do_action('gravityview_log_debug', '[gravityview_get_entries] Final Parameters', $criteria);
506 506
 
507 507
 		// Return value
508 508
 		$return = null;
509 509
 
510 510
 		/** Reduce # of database calls */
511
-		add_filter( 'gform_is_encrypted_field', '__return_false' );
511
+		add_filter('gform_is_encrypted_field', '__return_false');
512 512
 
513
-		if ( ! empty( $criteria['cache'] ) ) {
513
+		if (!empty($criteria['cache'])) {
514 514
 
515
-			$Cache = new GravityView_Cache( $form_ids, $criteria );
515
+			$Cache = new GravityView_Cache($form_ids, $criteria);
516 516
 
517
-			if ( $entries = $Cache->get() ) {
517
+			if ($entries = $Cache->get()) {
518 518
 
519 519
 				// Still update the total count when using cached results
520
-				if ( ! is_null( $total ) ) {
521
-					$total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] );
520
+				if (!is_null($total)) {
521
+					$total = GFAPI::count_entries($form_ids, $criteria['search_criteria']);
522 522
 				}
523 523
 
524 524
 				$return = $entries;
525 525
 			}
526 526
 		}
527 527
 
528
-		if ( is_null( $return ) && class_exists( 'GFAPI' ) && ( is_numeric( $form_ids ) || is_array( $form_ids ) ) ) {
528
+		if (is_null($return) && class_exists('GFAPI') && (is_numeric($form_ids) || is_array($form_ids))) {
529 529
 
530 530
 			/**
531 531
 			 * @filter `gravityview_pre_get_entries` Define entries to be used before GFAPI::get_entries() is called
@@ -535,24 +535,24 @@  discard block
 block discarded – undo
535 535
 			 * @param array $passed_criteria The original search criteria passed to `GVCommon::get_entries()`
536 536
 			 * @param  int|null $total Optional. An output parameter containing the total number of entries. Pass a non-null value to generate
537 537
 			 */
538
-			$entries = apply_filters( 'gravityview_before_get_entries', null, $criteria, $passed_criteria, $total );
538
+			$entries = apply_filters('gravityview_before_get_entries', null, $criteria, $passed_criteria, $total);
539 539
 
540 540
 			// No entries returned from gravityview_before_get_entries
541
-			if( is_null( $entries ) ) {
541
+			if (is_null($entries)) {
542 542
 
543
-				$entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total );
543
+				$entries = GFAPI::get_entries($form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total);
544 544
 
545
-				if ( is_wp_error( $entries ) ) {
546
-					do_action( 'gravityview_log_error', $entries->get_error_message(), $entries );
545
+				if (is_wp_error($entries)) {
546
+					do_action('gravityview_log_error', $entries->get_error_message(), $entries);
547 547
 
548 548
 					return false;
549 549
 				}
550 550
 			}
551 551
 
552
-			if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) {
552
+			if (!empty($criteria['cache']) && isset($Cache)) {
553 553
 
554 554
 				// Cache results
555
-				$Cache->set( $entries, 'entries' );
555
+				$Cache->set($entries, 'entries');
556 556
 
557 557
 			}
558 558
 
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
 		}
561 561
 
562 562
 		/** Remove filter added above */
563
-		remove_filter( 'gform_is_encrypted_field', '__return_false' );
563
+		remove_filter('gform_is_encrypted_field', '__return_false');
564 564
 
565 565
 		/**
566 566
 		 * @filter `gravityview_entries` Modify the array of entries returned to GravityView after it has been fetched from the cache or from `GFAPI::get_entries()`.
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 		 * @param array $passed_criteria The original search criteria passed to `GVCommon::get_entries()`
570 570
 		 * @param  int|null $total Optional. An output parameter containing the total number of entries. Pass a non-null value to generate
571 571
 		 */
572
-		$return = apply_filters( 'gravityview_entries', $return, $criteria, $passed_criteria, $total );
572
+		$return = apply_filters('gravityview_entries', $return, $criteria, $passed_criteria, $total);
573 573
 
574 574
 		return $return;
575 575
 	}
@@ -586,15 +586,15 @@  discard block
 block discarded – undo
586 586
 	 * @param boolean $check_entry_display Check whether the entry is visible for the current View configuration. Default: true. {@since 1.14}
587 587
 	 * @return array|boolean
588 588
 	 */
589
-	public static function get_entry( $entry_slug, $force_allow_ids = false, $check_entry_display = true ) {
589
+	public static function get_entry($entry_slug, $force_allow_ids = false, $check_entry_display = true) {
590 590
 
591
-		if ( class_exists( 'GFAPI' ) && ! empty( $entry_slug ) ) {
591
+		if (class_exists('GFAPI') && !empty($entry_slug)) {
592 592
 
593 593
 			/**
594 594
 			 * @filter `gravityview_custom_entry_slug` Whether to enable and use custom entry slugs.
595 595
 			 * @param boolean True: Allow for slugs based on entry values. False: always use entry IDs (default)
596 596
 			 */
597
-			$custom_slug = apply_filters( 'gravityview_custom_entry_slug', false );
597
+			$custom_slug = apply_filters('gravityview_custom_entry_slug', false);
598 598
 
599 599
 			/**
600 600
 			 * @filter `gravityview_custom_entry_slug_allow_id` When using a custom slug, allow access to the entry using the original slug (the Entry ID).
@@ -602,38 +602,38 @@  discard block
 block discarded – undo
602 602
 			 * - If enabled, you could access using the custom slug OR the entry id (example: `/entry/custom-slug/` OR `/entry/123/`)
603 603
 			 * @param boolean $custom_slug_id_access True: allow accessing the slug by ID; False: only use the slug passed to the method.
604 604
 			 */
605
-			$custom_slug_id_access = $force_allow_ids || apply_filters( 'gravityview_custom_entry_slug_allow_id', false );
605
+			$custom_slug_id_access = $force_allow_ids || apply_filters('gravityview_custom_entry_slug_allow_id', false);
606 606
 
607 607
 			/**
608 608
 			 * If we're using custom entry slugs, we do a meta value search
609 609
 			 * instead of doing a straightup ID search.
610 610
 			 */
611
-			if ( $custom_slug ) {
611
+			if ($custom_slug) {
612 612
 
613
-				$entry_id = self::get_entry_id_from_slug( $entry_slug );
613
+				$entry_id = self::get_entry_id_from_slug($entry_slug);
614 614
 
615 615
 			}
616 616
 
617 617
 			// If custom slug is off, search using the entry ID
618 618
 			// ID allow ID access is on, also use entry ID as a backup
619
-			if ( empty( $custom_slug ) || ! empty( $custom_slug_id_access ) ) {
619
+			if (empty($custom_slug) || !empty($custom_slug_id_access)) {
620 620
 				// Search for IDs matching $entry_slug
621 621
 				$entry_id = $entry_slug;
622 622
 			}
623 623
 
624
-			if ( empty( $entry_id ) ) {
624
+			if (empty($entry_id)) {
625 625
 				return false;
626 626
 			}
627 627
 
628 628
 			// fetch the entry
629
-			$entry = GFAPI::get_entry( $entry_id );
629
+			$entry = GFAPI::get_entry($entry_id);
630 630
 
631
-			if( $check_entry_display ) {
631
+			if ($check_entry_display) {
632 632
 				// Is the entry allowed
633
-				$entry = self::check_entry_display( $entry );
633
+				$entry = self::check_entry_display($entry);
634 634
 			}
635 635
 
636
-			return is_wp_error( $entry ) ? false : $entry;
636
+			return is_wp_error($entry) ? false : $entry;
637 637
 
638 638
 		}
639 639
 
@@ -657,51 +657,51 @@  discard block
 block discarded – undo
657 657
 	 *
658 658
 	 * @return bool True: matches, false: not matches
659 659
 	 */
660
-	public static function matches_operation( $val1, $val2, $operation ) {
660
+	public static function matches_operation($val1, $val2, $operation) {
661 661
 
662 662
 		$value = false;
663 663
 
664
-		if( 'context' === $val1 ) {
664
+		if ('context' === $val1) {
665 665
 
666
-			$matching_contexts = array( $val2 );
666
+			$matching_contexts = array($val2);
667 667
 
668 668
 			// We allow for non-standard contexts.
669
-			switch( $val2 ) {
669
+			switch ($val2) {
670 670
 				// Check for either single or edit
671 671
 				case 'singular':
672
-					$matching_contexts = array( 'single', 'edit' );
672
+					$matching_contexts = array('single', 'edit');
673 673
 					break;
674 674
 				// Use multiple as alias for directory for consistency
675 675
 				case 'multiple':
676
-					$matching_contexts = array( 'directory' );
676
+					$matching_contexts = array('directory');
677 677
 					break;
678 678
 			}
679 679
 
680
-			$val1 = in_array( gravityview_get_context(), $matching_contexts ) ? $val2 : false;
680
+			$val1 = in_array(gravityview_get_context(), $matching_contexts) ? $val2 : false;
681 681
 		}
682 682
 
683
-		switch ( $operation ) {
683
+		switch ($operation) {
684 684
 			case 'equals':
685
-				$value = GFFormsModel::matches_operation( $val1, $val2, 'is' );
685
+				$value = GFFormsModel::matches_operation($val1, $val2, 'is');
686 686
 				break;
687 687
 			case 'greater_than_or_is':
688 688
 			case 'greater_than_or_equals':
689
-				$is    = GFFormsModel::matches_operation( $val1, $val2, 'is' );
690
-				$gt    = GFFormsModel::matches_operation( $val1, $val2, 'greater_than' );
691
-				$value = ( $is || $gt );
689
+				$is    = GFFormsModel::matches_operation($val1, $val2, 'is');
690
+				$gt    = GFFormsModel::matches_operation($val1, $val2, 'greater_than');
691
+				$value = ($is || $gt);
692 692
 				break;
693 693
 			case 'less_than_or_is':
694 694
 			case 'less_than_or_equals':
695
-				$is    = GFFormsModel::matches_operation( $val1, $val2, 'is' );
696
-				$gt    = GFFormsModel::matches_operation( $val1, $val2, 'less_than' );
697
-				$value = ( $is || $gt );
695
+				$is    = GFFormsModel::matches_operation($val1, $val2, 'is');
696
+				$gt    = GFFormsModel::matches_operation($val1, $val2, 'less_than');
697
+				$value = ($is || $gt);
698 698
 				break;
699 699
 			case 'not_contains':
700
-				$contains = GFFormsModel::matches_operation( $val1, $val2, 'contains' );
701
-				$value    = ! $contains;
700
+				$contains = GFFormsModel::matches_operation($val1, $val2, 'contains');
701
+				$value    = !$contains;
702 702
 				break;
703 703
 			default:
704
-				$value = GFFormsModel::matches_operation( $val1, $val2, $operation );
704
+				$value = GFFormsModel::matches_operation($val1, $val2, $operation);
705 705
 		}
706 706
 
707 707
 		return $value;
@@ -719,41 +719,41 @@  discard block
 block discarded – undo
719 719
 	 * @param array $entry Gravity Forms Entry object
720 720
 	 * @return bool|array Returns 'false' if entry is not valid according to the view search filters (Adv Filter)
721 721
 	 */
722
-	public static function check_entry_display( $entry ) {
722
+	public static function check_entry_display($entry) {
723 723
 
724
-		if ( ! $entry || is_wp_error( $entry ) ) {
725
-			do_action( 'gravityview_log_debug', __METHOD__ . ' Entry was not found.', $entry );
724
+		if (!$entry || is_wp_error($entry)) {
725
+			do_action('gravityview_log_debug', __METHOD__.' Entry was not found.', $entry);
726 726
 			return false;
727 727
 		}
728 728
 
729
-		if ( empty( $entry['form_id'] ) ) {
730
-			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry is empty! Entry:', $entry );
729
+		if (empty($entry['form_id'])) {
730
+			do_action('gravityview_log_debug', '[apply_filters_to_entry] Entry is empty! Entry:', $entry);
731 731
 			return false;
732 732
 		}
733 733
 
734 734
 		$criteria = self::calculate_get_entries_criteria();
735 735
 
736 736
 		// Make sure the current View is connected to the same form as the Entry
737
-		if( ! empty( $criteria['context_view_id'] ) ) {
738
-			$context_view_id = intval( $criteria['context_view_id'] );
739
-			$context_form_id = gravityview_get_form_id( $context_view_id );
740
-			if( intval( $context_form_id ) !== intval( $entry['form_id'] ) ) {
741
-				do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry['form_id'] ), $criteria['context_view_id'] );
737
+		if (!empty($criteria['context_view_id'])) {
738
+			$context_view_id = intval($criteria['context_view_id']);
739
+			$context_form_id = gravityview_get_form_id($context_view_id);
740
+			if (intval($context_form_id) !== intval($entry['form_id'])) {
741
+				do_action('gravityview_log_debug', sprintf('[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry['form_id']), $criteria['context_view_id']);
742 742
 				return false;
743 743
 			}
744 744
 		}
745 745
 
746
-		if ( empty( $criteria['search_criteria'] ) || ! is_array( $criteria['search_criteria'] ) ) {
747
-			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No search criteria found:', $criteria );
746
+		if (empty($criteria['search_criteria']) || !is_array($criteria['search_criteria'])) {
747
+			do_action('gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No search criteria found:', $criteria);
748 748
 			return $entry;
749 749
 		}
750 750
 
751 751
 		$search_criteria = $criteria['search_criteria'];
752
-		unset( $criteria );
752
+		unset($criteria);
753 753
 
754 754
 		// check entry status
755
-		if ( array_key_exists( 'status', $search_criteria ) && $search_criteria['status'] != $entry['status'] ) {
756
-			do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry['status'] ), $search_criteria );
755
+		if (array_key_exists('status', $search_criteria) && $search_criteria['status'] != $entry['status']) {
756
+			do_action('gravityview_log_debug', sprintf('[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry['status']), $search_criteria);
757 757
 			return false;
758 758
 		}
759 759
 
@@ -761,53 +761,53 @@  discard block
 block discarded – undo
761 761
 		// @todo: Does it make sense to apply the Date create filters to the single entry?
762 762
 
763 763
 		// field_filters
764
-		if ( empty( $search_criteria['field_filters'] ) || ! is_array( $search_criteria['field_filters'] ) ) {
765
-			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No field filters criteria found:', $search_criteria );
764
+		if (empty($search_criteria['field_filters']) || !is_array($search_criteria['field_filters'])) {
765
+			do_action('gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No field filters criteria found:', $search_criteria);
766 766
 			return $entry;
767 767
 		}
768 768
 
769 769
 		$filters = $search_criteria['field_filters'];
770
-		unset( $search_criteria );
770
+		unset($search_criteria);
771 771
 
772
-		$mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters['mode'] ) : 'all';
773
-		unset( $filters['mode'] );
772
+		$mode = array_key_exists('mode', $filters) ? strtolower($filters['mode']) : 'all';
773
+		unset($filters['mode']);
774 774
 
775
-		$form = self::get_form( $entry['form_id'] );
775
+		$form = self::get_form($entry['form_id']);
776 776
 
777
-		foreach ( $filters as $filter ) {
777
+		foreach ($filters as $filter) {
778 778
 
779
-			if ( ! isset( $filter['key'] ) ) {
779
+			if (!isset($filter['key'])) {
780 780
 				continue;
781 781
 			}
782 782
 
783 783
 			$k = $filter['key'];
784 784
 
785
-			if ( in_array( $k, array( 'created_by', 'payment_status' ) ) ) {
786
-				$field_value = $entry[ $k ];
785
+			if (in_array($k, array('created_by', 'payment_status'))) {
786
+				$field_value = $entry[$k];
787 787
 				$field = null;
788 788
 			} else {
789
-				$field = self::get_field( $form, $k );
790
-				$field_value  = GFFormsModel::get_lead_field_value( $entry, $field );
789
+				$field = self::get_field($form, $k);
790
+				$field_value = GFFormsModel::get_lead_field_value($entry, $field);
791 791
 			}
792 792
 
793
-			$operator = isset( $filter['operator'] ) ? strtolower( $filter['operator'] ) : 'is';
794
-			$is_value_match = GFFormsModel::is_value_match( $field_value, $filter['value'], $operator, $field );
793
+			$operator = isset($filter['operator']) ? strtolower($filter['operator']) : 'is';
794
+			$is_value_match = GFFormsModel::is_value_match($field_value, $filter['value'], $operator, $field);
795 795
 
796 796
 			// verify if we are already free to go!
797
-			if ( ! $is_value_match && 'all' === $mode ) {
798
-				do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry cannot be displayed. Failed one criteria for ALL mode', $filter );
797
+			if (!$is_value_match && 'all' === $mode) {
798
+				do_action('gravityview_log_debug', '[apply_filters_to_entry] Entry cannot be displayed. Failed one criteria for ALL mode', $filter);
799 799
 				return false;
800
-			} elseif ( $is_value_match && 'any' === $mode ) {
800
+			} elseif ($is_value_match && 'any' === $mode) {
801 801
 				return $entry;
802 802
 			}
803 803
 		}
804 804
 
805 805
 		// at this point, if in ALL mode, then entry is approved - all conditions were met.
806 806
 		// Or, for ANY mode, means none of the conditions were satisfied, so entry is not approved
807
-		if ( 'all' === $mode ) {
807
+		if ('all' === $mode) {
808 808
 			return $entry;
809 809
 		} else {
810
-			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry cannot be displayed. Failed all the criteria for ANY mode', $filters );
810
+			do_action('gravityview_log_debug', '[apply_filters_to_entry] Entry cannot be displayed. Failed all the criteria for ANY mode', $filters);
811 811
 			return false;
812 812
 		}
813 813
 
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
 	 *
833 833
 	 * @return int|null|string Formatted date based on the original date
834 834
 	 */
835
-	public static function format_date( $date_string = '', $args = array() ) {
835
+	public static function format_date($date_string = '', $args = array()) {
836 836
 
837 837
 		$default_atts = array(
838 838
 			'raw' => false,
@@ -843,39 +843,39 @@  discard block
 block discarded – undo
843 843
 			'time' => false,
844 844
 		);
845 845
 
846
-		$atts = wp_parse_args( $args, $default_atts );
846
+		$atts = wp_parse_args($args, $default_atts);
847 847
 
848 848
 		/**
849 849
 		 * Gravity Forms code to adjust date to locally-configured Time Zone
850 850
 		 * @see GFCommon::format_date() for original code
851 851
 		 */
852
-		$date_gmt_time   = mysql2date( 'G', $date_string );
853
-		$date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time );
852
+		$date_gmt_time = mysql2date('G', $date_string);
853
+		$date_local_timestamp = GFCommon::get_local_timestamp($date_gmt_time);
854 854
 
855
-		$format  = rgar( $atts, 'format' );
856
-		$is_human  = ! empty( $atts['human'] );
857
-		$is_diff  = ! empty( $atts['diff'] );
858
-		$is_raw = ! empty( $atts['raw'] );
859
-		$is_timestamp = ! empty( $atts['timestamp'] );
860
-		$include_time = ! empty( $atts['time'] );
855
+		$format = rgar($atts, 'format');
856
+		$is_human = !empty($atts['human']);
857
+		$is_diff = !empty($atts['diff']);
858
+		$is_raw = !empty($atts['raw']);
859
+		$is_timestamp = !empty($atts['timestamp']);
860
+		$include_time = !empty($atts['time']);
861 861
 
862 862
 		// If we're using time diff, we want to have a different default format
863
-		if( empty( $format ) ) {
864
-			$format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' );
863
+		if (empty($format)) {
864
+			$format = $is_diff ? esc_html__('%s ago', 'gravityview') : get_option('date_format');
865 865
 		}
866 866
 
867 867
 		// If raw was specified, don't modify the stored value
868
-		if ( $is_raw ) {
868
+		if ($is_raw) {
869 869
 			$formatted_date = $date_string;
870
-		} elseif( $is_timestamp ) {
870
+		} elseif ($is_timestamp) {
871 871
 			$formatted_date = $date_local_timestamp;
872
-		} elseif ( $is_diff ) {
873
-			$formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) );
872
+		} elseif ($is_diff) {
873
+			$formatted_date = sprintf($format, human_time_diff($date_gmt_time));
874 874
 		} else {
875
-			$formatted_date = GFCommon::format_date( $date_string, $is_human, $format, $include_time );
875
+			$formatted_date = GFCommon::format_date($date_string, $is_human, $format, $include_time);
876 876
 		}
877 877
 
878
-		unset( $format, $is_diff, $is_human, $is_timestamp, $is_raw, $date_gmt_time, $date_local_timestamp, $default_atts );
878
+		unset($format, $is_diff, $is_human, $is_timestamp, $is_raw, $date_gmt_time, $date_local_timestamp, $default_atts);
879 879
 
880 880
 		return $formatted_date;
881 881
 	}
@@ -888,14 +888,14 @@  discard block
 block discarded – undo
888 888
 	 * @param string $field_id
889 889
 	 * @return string
890 890
 	 */
891
-	public static function get_field_label( $form = array(), $field_id = '' ) {
891
+	public static function get_field_label($form = array(), $field_id = '') {
892 892
 
893
-		if ( empty( $form ) || empty( $field_id ) ) {
893
+		if (empty($form) || empty($field_id)) {
894 894
 			return '';
895 895
 		}
896 896
 
897
-		$field = self::get_field( $form, $field_id );
898
-		return isset( $field['label'] ) ?  $field['label'] : '';
897
+		$field = self::get_field($form, $field_id);
898
+		return isset($field['label']) ? $field['label'] : '';
899 899
 
900 900
 	}
901 901
 
@@ -912,9 +912,9 @@  discard block
 block discarded – undo
912 912
 	 * @param string|int $field_id
913 913
 	 * @return array|null Array: Gravity Forms field array; NULL: Gravity Forms GFFormsModel does not exist
914 914
 	 */
915
-	public static function get_field( $form, $field_id ) {
916
-		if ( class_exists( 'GFFormsModel' ) ){
917
-			return GFFormsModel::get_field( $form, $field_id );
915
+	public static function get_field($form, $field_id) {
916
+		if (class_exists('GFFormsModel')) {
917
+			return GFFormsModel::get_field($form, $field_id);
918 918
 		} else {
919 919
 			return null;
920 920
 		}
@@ -930,16 +930,16 @@  discard block
 block discarded – undo
930 930
 	 * @param  WP_Post      $post WordPress post object
931 931
 	 * @return boolean           True: yep, GravityView; No: not!
932 932
 	 */
933
-	public static function has_gravityview_shortcode( $post = null ) {
934
-		if ( ! is_a( $post, 'WP_Post' ) ) {
933
+	public static function has_gravityview_shortcode($post = null) {
934
+		if (!is_a($post, 'WP_Post')) {
935 935
 			return false;
936 936
 		}
937 937
 
938
-		if ( 'gravityview' === get_post_type( $post ) ) {
938
+		if ('gravityview' === get_post_type($post)) {
939 939
 			return true;
940 940
 		}
941 941
 
942
-		return self::has_shortcode_r( $post->post_content, 'gravityview' ) ? true : false;
942
+		return self::has_shortcode_r($post->post_content, 'gravityview') ? true : false;
943 943
 
944 944
 	}
945 945
 
@@ -950,27 +950,27 @@  discard block
 block discarded – undo
950 950
 	 * @param string $content Content to check whether there's a shortcode
951 951
 	 * @param string $tag Current shortcode tag
952 952
 	 */
953
-	public static function has_shortcode_r( $content, $tag = 'gravityview' ) {
954
-		if ( false === strpos( $content, '[' ) ) {
953
+	public static function has_shortcode_r($content, $tag = 'gravityview') {
954
+		if (false === strpos($content, '[')) {
955 955
 			return false;
956 956
 		}
957 957
 
958
-		if ( shortcode_exists( $tag ) ) {
958
+		if (shortcode_exists($tag)) {
959 959
 
960 960
 			$shortcodes = array();
961 961
 
962
-			preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
963
-			if ( empty( $matches ) ){
962
+			preg_match_all('/'.get_shortcode_regex().'/s', $content, $matches, PREG_SET_ORDER);
963
+			if (empty($matches)) {
964 964
 				return false;
965 965
 			}
966 966
 
967
-			foreach ( $matches as $shortcode ) {
968
-				if ( $tag === $shortcode[2] ) {
967
+			foreach ($matches as $shortcode) {
968
+				if ($tag === $shortcode[2]) {
969 969
 
970 970
 					// Changed this to $shortcode instead of true so we get the parsed atts.
971 971
 					$shortcodes[] = $shortcode;
972 972
 
973
-				} else if ( isset( $shortcode[5] ) && $result = self::has_shortcode_r( $shortcode[5], $tag ) ) {
973
+				} else if (isset($shortcode[5]) && $result = self::has_shortcode_r($shortcode[5], $tag)) {
974 974
 					$shortcodes = $result;
975 975
 				}
976 976
 			}
@@ -994,7 +994,7 @@  discard block
 block discarded – undo
994 994
 	 *
995 995
 	 * @return array          Array with view details, as returned by get_posts()
996 996
 	 */
997
-	public static function get_connected_views( $form_id, $args = array() ) {
997
+	public static function get_connected_views($form_id, $args = array()) {
998 998
 
999 999
 		$defaults = array(
1000 1000
 			'post_type' => 'gravityview',
@@ -1003,9 +1003,9 @@  discard block
 block discarded – undo
1003 1003
 			'meta_value' => (int)$form_id,
1004 1004
 		);
1005 1005
 
1006
-		$args = wp_parse_args( $args, $defaults );
1006
+		$args = wp_parse_args($args, $defaults);
1007 1007
 
1008
-		$views = get_posts( $args );
1008
+		$views = get_posts($args);
1009 1009
 
1010 1010
 		return $views;
1011 1011
 	}
@@ -1017,8 +1017,8 @@  discard block
 block discarded – undo
1017 1017
 	 *
1018 1018
 	 * @return string ID of the connected Form, if exists. Empty string if not.
1019 1019
 	 */
1020
-	public static function get_meta_form_id( $view_id ) {
1021
-		return get_post_meta( $view_id, '_gravityview_form_id', true );
1020
+	public static function get_meta_form_id($view_id) {
1021
+		return get_post_meta($view_id, '_gravityview_form_id', true);
1022 1022
 	}
1023 1023
 
1024 1024
 	/**
@@ -1030,8 +1030,8 @@  discard block
 block discarded – undo
1030 1030
 	 *
1031 1031
 	 * @return string GravityView_Template::template_id value. Empty string if not.
1032 1032
 	 */
1033
-	public static function get_meta_template_id( $view_id ) {
1034
-		return get_post_meta( $view_id, '_gravityview_directory_template', true );
1033
+	public static function get_meta_template_id($view_id) {
1034
+		return get_post_meta($view_id, '_gravityview_directory_template', true);
1035 1035
 	}
1036 1036
 
1037 1037
 
@@ -1042,15 +1042,15 @@  discard block
 block discarded – undo
1042 1042
 	 * @param  int $post_id View ID
1043 1043
 	 * @return array          Associative array of settings with plugin defaults used if not set by the View
1044 1044
 	 */
1045
-	public static function get_template_settings( $post_id ) {
1045
+	public static function get_template_settings($post_id) {
1046 1046
 
1047
-		$settings = get_post_meta( $post_id, '_gravityview_template_settings', true );
1047
+		$settings = get_post_meta($post_id, '_gravityview_template_settings', true);
1048 1048
 
1049
-		if ( class_exists( 'GravityView_View_Data' ) ) {
1049
+		if (class_exists('GravityView_View_Data')) {
1050 1050
 
1051 1051
 			$defaults = GravityView_View_Data::get_default_args();
1052 1052
 
1053
-			return wp_parse_args( (array)$settings, $defaults );
1053
+			return wp_parse_args((array)$settings, $defaults);
1054 1054
 
1055 1055
 		}
1056 1056
 
@@ -1067,12 +1067,12 @@  discard block
 block discarded – undo
1067 1067
 	 * @param  string $key     Key for the setting
1068 1068
 	 * @return mixed|null          Setting value, or NULL if not set.
1069 1069
 	 */
1070
-	public static function get_template_setting( $post_id, $key ) {
1070
+	public static function get_template_setting($post_id, $key) {
1071 1071
 
1072
-		$settings = self::get_template_settings( $post_id );
1072
+		$settings = self::get_template_settings($post_id);
1073 1073
 
1074
-		if ( isset( $settings[ $key ] ) ) {
1075
-			return $settings[ $key ];
1074
+		if (isset($settings[$key])) {
1075
+			return $settings[$key];
1076 1076
 		}
1077 1077
 
1078 1078
 		return null;
@@ -1108,8 +1108,8 @@  discard block
 block discarded – undo
1108 1108
 	 * @param  int $post_id View ID
1109 1109
 	 * @return array          Multi-array of fields with first level being the field zones. See code comment.
1110 1110
 	 */
1111
-	public static function get_directory_fields( $post_id ) {
1112
-		return get_post_meta( $post_id, '_gravityview_directory_fields', true );
1111
+	public static function get_directory_fields($post_id) {
1112
+		return get_post_meta($post_id, '_gravityview_directory_fields', true);
1113 1113
 	}
1114 1114
 
1115 1115
 
@@ -1120,25 +1120,25 @@  discard block
 block discarded – undo
1120 1120
 	 * @param  int $formid Form ID
1121 1121
 	 * @return string         html
1122 1122
 	 */
1123
-	public static function get_sortable_fields( $formid, $current = '' ) {
1124
-		$output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>';
1123
+	public static function get_sortable_fields($formid, $current = '') {
1124
+		$output = '<option value="" '.selected('', $current, false).'>'.esc_html__('Default', 'gravityview').'</option>';
1125 1125
 
1126
-		if ( empty( $formid ) ) {
1126
+		if (empty($formid)) {
1127 1127
 			return $output;
1128 1128
 		}
1129 1129
 
1130
-		$fields = self::get_sortable_fields_array( $formid );
1130
+		$fields = self::get_sortable_fields_array($formid);
1131 1131
 
1132
-		if ( ! empty( $fields ) ) {
1132
+		if (!empty($fields)) {
1133 1133
 
1134
-			$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null );
1134
+			$blacklist_field_types = apply_filters('gravityview_blacklist_field_types', array('list', 'textarea'), null);
1135 1135
 
1136
-			foreach ( $fields as $id => $field ) {
1137
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
1136
+			foreach ($fields as $id => $field) {
1137
+				if (in_array($field['type'], $blacklist_field_types)) {
1138 1138
 					continue;
1139 1139
 				}
1140 1140
 
1141
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>';
1141
+				$output .= '<option value="'.$id.'" '.selected($id, $current, false).'>'.esc_attr($field['label']).'</option>';
1142 1142
 			}
1143 1143
 		}
1144 1144
 
@@ -1156,27 +1156,27 @@  discard block
 block discarded – undo
1156 1156
 	 *
1157 1157
 	 * @return array
1158 1158
 	 */
1159
-	public static function get_sortable_fields_array( $formid, $blacklist = array( 'list', 'textarea' ) ) {
1159
+	public static function get_sortable_fields_array($formid, $blacklist = array('list', 'textarea')) {
1160 1160
 
1161 1161
 		// Get fields with sub-inputs and no parent
1162
-		$fields = self::get_form_fields( $formid, true, false );
1162
+		$fields = self::get_form_fields($formid, true, false);
1163 1163
 
1164 1164
 		$date_created = array(
1165 1165
 			'date_created' => array(
1166 1166
 				'type' => 'date_created',
1167
-				'label' => __( 'Date Created', 'gravityview' ),
1167
+				'label' => __('Date Created', 'gravityview'),
1168 1168
 			),
1169 1169
 		);
1170 1170
 
1171 1171
         $fields = $date_created + $fields;
1172 1172
 
1173
-		$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL );
1173
+		$blacklist_field_types = apply_filters('gravityview_blacklist_field_types', $blacklist, NULL);
1174 1174
 
1175 1175
 		// TODO: Convert to using array_filter
1176
-		foreach( $fields as $id => $field ) {
1176
+		foreach ($fields as $id => $field) {
1177 1177
 
1178
-			if( in_array( $field['type'], $blacklist_field_types ) ) {
1179
-				unset( $fields[ $id ] );
1178
+			if (in_array($field['type'], $blacklist_field_types)) {
1179
+				unset($fields[$id]);
1180 1180
 			}
1181 1181
 		}
1182 1182
 
@@ -1186,7 +1186,7 @@  discard block
 block discarded – undo
1186 1186
          * @param array $fields Sub-set of GF form fields that are sortable
1187 1187
          * @param int $formid The Gravity Forms form ID that the fields are from
1188 1188
          */
1189
-        $fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid );
1189
+        $fields = apply_filters('gravityview/common/sortable_fields', $fields, $formid);
1190 1190
 
1191 1191
 		return $fields;
1192 1192
 	}
@@ -1197,15 +1197,15 @@  discard block
 block discarded – undo
1197 1197
 	 * @param  mixed $field_id Field ID or Field array
1198 1198
 	 * @return string field type
1199 1199
 	 */
1200
-	public static function get_field_type( $form = null, $field_id = '' ) {
1200
+	public static function get_field_type($form = null, $field_id = '') {
1201 1201
 
1202
-		if ( ! empty( $field_id ) && ! is_array( $field_id ) ) {
1203
-			$field = self::get_field( $form, $field_id );
1202
+		if (!empty($field_id) && !is_array($field_id)) {
1203
+			$field = self::get_field($form, $field_id);
1204 1204
 		} else {
1205 1205
 			$field = $field_id;
1206 1206
 		}
1207 1207
 
1208
-		return class_exists( 'RGFormsModel' ) ? RGFormsModel::get_input_type( $field ) : '';
1208
+		return class_exists('RGFormsModel') ? RGFormsModel::get_input_type($field) : '';
1209 1209
 
1210 1210
 	}
1211 1211
 
@@ -1216,17 +1216,17 @@  discard block
 block discarded – undo
1216 1216
 	 * @param  int|array  $field field key or field array
1217 1217
 	 * @return boolean
1218 1218
 	 */
1219
-	public static function is_field_numeric(  $form = null, $field = '' ) {
1219
+	public static function is_field_numeric($form = null, $field = '') {
1220 1220
 
1221
-		if ( ! is_array( $form ) && ! is_array( $field ) ) {
1222
-			$form = self::get_form( $form );
1221
+		if (!is_array($form) && !is_array($field)) {
1222
+			$form = self::get_form($form);
1223 1223
 		}
1224 1224
 
1225 1225
 		// If entry meta, it's a string. Otherwise, numeric
1226
-		if( ! is_numeric( $field ) && is_string( $field ) ) {
1226
+		if (!is_numeric($field) && is_string($field)) {
1227 1227
 			$type = $field;
1228 1228
 		} else {
1229
-			$type = self::get_field_type( $form, $field );
1229
+			$type = self::get_field_type($form, $field);
1230 1230
 		}
1231 1231
 
1232 1232
 		/**
@@ -1234,16 +1234,16 @@  discard block
 block discarded – undo
1234 1234
 		 * @since 1.5.2
1235 1235
 		 * @param array $numeric_types Fields that are numeric. Default: `[ number, time ]`
1236 1236
 		 */
1237
-		$numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) );
1237
+		$numeric_types = apply_filters('gravityview/common/numeric_types', array('number', 'time'));
1238 1238
 
1239 1239
 		// Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true
1240
-		if( $gv_field = GravityView_Fields::get( $type ) ) {
1241
-			if( true === $gv_field->is_numeric ) {
1240
+		if ($gv_field = GravityView_Fields::get($type)) {
1241
+			if (true === $gv_field->is_numeric) {
1242 1242
 				$numeric_types[] = $gv_field->is_numeric;
1243 1243
 			}
1244 1244
 		}
1245 1245
 
1246
-		$return = in_array( $type, $numeric_types );
1246
+		$return = in_array($type, $numeric_types);
1247 1247
 
1248 1248
 		return $return;
1249 1249
 	}
@@ -1262,19 +1262,19 @@  discard block
 block discarded – undo
1262 1262
 	 *
1263 1263
 	 * @return string Content, encrypted
1264 1264
 	 */
1265
-	public static function js_encrypt( $content, $message = '' ) {
1265
+	public static function js_encrypt($content, $message = '') {
1266 1266
 
1267 1267
 		$output = $content;
1268 1268
 
1269
-		if ( ! class_exists( 'StandalonePHPEnkoder' ) ) {
1270
-			include_once( GRAVITYVIEW_DIR . 'includes/lib/standalone-phpenkoder/StandalonePHPEnkoder.php' );
1269
+		if (!class_exists('StandalonePHPEnkoder')) {
1270
+			include_once(GRAVITYVIEW_DIR.'includes/lib/standalone-phpenkoder/StandalonePHPEnkoder.php');
1271 1271
 		}
1272 1272
 
1273
-		if ( class_exists( 'StandalonePHPEnkoder' ) ) {
1273
+		if (class_exists('StandalonePHPEnkoder')) {
1274 1274
 
1275 1275
 			$enkoder = new StandalonePHPEnkoder;
1276 1276
 
1277
-			$message = empty( $message ) ? __( 'Email hidden; Javascript is required.', 'gravityview' ) : $message;
1277
+			$message = empty($message) ? __('Email hidden; Javascript is required.', 'gravityview') : $message;
1278 1278
 
1279 1279
 			/**
1280 1280
 			 * @filter `gravityview/phpenkoder/msg` Modify the message shown when Javascript is disabled and an encrypted email field is displayed
@@ -1282,9 +1282,9 @@  discard block
 block discarded – undo
1282 1282
 			 * @param string $message Existing message
1283 1283
 			 * @param string $content Content to encrypt
1284 1284
 			 */
1285
-			$enkoder->enkode_msg = apply_filters( 'gravityview/phpenkoder/msg', $message, $content );
1285
+			$enkoder->enkode_msg = apply_filters('gravityview/phpenkoder/msg', $message, $content);
1286 1286
 
1287
-			$output = $enkoder->enkode( $content );
1287
+			$output = $enkoder->enkode($content);
1288 1288
 		}
1289 1289
 
1290 1290
 		return $output;
@@ -1301,25 +1301,25 @@  discard block
 block discarded – undo
1301 1301
 	 *
1302 1302
 	 * @author rubo77 at https://gist.github.com/rubo77/6821632
1303 1303
 	 **/
1304
-	public static function gv_parse_str( $string, &$result ) {
1305
-		if ( empty( $string ) ) {
1304
+	public static function gv_parse_str($string, &$result) {
1305
+		if (empty($string)) {
1306 1306
 			return false;
1307 1307
 		}
1308 1308
 
1309 1309
 		$result = array();
1310 1310
 
1311 1311
 		// find the pairs "name=value"
1312
-		$pairs = explode( '&', $string );
1312
+		$pairs = explode('&', $string);
1313 1313
 
1314
-		foreach ( $pairs as $pair ) {
1314
+		foreach ($pairs as $pair) {
1315 1315
 			// use the original parse_str() on each element
1316
-			parse_str( $pair, $params );
1316
+			parse_str($pair, $params);
1317 1317
 
1318
-			$k = key( $params );
1319
-			if ( ! isset( $result[ $k ] ) ) {
1318
+			$k = key($params);
1319
+			if (!isset($result[$k])) {
1320 1320
 				$result += $params;
1321
-			} elseif ( array_key_exists( $k, $params ) && is_array( $params[ $k ] ) ) {
1322
-				$result[ $k ] = self::array_merge_recursive_distinct( $result[ $k ], $params[ $k ] );
1321
+			} elseif (array_key_exists($k, $params) && is_array($params[$k])) {
1322
+				$result[$k] = self::array_merge_recursive_distinct($result[$k], $params[$k]);
1323 1323
 			}
1324 1324
 		}
1325 1325
 		return true;
@@ -1341,7 +1341,7 @@  discard block
 block discarded – undo
1341 1341
 	 *
1342 1342
 	 * @return string HTML output of anchor link. If empty $href, returns NULL
1343 1343
 	 */
1344
-	public static function get_link_html( $href = '', $anchor_text = '', $atts = array() ) {
1344
+	public static function get_link_html($href = '', $anchor_text = '', $atts = array()) {
1345 1345
 
1346 1346
 		// Supported attributes for anchor tags. HREF left out intentionally.
1347 1347
 		$allowed_atts = array(
@@ -1377,31 +1377,31 @@  discard block
 block discarded – undo
1377 1377
 		 * @filter `gravityview/get_link/allowed_atts` Modify the attributes that are allowed to be used in generating links
1378 1378
 		 * @param array $allowed_atts Array of attributes allowed
1379 1379
 		 */
1380
-		$allowed_atts = apply_filters( 'gravityview/get_link/allowed_atts', $allowed_atts );
1380
+		$allowed_atts = apply_filters('gravityview/get_link/allowed_atts', $allowed_atts);
1381 1381
 
1382 1382
 		// Make sure the attributes are formatted as array
1383
-		$passed_atts = wp_parse_args( $atts );
1383
+		$passed_atts = wp_parse_args($atts);
1384 1384
 
1385 1385
 		// Make sure the allowed attributes are only the ones in the $allowed_atts list
1386
-		$final_atts = shortcode_atts( $allowed_atts, $passed_atts );
1386
+		$final_atts = shortcode_atts($allowed_atts, $passed_atts);
1387 1387
 
1388 1388
 		// Remove attributes with empty values
1389
-		$final_atts = array_filter( $final_atts );
1389
+		$final_atts = array_filter($final_atts);
1390 1390
 
1391 1391
 		// If the href wasn't passed as an attribute, use the value passed to the function
1392
-		if ( empty( $final_atts['href'] ) && ! empty( $href ) ) {
1392
+		if (empty($final_atts['href']) && !empty($href)) {
1393 1393
 			$final_atts['href'] = $href;
1394 1394
 		}
1395 1395
 
1396
-		$final_atts['href'] = esc_url_raw( $href );
1396
+		$final_atts['href'] = esc_url_raw($href);
1397 1397
 
1398 1398
 		// For each attribute, generate the code
1399 1399
 		$output = '';
1400
-		foreach ( $final_atts as $attr => $value ) {
1401
-			$output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) );
1400
+		foreach ($final_atts as $attr => $value) {
1401
+			$output .= sprintf(' %s="%s"', $attr, esc_attr($value));
1402 1402
 		}
1403 1403
 
1404
-		$output = '<a'. $output .'>'. $anchor_text .'</a>';
1404
+		$output = '<a'.$output.'>'.$anchor_text.'</a>';
1405 1405
 
1406 1406
 		return $output;
1407 1407
 	}
@@ -1420,14 +1420,14 @@  discard block
 block discarded – undo
1420 1420
 	 * @author Daniel <daniel (at) danielsmedegaardbuus (dot) dk>
1421 1421
 	 * @author Gabriel Sobrinho <gabriel (dot) sobrinho (at) gmail (dot) com>
1422 1422
 	 */
1423
-	public static function array_merge_recursive_distinct( array &$array1, array &$array2 ) {
1423
+	public static function array_merge_recursive_distinct(array &$array1, array &$array2) {
1424 1424
 		$merged = $array1;
1425 1425
 
1426
-		foreach ( $array2 as $key => &$value )  {
1427
-			if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) {
1428
-				$merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value );
1426
+		foreach ($array2 as $key => &$value) {
1427
+			if (is_array($value) && isset($merged[$key]) && is_array($merged[$key])) {
1428
+				$merged[$key] = self::array_merge_recursive_distinct($merged[$key], $value);
1429 1429
 			} else {
1430
-				$merged[ $key ] = $value;
1430
+				$merged[$key] = $value;
1431 1431
 			}
1432 1432
 		}
1433 1433
 
@@ -1441,26 +1441,26 @@  discard block
 block discarded – undo
1441 1441
 	 * @param array $args Arguments to modify the user query. See get_users() {@since 1.14}
1442 1442
 	 * @return array Array of WP_User objects.
1443 1443
 	 */
1444
-	public static function get_users( $context = 'change_entry_creator', $args = array() ) {
1444
+	public static function get_users($context = 'change_entry_creator', $args = array()) {
1445 1445
 
1446 1446
 		$default_args = array(
1447 1447
 			'number' => 2000,
1448 1448
 			'orderby' => 'display_name',
1449 1449
 			'order' => 'ASC',
1450
-			'fields' => array( 'ID', 'display_name', 'user_login', 'user_nicename' )
1450
+			'fields' => array('ID', 'display_name', 'user_login', 'user_nicename')
1451 1451
 		);
1452 1452
 
1453 1453
 		// Merge in the passed arg
1454
-		$get_users_settings = wp_parse_args( $args, $default_args );
1454
+		$get_users_settings = wp_parse_args($args, $default_args);
1455 1455
 
1456 1456
 		/**
1457 1457
 		 * @filter `gravityview/get_users/{$context}` There are issues with too many users using [get_users()](http://codex.wordpress.org/Function_Reference/get_users) where it breaks the select. We try to keep it at a reasonable number. \n
1458 1458
 		 * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..)
1459 1459
 		 * @param array $settings Settings array, with `number` key defining the # of users to display
1460 1460
 		 */
1461
-		$get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1461
+		$get_users_settings = apply_filters('gravityview/get_users/'.$context, apply_filters('gravityview_change_entry_creator_user_parameters', $get_users_settings));
1462 1462
 
1463
-		return get_users( $get_users_settings );
1463
+		return get_users($get_users_settings);
1464 1464
 	}
1465 1465
 
1466 1466
 
@@ -1472,8 +1472,8 @@  discard block
 block discarded – undo
1472 1472
      *
1473 1473
      * @return string
1474 1474
      */
1475
-    public static function generate_notice( $notice, $class = '' ) {
1476
-        return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1475
+    public static function generate_notice($notice, $class = '') {
1476
+        return '<div class="gv-notice '.gravityview_sanitize_html_class($class).'">'.$notice.'</div>';
1477 1477
     }
1478 1478
 
1479 1479
 
@@ -1495,6 +1495,6 @@  discard block
 block discarded – undo
1495 1495
  *
1496 1496
  * @return string HTML output of anchor link. If empty $href, returns NULL
1497 1497
  */
1498
-function gravityview_get_link( $href = '', $anchor_text = '', $atts = array() ) {
1499
-	return GVCommon::get_link_html( $href, $anchor_text, $atts );
1498
+function gravityview_get_link($href = '', $anchor_text = '', $atts = array()) {
1499
+	return GVCommon::get_link_html($href, $anchor_text, $atts);
1500 1500
 }
Please login to merge, or discard this patch.
includes/class-gravityview-admin-bar.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
 	 * @since 1.13
24 24
 	 */
25 25
 	private function add_hooks() {
26
-		add_action( 'add_admin_bar_menus', array( $this, 'remove_links' ), 80 );
27
-		add_action( 'admin_bar_menu', array( $this, 'add_links' ), 85 );
26
+		add_action('add_admin_bar_menus', array($this, 'remove_links'), 80);
27
+		add_action('admin_bar_menu', array($this, 'add_links'), 85);
28 28
 	}
29 29
 
30 30
 	/**
@@ -55,15 +55,15 @@  discard block
 block discarded – undo
55 55
 
56 56
 		$entry_id = $this->gravityview_view->getSingleEntry();
57 57
 
58
-		if ( $entry_id && GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_entries' ), $entry_id ) ) {
58
+		if ($entry_id && GVCommon::has_cap(array('gravityforms_edit_entries', 'gravityview_edit_entries'), $entry_id)) {
59 59
 
60 60
 			$entry = $this->gravityview_view->getEntry();
61 61
 
62
-			$wp_admin_bar->add_menu( array(
62
+			$wp_admin_bar->add_menu(array(
63 63
 				'id' => 'edit-entry',
64
-				'title' => __( 'Edit Entry', 'gravityview' ),
65
-				'href' => esc_url_raw( admin_url( sprintf( 'admin.php?page=gf_entries&amp;screen_mode=edit&amp;view=entry&amp;id=%d&lid=%d', $entry['form_id'], $entry['id'] ) ) ),
66
-			) );
64
+				'title' => __('Edit Entry', 'gravityview'),
65
+				'href' => esc_url_raw(admin_url(sprintf('admin.php?page=gf_entries&amp;screen_mode=edit&amp;view=entry&amp;id=%d&lid=%d', $entry['form_id'], $entry['id']))),
66
+			));
67 67
 
68 68
 		}
69 69
 	}
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 		/** @var WP_Admin_Bar $wp_admin_bar */
79 79
 		global $wp_admin_bar;
80 80
 
81
-		if( GVCommon::has_cap('edit_gravityviews') ) {
81
+		if (GVCommon::has_cap('edit_gravityviews')) {
82 82
 
83 83
 			$view_data = GravityView_View_Data::getInstance();
84 84
 
@@ -86,15 +86,15 @@  discard block
 block discarded – undo
86 86
 
87 87
 			// If there is a View embed, shor Edit View link.
88 88
 			// todo: Support multiple View embeds with a drop-down menu
89
-			if ( ! $this->gravityview_view->isGravityviewPostType() && ! empty( $views ) && ! $view_data->has_multiple_views() ) {
90
-				$view = reset( $views );
89
+			if (!$this->gravityview_view->isGravityviewPostType() && !empty($views) && !$view_data->has_multiple_views()) {
90
+				$view = reset($views);
91 91
 
92
-				if( GVCommon::has_cap( 'edit_gravityview', $view['id'] ) ) {
93
-					$wp_admin_bar->add_menu( array(
92
+				if (GVCommon::has_cap('edit_gravityview', $view['id'])) {
93
+					$wp_admin_bar->add_menu(array(
94 94
 						'id'    => 'edit-view',
95
-						'title' => __( 'Edit View', 'gravityview' ),
96
-						'href'  => esc_url_raw( admin_url( sprintf( 'post.php?post=%d&action=edit', $view['id'] ) ) ),
97
-					) );
95
+						'title' => __('Edit View', 'gravityview'),
96
+						'href'  => esc_url_raw(admin_url(sprintf('post.php?post=%d&action=edit', $view['id']))),
97
+					));
98 98
 				}
99 99
 			}
100 100
 		}
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
 	function remove_links() {
109 109
 
110 110
 		// If we're on the single entry page, we don't want to cause confusion.
111
-		if ( is_admin() || ( $this->gravityview_view->getSingleEntry() && ! $this->gravityview_view->isGravityviewPostType() ) ) {
112
-			remove_action( 'admin_bar_menu', 'wp_admin_bar_edit_menu', 80 );
111
+		if (is_admin() || ($this->gravityview_view->getSingleEntry() && !$this->gravityview_view->isGravityviewPostType())) {
112
+			remove_action('admin_bar_menu', 'wp_admin_bar_edit_menu', 80);
113 113
 		}
114 114
 	}
115 115
 }
Please login to merge, or discard this patch.
includes/class-gravityview-admin-notices.php 2 patches
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
  * When the plugin is activated, flush dismissed notices
16 16
  * @since 1.15.1
17 17
  */
18
-register_activation_hook( GRAVITYVIEW_FILE, array( 'GravityView_Admin_Notices', 'flush_dismissed_notices' ) );
18
+register_activation_hook(GRAVITYVIEW_FILE, array('GravityView_Admin_Notices', 'flush_dismissed_notices'));
19 19
 
20 20
 /**
21 21
  * Handle displaying and storing of admin notices for GravityView
@@ -33,10 +33,10 @@  discard block
 block discarded – undo
33 33
 	}
34 34
 
35 35
 	function add_hooks() {
36
-		add_action( 'network_admin_notices', array( $this, 'dismiss_notice' ), 50 );
37
-		add_action( 'admin_notices', array( $this, 'dismiss_notice' ), 50 );
38
-		add_action( 'admin_notices', array( $this, 'admin_notice' ), 100 );
39
-		add_action( 'network_admin_notices', array( $this, 'admin_notice' ), 100 );
36
+		add_action('network_admin_notices', array($this, 'dismiss_notice'), 50);
37
+		add_action('admin_notices', array($this, 'dismiss_notice'), 50);
38
+		add_action('admin_notices', array($this, 'admin_notice'), 100);
39
+		add_action('network_admin_notices', array($this, 'admin_notice'), 100);
40 40
 	}
41 41
 
42 42
 	/**
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 * @return void
47 47
 	 */
48 48
 	static public function flush_dismissed_notices() {
49
-		delete_transient( 'gravityview_dismissed_notices' );
49
+		delete_transient('gravityview_dismissed_notices');
50 50
 	}
51 51
 
52 52
 	/**
@@ -57,26 +57,26 @@  discard block
 block discarded – undo
57 57
 	public function dismiss_notice() {
58 58
 
59 59
 		// No dismiss sent
60
-		if( empty( $_GET['gv-dismiss'] ) ) {
60
+		if (empty($_GET['gv-dismiss'])) {
61 61
 			return;
62 62
 		}
63 63
 
64 64
 		// Invalid nonce
65
-		if( !wp_verify_nonce( $_GET['gv-dismiss'], 'dismiss' ) ) {
65
+		if (!wp_verify_nonce($_GET['gv-dismiss'], 'dismiss')) {
66 66
 			return;
67 67
 		}
68 68
 
69
-		$notice_id = esc_attr( $_GET['notice'] );
69
+		$notice_id = esc_attr($_GET['notice']);
70 70
 
71 71
 		//don't display a message if use has dismissed the message for this version
72
-		$dismissed_notices = (array)get_transient( 'gravityview_dismissed_notices' );
72
+		$dismissed_notices = (array)get_transient('gravityview_dismissed_notices');
73 73
 
74 74
 		$dismissed_notices[] = $notice_id;
75 75
 
76
-		$dismissed_notices = array_unique( $dismissed_notices );
76
+		$dismissed_notices = array_unique($dismissed_notices);
77 77
 
78 78
 		// Remind users every 16 weeks
79
-		set_transient( 'gravityview_dismissed_notices', $dismissed_notices, WEEK_IN_SECONDS * 16 );
79
+		set_transient('gravityview_dismissed_notices', $dismissed_notices, WEEK_IN_SECONDS * 16);
80 80
 
81 81
 	}
82 82
 
@@ -91,15 +91,15 @@  discard block
 block discarded – undo
91 91
 	 * @param  string $notice            Notice array, set using `add_notice()`.
92 92
 	 * @return boolean                   True: show notice; False: hide notice
93 93
 	 */
94
-	private function is_notice_dismissed( $notice ) {
94
+	private function is_notice_dismissed($notice) {
95 95
 
96 96
 		// There are no dismissed notices.
97
-		if( empty( self::$dismissed_notices ) ) {
97
+		if (empty(self::$dismissed_notices)) {
98 98
 			return false;
99 99
 		}
100 100
 
101 101
 		// Has the
102
-		$is_dismissed = !empty( $notice['dismiss'] ) && in_array( $notice['dismiss'], self::$dismissed_notices );
102
+		$is_dismissed = !empty($notice['dismiss']) && in_array($notice['dismiss'], self::$dismissed_notices);
103 103
 
104 104
 		return $is_dismissed ? true : false;
105 105
 	}
@@ -124,17 +124,17 @@  discard block
 block discarded – undo
124 124
 	 */
125 125
 	private function check_show_multisite_notices() {
126 126
 
127
-		if( ! is_multisite() ) {
127
+		if (!is_multisite()) {
128 128
 			return true;
129 129
 		}
130 130
 
131 131
 		// It's network activated but the user can't manage network plugins; they can't do anything about it.
132
-		if( GravityView_Plugin::is_network_activated() && ! is_main_site() ) {
132
+		if (GravityView_Plugin::is_network_activated() && !is_main_site()) {
133 133
 			return false;
134 134
 		}
135 135
 
136 136
 		// or they don't have admin capabilities
137
-		if( ! is_super_admin() ) {
137
+		if (!is_super_admin()) {
138 138
 			return false;
139 139
 		}
140 140
 
@@ -155,53 +155,53 @@  discard block
 block discarded – undo
155 155
 		 * @filter `gravityview/admin/notices` Modify the notices displayed in the admin
156 156
 		 * @since 1.12
157 157
 		 */
158
-		$notices = apply_filters( 'gravityview/admin/notices', self::$admin_notices );
158
+		$notices = apply_filters('gravityview/admin/notices', self::$admin_notices);
159 159
 
160
-		if( empty( $notices ) || ! $this->check_show_multisite_notices() ) {
160
+		if (empty($notices) || !$this->check_show_multisite_notices()) {
161 161
 			return;
162 162
 		}
163 163
 
164 164
 		//don't display a message if use has dismissed the message for this version
165 165
 		// TODO: Use get_user_meta instead of get_transient
166
-		self::$dismissed_notices = isset( $_GET['show-dismissed-notices'] ) ? array() : (array)get_transient( 'gravityview_dismissed_notices' );
166
+		self::$dismissed_notices = isset($_GET['show-dismissed-notices']) ? array() : (array)get_transient('gravityview_dismissed_notices');
167 167
 
168 168
 		$output = '';
169 169
 
170
-		foreach( $notices as $notice ) {
170
+		foreach ($notices as $notice) {
171 171
 
172 172
 			// If the user doesn't have the capability to see the warning
173
-			if( isset( $notice['cap'] ) && false === GVCommon::has_cap( $notice['cap'] ) ) {
174
-				do_action( 'gravityview_log_debug', 'Notice not shown because user does not have the capability to view it.', $notice );
173
+			if (isset($notice['cap']) && false === GVCommon::has_cap($notice['cap'])) {
174
+				do_action('gravityview_log_debug', 'Notice not shown because user does not have the capability to view it.', $notice);
175 175
 				continue;
176 176
 			}
177 177
 
178
-			if( true === $this->is_notice_dismissed( $notice ) ) {
179
-				do_action( 'gravityview_log_debug', 'Notice not shown because the notice has already been dismissed.', $notice );
178
+			if (true === $this->is_notice_dismissed($notice)) {
179
+				do_action('gravityview_log_debug', 'Notice not shown because the notice has already been dismissed.', $notice);
180 180
 				continue;
181 181
 			}
182 182
 
183
-			$output .= '<div id="message" style="position:relative" class="notice '. gravityview_sanitize_html_class( $notice['class'] ).'">';
183
+			$output .= '<div id="message" style="position:relative" class="notice '.gravityview_sanitize_html_class($notice['class']).'">';
184 184
 
185 185
 			// Too cute to leave out.
186 186
 			$output .= gravityview_get_floaty();
187 187
 
188
-			if( !empty( $notice['title'] ) ) {
189
-				$output .= '<h3>'.esc_html( $notice['title'] ) .'</h3>';
188
+			if (!empty($notice['title'])) {
189
+				$output .= '<h3>'.esc_html($notice['title']).'</h3>';
190 190
 			}
191 191
 
192
-			$message = isset( $notice['message'] ) ? $notice['message'] : '';
192
+			$message = isset($notice['message']) ? $notice['message'] : '';
193 193
 
194
-			if( !empty( $notice['dismiss'] ) ) {
194
+			if (!empty($notice['dismiss'])) {
195 195
 
196 196
 				$dismiss = esc_attr($notice['dismiss']);
197 197
 
198
-				$url = esc_url( add_query_arg( array( 'gv-dismiss' => wp_create_nonce( 'dismiss' ), 'notice' => $dismiss ) ) );
198
+				$url = esc_url(add_query_arg(array('gv-dismiss' => wp_create_nonce('dismiss'), 'notice' => $dismiss)));
199 199
 
200 200
 				$align = is_rtl() ? 'alignleft' : 'alignright';
201
-				$message .= '<a href="'.$url.'" data-notice="'.$dismiss.'" class="' . $align . ' button button-link">'.esc_html__('Dismiss', 'gravityview' ).'</a></p>';
201
+				$message .= '<a href="'.$url.'" data-notice="'.$dismiss.'" class="'.$align.' button button-link">'.esc_html__('Dismiss', 'gravityview').'</a></p>';
202 202
 			}
203 203
 
204
-			$output .= wpautop( $message );
204
+			$output .= wpautop($message);
205 205
 
206 206
 			$output .= '<div class="clear"></div>';
207 207
 			$output .= '</div>';
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 
211 211
 		echo $output;
212 212
 
213
-		unset( $output, $align, $message, $notices );
213
+		unset($output, $align, $message, $notices);
214 214
 
215 215
 		//reset the notices handler
216 216
 		self::$admin_notices = array();
@@ -223,14 +223,14 @@  discard block
 block discarded – undo
223 223
 	 * @param array $notice Array with `class`, `message`, `dismiss` and `cap` keys. The message is not escaped.
224 224
 	 * @return void
225 225
 	 */
226
-	public static function add_notice( $notice = array() ) {
226
+	public static function add_notice($notice = array()) {
227 227
 
228
-		if( !isset( $notice['message'] ) ) {
229
-			do_action( 'gravityview_log_error', 'GravityView_Admin[add_notice] Notice not set', $notice );
228
+		if (!isset($notice['message'])) {
229
+			do_action('gravityview_log_error', 'GravityView_Admin[add_notice] Notice not set', $notice);
230 230
 			return;
231 231
 		}
232 232
 
233
-		$notice['class'] = empty( $notice['class'] ) ? 'error' : $notice['class'];
233
+		$notice['class'] = empty($notice['class']) ? 'error' : $notice['class'];
234 234
 
235 235
 		self::$admin_notices[] = $notice;
236 236
 	}
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * GravityView Admin notices
4
- *
5
- * @package   GravityView
6
- * @license   GPL2+
7
- * @author    Katz Web Services, Inc.
8
- * @link      http://gravityview.co
9
- * @copyright Copyright 2015, Katz Web Services, Inc.
10
- *
11
- * @since 1.12
12
- */
3
+	 * GravityView Admin notices
4
+	 *
5
+	 * @package   GravityView
6
+	 * @license   GPL2+
7
+	 * @author    Katz Web Services, Inc.
8
+	 * @link      http://gravityview.co
9
+	 * @copyright Copyright 2015, Katz Web Services, Inc.
10
+	 *
11
+	 * @since 1.12
12
+	 */
13 13
 
14 14
 /**
15 15
  * When the plugin is activated, flush dismissed notices
Please login to merge, or discard this patch.
includes/class-gravityview-change-entry-creator.php 2 patches
Indentation   +169 added lines, -169 removed lines patch added patch discarded remove patch
@@ -5,220 +5,220 @@
 block discarded – undo
5 5
  */
6 6
 class GravityView_Change_Entry_Creator {
7 7
 
8
-    function __construct() {
9
-
10
-    	/**
11
-    	 * @since  1.5.1
12
-    	 */
13
-    	add_action('gform_user_registered', array( $this, 'assign_new_user_to_lead'), 10, 4 );
14
-
15
-    	// ONLY ADMIN FROM HERE ON.
16
-    	if( !is_admin() ) { return; }
17
-
18
-	    /**
19
-         * @filter `gravityview_disable_change_entry_creator` Disable the Change Entry Creator functionality
20
-	     * @since 1.7.4
21
-	     * @param boolean $disable Disable the Change Entry Creator functionality. Default: false.
22
-	     */
23
-	    if( apply_filters('gravityview_disable_change_entry_creator', false ) ) {
24
-		    return;
25
-	    }
26
-
27
-        /**
28
-         * Use `init` to fix bbPress warning
29
-         * @see https://bbpress.trac.wordpress.org/ticket/2309
30
-         */
31
-    	add_action('init', array( $this, 'load'), 100 );
32
-
33
-    	add_action('plugins_loaded', array( $this, 'prevent_conflicts') );
8
+	function __construct() {
9
+
10
+		/**
11
+		 * @since  1.5.1
12
+		 */
13
+		add_action('gform_user_registered', array( $this, 'assign_new_user_to_lead'), 10, 4 );
14
+
15
+		// ONLY ADMIN FROM HERE ON.
16
+		if( !is_admin() ) { return; }
17
+
18
+		/**
19
+		 * @filter `gravityview_disable_change_entry_creator` Disable the Change Entry Creator functionality
20
+		 * @since 1.7.4
21
+		 * @param boolean $disable Disable the Change Entry Creator functionality. Default: false.
22
+		 */
23
+		if( apply_filters('gravityview_disable_change_entry_creator', false ) ) {
24
+			return;
25
+		}
26
+
27
+		/**
28
+		 * Use `init` to fix bbPress warning
29
+		 * @see https://bbpress.trac.wordpress.org/ticket/2309
30
+		 */
31
+		add_action('init', array( $this, 'load'), 100 );
32
+
33
+		add_action('plugins_loaded', array( $this, 'prevent_conflicts') );
34 34
 
35
-    }
35
+	}
36 36
 
37
-    /**
38
-     * When an user is created using the User Registration add-on, assign the entry to them
39
-     *
40
-     * @since  1.5.1
41
-     * @uses RGFormsModel::update_lead_property() Modify the entry `created_by` field
42
-     * @param  int $user_id  WordPress User ID
43
-     * @param  array $config   User registration feed configuration
44
-     * @param  array  $entry     GF Entry array
45
-     * @param  string $password User password
46
-     * @return void
47
-     */
48
-    function assign_new_user_to_lead( $user_id, $config, $entry = array(), $password = '' ) {
37
+	/**
38
+	 * When an user is created using the User Registration add-on, assign the entry to them
39
+	 *
40
+	 * @since  1.5.1
41
+	 * @uses RGFormsModel::update_lead_property() Modify the entry `created_by` field
42
+	 * @param  int $user_id  WordPress User ID
43
+	 * @param  array $config   User registration feed configuration
44
+	 * @param  array  $entry     GF Entry array
45
+	 * @param  string $password User password
46
+	 * @return void
47
+	 */
48
+	function assign_new_user_to_lead( $user_id, $config, $entry = array(), $password = '' ) {
49 49
 
50
-    	/**
51
-    	 * Disable assigning the new user to the entry by returning false.
52
-    	 * @param  int $user_id  WordPress User ID
53
-	     * @param  array $config   User registration feed configuration
54
-	     * @param  array  $entry     GF Entry array
55
-    	 */
56
-    	$assign_to_lead = apply_filters( 'gravityview_assign_new_user_to_entry', true, $user_id, $config, $entry );
57
-
58
-    	// If filter returns false, do not process
59
-    	if( empty( $assign_to_lead ) ) {
60
-    		return;
61
-    	}
50
+		/**
51
+		 * Disable assigning the new user to the entry by returning false.
52
+		 * @param  int $user_id  WordPress User ID
53
+		 * @param  array $config   User registration feed configuration
54
+		 * @param  array  $entry     GF Entry array
55
+		 */
56
+		$assign_to_lead = apply_filters( 'gravityview_assign_new_user_to_entry', true, $user_id, $config, $entry );
57
+
58
+		// If filter returns false, do not process
59
+		if( empty( $assign_to_lead ) ) {
60
+			return;
61
+		}
62 62
 
63
-    	// Update the entry. The `false` prevents checking Akismet; `true` disables the user updated hook from firing
64
-    	$result = RGFormsModel::update_lead_property( $entry['id'], 'created_by', $user_id, false, true );
63
+		// Update the entry. The `false` prevents checking Akismet; `true` disables the user updated hook from firing
64
+		$result = RGFormsModel::update_lead_property( $entry['id'], 'created_by', $user_id, false, true );
65 65
 
66
-    	if( empty( $result ) ) {
67
-    		$status = __('Error', 'gravityview');
68
-    	} else {
69
-    		$status = __('Success', 'gravityview');
70
-    	}
71
-
72
-    	$note = sprintf( _x('%s: Assigned User ID #%d as the entry creator.', 'First parameter: Success or error of the action. Second: User ID number', 'gravityview'), $status, $user_id );
66
+		if( empty( $result ) ) {
67
+			$status = __('Error', 'gravityview');
68
+		} else {
69
+			$status = __('Success', 'gravityview');
70
+		}
71
+
72
+		$note = sprintf( _x('%s: Assigned User ID #%d as the entry creator.', 'First parameter: Success or error of the action. Second: User ID number', 'gravityview'), $status, $user_id );
73 73
 
74
-    	do_action( 'gravityview_log_debug', 'GravityView_Change_Entry_Creator[assign_new_user_to_lead] - '.$note );
74
+		do_action( 'gravityview_log_debug', 'GravityView_Change_Entry_Creator[assign_new_user_to_lead] - '.$note );
75 75
 
76
-        GravityView_Entry_Notes::add_note( $entry['id'], -1, 'GravityView', $note, 'gravityview' );
76
+		GravityView_Entry_Notes::add_note( $entry['id'], -1, 'GravityView', $note, 'gravityview' );
77 77
 
78
-    }
78
+	}
79 79
 
80
-    /**
81
-     * Disable previous functionality; use this one as the canonical.
82
-     * @return void
83
-     */
84
-    function prevent_conflicts() {
80
+	/**
81
+	 * Disable previous functionality; use this one as the canonical.
82
+	 * @return void
83
+	 */
84
+	function prevent_conflicts() {
85 85
 
86
-    	// Plugin that was provided here:
87
-    	// @link https://gravityview.co/support/documentation/201991205/
88
-    	remove_action("gform_entry_info", 'gravityview_change_entry_creator_form', 10, 2);
89
-    	remove_action("gform_after_update_entry", 'gravityview_update_entry_creator', 10, 2);
86
+		// Plugin that was provided here:
87
+		// @link https://gravityview.co/support/documentation/201991205/
88
+		remove_action("gform_entry_info", 'gravityview_change_entry_creator_form', 10, 2);
89
+		remove_action("gform_after_update_entry", 'gravityview_update_entry_creator', 10, 2);
90 90
 
91
-    	// Disable for Gravity Forms Add-ons 3.6.2 and lower
92
-    	if( class_exists( 'KWS_GF_Change_Lead_Creator' ) ) {
91
+		// Disable for Gravity Forms Add-ons 3.6.2 and lower
92
+		if( class_exists( 'KWS_GF_Change_Lead_Creator' ) ) {
93 93
 
94
-    		$Old_Lead_Creator = new KWS_GF_Change_Lead_Creator;
94
+			$Old_Lead_Creator = new KWS_GF_Change_Lead_Creator;
95 95
 
96
-    		// Now, no validation is required in the methods; let's hook in.
97
-    		remove_action('admin_init', array( $Old_Lead_Creator, 'set_screen_mode' ) );
96
+			// Now, no validation is required in the methods; let's hook in.
97
+			remove_action('admin_init', array( $Old_Lead_Creator, 'set_screen_mode' ) );
98 98
 
99
-    		remove_action("gform_entry_info", array( $Old_Lead_Creator, 'add_select' ), 10, 2);
99
+			remove_action("gform_entry_info", array( $Old_Lead_Creator, 'add_select' ), 10, 2);
100 100
 
101
-    		remove_action("gform_after_update_entry", array( $Old_Lead_Creator, 'update_entry_creator' ), 10, 2);
102
-    	}
101
+			remove_action("gform_after_update_entry", array( $Old_Lead_Creator, 'update_entry_creator' ), 10, 2);
102
+		}
103 103
 
104
-    }
104
+	}
105 105
 
106
-    /**
107
-     * @since  3.6.3
108
-     * @return void
109
-     */
110
-    function load() {
106
+	/**
107
+	 * @since  3.6.3
108
+	 * @return void
109
+	 */
110
+	function load() {
111 111
 
112
-    	// Does GF exist?
113
-        if( !class_exists('GFCommon') ) {
114
-            return;
115
-        }
112
+		// Does GF exist?
113
+		if( !class_exists('GFCommon') ) {
114
+			return;
115
+		}
116 116
 
117
-        // Can the user edit entries?
118
-        if( ! GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_entries' ) ) ) {
119
-            return;
120
-        }
117
+		// Can the user edit entries?
118
+		if( ! GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_entries' ) ) ) {
119
+			return;
120
+		}
121 121
 
122
-        // If screen mode isn't set, then we're in the wrong place.
123
-        if( empty( $_REQUEST['screen_mode'] ) ) {
124
-            return;
125
-        }
122
+		// If screen mode isn't set, then we're in the wrong place.
123
+		if( empty( $_REQUEST['screen_mode'] ) ) {
124
+			return;
125
+		}
126 126
 
127
-        // Now, no validation is required in the methods; let's hook in.
128
-        add_action('admin_init', array( &$this, 'set_screen_mode' ) );
127
+		// Now, no validation is required in the methods; let's hook in.
128
+		add_action('admin_init', array( &$this, 'set_screen_mode' ) );
129 129
 
130
-        add_action("gform_entry_info", array( &$this, 'add_select' ), 10, 2);
130
+		add_action("gform_entry_info", array( &$this, 'add_select' ), 10, 2);
131 131
 
132
-        add_action("gform_after_update_entry", array( &$this, 'update_entry_creator' ), 10, 2);
132
+		add_action("gform_after_update_entry", array( &$this, 'update_entry_creator' ), 10, 2);
133 133
 
134
-    }
134
+	}
135 135
 
136
-    /**
137
-     * Allows for edit links to work with a link instead of a form (GET instead of POST)
138
-     * @return void
139
-     */
140
-    function set_screen_mode() {
136
+	/**
137
+	 * Allows for edit links to work with a link instead of a form (GET instead of POST)
138
+	 * @return void
139
+	 */
140
+	function set_screen_mode() {
141 141
 
142
-    	// If $_GET['screen_mode'] is set to edit, set $_POST value
143
-        if( rgget('screen_mode') === 'edit' ) {
144
-            $_POST["screen_mode"] = 'edit';
145
-        }
142
+		// If $_GET['screen_mode'] is set to edit, set $_POST value
143
+		if( rgget('screen_mode') === 'edit' ) {
144
+			$_POST["screen_mode"] = 'edit';
145
+		}
146 146
 
147
-    }
147
+	}
148 148
 
149
-    /**
150
-     * When the entry creator is changed, add a note to the entry
151
-     * @param  array $form   GF entry array
152
-     * @param  int $entry_id Entry ID
153
-     * @return void
154
-     */
155
-    function update_entry_creator($form, $entry_id) {
156
-            global $current_user;
149
+	/**
150
+	 * When the entry creator is changed, add a note to the entry
151
+	 * @param  array $form   GF entry array
152
+	 * @param  int $entry_id Entry ID
153
+	 * @return void
154
+	 */
155
+	function update_entry_creator($form, $entry_id) {
156
+			global $current_user;
157 157
 
158
-        // Update the entry
159
-        $created_by = absint( rgpost('created_by') );
158
+		// Update the entry
159
+		$created_by = absint( rgpost('created_by') );
160 160
 
161
-        RGFormsModel::update_lead_property( $entry_id, 'created_by', $created_by );
161
+		RGFormsModel::update_lead_property( $entry_id, 'created_by', $created_by );
162 162
 
163
-        // If the creator has changed, let's add a note about who it used to be.
164
-        $originally_created_by = rgpost('originally_created_by');
163
+		// If the creator has changed, let's add a note about who it used to be.
164
+		$originally_created_by = rgpost('originally_created_by');
165 165
 
166
-        // If there's no owner and there didn't used to be, keep going
167
-        if( empty( $originally_created_by ) && empty( $created_by ) ) {
168
-            return;
169
-        }
166
+		// If there's no owner and there didn't used to be, keep going
167
+		if( empty( $originally_created_by ) && empty( $created_by ) ) {
168
+			return;
169
+		}
170 170
 
171
-        // If the values have changed
172
-        if( absint( $originally_created_by ) !== absint( $created_by ) ) {
171
+		// If the values have changed
172
+		if( absint( $originally_created_by ) !== absint( $created_by ) ) {
173 173
 
174
-            $user_data = get_userdata($current_user->ID);
174
+			$user_data = get_userdata($current_user->ID);
175 175
 
176
-            $user_format = _x('%s (ID #%d)', 'The name and the ID of users who initiated changes to entry ownership', 'gravityview');
176
+			$user_format = _x('%s (ID #%d)', 'The name and the ID of users who initiated changes to entry ownership', 'gravityview');
177 177
 
178
-            $original_name = $created_by_name = esc_attr_x( 'No User', 'To show that the entry was unassigned from an actual user to no user.', 'gravityview');
178
+			$original_name = $created_by_name = esc_attr_x( 'No User', 'To show that the entry was unassigned from an actual user to no user.', 'gravityview');
179 179
 
180
-            if( !empty( $originally_created_by ) ) {
181
-                $originally_created_by_user_data = get_userdata($originally_created_by);
182
-                $original_name = sprintf( $user_format, $originally_created_by_user_data->display_name, $originally_created_by_user_data->ID );
183
-            }
180
+			if( !empty( $originally_created_by ) ) {
181
+				$originally_created_by_user_data = get_userdata($originally_created_by);
182
+				$original_name = sprintf( $user_format, $originally_created_by_user_data->display_name, $originally_created_by_user_data->ID );
183
+			}
184 184
 
185
-            if( !empty( $created_by ) ) {
186
-                $created_by_user_data =  get_userdata($created_by);
187
-                $created_by_name = sprintf( $user_format, $created_by_user_data->display_name, $created_by_user_data->ID );
188
-            }
185
+			if( !empty( $created_by ) ) {
186
+				$created_by_user_data =  get_userdata($created_by);
187
+				$created_by_name = sprintf( $user_format, $created_by_user_data->display_name, $created_by_user_data->ID );
188
+			}
189 189
 
190
-            GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $user_data->display_name, sprintf( __('Changed entry creator from %s to %s', 'gravityview'), $original_name, $created_by_name ), 'note' );
191
-        }
190
+			GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $user_data->display_name, sprintf( __('Changed entry creator from %s to %s', 'gravityview'), $original_name, $created_by_name ), 'note' );
191
+		}
192 192
 
193
-    }
193
+	}
194 194
 
195
-    /**
196
-     * Output the select to change the entry creator
197
-     * @param int $form_id GF Form ID
198
-     * @param array $entry    GF entry array
199
-     * @return void
200
-     */
201
-    function add_select($form_id, $entry ) {
195
+	/**
196
+	 * Output the select to change the entry creator
197
+	 * @param int $form_id GF Form ID
198
+	 * @param array $entry    GF entry array
199
+	 * @return void
200
+	 */
201
+	function add_select($form_id, $entry ) {
202 202
 
203
-        if( rgpost('screen_mode') !== 'edit' ) {
204
-            return;
205
-        }
203
+		if( rgpost('screen_mode') !== 'edit' ) {
204
+			return;
205
+		}
206 206
 
207
-        $users = GVCommon::get_users( 'change_entry_creator' );
207
+		$users = GVCommon::get_users( 'change_entry_creator' );
208 208
 
209
-        $output = '<label for="change_created_by">';
210
-        $output .= esc_html__('Change Entry Creator:', 'gravityview');
211
-        $output .= '</label>
209
+		$output = '<label for="change_created_by">';
210
+		$output .= esc_html__('Change Entry Creator:', 'gravityview');
211
+		$output .= '</label>
212 212
         <select name="created_by" id="change_created_by" class="widefat">';
213
-        $output .= '<option value=""> &mdash; '.esc_attr_x( 'No User', 'No user assigned to the entry', 'gravityview').' &mdash; </option>';
214
-        foreach($users as $user) {
215
-            $output .= '<option value="'. $user->ID .'"'. selected( $entry['created_by'], $user->ID, false ).'>'.esc_attr( $user->display_name.' ('.$user->user_nicename.')' ).'</option>';
216
-        }
217
-        $output .= '</select>';
218
-        $output .= '<input name="originally_created_by" value="'.esc_attr( $entry['created_by'] ).'" type="hidden" />';
219
-        echo $output;
220
-
221
-    }
213
+		$output .= '<option value=""> &mdash; '.esc_attr_x( 'No User', 'No user assigned to the entry', 'gravityview').' &mdash; </option>';
214
+		foreach($users as $user) {
215
+			$output .= '<option value="'. $user->ID .'"'. selected( $entry['created_by'], $user->ID, false ).'>'.esc_attr( $user->display_name.' ('.$user->user_nicename.')' ).'</option>';
216
+		}
217
+		$output .= '</select>';
218
+		$output .= '<input name="originally_created_by" value="'.esc_attr( $entry['created_by'] ).'" type="hidden" />';
219
+		echo $output;
220
+
221
+	}
222 222
 
223 223
 }
224 224
 
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -10,17 +10,17 @@  discard block
 block discarded – undo
10 10
     	/**
11 11
     	 * @since  1.5.1
12 12
     	 */
13
-    	add_action('gform_user_registered', array( $this, 'assign_new_user_to_lead'), 10, 4 );
13
+    	add_action('gform_user_registered', array($this, 'assign_new_user_to_lead'), 10, 4);
14 14
 
15 15
     	// ONLY ADMIN FROM HERE ON.
16
-    	if( !is_admin() ) { return; }
16
+    	if (!is_admin()) { return; }
17 17
 
18 18
 	    /**
19 19
          * @filter `gravityview_disable_change_entry_creator` Disable the Change Entry Creator functionality
20 20
 	     * @since 1.7.4
21 21
 	     * @param boolean $disable Disable the Change Entry Creator functionality. Default: false.
22 22
 	     */
23
-	    if( apply_filters('gravityview_disable_change_entry_creator', false ) ) {
23
+	    if (apply_filters('gravityview_disable_change_entry_creator', false)) {
24 24
 		    return;
25 25
 	    }
26 26
 
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
          * Use `init` to fix bbPress warning
29 29
          * @see https://bbpress.trac.wordpress.org/ticket/2309
30 30
          */
31
-    	add_action('init', array( $this, 'load'), 100 );
31
+    	add_action('init', array($this, 'load'), 100);
32 32
 
33
-    	add_action('plugins_loaded', array( $this, 'prevent_conflicts') );
33
+    	add_action('plugins_loaded', array($this, 'prevent_conflicts'));
34 34
 
35 35
     }
36 36
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      * @param  string $password User password
46 46
      * @return void
47 47
      */
48
-    function assign_new_user_to_lead( $user_id, $config, $entry = array(), $password = '' ) {
48
+    function assign_new_user_to_lead($user_id, $config, $entry = array(), $password = '') {
49 49
 
50 50
     	/**
51 51
     	 * Disable assigning the new user to the entry by returning false.
@@ -53,27 +53,27 @@  discard block
 block discarded – undo
53 53
 	     * @param  array $config   User registration feed configuration
54 54
 	     * @param  array  $entry     GF Entry array
55 55
     	 */
56
-    	$assign_to_lead = apply_filters( 'gravityview_assign_new_user_to_entry', true, $user_id, $config, $entry );
56
+    	$assign_to_lead = apply_filters('gravityview_assign_new_user_to_entry', true, $user_id, $config, $entry);
57 57
 
58 58
     	// If filter returns false, do not process
59
-    	if( empty( $assign_to_lead ) ) {
59
+    	if (empty($assign_to_lead)) {
60 60
     		return;
61 61
     	}
62 62
 
63 63
     	// Update the entry. The `false` prevents checking Akismet; `true` disables the user updated hook from firing
64
-    	$result = RGFormsModel::update_lead_property( $entry['id'], 'created_by', $user_id, false, true );
64
+    	$result = RGFormsModel::update_lead_property($entry['id'], 'created_by', $user_id, false, true);
65 65
 
66
-    	if( empty( $result ) ) {
66
+    	if (empty($result)) {
67 67
     		$status = __('Error', 'gravityview');
68 68
     	} else {
69 69
     		$status = __('Success', 'gravityview');
70 70
     	}
71 71
 
72
-    	$note = sprintf( _x('%s: Assigned User ID #%d as the entry creator.', 'First parameter: Success or error of the action. Second: User ID number', 'gravityview'), $status, $user_id );
72
+    	$note = sprintf(_x('%s: Assigned User ID #%d as the entry creator.', 'First parameter: Success or error of the action. Second: User ID number', 'gravityview'), $status, $user_id);
73 73
 
74
-    	do_action( 'gravityview_log_debug', 'GravityView_Change_Entry_Creator[assign_new_user_to_lead] - '.$note );
74
+    	do_action('gravityview_log_debug', 'GravityView_Change_Entry_Creator[assign_new_user_to_lead] - '.$note);
75 75
 
76
-        GravityView_Entry_Notes::add_note( $entry['id'], -1, 'GravityView', $note, 'gravityview' );
76
+        GravityView_Entry_Notes::add_note($entry['id'], -1, 'GravityView', $note, 'gravityview');
77 77
 
78 78
     }
79 79
 
@@ -89,16 +89,16 @@  discard block
 block discarded – undo
89 89
     	remove_action("gform_after_update_entry", 'gravityview_update_entry_creator', 10, 2);
90 90
 
91 91
     	// Disable for Gravity Forms Add-ons 3.6.2 and lower
92
-    	if( class_exists( 'KWS_GF_Change_Lead_Creator' ) ) {
92
+    	if (class_exists('KWS_GF_Change_Lead_Creator')) {
93 93
 
94 94
     		$Old_Lead_Creator = new KWS_GF_Change_Lead_Creator;
95 95
 
96 96
     		// Now, no validation is required in the methods; let's hook in.
97
-    		remove_action('admin_init', array( $Old_Lead_Creator, 'set_screen_mode' ) );
97
+    		remove_action('admin_init', array($Old_Lead_Creator, 'set_screen_mode'));
98 98
 
99
-    		remove_action("gform_entry_info", array( $Old_Lead_Creator, 'add_select' ), 10, 2);
99
+    		remove_action("gform_entry_info", array($Old_Lead_Creator, 'add_select'), 10, 2);
100 100
 
101
-    		remove_action("gform_after_update_entry", array( $Old_Lead_Creator, 'update_entry_creator' ), 10, 2);
101
+    		remove_action("gform_after_update_entry", array($Old_Lead_Creator, 'update_entry_creator'), 10, 2);
102 102
     	}
103 103
 
104 104
     }
@@ -110,26 +110,26 @@  discard block
 block discarded – undo
110 110
     function load() {
111 111
 
112 112
     	// Does GF exist?
113
-        if( !class_exists('GFCommon') ) {
113
+        if (!class_exists('GFCommon')) {
114 114
             return;
115 115
         }
116 116
 
117 117
         // Can the user edit entries?
118
-        if( ! GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_entries' ) ) ) {
118
+        if (!GVCommon::has_cap(array('gravityforms_edit_entries', 'gravityview_edit_entries'))) {
119 119
             return;
120 120
         }
121 121
 
122 122
         // If screen mode isn't set, then we're in the wrong place.
123
-        if( empty( $_REQUEST['screen_mode'] ) ) {
123
+        if (empty($_REQUEST['screen_mode'])) {
124 124
             return;
125 125
         }
126 126
 
127 127
         // Now, no validation is required in the methods; let's hook in.
128
-        add_action('admin_init', array( &$this, 'set_screen_mode' ) );
128
+        add_action('admin_init', array(&$this, 'set_screen_mode'));
129 129
 
130
-        add_action("gform_entry_info", array( &$this, 'add_select' ), 10, 2);
130
+        add_action("gform_entry_info", array(&$this, 'add_select'), 10, 2);
131 131
 
132
-        add_action("gform_after_update_entry", array( &$this, 'update_entry_creator' ), 10, 2);
132
+        add_action("gform_after_update_entry", array(&$this, 'update_entry_creator'), 10, 2);
133 133
 
134 134
     }
135 135
 
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
     function set_screen_mode() {
141 141
 
142 142
     	// If $_GET['screen_mode'] is set to edit, set $_POST value
143
-        if( rgget('screen_mode') === 'edit' ) {
143
+        if (rgget('screen_mode') === 'edit') {
144 144
             $_POST["screen_mode"] = 'edit';
145 145
         }
146 146
 
@@ -156,38 +156,38 @@  discard block
 block discarded – undo
156 156
             global $current_user;
157 157
 
158 158
         // Update the entry
159
-        $created_by = absint( rgpost('created_by') );
159
+        $created_by = absint(rgpost('created_by'));
160 160
 
161
-        RGFormsModel::update_lead_property( $entry_id, 'created_by', $created_by );
161
+        RGFormsModel::update_lead_property($entry_id, 'created_by', $created_by);
162 162
 
163 163
         // If the creator has changed, let's add a note about who it used to be.
164 164
         $originally_created_by = rgpost('originally_created_by');
165 165
 
166 166
         // If there's no owner and there didn't used to be, keep going
167
-        if( empty( $originally_created_by ) && empty( $created_by ) ) {
167
+        if (empty($originally_created_by) && empty($created_by)) {
168 168
             return;
169 169
         }
170 170
 
171 171
         // If the values have changed
172
-        if( absint( $originally_created_by ) !== absint( $created_by ) ) {
172
+        if (absint($originally_created_by) !== absint($created_by)) {
173 173
 
174 174
             $user_data = get_userdata($current_user->ID);
175 175
 
176 176
             $user_format = _x('%s (ID #%d)', 'The name and the ID of users who initiated changes to entry ownership', 'gravityview');
177 177
 
178
-            $original_name = $created_by_name = esc_attr_x( 'No User', 'To show that the entry was unassigned from an actual user to no user.', 'gravityview');
178
+            $original_name = $created_by_name = esc_attr_x('No User', 'To show that the entry was unassigned from an actual user to no user.', 'gravityview');
179 179
 
180
-            if( !empty( $originally_created_by ) ) {
180
+            if (!empty($originally_created_by)) {
181 181
                 $originally_created_by_user_data = get_userdata($originally_created_by);
182
-                $original_name = sprintf( $user_format, $originally_created_by_user_data->display_name, $originally_created_by_user_data->ID );
182
+                $original_name = sprintf($user_format, $originally_created_by_user_data->display_name, $originally_created_by_user_data->ID);
183 183
             }
184 184
 
185
-            if( !empty( $created_by ) ) {
186
-                $created_by_user_data =  get_userdata($created_by);
187
-                $created_by_name = sprintf( $user_format, $created_by_user_data->display_name, $created_by_user_data->ID );
185
+            if (!empty($created_by)) {
186
+                $created_by_user_data = get_userdata($created_by);
187
+                $created_by_name = sprintf($user_format, $created_by_user_data->display_name, $created_by_user_data->ID);
188 188
             }
189 189
 
190
-            GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $user_data->display_name, sprintf( __('Changed entry creator from %s to %s', 'gravityview'), $original_name, $created_by_name ), 'note' );
190
+            GravityView_Entry_Notes::add_note($entry_id, $current_user->ID, $user_data->display_name, sprintf(__('Changed entry creator from %s to %s', 'gravityview'), $original_name, $created_by_name), 'note');
191 191
         }
192 192
 
193 193
     }
@@ -198,24 +198,24 @@  discard block
 block discarded – undo
198 198
      * @param array $entry    GF entry array
199 199
      * @return void
200 200
      */
201
-    function add_select($form_id, $entry ) {
201
+    function add_select($form_id, $entry) {
202 202
 
203
-        if( rgpost('screen_mode') !== 'edit' ) {
203
+        if (rgpost('screen_mode') !== 'edit') {
204 204
             return;
205 205
         }
206 206
 
207
-        $users = GVCommon::get_users( 'change_entry_creator' );
207
+        $users = GVCommon::get_users('change_entry_creator');
208 208
 
209 209
         $output = '<label for="change_created_by">';
210 210
         $output .= esc_html__('Change Entry Creator:', 'gravityview');
211 211
         $output .= '</label>
212 212
         <select name="created_by" id="change_created_by" class="widefat">';
213
-        $output .= '<option value=""> &mdash; '.esc_attr_x( 'No User', 'No user assigned to the entry', 'gravityview').' &mdash; </option>';
214
-        foreach($users as $user) {
215
-            $output .= '<option value="'. $user->ID .'"'. selected( $entry['created_by'], $user->ID, false ).'>'.esc_attr( $user->display_name.' ('.$user->user_nicename.')' ).'</option>';
213
+        $output .= '<option value=""> &mdash; '.esc_attr_x('No User', 'No user assigned to the entry', 'gravityview').' &mdash; </option>';
214
+        foreach ($users as $user) {
215
+            $output .= '<option value="'.$user->ID.'"'.selected($entry['created_by'], $user->ID, false).'>'.esc_attr($user->display_name.' ('.$user->user_nicename.')').'</option>';
216 216
         }
217 217
         $output .= '</select>';
218
-        $output .= '<input name="originally_created_by" value="'.esc_attr( $entry['created_by'] ).'" type="hidden" />';
218
+        $output .= '<input name="originally_created_by" value="'.esc_attr($entry['created_by']).'" type="hidden" />';
219 219
         echo $output;
220 220
 
221 221
     }
Please login to merge, or discard this patch.
includes/class-gravityview-entry-list.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 /** If this file is called directly, abort. */
4
-if ( ! defined( 'ABSPATH' ) ) {
4
+if (!defined('ABSPATH')) {
5 5
 	die;
6 6
 }
7 7
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 * @param string $link_format
76 76
 	 * @param string $after_link
77 77
 	 */
78
-	function __construct( $entries = array(), $post_id = 0, $form = array(), $link_format = '', $after_link = '', $context = '' ) {
78
+	function __construct($entries = array(), $post_id = 0, $form = array(), $link_format = '', $after_link = '', $context = '') {
79 79
 
80 80
 		$this->entries = $entries;
81 81
 		$this->post_id = $post_id;
@@ -90,28 +90,28 @@  discard block
 block discarded – undo
90 90
 	/**
91 91
 	 * @param int $post_id
92 92
 	 */
93
-	public function set_post_id( $post_id ) {
93
+	public function set_post_id($post_id) {
94 94
 		$this->post_id = $post_id;
95 95
 	}
96 96
 
97 97
 	/**
98 98
 	 * @param string $link_format
99 99
 	 */
100
-	public function set_link_format( $link_format ) {
100
+	public function set_link_format($link_format) {
101 101
 		$this->link_format = $link_format;
102 102
 	}
103 103
 
104 104
 	/**
105 105
 	 * @param boolean $skip_current_entry
106 106
 	 */
107
-	public function set_skip_current_entry( $skip_current_entry ) {
107
+	public function set_skip_current_entry($skip_current_entry) {
108 108
 		$this->skip_current_entry = (bool)$skip_current_entry;
109 109
 	}
110 110
 
111 111
 	/**
112 112
 	 * @param string $after_link
113 113
 	 */
114
-	public function set_after_link( $after_link ) {
114
+	public function set_after_link($after_link) {
115 115
 		$this->after_link = $after_link;
116 116
 	}
117 117
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 * Set the message when there are no entries to display
120 120
 	 * @param string $empty_message
121 121
 	 */
122
-	public function set_empty_message( $empty_message ) {
122
+	public function set_empty_message($empty_message) {
123 123
 		$this->empty_message = $empty_message;
124 124
 	}
125 125
 
@@ -127,23 +127,23 @@  discard block
 block discarded – undo
127 127
 	 * Set the context in which this entry list is being displayed.
128 128
 	 * @param string $context
129 129
 	 */
130
-	public function set_context( $context ) {
130
+	public function set_context($context) {
131 131
 		$this->context = $context;
132 132
 	}
133 133
 
134 134
 	/**
135 135
 	 * @param string $wrapper_tag
136 136
 	 */
137
-	public function set_wrapper_tag( $wrapper_tag ) {
138
-		$this->wrapper_tag = esc_attr( $wrapper_tag );
137
+	public function set_wrapper_tag($wrapper_tag) {
138
+		$this->wrapper_tag = esc_attr($wrapper_tag);
139 139
 	}
140 140
 
141 141
 	/**
142 142
 	 *
143 143
 	 * @param string $item_tag
144 144
 	 */
145
-	public function set_item_tag( $item_tag ) {
146
-		$this->item_tag = esc_attr( $item_tag );
145
+	public function set_item_tag($item_tag) {
146
+		$this->item_tag = esc_attr($item_tag);
147 147
 	}
148 148
 
149 149
 	/**
@@ -170,32 +170,32 @@  discard block
 block discarded – undo
170 170
 	public function get_output() {
171 171
 
172 172
 		// No Entries
173
-		if( empty( $this->entries ) ) {
173
+		if (empty($this->entries)) {
174 174
 			return '<div class="gv-no-results">'.$this->empty_message.'</div>';
175 175
 		}
176 176
 
177 177
 		$output = '';
178 178
 		$current_entry = GravityView_View::getInstance()->getCurrentEntry();
179 179
 
180
-		$output .= '<'. $this->wrapper_tag .'>';
180
+		$output .= '<'.$this->wrapper_tag.'>';
181 181
 
182
-		foreach( $this->entries as $entry ) {
182
+		foreach ($this->entries as $entry) {
183 183
 
184
-			if( $this->skip_entry( $entry, $current_entry ) ) {
184
+			if ($this->skip_entry($entry, $current_entry)) {
185 185
 				continue;
186 186
 			}
187 187
 
188
-			$output .= $this->get_item_output( $entry );
188
+			$output .= $this->get_item_output($entry);
189 189
 		}
190 190
 
191
-		$output .= '</'. $this->wrapper_tag .'>';
191
+		$output .= '</'.$this->wrapper_tag.'>';
192 192
 
193 193
 		/**
194 194
 		 * @filter `gravityview/widget/recent-entries/output` Modify the HTML of the Recent Entries widget output
195 195
 		 * @param string $output HTML to be displayed
196 196
 		 * @param GravityView_Entry_List $this The current class instance
197 197
 		 */
198
-		$output = apply_filters( 'gravityview/widget/recent-entries/output', $output, $this );
198
+		$output = apply_filters('gravityview/widget/recent-entries/output', $output, $this);
199 199
 
200 200
 		return $output;
201 201
 	}
@@ -208,18 +208,18 @@  discard block
 block discarded – undo
208 208
 	 *
209 209
 	 * @return bool True: Skip entry; False: don't skip entry
210 210
 	 */
211
-	private function skip_entry( $entry, $current_entry ) {
211
+	private function skip_entry($entry, $current_entry) {
212 212
 
213 213
 		// If skip entry is off, or there's no current entry, return false
214
-		if( empty( $this->skip_current_entry ) || empty( $current_entry ) ) {
214
+		if (empty($this->skip_current_entry) || empty($current_entry)) {
215 215
 			return false;
216 216
 		}
217 217
 
218 218
 		// If in Single or Edit mode, $current_entry will be an array.
219
-		$current_entry_id = is_array( $current_entry ) ? $current_entry['id'] : $current_entry;
219
+		$current_entry_id = is_array($current_entry) ? $current_entry['id'] : $current_entry;
220 220
 
221 221
 		// If the entry ID matches the current entry, yes: skip
222
-		if( $entry['id'] === $current_entry_id ) {
222
+		if ($entry['id'] === $current_entry_id) {
223 223
 			return true;
224 224
 		}
225 225
 
@@ -240,13 +240,13 @@  discard block
 block discarded – undo
240 240
 	 *
241 241
 	 * @return string HTML output for the entry
242 242
 	 */
243
-	private function get_item_output( $entry ) {
243
+	private function get_item_output($entry) {
244 244
 
245
-		$link = GravityView_API::entry_link( $entry, $this->post_id );
245
+		$link = GravityView_API::entry_link($entry, $this->post_id);
246 246
 
247
-		$item_output = gravityview_get_link( $link, $this->link_format );
247
+		$item_output = gravityview_get_link($link, $this->link_format);
248 248
 
249
-		if( !empty( $this->after_link ) ) {
249
+		if (!empty($this->after_link)) {
250 250
 
251 251
 			/**
252 252
 			 * @filter `gravityview/entry-list/after-link` Modify the content displayed after the entry link in an entry list
@@ -255,14 +255,14 @@  discard block
 block discarded – undo
255 255
 			 * @param array $entry Gravity Forms entry array
256 256
 			 * @param GravityView_Entry_List $this The current class instance
257 257
 			 */
258
-			$after_link = apply_filters( 'gravityview/entry-list/after-link', '<div>'.$this->after_link.'</div>', $entry, $this );
258
+			$after_link = apply_filters('gravityview/entry-list/after-link', '<div>'.$this->after_link.'</div>', $entry, $this);
259 259
 
260 260
 			$item_output .= $after_link;
261 261
 		}
262 262
 
263
-		$item_output = GravityView_API::replace_variables( $item_output, $this->form, $entry );
263
+		$item_output = GravityView_API::replace_variables($item_output, $this->form, $entry);
264 264
 
265
-		$item_output = '<'. $this->item_tag .'>'. $item_output .'</'. $this->item_tag .'>';
265
+		$item_output = '<'.$this->item_tag.'>'.$item_output.'</'.$this->item_tag.'>';
266 266
 
267 267
 		/**
268 268
 		 * @filter `gravityview/entry-list/item` Modify each item's output in an entry list
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 		 * @param array $entry Gravity Forms entry array
272 272
 		 * @param GravityView_Entry_List $this The current class instance
273 273
 		 */
274
-		$item_output = apply_filters( 'gravityview/entry-list/item', $item_output, $entry, $this );
274
+		$item_output = apply_filters('gravityview/entry-list/item', $item_output, $entry, $this);
275 275
 
276 276
 		return $item_output;
277 277
 	}
Please login to merge, or discard this patch.
includes/class-gravityview-entry-notes.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 	 * @since 1.15
18 18
 	 */
19 19
 	private function add_hooks() {
20
-		add_filter( 'gform_notes_avatar', array( 'GravityView_Entry_Notes', 'filter_avatar' ), 10, 2 );
20
+		add_filter('gform_notes_avatar', array('GravityView_Entry_Notes', 'filter_avatar'), 10, 2);
21 21
 	}
22 22
 
23 23
 
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	 * @param string $note Note content.
32 32
 	 * @param string $note_type Type of note. Default: `gravityview`
33 33
 	 */
34
-	public static function add_note( $lead_id, $user_id, $user_name, $note = '', $note_type = 'gravityview' ) {
34
+	public static function add_note($lead_id, $user_id, $user_name, $note = '', $note_type = 'gravityview') {
35 35
 
36 36
 		$default_note = array(
37 37
 			'lead_id' => 0,
@@ -47,12 +47,12 @@  discard block
 block discarded – undo
47 47
 		 * @since 1.15.2
48 48
 		 * @param array $note Array with `lead_id`, `user_id`, `user_name`, `note`, and `note_type` key value pairs
49 49
 		 */
50
-		$note = apply_filters( 'gravityview/entry_notes/add_note', compact( 'lead_id', 'user_id', 'user_name', 'note', 'note_type' ) );
50
+		$note = apply_filters('gravityview/entry_notes/add_note', compact('lead_id', 'user_id', 'user_name', 'note', 'note_type'));
51 51
 
52 52
 		// Make sure the keys are all set
53
-		$note = wp_parse_args( $note, $default_note );
53
+		$note = wp_parse_args($note, $default_note);
54 54
 
55
-		GFFormsModel::add_note( intval( $note['lead_id'] ), intval( $note['user_id'] ), esc_attr( $note['user_name'] ), $note['note'], esc_attr( $note['note_type'] ) );
55
+		GFFormsModel::add_note(intval($note['lead_id']), intval($note['user_id']), esc_attr($note['user_name']), $note['note'], esc_attr($note['note_type']));
56 56
 	}
57 57
 
58 58
 	/**
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 	 * @see GFFormsModel::delete_note()
61 61
 	 * @param int $note_id Entry note ID
62 62
 	 */
63
-	public static function delete_note( $note_id ) {
64
-		GFFormsModel::delete_note( $note_id );
63
+	public static function delete_note($note_id) {
64
+		GFFormsModel::delete_note($note_id);
65 65
 	}
66 66
 
67 67
 	/**
@@ -70,13 +70,13 @@  discard block
 block discarded – undo
70 70
 	 * @todo Write more efficient delete note method using SQL
71 71
 	 * @param int[] $note_ids Array of entry note ids
72 72
 	 */
73
-	public static function delete_notes( $note_ids = array() ) {
73
+	public static function delete_notes($note_ids = array()) {
74 74
 
75
-		if( !is_array( $note_ids ) ) {
76
-			do_action( 'gravityview_log_error', __METHOD__ . ' - Note IDs not an array', $note_ids );
75
+		if (!is_array($note_ids)) {
76
+			do_action('gravityview_log_error', __METHOD__.' - Note IDs not an array', $note_ids);
77 77
 		}
78 78
 
79
-		GFFormsModel::delete_notes( $note_ids );
79
+		GFFormsModel::delete_notes($note_ids);
80 80
 	}
81 81
 
82 82
 	/**
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 	 *
88 88
 	 * @return stdClass[] Integer-keyed array of note objects
89 89
 	 */
90
-	public static function get_notes( $entry_id ) {
91
-		$notes = GFFormsModel::get_lead_notes( $entry_id );
90
+	public static function get_notes($entry_id) {
91
+		$notes = GFFormsModel::get_lead_notes($entry_id);
92 92
 
93 93
 		/**
94 94
 		 * @filter `gravityview/entry_notes/get_notes` Modify the notes array for an entry
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 		 * @param stdClass[] $notes Integer-keyed array of note objects
97 97
 		 * @param int $entry_id Entry to get notes for
98 98
 		 */
99
-		$notes = apply_filters( 'gravityview/entry_notes/get_notes', $notes, $entry_id );
99
+		$notes = apply_filters('gravityview/entry_notes/get_notes', $notes, $entry_id);
100 100
 
101 101
 		return $notes;
102 102
 	}
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
 	 * @param object $note Note object with id, user_id, date_created, value, note_type, user_name, user_email vars
110 110
 	 * @return string Possibly-modified avatar
111 111
 	 */
112
-	public static function filter_avatar( $avatar = '', $note ) {
112
+	public static function filter_avatar($avatar = '', $note) {
113 113
 
114
-		if( 'gravityview' === $note->note_type && -1 === (int)$note->user_id ) {
115
-			$avatar =  sprintf( '<img src="%s" width="48" height="48" alt="GravityView" class="avatar avatar-48 gravityview-avatar" />', esc_url_raw( plugins_url( 'assets/images/floaty-avatar.png', GRAVITYVIEW_FILE ) ) );
114
+		if ('gravityview' === $note->note_type && -1 === (int)$note->user_id) {
115
+			$avatar = sprintf('<img src="%s" width="48" height="48" alt="GravityView" class="avatar avatar-48 gravityview-avatar" />', esc_url_raw(plugins_url('assets/images/floaty-avatar.png', GRAVITYVIEW_FILE)));
116 116
 		}
117 117
 
118 118
 		return $avatar;
Please login to merge, or discard this patch.