Completed
Pull Request — master (#1147)
by Gennady
22:01 queued 16:50
created
includes/class-admin.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -4,10 +4,10 @@  discard block
 block discarded – undo
4 4
 
5 5
 	function __construct() {
6 6
 
7
-		if( ! is_admin() ) { return; }
7
+		if ( ! is_admin() ) { return; }
8 8
 
9 9
 		// If Gravity Forms isn't active or compatibile, stop loading
10
-		if( false === GravityView_Compatibility::is_valid() ) {
10
+		if ( false === GravityView_Compatibility::is_valid() ) {
11 11
 			return;
12 12
 		}
13 13
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 		add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) );
49 49
 		add_filter( 'bulk_post_updated_messages', array( $this, 'post_updated_messages' ) );
50 50
 
51
-		add_filter( 'plugin_action_links_'. plugin_basename( GRAVITYVIEW_FILE ) , array( $this, 'plugin_action_links' ) );
51
+		add_filter( 'plugin_action_links_' . plugin_basename( GRAVITYVIEW_FILE ), array( $this, 'plugin_action_links' ) );
52 52
 
53 53
 		add_action( 'plugins_loaded', array( $this, 'backend_actions' ), 100 );
54 54
 
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
 	 */
65 65
 	public static function no_views_text() {
66 66
 
67
-		if ( isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'] ) {
67
+		if ( isset( $_REQUEST[ 'post_status' ] ) && 'trash' === $_REQUEST[ 'post_status' ] ) {
68 68
 			return __( 'No Views found in Trash', 'gravityview' );
69
-		} elseif( ! empty( $_GET['s'] ) ) {
69
+		} elseif ( ! empty( $_GET[ 's' ] ) ) {
70 70
 			return __( 'No Views found.', 'gravityview' );
71 71
 		}
72 72
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 			$error .= ' ' . esc_html__( 'or select another form.', 'gravityview' );
111 111
 		}
112 112
 
113
-		if( $error ) {
113
+		if ( $error ) {
114 114
 			?>
115 115
 			<div class="wp-dialog notice-warning inline error wp-clearfix">
116 116
 				<?php echo gravityview_get_floaty(); ?>
@@ -129,23 +129,23 @@  discard block
 block discarded – undo
129 129
 	public function backend_actions() {
130 130
 
131 131
 		/** @define "GRAVITYVIEW_DIR" "../" */
132
-		include_once( GRAVITYVIEW_DIR .'includes/admin/class.field.type.php' );
133
-		include_once( GRAVITYVIEW_DIR .'includes/admin/class.render.settings.php' );
134
-		include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-item.php' );
135
-		include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-field.php' );
136
-		include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-widget.php' );
137
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin-views.php' );
138
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin-welcome.php' );
139
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin-installer.php' );
140
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin-add-shortcode.php' );
141
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' );
132
+		include_once( GRAVITYVIEW_DIR . 'includes/admin/class.field.type.php' );
133
+		include_once( GRAVITYVIEW_DIR . 'includes/admin/class.render.settings.php' );
134
+		include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-item.php' );
135
+		include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-field.php' );
136
+		include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-widget.php' );
137
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin-views.php' );
138
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin-welcome.php' );
139
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin-installer.php' );
140
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin-add-shortcode.php' );
141
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' );
142 142
 
143 143
 		/**
144 144
 		 * @action `gravityview_include_backend_actions` Triggered after all GravityView admin files are loaded
145 145
 		 *
146 146
 		 * Nice place to insert extensions' backend stuff
147 147
 		 */
148
-		do_action('gravityview_include_backend_actions');
148
+		do_action( 'gravityview_include_backend_actions' );
149 149
 	}
150 150
 
151 151
 	/**
@@ -161,12 +161,12 @@  discard block
 block discarded – undo
161 161
 
162 162
 		$actions = array();
163 163
 
164
-		if( GVCommon::has_cap( 'gravityview_view_settings' ) ) {
165
-			$actions[] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) );
164
+		if ( GVCommon::has_cap( 'gravityview_view_settings' ) ) {
165
+			$actions[ ] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) );
166 166
 		}
167 167
 
168
-		if( GVCommon::has_cap( 'gravityview_support_port' ) ) {
169
-			$actions[] = '<a href="https://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>';
168
+		if ( GVCommon::has_cap( 'gravityview_support_port' ) ) {
169
+			$actions[ ] = '<a href="https://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>';
170 170
 		}
171 171
 
172 172
 		return array_merge( $actions, $links );
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 		// By default, there will only be one item being modified.
195 195
 		// When in the `bulk_post_updated_messages` filter, there will be passed a number
196 196
 		// of modified items that will override this array.
197
-		$bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1 , 'locked' => 1 , 'deleted' => 1 , 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts;
197
+		$bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1, 'locked' => 1, 'deleted' => 1, 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts;
198 198
 
199 199
 		// If we're starting fresh, a new form was created.
200 200
 		// We should let the user know this is the case.
@@ -202,60 +202,60 @@  discard block
 block discarded – undo
202 202
 
203 203
 		$new_form_text = '';
204 204
 
205
-		if( !empty( $start_fresh ) ) {
205
+		if ( ! empty( $start_fresh ) ) {
206 206
 
207 207
 			// Get the form that was created
208 208
 			$connected_form = gravityview_get_form_id( $post_id );
209 209
 
210
-			if( !empty( $connected_form ) ) {
210
+			if ( ! empty( $connected_form ) ) {
211 211
 				$form = gravityview_get_form( $connected_form );
212
-				$form_name = esc_attr( $form['title'] );
212
+				$form_name = esc_attr( $form[ 'title' ] );
213 213
 				$image = self::get_floaty();
214
-				$new_form_text .= '<h3>'.$image.sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ).'</h3>';
215
-				$new_form_text .=  sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s
214
+				$new_form_text .= '<h3>' . $image . sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ) . '</h3>';
215
+				$new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s
216 216
 
217 217
 					You can %sedit the form%s in Gravity Forms and the updated fields will be available here. Don&rsquo;t forget to %scustomize the form settings%s.
218
-					', 'gravityview' ), '<strong>', '</strong>', '<a href="'.site_url( '?gf_page=preview&amp;id='.$connected_form ).'">', '</a>', '<code>[gravityform id="'.$connected_form.'" name="'.$form_name.'"]</code>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&amp;id='.$connected_form ).'">', '</a>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&amp;view=settings&amp;id='.$connected_form ).'">', '</a>');
218
+					', 'gravityview' ), '<strong>', '</strong>', '<a href="' . site_url( '?gf_page=preview&amp;id=' . $connected_form ) . '">', '</a>', '<code>[gravityform id="' . $connected_form . '" name="' . $form_name . '"]</code>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&amp;id=' . $connected_form ) . '">', '</a>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&amp;view=settings&amp;id=' . $connected_form ) . '">', '</a>' );
219 219
 				$new_form_text = wpautop( $new_form_text );
220 220
 
221 221
 				delete_post_meta( $post_id, '_gravityview_start_fresh' );
222 222
 			}
223 223
 		}
224 224
 
225
-		$messages['gravityview'] = array(
225
+		$messages[ 'gravityview' ] = array(
226 226
 			0  => '', // Unused. Messages start at index 1.
227 227
 			/* translators: %s and %s are HTML tags linking to the View on the website */
228
-			1  => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'),
228
+			1  => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ),
229 229
 			/* translators: %s and %s are HTML tags linking to the View on the website */
230
-			2  => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'),
230
+			2  => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ),
231 231
 			3  => __( 'View deleted.', 'gravityview' ),
232 232
 			/* translators: %s and %s are HTML tags linking to the View on the website */
233
-			4  => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'),
233
+			4  => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ),
234 234
 			/* translators: %s: date and time of the revision */
235
-			5  => isset( $_GET['revision'] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
235
+			5  => isset( $_GET[ 'revision' ] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int)$_GET[ 'revision' ], false ) ) : false,
236 236
 			/* translators: %s and %s are HTML tags linking to the View on the website */
237
-			6  => sprintf(__( 'View published. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text,
237
+			6  => sprintf( __( 'View published. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text,
238 238
 			/* translators: %s and %s are HTML tags linking to the View on the website */
239
-			7  => sprintf(__( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text,
239
+			7  => sprintf( __( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text,
240 240
 			8  => __( 'View submitted.', 'gravityview' ),
241 241
 			9  => sprintf(
242 242
 		        /* translators: Date and time the View is scheduled to be published */
243 243
 				__( 'View scheduled for: %1$s.', 'gravityview' ),
244 244
 				// translators: Publish box date format, see http://php.net/date
245
-				date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL )  ) )
245
+				date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) )
246 246
 			) . $new_form_text,
247 247
 			/* translators: %s and %s are HTML tags linking to the View on the website */
248
-			10  => sprintf(__( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text,
248
+			10  => sprintf( __( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text,
249 249
 
250 250
 			/**
251 251
 			 * These apply to `bulk_post_updated_messages`
252 252
 			 * @file wp-admin/edit.php
253 253
 			 */
254
-			'updated'   => _n( '%s View updated.', '%s Views updated.', $bulk_counts['updated'], 'gravityview' ),
255
-			'locked'    => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts['locked'], 'gravityview' ),
256
-			'deleted'   => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts['deleted'], 'gravityview' ),
257
-			'trashed'   => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts['trashed'], 'gravityview' ),
258
-			'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts['untrashed'], 'gravityview' ),
254
+			'updated'   => _n( '%s View updated.', '%s Views updated.', $bulk_counts[ 'updated' ], 'gravityview' ),
255
+			'locked'    => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts[ 'locked' ], 'gravityview' ),
256
+			'deleted'   => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts[ 'deleted' ], 'gravityview' ),
257
+			'trashed'   => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts[ 'trashed' ], 'gravityview' ),
258
+			'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts[ 'untrashed' ], 'gravityview' ),
259 259
 		);
260 260
 
261 261
 		return $messages;
Please login to merge, or discard this patch.
future/includes/class-gv-entry.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
 		$args = array();
115 115
 
116
-		$view_id = is_null ( $view ) ? null : $view->ID;
116
+		$view_id = is_null( $view ) ? null : $view->ID;
117 117
 
118 118
 		$permalink = null;
119 119
 
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 
127 127
 				$view_collection = View_Collection::from_post( $post );
128 128
 
129
-				if( 1 < $view_collection->count() ) {
130
-					$args['gvid'] = $view_id;
129
+				if ( 1 < $view_collection->count() ) {
130
+					$args[ 'gvid' ] = $view_id;
131 131
 				}
132 132
 			}
133 133
 		}
@@ -156,21 +156,21 @@  discard block
 block discarded – undo
156 156
 			 */
157 157
 			$link_parts = explode( '?', $permalink );
158 158
 
159
-			$query = ! empty( $link_parts[1] ) ? '?' . $link_parts[1] : '';
159
+			$query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : '';
160 160
 
161
-			$permalink = trailingslashit( $link_parts[0] ) . $entry_endpoint_name . '/'. $entry_slug .'/' . $query;
161
+			$permalink = trailingslashit( $link_parts[ 0 ] ) . $entry_endpoint_name . '/' . $entry_slug . '/' . $query;
162 162
 		} else {
163 163
 			$args[ $entry_endpoint_name ] = $entry_slug;
164 164
 		}
165 165
 
166 166
 		if ( $track_directory ) {
167
-			if ( ! empty( $_GET['pagenum'] ) ) {
168
-				$args['pagenum'] = intval( $_GET['pagenum'] );
167
+			if ( ! empty( $_GET[ 'pagenum' ] ) ) {
168
+				$args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] );
169 169
 			}
170 170
 
171 171
 			if ( $sort = Utils::_GET( 'sort' ) ) {
172
-				$args['sort'] = $sort;
173
-				$args['dir'] = Utils::_GET( 'dir' );
172
+				$args[ 'sort' ] = $sort;
173
+				$args[ 'dir' ] = Utils::_GET( 'dir' );
174 174
 			}
175 175
 		}
176 176
 
Please login to merge, or discard this patch.
includes/class-gravityview-entry-link-shortcode.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 
76 76
 		$atts = shortcode_atts( self::$defaults, $atts );
77 77
 
78
-		$atts['action'] = 'edit';
78
+		$atts[ 'action' ] = 'edit';
79 79
 
80 80
 		return $this->shortcode( $atts, $content, $context );
81 81
 	}
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
 		$atts = shortcode_atts( self::$defaults, $atts );
93 93
 
94
-		$atts['action'] = 'delete';
94
+		$atts[ 'action' ] = 'delete';
95 95
 
96 96
 		return $this->shortcode( $atts, $content, $context );
97 97
 	}
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 
132 132
 		$this->settings = shortcode_atts( self::$defaults, $atts, $context );
133 133
 
134
-		$this->view_id = empty( $this->settings['view_id'] ) ? GravityView_View::getInstance()->getViewId() : absint( $this->settings['view_id'] );
134
+		$this->view_id = empty( $this->settings[ 'view_id' ] ) ? GravityView_View::getInstance()->getViewId() : absint( $this->settings[ 'view_id' ] );
135 135
 
136 136
 		if ( empty( $this->view_id ) ) {
137 137
 			gravityview()->log->error( 'A View ID was not defined and we are not inside a View' );
@@ -139,10 +139,10 @@  discard block
 block discarded – undo
139 139
 			return null;
140 140
 		}
141 141
 
142
-		$this->entry = $this->get_entry( $this->settings['entry_id'] );
142
+		$this->entry = $this->get_entry( $this->settings[ 'entry_id' ] );
143 143
 
144 144
 		if ( empty( $this->entry ) ) {
145
-			gravityview()->log->error( 'An Entry ID was not defined or found. Entry ID: {entry_id}', array( 'entry_id' => $this->settings['entry_id'] ) );
145
+			gravityview()->log->error( 'An Entry ID was not defined or found. Entry ID: {entry_id}', array( 'entry_id' => $this->settings[ 'entry_id' ] ) );
146 146
 
147 147
 			return null;
148 148
 		}
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 		gravityview()->log->debug( '{context} atts:', array( 'context' => $context, 'data' => $atts ) );
151 151
 
152 152
 		if ( ! $this->has_cap() ) {
153
-			gravityview()->log->error( 'User does not have the capability to {action} this entry: {entry_id}', array( 'action' => esc_attr( $this->settings['action'] ), 'entry_id' => $this->entry['id'] ) );
153
+			gravityview()->log->error( 'User does not have the capability to {action} this entry: {entry_id}', array( 'action' => esc_attr( $this->settings[ 'action' ] ), 'entry_id' => $this->entry[ 'id' ] ) );
154 154
 
155 155
 			return null;
156 156
 		}
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 		}
165 165
 
166 166
 		// Get just the URL, not the tag
167
-		if ( 'url' === $this->settings['return'] ) {
167
+		if ( 'url' === $this->settings[ 'return' ] ) {
168 168
 			return $url;
169 169
 		}
170 170
 
@@ -185,13 +185,13 @@  discard block
 block discarded – undo
185 185
 	 */
186 186
 	private function get_link_atts() {
187 187
 
188
-		wp_parse_str( $this->settings['link_atts'], $link_atts );
188
+		wp_parse_str( $this->settings[ 'link_atts' ], $link_atts );
189 189
 
190
-		if ( 'delete' === $this->settings['action'] ) {
191
-			$link_atts['onclick'] = isset( $link_atts['onclick'] ) ? $link_atts['onclick'] : GravityView_Delete_Entry::get_confirm_dialog();
190
+		if ( 'delete' === $this->settings[ 'action' ] ) {
191
+			$link_atts[ 'onclick' ] = isset( $link_atts[ 'onclick' ] ) ? $link_atts[ 'onclick' ] : GravityView_Delete_Entry::get_confirm_dialog();
192 192
 		}
193 193
 
194
-		return (array) $link_atts;
194
+		return (array)$link_atts;
195 195
 	}
196 196
 
197 197
 	/**
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 			return do_shortcode( $content );
212 212
 		}
213 213
 
214
-		switch ( $this->settings['action'] ) {
214
+		switch ( $this->settings[ 'action' ] ) {
215 215
 			case 'edit':
216 216
 				$anchor_text = __( 'Edit Entry', 'gravityview' );
217 217
 				break;
@@ -239,9 +239,9 @@  discard block
 block discarded – undo
239 239
 	private function get_url() {
240 240
 
241 241
 		// if post_id is not defined, default to view_id
242
-		$post_id = empty( $this->settings['post_id'] ) ? $this->view_id : $this->settings['post_id'];
242
+		$post_id = empty( $this->settings[ 'post_id' ] ) ? $this->view_id : $this->settings[ 'post_id' ];
243 243
 
244
-		switch ( $this->settings['action'] ) {
244
+		switch ( $this->settings[ 'action' ] ) {
245 245
 			case 'edit':
246 246
 				$url = GravityView_Edit_Entry::get_edit_link( $this->entry, $this->view_id, $post_id );
247 247
 				break;
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 	 */
267 267
 	private function has_cap() {
268 268
 
269
-		switch ( $this->settings['action'] ) {
269
+		switch ( $this->settings[ 'action' ] ) {
270 270
 			case 'edit':
271 271
 				$has_cap = GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry, $this->view_id );
272 272
 				break;
@@ -331,9 +331,9 @@  discard block
 block discarded – undo
331 331
 	 */
332 332
 	private function maybe_add_field_values_query_args( $url ) {
333 333
 
334
-		if ( $url && ! empty( $this->settings['field_values'] ) ) {
334
+		if ( $url && ! empty( $this->settings[ 'field_values' ] ) ) {
335 335
 
336
-			wp_parse_str( $this->settings['field_values'], $field_values );
336
+			wp_parse_str( $this->settings[ 'field_values' ], $field_values );
337 337
 
338 338
 			$url = add_query_arg( $field_values, $url );
339 339
 		}
Please login to merge, or discard this patch.
future/includes/class-gv-shortcode-gravityview.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,8 +79,9 @@
 block discarded – undo
79 79
 		 * Check permissions.
80 80
 		 */
81 81
 		while ( $error = $view->can_render( array( 'shortcode' ), $request ) ) {
82
-			if ( ! is_wp_error( $error ) )
83
-				break;
82
+			if ( ! is_wp_error( $error ) ) {
83
+							break;
84
+			}
84 85
 
85 86
 			switch ( str_replace( 'gravityview/', '', $error->get_error_code() ) ) {
86 87
 				case 'post_password_required':
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 			'detail' => null,
42 42
 		) );
43 43
 		
44
-		if ( ! $view_id = $atts['id'] ? : $atts['view_id'] ) {
45
-			if ( $atts['detail'] && $view = $request->is_view() ) {
44
+		if ( ! $view_id = $atts[ 'id' ] ?: $atts[ 'view_id' ] ) {
45
+			if ( $atts[ 'detail' ] && $view = $request->is_view() ) {
46 46
 				$view_id = $view->ID;
47 47
 			}
48 48
 		}
@@ -110,12 +110,12 @@  discard block
 block discarded – undo
110 110
 			}
111 111
 		}
112 112
 
113
-		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID );
113
+		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID );
114 114
 
115 115
 		/**
116 116
 		 * View details.
117 117
 		 */
118
-		if ( $atts['detail'] ) {
118
+		if ( $atts[ 'detail' ] ) {
119 119
 			$entries = $view->get_entries( $request );
120 120
 			return self::_return( $this->detail( $view, $entries, $atts ) );
121 121
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 				return self::_return( '' );
133 133
 			}
134 134
 
135
-			if ( $entry['status'] != 'active' ) {
135
+			if ( $entry[ 'status' ] != 'active' ) {
136 136
 				gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) );
137 137
 				return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) );
138 138
 			}
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 			}
144 144
 
145 145
 			if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
146
-				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
146
+				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
147 147
 					gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) );
148 148
 					return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) );
149 149
 				}
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 				return self::_return( '' );
164 164
 			}
165 165
 
166
-			if ( $entry['status'] != 'active' ) {
166
+			if ( $entry[ 'status' ] != 'active' ) {
167 167
 				gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) );
168 168
 				return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) );
169 169
 			}
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 			}
175 175
 
176 176
 			if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
177
-				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
177
+				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
178 178
 					gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) );
179 179
 					return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) );
180 180
 				}
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 
183 183
 			$error = \GVCommon::check_entry_display( $entry->as_entry(), $view );
184 184
 
185
-			if( is_wp_error( $error ) ) {
185
+			if ( is_wp_error( $error ) ) {
186 186
 				gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing: {message}', array( 'entry_id' => $entry->ID, 'message' => $error->get_error_message() ) );
187 187
 				return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) );
188 188
 			}
@@ -198,10 +198,10 @@  discard block
 block discarded – undo
198 198
 				
199 199
 				// Mock the request with the actual View, not the global one
200 200
 				$mock_request = new \GV\Mock_Request();
201
-				$mock_request->returns['is_view'] = $view;
202
-				$mock_request->returns['is_entry'] = $request->is_entry();
203
-				$mock_request->returns['is_edit_entry'] = $request->is_edit_entry();
204
-				$mock_request->returns['is_search'] = $request->is_search();
201
+				$mock_request->returns[ 'is_view' ] = $view;
202
+				$mock_request->returns[ 'is_entry' ] = $request->is_entry();
203
+				$mock_request->returns[ 'is_edit_entry' ] = $request->is_edit_entry();
204
+				$mock_request->returns[ 'is_search' ] = $request->is_search();
205 205
 
206 206
 				$request = $mock_request;
207 207
 			}
@@ -237,16 +237,16 @@  discard block
 block discarded – undo
237 237
 		$filtered_atts = shortcode_atts( $supported_atts, $passed_atts, 'gravityview' );
238 238
 
239 239
 		// Only keep the passed attributes after making sure that they're valid pairs
240
-		$filtered_atts = array_intersect_key( (array) $passed_atts, $filtered_atts );
240
+		$filtered_atts = array_intersect_key( (array)$passed_atts, $filtered_atts );
241 241
 
242 242
 		$atts = array();
243 243
 
