Completed
Pull Request — master (#874)
by Zack
11:15 queued 07:33
created
includes/class-ajax.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 * @since 1.15
29 29
 	 * @param bool|false $mixed
30 30
 	 *
31
-	 * @return bool
31
+	 * @return boolean|null
32 32
 	 */
33 33
 	private function _exit( $mixed = NULL ) {
34 34
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 	 * Import Gravity Form XML or JSON
201 201
 	 *
202 202
 	 * @param  string $xml_or_json_path Path to form XML or JSON file
203
-	 * @return int|bool       Imported form ID or false
203
+	 * @return false|string       Imported form ID or false
204 204
 	 */
205 205
 	function import_form( $xml_or_json_path = '' ) {
206 206
 
Please login to merge, or discard this patch.
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 
137 137
 		// template areas
138 138
 		$template_areas_directory = apply_filters( 'gravityview_template_active_areas', array(), $template_id, 'directory' );
139
-        $template_areas_single = apply_filters( 'gravityview_template_active_areas', array(), $template_id, 'single' );
139
+		$template_areas_single = apply_filters( 'gravityview_template_active_areas', array(), $template_id, 'single' );
140 140
 
141 141
 		// widget areas
142 142
 		$default_widget_areas = GravityView_Plugin::get_default_widget_areas();
@@ -328,40 +328,40 @@  discard block
 block discarded – undo
328 328
 		// load file
329 329
 		$xmlstr = file_get_contents( $form_file );
330 330
 
331
-        $options = array(
332
-            "page" => array("unserialize_as_array" => true),
333
-            "form"=> array("unserialize_as_array" => true),
334
-            "field"=> array("unserialize_as_array" => true),
335
-            "rule"=> array("unserialize_as_array" => true),
336
-            "choice"=> array("unserialize_as_array" => true),
337
-            "input"=> array("unserialize_as_array" => true),
338
-            "routing_item"=> array("unserialize_as_array" => true),
339
-            "creditCard"=> array("unserialize_as_array" => true),
340
-            "routin"=> array("unserialize_as_array" => true),
341
-            "confirmation" => array("unserialize_as_array" => true),
342
-            "notification" => array("unserialize_as_array" => true)
343
-        );
331
+		$options = array(
332
+			"page" => array("unserialize_as_array" => true),
333
+			"form"=> array("unserialize_as_array" => true),
334
+			"field"=> array("unserialize_as_array" => true),
335
+			"rule"=> array("unserialize_as_array" => true),
336
+			"choice"=> array("unserialize_as_array" => true),
337
+			"input"=> array("unserialize_as_array" => true),
338
+			"routing_item"=> array("unserialize_as_array" => true),
339
+			"creditCard"=> array("unserialize_as_array" => true),
340
+			"routin"=> array("unserialize_as_array" => true),
341
+			"confirmation" => array("unserialize_as_array" => true),
342
+			"notification" => array("unserialize_as_array" => true)
343
+		);
344 344
 
345 345
 		$xml = new RGXML($options);
346
-        $forms = $xml->unserialize($xmlstr);
346
+		$forms = $xml->unserialize($xmlstr);
347 347
 
348
-        if( !$forms ) {
349
-        	do_action( 'gravityview_log_error', '[pre_get_available_fields] Importing Form Fields for preset ['. $template_id .']. Error importing file. (File)', $form_file );
350
-        	return false;
351
-        }
348
+		if( !$forms ) {
349
+			do_action( 'gravityview_log_error', '[pre_get_available_fields] Importing Form Fields for preset ['. $template_id .']. Error importing file. (File)', $form_file );
350
+			return false;
351
+		}
352 352
 
353
-        if( !empty( $forms[0] ) && is_array( $forms[0] ) ) {
354
-        	$form = $forms[0];
355
-        }
353
+		if( !empty( $forms[0] ) && is_array( $forms[0] ) ) {
354
+			$form = $forms[0];
355
+		}
356 356
 
357
-        if( empty( $form ) ) {
358
-        	do_action( 'gravityview_log_error', '[pre_get_available_fields] $form not set.', $forms );
359
-        	return false;
360
-        }
357
+		if( empty( $form ) ) {
358
+			do_action( 'gravityview_log_error', '[pre_get_available_fields] $form not set.', $forms );
359
+			return false;
360
+		}
361 361
 
362
-        do_action( 'gravityview_log_debug', '[pre_get_available_fields] Importing Form Fields for preset ['. $template_id .']. (Form)', $form );
362
+		do_action( 'gravityview_log_debug', '[pre_get_available_fields] Importing Form Fields for preset ['. $template_id .']. (Form)', $form );
363 363
 
364
-        return $form;
364
+		return $form;
365 365
 
366 366
 	}
367 367
 
Please login to merge, or discard this patch.
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 		 * Don't exit if we're running test suite.
37 37
 		 * @since 1.15
38 38
 		 */
39
-		if( defined( 'DOING_GRAVITYVIEW_TESTS' ) && DOING_GRAVITYVIEW_TESTS ) {
39
+		if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && DOING_GRAVITYVIEW_TESTS ) {
40 40
 			return $mixed;
41 41
 		}
42 42
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 * @return void
51 51
 	 */
52 52
 	function check_ajax_nonce() {
53
-		if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxviews' ) ) {
53
+		if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxviews' ) ) {
54 54
 			$this->_exit( false );
55 55
 		}
56 56
 	}
@@ -67,14 +67,14 @@  discard block
 block discarded – undo
67 67
 		//check nonce
68 68
 		$this->check_ajax_nonce();
69 69
 
70
-		$context = isset($_POST['context']) ? esc_attr( $_POST['context'] ) : 'directory';
70
+		$context = isset( $_POST[ 'context' ] ) ? esc_attr( $_POST[ 'context' ] ) : 'directory';
71 71
 
72 72
 		// If Form was changed, JS sends form ID, if start fresh, JS sends template_id
73
-		if( !empty( $_POST['form_id'] ) ) {
74
-			do_action( 'gravityview_render_available_fields', (int) $_POST['form_id'], $context );
73
+		if ( ! empty( $_POST[ 'form_id' ] ) ) {
74
+			do_action( 'gravityview_render_available_fields', (int)$_POST[ 'form_id' ], $context );
75 75
 			$this->_exit();
76
-		} elseif( !empty( $_POST['template_id'] ) ) {
77
-			$form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] );
76
+		} elseif ( ! empty( $_POST[ 'template_id' ] ) ) {
77
+			$form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] );
78 78
 
79 79
 			/** @see GravityView_Admin_Views::render_available_fields */
80 80
 			do_action( 'gravityview_render_available_fields', $form, $context );
@@ -96,17 +96,17 @@  discard block
 block discarded – undo
