Completed
Pull Request — develop (#1742)
by
unknown
18:44
created
future/includes/class-gv-settings-addon.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 		$setting_tabs = parent::get_app_settings_tabs();
119 119
 
120 120
 		foreach ( $setting_tabs as &$tab ) {
121
-			if ( 'uninstall' !== $tab['name'] ) {
121
+			if ( 'uninstall' !== $tab[ 'name' ] ) {
122 122
 				continue;
123 123
 			}
124 124
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 			}
130 130
 
131 131
 			// Add trash can icon to resemble the look and feel of the GF Settings page
132
-			$tab['icon'] = 'dashicons-trash';
132
+			$tab[ 'icon' ] = 'dashicons-trash';
133 133
 		}
134 134
 
135 135
 		return array_filter( $setting_tabs );
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
 	 */
145 145
 	public function register_no_conflict( $items ) {
146 146
 
147
-		$items[] = 'gform_settings';
148
-		$items[] = 'gv-admin-edd-license';
147
+		$items[ ] = 'gform_settings';
148
+		$items[ ] = 'gv-admin-edd-license';
149 149
 
150 150
 		return $items;
151 151
 	}
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 
197 197
 		$href = add_query_arg( array( 'post_type' => 'gravityview', 'page' => 'gravityview_settings', 'view' => 'uninstall' ), admin_url( 'edit.php' ) );
198 198
 
199
-		$uninstall_button = '<a href="' . esc_url( $href ) . '" class="' . gravityview_sanitize_html_class( $html_class ). '">' . esc_html__( 'Uninstall GravityView', 'gravityview' ) . '</a>';
199
+		$uninstall_button = '<a href="' . esc_url( $href ) . '" class="' . gravityview_sanitize_html_class( $html_class ) . '">' . esc_html__( 'Uninstall GravityView', 'gravityview' ) . '</a>';
200 200
 
201 201
 		$html .= $uninstall_button;
202 202
 
@@ -215,10 +215,10 @@  discard block
 block discarded – undo
215 215
 	 */
216 216
 	public function settings_save( $field, $echo = true ) {
217 217
 
218
-		$field['type']  = 'submit';
219
-		$field['name']  = 'gform-settings-save';
220
-		$field['class'] = 'button button-primary primary button-hero';
221
-		$field['value'] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) );
218
+		$field[ 'type' ]  = 'submit';
219
+		$field[ 'name' ]  = 'gform-settings-save';
220
+		$field[ 'class' ] = 'button button-primary primary button-hero';
221
+		$field[ 'value' ] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) );
222 222
 
223 223
 		$html = $this->as_html( $field, false );
224 224
 
@@ -240,8 +240,8 @@  discard block
 block discarded – undo
240 240
 	 */
241 241
 	public function modify_app_settings_menu_title( $setting_tabs ) {
242 242
 
243
-		$setting_tabs[0]['label'] = __( 'GravityView Settings', 'gravityview' );
244
-		$setting_tabs[0]['icon']  = 'dashicons-admin-settings';
243
+		$setting_tabs[ 0 ][ 'label' ] = __( 'GravityView Settings', 'gravityview' );
244
+		$setting_tabs[ 0 ][ 'icon' ]  = 'dashicons-admin-settings';
245 245
 
246 246
 		return $setting_tabs;
247 247
 	}
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 					$i = 0;
490 490
 					while ( $i < 11 ) {
491 491
 						echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_' . $i . '" value="' . $i . '" type="radio"> ' . $i . '</label></li>';
492
-						$i ++;
492
+						$i++;
493 493
 					}
494 494
 					?>
495 495
 				</ul>
@@ -695,14 +695,14 @@  discard block
 block discarded – undo
695 695
 	 */