244
-		foreach( $filtered_atts as $key => $passed_value ) {
244
+		foreach ( $filtered_atts as $key => $passed_value ) {
245 245
 
246 246
 			// Allow using GravityView merge tags in shortcode attributes, like {get} and {created_by}
247 247
 			$passed_value = \GravityView_Merge_Tags::replace_variables( $passed_value );
248 248
 
249
-			switch( $defaults[ $key ]['type'] ) {
249
+			switch ( $defaults[ $key ][ 'type' ] ) {
250 250
 
251 251
 				/**
252 252
 				 * Make sure number fields are numeric.
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 				 * @see http://php.net/manual/en/function.is-numeric.php#107326
255 255
 				 */
256 256
 				case 'number':
257
-					if( is_numeric( $passed_value ) ) {
257
+					if ( is_numeric( $passed_value ) ) {
258 258
 						$atts[ $key ] = ( $passed_value + 0 );
259 259
 					}
260 260
 					break;
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
 				 */
270 270
 				case 'select':
271 271
 				case 'radio':
272
-					$options = isset( $defaults[ $key ]['choices'] ) ? $defaults[ $key ]['choices'] : $defaults[ $key ]['options'];
273
-					if( in_array( $passed_value, array_keys( $options ) ) ) {
272
+					$options = isset( $defaults[ $key ][ 'choices' ] ) ? $defaults[ $key ][ 'choices' ] : $defaults[ $key ][ 'options' ];
273
+					if ( in_array( $passed_value, array_keys( $options ) ) ) {
274 274
 						$atts[ $key ] = $passed_value;
275 275
 					}
276 276
 					break;
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 			}
283 283
 		}
284 284
 
285
-		$atts['detail'] = \GV\Utils::get( $passed_atts, 'detail', null );
285
+		$atts[ 'detail' ] = \GV\Utils::get( $passed_atts, 'detail', null );
286 286
 
287 287
 		return $atts;
288 288
 	}
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	private function detail( $view, $entries, $atts ) {
300 300
 		$output = '';
301 301
 
302
-		switch ( $key = $atts['detail'] ):
302
+		switch ( $key = $atts[ 'detail' ] ):
303 303
 			case 'total_entries':
304 304
 				$output = number_format_i18n( $entries->total() );
305 305
 				break;
Please login to merge, or discard this patch.
includes/class-api.php 2 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -526,7 +526,7 @@
 block discarded – undo
526 526
 					$column = 'lead_id';
527 527
 				}
528 528
 
529
-				$results = $wpdb->get_results( $wpdb->prepare( "SELECT $column, meta_value FROM $table WHERE form_id = (SELECT form_id FROM $table WHERE $column = %d LIMIT 1) AND meta_key = 'gravityview_unique_id'", $id_or_string ) );
529
+				$results = $wpdb->get_results( $wpdb->prepare( "select $column, meta_value FROM $table WHERE form_id = (SELECT form_id FROM $table WHERE $column = %d LIMIT 1) AND meta_key = 'gravityview_unique_id'", $id_or_string ) );
530 530
 
531 531
 				if ( $results ) {
532 532
 					$cache = array_replace( $cache, array_combine( wp_list_pluck( $results, $column ), wp_list_pluck( $results, 'meta_value' ) ) );
Please login to merge, or discard this patch.
Spacing   +100 added lines, -100 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
 		$form = $gravityview_view->getForm();
33 33
 
34
-		if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && ! empty( $GLOBALS['GravityView_API_field_label_override'] ) ) {
34
+		if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && ! empty( $GLOBALS[ 'GravityView_API_field_label_override' ] ) ) {
35 35
 			/** Allow to fall through for back compatibility testing purposes. */
36 36
 		} else {
37 37
 			return \GV\Mocks\GravityView_API_field_label( $form, $field, $entry, $force_show_label );
@@ -39,29 +39,29 @@  discard block
 block discarded – undo
39 39
 
40 40
 		$label = '';
41 41
 
42
-		if( !empty( $field['show_label'] ) || $force_show_label ) {
42
+		if ( ! empty( $field[ 'show_label' ] ) || $force_show_label ) {
43 43
 
44
-			$label = $field['label'];
44
+			$label = $field[ 'label' ];
45 45
 
46 46
 			// Support Gravity Forms 1.9+
47
-			if( class_exists( 'GF_Field' ) ) {
47
+			if ( class_exists( 'GF_Field' ) ) {
48 48
 
49
-				$field_object = RGFormsModel::get_field( $form, $field['id'] );
49
+				$field_object = RGFormsModel::get_field( $form, $field[ 'id' ] );
50 50
 
51
-				if( $field_object ) {
51
+				if ( $field_object ) {
52 52
 
53
-					$input = GFFormsModel::get_input( $field_object, $field['id'] );
53
+					$input = GFFormsModel::get_input( $field_object, $field[ 'id' ] );
54 54
 
55 55
 					// This is a complex field, with labels on a per-input basis
56
-					if( $input ) {
56
+					if ( $input ) {
57 57
 
58 58
 						// Does the input have a custom label on a per-input basis? Otherwise, default label.
59
-						$label = ! empty( $input['customLabel'] ) ? $input['customLabel'] : $input['label'];
59
+						$label = ! empty( $input[ 'customLabel' ] ) ? $input[ 'customLabel' ] : $input[ 'label' ];
60 60
 
61 61
 					} else {
62 62
 
63 63
 						// This is a field with one label
64
-						$label = $field_object->get_field_label( true, $field['label'] );
64
+						$label = $field_object->get_field_label( true, $field[ 'label' ] );
65 65
 
66 66
 					}
67 67
 
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
 			}
71 71
 
72 72
 			// Use Gravity Forms label by default, but if a custom label is defined in GV, use it.
73
-			if ( !empty( $field['custom_label'] ) ) {
73
+			if ( ! empty( $field[ 'custom_label' ] ) ) {
74 74
 
75
-				$label = self::replace_variables( $field['custom_label'], $form, $entry );
75
+				$label = self::replace_variables( $field[ 'custom_label' ], $form, $entry );
76 76
 
77 77
 			}
78 78
 
@@ -134,11 +134,11 @@  discard block
 block discarded – undo
134 134
 
135 135
 		$width = NULL;
136 136
 
137
-		if( !empty( $field['width'] ) ) {
138
-			$width = absint( $field['width'] );
137
+		if ( ! empty( $field[ 'width' ] ) ) {
138
+			$width = absint( $field[ 'width' ] );
139 139
 
140 140
 			// If using percentages, limit to 100%
141
-			if( '%d%%' === $format && $width > 100 ) {
141
+			if ( '%d%%' === $format && $width > 100 ) {
142 142
 				$width = 100;
143 143
 			}
144 144
 
@@ -159,42 +159,42 @@  discard block
 block discarded – undo
159 159
 	public static function field_class( $field, $form = NULL, $entry = NULL ) {
160 160
 		$classes = array();
161 161
 
162
-		if( !empty( $field['custom_class'] ) ) {
162
+		if ( ! empty( $field[ 'custom_class' ] ) ) {
163 163
 
164
-            $custom_class = $field['custom_class'];
164
+            $custom_class = $field[ 'custom_class' ];
165 165
 
166
-            if( !empty( $entry ) ) {
166
+            if ( ! empty( $entry ) ) {
167 167
 
168 168
                 // We want the merge tag to be formatted as a class. The merge tag may be
169 169
                 // replaced by a multiple-word value that should be output as a single class.
170 170
                 // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager`
171
-                add_filter('gform_merge_tag_filter', 'sanitize_html_class');
171
+                add_filter( 'gform_merge_tag_filter', 'sanitize_html_class' );
172 172
 
173
-                $custom_class = self::replace_variables( $custom_class, $form, $entry);
173
+                $custom_class = self::replace_variables( $custom_class, $form, $entry );
174 174
 
175 175
                 // And then we want life to return to normal
176
-                remove_filter('gform_merge_tag_filter', 'sanitize_html_class');
176
+                remove_filter( 'gform_merge_tag_filter', 'sanitize_html_class' );
177 177
             }
178 178
 
179 179
 			// And now we want the spaces to be handled nicely.
180
-			$classes[] = gravityview_sanitize_html_class( $custom_class );
180
+			$classes[ ] = gravityview_sanitize_html_class( $custom_class );
181 181
 
182 182
 		}
183 183
 
184
-		if(!empty($field['id'])) {
185
-			if( !empty( $form ) && !empty( $form['id'] ) ) {
186
-				$form_id = '-'.$form['id'];
184
+		if ( ! empty( $field[ 'id' ] ) ) {
185
+			if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) {
186
+				$form_id = '-' . $form[ 'id' ];
187 187
 			} else {
188 188
 				// @deprecated path. Form should always be given.
189 189
 				gravityview()->log->warning( 'GravityView_View::getInstance() legacy API called' );
190 190
 				$gravityview_view = GravityView_View::getInstance();
191
-				$form_id = $gravityview_view->getFormId() ? '-'. $gravityview_view->getFormId() : '';
191
+				$form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : '';
192 192
 			}
193 193
 
194
-			$classes[] = 'gv-field'.$form_id.'-'.$field['id'];
194
+			$classes[ ] = 'gv-field' . $form_id . '-' . $field[ 'id' ];
195 195
 		}
196 196
 
197
-		return esc_attr(implode(' ', $classes));
197
+		return esc_attr( implode( ' ', $classes ) );
198 198
 	}
199 199
 
200 200
 	/**
@@ -210,11 +210,11 @@  discard block
 block discarded – undo
210 210
 	 * @return string Sanitized unique HTML `id` attribute for the field
211 211
 	 */
212 212
 	public static function field_html_attr_id( $field, $form = array(), $entry = array() ) {
213
-		$id = $field['id'];
213
+		$id = $field[ 'id' ];
214 214
 
215 215
 		if ( ! empty( $id ) ) {
216
-			if ( ! empty( $form ) && ! empty( $form['id'] ) ) {
217
-				$form_id = '-' . $form['id'];
216
+			if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) {
217
+				$form_id = '-' . $form[ 'id' ];
218 218
 			} else {
219 219
 				// @deprecated path. Form should always be given.
220 220
 				gravityview()->log->warning( 'GravityView_View::getInstance() legacy API called' );
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 				$form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : '';
223 223
 			}
224 224
 
225
-			$id = 'gv-field' . $form_id . '-' . $field['id'];
225
+			$id = 'gv-field' . $form_id . '-' . $field[ 'id' ];
226 226
 		}
227 227
 
228 228
 		return esc_attr( $id );
@@ -262,14 +262,14 @@  discard block
 block discarded – undo
262 262
 	 */
263 263
 	public static function entry_link_html( $entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array(), $base_id = null ) {
264 264
 
265
-		if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry['id'] ) ) {
265
+		if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry[ 'id' ] ) ) {
266 266
 			gravityview()->log->debug( 'Entry not defined; returning null', array( 'data' => $entry ) );
267 267
 			return NULL;
268 268
 		}
269 269
 
270 270
 		$href = self::entry_link( $entry, $base_id );
271 271
 
272
-		if( '' === $href ) {
272
+		if ( '' === $href ) {
273 273
 			return NULL;
274 274
 		}
275 275
 
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 		} else {
307 307
 			$gravityview_view = GravityView_View::getInstance();
308 308
 
309
-			if( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) {
309
+			if ( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) {
310 310
 				$is_search = true;
311 311
 			}
312 312
 		}
@@ -402,9 +402,9 @@  discard block
 block discarded – undo
402 402
 
403 403
 		// If we've saved the permalink in memory, use it
404 404
 		// @since 1.3
405
-		$link = wp_cache_get( 'gv_directory_link_'.$post_id );
405
+		$link = wp_cache_get( 'gv_directory_link_' . $post_id );
406 406
 
407
-		if ( (int) $post_id === (int) get_option( 'page_on_front' ) ) {
407
+		if ( (int)$post_id === (int)get_option( 'page_on_front' ) ) {
408 408
 			$link = home_url();
409 409
 		}
410 410
 
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 
414 414
 			// If not yet saved, cache the permalink.
415 415
 			// @since 1.3
416
-			wp_cache_set( 'gv_directory_link_'.$post_id, $link );
416
+			wp_cache_set( 'gv_directory_link_' . $post_id, $link );
417 417
 		}
418 418
 
419 419
 		// Deal with returning to proper pagination for embedded views
@@ -421,13 +421,13 @@  discard block
 block discarded – undo
421 421
 
422 422
 			$args = array();
423 423
 
424
-			if( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) {
425
-				$args['pagenum'] = intval( $pagenum );
424
+			if ( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) {
425
+				$args[ 'pagenum' ] = intval( $pagenum );
426 426
 			}
427 427
 
428
-			if( $sort = \GV\Utils::_GET( 'sort' ) ) {
429
-				$args['sort'] = $sort;
430
-				$args['dir'] = \GV\Utils::_GET( 'dir' );
428
+			if ( $sort = \GV\Utils::_GET( 'sort' ) ) {
429
+				$args[ 'sort' ] = $sort;
430
+				$args[ 'dir' ] = \GV\Utils::_GET( 'dir' );
431 431
 			}
432 432
 
433 433
 			$link = add_query_arg( $args, $link );
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 	private static function get_custom_entry_slug( $id, $entry = array() ) {
465 465
 
466 466
 		// Generate an unique hash to use as the default value
467
-		$slug = substr( wp_hash( $id, 'gravityview'.$id ), 0, 8 );
467
+		$slug = substr( wp_hash( $id, 'gravityview' . $id ), 0, 8 );
468 468
 
469 469
 		/**
470 470
 		 * @filter `gravityview_entry_slug` Modify the unique hash ID generated, if you want to improve usability or change the format. This will allow for custom URLs, such as `{entryid}-{first-name}` or even, if unique, `{first-name}-{last-name}`
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 		$slug = apply_filters( 'gravityview_entry_slug', $slug, $id, $entry );
476 476
 
477 477
 		// Make sure we have something - use the original ID as backup.
478
-		if( empty( $slug ) ) {
478
+		if ( empty( $slug ) ) {
479 479
 			$slug = $id;
480 480
 		}
481 481
 
@@ -569,15 +569,15 @@  discard block
 block discarded – undo
569 569
          * @param boolean $custom Should we process the custom entry slug?
570 570
          */
571 571
         $custom = apply_filters( 'gravityview_custom_entry_slug', false );
572
-        if( $custom ) {
572
+        if ( $custom ) {
573 573
             // create the gravityview_unique_id and save it
574 574
 
575 575
             // Get the entry hash
576
-            $hash = self::get_custom_entry_slug( $entry['id'], $entry );
576
+            $hash = self::get_custom_entry_slug( $entry[ 'id' ], $entry );
577 577
 
578
-	        gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry['id'], 'hash' => $hash ) );
578
+	        gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry[ 'id' ], 'hash' => $hash ) );
579 579
 
580
-            gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) );
580
+            gform_update_meta( $entry[ 'id' ], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) );
581 581
 
582 582
         }
583 583
     }
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
 
597 597
 		if ( ! empty( $entry ) && ! is_array( $entry ) ) {
598 598
 			$entry = GVCommon::get_entry( $entry );
599
-		} else if( empty( $entry ) ) {
599
+		} else if ( empty( $entry ) ) {
600 600
 			// @deprecated path
601 601
 			$entry = GravityView_frontend::getInstance()->getEntry();
602 602
 		}
@@ -616,9 +616,9 @@  discard block
 block discarded – undo
616 616
 
617 617
 		$query_arg_name = \GV\Entry::get_endpoint_name();
618 618
 
619
-		$entry_slug = self::get_entry_slug( $entry['id'], $entry );
619
+		$entry_slug = self::get_entry_slug( $entry[ 'id' ], $entry );
620 620
 
621
-		if ( get_option('permalink_structure') && !is_preview() ) {
621
+		if ( get_option( 'permalink_structure' ) && ! is_preview() ) {
622 622
 
623 623
 			$args = array();
624 624
 
@@ -628,9 +628,9 @@  discard block
 block discarded – undo
628 628
 			 */
629 629
 			$link_parts = explode( '?', $directory_link );
630 630
 
631
-			$query = !empty( $link_parts[1] ) ? '?'.$link_parts[1] : '';
631
+			$query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : '';
632 632
 
633
-			$directory_link = trailingslashit( $link_parts[0] ) . $query_arg_name . '/'. $entry_slug .'/' . $query;
633
+			$directory_link = trailingslashit( $link_parts[ 0 ] ) . $query_arg_name . '/' . $entry_slug . '/' . $query;
634 634
 
635 635
 		} else {
636 636
 
@@ -642,22 +642,22 @@  discard block
 block discarded – undo
642 642
 		 */
643 643
 		if ( $add_directory_args ) {
644 644
 
645
-			if ( ! empty( $_GET['pagenum'] ) ) {
646
-				$args['pagenum'] = intval( $_GET['pagenum'] );
645
+			if ( ! empty( $_GET[ 'pagenum' ] ) ) {
646
+				$args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] );
647 647
 			}
648 648
 
649 649
 			/**
650 650
 			 * @since 1.7
651 651
 			 */
652 652
 			if ( $sort = \GV\Utils::_GET( 'sort' ) ) {
653
-				$args['sort'] = $sort;
654
-				$args['dir'] = \GV\Utils::_GET( 'dir' );
653
+				$args[ 'sort' ] = $sort;
654
+				$args[ 'dir' ] = \GV\Utils::_GET( 'dir' );
655 655
 			}
656 656
 
657 657
 		}
658 658
 
659 659
 		if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) {
660
-			$args['gvid'] = gravityview_get_view_id();
660
+			$args[ 'gvid' ] = gravityview_get_view_id();
661 661
 		}
662 662
 
663 663
 		return add_query_arg( $args, $directory_link );
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
 }
679 679
 
680 680
 function gv_class( $field, $form = NULL, $entry = array() ) {
681
-	return GravityView_API::field_class( $field, $form, $entry  );
681
+	return GravityView_API::field_class( $field, $form, $entry );
682 682
 }
683 683
 
684 684
 /**
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
 		$view_id = 0;
702 702
 		if ( $context->view ) {
703 703
 			$view_id = $context->view->ID;
704
-			if( $context->view->settings->get( 'hide_until_searched' ) ) {
704
+			if ( $context->view->settings->get( 'hide_until_searched' ) ) {
705 705
 				$hide_until_searched = ( empty( $context->entry ) && ! $context->request->is_search() );
706 706
 			}
707 707
 		}
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
 		$default_css_class .= ' gv-container-no-results';
730 730
 	}
731 731
 
732
-	$css_class = trim( $passed_css_class . ' '. $default_css_class );
732
+	$css_class = trim( $passed_css_class . ' ' . $default_css_class );
733 733
 
734 734
 	/**
735 735
 	 * @filter `gravityview/render/container/class` Modify the CSS class to be added to the wrapper <div> of a View
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
 
757 757
 	$value = GravityView_API::field_value( $entry, $field );
758 758
 
759
-	if( $value === '' ) {
759
+	if ( $value === '' ) {
760 760
 		/**
761 761
 		 * @filter `gravityview_empty_value` What to display when a field is empty
762 762
 		 * @param string $value (empty string)
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
  */
870 870
 function gravityview_get_field_value( $entry, $field_id, $display_value ) {
871 871
 
872
-	if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) {
872
+	if ( floatval( $field_id ) === floor( floatval( $field_id ) ) ) {
873 873
 
874 874
 		// For the complete field value as generated by Gravity Forms
875 875
 		return $display_value;
@@ -903,16 +903,16 @@  discard block
 block discarded – undo
903 903
 		$terms = explode( ', ', $value );
904 904
 	}
905 905
 
906
-	foreach ($terms as $term_name ) {
906
+	foreach ( $terms as $term_name ) {
907 907
 
908 908
 		// If we're processing a category,
909
-		if( $taxonomy === 'category' ) {
909
+		if ( $taxonomy === 'category' ) {
910 910
 
911 911
 			// Use rgexplode to prevent errors if : doesn't exist
912 912
 			list( $term_name, $term_id ) = rgexplode( ':', $term_name, 2 );
913 913
 
914 914
 			// The explode was succesful; we have the category ID
915
-			if( !empty( $term_id )) {
915
+			if ( ! empty( $term_id ) ) {
916 916
 				$term = get_term_by( 'id', $term_id, $taxonomy );
917 917
 			} else {
918 918
 			// We have to fall back to the name
@@ -925,7 +925,7 @@  discard block
 block discarded – undo
925 925
 		}
926 926
 
927 927
 		// There's still a tag/category here.
928
-		if( $term ) {
928
+		if ( $term ) {
929 929
 
930 930
 			$term_link = get_term_link( $term, $taxonomy );
931 931
 
@@ -934,11 +934,11 @@  discard block
 block discarded – undo
934 934
 			    continue;
935 935
 			}
936 936
 
937
-			$output[] = gravityview_get_link( $term_link, esc_html( $term->name ) );
937
+			$output[ ] = gravityview_get_link( $term_link, esc_html( $term->name ) );
938 938
 		}
939 939
 	}
940 940
 
941
-	return implode(', ', $output );
941
+	return implode( ', ', $output );
942 942
 }
943 943
 
944 944
 /**
@@ -952,8 +952,8 @@  discard block
 block discarded – undo
952 952
 
953 953
 	$output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' );
954 954
 
955
-	if( empty( $link ) ) {
956
-		return strip_tags( $output);
955
+	if ( empty( $link ) ) {
956
+		return strip_tags( $output );
957 957
 	}
958 958
 
959 959
 	return $output;
@@ -972,7 +972,7 @@  discard block
 block discarded – undo
972 972
 	$fe = GravityView_frontend::getInstance();
973 973
 
974 974
 	// Solve problem when loading content via admin-ajax.php
975
-	if( ! $fe->getGvOutputData() ) {
975
+	if ( ! $fe->getGvOutputData() ) {
976 976
 
977 977
 		gravityview()->log->debug( 'gv_output_data not defined; parsing content.' );
978 978
 
@@ -980,7 +980,7 @@  discard block
 block discarded – undo
980 980
 	}
981 981
 
982 982
 	// Make 100% sure that we're dealing with a properly called situation
983
-	if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) {
983
+	if ( ! is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) {
984 984
 
985 985
 		gravityview()->log->debug( 'gv_output_data not an object or get_view not callable.', array( 'data' => $fe->getGvOutputData() ) );
986 986
 
@@ -1202,12 +1202,12 @@  discard block
 block discarded – undo
1202 1202
 function gravityview_get_files_array( $value, $gv_class = '', $context = null ) {
1203 1203
 	/** @define "GRAVITYVIEW_DIR" "../" */
1204 1204
 
1205
-	if( !class_exists( 'GravityView_Field' ) ) {
1206
-		include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' );
1205
+	if ( ! class_exists( 'GravityView_Field' ) ) {
1206
+		include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' );
1207 1207
 	}
1208 1208
 
1209
-	if( !class_exists( 'GravityView_Field_FileUpload' ) ) {
1210
-		include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field-fileupload.php' );
1209
+	if ( ! class_exists( 'GravityView_Field_FileUpload' ) ) {
1210
+		include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field-fileupload.php' );
1211 1211
 	}
1212 1212
 
1213 1213
 	if ( is_null( $context ) ) {
@@ -1310,21 +1310,21 @@  discard block
 block discarded – undo
1310 1310
 	} else {
1311 1311
 		// @deprecated path
1312 1312
 		// Required fields.
1313
-		if ( empty( $args['field'] ) || empty( $args['form'] ) ) {
1313
+		if ( empty( $args[ 'field' ] ) || empty( $args[ 'form' ] ) ) {
1314 1314
 			gravityview()->log->error( 'Field or form are empty.', array( 'data' => $args ) );
1315 1315
 			return '';
1316 1316
 		}
1317 1317
 	}
1318 1318
 
1319 1319
 	if ( $context instanceof \GV\Template_Context ) {
1320
-		$entry = $args['entry'] ? : ( $context->entry ? $context->entry->as_entry() : array() );
1321
-		$field = $args['field'] ? : ( $context->field ? $context->field->as_configuration() : array() );
1322
-		$form = $args['form'] ? : ( $context->view->form ? $context->view->form->form : array() );
1320
+		$entry = $args[ 'entry' ] ?: ( $context->entry ? $context->entry->as_entry() : array() );
1321
+		$field = $args[ 'field' ] ?: ( $context->field ? $context->field->as_configuration() : array() );
1322
+		$form = $args[ 'form' ] ?: ( $context->view->form ? $context->view->form->form : array() );
1323 1323
 	} else {
1324 1324
 		// @deprecated path
1325
-		$entry = empty( $args['entry'] ) ? array() : $args['entry'];
1326
-		$field = $args['field'];
1327
-		$form = $args['form'];
1325
+		$entry = empty( $args[ 'entry' ] ) ? array() : $args[ 'entry' ];
1326
+		$field = $args[ 'field' ];
1327
+		$form = $args[ 'form' ];
1328 1328
 	}
1329 1329
 
1330 1330
 	/**
@@ -1342,40 +1342,40 @@  discard block
 block discarded – undo
1342 1342
 	);
1343 1343
 
1344 1344
 	if ( $context instanceof \GV\Template_Context ) {
1345
-		$placeholders['value'] = \GV\Utils::get( $args, 'value', '' );
1345
+		$placeholders[ 'value' ] = \GV\Utils::get( $args, 'value', '' );
1346 1346
 	} else {
1347 1347
 		// @deprecated path
1348
-		$placeholders['value'] = gv_value( $entry, $field );
1348
+		$placeholders[ 'value' ] = gv_value( $entry, $field );
1349 1349
 	}
1350 1350
 
1351 1351
 	// If the value is empty and we're hiding empty, return empty.
1352
-	if ( $placeholders['value'] === '' && ! empty( $args['hide_empty'] ) ) {
1352
+	if ( $placeholders[ 'value' ] === '' && ! empty( $args[ 'hide_empty' ] ) ) {
1353 1353
 		return '';
1354 1354
 	}
1355 1355
 
1356
-	if ( $placeholders['value'] !== '' && ! empty( $args['wpautop'] ) ) {
1357
-		$placeholders['value'] = wpautop( $placeholders['value'] );
1356
+	if ( $placeholders[ 'value' ] !== '' && ! empty( $args[ 'wpautop' ] ) ) {
1357
+		$placeholders[ 'value' ] = wpautop( $placeholders[ 'value' ] );
1358 1358
 	}
1359 1359
 
1360 1360
 	// Get width setting, if exists
1361
-	$placeholders['width'] = GravityView_API::field_width( $field );
1361
+	$placeholders[ 'width' ] = GravityView_API::field_width( $field );
1362 1362
 
1363 1363
 	// If replacing with CSS inline formatting, let's do it.
1364
-	$placeholders['width:style'] = GravityView_API::field_width( $field, 'width:' . $placeholders['width'] . '%;' );
1364
+	$placeholders[ 'width:style' ] = GravityView_API::field_width( $field, 'width:' . $placeholders[ 'width' ] . '%;' );
1365 1365
 
1366 1366
 	// Grab the Class using `gv_class`
1367
-	$placeholders['class'] = gv_class( $field, $form, $entry );
1368
-	$placeholders['field_id'] = GravityView_API::field_html_attr_id( $field, $form, $entry );
1367
+	$placeholders[ 'class' ] = gv_class( $field, $form, $entry );
1368
+	$placeholders[ 'field_id' ] = GravityView_API::field_html_attr_id( $field, $form, $entry );
1369 1369
 
1370 1370
 	if ( $context instanceof \GV\Template_Context ) {
1371
-		$placeholders['label_value'] = \GV\Utils::get( $args, 'label' );
1371
+		$placeholders[ 'label_value' ] = \GV\Utils::get( $args, 'label' );
1372 1372
 	} else {
1373 1373
 		// Default Label value
1374
-		$placeholders['label_value'] = gv_label( $field, $entry );
1374
+		$placeholders[ 'label_value' ] = gv_label( $field, $entry );
1375 1375
 	}
1376 1376
 
1377
-	if ( empty( $placeholders['label'] ) && ! empty( $placeholders['label_value'] ) ){
1378
-		$placeholders['label'] = '<span class="gv-field-label">{{ label_value }}</span>';
1377
+	if ( empty( $placeholders[ 'label' ] ) && ! empty( $placeholders[ 'label_value' ] ) ) {
1378
+		$placeholders[ 'label' ] = '<span class="gv-field-label">{{ label_value }}</span>';
1379 1379
 	}
1380 1380
 
1381 1381
 	/**
@@ -1386,7 +1386,7 @@  discard block
 block discarded – undo
1386 1386
 	 * @since 2.0
1387 1387
 	 * @param \GV\Template_Context $context The context.
1388 1388
 	 */
1389
-	$html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args, $context );
1389
+	$html = apply_filters( 'gravityview/field_output/pre_html', $args[ 'markup' ], $args, $context );
1390 1390
 
1391 1391
 	/**
1392 1392
 	 * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders
@@ -1413,7 +1413,7 @@  discard block
 block discarded – undo
1413 1413
 	foreach ( $placeholders as $tag => $value ) {
1414 1414
 
1415 1415
 		// If the tag doesn't exist just skip it
1416
-		if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){
1416
+		if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ) {
1417 1417
 			continue;
1418 1418
 		}
1419 1419
 
Please login to merge, or discard this patch.
includes/class-admin-views.php 1 patch
Spacing   +179 added lines, -179 removed lines patch added patch discarded remove patch
@@ -28,31 +28,31 @@  discard block
 block discarded – undo
28 28
 		add_filter( 'gravityview_blacklist_field_types', array( $this, 'default_field_blacklist' ), 10, 2 );
29 29
 
30 30
 		// Tooltips
31
-		add_filter( 'gform_tooltips', array( $this, 'tooltips') );
31
+		add_filter( 'gform_tooltips', array( $this, 'tooltips' ) );
32 32
 
33 33
 		// adding styles and scripts
34
-		add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles'), 999 );
35
-		add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict') );
36
-		add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict') );
37
-		add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict') );
38
-		add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict') );
39
-
40
-		add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas'), 10, 4 );
41
-		add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas'), 10, 3 );
42
-		add_action( 'gravityview_render_field_pickers', array( $this, 'render_field_pickers') );
43
-		add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields'), 10, 2 );
44
-		add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets') );
45
-		add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas'), 10, 5 );
34
+		add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles' ), 999 );
35
+		add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict' ) );
36
+		add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict' ) );
37
+		add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict' ) );
38
+		add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) );
39
+
40
+		add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas' ), 10, 4 );
41
+		add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas' ), 10, 3 );
42
+		add_action( 'gravityview_render_field_pickers', array( $this, 'render_field_pickers' ) );
43
+		add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields' ), 10, 2 );
44
+		add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets' ) );
45
+		add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas' ), 10, 5 );
46 46
 
47 47
 		// @todo check if this hook is needed..
48 48
 		//add_action( 'gravityview_render_field_options', array( $this, 'render_field_options'), 10, 9 );
49 49
 
50 50
 		// Add Connected Form column
51
-		add_filter('manage_gravityview_posts_columns' , array( $this, 'add_post_type_columns' ) );
51
+		add_filter( 'manage_gravityview_posts_columns', array( $this, 'add_post_type_columns' ) );
52 52
 
53 53
 		add_filter( 'gform_toolbar_menu', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 );
54 54
 
55
-		add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content'), 10, 2 );
55
+		add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content' ), 10, 2 );
56 56
 
57 57
 		add_action( 'restrict_manage_posts', array( $this, 'add_view_dropdown' ) );
58 58
 
@@ -71,11 +71,11 @@  discard block
 block discarded – undo
71 71
 	 */
72 72
 	function suggest_support_articles( $localization_data = array() ) {
73 73
 
74
-	    if( ! gravityview()->request->is_view() ) {
74
+	    if ( ! gravityview()->request->is_view() ) {
75 75
 	        return $localization_data;
76 76
         }
77 77
 
78
-		$localization_data['suggest'] = array(
78
+		$localization_data[ 'suggest' ] = array(
79 79
             '57ef23539033602e61d4a560',
80 80
             '54c67bb9e4b0512429885513',
81 81
             '54c67bb9e4b0512429885512',
@@ -96,13 +96,13 @@  discard block
 block discarded – undo
96 96
 	public function filter_pre_get_posts_by_gravityview_form_id( &$query ) {
97 97
 		global $pagenow;
98 98
 
99
-		if ( !is_admin() ) {
99
+		if ( ! is_admin() ) {
100 100
 			return;
101 101
 		}
102 102
 
103
-		$form_id = isset( $_GET['gravityview_form_id'] ) ? (int) $_GET['gravityview_form_id'] : false;
103
+		$form_id = isset( $_GET[ 'gravityview_form_id' ] ) ? (int)$_GET[ 'gravityview_form_id' ] : false;
104 104
 
105
-		if( 'edit.php' !== $pagenow || ! $form_id || ! isset( $query->query_vars[ 'post_type' ] ) ) {
105
+		if ( 'edit.php' !== $pagenow || ! $form_id || ! isset( $query->query_vars[ 'post_type' ] ) ) {
106 106
 			return;
107 107
 		}
108 108
 
@@ -119,18 +119,18 @@  discard block
 block discarded – undo
119 119
 	function add_view_dropdown() {
120 120
 		$current_screen = get_current_screen();
121 121
 
122
-		if( 'gravityview' !== $current_screen->post_type ) {
122
+		if ( 'gravityview' !== $current_screen->post_type ) {
123 123
 			return;
124 124
 		}
125 125
 
126 126
 		$forms = gravityview_get_forms();
127 127
 		$current_form = \GV\Utils::_GET( 'gravityview_form_id' );
128 128
 		// If there are no forms to select, show no forms.
129
-		if( !empty( $forms ) ) { ?>
129
+		if ( ! empty( $forms ) ) { ?>
130 130
 			<select name="gravityview_form_id" id="gravityview_form_id">
131 131
 				<option value="" <?php selected( '', $current_form, true ); ?>><?php esc_html_e( 'All forms', 'gravityview' ); ?></option>
132
-				<?php foreach( $forms as $form ) { ?>
133
-					<option value="<?php echo $form['id']; ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option>
132
+				<?php foreach ( $forms as $form ) { ?>
133
+					<option value="<?php echo $form[ 'id' ]; ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option>
134 134
 				<?php } ?>
135 135
 			</select>
136 136
 		<?php }
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 */
144 144
 	public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) {
145 145
 		_deprecated_function( 'GravityView_Admin_Views::render_setting_row', '1.1.7', 'GravityView_Render_Settings::render_setting_row' );
146
-		GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name , $id );
146
+		GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name, $id );
147 147
 	}
148 148
 
149 149
 	/**
@@ -166,9 +166,9 @@  discard block
 block discarded – undo
166 166
 
167 167
 		$connected_views = gravityview_get_connected_views( $id, array( 'post_status' => 'any' ) );
168 168
 
169
-		if( empty( $connected_views ) ) {
169
+		if ( empty( $connected_views ) ) {
170 170
 
171
-		    $menu_items['gravityview'] = array(
171
+		    $menu_items[ 'gravityview' ] = array(
172 172
 				'label'          => esc_attr__( 'Create a View', 'gravityview' ),
173 173
 				'icon'           => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>',
174 174
 				'title'          => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ),
@@ -184,22 +184,22 @@  discard block
 block discarded – undo
184 184
 		$sub_menu_items = array();
185 185
 		foreach ( (array)$connected_views as $view ) {
186 186
 
187
-			if( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) {
187
+			if ( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) {
188 188
 				continue;
189 189
 			}
190 190
 
191
-			$label = empty( $view->post_title ) ? sprintf( __('No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title;
191
+			$label = empty( $view->post_title ) ? sprintf( __( 'No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title;
192 192
 
193
-			$sub_menu_items[] = array(
193
+			$sub_menu_items[ ] = array(
194 194
 				'label' => esc_attr( $label ),
195
-				'url' => admin_url( 'post.php?action=edit&post='.$view->ID ),
195
+				'url' => admin_url( 'post.php?action=edit&post=' . $view->ID ),
196 196
 			);
197 197
 		}
198 198
 
199 199
 		// If there were no items added, then let's create the parent menu
200
-		if( $sub_menu_items ) {
200
+		if ( $sub_menu_items ) {
201 201
 
202
-		    $sub_menu_items[] = array(
202
+		    $sub_menu_items[ ] = array(
203 203
 			    'label' => esc_attr__( 'Create a View', 'gravityview' ),
204 204
                 'link_class' => 'gv-create-view',
205 205
 			    'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ),
@@ -208,14 +208,14 @@  discard block
 block discarded – undo
208 208
             );
209 209
 
210 210
 			// Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown
211
-			$sub_menu_items[] = array(
211
+			$sub_menu_items[ ] = array(
212 212
 				'url' => '#',
213 213
 				'label' => '',
214 214
 				'menu_class' => 'hidden',
215 215
 				'capabilities' => '',
216 216
 			);
217 217
 
218
-			$menu_items['gravityview'] = array(
218
+			$menu_items[ 'gravityview' ] = array(
219 219
 				'label'          => __( 'Connected Views', 'gravityview' ),
220 220
 				'icon'           => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>',
221 221
 				'title'          => __( 'GravityView Views using this form as a data source', 'gravityview' ),
@@ -244,8 +244,8 @@  discard block
 block discarded – undo
244 244
 		$add = array( 'captcha', 'page' );
245 245
 
246 246
 		// Don't allowing editing the following values:
247
-		if( $context === 'edit' ) {
248
-			$add[] = 'post_id';
247
+		if ( $context === 'edit' ) {
248
+			$add[ ] = 'post_id';
249 249
 		}
250 250
 
251 251
 		$return = array_merge( $array, $add );
@@ -268,32 +268,32 @@  discard block
 block discarded – undo
268 268
 		foreach ( $default_args as $key => $arg ) {
269 269
 
270 270
 			// If an arg has `tooltip` defined, but it's false, don't display a tooltip
271
-			if( isset( $arg['tooltip'] ) && empty( $arg['tooltip'] ) ) { continue; }
271
+			if ( isset( $arg[ 'tooltip' ] ) && empty( $arg[ 'tooltip' ] ) ) { continue; }
272 272
 
273 273
 			// By default, use `tooltip` if defined.
274
-			$tooltip = empty( $arg['tooltip'] ) ? NULL : $arg['tooltip'];
274
+			$tooltip = empty( $arg[ 'tooltip' ] ) ? NULL : $arg[ 'tooltip' ];
275 275
 
276 276
 			// Otherwise, use the description as a tooltip.
277
-			if( empty( $tooltip ) && !empty( $arg['desc'] ) ) {
278
-				$tooltip = $arg['desc'];
277
+			if ( empty( $tooltip ) && ! empty( $arg[ 'desc' ] ) ) {
278
+				$tooltip = $arg[ 'desc' ];
279 279
 			}
280 280
 
281 281
 			// If there's no tooltip set, continue
282
-			if( empty( $tooltip ) ) {
282
+			if ( empty( $tooltip ) ) {
283 283
 				continue;
284 284
 			}
285 285
 
286 286
 			// Add the tooltip
287
-			$gv_tooltips[ 'gv_'.$key ] = array(
288
-				'title'	=> $arg['label'],
287
+			$gv_tooltips[ 'gv_' . $key ] = array(
288
+				'title'	=> $arg[ 'label' ],
289 289
 				'value'	=> $tooltip,
290 290
 			);
291 291
 
292 292
 		}
293 293
 
294
-		$gv_tooltips['gv_css_merge_tags'] = array(
295
-			'title' => __('CSS Merge Tags', 'gravityview'),
296
-			'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview'), '<code>', '</code>' )
294
+		$gv_tooltips[ 'gv_css_merge_tags' ] = array(
295
+			'title' => __( 'CSS Merge Tags', 'gravityview' ),
296
+			'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview' ), '<code>', '</code>' )
297 297
 		);
298 298
 
299 299
 		/**
@@ -311,9 +311,9 @@  discard block
 block discarded – undo
311 311
 
312 312
 		foreach ( $gv_tooltips as $key => $tooltip ) {
313 313
 
314
-			$title = empty( $tooltip['title'] ) ? '' : '<h6>'.esc_html( $tooltip['title'] ) .'</h6>';
314
+			$title = empty( $tooltip[ 'title' ] ) ? '' : '<h6>' . esc_html( $tooltip[ 'title' ] ) . '</h6>';
315 315
 
316
-			$tooltips[ $key ] = $title . wpautop( esc_html( $tooltip['value'] ) );
316
+			$tooltips[ $key ] = $title . wpautop( esc_html( $tooltip[ 'value' ] ) );
317 317
 		}
318 318
 
319 319
 		return $tooltips;
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 	 *
328 328
 	 * @return void
329 329
 	 */
330
-	public function add_custom_column_content( $column_name = NULL, $post_id )	{
330
+	public function add_custom_column_content( $column_name = NULL, $post_id ) {
331 331
 
332 332
 		$output = '';
333 333
 
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 				// Generate backup if label doesn't exist: `example_name` => `Example Name`
350 350
 				$template_id_pretty = ucwords( implode( ' ', explode( '_', $template_id ) ) );
351 351
 
352
-				$output = $template ? $template['label'] : $template_id_pretty;
352
+				$output = $template ? $template[ 'label' ] : $template_id_pretty;
353 353
 
354 354
 				break;
355 355
 
@@ -390,44 +390,44 @@  discard block
 block discarded – undo
390 390
 	static public function get_connected_form_links( $form, $include_form_link = true ) {
391 391
 
392 392
 		// Either the form is empty or the form ID is 0, not yet set.
393
-		if( empty( $form ) ) {
393
+		if ( empty( $form ) ) {
394 394
 			return '';
395 395
 		}
396 396
 
397 397
 		// The $form is passed as the form ID
398
-		if( !is_array( $form ) ) {
398
+		if ( ! is_array( $form ) ) {
399 399
 			$form = gravityview_get_form( $form );
400 400
 		}
401 401
 
402
-		$form_id = $form['id'];
402
+		$form_id = $form[ 'id' ];
403 403
 		$links = array();
404 404
 
405
-		if( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) {
405
+		if ( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) {
406 406
 			$form_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&amp;id=%d', $form_id ) );
407
-			$form_link = '<strong class="gv-form-title">'.gravityview_get_link( $form_url, $form['title'], 'class=row-title' ).'</strong>';
408
-			$links[] = '<span>'.gravityview_get_link( $form_url, __('Edit Form', 'gravityview') ).'</span>';
407
+			$form_link = '<strong class="gv-form-title">' . gravityview_get_link( $form_url, $form[ 'title' ], 'class=row-title' ) . '</strong>';
408
+			$links[ ] = '<span>' . gravityview_get_link( $form_url, __( 'Edit Form', 'gravityview' ) ) . '</span>';
409 409
 		} else {
410
-			$form_link = '<strong class="gv-form-title">'. esc_html( $form['title'] ). '</strong>';
410
+			$form_link = '<strong class="gv-form-title">' . esc_html( $form[ 'title' ] ) . '</strong>';
411 411
 		}
412 412
 
413
-		if( GVCommon::has_cap( 'gravityforms_view_entries' ) ) {
413
+		if ( GVCommon::has_cap( 'gravityforms_view_entries' ) ) {
414 414
 			$entries_url = admin_url( sprintf( 'admin.php?page=gf_entries&amp;id=%d', $form_id ) );
415
-			$links[] = '<span>'.gravityview_get_link( $entries_url, __('Entries', 'gravityview') ).'</span>';
415
+			$links[ ] = '<span>' . gravityview_get_link( $entries_url, __( 'Entries', 'gravityview' ) ) . '</span>';
416 416
 		}
417 417
 
418
-		if( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) {
418
+		if ( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) {
419 419
 			$settings_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&amp;view=settings&amp;id=%d', $form_id ) );
420
-			$links[] = '<span>'.gravityview_get_link( $settings_url, __('Settings', 'gravityview'), 'title='.__('Edit settings for this form', 'gravityview') ).'</span>';
420
+			$links[ ] = '<span>' . gravityview_get_link( $settings_url, __( 'Settings', 'gravityview' ), 'title=' . __( 'Edit settings for this form', 'gravityview' ) ) . '</span>';
421 421
 		}
422 422
 
423
-		if( GVCommon::has_cap( array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms") ) ) {
423
+		if ( GVCommon::has_cap( array( "gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms" ) ) ) {
424 424
 			$preview_url = site_url( sprintf( '?gf_page=preview&amp;id=%d', $form_id ) );
425
-			$links[] = '<span>'.gravityview_get_link( $preview_url, __('Preview Form', 'gravityview'), 'title='.__('Preview this form', 'gravityview') ).'</span>';
425
+			$links[ ] = '<span>' . gravityview_get_link( $preview_url, __( 'Preview Form', 'gravityview' ), 'title=' . __( 'Preview this form', 'gravityview' ) ) . '</span>';
426 426
 		}
427 427
 
428 428
 		$output = '';
429 429
 
430
-		if( !empty( $include_form_link ) ) {
430
+		if ( ! empty( $include_form_link ) ) {
431 431
 			$output .= $form_link;
432 432
 		}
433 433
 
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 		 */
440 440
 		$links = apply_filters( 'gravityview_connected_form_links', $links, $form );
441 441
 
442
-		$output .= '<div class="row-actions">'. implode( ' | ', $links ) .'</div>';
442
+		$output .= '<div class="row-actions">' . implode( ' | ', $links ) . '</div>';
443 443
 
444 444
 		return $output;
445 445
 	}
@@ -453,8 +453,8 @@  discard block
 block discarded – undo
453 453
 		// Get the date column and save it for later to add back in.
454 454
 		// This adds it after the Data Source column.
455 455
 		// This way, we don't need to do array_slice, array_merge, etc.
456
-		$date = $columns['date'];
457
-		unset( $columns['date'] );
456
+		$date = $columns[ 'date' ];
457
+		unset( $columns[ 'date' ] );
458 458
 
459 459
 		$data_source_required_caps = array(
460 460
 			'gravityforms_edit_forms',
@@ -465,14 +465,14 @@  discard block
 block discarded – undo
465 465
 			'gravityforms_preview_forms',
466 466
 		);
467 467
 
468
-		if( GVCommon::has_cap( $data_source_required_caps ) ) {
469
-			$columns['gv_connected_form'] = __( 'Data Source', 'gravityview' );
468
+		if ( GVCommon::has_cap( $data_source_required_caps ) ) {
469
+			$columns[ 'gv_connected_form' ] = __( 'Data Source', 'gravityview' );
470 470
 		}
471 471
 
472
-		$columns['gv_template'] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' );
472
+		$columns[ 'gv_template' ] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' );
473 473
 
474 474
 		// Add the date back in.
475
-		$columns['date'] = $date;
475
+		$columns[ 'date' ] = $date;
476 476
 
477 477
 		return $columns;
478 478
 	}
@@ -486,12 +486,12 @@  discard block
 block discarded – undo
486 486
 	 */
487 487
 	function save_postdata( $post_id ) {
488 488
 
489
-		if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){
489
+		if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
490 490
 			return;
491 491
 		}
492 492
 
493 493
 		// validate post_type
494
-		if ( ! isset( $_POST['post_type'] ) || 'gravityview' != $_POST['post_type'] ) {
494
+		if ( ! isset( $_POST[ 'post_type' ] ) || 'gravityview' != $_POST[ 'post_type' ] ) {
495 495
 			return;
496 496
 		}
497 497
 
@@ -506,64 +506,64 @@  discard block
 block discarded – undo
506 506
 		$statii = array();
507 507
 
508 508
 		// check if this is a start fresh View
509
-		if ( isset( $_POST['gravityview_select_form_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_form_nonce'], 'gravityview_select_form' ) ) {
509
+		if ( isset( $_POST[ 'gravityview_select_form_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_form_nonce' ], 'gravityview_select_form' ) ) {
510 510
 
511
-			$form_id = !empty( $_POST['gravityview_form_id'] ) ? $_POST['gravityview_form_id'] : '';
511
+			$form_id = ! empty( $_POST[ 'gravityview_form_id' ] ) ? $_POST[ 'gravityview_form_id' ] : '';
512 512
 			// save form id
513
-			$statii['form_id'] = update_post_meta( $post_id, '_gravityview_form_id', $form_id );
513
+			$statii[ 'form_id' ] = update_post_meta( $post_id, '_gravityview_form_id', $form_id );
514 514
 
515 515
 		}
516 516
 
517
-		if( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii['form_id'] ) ) {
517
+		if ( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii[ 'form_id' ] ) ) {
518 518
 			gravityview()->log->error( 'Current user does not have the capability to create a new Form.', array( 'data' => wp_get_current_user() ) );
519 519
 			return;
520 520
 		}
521 521
 
522 522
 		// Was this a start fresh?
523
-		if ( ! empty( $_POST['gravityview_form_id_start_fresh'] ) ) {
524
-			$statii['start_fresh'] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 );
523
+		if ( ! empty( $_POST[ 'gravityview_form_id_start_fresh' ] ) ) {
524
+			$statii[ 'start_fresh' ] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 );
525 525
 		} else {
526
-			$statii['start_fresh'] = delete_post_meta( $post_id, '_gravityview_start_fresh' );
526
+			$statii[ 'start_fresh' ] = delete_post_meta( $post_id, '_gravityview_start_fresh' );
527 527
 		}
528 528
 
529 529
 		// Check if we have a template id
530
-		if ( isset( $_POST['gravityview_select_template_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_template_nonce'], 'gravityview_select_template' ) ) {
530
+		if ( isset( $_POST[ 'gravityview_select_template_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_template_nonce' ], 'gravityview_select_template' ) ) {
531 531
 
532
-			$template_id = !empty( $_POST['gravityview_directory_template'] ) ? $_POST['gravityview_directory_template'] : '';
532
+			$template_id = ! empty( $_POST[ 'gravityview_directory_template' ] ) ? $_POST[ 'gravityview_directory_template' ] : '';
533 533
 
534 534
 			// now save template id
535
-			$statii['directory_template'] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id );
535
+			$statii[ 'directory_template' ] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id );
536 536
 		}
537 537
 
538 538
 
539 539
 		// save View Configuration metabox
540
-		if ( isset( $_POST['gravityview_view_configuration_nonce'] ) && wp_verify_nonce( $_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration' ) ) {
540
+		if ( isset( $_POST[ 'gravityview_view_configuration_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_view_configuration_nonce' ], 'gravityview_view_configuration' ) ) {
541 541
 
542 542
 			// template settings
543
-			if( empty( $_POST['template_settings'] ) ) {
544
-				$_POST['template_settings'] = array();
543
+			if ( empty( $_POST[ 'template_settings' ] ) ) {
544
+				$_POST[ 'template_settings' ] = array();
545 545
 			}
546
-			$statii['template_settings'] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST['template_settings'] );
546
+			$statii[ 'template_settings' ] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST[ 'template_settings' ] );
547 547
 
548 548
 			$fields = array();
549 549
 
550 550
 			// Directory&single Visible Fields
551
-			if( !empty( $preset_fields ) ) {
551
+			if ( ! empty( $preset_fields ) ) {
552 552
 
553 553
 				$fields = $preset_fields;
554 554
 
555
-			} elseif( !empty( $_POST['gv_fields'] ) ) {
555
+			} elseif ( ! empty( $_POST[ 'gv_fields' ] ) ) {
556 556
 				$fields = _gravityview_process_posted_fields();
557 557
 			}
558 558
 
559 559
 			$fields = map_deep( $fields, 'addslashes' );
560
-			$statii['directory_fields'] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields );
560
+			$statii[ 'directory_fields' ] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields );
561 561
 
562 562
 			// Directory Visible Widgets
563
-			if( empty( $_POST['widgets'] ) ) {
564
-				$_POST['widgets'] = array();
563
+			if ( empty( $_POST[ 'widgets' ] ) ) {
564
+				$_POST[ 'widgets' ] = array();
565 565
 			}
566
-			$statii['directory_widgets'] = gravityview_set_directory_widgets( $post_id, $_POST['widgets'] );
566
+			$statii[ 'directory_widgets' ] = gravityview_set_directory_widgets( $post_id, $_POST[ 'widgets' ] );
567 567
 
568 568
 		} // end save view configuration
569 569
 
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
 		 * @param array $statii Array of statuses of the post meta saving processes. If saving worked, each key should be mapped to a value of the post ID (`directory_widgets` => `124`). If failed (or didn't change), the value will be false.
574 574
 		 * @since 1.17.2
575 575
 		 */
576
-		do_action('gravityview_view_saved', $post_id, $statii );
576
+		do_action( 'gravityview_view_saved', $post_id, $statii );
577 577
 
578 578
 		gravityview()->log->debug( '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array( 'data' => array_map( 'intval', $statii ) ) );
579 579
 	}
@@ -617,20 +617,20 @@  discard block
 block discarded – undo
617 617
 
618 618
 		$output = '';
619 619
 
620
-		if( !empty( $fields ) ) {
620
+		if ( ! empty( $fields ) ) {
621 621
 
622
-			foreach( $fields as $id => $details ) {
622
+			foreach ( $fields as $id => $details ) {
623 623
 
624
-				if( in_array( $details['type'], (array) $blacklist_field_types ) ) {
624
+				if ( in_array( $details[ 'type' ], (array)$blacklist_field_types ) ) {
625 625
 					continue;
626 626
 				}
627 627
 
628 628
 				// Edit mode only allows editing the parent fields, not single inputs.
629
-				if( $context === 'edit' && !empty( $details['parent'] ) ) {
629
+				if ( $context === 'edit' && ! empty( $details[ 'parent' ] ) ) {
630 630
 					continue;
631 631
 				}
632 632
 
633
-				$output .= new GravityView_Admin_View_Field( $details['label'], $id, $details, $settings = array(), $form );
633
+				$output .= new GravityView_Admin_View_Field( $details[ 'label' ], $id, $details, $settings = array(), $form );
634 634
 
635 635
 			} // End foreach
636 636
 		}
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
 		echo $output;
639 639
 
640 640
 		// For the EDIT view we only want to allow the form fields.
641
-		if( $context === 'edit' ) {
641
+		if ( $context === 'edit' ) {
642 642
 			return;
643 643
 		}
644 644
 
@@ -662,16 +662,16 @@  discard block
 block discarded – undo
662 662
 		$additional_fields = apply_filters( 'gravityview_additional_fields', array(
663 663
 			array(
664 664
 				'label_text' => __( '+ Add All Fields', 'gravityview' ),
665
-				'desc' => __('Add all the available fields at once.', 'gravityview'),
665
+				'desc' => __( 'Add all the available fields at once.', 'gravityview' ),
666 666
 				'field_id' => 'all-fields',
667 667
 				'label_type' => 'field',
668 668
 				'input_type' => NULL,
669 669
 				'field_options' => NULL,
670 670
 				'settings_html'	=> NULL,
671 671
 			)
672
-		));
672
+		) );
673 673
 
674
-		if( !empty( $additional_fields )) {
674
+		if ( ! empty( $additional_fields ) ) {
675 675
 			foreach ( (array)$additional_fields as $item ) {
676 676
 
677 677
 				// Prevent items from not having index set
@@ -682,16 +682,16 @@  discard block
 block discarded – undo
682 682
 					'input_type' => NULL,
683 683
 					'field_options' => NULL,
684 684
 					'settings_html'	=> NULL,
685
-				));
685
+				) );
686 686
 
687 687
 				// Backward compat.
688
-				if( !empty( $item['field_options'] ) ) {
688
+				if ( ! empty( $item[ 'field_options' ] ) ) {
689 689
 					// Use settings_html from now on.
690
-					$item['settings_html'] = $item['field_options'];
690
+					$item[ 'settings_html' ] = $item[ 'field_options' ];
691 691
 				}
692 692
 
693 693
 				// Render a label for each of them
694
-				echo new GravityView_Admin_View_Field( $item['label_text'], $item['field_id'], $item, $settings = array(), $form );
694
+				echo new GravityView_Admin_View_Field( $item[ 'label_text' ], $item[ 'field_id' ], $item, $settings = array(), $form );
695 695
 
696 696
 			}
697 697
 		}
@@ -704,54 +704,54 @@  discard block
 block discarded – undo
704 704
 	 * @param  string $zone   Either 'single', 'directory', 'header', 'footer'
705 705
 	 * @return array
706 706
 	 */
707
-	function get_entry_default_fields($form, $zone) {
707
+	function get_entry_default_fields( $form, $zone ) {
708 708
 
709 709
 		$entry_default_fields = array();
710 710
 
711
-		if( in_array( $zone, array( 'directory', 'single' ) ) ) {
711
+		if ( in_array( $zone, array( 'directory', 'single' ) ) ) {
712 712
 
713 713
 			$entry_default_fields = array(
714 714
 				'id' => array(
715
-					'label' => __('Entry ID', 'gravityview'),
715
+					'label' => __( 'Entry ID', 'gravityview' ),
716 716
 					'type' => 'id',
717
-					'desc'	=> __('The unique ID of the entry.', 'gravityview'),
717
+					'desc'	=> __( 'The unique ID of the entry.', 'gravityview' ),
718 718
 				),
719 719
 				'date_created' => array(
720
-					'label' => __('Entry Date', 'gravityview'),
721
-					'desc'	=> __('The date the entry was created.', 'gravityview'),
720
+					'label' => __( 'Entry Date', 'gravityview' ),
721
+					'desc'	=> __( 'The date the entry was created.', 'gravityview' ),
722 722
 					'type' => 'date_created',
723 723
 				),
724 724
 				'source_url' => array(
725
-					'label' => __('Source URL', 'gravityview'),
725
+					'label' => __( 'Source URL', 'gravityview' ),
726 726
 					'type' => 'source_url',
727
-					'desc'	=> __('The URL of the page where the form was submitted.', 'gravityview'),
727
+					'desc'	=> __( 'The URL of the page where the form was submitted.', 'gravityview' ),
728 728
 				),
729 729
 				'ip' => array(
730
-					'label' => __('User IP', 'gravityview'),
730
+					'label' => __( 'User IP', 'gravityview' ),
731 731
 					'type' => 'ip',
732
-					'desc'	=> __('The IP Address of the user who created the entry.', 'gravityview'),
732
+					'desc'	=> __( 'The IP Address of the user who created the entry.', 'gravityview' ),
733 733
 				),
734 734
 				'created_by' => array(
735
-					'label' => __('User', 'gravityview'),
735
+					'label' => __( 'User', 'gravityview' ),
736 736
 					'type' => 'created_by',
737
-					'desc'	=> __('Details of the logged-in user who created the entry (if any).', 'gravityview'),
737
+					'desc'	=> __( 'Details of the logged-in user who created the entry (if any).', 'gravityview' ),
738 738
 				),
739 739
 
740 740
 				/**
741 741
 				 * @since 1.7.2
742 742
 				 */
743 743
 			    'other_entries' => array(
744
-				    'label'	=> __('Other Entries', 'gravityview'),
744
+				    'label'	=> __( 'Other Entries', 'gravityview' ),
745 745
 				    'type'	=> 'other_entries',
746
-				    'desc'	=> __('Display other entries created by the entry creator.', 'gravityview'),
746
+				    'desc'	=> __( 'Display other entries created by the entry creator.', 'gravityview' ),
747 747
 			    ),
748 748
 	        );
749 749
 
750
-			if( 'single' !== $zone) {
750
+			if ( 'single' !== $zone ) {
751 751
 
752
-				$entry_default_fields['entry_link'] = array(
753
-					'label' => __('Link to Entry', 'gravityview'),
754
-					'desc'	=> __('A dedicated link to the single entry with customizable text.', 'gravityview'),
752
+				$entry_default_fields[ 'entry_link' ] = array(
753
+					'label' => __( 'Link to Entry', 'gravityview' ),
754
+					'desc'	=> __( 'A dedicated link to the single entry with customizable text.', 'gravityview' ),
755 755
 					'type' => 'entry_link',
756 756
 				);
757 757
 			}
@@ -761,10 +761,10 @@  discard block
 block discarded – undo
761 761
 		/**
762 762
 		 * @since  1.2
763 763
 		 */
764
-		$entry_default_fields['custom']	= array(
765
-			'label'	=> __('Custom Content', 'gravityview'),
764
+		$entry_default_fields[ 'custom' ] = array(
765
+			'label'	=> __( 'Custom Content', 'gravityview' ),
766 766
 			'type'	=> 'custom',
767
-			'desc'	=> __('Insert custom text or HTML.', 'gravityview'),
767
+			'desc'	=> __( 'Insert custom text or HTML.', 'gravityview' ),
768 768
 		);
769 769
 
770 770
 		/**
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
 		 * @param  string|array $form form_ID or form object
774 774
 		 * @param  string $zone   Either 'single', 'directory', 'header', 'footer'
775 775
 		 */
776
-		return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone);
776
+		return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone );
777 777
 	}
778 778
 
779 779
 	/**
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
 	 */
785 785
 	function get_available_fields( $form = '', $zone = NULL ) {
786 786
 
787
-		if( empty( $form ) ) {
787
+		if ( empty( $form ) ) {
788 788
 			gravityview()->log->error( '$form is empty' );
789 789
 			return array();
790 790
 		}
@@ -793,7 +793,7 @@  discard block
 block discarded – undo
793 793
 		$fields = gravityview_get_form_fields( $form, true );
794 794
 
795 795
 		// get meta fields ( only if form was already created )
796
-		if( !is_array( $form ) ) {
796
+		if ( ! is_array( $form ) ) {
797 797
 			$meta_fields = gravityview_get_entry_meta( $form );
798 798
 		} else {
799 799
 			$meta_fields = array();
@@ -806,7 +806,7 @@  discard block
 block discarded – undo
806 806
 		$fields = $fields + $meta_fields + $default_fields;
807 807
 
808 808
 		// Move Custom Content to top
809
-		$fields = array( 'custom' => $fields['custom'] ) + $fields;
809
+		$fields = array( 'custom' => $fields[ 'custom' ] ) + $fields;
810 810
 
811 811
 		return $fields;
812 812
 	}
@@ -820,11 +820,11 @@  discard block
 block discarded – undo
820 820
 
821 821
 		$widgets = $this->get_registered_widgets();
822 822
 
823
-		if( !empty( $widgets ) ) {
823
+		if ( ! empty( $widgets ) ) {
824 824
 
825
-			foreach( $widgets as $id => $details ) {
825
+			foreach ( $widgets as $id => $details ) {
826 826
 
827
-				echo new GravityView_Admin_View_Widget( $details['label'], $id, $details );
827
+				echo new GravityView_Admin_View_Widget( $details[ 'label' ], $id, $details );
828 828
 
829 829
 			}
830 830
 		}
@@ -853,7 +853,7 @@  discard block
 block discarded – undo
853 853
 	function render_active_areas( $template_id, $type, $zone, $rows, $values ) {
854 854
 		global $post;
855 855
 
856
-		if( $type === 'widget' ) {
856
+		if ( $type === 'widget' ) {
857 857
 			$button_label = __( 'Add Widget', 'gravityview' );
858 858
 		} else {
859 859
 			$button_label = __( 'Add Field', 'gravityview' );
@@ -865,10 +865,10 @@  discard block
 block discarded – undo
865 865
 		$form_id = null;
866 866
 
867 867
 		// if saved values, get available fields to label everyone
868
-		if( !empty( $values ) && ( !empty( $post->ID ) || !empty( $_POST['template_id'] ) ) ) {
868
+		if ( ! empty( $values ) && ( ! empty( $post->ID ) || ! empty( $_POST[ 'template_id' ] ) ) ) {
869 869
 
870
-			if( !empty( $_POST['template_id'] ) ) {
871
-				$form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] );
870
+			if ( ! empty( $_POST[ 'template_id' ] ) ) {
871
+				$form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] );
872 872
 			} else {
873 873
 				$form_id = $form = gravityview_get_form_id( $post->ID );
874 874
 			}
@@ -886,44 +886,44 @@  discard block
 block discarded – undo
886 886
 			}
887 887
 		}
888 888
 
889
-		foreach( $rows as $row ) :
890
-			foreach( $row as $col => $areas ) :
891
-				$column = ($col == '2-2') ? '1-2' : $col; ?>
889
+		foreach ( $rows as $row ) :
890
+			foreach ( $row as $col => $areas ) :
891
+				$column = ( $col == '2-2' ) ? '1-2' : $col; ?>
892 892
 
893 893
 				<div class="gv-grid-col-<?php echo esc_attr( $column ); ?>">
894 894
 
895
-					<?php foreach( $areas as $area ) : 	?>
895
+					<?php foreach ( $areas as $area ) : 	?>
896 896
 
897
-						<div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>">
898
-							<div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>">
897
+						<div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>">
898
+							<div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>">
899 899
 
900 900
 								<?php // render saved fields
901 901
 
902
-								if( ! empty( $values[ $zone .'_'. $area['areaid'] ] ) ) {
902
+								if ( ! empty( $values[ $zone . '_' . $area[ 'areaid' ] ] ) ) {
903 903
 
904
-									foreach( $values[ $zone .'_'. $area['areaid'] ] as $uniqid => $field ) {
904
+									foreach ( $values[ $zone . '_' . $area[ 'areaid' ] ] as $uniqid => $field ) {
905 905
 
906 906
 										// Maybe has a form ID
907
-										$form_id = empty( $field['form_id'] ) ? $form_id : $field['form_id'];
907
+										$form_id = empty( $field[ 'form_id' ] ) ? $form_id : $field[ 'form_id' ];
908 908
 
909 909
 										$input_type = NULL;
910 910
 
911 911
 										if ( $form_id ) {
912
-											$original_item = isset( $available_items[ $form_id ] [ $field['id'] ] ) ? $available_items[ $form_id ] [ $field['id'] ] : false ;
912
+											$original_item = isset( $available_items[ $form_id ] [ $field[ 'id' ] ] ) ? $available_items[ $form_id ] [ $field[ 'id' ] ] : false;
913 913
                                         } else {
914
-											$original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ;
914
+											$original_item = isset( $available_items[ $field[ 'id' ] ] ) ? $available_items[ $field[ 'id' ] ] : false;
915 915
                                         }
916 916
 
917
-										if ( !$original_item ) {
918
-											gravityview()->log->error( 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array(' data' => array('available_items' => $available_items, 'field' => $field ) ) );
917
+										if ( ! $original_item ) {
918
+											gravityview()->log->error( 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array( ' data' => array( 'available_items' => $available_items, 'field' => $field ) ) );
919 919
 
920 920
 											$original_item = $field;
921 921
 										} else {
922
-											$input_type = isset( $original_item['type'] ) ? $original_item['type'] : NULL;
922
+											$input_type = isset( $original_item[ 'type' ] ) ? $original_item[ 'type' ] : NULL;
923 923
 										}
924 924
 
925 925
 										// Field options dialog box
926
-										$field_options = GravityView_Render_Settings::render_field_options( $form_id, $type, $template_id, $field['id'], $original_item['label'], $zone .'_'. $area['areaid'], $input_type, $uniqid, $field, $zone, $original_item );
926
+										$field_options = GravityView_Render_Settings::render_field_options( $form_id, $type, $template_id, $field[ 'id' ], $original_item[ 'label' ], $zone . '_' . $area[ 'areaid' ], $input_type, $uniqid, $field, $zone, $original_item );
927 927
 
928 928
 										$item = array(
929 929
 											'input_type' => $input_type,
@@ -936,23 +936,23 @@  discard block
 block discarded – undo
936 936
 											$item = wp_parse_args( $item, $original_item );
937 937
 										}
938 938
 
939
-										switch( $type ) {
939
+										switch ( $type ) {
940 940
 											case 'widget':
941
-												echo new GravityView_Admin_View_Widget( $item['label'], $field['id'], $item, $field );
941
+												echo new GravityView_Admin_View_Widget( $item[ 'label' ], $field[ 'id' ], $item, $field );
942 942
 												break;
943 943
 											default:
944
-												echo new GravityView_Admin_View_Field( $field['label'], $field['id'], $item, $field, $form_id );
944
+												echo new GravityView_Admin_View_Field( $field[ 'label' ], $field[ 'id' ], $item, $field, $form_id );
945 945
 										}
946 946
 									}
947 947
 
948 948
 								} // End if zone is not empty ?>
949 949
 
950
-								<span class="drop-message"><?php echo sprintf(esc_attr__('"+ %s" or drag existing %ss here.', 'gravityview'), $button_label, $type ); ?></span>
950
+								<span class="drop-message"><?php echo sprintf( esc_attr__( '"+ %s" or drag existing %ss here.', 'gravityview' ), $button_label, $type ); ?></span>
951 951
 							</div>
952 952
 							<div class="gv-droppable-area-action">
953
-								<a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>" data-formid="<?php echo $view ? esc_attr( $view->form ? $view->form->ID : '' ) : ''; ?>"><?php echo '+ '.esc_html( $button_label ); ?></a>
953
+								<a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>" data-formid="<?php echo $view ? esc_attr( $view->form ? $view->form->ID : '' ) : ''; ?>"><?php echo '+ ' . esc_html( $button_label ); ?></a>
954 954
 
955
-								<p class="gv-droppable-area-title"><strong><?php echo esc_html( $area['title'] ); ?></strong><?php if( !empty( $area['subtitle'] ) ) { ?><span class="gv-droppable-area-subtitle"> &ndash; <?php echo esc_html( $area['subtitle'] ); ?></span><?php } ?></p>
955
+								<p class="gv-droppable-area-title"><strong><?php echo esc_html( $area[ 'title' ] ); ?></strong><?php if ( ! empty( $area[ 'subtitle' ] ) ) { ?><span class="gv-droppable-area-subtitle"> &ndash; <?php echo esc_html( $area[ 'subtitle' ] ); ?></span><?php } ?></p>
956 956
 							</div>
957 957
 						</div>
958 958
 
@@ -974,7 +974,7 @@  discard block
 block discarded – undo
974 974
 		$default_widget_areas = GravityView_Widget::get_default_widget_areas();
975 975
 
976 976
 		$widgets = array();
977
-		if( !empty( $post_id ) ) {
977
+		if ( ! empty( $post_id ) ) {
978 978
 			$widgets = gravityview_get_directory_widgets( $post_id );
979 979
 		}
980 980
 
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
 		// list of available fields to be shown in the popup
1008 1008
 		$forms = gravityview_get_forms( 'any' );
1009 1009
 
1010
-		$form_ids = array_map( function ($form) { return $form['id']; }, $forms);
1010
+		$form_ids = array_map( function( $form ) { return $form[ 'id' ]; }, $forms );
1011 1011
 
1012 1012
 		foreach ( $form_ids as $form_id ) {
1013 1013
 			$filter_field_id = sprintf( 'gv-field-filter-%s-%d', $context, $form_id );
@@ -1020,7 +1020,7 @@  discard block
 block discarded – undo
1020 1020
                 </div>
1021 1021
 
1022 1022
                 <div id="available-fields-<?php echo $filter_field_id; ?>" aria-live="polite" role="listbox">
1023
-                <?php do_action('gravityview_render_available_fields', $form_id, $context ); ?>
1023
+                <?php do_action( 'gravityview_render_available_fields', $form_id, $context ); ?>
1024 1024
                 </div>
1025 1025
 
1026 1026
                 <div class="gv-no-results hidden description"><?php esc_html_e( 'No fields were found matching the search.', 'gravityview' ); ?></div>
@@ -1039,7 +1039,7 @@  discard block
 block discarded – undo
1039 1039
 	 * @return string HTML of the active areas
1040 1040
 	 */
1041 1041
 	function render_directory_active_areas( $template_id = '', $context = 'single', $post_id = '', $echo = false ) {
1042
-		if( empty( $template_id ) ) {
1042
+		if ( empty( $template_id ) ) {
1043 1043
 			gravityview()->log->debug( '[render_directory_active_areas] {template_id} is empty', array( 'template_id' => $template_id ) );
1044 1044
 			return '';
1045 1045
 		}
@@ -1053,12 +1053,12 @@  discard block
 block discarded – undo
1053 1053
 		 */
1054 1054
 		$template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context );
1055 1055
 
1056
-		if( empty( $template_areas ) ) {
1056
+		if ( empty( $template_areas ) ) {
1057 1057
 
1058 1058
 			gravityview()->log->debug( '[render_directory_active_areas] No areas defined. Maybe template {template_id} is disabled.', array( 'data' => $template_id ) );
1059 1059
 			$output = '<div>';
1060
-			$output .= '<h2 class="description" style="font-size: 16px; margin:0">'. sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>'.$template_id.'</em>' ) .'</h2>';
1061
-			$output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">'.esc_html__('The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview').'</p>';
1060
+			$output .= '<h2 class="description" style="font-size: 16px; margin:0">' . sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>' . $template_id . '</em>' ) . '</h2>';
1061
+			$output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">' . esc_html__( 'The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview' ) . '</p>';
1062 1062
 			$output .= '</div>';
1063 1063
 		} else {
1064 1064
 
@@ -1073,7 +1073,7 @@  discard block
 block discarded – undo
1073 1073
 
1074 1074
 		}
1075 1075
 
1076
-		if( $echo ) {
1076
+		if ( $echo ) {
1077 1077
 			echo $output;
1078 1078
 		}
1079 1079
 
@@ -1093,26 +1093,26 @@  discard block
 block discarded – undo
1093 1093
 		$is_widgets_page = ( $pagenow === 'widgets.php' );
1094 1094
 
1095 1095
 		// Add the GV font (with the Astronaut)
1096
-		wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version );
1096
+		wp_enqueue_style( 'gravityview_global', plugins_url( 'assets/css/admin-global.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version );
1097 1097
 
1098
-		wp_register_script( 'gravityview-jquery-cookie', plugins_url('assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version, true );
1098
+		wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true );
1099 1099
 
1100 1100
 		// Don't process any scripts below here if it's not a GravityView page.
1101
-		if( ! gravityview_is_admin_page( $hook, 'single' ) && ! $is_widgets_page ) {
1101
+		if ( ! gravityview_is_admin_page( $hook, 'single' ) && ! $is_widgets_page ) {
1102 1102
 		    return;
1103 1103
 		}
1104 1104
 
1105 1105
         wp_enqueue_script( 'jquery-ui-datepicker' );
1106
-        wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), GravityView_Plugin::version );
1106
+        wp_enqueue_style( 'gravityview_views_datepicker', plugins_url( 'assets/css/admin-datepicker.css', GRAVITYVIEW_FILE ), GravityView_Plugin::version );
1107 1107
 
1108
-        $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
1108
+        $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
1109 1109
 
1110 1110
         //enqueue scripts
1111 1111
         wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), GravityView_Plugin::version );
1112 1112
 
1113
-        wp_localize_script('gravityview_views_scripts', 'gvGlobals', array(
1113
+        wp_localize_script( 'gravityview_views_scripts', 'gvGlobals', array(
1114 1114
             'cookiepath' => COOKIEPATH,
1115
-            'passed_form_id' => (bool) \GV\Utils::_GET( 'form_id' ),
1115
+            'passed_form_id' => (bool)\GV\Utils::_GET( 'form_id' ),
1116 1116
             'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ),
1117 1117
             'label_viewname' => __( 'Enter View name here', 'gravityview' ),
1118 1118
             'label_close' => __( 'Close', 'gravityview' ),
@@ -1124,9 +1124,9 @@  discard block
 block discarded – undo
1124 1124
             'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ),
1125 1125
             'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ),
1126 1126
             'remove_all_fields' => __( 'Would you like to remove all fields in this zone? (You are seeing this message because you were holding down the ALT key)', 'gravityview' ),
1127
-        ));
1127
+        ) );
1128 1128
 
1129
-        wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array('dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version );
1129
+        wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version );
1130 1130
 
1131 1131
         // Enqueue scripts needed for merge tags
1132 1132
         self::enqueue_gravity_forms_scripts();
@@ -1151,7 +1151,7 @@  discard block
 block discarded – undo
1151 1151
 		);
1152 1152
 
1153 1153
 		if ( wp_is_mobile() ) {
1154
-		    $scripts[] = 'jquery-touch-punch';
1154
+		    $scripts[ ] = 'jquery-touch-punch';
1155 1155
 		}
1156 1156
 
1157 1157
 		wp_enqueue_script( $scripts );
Please login to merge, or discard this patch.
includes/class-admin-installer.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
 	 *
50 50
 	 * @param array $items Scripts or styles to exclude from no-conflict
51 51
 	 *
52
-	 * @return array
52
+	 * @return string[]
53 53
 	 */
54 54
 	public function register_noconflict( $items ) {
55 55
 
Please login to merge, or discard this patch.
Indentation   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
 	 */
67 67
 	public function add_downloads_data_filters() {
68 68
 
69
-	    $downloads_data = get_site_transient( self::DOWNLOADS_DATA_TRANSIENT );
69
+		$downloads_data = get_site_transient( self::DOWNLOADS_DATA_TRANSIENT );
70 70
 
71
-	    if ( ! $downloads_data ) {
71
+		if ( ! $downloads_data ) {
72 72
 			return;
73 73
 		}
74 74
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	 */
98 98
 	public function add_admin_menu() {
99 99
 
100
-	    $menu_text = _x( 'Extensions', 'Extensions are WordPress plugins that add functionality to GravityView and Gravity Forms', 'gravityview' );
100
+		$menu_text = _x( 'Extensions', 'Extensions are WordPress plugins that add functionality to GravityView and Gravity Forms', 'gravityview' );
101 101
 
102 102
 		$menu_text = sprintf( '<span title="%s">%s</span>', esc_attr__( 'Plugins that extend GravityView and Gravity Forms functionality.', 'gravityview' ), $menu_text );
103 103
 
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
 	}
113 113
 
114 114
 	/**
115
-     * When on the Installer page, show a different notice than on the Settings page
116
-     *
115
+	 * When on the Installer page, show a different notice than on the Settings page
116
+	 *
117 117
 	 * @param array $notice
118 118
 	 *
119 119
 	 * @return string License notice
@@ -121,10 +121,10 @@  discard block
 block discarded – undo
121 121
 	public function maybe_modify_license_notice( $notice = '' ) {
122 122
 
123 123
 		if ( ! gravityview()->request->is_admin( '', 'downloads' ) ) {
124
-            return $notice;
125
-        }
124
+			return $notice;
125
+		}
126 126
 
127
-        return esc_html__( 'Your license %s. Do you want access to these plugins? %sActivate your license%s or %sget a license here%s.', 'gravityview' );
127
+		return esc_html__( 'Your license %s. Do you want access to these plugins? %sActivate your license%s or %sget a license here%s.', 'gravityview' );
128 128
 	}
129 129
 
130 130
 	/**
@@ -162,43 +162,43 @@  discard block
 block discarded – undo
162 162
 	 * Get downloads data from transient or from API; save transient after getting data from API
163 163
 	 *
164 164
 	 * @return WP_Error|array If error, returns WP_Error. If not valid JSON, empty array. Otherwise, this structure: {
165
-     *   @type array  $info {
166
-     *       @type string $id int 17
167
-     *       @type string $slug Extension slug
168
-     *       @type string $title Extension title
169
-     *       @type string $create_date in '2018-07-19 20:03:10' format
170
-     *       @type string $modified_date
171
-     *       @type string $status
172
-     *       @type string $link URL to public plugin page
173
-     *       @type string $content
174
-     *       @type string $excerpt
175
-     *       @type string $thumbnail URL to thumbnail
176
-     *       @type array  $category Taxonomy details for the plugin's category {
177
-     *         @type int $term_id => int 30
178
-     *         @type string $name => string 'Plugins' (length=7)
179
-     *         @type string $slug => string 'plugins' (length=7)
180
-     *         @type int $term_group => int 0
181
-     *         @type int $term_taxonomy_id => int 30
182
-     *         @type string $taxonomy => string 'download_category' (length=17)
183
-     *         @type string $description => string '' (length=0)
184
-     *         @type int $parent => int 0
185
-     *         @type int $count => int 4
186
-     *         @type string $filter => string 'raw' (length=3)
187
-     *       }
188
-     *       @type array $tags {see $category above}
189
-     *       @type string $textdomain string 'gravityview' (length=11)
190
-     *   }
191
-     *   @type array $pricing array of `price_name_slugs` => '00.00' values, if price options exist
192
-     *   @type array $licensing {
193
-     *       @type bool   $enabled Is licensing enabled for the extension
194
-     *       @type string $version Version number
195
-     *       @type string $exp_unit Expiration unit ('years')
196
-     *       @type string $exp_length Expiration length ('1')
197
-     *   }
198
-     *   @type array $files Array of files. Empty if user has no access to the file. {
199
-     *       @type string $file string URL of the file download
200
-     *   }
201
-     * }
165
+	 *   @type array  $info {
166
+	 *       @type string $id int 17
167
+	 *       @type string $slug Extension slug
168
+	 *       @type string $title Extension title
169
+	 *       @type string $create_date in '2018-07-19 20:03:10' format
170
+	 *       @type string $modified_date
171
+	 *       @type string $status
172
+	 *       @type string $link URL to public plugin page
173
+	 *       @type string $content
174
+	 *       @type string $excerpt
175
+	 *       @type string $thumbnail URL to thumbnail
176
+	 *       @type array  $category Taxonomy details for the plugin's category {
177
+	 *         @type int $term_id => int 30
178
+	 *         @type string $name => string 'Plugins' (length=7)
179
+	 *         @type string $slug => string 'plugins' (length=7)
180
+	 *         @type int $term_group => int 0
181
+	 *         @type int $term_taxonomy_id => int 30
182
+	 *         @type string $taxonomy => string 'download_category' (length=17)
183
+	 *         @type string $description => string '' (length=0)
184
+	 *         @type int $parent => int 0
185
+	 *         @type int $count => int 4
186
+	 *         @type string $filter => string 'raw' (length=3)
187
+	 *       }
188
+	 *       @type array $tags {see $category above}
189
+	 *       @type string $textdomain string 'gravityview' (length=11)
190
+	 *   }
191
+	 *   @type array $pricing array of `price_name_slugs` => '00.00' values, if price options exist
192
+	 *   @type array $licensing {
193
+	 *       @type bool   $enabled Is licensing enabled for the extension
194
+	 *       @type string $version Version number
195
+	 *       @type string $exp_unit Expiration unit ('years')
196
+	 *       @type string $exp_length Expiration length ('1')
197
+	 *   }
198
+	 *   @type array $files Array of files. Empty if user has no access to the file. {
199
+	 *       @type string $file string URL of the file download
200
+	 *   }
201
+	 * }
202 202
 	 */
203 203
 	public function get_downloads_data() {
204 204
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 		) );
227 227
 
228 228
 		if ( is_wp_error( $response ) ) {
229
-		    gravityview()->log->error( "Extension data response is an error", array( 'data' => $response ) );
229
+			gravityview()->log->error( "Extension data response is an error", array( 'data' => $response ) );
230 230
 			return $response;
231 231
 		}
232 232
 
@@ -279,10 +279,10 @@  discard block
 block discarded – undo
279 279
                 <div class="gv-admin-installer-notice notice inline error">
280 280
                     <h3><?php esc_html_e( 'Extensions and plugins data cannot be loaded at the moment. Please try again later.', 'gravityview' ); ?></h3>
281 281
                     <?php
282
-                    if ( is_wp_error( $downloads_data ) ) {
283
-	                    echo wpautop( '<pre>' . esc_html( $downloads_data->get_error_message() ) . '</pre>' );
284
-                    }
285
-                    ?>
282
+					if ( is_wp_error( $downloads_data ) ) {
283
+						echo wpautop( '<pre>' . esc_html( $downloads_data->get_error_message() ) . '</pre>' );
284
+					}
285
+					?>
286 286
                 </div>
287 287
             </div>
288 288
 			<?php
@@ -338,9 +338,9 @@  discard block
 block discarded – undo
338 338
 	protected function render_download( $download, $wp_plugins ) {
339 339
 
340 340
 
341
-        $details = $this->get_download_display_details( $download, $wp_plugins );
341
+		$details = $this->get_download_display_details( $download, $wp_plugins );
342 342
 
343
-        $download_info = $details['download_info'];
343
+		$download_info = $details['download_info'];
344 344
 
345 345
 		?>
346 346
         <div class="item <?php echo esc_attr( $details['item_class'] ); ?>">
@@ -362,43 +362,43 @@  discard block
 block discarded – undo
362 362
 
363 363
                 <div class="addon-excerpt"><?php
364 364
 
365
-                    $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info['excerpt'] );
365
+					$excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info['excerpt'] );
366 366
 
367
-                    // Allow some pure HTML tags, but remove everything else from the excerpt.
368
-                    $tags = array( '<strong>', '</strong>', '<em>', '</em>', '<code>', '</code>' );
369
-                    $replacements = array( '[b]', '[/b]', '[i]', '[/i]', '[code]', '[/code]' );
367
+					// Allow some pure HTML tags, but remove everything else from the excerpt.
368
+					$tags = array( '<strong>', '</strong>', '<em>', '</em>', '<code>', '</code>' );
369
+					$replacements = array( '[b]', '[/b]', '[i]', '[/i]', '[code]', '[/code]' );
370 370
 
371
-                    $excerpt = str_replace( $tags, $replacements, $excerpt );
372
-                    $excerpt = esc_html( strip_tags( $excerpt ) );
371
+					$excerpt = str_replace( $tags, $replacements, $excerpt );
372
+					$excerpt = esc_html( strip_tags( $excerpt ) );
373 373
 					$excerpt = str_replace( $replacements, $tags, $excerpt );
374 374
 
375 375
 					echo wpautop( $excerpt );
376
-                ?></div>
376
+				?></div>
377 377
             </div>
378 378
         </div>
379 379
 		<?php
380 380
 	}
381 381
 
382 382
 	/**
383
-     * Generates details array for the download to keep the render_download() method a bit tidier
384
-     *
383
+	 * Generates details array for the download to keep the render_download() method a bit tidier
384
+	 *
385 385
 	 * @param array $download Single download, as returned by {@see get_downloads_data}
386 386
 	 * @param array $wp_plugins All active plugins, as returned by {@see get_plugins()}
387 387
 	 *
388 388
 	 * @return array {
389
-     *   @type array $download_info
390
-     *   @type string $plugin_path
391
-     *   @type string $status License status returned by Easy Digital Downloads ("active", "inactive", "expired", "revoked", etc)
392
-     *   @type string $status_label
393
-     *   @type string $button_title Title attribute to show when hovering over the download's button
394
-     *   @type string $button_class CSS class to use for the button
395
-     *   @type string $button_label Text to use for the download's anchor link
396
-     *   @type string $href URL for the download's button
397
-     *   @type bool   $spinner Whether to show the spinner icon
398
-     *   @type string $item_class CSS class for the download container
399
-     *   @type string $required_license The name of the required license for the download ("All Access" or "Core + Extensions")
400
-     *   @type bool   $is_active Is the current GravityView license (as entered in Settings) active?
401
-     * }
389
+	 *   @type array $download_info
390
+	 *   @type string $plugin_path
391
+	 *   @type string $status License status returned by Easy Digital Downloads ("active", "inactive", "expired", "revoked", etc)
392
+	 *   @type string $status_label
393
+	 *   @type string $button_title Title attribute to show when hovering over the download's button
394
+	 *   @type string $button_class CSS class to use for the button
395
+	 *   @type string $button_label Text to use for the download's anchor link
396
+	 *   @type string $href URL for the download's button
397
+	 *   @type bool   $spinner Whether to show the spinner icon
398
+	 *   @type string $item_class CSS class for the download container
399
+	 *   @type string $required_license The name of the required license for the download ("All Access" or "Core + Extensions")
400
+	 *   @type bool   $is_active Is the current GravityView license (as entered in Settings) active?
401
+	 * }
402 402
 	 */
403 403
 	private function get_download_display_details( $download, $wp_plugins ) {
404 404
 
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 			'slug' => '',
410 410
 			'excerpt' => '',
411 411
 			'link' => '',
412
-            'coming_soon' => false,
412
+			'coming_soon' => false,
413 413
 			'installer_title' => null, // May not be defined
414 414
 			'installer_excerpt' => null, // May not be defined
415 415
 		) );
@@ -451,14 +451,14 @@  discard block
 block discarded – undo
451 451
 			$href         = 'https://gravityview.co/pricing/?utm_source=admin-installer&utm_medium=admin&utm_campaign=Admin%20Notice&utm_content=' . $required_license;
452 452
 		}
453 453
 
454
-        elseif ( ! empty( $download_info['coming_soon'] ) ) {
455
-	        $spinner      = false;
456
-	        $status       = 'notinstalled';
457
-	        $status_label = __( 'Coming Soon', 'gravityview' );
458
-	        $button_label = __( 'Learn More', 'gravityview' );
459
-	        $button_class = 'button-primary button-large';
460
-	        $href         = \GV\Utils::get( $download_info, 'link', 'https://gravityview.co/extensions/' );
461
-        }
454
+		elseif ( ! empty( $download_info['coming_soon'] ) ) {
455
+			$spinner      = false;
456
+			$status       = 'notinstalled';
457
+			$status_label = __( 'Coming Soon', 'gravityview' );
458
+			$button_label = __( 'Learn More', 'gravityview' );
459
+			$button_class = 'button-primary button-large';
460
+			$href         = \GV\Utils::get( $download_info, 'link', 'https://gravityview.co/extensions/' );
461
+		}
462 462
 
463 463
 		// Access but the plugin is not installed
464 464
 		elseif ( ! $wp_plugin ) {
@@ -498,18 +498,18 @@  discard block
 block discarded – undo
498 498
 		}
499 499
 
500 500
 		return compact( 'download_info','plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' );
501
-    }
501
+	}
502 502
 
503 503
 	/**
504
-     * Returns the base price for an extension
505
-     *
504
+	 * Returns the base price for an extension
505
+	 *
506 506
 	 * @param array $download
507 507
 	 *
508 508
 	 * @return float Base price for an extension. If not for sale separately, returns 0
509 509
 	 */
510 510
 	private function get_download_base_price( $download ) {
511 511
 
512
-	    $base_price = \GV\Utils::get( $download, 'pricing/amount', 0 );
512
+		$base_price = \GV\Utils::get( $download, 'pricing/amount', 0 );
513 513
 		$base_price = \GFCommon::to_number( $base_price );
514 514
 
515 515
 		unset( $download['pricing']['amount'] );
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 		}
521 521
 
522 522
 		return floatval( $base_price );
523
-    }
523
+	}
524 524
 
525 525
 	/**
526 526
 	 * Handle AJAX request to activate extension
@@ -538,8 +538,8 @@  discard block
 block discarded – undo
538 538
 
539 539
 		if ( is_wp_error( $result ) || ! is_plugin_active( $data['path'] ) ) {
540 540
 			wp_send_json_error( array(
541
-                'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() )
542
-            ) );
541
+				'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() )
542
+			) );
543 543
 		}
544 544
 
545 545
 		wp_send_json_success();
@@ -560,10 +560,10 @@  discard block
 block discarded – undo
560 560
 		deactivate_plugins( $data['path'] );
561 561
 
562 562
 		if( is_plugin_active( $data['path'] ) ) {
563
-            wp_send_json_error( array(
564
-                'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) )
565
-            ) );
566
-        }
563
+			wp_send_json_error( array(
564
+				'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) )
565
+			) );
566
+		}
567 567
 
568 568
 		wp_send_json_success();
569 569
 	}
Please login to merge, or discard this patch.
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public function register_noconflict( $items ) {
55 55
 
56
-		$items[] = 'gravityview-admin-installer';
56
+		$items[ ] = 'gravityview-admin-installer';
57 57
 
58 58
 		return $items;
59 59
 	}
@@ -72,17 +72,17 @@  discard block
 block discarded – undo
72 72
 			return;
73 73
 		}
74 74
 
75
-		add_filter( 'plugins_api', function ( $data, $action, $args ) use ( $downloads_data ) {
75
+		add_filter( 'plugins_api', function( $data, $action, $args ) use ( $downloads_data ) {
76 76
 			foreach ( $downloads_data as $extension ) {
77
-				if ( empty( $extension['info'] ) || empty( $args->slug ) || $args->slug !== $extension['info']['slug'] ) {
77
+				if ( empty( $extension[ 'info' ] ) || empty( $args->slug ) || $args->slug !== $extension[ 'info' ][ 'slug' ] ) {
78 78
 					continue;
79 79
 				}
80 80
 
81
-				return (object) array(
82
-					'slug'          => $extension['info']['slug'],
83
-					'name'          => $extension['info']['title'],
84
-					'version'       => $extension['licensing']['version'],
85
-					'download_link' => $extension['files'][0]['file'],
81
+				return (object)array(
82
+					'slug'          => $extension[ 'info' ][ 'slug' ],
83
+					'name'          => $extension[ 'info' ][ 'title' ],
84
+					'version'       => $extension[ 'licensing' ][ 'version' ],
85
+					'download_link' => $extension[ 'files' ][ 0 ][ 'file' ],
86 86
 				);
87 87
 			}
88 88
 
@@ -144,13 +144,13 @@  discard block
 block discarded – undo
144 144
 
145 145
 		foreach ( $all_plugins as $path => $plugin ) {
146 146
 
147
-			if ( empty( $plugin['TextDomain'] ) ) {
147
+			if ( empty( $plugin[ 'TextDomain' ] ) ) {
148 148
 				continue;
149 149
 			}
150 150
 
151
-			$wp_plugins[ $plugin['TextDomain'] ] = array(
151
+			$wp_plugins[ $plugin[ 'TextDomain' ] ] = array(
152 152
 				'path'      => $path,
153
-				'version'   => $plugin['Version'],
153
+				'version'   => $plugin[ 'Version' ],
154 154
 				'activated' => is_plugin_active( $path )
155 155
 			);
156 156
 		}
@@ -232,13 +232,13 @@  discard block
 block discarded – undo
232 232
 
233 233
 		$downloads_data = json_decode( wp_remote_retrieve_body( $response ), true );
234 234
 
235
-		if ( empty( $downloads_data['products'] ) ) {
235
+		if ( empty( $downloads_data[ 'products' ] ) ) {
236 236
 			return array();
237 237
 		}
238 238
 
239
-		$this->set_downloads_data( $downloads_data['products'] );
239
+		$this->set_downloads_data( $downloads_data[ 'products' ] );
240 240
 
241
-		return $downloads_data['products'];
241
+		return $downloads_data[ 'products' ];
242 242
 	}
243 243
 
244 244
 	/**
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 
312 312
 				foreach ( $downloads_data as $extension ) {
313 313
 
314
-					if ( empty( $extension['info'] ) ) {
314
+					if ( empty( $extension[ 'info' ] ) ) {
315 315
 						continue;
316 316
 					}
317 317
 
@@ -340,29 +340,29 @@  discard block
 block discarded – undo
340 340
 
341 341
         $details = $this->get_download_display_details( $download, $wp_plugins );
342 342
 
343
-        $download_info = $details['download_info'];
343
+        $download_info = $details[ 'download_info' ];
344 344
 
345 345
 		?>
346
-        <div class="item <?php echo esc_attr( $details['item_class'] ); ?>">
346
+        <div class="item <?php echo esc_attr( $details[ 'item_class' ] ); ?>">
347 347
             <div class="addon-inner">
348
-                <a href="<?php echo esc_url( $download_info['link'] ); ?>" rel="external noreferrer noopener" title="<?php esc_html_e( 'Visit the plugin page', 'gravityview' ); ?>"><img class="thumbnail" src="<?php echo esc_attr( $download_info['thumbnail'] ); ?>" alt="" /></a>
349
-                <h3><?php echo esc_html( \GV\Utils::get( $download_info, 'installer_title', $download_info['title'] ) ); ?></h3>
348
+                <a href="<?php echo esc_url( $download_info[ 'link' ] ); ?>" rel="external noreferrer noopener" title="<?php esc_html_e( 'Visit the plugin page', 'gravityview' ); ?>"><img class="thumbnail" src="<?php echo esc_attr( $download_info[ 'thumbnail' ] ); ?>" alt="" /></a>
349
+                <h3><?php echo esc_html( \GV\Utils::get( $download_info, 'installer_title', $download_info[ 'title' ] ) ); ?></h3>
350 350
                 <div>
351
-                    <?php if( $details['status_label'] ) { ?>
352
-                    <div class="status <?php echo esc_attr( $details['status'] ); ?>" title="<?php printf( esc_attr__( 'Plugin status: %s', 'gravityview' ), esc_html( $details['status_label'] ) ); ?>">
353
-                        <span class="dashicons dashicons-admin-plugins"></span> <span class="status-label"><?php echo esc_html( $details['status_label'] ); ?></span>
351
+                    <?php if ( $details[ 'status_label' ] ) { ?>
352
+                    <div class="status <?php echo esc_attr( $details[ 'status' ] ); ?>" title="<?php printf( esc_attr__( 'Plugin status: %s', 'gravityview' ), esc_html( $details[ 'status_label' ] ) ); ?>">
353
+                        <span class="dashicons dashicons-admin-plugins"></span> <span class="status-label"><?php echo esc_html( $details[ 'status_label' ] ); ?></span>
354 354
                     </div>
355 355
 			        <?php } ?>
356 356
 
357
-                    <a data-status="<?php echo esc_attr( $details['status'] ); ?>" data-plugin-path="<?php echo esc_attr( $details['plugin_path'] ); ?>" href="<?php echo esc_url( $details['href'] ); ?>" class="button <?php echo esc_attr( $details['button_class'] ); ?>" title="<?php echo esc_attr( $details['button_title'] ); ?>">
358
-                        <span class="title"><?php echo esc_html( $details['button_label'] ); ?></span>
359
-                        <?php if( $details['spinner'] ) { ?><span class="spinner"></span><?php } ?>
357
+                    <a data-status="<?php echo esc_attr( $details[ 'status' ] ); ?>" data-plugin-path="<?php echo esc_attr( $details[ 'plugin_path' ] ); ?>" href="<?php echo esc_url( $details[ 'href' ] ); ?>" class="button <?php echo esc_attr( $details[ 'button_class' ] ); ?>" title="<?php echo esc_attr( $details[ 'button_title' ] ); ?>">
358
+                        <span class="title"><?php echo esc_html( $details[ 'button_label' ] ); ?></span>
359
+                        <?php if ( $details[ 'spinner' ] ) { ?><span class="spinner"></span><?php } ?>
360 360
                     </a>
361 361
                 </div>
362 362
 
363 363
                 <div class="addon-excerpt"><?php
364 364
 
365
-                    $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info['excerpt'] );
365
+                    $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info[ 'excerpt' ] );
366 366
 
367 367
                     // Allow some pure HTML tags, but remove everything else from the excerpt.
368 368
                     $tags = array( '<strong>', '</strong>', '<em>', '</em>', '<code>', '</code>' );
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 	 */
403 403
 	private function get_download_display_details( $download, $wp_plugins ) {
404 404
 
405
-		$download_info = wp_parse_args( (array) $download['info'], array(
405
+		$download_info = wp_parse_args( (array)$download[ 'info' ], array(
406 406
 			'thumbnail' => '',
407 407
 			'title' => '',
408 408
 			'textdomain' => '',
@@ -414,9 +414,9 @@  discard block
 block discarded – undo
414 414
 			'installer_excerpt' => null, // May not be defined
415 415
 		) );
416 416
 
417
-		$wp_plugin = \GV\Utils::get( $wp_plugins, $download_info['textdomain'], false );
417
+		$wp_plugin = \GV\Utils::get( $wp_plugins, $download_info[ 'textdomain' ], false );
418 418
 
419
-		$has_access = ! empty( $download['files'] );
419
+		$has_access = ! empty( $download[ 'files' ] );
420 420
 		$spinner = true;
421 421
 		$href = $plugin_path = '#';
422 422
 		$status = $item_class = $button_title = $button_class = '';
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 		$required_license = $galactic_only ? __( 'All Access', 'gravityview' ) : __( 'Core + Extensions', 'gravityview' );
427 427
 
428 428
 		// The license is not active - no matter what level, this should not work
429
-		if( ! $is_active  && empty( $base_price ) ) {
429
+		if ( ! $is_active && empty( $base_price ) ) {
430 430
 			$spinner      = false;
431 431
 			$button_class = 'disabled disabled-license';
432 432
 			$button_label = sprintf( __( 'Active %s License is Required.', 'gravityview' ), $required_license );
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 			$status_label = '';
439 439
 			$button_label = sprintf( __( 'Purchase Now for %s', 'gravityview' ), '$' . $base_price );
440 440
 			$button_class = 'button-primary button-large';
441
-			$href         = $download_info['link'];
441
+			$href         = $download_info[ 'link' ];
442 442
 			$item_class   = 'featured';
443 443
 		}
444 444
 
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 			$href         = 'https://gravityview.co/pricing/?utm_source=admin-installer&utm_medium=admin&utm_campaign=Admin%20Notice&utm_content=' . $required_license;
452 452
 		}
453 453
 
454
-        elseif ( ! empty( $download_info['coming_soon'] ) ) {
454
+        elseif ( ! empty( $download_info[ 'coming_soon' ] ) ) {
455 455
 	        $spinner      = false;
456 456
 	        $status       = 'notinstalled';
457 457
 	        $status_label = __( 'Coming Soon', 'gravityview' );
@@ -466,8 +466,8 @@  discard block
 block discarded – undo
466 466
 			$href = add_query_arg(
467 467
 				array(
468 468
 					'action'   => 'install-plugin',
469
-					'plugin'   => $download_info['slug'],
470
-					'_wpnonce' => wp_create_nonce( 'install-plugin_' . $download_info['slug'] ),
469
+					'plugin'   => $download_info[ 'slug' ],
470
+					'_wpnonce' => wp_create_nonce( 'install-plugin_' . $download_info[ 'slug' ] ),
471 471
 				),
472 472
 				self_admin_url( 'update.php' )
473 473
 			);
@@ -479,25 +479,25 @@  discard block
 block discarded – undo
479 479
 		}
480 480
 
481 481
 		// Access and the plugin is installed but not active
482
-		elseif ( false === $wp_plugin['activated'] ) {
482
+		elseif ( false === $wp_plugin[ 'activated' ] ) {
483 483
 			$status = 'inactive';
484 484
 			$status_label = __( 'Inactive', 'gravityview' );
485 485
 			$button_label = __( 'Activate', 'gravityview' );
486
-			$plugin_path = $wp_plugin['path'];
486
+			$plugin_path = $wp_plugin[ 'path' ];
487 487
 
488 488
 		}
489 489
 
490 490
 		// Access and the plugin is installed and active
491 491
 		else {
492 492
 
493
-			$plugin_path = $wp_plugin['path'];
493
+			$plugin_path = $wp_plugin[ 'path' ];
494 494
 			$status = 'active';
495 495
 			$status_label = __( 'Active', 'gravityview' );
496 496
 			$button_label = __( 'Deactivate', 'gravityview' );
497 497
 
498 498
 		}
499 499
 
500
-		return compact( 'download_info','plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' );
500
+		return compact( 'download_info', 'plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' );
501 501
     }
502 502
 
503 503
 	/**
@@ -512,11 +512,11 @@  discard block
 block discarded – undo
512 512
 	    $base_price = \GV\Utils::get( $download, 'pricing/amount', 0 );
513 513
 		$base_price = \GFCommon::to_number( $base_price );
514 514
 
515
-		unset( $download['pricing']['amount'] );
515
+		unset( $download[ 'pricing' ][ 'amount' ] );
516 516
 
517 517
 		// Price options array, not single price
518
-		if ( ! $base_price && ! empty( $download['pricing'] ) ) {
519
-			$base_price = array_shift( $download['pricing'] );
518
+		if ( ! $base_price && ! empty( $download[ 'pricing' ] ) ) {
519
+			$base_price = array_shift( $download[ 'pricing' ] );
520 520
 		}
521 521
 
522 522
 		return floatval( $base_price );
@@ -530,13 +530,13 @@  discard block
 block discarded – undo
530 530
 	public function activate_download() {
531 531
 		$data = \GV\Utils::_POST( 'data', array() );
532 532
 
533
-		if ( empty( $data['path'] ) ) {
533
+		if ( empty( $data[ 'path' ] ) ) {
534 534
 			return;
535 535
 		}
536 536
 
537
-		$result = activate_plugin( $data['path'] );
537
+		$result = activate_plugin( $data[ 'path' ] );
538 538
 
539
-		if ( is_wp_error( $result ) || ! is_plugin_active( $data['path'] ) ) {
539
+		if ( is_wp_error( $result ) || ! is_plugin_active( $data[ 'path' ] ) ) {
540 540
 			wp_send_json_error( array(
541 541
                 'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() )
542 542
             ) );
@@ -553,13 +553,13 @@  discard block
 block discarded – undo
553 553
 	public function deactivate_download() {
554 554
 		$data = \GV\Utils::_POST( 'data', array() );
555 555
 
556
-		if ( empty( $data['path'] ) ) {
556
+		if ( empty( $data[ 'path' ] ) ) {
557 557
 			return;
558 558
 		}
559 559
 
560
-		deactivate_plugins( $data['path'] );
560
+		deactivate_plugins( $data[ 'path' ] );
561 561
 
562
-		if( is_plugin_active( $data['path'] ) ) {
562
+		if ( is_plugin_active( $data[ 'path' ] ) ) {
563 563
             wp_send_json_error( array(
564 564
                 'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) )
565 565
             ) );
Please login to merge, or discard this patch.
Braces   +1 added lines, -3 removed lines patch added patch discarded remove patch
@@ -449,9 +449,7 @@
 block discarded – undo
449 449
 			$button_label = sprintf( __( 'Upgrade to %s for Access', 'gravityview' ), $required_license );
450 450
 			$button_class = 'button-primary button-large';
451 451
 			$href         = 'https://gravityview.co/pricing/?utm_source=admin-installer&utm_medium=admin&utm_campaign=Admin%20Notice&utm_content=' . $required_license;
452
-		}
453
-
454
-        elseif ( ! empty( $download_info['coming_soon'] ) ) {
452
+		} elseif ( ! empty( $download_info['coming_soon'] ) ) {
455 453
 	        $spinner      = false;
456 454
 	        $status       = 'notinstalled';
457 455
 	        $status_label = __( 'Coming Soon', 'gravityview' );
Please login to merge, or discard this patch.
future/includes/class-gv-settings-addon.php 2 patches
Indentation   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -134,28 +134,28 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	public function add_network_menu() {
136 136
 
137
-	    if ( ! gravityview()->plugin->is_network_activated() ) {
137
+		if ( ! gravityview()->plugin->is_network_activated() ) {
138 138
 			return;
139 139
 		}
140 140
 
141
-        add_menu_page( __( 'Settings', 'gravityview' ), __( 'GravityView', 'gravityview' ), $this->_capabilities_app_settings, "{$this->_slug}_settings", array( $this, 'app_tab_page' ), 'none' );
141
+		add_menu_page( __( 'Settings', 'gravityview' ), __( 'GravityView', 'gravityview' ), $this->_capabilities_app_settings, "{$this->_slug}_settings", array( $this, 'app_tab_page' ), 'none' );
142 142
 	}
143 143
 
144 144
 	/**
145
-     * Uninstall all traces of GravityView
146
-     *
147
-     * Note: method is public because parent method is public
148
-     *
145
+	 * Uninstall all traces of GravityView
146
+	 *
147
+	 * Note: method is public because parent method is public
148
+	 *
149 149
 	 * @return bool
150 150
 	 */
151 151
 	public function uninstall() {
152 152
 		gravityview()->plugin->uninstall();
153 153
 
154 154
 		/**
155
-         * Set the path so that Gravity Forms can de-activate GravityView
156
-         * @see GFAddOn::uninstall_addon
157
-         * @uses deactivate_plugins()
158
-         */
155
+		 * Set the path so that Gravity Forms can de-activate GravityView
156
+		 * @see GFAddOn::uninstall_addon
157
+		 * @uses deactivate_plugins()
158
+		 */
159 159
 		$this->_path = GRAVITYVIEW_FILE;
160 160
 
161 161
 		return true;
@@ -185,42 +185,42 @@  discard block
 block discarded – undo
185 185
 	}
186 186
 
187 187
 	/**
188
-     * Get an array of reasons why the plugin might be uninstalled
189
-     *
190
-     * @since 1.17.5
191
-     *
188
+	 * Get an array of reasons why the plugin might be uninstalled
189
+	 *
190
+	 * @since 1.17.5
191
+	 *
192 192
 	 * @return array Array of reasons with the label and followup questions for each uninstall reason
193 193
 	 */
194 194
 	private function get_uninstall_reasons() {
195 195
 		$reasons = array(
196 196
 			'will-continue' => array(
197
-                'label' => esc_html__( 'I am going to continue using GravityView', 'gravityview' ),
198
-            ),
197
+				'label' => esc_html__( 'I am going to continue using GravityView', 'gravityview' ),
198
+			),
199 199
 			'no-longer-need' => array(
200
-                'label' => esc_html__( 'I no longer need GravityView', 'gravityview' ),
201
-            ),
200
+				'label' => esc_html__( 'I no longer need GravityView', 'gravityview' ),
201
+			),
202 202
 			'doesnt-work' => array(
203
-                'label' => esc_html__( 'The plugin doesn\'t work', 'gravityview' ),
204
-            ),
203
+				'label' => esc_html__( 'The plugin doesn\'t work', 'gravityview' ),
204
+			),
205 205
 			'found-other' => array(
206
-                'label' => esc_html__( 'I found a better plugin', 'gravityview' ),
207
-                'followup' => esc_attr__( 'What plugin you are using, and why?', 'gravityview' ),
208
-            ),
206
+				'label' => esc_html__( 'I found a better plugin', 'gravityview' ),
207
+				'followup' => esc_attr__( 'What plugin you are using, and why?', 'gravityview' ),
208
+			),
209 209
 			'other' => array(
210
-                'label' => esc_html__( 'Other', 'gravityview' ),
211
-            ),
210
+				'label' => esc_html__( 'Other', 'gravityview' ),
211
+			),
212 212
 		);
213 213
 
214 214
 		shuffle( $reasons );
215 215
 
216 216
 		return $reasons;
217
-    }
217
+	}
218 218
 
219 219
 	/**
220
-     * Display a feedback form when the plugin is uninstalled
221
-     *
222
-     * @since 1.17.5
223
-     *
220
+	 * Display a feedback form when the plugin is uninstalled
221
+	 *
222
+	 * @since 1.17.5
223
+	 *
224 224
 	 * @return string HTML of the uninstallation form
225 225
 	 */
226 226
 	public function uninstall_form() {
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
             <h2><?php esc_html_e( 'Why did you uninstall GravityView?', 'gravityview' ); ?></h2>
301 301
             <ul>
302 302
 				<?php
303
-                $reasons = $this->get_uninstall_reasons();
303
+				$reasons = $this->get_uninstall_reasons();
304 304
 				foreach ( $reasons as $reason ) {
305 305
 					printf( '<li><label><input name="reason" type="radio" value="other" data-followup="%s"> %s</label></li>', Utils::get( $reason, 'followup' ), Utils::get( $reason, 'label' ) );
306 306
 				}
@@ -394,12 +394,12 @@  discard block
 block discarded – undo
394 394
 	}
395 395
 
396 396
 	public function app_settings_tab() {
397
-	    parent::app_settings_tab();
397
+		parent::app_settings_tab();
398 398
 
399 399
 		if ( $this->maybe_uninstall() ) {
400
-            echo $this->uninstall_form();
400
+			echo $this->uninstall_form();
401 401
 		}
402
-    }
402
+	}
403 403
 
404 404
 	/**
405 405
 	 * The Settings title
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
 	 * @return array The settings.
485 485
 	 */
486 486
 	public function all() {
487
-	    return wp_parse_args( get_option( 'gravityformsaddon_' . $this->_slug . '_app_settings', array() ), $this->defaults() );
487
+		return wp_parse_args( get_option( 'gravityformsaddon_' . $this->_slug . '_app_settings', array() ), $this->defaults() );
488 488
 	}
489 489
 
490 490
 	/**
@@ -553,8 +553,8 @@  discard block
 block discarded – undo
553 553
                     type="' . $field['type'] . '"
554 554
                     name="' . esc_attr( $name ) . '"
555 555
                     value="' . $value . '" ' .
556
-		        implode( ' ', $attributes ) .
557
-		        ' />';
556
+				implode( ' ', $attributes ) .
557
+				' />';
558 558
 
559 559
 		if ( $echo ) {
560 560
 			echo $html;
@@ -572,12 +572,12 @@  discard block
 block discarded – undo
572 572
 	}
573 573
 
574 574
 	/**
575
-     * Check whether GravityView is being saved
576
-     *
577
-     * The generic is_save_postback() is true for all addons
578
-     *
579
-     * @since 2.0.8
580
-     *
575
+	 * Check whether GravityView is being saved
576
+	 *
577
+	 * The generic is_save_postback() is true for all addons
578
+	 *
579
+	 * @since 2.0.8
580
+	 *
581 581
 	 * @return bool
582 582
 	 */
583 583
 	public function is_save_postback() {
@@ -591,16 +591,16 @@  discard block
 block discarded – undo
591 591
 	 */
592 592
 	public function license_key_notice() {
593 593
 
594
-	    if( $this->is_save_postback() ) {
595
-		    $settings = $this->get_posted_settings();
596
-		    $license_key = \GV\Utils::get( $settings, 'license_key' );
597
-		    $license_status = \GV\Utils::get( $settings, 'license_key_status', 'inactive' );
598
-        } else {
599
-		    $license_status = $this->get( 'license_key_status', 'inactive' );
600
-		    $license_key    = $this->get( 'license_key' );
601
-	    }
594
+		if( $this->is_save_postback() ) {
595
+			$settings = $this->get_posted_settings();
596
+			$license_key = \GV\Utils::get( $settings, 'license_key' );
597
+			$license_status = \GV\Utils::get( $settings, 'license_key_status', 'inactive' );
598
+		} else {
599
+			$license_status = $this->get( 'license_key_status', 'inactive' );
600
+			$license_key    = $this->get( 'license_key' );
601
+		}
602 602
 
603
-	    $license_id = empty( $license_key ) ? 'license' : $license_key;
603
+		$license_id = empty( $license_key ) ? 'license' : $license_key;
604 604
 
605 605
 		$message = esc_html__( 'Your GravityView license %s. This means you&rsquo;re missing out on updates and support! %sActivate your license%s or %sget a license here%s.', 'gravityview' );
606 606
 
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
 		$update_below = false;
618 618
 		$primary_button_link = admin_url( 'edit.php?post_type=gravityview&amp;page=gravityview_settings' );
619 619
 
620
-        switch ( $license_status ) {
620
+		switch ( $license_status ) {
621 621
 			/** @since 1.17 */
622 622
 			case 'expired':
623 623
 				$title = __( 'Expired License', 'gravityview' );
@@ -655,13 +655,13 @@  discard block
 block discarded – undo
655 655
 			return;
656 656
 		}
657 657
 
658
-        \GravityView_Admin_Notices::add_notice( array(
659
-            'message' => $message,
660
-            'class'   => 'notice notice-warning',
661
-            'title'   => $title,
662
-            'cap'     => 'gravityview_edit_settings',
663
-            'dismiss' => sha1( $license_status . '_' . $license_id . '_' . date( 'z' ) ), // Show every day, instead of every 8 weeks (which is the default)
664
-        ) );
658
+		\GravityView_Admin_Notices::add_notice( array(
659
+			'message' => $message,
660
+			'class'   => 'notice notice-warning',
661
+			'title'   => $title,
662
+			'cap'     => 'gravityview_edit_settings',
663
+			'dismiss' => sha1( $license_status . '_' . $license_id . '_' . date( 'z' ) ), // Show every day, instead of every 8 weeks (which is the default)
664
+		) );
665 665
 	}
666 666
 
667 667
 	/**
@@ -675,12 +675,12 @@  discard block
 block discarded – undo
675 675
 	}
676 676
 
677 677
 	/**
678
-     * Add tooltip script to app settings page. Not enqueued by Gravity Forms for some reason.
679
-     *
680
-     * @since 1.21.5
681
-     *
682
-     * @see GFAddOn::scripts()
683
-     *
678
+	 * Add tooltip script to app settings page. Not enqueued by Gravity Forms for some reason.
679
+	 *
680
+	 * @since 1.21.5
681
+	 *
682
+	 * @see GFAddOn::scripts()
683
+	 *
684 684
 	 * @return array Array of scripts
685 685
 	 */
686 686
 	public function scripts() {
@@ -689,10 +689,10 @@  discard block
 block discarded – undo
689 689
 		$scripts[] = array(
690 690
 			'handle'  => 'gform_tooltip_init',
691 691
 			'enqueue' => array(
692
-                array(
693
-			        'admin_page' => array( 'app_settings' )
694
-                )
695
-            )
692
+				array(
693
+					'admin_page' => array( 'app_settings' )
694
+				)
695
+			)
696 696
 		);
697 697
 
698 698
 		return $scripts;
@@ -710,10 +710,10 @@  discard block
 block discarded – undo
710 710
 			'src'     => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ),
711 711
 			'version' => Plugin::$version,
712 712
 			'deps' => array(
713
-                'gform_admin',
713
+				'gform_admin',
714 714
 				'gaddon_form_settings_css',
715
-                'gform_tooltip',
716
-                'gform_font_awesome',
715
+				'gform_tooltip',
716
+				'gform_font_awesome',
717 717
 			),
718 718
 			'enqueue' => array(
719 719
 				array( 'admin_page' => array(
@@ -881,7 +881,7 @@  discard block
 block discarded – undo
881 881
 					array(
882 882
 						'label' => _x( 'Show me beta versions if they are available.', 'gravityview' ),
883 883
 						'value' => '1',
884
-                        'name'  => 'beta',
884
+						'name'  => 'beta',
885 885
 					),
886 886
 				),
887 887
 				'description'   => __( 'You will have early access to the latest GravityView features and improvements. There may be bugs! If you encounter an issue, help make GravityView better by reporting it!', 'gravityview' ),
@@ -919,38 +919,38 @@  discard block
 block discarded – undo
919 919
 
920 920
 			if ( empty( $field['disabled'] ) ) {
921 921
 				unset( $field['disabled'] );
922
-            }
922
+			}
923 923
 		}
924 924
 
925
-        $sections = array(
926
-            array(
927
-                'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), Plugin::$version ) ),
928
-                'fields'      => $fields,
929
-            )
930
-        );
925
+		$sections = array(
926
+			array(
927
+				'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), Plugin::$version ) ),
928
+				'fields'      => $fields,
929
+			)
930
+		);
931 931
 
932
-        // custom 'update settings' button
933
-        $button = array(
934
-            'class' => 'button button-primary button-hero',
935
-            'type' => 'save',
936
-        );
932
+		// custom 'update settings' button
933
+		$button = array(
934
+			'class' => 'button button-primary button-hero',
935
+			'type' => 'save',
936
+		);
937 937
 
938 938
 		if ( $disabled_attribute ) {
939 939
 			$button['disabled'] = $disabled_attribute;
940 940
 		}
941 941
 
942
-        /**
943
-         * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page
944
-         * Extensions can tap in here to insert their own section and settings.
945
-         * <code>
946
-         *   $sections[] = array(
947
-         *      'title' => __( 'GravityView My Extension Settings', 'gravityview' ),
948
-         *      'fields' => $settings,
949
-         *   );
950
-         * </code>
951
-         * @param array $extension_settings Empty array, ready for extension settings!
952
-         */
953
-        $extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() );
942
+		/**
943
+		 * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page
944
+		 * Extensions can tap in here to insert their own section and settings.
945
+		 * <code>
946
+		 *   $sections[] = array(
947
+		 *      'title' => __( 'GravityView My Extension Settings', 'gravityview' ),
948
+		 *      'fields' => $settings,
949
+		 *   );
950
+		 * </code>
951
+		 * @param array $extension_settings Empty array, ready for extension settings!
952
+		 */
953
+		$extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() );
954 954
 
955 955
 		// If there are extensions, add a section for them
956 956
 		if ( ! empty( $extension_sections ) ) {
@@ -963,13 +963,13 @@  discard block
 block discarded – undo
963 963
 				}
964 964
 			}
965 965
 
966
-            $k = count( $extension_sections ) - 1 ;
967
-            $extension_sections[ $k ]['fields'][] = $button;
966
+			$k = count( $extension_sections ) - 1 ;
967
+			$extension_sections[ $k ]['fields'][] = $button;
968 968
 			$sections = array_merge( $sections, $extension_sections );
969 969
 		} else {
970
-            // add the 'update settings' button to the general section
971
-            $sections[0]['fields'][] = $button;
972
-        }
970
+			// add the 'update settings' button to the general section
971
+			$sections[0]['fields'][] = $button;
972
+		}
973 973
 
974 974
 		return $sections;
975 975
 	}
@@ -1023,9 +1023,9 @@  discard block
 block discarded – undo
1023 1023
 	 */
1024 1024
 	protected function settings_edd_license( $field, $echo = true ) {
1025 1025
 
1026
-	    if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) {
1027
-		    $field['input_type'] = 'password';
1028
-        }
1026
+		if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) {
1027
+			$field['input_type'] = 'password';
1028
+		}
1029 1029
 
1030 1030
 		$text = $this->settings_text( $field, false );
1031 1031
 
@@ -1042,9 +1042,9 @@  discard block
 block discarded – undo
1042 1042
 
1043 1043
 	/**
1044 1044
 	 * Allow pure HTML settings row
1045
-     *
1046
-     * @since 2.0.6
1047
-     *
1045
+	 *
1046
+	 * @since 2.0.6
1047
+	 *
1048 1048
 	 * @param array $field
1049 1049
 	 * @param bool $echo Whether to echo the
1050 1050
 	 *
@@ -1110,19 +1110,19 @@  discard block
 block discarded – undo
1110 1110
 	}
1111 1111
 
1112 1112
 	/**
1113
-     * Keep GravityView styling for `$field['description']`, even though Gravity Forms added support for it
1114
-     *
1115
-     * Converts `$field['description']` to `$field['gv_description']`
1116
-     * Converts `$field['subtitle']` to `$field['description']`
1117
-     *
1118
-     * @see \GV\Addon_Settings::single_setting_label Converts `gv_description` back to `description`
1119
-     * @see http://share.gravityview.co/P28uGp/2OIRKxog for image that shows subtitle vs description
1120
-     *
1121
-     * @since 1.21.5.2
1122
-     *
1113
+	 * Keep GravityView styling for `$field['description']`, even though Gravity Forms added support for it
1114
+	 *
1115
+	 * Converts `$field['description']` to `$field['gv_description']`
1116
+	 * Converts `$field['subtitle']` to `$field['description']`
1117
+	 *
1118
+	 * @see \GV\Addon_Settings::single_setting_label Converts `gv_description` back to `description`
1119
+	 * @see http://share.gravityview.co/P28uGp/2OIRKxog for image that shows subtitle vs description
1120
+	 *
1121
+	 * @since 1.21.5.2
1122
+	 *
1123 1123
 	 * @param array $field
1124
-     *
1125
-     * @return void
1124
+	 *
1125
+	 * @return void
1126 1126
 	 */
1127 1127
 	public function single_setting_row( $field ) {
1128 1128
 		$field['gv_description'] = Utils::get( $field, 'description' );
Please login to merge, or discard this patch.
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 * @return array
103 103
 	 */
104 104
 	public function modify_app_settings_menu_title( $setting_tabs ) {
105
-		$setting_tabs[0]['label'] = __( 'GravityView Settings', 'gravityview' );
105
+		$setting_tabs[ 0 ][ 'label' ] = __( 'GravityView Settings', 'gravityview' );
106 106
 		return $setting_tabs;
107 107
 	}
108 108
 
@@ -308,15 +308,15 @@  discard block
 block discarded – undo
308 308
             </ul>
309 309
             <div class="gv-followup widefat">
310 310
                 <p><strong><label for="gv-reason-details"><?php esc_html_e( 'Comments', 'gravityview' ); ?></label></strong></p>
311
-                <textarea id="gv-reason-details" name="reason_details" data-default="<?php esc_attr_e('Please share your thoughts about GravityView', 'gravityview') ?>" placeholder="<?php esc_attr_e('Please share your thoughts about GravityView', 'gravityview'); ?>" class="large-text"></textarea>
311
+                <textarea id="gv-reason-details" name="reason_details" data-default="<?php esc_attr_e( 'Please share your thoughts about GravityView', 'gravityview' ) ?>" placeholder="<?php esc_attr_e( 'Please share your thoughts about GravityView', 'gravityview' ); ?>" class="large-text"></textarea>
312 312
             </div>
313 313
             <div class="scale-description">
314 314
                 <p><strong><?php esc_html_e( 'How likely are you to recommend GravityView?', 'gravityview' ); ?></strong></p>
315 315
                 <ul class="inline">
316 316
 					<?php
317 317
 					$i = 0;
318
-					while( $i < 11 ) {
319
-						echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_'.$i.'" value="'.$i.'" type="radio"> '.$i.'</label></li>';
318
+					while ( $i < 11 ) {
319
+						echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_' . $i . '" value="' . $i . '" type="radio"> ' . $i . '</label></li>';
320 320
 						$i++;
321 321
 					}
322 322
 					?>
@@ -533,15 +533,15 @@  discard block
 block discarded – undo
533 533
 	 * @return string The HTML
534 534
 	 */
535 535
 	public function as_html( $field, $echo = true ) {
536
-		$field['type']  = ( isset( $field['type'] ) && in_array( $field['type'], array( 'submit','reset','button' ) ) ) ? $field['type'] : 'submit';
536
+		$field[ 'type' ] = ( isset( $field[ 'type' ] ) && in_array( $field[ 'type' ], array( 'submit', 'reset', 'button' ) ) ) ? $field[ 'type' ] : 'submit';
537 537
 
538 538
 		$attributes    = $this->get_field_attributes( $field );
539 539
 		$default_value = Utils::get( $field, 'value', Utils::get( $field, 'default_value' ) );
540
-		$value         = $this->get( $field['name'], $default_value );
540
+		$value         = $this->get( $field[ 'name' ], $default_value );
541 541
 
542 542
 
543
-		$attributes['class'] = isset( $attributes['class'] ) ? esc_attr( $attributes['class'] ) : 'button-primary gfbutton';
544
-		$name    = ( $field['name'] === 'gform-settings-save' ) ? $field['name'] : '_gaddon_setting_' . $field['name'];
543
+		$attributes[ 'class' ] = isset( $attributes[ 'class' ] ) ? esc_attr( $attributes[ 'class' ] ) : 'button-primary gfbutton';
544
+		$name = ( $field[ 'name' ] === 'gform-settings-save' ) ? $field[ 'name' ] : '_gaddon_setting_' . $field[ 'name' ];
545 545
 
546 546
 		if ( empty( $value ) ) {
547 547
 			$value = __( 'Update Settings', 'gravityview' );
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
 		$attributes = $this->get_field_attributes( $field );
551 551
 
552 552
 		$html = '<input
553
-                    type="' . $field['type'] . '"
553
+                    type="' . $field[ 'type' ] . '"
554 554
                     name="' . esc_attr( $name ) . '"
555 555
                     value="' . $value . '" ' .
556 556
 		        implode( ' ', $attributes ) .
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
 	 * @return bool
582 582
 	 */
583 583
 	public function is_save_postback() {
584
-		return isset( $_POST['gform-settings-save'] ) && isset( $_POST['_gravityview_save_settings_nonce'] );
584
+		return isset( $_POST[ 'gform-settings-save' ] ) && isset( $_POST[ '_gravityview_save_settings_nonce' ] );
585 585
 	}
586 586
 
587 587
 	/**
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 	 */
592 592
 	public function license_key_notice() {
593 593
 
594
-	    if( $this->is_save_postback() ) {
594
+	    if ( $this->is_save_postback() ) {
595 595
 		    $settings = $this->get_posted_settings();
596 596
 		    $license_key = \GV\Utils::get( $settings, 'license_key' );
597 597
 		    $license_status = \GV\Utils::get( $settings, 'license_key_status', 'inactive' );
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
 		 * but didn't want to mess up the translation strings for the translators.
613 613
 		 */
614 614
 		$message = mb_substr( $message, 0, mb_strlen( $message ) - 1 );
615
-		$title = __( 'Inactive License', 'gravityview');
615
+		$title = __( 'Inactive License', 'gravityview' );
616 616
 		$status = '';
617 617
 		$update_below = false;
618 618
 		$primary_button_link = admin_url( 'edit.php?post_type=gravityview&amp;page=gravityview_settings' );
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
 				$update_below = __( 'Activate your license key below.', 'gravityview' );
643 643
 				break;
644 644
 		}
645
-		$url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content='.$license_status.'&utm_campaign=Admin%20Notice';
645
+		$url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content=' . $license_status . '&utm_campaign=Admin%20Notice';
646 646
 
647 647
 		// Show a different notice on settings page for inactive licenses (hide the buttons)
648 648
 		if ( $update_below && gravityview_is_admin_page( '', 'settings' ) ) {
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 	public function scripts() {
687 687
 		$scripts = parent::scripts();
688 688
 
689
-		$scripts[] = array(
689
+		$scripts[ ] = array(
690 690
 			'handle'  => 'gform_tooltip_init',
691 691
 			'enqueue' => array(
692 692
                 array(
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
 	public function styles() {
706 706
 		$styles = parent::styles();
707 707
 
708
-		$styles[] = array(
708
+		$styles[ ] = array(
709 709
 			'handle'  => 'gravityview_settings',
710 710
 			'src'     => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ),
711 711
 			'version' => Plugin::$version,
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
 		 * If multisite and not network admin, we don't want the settings to show.
737 737
 		 * @since 1.7.6
738 738
 		 */
739
-		$show_submenu = ( ! is_multisite() ) ||  is_main_site() || ( ! gravityview()->plugin->is_network_activated() ) || ( is_network_admin() && gravityview()->plugin->is_network_activated() );
739
+		$show_submenu = ( ! is_multisite() ) || is_main_site() || ( ! gravityview()->plugin->is_network_activated() ) || ( is_network_admin() && gravityview()->plugin->is_network_activated() );
740 740
 
741 741
 		/**
742 742
 		 * Override whether to show the Settings menu on a per-blog basis.
@@ -784,26 +784,26 @@  discard block
 block discarded – undo
784 784
 				'label' => __( 'License Key', 'gravityview' ),
785 785
 				'description' => __( 'Enter the license key that was sent to you on purchase. This enables plugin updates &amp; support.', 'gravityview' ) . $this->get_license_handler()->license_details( $this->get_app_setting( 'license_key_response' ) ),
786 786
 				'type' => 'edd_license',
787
-				'disabled' => ( defined( 'GRAVITYVIEW_LICENSE_KEY' )  && GRAVITYVIEW_LICENSE_KEY ),
787
+				'disabled' => ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ),
788 788
 				'data-pending-text' => __( 'Verifying license&hellip;', 'gravityview' ),
789
-				'default_value' => $default_settings['license_key'],
789
+				'default_value' => $default_settings[ 'license_key' ],
790 790
 				'class' => ( '' == $this->get( 'license_key' ) ) ? 'activate code regular-text edd-license-key' : 'deactivate code regular-text edd-license-key',
791 791
 			),
792 792
 			array(
793 793
 				'name' => 'license_key_response',
794
-				'default_value' => $default_settings['license_key_response'],
794
+				'default_value' => $default_settings[ 'license_key_response' ],
795 795
 				'type' => 'hidden',
796 796
 			),
797 797
 			array(
798 798
 				'name' => 'license_key_status',
799
-				'default_value' => $default_settings['license_key_status'],
799
+				'default_value' => $default_settings[ 'license_key_status' ],
800 800
 				'type' => 'hidden',
801 801
 			),
802 802
 			array(
803 803
 				'name' => 'support-email',
804 804
 				'type' => 'text',
805 805
 				'validate' => 'email',
806
-				'default_value' => $default_settings['support-email'],
806
+				'default_value' => $default_settings[ 'support-email' ],
807 807
 				'label' => __( 'Support Email', 'gravityview' ),
808 808
 				'description' => __( 'In order to provide responses to your support requests, please provide your email address.', 'gravityview' ),
809 809
 				'class' => 'code regular-text',
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
 				'name' => 'support_port',
816 816
 				'type' => 'radio',
817 817
 				'label' => __( 'Show Support Port?', 'gravityview' ),
818
-				'default_value' => $default_settings['support_port'],
818
+				'default_value' => $default_settings[ 'support_port' ],
819 819
 				'horizontal' => 1,
820 820
 				'choices' => array(
821 821
 					array(
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
 				'name' => 'no-conflict-mode',
835 835
 				'type' => 'radio',
836 836
 				'label' => __( 'No-Conflict Mode', 'gravityview' ),
837
-				'default_value' => $default_settings['no-conflict-mode'],
837
+				'default_value' => $default_settings[ 'no-conflict-mode' ],
838 838
 				'horizontal' => 1,
839 839
 				'choices' => array(
840 840
 					array(
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
 					'name' => 'rest_api',
857 857
 					'type' => 'radio',
858 858
 					'label' => __( 'REST API', 'gravityview' ),
859
-					'default_value' => $default_settings['rest_api'],
859
+					'default_value' => $default_settings[ 'rest_api' ],
860 860
 					'horizontal' => 1,
861 861
 					'choices' => array(
862 862
 						array(
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
 				'name' => 'beta',
876 876
 				'type' => 'checkbox',
877 877
 				'label' => __( 'Become a Beta Tester', 'gravityview' ),
878
-				'default_value' => $default_settings['beta'],
878
+				'default_value' => $default_settings[ 'beta' ],
879 879
 				'horizontal' => 1,
880 880
 				'choices' => array(
881 881
 					array(
@@ -908,17 +908,17 @@  discard block
 block discarded – undo
908 908
 		 * @since 1.7.4
909 909
 		 */
910 910
 		foreach ( $fields as &$field ) {
911
-			$field['name']          = isset( $field['name'] ) ? $field['name'] : Utils::get( $field, 'id' );
912
-			$field['label']         = isset( $field['label'] ) ? $field['label'] : Utils::get( $field, 'title' );
913
-			$field['default_value'] = isset( $field['default_value'] ) ? $field['default_value'] : Utils::get( $field, 'default' );
914
-			$field['description']   = isset( $field['description'] ) ? $field['description'] : Utils::get( $field, 'subtitle' );
911
+			$field[ 'name' ]          = isset( $field[ 'name' ] ) ? $field[ 'name' ] : Utils::get( $field, 'id' );
912
+			$field[ 'label' ]         = isset( $field[ 'label' ] ) ? $field[ 'label' ] : Utils::get( $field, 'title' );
913
+			$field[ 'default_value' ] = isset( $field[ 'default_value' ] ) ? $field[ 'default_value' ] : Utils::get( $field, 'default' );
914
+			$field[ 'description' ]   = isset( $field[ 'description' ] ) ? $field[ 'description' ] : Utils::get( $field, 'subtitle' );
915 915
 
916 916
 			if ( $disabled_attribute ) {
917
-				$field['disabled']  = $disabled_attribute;
917
+				$field[ 'disabled' ] = $disabled_attribute;
918 918
 			}
919 919
 
920
-			if ( empty( $field['disabled'] ) ) {
921
-				unset( $field['disabled'] );
920
+			if ( empty( $field[ 'disabled' ] ) ) {
921
+				unset( $field[ 'disabled' ] );
922 922
             }
923 923
 		}
924 924
 
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
         );
937 937
 
938 938
 		if ( $disabled_attribute ) {
939
-			$button['disabled'] = $disabled_attribute;
939
+			$button[ 'disabled' ] = $disabled_attribute;
940 940
 		}
941 941
 
942 942
         /**
@@ -955,20 +955,20 @@  discard block
 block discarded – undo
955 955
 		// If there are extensions, add a section for them
956 956
 		if ( ! empty( $extension_sections ) ) {
957 957
 
958
-			if( $disabled_attribute ) {
958
+			if ( $disabled_attribute ) {
959 959
 				foreach ( $extension_sections as &$section ) {
960
-					foreach ( $section['fields'] as &$field ) {
961
-						$field['disabled'] = $disabled_attribute;
960
+					foreach ( $section[ 'fields' ] as &$field ) {
961
+						$field[ 'disabled' ] = $disabled_attribute;
962 962
 					}
963 963
 				}
964 964
 			}
965 965
 
966
-            $k = count( $extension_sections ) - 1 ;
967
-            $extension_sections[ $k ]['fields'][] = $button;
966
+            $k = count( $extension_sections ) - 1;
967
+            $extension_sections[ $k ][ 'fields' ][ ] = $button;
968 968
 			$sections = array_merge( $sections, $extension_sections );
969 969
 		} else {
970 970
             // add the 'update settings' button to the general section
971
-            $sections[0]['fields'][] = $button;
971
+            $sections[ 0 ][ 'fields' ][ ] = $button;
972 972
         }
973 973
 
974 974
 		return $sections;
@@ -1024,7 +1024,7 @@  discard block
 block discarded – undo
1024 1024
 	protected function settings_edd_license( $field, $echo = true ) {
1025 1025
 
1026 1026
 	    if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) {
1027
-		    $field['input_type'] = 'password';
1027
+		    $field[ 'input_type' ] = 'password';
1028 1028
         }
1029 1029
 
1030 1030
 		$text = $this->settings_text( $field, false );
@@ -1073,7 +1073,7 @@  discard block
 block discarded – undo
1073 1073
 	public function single_setting_row_html( $field ) {
1074 1074
 		?>
1075 1075
 
1076
-        <tr id="gaddon-setting-row-<?php echo esc_attr( $field['name'] ); ?>">
1076
+        <tr id="gaddon-setting-row-<?php echo esc_attr( $field[ 'name' ] ); ?>">
1077 1077
             <td colspan="2">
1078 1078
 				<?php $this->single_setting( $field ); ?>
1079 1079
             </td>
@@ -1091,10 +1091,10 @@  discard block
 block discarded – undo
1091 1091
 	 * @return string
1092 1092
 	 */
1093 1093
 	public function settings_save( $field, $echo = true ) {
1094
-		$field['type']  = 'submit';
1095
-		$field['name']  = 'gform-settings-save';
1096
-		$field['class'] = isset( $field['class'] ) ? $field['class'] : 'button-primary gfbutton';
1097
-		$field['value'] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) );
1094
+		$field[ 'type' ]  = 'submit';
1095
+		$field[ 'name' ]  = 'gform-settings-save';
1096
+		$field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] : 'button-primary gfbutton';
1097
+		$field[ 'value' ] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) );
1098 1098
 
1099 1099
 		$output = $this->settings_submit( $field, false );
1100 1100
 
@@ -1125,8 +1125,8 @@  discard block
 block discarded – undo
1125 1125
      * @return void
1126 1126
 	 */
1127 1127
 	public function single_setting_row( $field ) {
1128
-		$field['gv_description'] = Utils::get( $field, 'description' );
1129
-		$field['description']    = Utils::get( $field, 'subtitle' );
1128
+		$field[ 'gv_description' ] = Utils::get( $field, 'description' );
1129
+		$field[ 'description' ]    = Utils::get( $field, 'subtitle' );
1130 1130
 		parent::single_setting_row( $field );
1131 1131
 	}
1132 1132
 
@@ -1138,7 +1138,7 @@  discard block
 block discarded – undo
1138 1138
 	public function single_setting_label( $field ) {
1139 1139
 		parent::single_setting_label( $field );
1140 1140
 		if ( $description = Utils::get( $field, 'gv_description' ) ) {
1141
-			echo '<span class="description">'. $description .'</span>';
1141
+			echo '<span class="description">' . $description . '</span>';
1142 1142
 		}
1143 1143
 	}
1144 1144
 
@@ -1175,9 +1175,9 @@  discard block
 block discarded – undo
1175 1175
 		// If the posted key doesn't match the activated/deactivated key (set using the Activate License button, AJAX response),
1176 1176
 		// then we assume it's changed. If it's changed, unset the status and the previous response.
1177 1177
 		if ( $local_key !== $response_key ) {
1178
-			unset( $posted_settings['license_key_response'] );
1179
-			unset( $posted_settings['license_key_status'] );
1180
-			\GFCommon::add_error_message( __('The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) );
1178
+			unset( $posted_settings[ 'license_key_response' ] );
1179
+			unset( $posted_settings[ 'license_key_status' ] );
1180
+			\GFCommon::add_error_message( __( 'The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) );
1181 1181
 		}
1182 1182
 		return $posted_settings;
1183 1183
 	}
Please login to merge, or discard this patch.
future/includes/class-gv-license-handler.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 		);
101 101
 
102 102
 		if ( ! empty( $action ) ) {
103
-			$settings['edd_action'] = esc_attr( $action );
103
+			$settings[ 'edd_action' ] = esc_attr( $action );
104 104
 		}
105 105
 
106 106
 		return array_map( 'urlencode', $settings );
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 			'format' => 'json',
157 157
 		) );
158 158
 
159
-		if ( $is_ajax && empty( $data['license'] ) ) {
159
+		if ( $is_ajax && empty( $data[ 'license' ] ) ) {
160 160
 			die( -1 );
161 161
 		}
162 162
 
@@ -184,12 +184,12 @@  discard block
 block discarded – undo
184 184
 
185 185
 			$json = json_encode( $license_data );
186 186
 
187
-			$update_license = Utils::get( $data, 'update' ) || 'gravityview_license' === Utils::_POST('action');
187
+			$update_license = Utils::get( $data, 'update' ) || 'gravityview_license' === Utils::_POST( 'action' );
188 188
 
189 189
 			$is_check_action_button = ( 'check_license' === Utils::get( $data, 'edd_action' ) && defined( 'DOING_AJAX' ) && DOING_AJAX );
190 190
 
191 191
 			if ( 'deactivate_license' === Utils::get( $data, 'edd_action' ) ) {
192
-				do_action('gravityview/admin_installer/delete_downloads_data', true );
192
+				do_action( 'gravityview/admin_installer/delete_downloads_data', true );
193 193
 			}
194 194
 
195 195
 			if ( $is_check_action_button ) {
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 			// most likely a mistake.
202 202
 			} else if ( $license_data->license !== 'failed' && $update_license ) {
203 203
 
204
-				if ( ! empty( $data['field_id'] ) ) {
204
+				if ( ! empty( $data[ 'field_id' ] ) ) {
205 205
 					set_transient( self::status_transient_key, $license_data, DAY_IN_SECONDS );
206 206
 				}
207 207
 
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 		if ( empty( $license_data ) ) {
229 229
 			$message = '';
230 230
 		} else {
231
-			if( ! empty( $license_data->error ) ) {
231
+			if ( ! empty( $license_data->error ) ) {
232 232
 				$class = 'error';
233 233
 				$string_key = $license_data->error;
234 234
 			} else { $class = $license_data->license;
@@ -254,17 +254,17 @@  discard block
 block discarded – undo
254 254
 	 */
255 255
 	public function license_details( $response = array() ) {
256 256
 
257
-		$response = (array) $response;
257
+		$response = (array)$response;
258 258
 
259 259
 		$return = '';
260 260
 		$wrapper = '<span class="gv-license-details" aria-live="polite" aria-busy="false">%s</span>';
261 261
 
262
-		if ( ! empty( $response['license_key'] ) ) {
262
+		if ( ! empty( $response[ 'license_key' ] ) ) {
263 263
 			$return .= '<h3>' . esc_html__( 'License Details:', 'gravityview' ) . '</h3>';
264 264
 
265 265
 			if ( in_array( Utils::get( $response, 'license' ), array( 'invalid', 'deactivated' ) ) ) {
266
-				$return .= $this->strings( $response['license'], $response );
267
-			} elseif ( ! empty( $response['license_name'] ) ) {
266
+				$return .= $this->strings( $response[ 'license' ], $response );
267
+			} elseif ( ! empty( $response[ 'license_name' ] ) ) {
268 268
 				$response_keys = array(
269 269
 					'license_name'   => '',
270 270
 					'license_limit'  => '',
@@ -278,19 +278,19 @@  discard block
 block discarded – undo
278 278
 				// Make sure all the keys are set
279 279
 				$response = wp_parse_args( $response, $response_keys );
280 280
 
281
-				$login_link = sprintf( '<a href="%s" class="howto" rel="external">%s</a>', esc_url( sprintf( 'https://gravityview.co/wp-login.php?username=%s', $response['customer_email'] ) ), esc_html__( 'Access your GravityView account', 'gravityview' ) );
282
-				$local_text = ( ! empty( $response['is_local'] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' );
281
+				$login_link = sprintf( '<a href="%s" class="howto" rel="external">%s</a>', esc_url( sprintf( 'https://gravityview.co/wp-login.php?username=%s', $response[ 'customer_email' ] ) ), esc_html__( 'Access your GravityView account', 'gravityview' ) );
282
+				$local_text = ( ! empty( $response[ 'is_local' ] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' );
283 283
 				$details    = array(
284
-					'license'     => sprintf( esc_html__( 'License level: %s', 'gravityview' ), esc_html( $response['license_name'] ), esc_html( $response['license_limit'] ) ),
285
-					'licensed_to' => sprintf( esc_html_x( 'Licensed to: %1$s (%2$s)', '1: Customer name; 2: Customer email', 'gravityview' ), esc_html__( $response['customer_name'], 'gravityview' ), esc_html__( $response['customer_email'], 'gravityview' ) ) . $login_link,
286
-					'activations' => sprintf( esc_html__( 'Activations: %d of %s sites', 'gravityview' ), intval( $response['site_count'] ), esc_html( $response['license_limit'] ) ) . $local_text,
287
-					'expires'     => 'lifetime' === $response['expires'] ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response['expires'] ) - DAY_IN_SECONDS ) ),
288
-					'upgrade'     => $this->get_upgrade_html( $response['upgrades'] ),
284
+					'license'     => sprintf( esc_html__( 'License level: %s', 'gravityview' ), esc_html( $response[ 'license_name' ] ), esc_html( $response[ 'license_limit' ] ) ),
285
+					'licensed_to' => sprintf( esc_html_x( 'Licensed to: %1$s (%2$s)', '1: Customer name; 2: Customer email', 'gravityview' ), esc_html__( $response[ 'customer_name' ], 'gravityview' ), esc_html__( $response[ 'customer_email' ], 'gravityview' ) ) . $login_link,
286
+					'activations' => sprintf( esc_html__( 'Activations: %d of %s sites', 'gravityview' ), intval( $response[ 'site_count' ] ), esc_html( $response[ 'license_limit' ] ) ) . $local_text,
287
+					'expires'     => 'lifetime' === $response[ 'expires' ] ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response[ 'expires' ] ) - DAY_IN_SECONDS ) ),
288
+					'upgrade'     => $this->get_upgrade_html( $response[ 'upgrades' ] ),
289 289
 				);
290 290
 
291
-				if ( ! empty( $response['error'] ) && 'expired' === $response['error'] ) {
292
-					unset( $details['upgrade'] );
293
-					$details['expires'] = '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>';
291
+				if ( ! empty( $response[ 'error' ] ) && 'expired' === $response[ 'error' ] ) {
292
+					unset( $details[ 'upgrade' ] );
293
+					$details[ 'expires' ] = '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>';
294 294
 				}
295 295
 
296 296
 				$return .= '<ul><li>' . implode( '</li><li>', array_filter( $details ) ) . '</li></ul>';
@@ -316,20 +316,20 @@  discard block
 block discarded – undo
316 316
 		if ( ! empty( $upgrades ) ) {
317 317
 
318 318
 			$locale_parts = explode( '_', get_locale() );
319
-			$is_english = ( 'en' === $locale_parts[0] );
319
+			$is_english = ( 'en' === $locale_parts[ 0 ] );
320 320
 
321 321
 			$output .= '<h4>' . esc_html__( 'Upgrades available:', 'gravityview' ) . '</h4>';
322 322
 			$output .= '<ul class="ul-disc">';
323 323
 
324 324
 			foreach ( $upgrades as $upgrade_id => $upgrade ) {
325
-				$upgrade = (object) $upgrade;
325
+				$upgrade = (object)$upgrade;
326 326
 
327 327
 				$anchor_text = sprintf( esc_html_x( 'Upgrade to %1$s for %2$s', '1: GravityView upgrade name, 2: Cost of upgrade', 'gravityview' ), esc_attr( $upgrade->name ), esc_attr( $upgrade->price ) );
328 328
 
329 329
 				if ( $is_english && isset( $upgrade->description ) ) {
330 330
 					$message = esc_html( $upgrade->description );
331 331
 				} else {
332
-					switch( $upgrade->price_id ) {
332
+					switch ( $upgrade->price_id ) {
333 333
 						// Interstellar
334 334
 						case 1:
335 335
 						default:
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 			'invalid' => esc_html__( 'The license key entered is invalid.', 'gravityview' ),
389 389
 			'missing' => esc_html__( 'Invalid license key.', 'gravityview' ),
390 390
 			'revoked' => esc_html__( 'This license key has been revoked.', 'gravityview' ),
391
-			'expired' => sprintf( esc_html__( 'This license key has expired. %sRenew your license on the GravityView website%s to receive updates and support.', 'gravityview' ), '<a href="'. esc_url( $this->get_license_renewal_url( $license_data ) ) .'">', '</a>' ),
391
+			'expired' => sprintf( esc_html__( 'This license key has expired. %sRenew your license on the GravityView website%s to receive updates and support.', 'gravityview' ), '<a href="' . esc_url( $this->get_license_renewal_url( $license_data ) ) . '">', '</a>' ),
392 392
 			'capability' => esc_html__( 'You don\'t have the ability to edit plugin settings.', 'gravityview' ),
393 393
 
394 394
 			'verifying_license' => esc_html__( 'Verifying license&hellip;', 'gravityview' ),
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 
418 418
 		if ( ! empty( $license_data->renewal_url ) ) {
419 419
 			$renew_license_url = $license_data->renewal_url;
420
-		} elseif( ! empty( $license_data->license_key ) ) {
420
+		} elseif ( ! empty( $license_data->license_key ) ) {
421 421
 			$renew_license_url = sprintf( 'https://gravityview.co/checkout/?download_id=17&edd_license_key=%s', $license_data->license_key );
422 422
 		} else {
423 423
 			$renew_license_url = 'https://gravityview.co/account/';
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 	 * @return array|\WP_Error
435 435
 	 */
436 436
 	private function _license_get_remote_response( $data, $license = '' ) {
437
-		$api_params = $this->_get_edd_settings( $data['edd_action'], $license );
437
+		$api_params = $this->_get_edd_settings( $data[ 'edd_action' ], $license );
438 438
 
439 439
 		$url = add_query_arg( $api_params, self::url );
440 440
 
@@ -474,9 +474,9 @@  discard block
 block discarded – undo
474 474
 	private function license_call_update_settings( $license_data, $data ) {
475 475
 		$settings = array();
476 476
 
477
-        $settings['license_key'] = $license_data->license_key = trim( $data['license'] );
478
-		$settings['license_key_status'] = $license_data->license;
479
-		$settings['license_key_response'] = (array)$license_data;
477
+        $settings[ 'license_key' ] = $license_data->license_key = trim( $data[ 'license' ] );
478
+		$settings[ 'license_key_status' ] = $license_data->license;
479
+		$settings[ 'license_key_response' ] = (array)$license_data;
480 480
 
481 481
 		$this->settings->set( $settings );
482 482
 	}
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
 
492 492
 		if ( ! empty( $key ) ) {
493 493
 			$response = $this->settings->get( 'license_key_response' );
494
-			$response = is_array( $response ) ? (object) $response : json_decode( $response );
494
+			$response = is_array( $response ) ? (object)$response : json_decode( $response );
495 495
 		} else {
496 496
 			$response = array();
497 497
 		}
@@ -533,11 +533,11 @@  discard block
 block discarded – undo
533 533
 
534 534
 		$submit = '<div class="gv-edd-button-wrapper">';
535 535
 		foreach ( $fields as $field ) {
536
-			$field['type'] = 'button';
537
-			$field['class'] = isset( $field['class'] ) ? $field['class'] . ' '. $class : $class;
538
-			$field['style'] = 'margin-left: 10px;';
539
-			if( $disabled_attribute ) {
540
-				$field['disabled'] = $disabled_attribute;
536
+			$field[ 'type' ] = 'button';
537
+			$field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] . ' ' . $class : $class;
538
+			$field[ 'style' ] = 'margin-left: 10px;';
539
+			if ( $disabled_attribute ) {
540
+				$field[ 'disabled' ] = $disabled_attribute;
541 541
 			}
542 542
 			$submit .= $this->settings->as_html( $field, $echo );
543 543
 		}
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
 				    'url'        => home_url(),
617 617
 				    'site_data'  => $this->get_site_data(),
618 618
 			    ),
619
-			));
619
+			) );
620 620
 
621 621
 			// make sure the response came back okay
622 622
 			if ( is_wp_error( $response ) ) {
@@ -647,45 +647,45 @@  discard block
 block discarded – undo
647 647
 		$theme_data = wp_get_theme();
648 648
 		$theme      = $theme_data->Name . ' ' . $theme_data->Version;
649 649
 
650
-		$data['gv_version']  = Plugin::$version;
651
-		$data['php_version']  = phpversion();
652
-		$data['wp_version']   = get_bloginfo( 'version' );
653
-		$data['gf_version']  = \GFForms::$version;
654
-		$data['server']       = Utils::get( $_SERVER, 'SERVER_SOFTWARE' );
655
-		$data['multisite']    = is_multisite();
656
-		$data['theme']        = $theme;
657
-		$data['url']          = home_url();
658
-		$data['license_key']  = $this->settings->get( 'license_key' );
659
-		$data['beta']         = $this->settings->get( 'beta' );
650
+		$data[ 'gv_version' ]  = Plugin::$version;
651
+		$data[ 'php_version' ]  = phpversion();
652
+		$data[ 'wp_version' ]   = get_bloginfo( 'version' );
653
+		$data[ 'gf_version' ]  = \GFForms::$version;
654
+		$data[ 'server' ]       = Utils::get( $_SERVER, 'SERVER_SOFTWARE' );
655
+		$data[ 'multisite' ]    = is_multisite();
656
+		$data[ 'theme' ]        = $theme;
657
+		$data[ 'url' ]          = home_url();
658
+		$data[ 'license_key' ]  = $this->settings->get( 'license_key' );
659
+		$data[ 'beta' ]         = $this->settings->get( 'beta' );
660 660
 
661 661
 		// View Data
662 662
 		$gravityview_posts = wp_count_posts( 'gravityview', 'readable' );
663 663
 
664
-		$data['view_count'] = null;
665
-		$data['view_first'] = null;
666
-		$data['view_latest'] = null;
664
+		$data[ 'view_count' ] = null;
665
+		$data[ 'view_first' ] = null;
666
+		$data[ 'view_latest' ] = null;
667 667
 
668 668
 		if ( $gravityview_posts->publish ) {
669
-			$data['view_count'] = $gravityview_posts->publish;
669
+			$data[ 'view_count' ] = $gravityview_posts->publish;
670 670
 
671 671
 			$first = get_posts( 'numberposts=1&post_type=gravityview&post_status=publish&order=ASC' );
672 672
 			$latest = get_posts( 'numberposts=1&post_type=gravityview&post_status=publish&order=DESC' );
673 673
 
674 674
 			if ( $first = array_shift( $first ) ) {
675
-				$data['view_first'] = $first->post_date;
675
+				$data[ 'view_first' ] = $first->post_date;
676 676
 			}
677 677
 			if ( $latest = array_pop( $latest ) ) {
678
-				$data['view_latest'] = $latest->post_date;
678
+				$data[ 'view_latest' ] = $latest->post_date;
679 679
 			}
680 680
 		}
681 681
 
682 682
 		// Form counts
683 683
 		if ( class_exists( 'GFFormsModel' ) ) {
684 684
 			$form_data = \GFFormsModel::get_form_count();
685
-			$data['forms_total'] = Utils::get( $form_data, 'total', 0 );
686
-			$data['forms_active'] = Utils::get( $form_data, 'active', 0 );
687
-			$data['forms_inactive'] = Utils::get( $form_data, 'inactive', 0 );
688
-			$data['forms_trash'] = Utils::get( $form_data, 'inactive', 0 );
685
+			$data[ 'forms_total' ] = Utils::get( $form_data, 'total', 0 );
686
+			$data[ 'forms_active' ] = Utils::get( $form_data, 'active', 0 );
687
+			$data[ 'forms_inactive' ] = Utils::get( $form_data, 'inactive', 0 );
688
+			$data[ 'forms_trash' ] = Utils::get( $form_data, 'inactive', 0 );
689 689
 		}
690 690
 
691 691
 		// Retrieve current plugin information
@@ -693,13 +693,13 @@  discard block
 block discarded – undo
693 693
 			include ABSPATH . '/wp-admin/includes/plugin.php';
694 694
 		}
695 695
 
696
-		$data['integrations']     = self::get_related_plugins_and_extensions();
697
-		$data['active_plugins']   = get_option( 'active_plugins', array() );
698
-		$data['inactive_plugins'] = array();
699
-		$data['locale']           = get_locale();
696
+		$data[ 'integrations' ]     = self::get_related_plugins_and_extensions();
697
+		$data[ 'active_plugins' ]   = get_option( 'active_plugins', array() );
698
+		$data[ 'inactive_plugins' ] = array();
699
+		$data[ 'locale' ]           = get_locale();
700 700
 
701 701
 		// Validate request on the GV server
702
-		$data['hash']             = 'gv_version.url.locale:' . sha1( $data['gv_version'] . $data['url'] . $data['locale'] );
702
+		$data[ 'hash' ]             = 'gv_version.url.locale:' . sha1( $data[ 'gv_version' ] . $data[ 'url' ] . $data[ 'locale' ] );
703 703
 
704 704
 		return $data;
705 705
 	}
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
 
730 730
 				$plugin_data = get_plugin_data( $active_plugin );
731 731
 
732
-				$extensions[] = sprintf( '%s %s', $plugin_data['Name'], $plugin_data['Version'] );
732
+				$extensions[ ] = sprintf( '%s %s', $plugin_data[ 'Name' ], $plugin_data[ 'Version' ] );
733 733
 			}
734 734
 
735 735
 			if ( ! empty( $extensions ) ) {
Please login to merge, or discard this patch.