96 96
 	function get_active_areas() {
97 97
 		$this->check_ajax_nonce();
98 98
 
99
-		if( empty( $_POST['template_id'] ) ) {
99
+		if ( empty( $_POST[ 'template_id' ] ) ) {
100 100
 			$this->_exit( false );
101 101
 		}
102 102
 
103 103
 		ob_start();
104
-		do_action( 'gravityview_render_directory_active_areas', $_POST['template_id'], 'directory', '', true );
105
-		$response['directory'] = ob_get_clean();
104
+		do_action( 'gravityview_render_directory_active_areas', $_POST[ 'template_id' ], 'directory', '', true );
105
+		$response[ 'directory' ] = ob_get_clean();
106 106
 
107 107
 		ob_start();
108
-		do_action( 'gravityview_render_directory_active_areas',  $_POST['template_id'], 'single', '', true );
109
-		$response['single'] = ob_get_clean();
108
+		do_action( 'gravityview_render_directory_active_areas', $_POST[ 'template_id' ], 'single', '', true );
109
+		$response[ 'single' ] = ob_get_clean();
110 110
 
111 111
 		$response = array_map( 'gravityview_strip_whitespace', $response );
112 112
 
@@ -121,20 +121,20 @@  discard block
 block discarded – undo
121 121
 
122 122
 		$this->check_ajax_nonce();
123 123
 
124
-		if( empty( $_POST['template_id'] ) ) {
124
+		if ( empty( $_POST[ 'template_id' ] ) ) {
125 125
 			$this->_exit( false );
126 126
 		}
127 127
 
128 128
 		// get the fields xml config file for this specific preset
129
-		$preset_fields_path = apply_filters( 'gravityview_template_fieldsxml', array(), $_POST['template_id'] );
129
+		$preset_fields_path = apply_filters( 'gravityview_template_fieldsxml', array(), $_POST[ 'template_id' ] );
130 130
 		// import fields
131
-		if( !empty( $preset_fields_path ) ) {
131
+		if ( ! empty( $preset_fields_path ) ) {
132 132
 			$presets = $this->import_fields( $preset_fields_path );
133 133
 		} else {
134 134
 			$presets = array( 'widgets' => array(), 'fields' => array() );
135 135
 		}
136 136
 
137
-		$template_id = esc_attr( $_POST['template_id'] );
137
+		$template_id = esc_attr( $_POST[ 'template_id' ] );
138 138
 
139 139
 		// template areas
140 140
 		$template_areas_directory = apply_filters( 'gravityview_template_active_areas', array(), $template_id, 'directory' );
@@ -144,20 +144,20 @@  discard block
 block discarded – undo
144 144
 		$default_widget_areas = GravityView_Plugin::get_default_widget_areas();
145 145
 
146 146
 		ob_start();
147
-		do_action('gravityview_render_active_areas', $template_id, 'widget', 'header', $default_widget_areas, $presets['widgets'] );
148
-		$response['header'] = ob_get_clean();
147
+		do_action( 'gravityview_render_active_areas', $template_id, 'widget', 'header', $default_widget_areas, $presets[ 'widgets' ] );
148
+		$response[ 'header' ] = ob_get_clean();
149 149
 
150 150
 		ob_start();
151
-		do_action('gravityview_render_active_areas', $template_id, 'widget', 'footer', $default_widget_areas, $presets['widgets'] );
152
-		$response['footer'] = ob_get_clean();
151
+		do_action( 'gravityview_render_active_areas', $template_id, 'widget', 'footer', $default_widget_areas, $presets[ 'widgets' ] );
152
+		$response[ 'footer' ] = ob_get_clean();
153 153
 
154 154
 		ob_start();
155
-		do_action('gravityview_render_active_areas', $template_id, 'field', 'directory', $template_areas_directory, $presets['fields'] );
156
-		$response['directory'] = ob_get_clean();
155
+		do_action( 'gravityview_render_active_areas', $template_id, 'field', 'directory', $template_areas_directory, $presets[ 'fields' ] );
156
+		$response[ 'directory' ] = ob_get_clean();
157 157
 
158 158
 		ob_start();
159
-		do_action('gravityview_render_active_areas', $template_id, 'field', 'single', $template_areas_single, $presets['fields'] );
160
-		$response['single'] = ob_get_clean();
159
+		do_action( 'gravityview_render_active_areas', $template_id, 'field', 'single', $template_areas_single, $presets[ 'fields' ] );
160
+		$response[ 'single' ] = ob_get_clean();
161 161
 
162 162
 		$response = array_map( 'gravityview_strip_whitespace', $response );
163 163
 
@@ -175,26 +175,26 @@  discard block
 block discarded – undo
175 175
 
176 176
 		$this->check_ajax_nonce();
177 177
 
178
-		if( empty( $_POST['template_id'] ) ) {
178
+		if ( empty( $_POST[ 'template_id' ] ) ) {
179 179
 			do_action( 'gravityview_log_error', '[create_preset_form] Cannot create preset form; the template_id is empty.' );
180 180
 			$this->_exit( false );
181 181
 		}
182 182
 
183 183
 		// get the xml for this specific template_id
184
-		$preset_form_xml_path = apply_filters( 'gravityview_template_formxml', '', $_POST['template_id'] );
184
+		$preset_form_xml_path = apply_filters( 'gravityview_template_formxml', '', $_POST[ 'template_id' ] );
185 185
 
186 186
 		// import form
187 187
 		$form = $this->import_form( $preset_form_xml_path );
188 188
 
189 189
 		// get the form ID
190
-		if( false === $form ) {
190
+		if ( false === $form ) {
191 191
 			// send error to user
192
-			do_action( 'gravityview_log_error', '[create_preset_form] Error importing form for template id: ' . (int) $_POST['template_id'] );
192
+			do_action( 'gravityview_log_error', '[create_preset_form] Error importing form for template id: ' . (int)$_POST[ 'template_id' ] );
193 193
 
194 194
 			$this->_exit( false );
195 195
 		}
196 196
 
197
-		$this->_exit( '<option value="'.esc_attr( $form['id'] ).'" selected="selected">'.esc_html( $form['title'] ).'</option>' );
197
+		$this->_exit( '<option value="' . esc_attr( $form[ 'id' ] ) . '" selected="selected">' . esc_html( $form[ 'title' ] ) . '</option>' );
198 198
 
199 199
 	}
200 200
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 
209 209
 		do_action( 'gravityview_log_debug', '[import_form] Import Preset Form. (File)', $xml_or_json_path );
210 210
 
211
-		if( empty( $xml_or_json_path ) || !class_exists('GFExport') || !file_exists( $xml_or_json_path ) ) {
211
+		if ( empty( $xml_or_json_path ) || ! class_exists( 'GFExport' ) || ! file_exists( $xml_or_json_path ) ) {
212 212
 			do_action( 'gravityview_log_error', '[import_form] Class GFExport or file not found. file: ', $xml_or_json_path );
213 213
 			return false;
214 214
 		}
@@ -220,13 +220,13 @@  discard block
 block discarded – undo
220 220
 		do_action( 'gravityview_log_debug', '[import_form] Importing form (Result)', $count );
221 221
 		do_action( 'gravityview_log_debug', '[import_form] Importing form (Form) ', $forms );
222 222
 
223
-		if( $count != 1 || empty( $forms[0]['id'] ) ) {
223
+		if ( $count != 1 || empty( $forms[ 0 ][ 'id' ] ) ) {
224 224
 			do_action( 'gravityview_log_error', '[import_form] Form Import Failed!' );
225 225
 			return false;
226 226
 		}
227 227
 
228 228
 		// import success - return form id
229
-		return $forms[0];
229
+		return $forms[ 0 ];
230 230
 	}
231 231
 
232 232
 
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	function get_field_options() {
241 241
 		$this->check_ajax_nonce();
242 242
 
243
-		if( empty( $_POST['template'] ) || empty( $_POST['area'] ) || empty( $_POST['field_id'] ) || empty( $_POST['field_type'] ) ) {
243
+		if ( empty( $_POST[ 'template' ] ) || empty( $_POST[ 'area' ] ) || empty( $_POST[ 'field_id' ] ) || empty( $_POST[ 'field_type' ] ) ) {
244 244
 			do_action( 'gravityview_log_error', '[get_field_options] Required fields were not set in the $_POST request. ' );
245 245
 			$this->_exit( false );
246 246
 		}
@@ -252,10 +252,10 @@  discard block
 block discarded – undo
252 252
 		$_post = array_map( 'esc_attr', $_post );
253 253
 
254 254
 		// The GF type of field: `product`, `name`, `creditcard`, `id`, `text`
255
-		$input_type = isset($_post['input_type']) ? esc_attr( $_post['input_type'] ) : NULL;
256
-		$context = isset($_post['context']) ? esc_attr( $_post['context'] ) : NULL;
255
+		$input_type = isset( $_post[ 'input_type' ] ) ? esc_attr( $_post[ 'input_type' ] ) : NULL;
256
+		$context = isset( $_post[ 'context' ] ) ? esc_attr( $_post[ 'context' ] ) : NULL;
257 257
 
258
-		$response = GravityView_Render_Settings::render_field_options( $_post['field_type'], $_post['template'], $_post['field_id'], $_post['field_label'], $_post['area'], $input_type, '', '', $context  );
258
+		$response = GravityView_Render_Settings::render_field_options( $_post[ 'field_type' ], $_post[ 'template' ], $_post[ 'field_id' ], $_post[ 'field_label' ], $_post[ 'area' ], $input_type, '', '', $context );
259 259
 
260 260
 		$response = gravityview_strip_whitespace( $response );
261 261
 
@@ -276,15 +276,15 @@  discard block
 block discarded – undo
276 276
 		$form = '';
277 277
 
278 278
 		// if form id is set, use it, else, get form from preset
279
-		if( !empty( $_POST['form_id'] ) ) {
279
+		if ( ! empty( $_POST[ 'form_id' ] ) ) {
280 280
 
281
-			$form = (int) $_POST['form_id'];
281
+			$form = (int)$_POST[ 'form_id' ];
282 282
 
283 283
 		}
284 284
 		// get form from preset
285
-		elseif( !empty( $_POST['template_id'] ) ) {
285
+		elseif ( ! empty( $_POST[ 'template_id' ] ) ) {
286 286
 
287
-			$form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] );
287
+			$form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] );
288 288
 
289 289
 		}
290 290
 
@@ -300,27 +300,27 @@  discard block
 block discarded – undo
300 300
 	 * @param  string $template_id Preset template
301 301
 	 *
302 302
 	 */
303
-	static function pre_get_form_fields( $template_id = '') {
303
+	static function pre_get_form_fields( $template_id = '' ) {
304 304
 
305
-		if( empty( $template_id ) ) {
305
+		if ( empty( $template_id ) ) {
306 306
 			do_action( 'gravityview_log_error', __METHOD__ . ' - Template ID not set.' );
307 307
 			return false;
308 308
 		} else {
309 309
 			$form_file = apply_filters( 'gravityview_template_formxml', '', $template_id );
310
-			if( !file_exists( $form_file )  ) {
311
-				do_action( 'gravityview_log_error', __METHOD__ . ' - Importing Form Fields for preset ['. $template_id .']. File not found. file: ' . $form_file );
310
+			if ( ! file_exists( $form_file ) ) {
311
+				do_action( 'gravityview_log_error', __METHOD__ . ' - Importing Form Fields for preset [' . $template_id . ']. File not found. file: ' . $form_file );
312 312
 				return false;
313 313
 			}
314 314
 		}
315 315
 
316 316
 		// Load xml parser (from GravityForms)
317
-		if( class_exists( 'GFCommon' ) ) {
317
+		if ( class_exists( 'GFCommon' ) ) {
318 318
 			$xml_parser = GFCommon::get_base_path() . '/xml.php';
319 319
 		} else {
320 320
 			$xml_parser = trailingslashit( WP_PLUGIN_DIR ) . 'gravityforms/xml.php';
321 321
 		}
322 322
 
323
-		if( file_exists( $xml_parser ) ) {
323
+		if ( file_exists( $xml_parser ) ) {
324 324
 			require_once( $xml_parser );
325 325
 		} else {
326 326
 			do_action( 'gravityview_log_debug', __METHOD__ . ' - Gravity Forms XML Parser not found.', $xml_parser );
@@ -331,37 +331,37 @@  discard block
 block discarded – undo
331 331
 		$xmlstr = file_get_contents( $form_file );
332 332
 
333 333
         $options = array(
334
-            "page" => array("unserialize_as_array" => true),
335
-            "form"=> array("unserialize_as_array" => true),
336
-            "field"=> array("unserialize_as_array" => true),
337
-            "rule"=> array("unserialize_as_array" => true),
338
-            "choice"=> array("unserialize_as_array" => true),
339
-            "input"=> array("unserialize_as_array" => true),
340
-            "routing_item"=> array("unserialize_as_array" => true),
341
-            "creditCard"=> array("unserialize_as_array" => true),
342
-            "routin"=> array("unserialize_as_array" => true),
343
-            "confirmation" => array("unserialize_as_array" => true),
344
-            "notification" => array("unserialize_as_array" => true)
334
+            "page" => array( "unserialize_as_array" => true ),
335
+            "form"=> array( "unserialize_as_array" => true ),
336
+            "field"=> array( "unserialize_as_array" => true ),
337
+            "rule"=> array( "unserialize_as_array" => true ),
338
+            "choice"=> array( "unserialize_as_array" => true ),
339
+            "input"=> array( "unserialize_as_array" => true ),
340
+            "routing_item"=> array( "unserialize_as_array" => true ),
341
+            "creditCard"=> array( "unserialize_as_array" => true ),
342
+            "routin"=> array( "unserialize_as_array" => true ),
343
+            "confirmation" => array( "unserialize_as_array" => true ),
344
+            "notification" => array( "unserialize_as_array" => true )
345 345
         );
346 346
 
347
-		$xml = new RGXML($options);
348
-        $forms = $xml->unserialize($xmlstr);
347
+		$xml = new RGXML( $options );
348
+        $forms = $xml->unserialize( $xmlstr );
349 349
 
350
-        if( !$forms ) {
351
-        	do_action( 'gravityview_log_error', '[pre_get_available_fields] Importing Form Fields for preset ['. $template_id .']. Error importing file. (File)', $form_file );
350
+        if ( ! $forms ) {
351
+        	do_action( 'gravityview_log_error', '[pre_get_available_fields] Importing Form Fields for preset [' . $template_id . ']. Error importing file. (File)', $form_file );
352 352
         	return false;
353 353
         }
354 354
 
355
-        if( !empty( $forms[0] ) && is_array( $forms[0] ) ) {
356
-        	$form = $forms[0];
355
+        if ( ! empty( $forms[ 0 ] ) && is_array( $forms[ 0 ] ) ) {
356
+        	$form = $forms[ 0 ];
357 357
         }
358 358
 
359
-        if( empty( $form ) ) {
359
+        if ( empty( $form ) ) {
360 360
         	do_action( 'gravityview_log_error', '[pre_get_available_fields] $form not set.', $forms );
361 361
         	return false;
362 362
         }
363 363
 
364
-        do_action( 'gravityview_log_debug', '[pre_get_available_fields] Importing Form Fields for preset ['. $template_id .']. (Form)', $form );
364
+        do_action( 'gravityview_log_debug', '[pre_get_available_fields] Importing Form Fields for preset [' . $template_id . ']. (Form)', $form );
365 365
 
366 366
         return $form;
367 367
 
@@ -375,38 +375,38 @@  discard block
 block discarded – undo
375 375
 	 */
376 376
 	function import_fields( $file ) {
377 377
 
378
-		if( empty( $file ) || !file_exists(  $file ) ) {
378
+		if ( empty( $file ) || ! file_exists( $file ) ) {
379 379
 			do_action( 'gravityview_log_error', '[import_fields] Importing Preset Fields. File not found. (File)', $file );
380 380
 			return false;
381 381
 		}
382 382
 
383
-		if( !class_exists('WXR_Parser') ) {
383
+		if ( ! class_exists( 'WXR_Parser' ) ) {
384 384
 			include_once GRAVITYVIEW_DIR . 'includes/lib/xml-parsers/parsers.php';
385 385
 		}
386 386
 
387 387
 		$parser = new WXR_Parser();
388 388
 		$presets = $parser->parse( $file );
389 389
 
390
-		if(is_wp_error( $presets )) {
390
+		if ( is_wp_error( $presets ) ) {
391 391
 			do_action( 'gravityview_log_error', '[import_fields] Importing Preset Fields failed. Threw WP_Error.', $presets );
392 392
 			return false;
393 393
 		}
394 394
 
395
-		if( empty( $presets['posts'][0]['postmeta'] ) && !is_array( $presets['posts'][0]['postmeta'] ) ) {
395
+		if ( empty( $presets[ 'posts' ][ 0 ][ 'postmeta' ] ) && ! is_array( $presets[ 'posts' ][ 0 ][ 'postmeta' ] ) ) {
396 396
 			do_action( 'gravityview_log_error', '[import_fields] Importing Preset Fields failed. Meta not found in file.', $file );
397 397
 			return false;
398 398
 		}
399 399
 
400
-		do_action( 'gravityview_log_debug', '[import_fields] postmeta', $presets['posts'][0]['postmeta'] );
400
+		do_action( 'gravityview_log_debug', '[import_fields] postmeta', $presets[ 'posts' ][ 0 ][ 'postmeta' ] );
401 401
 
402 402
 		$fields = $widgets = array();
403
-		foreach( $presets['posts'][0]['postmeta'] as $meta ) {
404
-			switch ($meta['key']) {
403
+		foreach ( $presets[ 'posts' ][ 0 ][ 'postmeta' ] as $meta ) {
404
+			switch ( $meta[ 'key' ] ) {
405 405
 				case '_gravityview_directory_fields':
406
-					$fields = maybe_unserialize( $meta['value'] );
406
+					$fields = maybe_unserialize( $meta[ 'value' ] );
407 407
 					break;
408 408
 				case '_gravityview_directory_widgets':
409
-					$widgets = maybe_unserialize( $meta['value'] );
409
+					$widgets = maybe_unserialize( $meta[ 'value' ] );
410 410
 					break;
411 411
 			}
412 412
 		}
Please login to merge, or discard this patch.
includes/class-gravityview-admin-duplicate-view.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -195,7 +195,7 @@
 block discarded – undo
195 195
 	 *
196 196
 	 * @since 1.6
197 197
 	 *
198
-	 * @param int $new_view_id The ID of the newly created View
198
+	 * @param int $new_id The ID of the newly created View
199 199
 	 * @param WP_Post $post The View that was just cloned
200 200
 	 *
201 201
 	 * @return void
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -15,12 +15,12 @@  discard block
 block discarded – undo
15 15
 	function __construct() {
16 16
 
17 17
 		// Only run on Admin
18
-		if ( !is_admin() ) {
18
+		if ( ! is_admin() ) {
19 19
 			return;
20 20
 		}
21 21
 
22 22
 		// If the Duplicate Post plugin is active, don't run.
23
-		if( defined('DUPLICATE_POST_CURRENT_VERSION') ) {
23
+		if ( defined( 'DUPLICATE_POST_CURRENT_VERSION' ) ) {
24 24
 			return;
25 25
 		}
26 26
 
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
60 60
 		global $post;
61 61
 
62 62
 		// We only want to add Clone links to the Edit View metabox
63
-		if( !$this->is_all_views_page() ) {
63
+		if ( ! $this->is_all_views_page() ) {
64 64
 
65
-			if( $duplicate_links = $this->make_duplicate_link_row( array(), $post ) ) {
66
-				$links[] = '<span>' . $duplicate_links['edit_as_new_draft'] . '</span>';
65
+			if ( $duplicate_links = $this->make_duplicate_link_row( array(), $post ) ) {
66
+				$links[ ] = '<span>' . $duplicate_links[ 'edit_as_new_draft' ] . '</span>';
67 67
 			}
68 68
 
69 69
 		}
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 		 * @param string|null If string, the status to set for the new View. If empty, use existing View status.
120 120
 		 * @param WP_Post $post View being cloned
121 121
 		 */
122
-		$new_view_status = apply_filters('gravityview/duplicate-view/status', $status, $post );
122
+		$new_view_status = apply_filters( 'gravityview/duplicate-view/status', $status, $post );
123 123
 
124 124
 		$new_view = array(
125 125
 			'menu_order'     => $post->menu_order,
@@ -142,11 +142,11 @@  discard block
 block discarded – undo
142 142
 		 * @param boolean $copy_date Whether the copy the date from the existing View. Default: `false`
143 143
 		 * @param WP_Post $post View being cloned
144 144
 		 */
145
-		$copy_date = apply_filters('gravityview/duplicate-view/copy-date', false, $post );
145
+		$copy_date = apply_filters( 'gravityview/duplicate-view/copy-date', false, $post );
146 146
 
147 147
 		if ( $copy_date ) {
148
-			$new_view['post_date']     = $new_post_date = $post->post_date;
149
-			$new_view['post_date_gmt'] = get_gmt_from_date( $new_post_date );
148
+			$new_view[ 'post_date' ]     = $new_post_date = $post->post_date;
149
+			$new_view[ 'post_date_gmt' ] = get_gmt_from_date( $new_post_date );
150 150
 		}
151 151
 
152 152
 		/**
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 		 * @param array $new_view Array of settings to be passed to wp_insert_post()
156 156
 		 * @param WP_Post $post View being cloned
157 157
 		 */
158
-		$new_view = apply_filters('gravityview/duplicate-view/new-view', $new_view, $post );
158
+		$new_view = apply_filters( 'gravityview/duplicate-view/new-view', $new_view, $post );
159 159
 
160 160
 		// Magic happens here.
161 161
 		$new_view_id = wp_insert_post( $new_view );
@@ -237,13 +237,13 @@  discard block
 block discarded – undo
237 237
 			$clone_text = __( 'Clone', 'gravityview' );
238 238
 			$clone_title = __( 'Clone this View', 'gravityview' );
239 239
 
240
-			$actions['clone'] = gravityview_get_link( $clone_link, $clone_text, 'title='.$clone_title );
240
+			$actions[ 'clone' ] = gravityview_get_link( $clone_link, $clone_text, 'title=' . $clone_title );
241 241
 
242 242
 			$clone_draft_link = $this->get_clone_view_link( $post->ID );
243 243
 			$clone_draft_text = $this->is_all_views_page() ? __( 'New Draft', 'gravityview' ) : __( 'Clone View', 'gravityview' );
244 244
 			$clone_draft_title = __( 'Copy as a new draft View', 'gravityview' );
245 245
 
246
-			$actions['edit_as_new_draft'] = gravityview_get_link( $clone_draft_link, esc_html( $clone_draft_text ), 'title='.$clone_draft_title );
246
+			$actions[ 'edit_as_new_draft' ] = gravityview_get_link( $clone_draft_link, esc_html( $clone_draft_text ), 'title=' . $clone_draft_title );
247 247
 		}
248 248
 
249 249
 		return $actions;
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 		}
268 268
 
269 269
 		// Verify the View exists
270
-		if ( !$view = get_post( $id ) ) {
270
+		if ( ! $view = get_post( $id ) ) {
271 271
 			return '';
272 272
 		}
273 273
 
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 		$post_type_object = get_post_type_object( $view->post_type );
283 283
 
284 284
 		/** If there's no gravityview post type for some reason, abort! */
285
-		if ( !$post_type_object ) {
285
+		if ( ! $post_type_object ) {
286 286
 			do_action( 'gravityview_log_error', __METHOD__ . ' No gravityview post type exists when trying to clone the View.', $view );
287 287
 			return '';
288 288
 		}
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 		 * @param int $view_id View ID
295 295
 		 * @param string $context How to display the link. If "display", the URL is run through esc_html(). Default: `display`
296 296
 		 */
297
-		$clone_view_link = apply_filters( 'gravityview/duplicate-view/get_clone_view_link', admin_url( "admin.php". $action ), $view->ID, $context );
297
+		$clone_view_link = apply_filters( 'gravityview/duplicate-view/get_clone_view_link', admin_url( "admin.php" . $action ), $view->ID, $context );
298 298
 
299 299
 		return $clone_view_link;
300 300
 	}
@@ -321,14 +321,14 @@  discard block
 block discarded – undo
321 321
 	 */
322 322
 	public function save_as_new_view( $status = '' ) {
323 323
 
324
-		if ( ! ( isset( $_GET['post'] ) || isset( $_POST['post'] ) ) ) {
324
+		if ( ! ( isset( $_GET[ 'post' ] ) || isset( $_POST[ 'post' ] ) ) ) {
325 325
 			wp_die( __( 'No post to duplicate has been supplied!', 'gravityview' ) );
326 326
 		}
327 327
 
328 328
 		// Get the original post
329
-		$id   = ( isset( $_GET['post'] ) ? $_GET['post'] : $_POST['post'] );
329
+		$id = ( isset( $_GET[ 'post' ] ) ? $_GET[ 'post' ] : $_POST[ 'post' ] );
330 330
 
331
-		if( ! $this->current_user_can_copy( $id ) ) {
331
+		if ( ! $this->current_user_can_copy( $id ) ) {
332 332
 			wp_die( __( 'You don\'t have permission to copy this View.', 'gravityview' ) );
333 333
 		}
334 334
 
Please login to merge, or discard this patch.
includes/class-gravityview-compatibility.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@
 block discarded – undo
116 116
 
117 117
 	/**
118 118
 	 * @since 1.12
119
-	 * @return bool
119
+	 * @return boolean|null
120 120
 	 */
121 121
 	private function add_fallback_shortcode() {
122 122
 
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -204,7 +204,7 @@
 block discarded – undo
204 204
 			self::$notices['wp_version'] = array(
205 205
 				'class' => 'error',
206 206
 				'message' => sprintf( __( "%sGravityView requires WordPress %s or newer.%s \n\nYou're using Version %s. Please upgrade your WordPress installation.", 'gravityview' ), '<h3>', GV_MIN_WP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.$wp_version.'</span>' ),
207
-			    'cap' => 'update_core',
207
+				'cap' => 'update_core',
208 208
 				'dismiss' => 'wp_version',
209 209
 			);
210 210
 
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 * @return GravityView_Compatibility
77 77
 	 */
78 78
 	public static function getInstance() {
79
-		if( self::$instance ) {
79
+		if ( self::$instance ) {
80 80
 			return self::$instance;
81 81
 		}
82 82
 		return new self;
@@ -154,10 +154,10 @@  discard block
 block discarded – undo
154 154
 		// If Gravity Forms doesn't exist or is outdated, load the admin view class to
155 155
 		// show the notice, but not load any post types or process shortcodes.
156 156
 		// Without Gravity Forms, there is no GravityView. Beautiful, really.
157
-		if( ! self::is_valid() ) {
157
+		if ( ! self::is_valid() ) {
158 158
 
159 159
 			// If the plugin's not loaded, might as well hide the shortcode for people.
160
-			add_shortcode( 'gravityview', array( $this, '_shortcode_gf_notice') );
160
+			add_shortcode( 'gravityview', array( $this, '_shortcode_gf_notice' ) );
161 161
 
162 162
 		}
163 163
 	}
@@ -183,15 +183,15 @@  discard block
 block discarded – undo
183 183
 	 */
184 184
 	public function _shortcode_gf_notice( $atts = array(), $content = null, $shortcode = 'gravityview' ) {
185 185
 
186
-		if( ! GVCommon::has_cap( 'activate_plugins' ) ) {
186
+		if ( ! GVCommon::has_cap( 'activate_plugins' ) ) {
187 187
 			return null;
188 188
 		}
189 189
 
190 190
 		$notices = self::get_notices();
191 191
 
192
-		$message = '<div style="border:1px solid red; padding: 15px;"><p style="text-align:center;"><em>' . esc_html__( 'You are seeing this notice because you are an administrator. Other users of the site will see nothing.', 'gravityview') . '</em></p>';
193
-		foreach( (array)$notices as $notice ) {
194
-			$message .= wpautop( $notice['message'] );
192
+		$message = '<div style="border:1px solid red; padding: 15px;"><p style="text-align:center;"><em>' . esc_html__( 'You are seeing this notice because you are an administrator. Other users of the site will see nothing.', 'gravityview' ) . '</em></p>';
193
+		foreach ( (array)$notices as $notice ) {
194
+			$message .= wpautop( $notice[ 'message' ] );
195 195
 		}
196 196
 		$message .= '</div>';
197 197
 
@@ -211,12 +211,12 @@  discard block
 block discarded – undo
211 211
 
212 212
 		if (
213 213
 			( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) && ! gravityview()->plugin->is_compatible_php() )
214
-			|| ( false === version_compare( phpversion(), GV_MIN_PHP_VERSION , '>=' ) )
214
+			|| ( false === version_compare( phpversion(), GV_MIN_PHP_VERSION, '>=' ) )
215 215
 		) {
216 216
 
217
-			self::$notices['php_version'] = array(
217
+			self::$notices[ 'php_version' ] = array(
218 218
 				'class' => 'error',
219
-				'message' => sprintf( __( "%sGravityView requires PHP Version %s or newer.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), '<h3>', GV_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.phpversion().'</span>' ),
219
+				'message' => sprintf( __( "%sGravityView requires PHP Version %s or newer.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), '<h3>', GV_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . phpversion() . '</span>' ),
220 220
 				'cap' => 'manage_options',
221 221
 				'dismiss' => 'php_version',
222 222
 			);
@@ -224,14 +224,14 @@  discard block
 block discarded – undo
224 224
 			return false;
225 225
 		}
226 226
 
227
-		if( false === version_compare( phpversion(), GV_FUTURE_MIN_PHP_VERSION , '>=' ) ) {
227
+		if ( false === version_compare( phpversion(), GV_FUTURE_MIN_PHP_VERSION, '>=' ) ) {
228 228
 
229 229
 			// Show the notice on every update. Yes, annoying, but not as annoying as a plugin breaking.
230
-			$key = sprintf('php_%s_%s', GV_FUTURE_MIN_PHP_VERSION, GravityView_Plugin::version );
230
+			$key = sprintf( 'php_%s_%s', GV_FUTURE_MIN_PHP_VERSION, GravityView_Plugin::version );
231 231
 
232 232
 			self::$notices[ $key ] = array(
233 233
 				'class' => 'error',
234
-				'message' => sprintf( __( "%sGravityView will soon require PHP Version %s.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), '<h3>', GV_FUTURE_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.phpversion().'</span>' ),
234
+				'message' => sprintf( __( "%sGravityView will soon require PHP Version %s.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), '<h3>', GV_FUTURE_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . phpversion() . '</span>' ),
235 235
 				'cap' => 'manage_options',
236 236
 				'dismiss' => $key,
237 237
 			);
@@ -255,9 +255,9 @@  discard block
 block discarded – undo
255 255
 			|| ( false === version_compare( $wp_version, GV_MIN_WP_VERSION, '>=' ) )
256 256
 		) {
257 257
 
258
-			self::$notices['wp_version'] = array(
258
+			self::$notices[ 'wp_version' ] = array(
259 259
 				'class' => 'error',
260
-				'message' => sprintf( __( "%sGravityView requires WordPress %s or newer.%s \n\nYou're using Version %s. Please upgrade your WordPress installation.", 'gravityview' ), '<h3>', GV_MIN_WP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.$wp_version.'</span>' ),
260
+				'message' => sprintf( __( "%sGravityView requires WordPress %s or newer.%s \n\nYou're using Version %s. Please upgrade your WordPress installation.", 'gravityview' ), '<h3>', GV_MIN_WP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . $wp_version . '</span>' ),
261 261
 			    'cap' => 'update_core',
262 262
 				'dismiss' => 'wp_version',
263 263
 			);
@@ -280,10 +280,10 @@  discard block
 block discarded – undo
280 280
 	public static function check_gravityforms() {
281 281
 
282 282
 		// Bypass other checks: if the class exists
283
-		if( class_exists( 'GFCommon' ) ) {
283
+		if ( class_exists( 'GFCommon' ) ) {
284 284
 
285 285
 			// Does the version meet future requirements?
286
-			if( true === version_compare( GFCommon::$version, GV_FUTURE_MIN_GF_VERSION, ">=" ) ) {
286
+			if ( true === version_compare( GFCommon::$version, GV_FUTURE_MIN_GF_VERSION, ">=" ) ) {
287 287
 				return true;
288 288
 			}
289 289
 
@@ -297,9 +297,9 @@  discard block
 block discarded – undo
297 297
 			$class = $meets_minimum ? 'notice-warning' : 'error';
298 298
 
299 299
 			// Show the notice even if the future version requirements aren't met
300
-			self::$notices['gf_version'] = array(
300
+			self::$notices[ 'gf_version' ] = array(
301 301
 				'class' => $class,
302
-				'message' => sprintf( __( "%sGravityView requires Gravity Forms Version %s or newer.%s \n\nYou're using Version %s. Please update your Gravity Forms or purchase a license. %sGet Gravity Forms%s - starting at $39%s%s", 'gravityview' ), '<h3>', GV_FUTURE_MIN_GF_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.GFCommon::$version.'</span>', "\n\n".'<a href="https://katz.si/gravityforms" class="button button-secondary button-large button-hero">' , '<em>', '</em>', '</a>'),
302
+				'message' => sprintf( __( "%sGravityView requires Gravity Forms Version %s or newer.%s \n\nYou're using Version %s. Please update your Gravity Forms or purchase a license. %sGet Gravity Forms%s - starting at $39%s%s", 'gravityview' ), '<h3>', GV_FUTURE_MIN_GF_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . GFCommon::$version . '</span>', "\n\n" . '<a href="https://katz.si/gravityforms" class="button button-secondary button-large button-hero">', '<em>', '</em>', '</a>' ),
303 303
 				'cap' => 'update_plugins',
304 304
 				'dismiss' => 'gf_version_' . GV_FUTURE_MIN_GF_VERSION,
305 305
 			);
@@ -315,42 +315,42 @@  discard block
 block discarded – undo
315 315
 		 * OR
316 316
 		 * It's the Network Admin and we just don't know whether the sites have GF activated themselves.
317 317
 		 */
318
-		if( true === $gf_status || is_network_admin() ) {
318
+		if ( true === $gf_status || is_network_admin() ) {
319 319
 			return true;
320 320
 		}
321 321
 
322 322
 		// If GFCommon doesn't exist, assume GF not active
323 323
 		$return = false;
324 324
 
325
-		switch( $gf_status ) {
325
+		switch ( $gf_status ) {
326 326
 			case 'inactive':
327 327
 
328 328
 				// Required for multisite
329
-				if( ! function_exists('wp_create_nonce') ) {
329
+				if ( ! function_exists( 'wp_create_nonce' ) ) {
330 330
 					require_once ABSPATH . WPINC . '/pluggable.php';
331 331
 				}
332 332
 
333 333
 				// Otherwise, throws an error on activation & deactivation "Use of undefined constant LOGGED_IN_COOKIE"
334
-				if( is_multisite() ) {
334
+				if ( is_multisite() ) {
335 335
 					wp_cookie_constants();
336 336
 				}
337 337
 
338 338
 				$return = false;
339 339
 
340
-				$button = function_exists('is_network_admin') && is_network_admin() ? '<strong><a href="#gravity-forms">' : '<strong><a href="'. wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=gravityforms/gravityforms.php' ), 'activate-plugin_gravityforms/gravityforms.php') . '" class="button button-large">';
340
+				$button = function_exists( 'is_network_admin' ) && is_network_admin() ? '<strong><a href="#gravity-forms">' : '<strong><a href="' . wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=gravityforms/gravityforms.php' ), 'activate-plugin_gravityforms/gravityforms.php' ) . '" class="button button-large">';
341 341
 
342
-				self::$notices['gf_inactive'] = array(
342
+				self::$notices[ 'gf_inactive' ] = array(
343 343
 					'class' => 'error',
344
-					'message' => sprintf( __( '%sGravityView requires Gravity Forms to be active. %sActivate Gravity Forms%s to use the GravityView plugin.', 'gravityview' ), '<h3>', "</h3>\n\n". $button, '</a></strong>' ),
344
+					'message' => sprintf( __( '%sGravityView requires Gravity Forms to be active. %sActivate Gravity Forms%s to use the GravityView plugin.', 'gravityview' ), '<h3>', "</h3>\n\n" . $button, '</a></strong>' ),
345 345
 					'cap' => 'activate_plugins',
346 346
 					'dismiss' => 'gf_inactive',
347 347
 				);
348 348
 
349 349
 				break;
350 350
 			default:
351
-				self::$notices['gf_installed'] = array(
351
+				self::$notices[ 'gf_installed' ] = array(
352 352
 					'class' => 'error',
353
-					'message' => sprintf( __( '%sGravityView requires Gravity Forms to be installed in order to run properly. %sGet Gravity Forms%s - starting at $39%s%s', 'gravityview' ), '<h3>', "</h3>\n\n".'<a href="http://katz.si/gravityforms" class="button button-secondary button-large button-hero">' , '<em>', '</em>', '</a>'),
353
+					'message' => sprintf( __( '%sGravityView requires Gravity Forms to be installed in order to run properly. %sGet Gravity Forms%s - starting at $39%s%s', 'gravityview' ), '<h3>', "</h3>\n\n" . '<a href="http://katz.si/gravityforms" class="button button-secondary button-large button-hero">', '<em>', '</em>', '</a>' ),
354 354
 					'cap' => 'install_plugins',
355 355
 					'dismiss' => 'gf_installed',
356 356
 				);
@@ -367,10 +367,10 @@  discard block
 block discarded – undo
367 367
 	 */
368 368
 	private static function check_gf_directory() {
369 369
 
370
-		if( class_exists( 'GFDirectory' ) ) {
371
-			self::$notices['gf_directory'] = array(
370
+		if ( class_exists( 'GFDirectory' ) ) {
371
+			self::$notices[ 'gf_directory' ] = array(
372 372
 				'class' => 'error is-dismissible',
373
-				'title' => __('Potential Conflict', 'gravityview' ),
373
+				'title' => __( 'Potential Conflict', 'gravityview' ),
374 374
 				'message' => __( 'GravityView and Gravity Forms Directory are both active. This may cause problems. If you experience issues, disable the Gravity Forms Directory plugin.', 'gravityview' ),
375 375
 				'dismiss' => 'gf_directory',
376 376
 				'cap' => 'activate_plugins',
@@ -389,21 +389,21 @@  discard block
 block discarded – undo
389 389
 	 */
390 390
 	public static function get_plugin_status( $location = '' ) {
391 391
 
392
-		if( ! function_exists('is_plugin_active') ) {
392
+		if ( ! function_exists( 'is_plugin_active' ) ) {
393 393
 			include_once( ABSPATH . '/wp-admin/includes/plugin.php' );
394 394
 		}
395 395
 
396
-		if( is_network_admin() && is_plugin_active_for_network( $location ) ) {
396
+		if ( is_network_admin() && is_plugin_active_for_network( $location ) ) {
397 397
 			return true;
398 398
 		}
399 399
 
400
-		if( !is_network_admin() && is_plugin_active( $location ) ) {
400
+		if ( ! is_network_admin() && is_plugin_active( $location ) ) {
401 401
 			return true;
402 402
 		}
403 403
 
404
-		if(
405
-			!file_exists( trailingslashit( WP_PLUGIN_DIR ) . $location ) &&
406
-			!file_exists( trailingslashit( WPMU_PLUGIN_DIR ) . $location )
404
+		if (
405
+			! file_exists( trailingslashit( WP_PLUGIN_DIR ) . $location ) &&
406
+			! file_exists( trailingslashit( WPMU_PLUGIN_DIR ) . $location )
407 407
 		) {
408 408
 			return false;
409 409
 		}
Please login to merge, or discard this patch.
includes/class-gravityview-entry-link-shortcode.php 2 patches
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -221,7 +221,6 @@  discard block
 block discarded – undo
221 221
 	 *
222 222
 	 * @since 1.15
223 223
 	 *
224
-	 * @param string|null $content Content inside shortcode, if defined
225 224
 	 *
226 225
 	 * @return string|boolean If URL is fetched, the URL to the entry link. If not found, returns false.
227 226
 	 */
@@ -316,7 +315,7 @@  discard block
 block discarded – undo
316 315
 	 *
317 316
 	 * @since 1.15
318 317
 	 *
319
-	 * @param string $href URL
318
+	 * @param string|null $url
320 319
 	 */
321 320
 	private function maybe_add_field_values_query_args( $url ) {
322 321
 
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 * @copydoc GravityView_Entry_Link_Shortcode::shortcode
73 73
 	 */
74 74
 	public function edit_shortcode( $atts, $content = null, $context = 'gv_edit_entry_link' ) {
75
-		$atts['action'] = 'edit';
75
+		$atts[ 'action' ] = 'edit';
76 76
 
77 77
 		return $this->shortcode( $atts, $content, $context );
78 78
 	}
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 * @copydoc GravityView_Entry_Link_Shortcode::shortcode
86 86
 	 */
87 87
 	public function delete_shortcode( $atts, $content = null, $context = 'gv_delete_entry_link' ) {
88
-		$atts['action'] = 'delete';
88
+		$atts[ 'action' ] = 'delete';
89 89
 
90 90
 		return $this->shortcode( $atts, $content, $context );
91 91
 	}
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 
127 127
 		$this->settings = shortcode_atts( self::$defaults, $atts, $context );
128 128
 
129
-		$this->view_id = empty( $this->settings['view_id'] ) ? GravityView_View::getInstance()->getViewId() : absint( $this->settings['view_id'] );
129
+		$this->view_id = empty( $this->settings[ 'view_id' ] ) ? GravityView_View::getInstance()->getViewId() : absint( $this->settings[ 'view_id' ] );
130 130
 
131 131
 		if ( empty( $this->view_id ) ) {
132 132
 			do_action( 'gravityview_log_error', __METHOD__ . ' A View ID was not defined and we are not inside a View' );
@@ -134,12 +134,12 @@  discard block
 block discarded – undo
134 134
 			return null;
135 135
 		}
136 136
 
137
-		$this->entry = $this->get_entry( $this->settings['entry_id'] );
137
+		$this->entry = $this->get_entry( $this->settings[ 'entry_id' ] );
138 138
 
139 139
 		do_action( 'gravityview_log_debug', __METHOD__ . ' ' . $context . ' $atts: ', $atts );
140 140
 
141 141
 		if ( ! $this->has_cap() ) {
142
-			do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the capability to ' . esc_attr( $this->settings['action'] ) . ' this entry: ' . $this->entry['id'] );
142
+			do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the capability to ' . esc_attr( $this->settings[ 'action' ] ) . ' this entry: ' . $this->entry[ 'id' ] );
143 143
 
144 144
 			return null;
145 145
 		}
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 		}
154 154
 
155 155
 		// Get just the URL, not the tag
156
-		if ( 'url' === $this->settings['return'] ) {
156
+		if ( 'url' === $this->settings[ 'return' ] ) {
157 157
 			return $url;
158 158
 		}
159 159
 
@@ -174,13 +174,13 @@  discard block
 block discarded – undo
174 174
 	 */
175 175
 	private function get_link_atts() {
176 176
 
177
-		wp_parse_str( $this->settings['link_atts'], $link_atts );
177
+		wp_parse_str( $this->settings[ 'link_atts' ], $link_atts );
178 178
 
179
-		if ( 'delete' === $this->settings['action'] ) {
180
-			$link_atts['onclick'] = isset( $link_atts['onclick'] ) ? $link_atts['onclick'] : GravityView_Delete_Entry::get_confirm_dialog();
179
+		if ( 'delete' === $this->settings[ 'action' ] ) {
180
+			$link_atts[ 'onclick' ] = isset( $link_atts[ 'onclick' ] ) ? $link_atts[ 'onclick' ] : GravityView_Delete_Entry::get_confirm_dialog();
181 181
 		}
182 182
 
183
-		return (array) $link_atts;
183
+		return (array)$link_atts;
184 184
 	}
185 185
 
186 186
 	/**
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 			return $content;
201 201
 		}
202 202
 
203
-		switch ( $this->settings['action'] ) {
203
+		switch ( $this->settings[ 'action' ] ) {
204 204
 			case 'edit':
205 205
 				$anchor_text = __( 'Edit Entry', 'gravityview' );
206 206
 				break;
@@ -228,9 +228,9 @@  discard block
 block discarded – undo
228 228
 	private function get_url() {
229 229
 
230 230
 		// if post_id is not defined, default to view_id
231
-		$post_id = empty( $this->settings['post_id'] ) ? $this->view_id : absint( $this->settings['post_id'] );
231
+		$post_id = empty( $this->settings[ 'post_id' ] ) ? $this->view_id : absint( $this->settings[ 'post_id' ] );
232 232
 
233
-		switch ( $this->settings['action'] ) {
233
+		switch ( $this->settings[ 'action' ] ) {
234 234
 			case 'edit':
235 235
 				$url = GravityView_Edit_Entry::get_edit_link( $this->entry, $this->view_id, $post_id );
236 236
 				break;
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 	 */
256 256
 	private function has_cap() {
257 257
 
258
-		switch ( $this->settings['action'] ) {
258
+		switch ( $this->settings[ 'action' ] ) {
259 259
 			case 'edit':
260 260
 				$has_cap = GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry, $this->view_id );
261 261
 				break;
@@ -320,9 +320,9 @@  discard block
 block discarded – undo
320 320
 	 */
321 321
 	private function maybe_add_field_values_query_args( $url ) {
322 322
 
323
-		if ( $url && ! empty( $this->settings['field_values'] ) ) {
323
+		if ( $url && ! empty( $this->settings[ 'field_values' ] ) ) {
324 324
 
325
-			wp_parse_str( $this->settings['field_values'], $field_values );
325
+			wp_parse_str( $this->settings[ 'field_values' ], $field_values );
326 326
 
327 327
 			$url = add_query_arg( $field_values, $url );
328 328
 		}
Please login to merge, or discard this patch.
includes/class-gravityview-extension.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -278,7 +278,7 @@
 block discarded – undo
278 278
 
279 279
 	/**
280 280
 	 * Add a notice to be displayed in the admin.
281
-	 * @param array $notice Array with `class` and `message` keys. The message is not escaped.
281
+	 * @param string $notice Array with `class` and `message` keys. The message is not escaped.
282 282
 	 */
283 283
 	public static function add_notice( $notice = array() ) {
284 284
 
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -244,13 +244,13 @@
 block discarded – undo
244 244
 			$this->_remote_update_url,
245 245
 			$this->_path,
246 246
 			array(
247
-            	'version'	=> $this->_version, // current version number
248
-            	'license'	=> $license['license'],
249
-	            'item_id'   => $this->_item_id, // The ID of the download on _remote_update_url
250
-            	'item_name' => $this->_title,  // name of this plugin
251
-            	'author' 	=> strip_tags( $this->_author )  // author of this plugin
252
-          	)
253
-        );
247
+				'version'	=> $this->_version, // current version number
248
+				'license'	=> $license['license'],
249
+				'item_id'   => $this->_item_id, // The ID of the download on _remote_update_url
250
+				'item_name' => $this->_title,  // name of this plugin
251
+				'author' 	=> strip_tags( $this->_author )  // author of this plugin
252
+		  	)
253
+		);
254 254
 	}
255 255
 
256 256
 	/**
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -71,13 +71,13 @@  discard block
 block discarded – undo
71 71
 
72 72
 		add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
73 73
 
74
-		add_action( 'admin_init', array( $this, 'settings') );
74
+		add_action( 'admin_init', array( $this, 'settings' ) );
75 75
 
76 76
 		add_action( 'admin_notices', array( $this, 'admin_notice' ), 100 );
77 77
 
78 78
 		add_action( 'gravityview/metaboxes/before_render', array( $this, 'add_metabox_tab' ) );
79 79
 
80
-		if( false === $this->is_extension_supported() ) {
80
+		if ( false === $this->is_extension_supported() ) {
81 81
 			return;
82 82
 		}
83 83
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 		$tab_settings = $this->tab_settings();
117 117
 
118 118
 		// Don't add a tab if it's empty.
119
-		if( empty( $tab_settings ) ) {
119
+		if ( empty( $tab_settings ) ) {
120 120
 			return;
121 121
 		}
122 122
 
@@ -134,17 +134,17 @@  discard block
 block discarded – undo
134 134
 		$tab = wp_parse_args( $tab_settings, $tab_defaults );
135 135
 
136 136
 		// Force the screen to be GravityView
137
-		$tab['screen'] = 'gravityview';
137
+		$tab[ 'screen' ] = 'gravityview';
138 138
 
139
-		if( class_exists('GravityView_Metabox_Tab') ) {
139
+		if ( class_exists( 'GravityView_Metabox_Tab' ) ) {
140 140
 
141
-			$metabox = new GravityView_Metabox_Tab( $tab['id'], $tab['title'], $tab['file'], $tab['icon-class'], $tab['callback'], $tab['callback_args'] );
141
+			$metabox = new GravityView_Metabox_Tab( $tab[ 'id' ], $tab[ 'title' ], $tab[ 'file' ], $tab[ 'icon-class' ], $tab[ 'callback' ], $tab[ 'callback_args' ] );
142 142
 
143 143
 			GravityView_Metabox_Tabs::add( $metabox );
144 144
 
145 145
 		} else {
146 146
 
147
-			add_meta_box( 'gravityview_'.$tab['id'], $tab['title'], $tab['callback'], $tab['screen'], $tab['context'], $tab['priority'] );
147
+			add_meta_box( 'gravityview_' . $tab[ 'id' ], $tab[ 'title' ], $tab[ 'callback' ], $tab[ 'screen' ], $tab[ 'context' ], $tab[ 'priority' ] );
148 148
 
149 149
 		}
150 150
 	}
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	 */
161 161
 	public function load_plugin_textdomain() {
162 162
 
163
-		if( empty( $this->_text_domain ) ) {
163
+		if ( empty( $this->_text_domain ) ) {
164 164
 			do_action( 'gravityview_log_debug', __METHOD__ . ': Extension translation cannot be loaded; the `_text_domain` variable is not defined', $this );
165 165
 			return;
166 166
 		}
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 		$lang_dir = dirname( plugin_basename( $path ) ) . '/languages/';
173 173
 
174 174
 		// Traditional WordPress plugin locale filter
175
-		$locale = apply_filters( 'plugin_locale',  get_locale(), $this->_text_domain );
175
+		$locale = apply_filters( 'plugin_locale', get_locale(), $this->_text_domain );
176 176
 
177 177
 		$mofile = sprintf( '%1$s-%2$s.mo', $this->_text_domain, $locale );
178 178
 
@@ -202,11 +202,11 @@  discard block
 block discarded – undo
202 202
 	 */
203 203
 	protected function get_license() {
204 204
 
205
-		if( !class_exists( 'GravityView_Settings' ) ) {
205
+		if ( ! class_exists( 'GravityView_Settings' ) ) {
206 206
 			return false;
207 207
 		}
208 208
 
209
-		$license = GravityView_Settings::getSetting('license');
209
+		$license = GravityView_Settings::getSetting( 'license' );
210 210
 
211 211
 		return $license;
212 212
 	}
@@ -219,16 +219,16 @@  discard block
 block discarded – undo
219 219
 	public function settings() {
220 220
 
221 221
 		// If doing ajax, get outta here
222
-		if( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) )  {
222
+		if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
223 223
 			return;
224 224
 		}
225 225
 
226
-		if( !class_exists( 'EDD_SL_Plugin_Updater' ) ) {
226
+		if ( ! class_exists( 'EDD_SL_Plugin_Updater' ) ) {
227 227
 
228 228
 			$file_path = plugin_dir_path( __FILE__ ) . 'lib/EDD_SL_Plugin_Updater.php';
229 229
 
230 230
 			// This file may be in the lib/ directory already
231
-			if( ! file_exists( $file_path ) ) {
231
+			if ( ! file_exists( $file_path ) ) {
232 232
 				$file_path = plugin_dir_path( __FILE__ ) . '/EDD_SL_Plugin_Updater.php';
233 233
 			}
234 234
 
@@ -238,16 +238,16 @@  discard block
 block discarded – undo
238 238
 		$license = $this->get_license();
239 239
 
240 240
 		// Don't update if invalid license.
241
-		if( false === $license || empty( $license['status'] ) || strtolower( $license['status'] ) !== 'valid' ) { return; }
241
+		if ( false === $license || empty( $license[ 'status' ] ) || strtolower( $license[ 'status' ] ) !== 'valid' ) { return; }
242 242
 
243 243
 		new EDD_SL_Plugin_Updater(
244 244
 			$this->_remote_update_url,
245 245
 			$this->_path,
246 246
 			array(
247 247
             	'version'	=> $this->_version, // current version number
248
-            	'license'	=> $license['license'],
248
+            	'license'	=> $license[ 'license' ],
249 249
 	            'item_id'   => $this->_item_id, // The ID of the download on _remote_update_url
250
-            	'item_name' => $this->_title,  // name of this plugin
250
+            	'item_name' => $this->_title, // name of this plugin
251 251
             	'author' 	=> strip_tags( $this->_author )  // author of this plugin
252 252
           	)
253 253
         );
@@ -260,14 +260,14 @@  discard block
 block discarded – undo
260 260
 	 */
261 261
 	public function admin_notice() {
262 262
 
263
-		if( empty( self::$admin_notices ) ) {
263
+		if ( empty( self::$admin_notices ) ) {
264 264
 			return;
265 265
 		}
266 266
 
267
-		foreach( self::$admin_notices as $key => $notice ) {
267
+		foreach ( self::$admin_notices as $key => $notice ) {
268 268
 
269
-			echo '<div id="message" class="'. esc_attr( $notice['class'] ).'">';
270
-			echo wpautop( $notice['message'] );
269
+			echo '<div id="message" class="' . esc_attr( $notice[ 'class' ] ) . '">';
270
+			echo wpautop( $notice[ 'message' ] );
271 271
 			echo '<div class="clear"></div>';
272 272
 			echo '</div>';
273 273
 		}
@@ -282,16 +282,16 @@  discard block
 block discarded – undo
282 282
 	 */
283 283
 	public static function add_notice( $notice = array() ) {
284 284
 
285
-		if( is_array( $notice ) && !isset( $notice['message'] ) ) {
286
-			do_action( 'gravityview_log_error', __CLASS__.'[add_notice] Notice not set', $notice );
285
+		if ( is_array( $notice ) && ! isset( $notice[ 'message' ] ) ) {
286
+			do_action( 'gravityview_log_error', __CLASS__ . '[add_notice] Notice not set', $notice );
287 287
 			return;
288
-		} else if( is_string( $notice ) ) {
288
+		} else if ( is_string( $notice ) ) {
289 289
 			$notice = array( 'message' => $notice );
290 290
 		}
291 291
 
292
-		$notice['class'] = empty( $notice['class'] ) ? 'error' : $notice['class'];
292
+		$notice[ 'class' ] = empty( $notice[ 'class' ] ) ? 'error' : $notice[ 'class' ];
293 293
 
294
-		self::$admin_notices[] = $notice;
294
+		self::$admin_notices[ ] = $notice;
295 295
 	}
296 296
 
297 297
 	/**
@@ -346,17 +346,17 @@  discard block
 block discarded – undo
346 346
 
347 347
 		$message = '';
348 348
 
349
-		if( !class_exists( 'GravityView_Plugin' ) ) {
349
+		if ( ! class_exists( 'GravityView_Plugin' ) ) {
350 350
 
351
-			$message = sprintf( __('Could not activate the %s Extension; GravityView is not active.', 'gravityview'), $this->_title );
351
+			$message = sprintf( __( 'Could not activate the %s Extension; GravityView is not active.', 'gravityview' ), $this->_title );
352 352
 
353
-		} else if( false === version_compare(GravityView_Plugin::version, $this->_min_gravityview_version , ">=") ) {
353
+		} else if ( false === version_compare( GravityView_Plugin::version, $this->_min_gravityview_version, ">=" ) ) {
354 354
 
355
-			$message = sprintf( __('The %s Extension requires GravityView Version %s or newer.', 'gravityview' ), $this->_title, '<tt>'.$this->_min_gravityview_version.'</tt>' );
355
+			$message = sprintf( __( 'The %s Extension requires GravityView Version %s or newer.', 'gravityview' ), $this->_title, '<tt>' . $this->_min_gravityview_version . '</tt>' );
356 356
 
357
-		} else if( isset( $this->_min_php_version ) && false === version_compare( phpversion(), $this->_min_php_version , ">=") ) {
357
+		} else if ( isset( $this->_min_php_version ) && false === version_compare( phpversion(), $this->_min_php_version, ">=" ) ) {
358 358
 
359
-			$message = sprintf( __('The %s Extension requires PHP Version %s or newer. Please ask your host to upgrade your server\'s PHP.', 'gravityview' ), $this->_title, '<tt>'.$this->_min_php_version.'</tt>' );
359
+			$message = sprintf( __( 'The %s Extension requires PHP Version %s or newer. Please ask your host to upgrade your server\'s PHP.', 'gravityview' ), $this->_title, '<tt>' . $this->_min_php_version . '</tt>' );
360 360
 
361 361
 		} else {
362 362
 
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 
369 369
 			self::add_notice( $message );
370 370
 
371
-			do_action( 'gravityview_log_error', __METHOD__. ' ' . $message );
371
+			do_action( 'gravityview_log_error', __METHOD__ . ' ' . $message );
372 372
 
373 373
 			self::$is_compatible = false;
374 374
 		}
Please login to merge, or discard this patch.
Braces   +3 added lines, -5 removed lines patch added patch discarded remove patch
@@ -183,12 +183,10 @@  discard block
 block discarded – undo
183 183
 		if ( file_exists( $mofile_global ) ) {
184 184
 			// Look in global /wp-content/languages/[plugin-dir]/ folder
185 185
 			load_textdomain( $this->_text_domain, $mofile_global );
186
-		}
187
-		elseif ( file_exists( $mofile_local ) ) {
186
+		} elseif ( file_exists( $mofile_local ) ) {
188 187
 			// Look in local /wp-content/plugins/[plugin-dir]/languages/ folder
189 188
 			load_textdomain( $this->_text_domain, $mofile_local );
190
-		}
191
-		else {
189
+		} else {
192 190
 			// Load the default language files
193 191
 			load_plugin_textdomain( $this->_text_domain, false, $lang_dir );
194 192
 		}
@@ -219,7 +217,7 @@  discard block
 block discarded – undo
219 217
 	public function settings() {
220 218
 
221 219
 		// If doing ajax, get outta here
222
-		if( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) )  {
220
+		if( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
223 221
 			return;
224 222
 		}
225 223
 
Please login to merge, or discard this patch.
includes/class-gravityview-merge-tags.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@
 block discarded – undo
135 135
 	 * @param bool $url_encode Whether to URL-encode output
136 136
 	 * @param bool $esc_html Whether to apply `esc_html()` to output
137 137
 	 *
138
-	 * @return mixed
138
+	 * @return string
139 139
 	 */
140 140
 	public static function replace_gv_merge_tags(  $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
141 141
 
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 		$gv_modifiers = array(
54 54
 			'maxwords:(\d+)' => 'modifier_maxwords', /** @see modifier_maxwords */
55 55
 			'wpautop' => 'modifier_wpautop', /** @see modifier_wpautop */
56
-		    'timestamp' => 'modifier_timestamp', /** @see modifier_timestamp */
56
+			'timestamp' => 'modifier_timestamp', /** @see modifier_timestamp */
57 57
 		);
58 58
 		
59 59
 		$return = $value;
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 
254 254
 		$atts = array(
255 255
 			'format' => self::get_format_from_modifiers( $exploded, false ),
256
-		    'human' => in_array( 'human', $exploded ), // {date_created:human}
256
+			'human' => in_array( 'human', $exploded ), // {date_created:human}
257 257
 			'diff' => in_array( 'diff', $exploded ), // {date_created:diff}
258 258
 			'raw' => in_array( 'raw', $exploded ), // {date_created:raw}
259 259
 			'timestamp' => in_array( 'timestamp', $exploded ), // {date_created:timestamp}
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	public static function process_modifiers( $value, $merge_tag, $modifier, $field, $raw_value ) {
46 46
 
47 47
 		// No modifier was set or the raw value was empty
48
-		if( 'all_fields' === $merge_tag || '' === $modifier || ! is_string( $raw_value ) || '' === $raw_value ) {
48
+		if ( 'all_fields' === $merge_tag || '' === $modifier || ! is_string( $raw_value ) || '' === $raw_value ) {
49 49
 			return $value;
50 50
 		}
51 51
 
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
 		foreach ( $gv_modifiers as $gv_modifier => $method ) {
62 62
 
63 63
 			// Only match the regex if it's the first modifer; this allows us to enforce our own modifier structure
64
-			preg_match( '/^' . $gv_modifier .'/ism', $modifier, $matches );
64
+			preg_match( '/^' . $gv_modifier . '/ism', $modifier, $matches );
65 65
 
66
-			if( ! empty( $matches ) ) {
66
+			if ( ! empty( $matches ) ) {
67 67
 				// The called method is passed the raw value and the full matches array
68 68
 				$return = self::$method( $raw_value, $matches );
69 69
 				break;
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 */
88 88
 	private static function modifier_timestamp( $raw_value, $matches ) {
89 89
 
90
-		if( empty( $matches[0] ) ) {
90
+		if ( empty( $matches[ 0 ] ) ) {
91 91
 			return $raw_value;
92 92
 		}
93 93
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 */
112 112
 	private static function modifier_wpautop( $raw_value, $matches ) {
113 113
 
114
-		if( empty( $matches[0] ) || ! function_exists( 'wpautop' ) ) {
114
+		if ( empty( $matches[ 0 ] ) || ! function_exists( 'wpautop' ) ) {
115 115
 			return $raw_value;
116 116
 		}
117 117
 
@@ -135,11 +135,11 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	private static function modifier_maxwords( $raw_value, $matches ) {
137 137
 
138
-		if( ! is_string( $raw_value ) || empty( $matches[1] ) || ! function_exists( 'wp_trim_words' ) ) {
138
+		if ( ! is_string( $raw_value ) || empty( $matches[ 1 ] ) || ! function_exists( 'wp_trim_words' ) ) {
139 139
 			return $raw_value;
140 140
 		}
141 141
 
142
-		$max = intval( $matches[1] );
142
+		$max = intval( $matches[ 1 ] );
143 143
 
144 144
 		$more_placeholder = '[GVMORE]';
145 145
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 	 * @param  bool             $esc_html     Pass return value through `esc_html()`
172 172
 	 * @return string           Text with variables maybe replaced
173 173
 	 */
174
-	public static function replace_variables($text, $form = array(), $entry = array(), $url_encode = false, $esc_html = true ) {
174
+	public static function replace_variables( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = true ) {
175 175
 
176 176
 		/**
177 177
 		 * @filter `gravityview_do_replace_variables` Turn off merge tag variable replacements.\n
@@ -196,9 +196,9 @@  discard block
 block discarded – undo
196 196
 		 * @internal Fixed $form['title'] in Gravity Forms
197 197
 		 * @see      https://github.com/gravityforms/gravityforms/pull/27/files
198 198
 		 */
199
-		$form['title']  = isset( $form['title'] ) ? $form['title'] : '';
200
-		$form['id']     = isset( $form['id'] ) ? $form['id'] : '';
201
-		$form['fields'] = isset( $form['fields'] ) ? $form['fields'] : array();
199
+		$form[ 'title' ]  = isset( $form[ 'title' ] ) ? $form[ 'title' ] : '';
200
+		$form[ 'id' ]     = isset( $form[ 'id' ] ) ? $form[ 'id' ] : '';
201
+		$form[ 'fields' ] = isset( $form[ 'fields' ] ) ? $form[ 'fields' ] : array();
202 202
 
203 203
 		return GFCommon::replace_variables( $text, $form, $entry, $url_encode, $esc_html );
204 204
 	}
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 	 *
219 219
 	 * @return mixed
220 220
 	 */
221
-	public static function replace_gv_merge_tags(  $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
221
+	public static function replace_gv_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
222 222
 
223 223
 		/**
224 224
 		 * This prevents the gform_replace_merge_tags filter from being called twice, as defined in:
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 		 * @see GFCommon::replace_variables_prepopulate()
227 227
 		 * @todo Remove eventually: Gravity Forms fixed this issue in 1.9.14
228 228
 		 */
229
-		if( false === $form ) {
229
+		if ( false === $form ) {
230 230
 			return $text;
231 231
 		}
232 232
 
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 			'diff' => in_array( 'diff', $exploded ), // {date_created:diff}
259 259
 			'raw' => in_array( 'raw', $exploded ), // {date_created:raw}
260 260
 			'timestamp' => in_array( 'timestamp', $exploded ), // {date_created:timestamp}
261
-			'time' => in_array( 'time', $exploded ),  // {date_created:time}
261
+			'time' => in_array( 'time', $exploded ), // {date_created:time}
262 262
 		);
263 263
 
264 264
 		$formatted_date = GVCommon::format_date( $date_created, $atts );
@@ -321,14 +321,14 @@  discard block
 block discarded – undo
321 321
 		preg_match_all( "/{get:(.*?)}/ism", $text, $matches, PREG_SET_ORDER );
322 322
 
323 323
 		// If there are no matches OR the Entry `created_by` isn't set or is 0 (no user)
324
-		if( empty( $matches ) ) {
324
+		if ( empty( $matches ) ) {
325 325
 			return $text;
326 326
 		}
327 327
 
328 328
 		foreach ( $matches as $match ) {
329 329
 
330
-			$full_tag = $match[0];
331
-			$property = $match[1];
330
+			$full_tag = $match[ 0 ];
331
+			$property = $match[ 1 ];
332 332
 
333 333
 			$value = stripslashes_deep( rgget( $property ) );
334 334
 
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 			 * @since 1.15
353 353
 			 * @param bool $esc_html Whether to esc_html() the value. Default: `true`
354 354
 			 */
355
-			$esc_html = apply_filters('gravityview/merge_tags/get/esc_html/' . $property, true );
355
+			$esc_html = apply_filters( 'gravityview/merge_tags/get/esc_html/' . $property, true );
356 356
 
357 357
 			$value = $esc_html ? esc_html( $value ) : $value;
358 358
 
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 			 * @param[in] array $form Gravity Forms form array
364 364
 			 * @param[in] array $entry Entry array
365 365
 			 */
366
-			$value = apply_filters('gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry );
366
+			$value = apply_filters( 'gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry );
367 367
 
368 368
 			$text = str_replace( $full_tag, $value, $text );
369 369
 		}
Please login to merge, or discard this patch.
includes/class-gravityview-roles-capabilities.php 3 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,6 @@
 block discarded – undo
67 67
 	 *
68 68
 	 * @since 1.15
69 69
 	 *
70
-	 * @param array   $allcaps An array of all the user's capabilities.
71 70
 	 * @param array   $caps    Actual capabilities for meta capability.
72 71
 	 * @param array   $args    Optional parameters passed to has_cap(), typically object ID.
73 72
 	 * @param WP_User|null $user    The user object, in WordPress 3.7.0 or higher
Please login to merge, or discard this patch.
Indentation   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		add_filter( 'members_get_capabilities', array( 'GravityView_Roles_Capabilities', 'merge_with_all_caps' ) );
57 57
 		add_action( 'members_register_cap_groups', array( $this, 'members_register_cap_group' ), 20 );
58 58
 		add_filter( 'user_has_cap', array( $this, 'filter_user_has_cap' ), 10, 4 );
59
-        add_action( 'admin_init', array( $this, 'add_caps') );
59
+		add_action( 'admin_init', array( $this, 'add_caps') );
60 60
 	}
61 61
 
62 62
 
@@ -360,7 +360,6 @@  discard block
 block discarded – undo
360 360
 	 * Add Gravity Forms and GravityView's "full access" caps when any other caps are checked against.
361 361
 	 *
362 362
 	 * @since 1.15
363
-
364 363
 	 * @param array $caps_to_check
365 364
 	 *
366 365
 	 * @return array
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	 */
34 34
 	public static function get_instance() {
35 35
 
36
-		if( ! self::$instance ) {
36
+		if ( ! self::$instance ) {
37 37
 			self::$instance = new self;
38 38
 		}
39 39
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		add_filter( 'members_get_capabilities', array( 'GravityView_Roles_Capabilities', 'merge_with_all_caps' ) );
57 57
 		add_action( 'members_register_cap_groups', array( $this, 'members_register_cap_group' ), 20 );
58 58
 		add_filter( 'user_has_cap', array( $this, 'filter_user_has_cap' ), 10, 4 );
59
-        add_action( 'admin_init', array( $this, 'add_caps') );
59
+        add_action( 'admin_init', array( $this, 'add_caps' ) );
60 60
 	}
61 61
 
62 62
 
@@ -77,18 +77,18 @@  discard block
 block discarded – undo
77 77
 	public function filter_user_has_cap( $usercaps = array(), $caps = array(), $args = array(), $user = NULL ) {
78 78
 
79 79
 		// Empty caps_to_check array
80
-		if( ! $usercaps || ! $caps ) {
80
+		if ( ! $usercaps || ! $caps ) {
81 81
 			return $usercaps;
82 82
 		}
83 83
 
84 84
 		/**
85 85
 		 * Enable all GravityView caps_to_check if `gravityview_full_access` is enabled
86 86
 		 */
87
-		if( ! empty( $usercaps['gravityview_full_access'] ) ) {
87
+		if ( ! empty( $usercaps[ 'gravityview_full_access' ] ) ) {
88 88
 
89 89
 			$all_gravityview_caps = self::all_caps();
90 90
 
91
-			foreach( $all_gravityview_caps as $gv_cap ) {
91
+			foreach ( $all_gravityview_caps as $gv_cap ) {
92 92
 				$usercaps[ $gv_cap ] = true;
93 93
 			}
94 94
 
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 		$all = $administrator;
307 307
 
308 308
 		// If role is set, return caps_to_check for just that role.
309
-		if( $single_role ) {
309
+		if ( $single_role ) {
310 310
 			$caps = isset( ${$single_role} ) ? ${$single_role} : false;
311 311
 			return $flat_array ? $caps : array( $single_role => $caps );
312 312
 		}
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 	 */
335 335
 	public static function has_cap( $caps_to_check = '', $object_id = null, $user_id = null ) {
336 336
 
337
-		if( ! is_user_logged_in() || empty( $caps_to_check ) ) {
337
+		if ( ! is_user_logged_in() || empty( $caps_to_check ) ) {
338 338
 			return false;
339 339
 		}
340 340
 
@@ -344,13 +344,13 @@  discard block
 block discarded – undo
344 344
 		$caps_to_check = self::maybe_add_full_access_caps( $caps_to_check );
345 345
 
346 346
 		foreach ( $caps_to_check as $cap ) {
347
-			if( ! is_null( $object_id ) ) {
347
+			if ( ! is_null( $object_id ) ) {
348 348
 				$has_cap = $user_id ? user_can( $user_id, $cap, $object_id ) : current_user_can( $cap, $object_id );
349 349
 			} else {
350 350
 				$has_cap = $user_id ? user_can( $user_id, $cap ) : current_user_can( $cap );
351 351
 			}
352 352
 			// At the first successful response, stop checking
353
-			if( $has_cap ) {
353
+			if ( $has_cap ) {
354 354
 				break;
355 355
 			}
356 356
 		}
@@ -374,15 +374,15 @@  discard block
 block discarded – undo
374 374
 		$all_gravityview_caps = self::all_caps();
375 375
 
376 376
 		// Are there any $caps_to_check that are from GravityView?
377
-		if( $has_gravityview_caps = array_intersect( $caps_to_check, $all_gravityview_caps ) ) {
378
-			$caps_to_check[] = 'gravityview_full_access';
377
+		if ( $has_gravityview_caps = array_intersect( $caps_to_check, $all_gravityview_caps ) ) {
378
+			$caps_to_check[ ] = 'gravityview_full_access';
379 379
 		}
380 380
 
381 381
 		$all_gravity_forms_caps = class_exists( 'GFCommon' ) ? GFCommon::all_caps() : array();
382 382
 
383 383
 		// Are there any $caps_to_check that are from Gravity Forms?
384
-		if( $all_gravity_forms_caps = array_intersect( $caps_to_check, $all_gravity_forms_caps ) ) {
385
-			$caps_to_check[] = 'gform_full_access';
384
+		if ( $all_gravity_forms_caps = array_intersect( $caps_to_check, $all_gravity_forms_caps ) ) {
385
+			$caps_to_check[ ] = 'gform_full_access';
386 386
 		}
387 387
 
388 388
 		return array_unique( $caps_to_check );
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 			$capabilities = self::all_caps();
405 405
 
406 406
 			// Loop through each role and remove GV caps_to_check
407
-			foreach( $wp_roles->get_names() as $role_slug => $role_name ) {
407
+			foreach ( $wp_roles->get_names() as $role_slug => $role_name ) {
408 408
 				foreach ( $capabilities as $cap ) {
409 409
 					$wp_roles->remove_cap( $role_slug, $cap );
410 410
 				}
Please login to merge, or discard this patch.
includes/class-gravityview-template.php 2 patches
Doc Comments   +8 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,6 +37,9 @@  discard block
 block discarded – undo
37 37
 	public $active_areas;
38 38
 
39 39
 
40
+	/**
41
+	 * @param string $id
42
+	 */
40 43
 	function __construct( $id, $settings = array(), $field_options = array(), $areas = array() ) {
41 44
 
42 45
 		if ( empty( $id ) ) {
@@ -144,6 +147,9 @@  discard block
 block discarded – undo
144 147
 		return $areas;
145 148
 	}
146 149
 
150
+	/**
151
+	 * @param string $context
152
+	 */
147 153
 	public function get_active_areas( $context ) {
148 154
 		if ( isset( $this->active_areas[ $context ] ) ) {
149 155
 			return $this->active_areas[ $context ];
@@ -156,8 +162,8 @@  discard block
 block discarded – undo
156 162
 	/**
157 163
 	 * Assign template specific field options
158 164
 	 *
159
-	 * @param array $options (default: array())
160
-	 * @param string $template (default: '')
165
+	 * @param array $field_options (default: array())
166
+	 * @param string $template_id (default: '')
161 167
 	 * @param string $field_id key for the field
162 168
 	 * @param  string|array $context Context for the field; `directory` or `single` for example.
163 169
 	 *
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -193,8 +193,8 @@  discard block
 block discarded – undo
193 193
 	 * @return string                Path to XML file
194 194
 	 */
195 195
 	public function assign_form_xml( $xml = '', $template = '' ) {
196
-		if ( $this->settings['type'] === 'preset' && ! empty( $this->settings['preset_form'] ) && $this->template_id === $template ) {
197
-			return $this->settings['preset_form'];
196
+		if ( $this->settings[ 'type' ] === 'preset' && ! empty( $this->settings[ 'preset_form' ] ) && $this->template_id === $template ) {
197
+			return $this->settings[ 'preset_form' ];
198 198
 		}
199 199
 
200 200
 		return $xml;
@@ -207,8 +207,8 @@  discard block
 block discarded – undo
207 207
 	 * @return string                Path to XML file
208 208
 	 */
209 209
 	public function assign_fields_xml( $xml = '', $template = '' ) {
210
-		if ( $this->settings['type'] === 'preset' && ! empty( $this->settings['preset_fields'] ) && $this->template_id === $template ) {
211
-			return $this->settings['preset_fields'];
210
+		if ( $this->settings[ 'type' ] === 'preset' && ! empty( $this->settings[ 'preset_fields' ] ) && $this->template_id === $template ) {
211
+			return $this->settings[ 'preset_fields' ];
212 212
 		}
213 213
 
214 214
 		return $xml;
@@ -226,8 +226,8 @@  discard block
 block discarded – undo
226 226
 	 */
227 227
 	public function assign_view_slug( $default, $context ) {
228 228
 
229
-		if ( ! empty( $this->settings['slug'] ) ) {
230
-			return $this->settings['slug'];
229
+		if ( ! empty( $this->settings[ 'slug' ] ) ) {
230
+			return $this->settings[ 'slug' ];
231 231
 		}
232 232
 		if ( ! empty( $default ) ) {
233 233
 			return $default;
@@ -244,8 +244,8 @@  discard block
 block discarded – undo
244 244
 	 * @return void
245 245
 	 */
246 246
 	public function register_styles() {
247
-		if ( ! empty( $this->settings['css_source'] ) ) {
248
-			wp_register_style( 'gravityview_style_' . $this->template_id, $this->settings['css_source'], array(), GravityView_Plugin::version, 'all' );
247
+		if ( ! empty( $this->settings[ 'css_source' ] ) ) {
248
+			wp_register_style( 'gravityview_style_' . $this->template_id, $this->settings[ 'css_source' ], array(), GravityView_Plugin::version, 'all' );
249 249
 		}
250 250
 	}
251 251
 
Please login to merge, or discard this patch.
includes/class-oembed.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -211,6 +211,7 @@
 block discarded – undo
211 211
 	 * @var $view_id
212 212
 	 *
213 213
 	 * @see render_handler
214
+	 * @param string $url
214 215
 	 */
215 216
 	private function set_vars( $matches, $attr, $url, $rawattr ) {
216 217
 
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	 */
43 43
 	static function getInstance() {
44 44
 
45
-		if( empty( self::$instance ) ) {
45
+		if ( empty( self::$instance ) ) {
46 46
 			self::$instance = new self;
47 47
 
48 48
 			self::$instance->initialize();
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 		// Catch either
100 100
 		$match_regex = "(?:{$using_permalinks}|{$not_using_permalinks})";
101 101
 
102
-		return '#'.$match_regex.'#i';
102
+		return '#' . $match_regex . '#i';
103 103
 	}
104 104
 
105 105
 	/**
@@ -118,18 +118,18 @@  discard block
 block discarded – undo
118 118
 
119 119
 		$post_id = url_to_postid( $url );
120 120
 
121
-		if( empty( $post_id ) ) {
121
+		if ( empty( $post_id ) ) {
122 122
 
123 123
 			$args = array(
124 124
 				'post_status' => 'publish',
125 125
 				'name' => $slug,
126
-				'post_type' => array('any', 'gravityview'),
126
+				'post_type' => array( 'any', 'gravityview' ),
127 127
 			);
128 128
 
129 129
 			$posts = get_posts( $args );
130 130
 
131
-			if( !empty( $posts ) ) {
132
-				$post_id = $posts[0]->ID;
131
+			if ( ! empty( $posts ) ) {
132
+				$post_id = $posts[ 0 ]->ID;
133 133
 			}
134 134
 		}
135 135
 
@@ -162,17 +162,17 @@  discard block
 block discarded – undo
162 162
 	public function render_handler( $matches, $attr, $url, $rawattr ) {
163 163
 
164 164
 		// If not using permalinks, re-assign values for matching groups
165
-		if( !empty( $matches['entry_slug2'] ) ) {
166
-			$matches['is_cpt'] = $matches['is_cpt2'];
167
-			$matches['slug'] = $matches['slug2'];
168
-			$matches['entry_slug'] = $matches['entry_slug2'];
169
-			unset( $matches['is_cpt2'], $matches['slug2'], $matches['entry_slug2'] );
165
+		if ( ! empty( $matches[ 'entry_slug2' ] ) ) {
166
+			$matches[ 'is_cpt' ] = $matches[ 'is_cpt2' ];
167
+			$matches[ 'slug' ] = $matches[ 'slug2' ];
168
+			$matches[ 'entry_slug' ] = $matches[ 'entry_slug2' ];
169
+			unset( $matches[ 'is_cpt2' ], $matches[ 'slug2' ], $matches[ 'entry_slug2' ] );
170 170
 		}
171 171
 
172 172
 		// No Entry was found
173
-		if( empty( $matches['entry_slug'] ) ) {
173
+		if ( empty( $matches[ 'entry_slug' ] ) ) {
174 174
 
175
-			do_action('gravityview_log_error', 'GravityView_oEmbed[render_handler] $entry_slug not parsed by regex.', $matches );
175
+			do_action( 'gravityview_log_error', 'GravityView_oEmbed[render_handler] $entry_slug not parsed by regex.', $matches );
176 176
 
177 177
 			return '';
178 178
 		}
@@ -182,11 +182,11 @@  discard block
 block discarded – undo
182 182
 		// Setup the data used
183 183
 		$this->set_vars( $matches, $attr, $url, $rawattr );
184 184
 
185
-		if( is_admin() && !$this->is_full_oembed_preview ) {
185
+		if ( is_admin() && ! $this->is_full_oembed_preview ) {
186 186
 			$return = $this->render_admin( $matches, $attr, $url, $rawattr );
187 187
 		} else {
188 188
 
189
-			if( $this->is_full_oembed_preview ) {
189
+			if ( $this->is_full_oembed_preview ) {
190 190
 				$return .= $this->generate_preview_notice();
191 191
 			}
192 192
 
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
 	private function generate_preview_notice() {
206 206
 		$floaty = GravityView_Admin::get_floaty();
207 207
 		$title = esc_html__( 'This will look better when it is embedded.', 'gravityview' );
208
-		$message = esc_html__('Styles don\'t get loaded when being previewed, so the content below will look strange. Don\'t be concerned!', 'gravityview');
209
-		return '<div class="updated notice">'. $floaty. '<h3>'.$title.'</h3><p>'.$message.'</p><br style="clear:both;" /></div>';
208
+		$message = esc_html__( 'Styles don\'t get loaded when being previewed, so the content below will look strange. Don\'t be concerned!', 'gravityview' );
209
+		return '<div class="updated notice">' . $floaty . '<h3>' . $title . '</h3><p>' . $message . '</p><br style="clear:both;" /></div>';
210 210
 	}
211 211
 
212 212
 	/**
@@ -219,14 +219,14 @@  discard block
 block discarded – undo
219 219
 	 */
220 220
 	private function set_vars( $matches, $attr, $url, $rawattr ) {
221 221
 
222
-		$this->entry_id = $matches['entry_slug'];
222
+		$this->entry_id = $matches[ 'entry_slug' ];
223 223
 
224
-		$post_id = $this->get_postid_from_url_and_slug( $url, $matches['slug'] );
224
+		$post_id = $this->get_postid_from_url_and_slug( $url, $matches[ 'slug' ] );
225 225
 
226 226
 		// The URL didn't have the View Custom Post Type structure.
227
-		if( empty( $matches['is_cpt'] ) || $matches['is_cpt'] !== 'gravityview' ) {
227
+		if ( empty( $matches[ 'is_cpt' ] ) || $matches[ 'is_cpt' ] !== 'gravityview' ) {
228 228
 
229
-			do_action('gravityview_log_debug', 'GravityView_oEmbed[render_handler] Embedding an entry inside a post or page', $matches );
229
+			do_action( 'gravityview_log_debug', 'GravityView_oEmbed[render_handler] Embedding an entry inside a post or page', $matches );
230 230
 
231 231
 			if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) && $post = get_post( $post_id ) ) {
232 232
 				$views = \GV\View_Collection::from_post( $post );
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 						}
240 240
 					}
241 241
 
242
-					$this->view_id = $views[0]->ID;
242
+					$this->view_id = $views[ 0 ]->ID;
243 243
 				}
244 244
 			} else {
245 245
 				/** Deprecated. */
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 		}
254 254
 
255 255
 		// The inline content has $_POST['type'] set to "embed", while the "Add Media" modal doesn't set that.
256
-		$this->is_full_oembed_preview = ( isset( $_POST['action'] ) && $_POST['action'] === 'parse-embed' && !isset( $_POST['type'] ) );
256
+		$this->is_full_oembed_preview = ( isset( $_POST[ 'action' ] ) && $_POST[ 'action' ] === 'parse-embed' && ! isset( $_POST[ 'type' ] ) );
257 257
 	}
258 258
 
259 259
 	/**
@@ -271,15 +271,15 @@  discard block
 block discarded – undo
271 271
 		// Floaty the astronaut
272 272
 		$image = GravityView_Admin::get_floaty();
273 273
 
274
-		$embed_heading = sprintf( esc_html__('Embed Entry %d', 'gravityview'), $this->entry_id );
274
+		$embed_heading = sprintf( esc_html__( 'Embed Entry %d', 'gravityview' ), $this->entry_id );
275 275
 
276
-		$embed_text = sprintf( esc_html__('This entry will be displayed as it is configured in View %d', 'gravityview'), $this->view_id );
276
+		$embed_text = sprintf( esc_html__( 'This entry will be displayed as it is configured in View %d', 'gravityview' ), $this->view_id );
277 277
 
278 278
 		return '
279 279
 		<div class="loading-placeholder" style="background-color:#e6f0f5;">
280
-			<h3 style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">'.$image.$embed_heading.'</h3>
280
+			<h3 style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">'.$image . $embed_heading . '</h3>
281 281
 			<p style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">
282
-				'.$embed_text.'
282
+				'.$embed_text . '
283 283
 			</p>
284 284
 			<br style="clear: both;">
285 285
 		</div>';
@@ -334,14 +334,14 @@  discard block
 block discarded – undo
334 334
 	private function render_frontend( $matches, $attr, $url, $rawattr ) {
335 335
 
336 336
 		// If it's already been parsed, don't re-output it.
337
-		if( !empty( $this->output[ $this->entry_id ] ) ) {
337
+		if ( ! empty( $this->output[ $this->entry_id ] ) ) {
338 338
 			return $this->output[ $this->entry_id ];
339 339
 		}
340 340
 
341 341
 		$entry_output = $this->generate_entry_output();
342 342
 
343 343
 		// Wrap a container div around the output to allow for custom styling
344
-		$output = sprintf('<div class="gravityview-oembed gravityview-oembed-entry gravityview-oembed-entry-'.$this->entry_id.'">%s</div>', $entry_output );
344
+		$output = sprintf( '<div class="gravityview-oembed gravityview-oembed-entry gravityview-oembed-entry-' . $this->entry_id . '">%s</div>', $entry_output );
345 345
 
346 346
 		/**
347 347
 		 * @filter `gravityview/oembed/entry` Filter the output of the oEmbed entry embed
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 		 *  @var string $url The original URL that was matched by the regex. \n
355 355
 		 *  @var array $rawattr The original unmodified attributes.
356 356
 		 */
357
-		$output = apply_filters('gravityview/oembed/entry', $output, $this, compact( $entry_output, $matches, $attr, $url, $rawattr ) );
357
+		$output = apply_filters( 'gravityview/oembed/entry', $output, $this, compact( $entry_output, $matches, $attr, $url, $rawattr ) );
358 358
 
359 359
 		unset( $entry_output );
360 360
 
Please login to merge, or discard this patch.