Completed
Pull Request — develop (#1157)
by Zack
15:42
created
includes/widgets/search-widget/templates/search-field-entry_date.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@
 block discarded – undo
7 7
 
8 8
 $gravityview_view = GravityView_View::getInstance();
9 9
 $view_id = $gravityview_view->getViewId();
10
-$value = $gravityview_view->search_field['value'];
11
-$label = $gravityview_view->search_field['label'];
10
+$value = $gravityview_view->search_field[ 'value' ];
11
+$label = $gravityview_view->search_field[ 'label' ];
12 12
 
13 13
 ?>
14 14
 
15 15
 <div class="gv-search-box gv-search-date gv-search-date-range gv-search-field-entry_date">
16
-	<?php if( ! gv_empty( $label, false, false ) ) { ?>
16
+	<?php if ( ! gv_empty( $label, false, false ) ) { ?>
17 17
 	<label for="gv_start_date_<?php echo $view_id; ?>"><?php echo esc_html( $label ); ?></label>
18 18
 	<?php } ?>
19 19
 	<p>
20
-		<input name="gv_start" id="gv_start_date_<?php echo $view_id; ?>" type="text" class="<?php echo esc_attr( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e('Start date', 'gravityview' ); ?>" value="<?php echo $value['start']; ?>">
21
-		<input name="gv_end" id="gv_end_date_<?php echo $view_id; ?>" type="text" class="<?php echo esc_attr( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e('End date', 'gravityview' ); ?>" value="<?php echo $value['end']; ?>">
20
+		<input name="gv_start" id="gv_start_date_<?php echo $view_id; ?>" type="text" class="<?php echo esc_attr( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e( 'Start date', 'gravityview' ); ?>" value="<?php echo $value[ 'start' ]; ?>">
21
+		<input name="gv_end" id="gv_end_date_<?php echo $view_id; ?>" type="text" class="<?php echo esc_attr( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e( 'End date', 'gravityview' ); ?>" value="<?php echo $value[ 'end' ]; ?>">
22 22
 	</p>
23 23
 </div>
24 24
\ No newline at end of file
Please login to merge, or discard this patch.
includes/widgets/search-widget/templates/search-field-date_range.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@
 block discarded – undo
7 7
 
8 8
 $gravityview_view = GravityView_View::getInstance();
9 9
 $view_id = $gravityview_view->getViewId();
10
-$value = $gravityview_view->search_field['value'];
11
-$label = $gravityview_view->search_field['label'];
12
-$name = $gravityview_view->search_field['name'];
10
+$value = $gravityview_view->search_field[ 'value' ];
11
+$label = $gravityview_view->search_field[ 'label' ];
12
+$name = $gravityview_view->search_field[ 'name' ];
13 13
 ?>
14 14
 
15 15
 <div class="gv-search-box gv-search-date gv-search-date-range">
16
-	<?php if( ! gv_empty( $label, false, false ) ) { ?>
17
-	<label for="search-box-<?php echo esc_attr( $name ).'-start'; ?>"><?php echo esc_html( $label ); ?></label>
16
+	<?php if ( ! gv_empty( $label, false, false ) ) { ?>
17
+	<label for="search-box-<?php echo esc_attr( $name ) . '-start'; ?>"><?php echo esc_html( $label ); ?></label>
18 18
 	<?php } ?>
19 19
 	<p>
20
-		<input name="<?php echo esc_attr( $name ).'[start]'; ?>" id="search-box-<?php echo esc_attr( $name ).'-start'; ?>" type="text" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e('Start date', 'gravityview' ); ?>" value="<?php echo esc_attr( $value['start'] ); ?>">
21
-		<input name="<?php echo esc_attr( $name ).'[end]'; ?>" id="search-box-<?php echo esc_attr( $name ).'-end'; ?>" type="text" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e('End date', 'gravityview' ); ?>" value="<?php echo esc_attr( $value['end'] ); ?>">
20
+		<input name="<?php echo esc_attr( $name ) . '[start]'; ?>" id="search-box-<?php echo esc_attr( $name ) . '-start'; ?>" type="text" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e( 'Start date', 'gravityview' ); ?>" value="<?php echo esc_attr( $value[ 'start' ] ); ?>">
21
+		<input name="<?php echo esc_attr( $name ) . '[end]'; ?>" id="search-box-<?php echo esc_attr( $name ) . '-end'; ?>" type="text" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e( 'End date', 'gravityview' ); ?>" value="<?php echo esc_attr( $value[ 'end' ] ); ?>">
22 22
 	</p>
23 23
 </div>
24 24
\ No newline at end of file
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.
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-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/rest/class-gv-rest-route.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
 		$format = '(?:\.(?P<format>html|json))?';
134 134
 
135
-		register_rest_route( $namespace, sprintf( '/%s/(?P<id>[\d]+)/%s/(?P<s_id>[\w-]+)%s', $base, $sub_type, $format ) , array(
135
+		register_rest_route( $namespace, sprintf( '/%s/(?P<id>[\d]+)/%s/(?P<s_id>[\w-]+)%s', $base, $sub_type, $format ), array(
136 136
 			array(
137 137
 				'methods'         => \WP_REST_Server::READABLE,
138 138
 				'callback'        => array( $this, 'get_sub_item' ),
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 	 * @return \WP_REST_Response
384 384
 	 */
385 385
 	protected function not_implemented(  ) {
386
-		$error = new \WP_Error( 'not-implemented-yet', __( 'Endpoint Not Yet Implemented.', 'gravityview' )  );
386
+		$error = new \WP_Error( 'not-implemented-yet', __( 'Endpoint Not Yet Implemented.', 'gravityview' ) );
387 387
 		return new \WP_REST_Response( $error, 501 );
388 388
 	}
389 389
 
Please login to merge, or discard this patch.
includes/class-gravityview-shortcode.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 		gravityview()->log->debug( '$passed_atts: ', array( 'data' => $passed_atts ) );
49 49
 
50 50
 		// Get details about the current View
51
-		if( !empty( $passed_atts['detail'] ) ) {
52
-			return $this->get_view_detail( $passed_atts['detail'] );
51
+		if ( ! empty( $passed_atts[ 'detail' ] ) ) {
52
+			return $this->get_view_detail( $passed_atts[ 'detail' ] );
53 53
 		}
54 54
 
55 55
 		$atts = $this->parse_and_sanitize_atts( $passed_atts );
@@ -85,16 +85,16 @@  discard block
 block discarded – undo
85 85
 		$filtered_atts = shortcode_atts( $supported_atts, $passed_atts, 'gravityview' );
86 86
 
87 87
 		// Only keep the passed attributes after making sure that they're valid pairs
88
-		$filtered_atts = array_intersect_key( (array) $passed_atts, $filtered_atts );
88
+		$filtered_atts = array_intersect_key( (array)$passed_atts, $filtered_atts );
89 89
 
90 90
 		$atts = array();
91 91
 
92
-		foreach( $filtered_atts as $key => $passed_value ) {
92
+		foreach ( $filtered_atts as $key => $passed_value ) {
93 93
 
94 94
 			// Allow using GravityView merge tags in shortcode attributes, like {get} and {created_by}
95 95
 			$passed_value = GravityView_Merge_Tags::replace_variables( $passed_value );
96 96
 
97
-			switch( $defaults[ $key ]['type'] ) {
97
+			switch ( $defaults[ $key ][ 'type' ] ) {
98 98
 
99 99
 				/**
100 100
 				 * Make sure number fields are numeric.
@@ -102,14 +102,14 @@  discard block
 block discarded – undo
102 102
 				 * @see http://php.net/manual/en/function.is-numeric.php#107326
103 103
 				 */
104 104
 				case 'number':
105
-					if( is_numeric( $passed_value ) ) {
105
+					if ( is_numeric( $passed_value ) ) {
106 106
 						$atts[ $key ] = ( $passed_value + 0 );
107 107
 					}
108 108
 					break;
109 109
 
110 110
 				/** @since 2.1 */
111 111
 				case 'operator':
112
-					if( GFFormsModel::is_valid_operator( $passed_value ) ) {
112
+					if ( GFFormsModel::is_valid_operator( $passed_value ) ) {
113 113
 						$atts[ $key ] = $passed_value;
114 114
 					}
115 115
 					break;
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
 				 */
125 125
 				case 'select':
126 126
 				case 'radio':
127
-					$options = isset( $defaults[ $key ]['choices'] ) ? $defaults[ $key ]['choices'] : $defaults[ $key ]['options'];
128
-					if( in_array( $passed_value, array_keys( $options ) ) ) {
127
+					$options = isset( $defaults[ $key ][ 'choices' ] ) ? $defaults[ $key ][ 'choices' ] : $defaults[ $key ][ 'options' ];
128
+					if ( in_array( $passed_value, array_keys( $options ) ) ) {
129 129
 						$atts[ $key ] = $passed_value;
130 130
 					}
131 131
 					break;
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 		$gravityview_view = GravityView_View::getInstance();
155 155
 		$return = '';
156 156
 
157
-		switch( $detail ) {
157
+		switch ( $detail ) {
158 158
 			case 'total_entries':
159 159
 				$return = number_format_i18n( $gravityview_view->getTotalEntries() );
160 160
 				break;
Please login to merge, or discard this patch.
future/includes/class-gv-template-entry-list.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -57,13 +57,13 @@
 block discarded – undo
57 57
 		$hide_empty = apply_filters( 'gravityview/render/hide-empty-zone', Utils::get( $extras, 'hide_empty', $this->view->settings->get( 'hide_empty', false ) ), $context );
58 58
 
59 59
 		if ( is_numeric( $field->ID ) ) {
60
-			$extras['field'] = $field->as_configuration();
60
+			$extras[ 'field' ] = $field->as_configuration();
61 61
 		}
62 62
 
63
-		$extras['entry'] = $this->entry->as_entry();
64
-		$extras['hide_empty'] = $hide_empty;
65
-		$extras['label'] = $label;
66
-		$extras['value'] = $value;
63
+		$extras[ 'entry' ] = $this->entry->as_entry();
64
+		$extras[ 'hide_empty' ] = $hide_empty;
65
+		$extras[ 'label' ] = $label;
66
+		$extras[ 'value' ] = $value;
67 67
 
68 68
 		return \gravityview_field_output( $extras, $context );
69 69
 	}
Please login to merge, or discard this patch.