696 696
 	public function as_html( $field, $echo = true ) {
697 697
 
698
-		$field['type'] = ( isset( $field['type'] ) && in_array( $field['type'], array( 'submit', 'reset', 'button' ) ) ) ? $field['type'] : 'submit';
698
+		$field[ 'type' ] = ( isset( $field[ 'type' ] ) && in_array( $field[ 'type' ], array( 'submit', 'reset', 'button' ) ) ) ? $field[ 'type' ] : 'submit';
699 699
 
700 700
 		$attributes    = $this->get_field_attributes( $field );
701 701
 		$default_value = Utils::get( $field, 'value', Utils::get( $field, 'default_value' ) );
702
-		$value         = $this->get( $field['name'], $default_value );
702
+		$value         = $this->get( $field[ 'name' ], $default_value );
703 703
 
704
-		$attributes['class'] = isset( $attributes['class'] ) ? esc_attr( $attributes['class'] ) : 'button-primary primary gfbutton';
705
-		$name                = ( $field['name'] === 'gform-settings-save' ) ? $field['name'] : '_gaddon_setting_' . $field['name'];
704
+		$attributes[ 'class' ] = isset( $attributes[ 'class' ] ) ? esc_attr( $attributes[ 'class' ] ) : 'button-primary primary gfbutton';
705
+		$name                = ( $field[ 'name' ] === 'gform-settings-save' ) ? $field[ 'name' ] : '_gaddon_setting_' . $field[ 'name' ];
706 706
 
707 707
 		if ( empty( $value ) ) {
708 708
 			$value = __( 'Update Settings', 'gravityview' );
@@ -711,7 +711,7 @@  discard block
 block discarded – undo
711 711
 		$attributes = $this->get_field_attributes( $field );
712 712
 
713 713
 		$html = '<input
714
-                    type="' . $field['type'] . '"
714
+                    type="' . $field[ 'type' ] . '"
715 715
                     name="' . esc_attr( $name ) . '"
716 716
                     value="' . $value . '" ' .
717 717
 				implode( ' ', $attributes ) .
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
 	 */
746 746
 	public function is_save_postback() {
747 747
 
748
-		return isset( $_POST['gform-settings-save'] ) && isset( $_POST['_gravityview_save_settings_nonce'] );
748
+		return isset( $_POST[ 'gform-settings-save' ] ) && isset( $_POST[ '_gravityview_save_settings_nonce' ] );
749 749
 	}
750 750
 
751 751
 	/**
@@ -862,7 +862,7 @@  discard block
 block discarded – undo
862 862
 
863 863
 		$scripts = parent::scripts();
864 864
 
865
-		$scripts[] = array(
865
+		$scripts[ ] = array(
866 866
 				'handle'  => 'gform_tooltip_init',
867 867
 				'enqueue' => array(
868 868
 						array(
@@ -890,11 +890,11 @@  discard block
 block discarded – undo
890 890
 		);
891 891
 
892 892
 		// This file was removed from 2.5
893
-		if( ! gravityview()->plugin->is_GF_25() ) {
894
-			$deps[] = 'gform_tooltip';
893
+		if ( ! gravityview()->plugin->is_GF_25() ) {
894
+			$deps[ ] = 'gform_tooltip';
895 895
 		}
896 896
 
897
-		$styles[] = array(
897
+		$styles[ ] = array(
898 898
 			'handle'  => 'gravityview_settings',
899 899
 			'src'     => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ),
900 900
 			'version' => Plugin::$version,
@@ -981,7 +981,7 @@  discard block
 block discarded – undo
981 981
 						'name'          => 'support-email',
982 982
 						'type'          => 'text',
983 983
 						'validate'      => 'email',
984
-						'default_value' => $default_settings['support-email'],
984
+						'default_value' => $default_settings[ 'support-email' ],
985 985
 						'label'         => __( 'Support Email', 'gravityview' ),
986 986
 						'description'   => __( 'In order to provide responses to your support requests, please provide your email address.', 'gravityview' ),
987 987
 						'class'         => 'code regular-text',
@@ -993,7 +993,7 @@  discard block
 block discarded – undo
993 993
 						'name'          => 'support_port',
994 994
 						'type'          => 'radio',
995 995
 						'label'         => __( 'Show Support Port?', 'gravityview' ),
996
-						'default_value' => $default_settings['support_port'],
996
+						'default_value' => $default_settings[ 'support_port' ],
997 997
 						'horizontal'    => 1,
998 998
 						'choices'       => array(
999 999
 								array(
@@ -1012,7 +1012,7 @@  discard block
 block discarded – undo
1012 1012
 						'name'          => 'no-conflict-mode',
1013 1013
 						'type'          => 'radio',
1014 1014
 						'label'         => __( 'No-Conflict Mode', 'gravityview' ),
1015
-						'default_value' => $default_settings['no-conflict-mode'],
1015
+						'default_value' => $default_settings[ 'no-conflict-mode' ],
1016 1016
 						'horizontal'    => 1,
1017 1017
 						'choices'       => array(
1018 1018
 								array(
@@ -1030,7 +1030,7 @@  discard block
 block discarded – undo
1030 1030
 						'name'          => 'public-approval-link',
1031 1031
 						'type'          => 'radio',
1032 1032
 						'label'         => __( 'Public Approval Link', 'gravityview' ),
1033
-						'default_value' => $default_settings['public-approval-link'],
1033
+						'default_value' => $default_settings[ 'public-approval-link' ],
1034 1034
 						'horizontal'    => 1,
1035 1035
 						'choices'       => array(
1036 1036
 								array(
@@ -1052,7 +1052,7 @@  discard block
 block discarded – undo
1052 1052
 								'name'          => 'rest_api',
1053 1053
 								'type'          => 'radio',
1054 1054
 								'label'         => __( 'REST API', 'gravityview' ),
1055
-								'default_value' => $default_settings['rest_api'],
1055
+								'default_value' => $default_settings[ 'rest_api' ],
1056 1056
 								'horizontal'    => 1,
1057 1057
 								'choices'       => array(
1058 1058
 										array(
@@ -1071,7 +1071,7 @@  discard block
 block discarded – undo
1071 1071
 					'name' => 'powered_by',
1072 1072
 					'type' => 'checkbox',
1073 1073
 					'label' => __( 'Display "Powered By" Link', 'gravityview' ),
1074
-					'default_value' => $default_settings['powered_by'],
1074
+					'default_value' => $default_settings[ 'powered_by' ],
1075 1075
 					'choices' => array(
1076 1076
 						array(
1077 1077
 							'label' => esc_html__( 'Display a "Powered by GravityView" link', 'gravityview' ),
@@ -1096,7 +1096,7 @@  discard block
 block discarded – undo
1096 1096
 						'name'          => 'beta',
1097 1097
 						'type'          => 'checkbox',
1098 1098
 						'label'         => __( 'Become a Beta Tester', 'gravityview' ),
1099
-						'default_value' => $default_settings['beta'],
1099
+						'default_value' => $default_settings[ 'beta' ],
1100 1100
 						'horizontal'    => 1,
1101 1101
 						'choices'       => array(
1102 1102
 								array(
@@ -1130,17 +1130,17 @@  discard block
 block discarded – undo
1130 1130
 		 * @since 1.7.4
1131 1131
 		 */
1132 1132
 		foreach ( $fields as &$field ) {
1133
-			$field['name']          = isset( $field['name'] ) ? $field['name'] : Utils::get( $field, 'id' );
1134
-			$field['label']         = isset( $field['label'] ) ? $field['label'] : Utils::get( $field, 'title' );
1135
-			$field['default_value'] = isset( $field['default_value'] ) ? $field['default_value'] : Utils::get( $field, 'default' );
1136
-			$field['description']   = isset( $field['description'] ) ? $field['description'] : Utils::get( $field, 'subtitle' );
1133
+			$field[ 'name' ]          = isset( $field[ 'name' ] ) ? $field[ 'name' ] : Utils::get( $field, 'id' );
1134
+			$field[ 'label' ]         = isset( $field[ 'label' ] ) ? $field[ 'label' ] : Utils::get( $field, 'title' );
1135
+			$field[ 'default_value' ] = isset( $field[ 'default_value' ] ) ? $field[ 'default_value' ] : Utils::get( $field, 'default' );
1136
+			$field[ 'description' ]   = isset( $field[ 'description' ] ) ? $field[ 'description' ] : Utils::get( $field, 'subtitle' );
1137 1137
 
1138 1138
 			if ( $disabled_attribute ) {
1139
-				$field['disabled'] = $disabled_attribute;
1139
+				$field[ 'disabled' ] = $disabled_attribute;
1140 1140
 			}
1141 1141
 
1142
-			if ( empty( $field['disabled'] ) ) {
1143
-				unset( $field['disabled'] );
1142
+			if ( empty( $field[ 'disabled' ] ) ) {
1143
+				unset( $field[ 'disabled' ] );
1144 1144
 			}
1145 1145
 		}
1146 1146
 
@@ -1152,23 +1152,23 @@  discard block
 block discarded – undo
1152 1152
 					'description' => __( 'Enter the license key that was sent to you on purchase. This enables plugin updates &amp; support.', 'gravityview' ),
1153 1153
 					'type' => 'edd_license',
1154 1154
 					'data-pending-text' => __( 'Verifying license&hellip;', 'gravityview' ),
1155
-					'default_value' => $default_settings['license_key'],
1155
+					'default_value' => $default_settings[ 'license_key' ],
1156 1156
 					'class' => ( '' == $this->get( 'license_key' ) ) ? 'activate code regular-text edd-license-key' : 'deactivate code regular-text edd-license-key',
1157 1157
 			),
1158 1158
 			array(
1159 1159
 					'name' => 'license_key_response',
1160
-					'default_value' => $default_settings['license_key_response'],
1160
+					'default_value' => $default_settings[ 'license_key_response' ],
1161 1161
 					'type' => 'hidden',
1162 1162
 			),
1163 1163
 			array(
1164 1164
 					'name' => 'license_key_status',
1165
-					'default_value' => $default_settings['license_key_status'],
1165
+					'default_value' => $default_settings[ 'license_key_status' ],
1166 1166
 					'type' => 'hidden',
1167 1167
 			),
1168 1168
 		);
1169 1169
 
1170 1170
 		if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) {
1171
-			$license_fields[0] = array_merge( $license_fields[0], array(
1171
+			$license_fields[ 0 ] = array_merge( $license_fields[ 0 ], array(
1172 1172
 				'disabled' => true,
1173 1173
 				'title'    => __( 'The license key is defined by your site\'s configuration file.', 'gravityview' ),
1174 1174
 			) );
@@ -1179,7 +1179,7 @@  discard block
 block discarded – undo
1179 1179
 
1180 1180
 		if ( \gravityview()->plugin->is_GF_25() ) {
1181 1181
 
1182
-			$sections[] = array(
1182
+			$sections[ ] = array(
1183 1183
 					'title'       => __( 'GravityView License', 'gravityview' ),
1184 1184
 					'class'       => 'gform-settings-panel--full gv-settings-panel--license',
1185 1185
 					'description' => $version_info,
@@ -1197,7 +1197,7 @@  discard block
 block discarded – undo
1197 1197
 			) );
1198 1198
 		}
1199 1199
 
1200
-		$sections[] = array(
1200
+		$sections[ ] = array(
1201 1201
 			'title' => ( gravityview()->plugin->is_GF_25() ? __( 'GravityView Settings', 'gravityview' ) : null ),
1202 1202
 			'class' => 'gform-settings-panel--full gv-settings-panel--core',
1203 1203
 			'fields'      => $fields,
@@ -1221,8 +1221,8 @@  discard block
 block discarded – undo
1221 1221
 
1222 1222
 			if ( $disabled_attribute ) {
1223 1223
 				foreach ( $extension_sections as &$section ) {
1224
-					foreach ( $section['fields'] as &$field ) {
1225
-						$field['disabled'] = $disabled_attribute;
1224
+					foreach ( $section[ 'fields' ] as &$field ) {
1225
+						$field[ 'disabled' ] = $disabled_attribute;
1226 1226
 					}
1227 1227
 				}
1228 1228
 			}
@@ -1288,7 +1288,7 @@  discard block
 block discarded – undo
1288 1288
 	public function settings_edd_license( $field, $echo = true ) {
1289 1289
 
1290 1290
 		if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) {
1291
-			$field['input_type'] = 'password';
1291
+			$field[ 'input_type' ] = 'password';
1292 1292
 		}
1293 1293
 
1294 1294
 		$text = $this->settings_text( $field, false );
@@ -1340,7 +1340,7 @@  discard block
 block discarded – undo
1340 1340
 
1341 1341
 		?>
1342 1342
 
1343
-		<tr id="gaddon-setting-row-<?php echo esc_attr( $field['name'] ); ?>">
1343
+		<tr id="gaddon-setting-row-<?php echo esc_attr( $field[ 'name' ] ); ?>">
1344 1344
 			<td colspan="2">
1345 1345
 				<?php $this->single_setting( $field ); ?>
1346 1346
 			</td>
@@ -1366,8 +1366,8 @@  discard block
 block discarded – undo
1366 1366
 	 */
1367 1367
 	public function single_setting_row( $field ) {
1368 1368
 
1369
-		$field['gv_description'] = Utils::get( $field, 'description' );
1370
-		$field['description']    = Utils::get( $field, 'subtitle' );
1369
+		$field[ 'gv_description' ] = Utils::get( $field, 'description' );
1370
+		$field[ 'description' ]    = Utils::get( $field, 'subtitle' );
1371 1371
 		parent::single_setting_row( $field );
1372 1372
 	}
1373 1373
 
@@ -1428,8 +1428,8 @@  discard block
 block discarded – undo
1428 1428
 		// then we assume it's changed. If it's changed, unset the status and the previous response.
1429 1429
 		if ( ! $added_message && ( $local_key !== $response_key ) ) {
1430 1430
 
1431
-			unset( $posted_settings['license_key_response'] );
1432
-			unset( $posted_settings['license_key_status'] );
1431
+			unset( $posted_settings[ 'license_key_response' ] );
1432
+			unset( $posted_settings[ 'license_key_status' ] );
1433 1433
 
1434 1434
 			\GFCommon::add_error_message( __( 'The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) );
1435 1435
 
Please login to merge, or discard this patch.
includes/class-gravityview-entry-approval-link.php 2 patches
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 */
81 81
 	protected function add_form_settings( $fields = array(), $form = array() ) {
82 82
 
83
-		$fields['restrictions']['fields'][] = array(
83
+		$fields[ 'restrictions' ][ 'fields' ][ ] = array(
84 84
 			'name'       => 'publicApprovalLink',
85 85
 			'type'       => 'radio',
86 86
 			'horizontal' => true,
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	 *
168 168
 	 * @return string Original text if {_custom_merge_tag} isn't found. Otherwise, replaced text.
169 169
 	 */
170
-	public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false  ) {
170
+	public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
171 171
 
172 172
 		$matches = array();
173 173
 		preg_match_all( '/{gv_([dis|un]*approve)_entry:?([0-9]+)?:?(.+)?}/', $text, $matches, PREG_SET_ORDER );
@@ -177,8 +177,8 @@  discard block
 block discarded – undo
177 177
 			return $text;
178 178
 		}
179 179
 
180
-		if ( ! isset( $form['publicApprovalLink'] ) ) {
181
-			$form['publicApprovalLink'] = gravityview()->plugin->settings->get( 'public-approval-link' );
180
+		if ( ! isset( $form[ 'publicApprovalLink' ] ) ) {
181
+			$form[ 'publicApprovalLink' ] = gravityview()->plugin->settings->get( 'public-approval-link' );
182 182
 		}
183 183
 
184 184
 		return $this->replace_merge_tag( $matches, $text, $form, $entry, $url_encode, $esc_html );
@@ -200,14 +200,14 @@  discard block
 block discarded – undo
200 200
 	 */
201 201
 	protected function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
202 202
 
203
-		foreach( $matches as $match ) {
203
+		foreach ( $matches as $match ) {
204 204
 
205
-			$full_tag         = $match[0];
206
-			$action           = $match[1];
207
-			$expiration_hours = isset( $match[2] ) ? intval( $match[2] ) : self::EXPIRATION_HOURS;
208
-			$privacy          = isset( $match[3] ) ? $match[3] : self::PRIVACY;
205
+			$full_tag         = $match[ 0 ];
206
+			$action           = $match[ 1 ];
207
+			$expiration_hours = isset( $match[ 2 ] ) ? intval( $match[ 2 ] ) : self::EXPIRATION_HOURS;
208
+			$privacy          = isset( $match[ 3 ] ) ? $match[ 3 ] : self::PRIVACY;
209 209
 
210
-			if ( false === (bool) $form['publicApprovalLink'] ) {
210
+			if ( false === (bool)$form[ 'publicApprovalLink' ] ) {
211 211
 				$privacy = self::PRIVACY;
212 212
 			}
213 213
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 			$link_url = $this->get_link_url( $token, $privacy );
221 221
 
222 222
 
223
-			if ( self::EXPIRATION_HOURS > (int) $expiration_hours ) {
223
+			if ( self::EXPIRATION_HOURS > (int)$expiration_hours ) {
224 224
 				$link_url = add_query_arg( array( 'nonce' => wp_create_nonce( 'gv_token' ) ), $link_url );
225 225
 			}
226 226
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	 */
253 253
 	protected function get_token( $action = false, $expiration_hours = 24, $privacy = 'private', $entry = array() ) {
254 254
 
255
-		if ( ! $action || ! $entry['id'] ) {
255
+		if ( ! $action || ! $entry[ 'id' ] ) {
256 256
 			return false;
257 257
 		}
258 258
 
@@ -271,14 +271,14 @@  discard block
 block discarded – undo
271 271
 		}
272 272
 
273 273
 		$scopes = array(
274
-			'entry_id'         => $entry['id'],
274
+			'entry_id'         => $entry[ 'id' ],
275 275
 			'approval_status'  => $approval_status,
276 276
 			'expiration_hours' => $expiration_hours,
277 277
 			'privacy'          => $privacy,
278 278
 		);
279 279
 
280 280
 		$jti                  = uniqid();
281
-		$expiration_timestamp = strtotime( '+' . (int) $expiration_hours . ' hours' );
281
+		$expiration_timestamp = strtotime( '+' . (int)$expiration_hours . ' hours' );
282 282
 
283 283
 		$token_array = array(
284 284
 			'iat'    => time(),
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 		$query_args = array();
367 367
 
368 368
 		if ( ! empty( $token ) ) {
369
-			$query_args['gv_token'] = $token;
369
+			$query_args[ 'gv_token' ] = $token;
370 370
 		}
371 371
 
372 372
 		$url = add_query_arg( $query_args, $base_url );
@@ -424,21 +424,21 @@  discard block
 block discarded – undo
424 424
 			}
425 425
 
426 426
 			if ( empty( $token_array ) ) {
427
-				echo \GVCommon::generate_notice( __( 'Invalid request.', 'gravityview' ) , 'gv-error' );
427
+				echo \GVCommon::generate_notice( __( 'Invalid request.', 'gravityview' ), 'gv-error' );
428 428
 
429 429
 				return;
430 430
 			}
431 431
 
432
-			$scopes = $token_array['scopes'];
432
+			$scopes = $token_array[ 'scopes' ];
433 433
 
434
-			if ( empty( $scopes['entry_id'] ) || empty( $scopes['approval_status'] ) || empty( $scopes['privacy'] ) ) {
435
-				echo \GVCommon::generate_notice( __( 'Invalid request.', 'gravityview' ) , 'gv-error' );
434
+			if ( empty( $scopes[ 'entry_id' ] ) || empty( $scopes[ 'approval_status' ] ) || empty( $scopes[ 'privacy' ] ) ) {
435
+				echo \GVCommon::generate_notice( __( 'Invalid request.', 'gravityview' ), 'gv-error' );
436 436
 
437 437
 				return;
438 438
 			}
439 439
 
440
-			if ( self::PRIVACY === $scopes['privacy'] && ! is_user_logged_in() ) {
441
-				echo \GVCommon::generate_notice( __( 'You are not allowed to perform this operation.', 'gravityview' ) , 'gv-error' );
440
+			if ( self::PRIVACY === $scopes[ 'privacy' ] && ! is_user_logged_in() ) {
441
+				echo \GVCommon::generate_notice( __( 'You are not allowed to perform this operation.', 'gravityview' ), 'gv-error' );
442 442
 
443 443
 				return;
444 444
 			}
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 			return false;
503 503
 		}
504 504
 
505
-		$body_64 = $parts[0];
505
+		$body_64 = $parts[ 0 ];
506 506
 
507 507
 		$body_json = base64_decode( $body_64 );
508 508
 		if ( empty( $body_json ) ) {
@@ -569,25 +569,25 @@  discard block
 block discarded – undo
569 569
 
570 570
 		$token = json_decode( $body_json, true );
571 571
 
572
-		if ( ! isset( $token['jti'] ) ) {
572
+		if ( ! isset( $token[ 'jti' ] ) ) {
573 573
 			return false;
574 574
 		}
575 575
 
576
-		if ( ! isset( $token['exp'] ) || $token['exp'] < time() ) {
576
+		if ( ! isset( $token[ 'exp' ] ) || $token[ 'exp' ] < time() ) {
577 577
 			return false;
578 578
 		}
579 579
 
580
-		if ( ! isset( $token['scopes'] ) ) {
580
+		if ( ! isset( $token[ 'scopes' ] ) ) {
581 581
 			return false;
582 582
 		}
583 583
 
584
-		if ( ! isset( $token['scopes']['expiration_hours'] ) ) {
584
+		if ( ! isset( $token[ 'scopes' ][ 'expiration_hours' ] ) ) {
585 585
 			return false;
586 586
 		}
587 587
 
588
-		if ( self::EXPIRATION_HOURS > $token['scopes']['expiration_hours'] ) {
588
+		if ( self::EXPIRATION_HOURS > $token[ 'scopes' ][ 'expiration_hours' ] ) {
589 589
 
590
-			if ( ! isset( $_GET['nonce'] ) ) {
590
+			if ( ! isset( $_GET[ 'nonce' ] ) ) {
591 591
 				return false;
592 592
 			}
593 593
 
@@ -614,11 +614,11 @@  discard block
 block discarded – undo
614 614
 			return false;
615 615
 		}
616 616
 
617
-		$entry_id        = $scopes['entry_id'];
618
-		$approval_status = $scopes['approval_status'];
617
+		$entry_id        = $scopes[ 'entry_id' ];
618
+		$approval_status = $scopes[ 'approval_status' ];
619 619
 
620 620
 		$entry      = GFAPI::get_entry( $entry_id );
621
-		$form_id    = $entry['form_id'];
621
+		$form_id    = $entry[ 'form_id' ];
622 622
 		$return_url = admin_url( '/admin.php?page=gf_entries&id=' . $form_id );
623 623
 
624 624
 		// Valid status
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
 		}
643 643
 
644 644
 		// Has capability
645
-		elseif ( self::PRIVACY === $scopes['privacy'] && ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry_id ) ) {
645
+		elseif ( self::PRIVACY === $scopes[ 'privacy' ] && ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry_id ) ) {
646 646
 
647 647
 			gravityview()->log->error( 'User does not have the `gravityview_moderate_entries` capability.' );
648 648
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -3 removed lines patch added patch discarded remove patch
@@ -467,9 +467,7 @@
 block discarded – undo
467 467
 
468 468
 			if ( 'success' === $result ) {
469 469
 				echo \GVCommon::generate_notice( __( 'Entry approval updated!', 'gravityview' ), 'gv-success' );
470
-			}
471
-
472
-			elseif ( 'error' === $result ) {
470
+			} elseif ( 'error' === $result ) {
473 471
 				echo \GVCommon::generate_notice( __( 'Error updating approval.', 'gravityview' ), 'gv-error' );
474 472
 			}
475 473
 		}
Please login to merge, or discard this patch.