Completed
Pull Request — master (#747)
by Steve
19:06
created
includes/admin/metaboxes/class-gravityview-metabox-tab.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@
 block discarded – undo
95 95
 	 * @param string $icon_class_name Icon class used in vertical tabs. Supports non-dashicon. If dashicons, no need for `dashicons ` prefix
96 96
 	 * @param string $callback Function to render the metabox, if $file is not defined.
97 97
 	 * @param null $callback_args Arguments passed to the callback
98
-	 * @return void
98
+	 * @return GravityView_Metabox_Tab
99 99
 	 */
100 100
 	function __construct( $id, $title = '', $file = '', $icon_class_name = '', $callback = '', $callback_args = null  ) {
101 101
 
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -97,9 +97,9 @@  discard block
 block discarded – undo
97 97
 	 * @param array $callback_args Arguments passed to the callback
98 98
 	 * @return void
99 99
 	 */
100
-	function __construct( $id, $title = '', $file = '', $icon_class_name = '', $callback = '', $callback_args = array()  ) {
100
+	function __construct( $id, $title = '', $file = '', $icon_class_name = '', $callback = '', $callback_args = array() ) {
101 101
 
102
-		$this->id = $this->prefix.$id;
102
+		$this->id = $this->prefix . $id;
103 103
 		$this->title = $title;
104 104
 		$this->render_template_file = $file;
105 105
 		$this->callback = $callback;
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 */
119 119
 	function parse_icon_class_name( $icon_class_name = '' ) {
120 120
 
121
-		if( preg_match( '/dashicon/i', $icon_class_name ) ) {
121
+		if ( preg_match( '/dashicon/i', $icon_class_name ) ) {
122 122
 			$icon_class_name = 'dashicons ' . $icon_class_name;
123 123
 		}
124 124
 
@@ -142,29 +142,29 @@  discard block
 block discarded – undo
142 142
 	 */
143 143
 	function render( $post ) {
144 144
 
145
-		if( !empty( $this->render_template_file ) ) {
145
+		if ( ! empty( $this->render_template_file ) ) {
146 146
 
147 147
 			$file = $this->render_template_file;
148 148
 
149 149
 			// If the full path exists, use it
150
-			if( file_exists( $file ) ) {
150
+			if ( file_exists( $file ) ) {
151 151
 				$path = $file;
152 152
 			} else {
153
-				$path = GRAVITYVIEW_DIR .'includes/admin/metaboxes/views/'.$file;
153
+				$path = GRAVITYVIEW_DIR . 'includes/admin/metaboxes/views/' . $file;
154 154
 			}
155 155
 
156
-			if( file_exists( $path ) ) {
156
+			if ( file_exists( $path ) ) {
157 157
 				include $path;
158 158
 			} else {
159 159
 				do_action( 'gravityview_log_error', 'Metabox template file not found', $this );
160 160
 			}
161 161
 
162
-		} else if( !empty( $this->callback ) ) {
162
+		} else if ( ! empty( $this->callback ) ) {
163 163
 
164
-			if( is_callable( $this->callback ) ) {
164
+			if ( is_callable( $this->callback ) ) {
165 165
 
166 166
 				/** @see do_accordion_sections() */
167
-				call_user_func( $this->callback, $post, (array) $this );
167
+				call_user_func( $this->callback, $post, (array)$this );
168 168
 
169 169
 			} else {
170 170
 				do_action( 'gravityview_log_error', 'Metabox callback was not callable', $this );
Please login to merge, or discard this patch.
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
 			do_action( 'gravityview_render_available_fields', $form, $context );
79 79
 			$this->_exit();
80 80
 		}
@@ -94,17 +94,17 @@  discard block
 block discarded – undo
94 94
 	function get_active_areas() {
95 95
 		$this->check_ajax_nonce();
96 96
 
97
-		if( empty( $_POST['template_id'] ) ) {
97
+		if ( empty( $_POST[ 'template_id' ] ) ) {
98 98
 			$this->_exit( false );
99 99
 		}
100 100
 
101 101
 		ob_start();
102
-		do_action( 'gravityview_render_directory_active_areas', $_POST['template_id'], 'directory', '', true );
103
-		$response['directory'] = ob_get_clean();
102
+		do_action( 'gravityview_render_directory_active_areas', $_POST[ 'template_id' ], 'directory', '', true );
103
+		$response[ 'directory' ] = ob_get_clean();
104 104
 
105 105
 		ob_start();
106
-		do_action( 'gravityview_render_directory_active_areas',  $_POST['template_id'], 'single', '', true );
107
-		$response['single'] = ob_get_clean();
106
+		do_action( 'gravityview_render_directory_active_areas', $_POST[ 'template_id' ], 'single', '', true );
107
+		$response[ 'single' ] = ob_get_clean();
108 108
 
109 109
 		$response = array_map( 'gravityview_strip_whitespace', $response );
110 110
 
@@ -119,20 +119,20 @@  discard block
 block discarded – undo
119 119
 
120 120
 		$this->check_ajax_nonce();
121 121
 
122
-		if( empty( $_POST['template_id'] ) ) {
122
+		if ( empty( $_POST[ 'template_id' ] ) ) {
123 123
 			$this->_exit( false );
124 124
 		}
125 125
 
126 126
 		// get the fields xml config file for this specific preset
127
-		$preset_fields_path = apply_filters( 'gravityview_template_fieldsxml', array(), $_POST['template_id'] );
127
+		$preset_fields_path = apply_filters( 'gravityview_template_fieldsxml', array(), $_POST[ 'template_id' ] );
128 128
 		// import fields
129
-		if( !empty( $preset_fields_path ) ) {
129
+		if ( ! empty( $preset_fields_path ) ) {
130 130
 			$presets = $this->import_fields( $preset_fields_path );
131 131
 		} else {
132 132
 			$presets = array( 'widgets' => array(), 'fields' => array() );
133 133
 		}
134 134
 
135
-		$template_id = esc_attr( $_POST['template_id'] );
135
+		$template_id = esc_attr( $_POST[ 'template_id' ] );
136 136
 
137 137
 		// template areas
138 138
 		$template_areas_directory = apply_filters( 'gravityview_template_active_areas', array(), $template_id, 'directory' );
@@ -142,20 +142,20 @@  discard block
 block discarded – undo
142 142
 		$default_widget_areas = GravityView_Plugin::get_default_widget_areas();
143 143
 
144 144
 		ob_start();
145
-		do_action('gravityview_render_active_areas', $template_id, 'widget', 'header', $default_widget_areas, $presets['widgets'] );
146
-		$response['header'] = ob_get_clean();
145
+		do_action( 'gravityview_render_active_areas', $template_id, 'widget', 'header', $default_widget_areas, $presets[ 'widgets' ] );
146
+		$response[ 'header' ] = ob_get_clean();
147 147
 
148 148
 		ob_start();
149
-		do_action('gravityview_render_active_areas', $template_id, 'widget', 'footer', $default_widget_areas, $presets['widgets'] );
150
-		$response['footer'] = ob_get_clean();
149
+		do_action( 'gravityview_render_active_areas', $template_id, 'widget', 'footer', $default_widget_areas, $presets[ 'widgets' ] );
150
+		$response[ 'footer' ] = ob_get_clean();
151 151
 
152 152
 		ob_start();
153
-		do_action('gravityview_render_active_areas', $template_id, 'field', 'directory', $template_areas_directory, $presets['fields'] );
154
-		$response['directory'] = ob_get_clean();
153
+		do_action( 'gravityview_render_active_areas', $template_id, 'field', 'directory', $template_areas_directory, $presets[ 'fields' ] );
154
+		$response[ 'directory' ] = ob_get_clean();
155 155
 
156 156
 		ob_start();
157
-		do_action('gravityview_render_active_areas', $template_id, 'field', 'single', $template_areas_single, $presets['fields'] );
158
-		$response['single'] = ob_get_clean();
157
+		do_action( 'gravityview_render_active_areas', $template_id, 'field', 'single', $template_areas_single, $presets[ 'fields' ] );
158
+		$response[ 'single' ] = ob_get_clean();
159 159
 
160 160
 		$response = array_map( 'gravityview_strip_whitespace', $response );
161 161
 
@@ -173,26 +173,26 @@  discard block
 block discarded – undo
173 173
 
174 174
 		$this->check_ajax_nonce();
175 175
 
176
-		if( empty( $_POST['template_id'] ) ) {
176
+		if ( empty( $_POST[ 'template_id' ] ) ) {
177 177
 			do_action( 'gravityview_log_error', '[create_preset_form] Cannot create preset form; the template_id is empty.' );
178 178
 			$this->_exit( false );
179 179
 		}
180 180
 
181 181
 		// get the xml for this specific template_id
182
-		$preset_form_xml_path = apply_filters( 'gravityview_template_formxml', '', $_POST['template_id'] );
182
+		$preset_form_xml_path = apply_filters( 'gravityview_template_formxml', '', $_POST[ 'template_id' ] );
183 183
 
184 184
 		// import form
185 185
 		$form = $this->import_form( $preset_form_xml_path );
186 186
 
187 187
 		// get the form ID
188
-		if( false === $form ) {
188
+		if ( false === $form ) {
189 189
 			// send error to user
190
-			do_action( 'gravityview_log_error', '[create_preset_form] Error importing form for template id: ' . (int) $_POST['template_id'] );
190
+			do_action( 'gravityview_log_error', '[create_preset_form] Error importing form for template id: ' . (int)$_POST[ 'template_id' ] );
191 191
 
192 192
 			$this->_exit( false );
193 193
 		}
194 194
 
195
-		$this->_exit( '<option value="'.esc_attr( $form['id'] ).'" selected="selected">'.esc_html( $form['title'] ).'</option>' );
195
+		$this->_exit( '<option value="' . esc_attr( $form[ 'id' ] ) . '" selected="selected">' . esc_html( $form[ 'title' ] ) . '</option>' );
196 196
 
197 197
 	}
198 198
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 
207 207
 		do_action( 'gravityview_log_debug', '[import_form] Import Preset Form. (File)', $xml_or_json_path );
208 208
 
209
-		if( empty( $xml_or_json_path ) || !class_exists('GFExport') || !file_exists( $xml_or_json_path ) ) {
209
+		if ( empty( $xml_or_json_path ) || ! class_exists( 'GFExport' ) || ! file_exists( $xml_or_json_path ) ) {
210 210
 			do_action( 'gravityview_log_error', '[import_form] Class GFExport or file not found. file: ', $xml_or_json_path );
211 211
 			return false;
212 212
 		}
@@ -218,13 +218,13 @@  discard block
 block discarded – undo
218 218
 		do_action( 'gravityview_log_debug', '[import_form] Importing form (Result)', $count );
219 219
 		do_action( 'gravityview_log_debug', '[import_form] Importing form (Form) ', $forms );
220 220
 
221
-		if( $count != 1 || empty( $forms[0]['id'] ) ) {
221
+		if ( $count != 1 || empty( $forms[ 0 ][ 'id' ] ) ) {
222 222
 			do_action( 'gravityview_log_error', '[import_form] Form Import Failed!' );
223 223
 			return false;
224 224
 		}
225 225
 
226 226
 		// import success - return form id
227
-		return $forms[0];
227
+		return $forms[ 0 ];
228 228
 	}
229 229
 
230 230
 
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	function get_field_options() {
239 239
 		$this->check_ajax_nonce();
240 240
 
241
-		if( empty( $_POST['template'] ) || empty( $_POST['area'] ) || empty( $_POST['field_id'] ) || empty( $_POST['field_type'] ) ) {
241
+		if ( empty( $_POST[ 'template' ] ) || empty( $_POST[ 'area' ] ) || empty( $_POST[ 'field_id' ] ) || empty( $_POST[ 'field_type' ] ) ) {
242 242
 			do_action( 'gravityview_log_error', '[get_field_options] Required fields were not set in the $_POST request. ' );
243 243
 			$this->_exit( false );
244 244
 		}
@@ -250,10 +250,10 @@  discard block
 block discarded – undo
250 250
 		$_post = array_map( 'esc_attr', $_post );
251 251
 
252 252
 		// The GF type of field: `product`, `name`, `creditcard`, `id`, `text`
253
-		$input_type = isset($_post['input_type']) ? esc_attr( $_post['input_type'] ) : NULL;
254
-		$context = isset($_post['context']) ? esc_attr( $_post['context'] ) : NULL;
253
+		$input_type = isset( $_post[ 'input_type' ] ) ? esc_attr( $_post[ 'input_type' ] ) : NULL;
254
+		$context = isset( $_post[ 'context' ] ) ? esc_attr( $_post[ 'context' ] ) : NULL;
255 255
 
256
-		$response = GravityView_Render_Settings::render_field_options( $_post['field_type'], $_post['template'], $_post['field_id'], $_post['field_label'], $_post['area'], $input_type, '', '', $context  );
256
+		$response = GravityView_Render_Settings::render_field_options( $_post[ 'field_type' ], $_post[ 'template' ], $_post[ 'field_id' ], $_post[ 'field_label' ], $_post[ 'area' ], $input_type, '', '', $context );
257 257
 
258 258
 		$response = gravityview_strip_whitespace( $response );
259 259
 
@@ -274,15 +274,15 @@  discard block
 block discarded – undo
274 274
 		$form = '';
275 275
 
276 276
 		// if form id is set, use it, else, get form from preset
277
-		if( !empty( $_POST['form_id'] ) ) {
277
+		if ( ! empty( $_POST[ 'form_id' ] ) ) {
278 278
 
279
-			$form = (int) $_POST['form_id'];
279
+			$form = (int)$_POST[ 'form_id' ];
280 280
 
281 281
 		}
282 282
 		// get form from preset
283
-		elseif( !empty( $_POST['template_id'] ) ) {
283
+		elseif ( ! empty( $_POST[ 'template_id' ] ) ) {
284 284
 
285
-			$form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] );
285
+			$form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] );
286 286
 
287 287
 		}
288 288
 
@@ -298,27 +298,27 @@  discard block
 block discarded – undo
298 298
 	 * @param  string $template_id Preset template
299 299
 	 *
300 300
 	 */
301
-	static function pre_get_form_fields( $template_id = '') {
301
+	static function pre_get_form_fields( $template_id = '' ) {
302 302
 
303
-		if( empty( $template_id ) ) {
303
+		if ( empty( $template_id ) ) {
304 304
 			do_action( 'gravityview_log_error', __METHOD__ . ' - Template ID not set.' );
305 305
 			return false;
306 306
 		} else {
307 307
 			$form_file = apply_filters( 'gravityview_template_formxml', '', $template_id );
308
-			if( !file_exists( $form_file )  ) {
309
-				do_action( 'gravityview_log_error', __METHOD__ . ' - Importing Form Fields for preset ['. $template_id .']. File not found. file: ' . $form_file );
308
+			if ( ! file_exists( $form_file ) ) {
309
+				do_action( 'gravityview_log_error', __METHOD__ . ' - Importing Form Fields for preset [' . $template_id . ']. File not found. file: ' . $form_file );
310 310
 				return false;
311 311
 			}
312 312
 		}
313 313
 
314 314
 		// Load xml parser (from GravityForms)
315
-		if( class_exists( 'GFCommon' ) ) {
315
+		if ( class_exists( 'GFCommon' ) ) {
316 316
 			$xml_parser = GFCommon::get_base_path() . '/xml.php';
317 317
 		} else {
318 318
 			$xml_parser = trailingslashit( WP_PLUGIN_DIR ) . 'gravityforms/xml.php';
319 319
 		}
320 320
 
321
-		if( file_exists( $xml_parser ) ) {
321
+		if ( file_exists( $xml_parser ) ) {
322 322
 			require_once( $xml_parser );
323 323
 		} else {
324 324
 			do_action( 'gravityview_log_debug', __METHOD__ . ' - Gravity Forms XML Parser not found.', $xml_parser );
@@ -329,37 +329,37 @@  discard block
 block discarded – undo
329 329
 		$xmlstr = file_get_contents( $form_file );
330 330
 
331 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)
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 343
         );
344 344
 
345
-		$xml = new RGXML($options);
346
-        $forms = $xml->unserialize($xmlstr);
345
+		$xml = new RGXML( $options );
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 );
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 350
         	return false;
351 351
         }
352 352
 
353
-        if( !empty( $forms[0] ) && is_array( $forms[0] ) ) {
354
-        	$form = $forms[0];
353
+        if ( ! empty( $forms[ 0 ] ) && is_array( $forms[ 0 ] ) ) {
354
+        	$form = $forms[ 0 ];
355 355
         }
356 356
 
357
-        if( empty( $form ) ) {
357
+        if ( empty( $form ) ) {
358 358
         	do_action( 'gravityview_log_error', '[pre_get_available_fields] $form not set.', $forms );
359 359
         	return false;
360 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 364
         return $form;
365 365
 
@@ -373,38 +373,38 @@  discard block
 block discarded – undo
373 373
 	 */
374 374
 	function import_fields( $file ) {
375 375
 
376
-		if( empty( $file ) || !file_exists(  $file ) ) {
376
+		if ( empty( $file ) || ! file_exists( $file ) ) {
377 377
 			do_action( 'gravityview_log_error', '[import_fields] Importing Preset Fields. File not found. (File)', $file );
378 378
 			return false;
379 379
 		}
380 380
 
381
-		if( !class_exists('WXR_Parser') ) {
381
+		if ( ! class_exists( 'WXR_Parser' ) ) {
382 382
 			include_once GRAVITYVIEW_DIR . 'includes/lib/xml-parsers/parsers.php';
383 383
 		}
384 384
 
385 385
 		$parser = new WXR_Parser();
386 386
 		$presets = $parser->parse( $file );
387 387
 
388
-		if(is_wp_error( $presets )) {
388
+		if ( is_wp_error( $presets ) ) {
389 389
 			do_action( 'gravityview_log_error', '[import_fields] Importing Preset Fields failed. Threw WP_Error.', $presets );
390 390
 			return false;
391 391
 		}
392 392
 
393
-		if( empty( $presets['posts'][0]['postmeta'] ) && !is_array( $presets['posts'][0]['postmeta'] ) ) {
393
+		if ( empty( $presets[ 'posts' ][ 0 ][ 'postmeta' ] ) && ! is_array( $presets[ 'posts' ][ 0 ][ 'postmeta' ] ) ) {
394 394
 			do_action( 'gravityview_log_error', '[import_fields] Importing Preset Fields failed. Meta not found in file.', $file );
395 395
 			return false;
396 396
 		}
397 397
 
398
-		do_action( 'gravityview_log_debug', '[import_fields] postmeta', $presets['posts'][0]['postmeta'] );
398
+		do_action( 'gravityview_log_debug', '[import_fields] postmeta', $presets[ 'posts' ][ 0 ][ 'postmeta' ] );
399 399
 
400 400
 		$fields = $widgets = array();
401
-		foreach( $presets['posts'][0]['postmeta'] as $meta ) {
402
-			switch ($meta['key']) {
401
+		foreach ( $presets[ 'posts' ][ 0 ][ 'postmeta' ] as $meta ) {
402
+			switch ( $meta[ 'key' ] ) {
403 403
 				case '_gravityview_directory_fields':
404
-					$fields = maybe_unserialize( $meta['value'] );
404
+					$fields = maybe_unserialize( $meta[ 'value' ] );
405 405
 					break;
406 406
 				case '_gravityview_directory_widgets':
407
-					$widgets = maybe_unserialize( $meta['value'] );
407
+					$widgets = maybe_unserialize( $meta[ 'value' ] );
408 408
 					break;
409 409
 			}
410 410
 		}
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   +35 added lines, -35 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;
@@ -123,10 +123,10 @@  discard block
 block discarded – undo
123 123
 		// If Gravity Forms doesn't exist or is outdated, load the admin view class to
124 124
 		// show the notice, but not load any post types or process shortcodes.
125 125
 		// Without Gravity Forms, there is no GravityView. Beautiful, really.
126
-		if( ! self::is_valid() ) {
126
+		if ( ! self::is_valid() ) {
127 127
 
128 128
 			// If the plugin's not loaded, might as well hide the shortcode for people.
129
-			add_shortcode( 'gravityview', array( $this, '_shortcode_gf_notice') );
129
+			add_shortcode( 'gravityview', array( $this, '_shortcode_gf_notice' ) );
130 130
 
131 131
 		}
132 132
 	}
@@ -152,15 +152,15 @@  discard block
 block discarded – undo
152 152
 	 */
153 153
 	public function _shortcode_gf_notice( $atts = array(), $content = null, $shortcode = 'gravityview' ) {
154 154
 
155
-		if( ! GVCommon::has_cap( 'activate_plugins' ) ) {
155
+		if ( ! GVCommon::has_cap( 'activate_plugins' ) ) {
156 156
 			return null;
157 157
 		}
158 158
 
159 159
 		$notices = self::get_notices();
160 160
 
161
-		$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>';
162
-		foreach( (array)$notices as $notice ) {
163
-			$message .= wpautop( $notice['message'] );
161
+		$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>';
162
+		foreach ( (array)$notices as $notice ) {
163
+			$message .= wpautop( $notice[ 'message' ] );
164 164
 		}
165 165
 		$message .= '</div>';
166 166
 
@@ -175,11 +175,11 @@  discard block
 block discarded – undo
175 175
 	 * @return boolean
176 176
 	 */
177 177
 	public static function check_php() {
178
-		if( false === version_compare( phpversion(), GV_MIN_PHP_VERSION , '>=' ) ) {
178
+		if ( false === version_compare( phpversion(), GV_MIN_PHP_VERSION, '>=' ) ) {
179 179
 
180
-			self::$notices['php_version'] = array(
180
+			self::$notices[ 'php_version' ] = array(
181 181
 				'class' => 'error',
182
-				'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>' ),
182
+				'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>' ),
183 183
 				'cap' => 'manage_options',
184 184
 				'dismiss' => 'php_version',
185 185
 			);
@@ -199,11 +199,11 @@  discard block
 block discarded – undo
199 199
 	public static function check_wordpress() {
200 200
 		global $wp_version;
201 201
 
202
-		if( version_compare( $wp_version, GV_MIN_WP_VERSION ) <= 0 ) {
202
+		if ( version_compare( $wp_version, GV_MIN_WP_VERSION ) <= 0 ) {
203 203
 
204
-			self::$notices['wp_version'] = array(
204
+			self::$notices[ 'wp_version' ] = array(
205 205
 				'class' => 'error',
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>' ),
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 207
 			    'cap' => 'update_core',
208 208
 				'dismiss' => 'wp_version',
209 209
 			);
@@ -226,17 +226,17 @@  discard block
 block discarded – undo
226 226
 	public static function check_gravityforms() {
227 227
 
228 228
 		// Bypass other checks: if the class exists
229
-		if( class_exists( 'GFCommon' ) ) {
229
+		if ( class_exists( 'GFCommon' ) ) {
230 230
 
231 231
 			// and the version's right, we're good.
232
-			if( true === version_compare( GFCommon::$version, GV_MIN_GF_VERSION, ">=" ) ) {
232
+			if ( true === version_compare( GFCommon::$version, GV_MIN_GF_VERSION, ">=" ) ) {
233 233
 				return true;
234 234
 			}
235 235
 
236 236
 			// Or the version's wrong
237
-			self::$notices['gf_version'] = array(
237
+			self::$notices[ 'gf_version' ] = array(
238 238
 				'class' => 'error',
239
-				'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_MIN_GF_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.GFCommon::$version.'</span>', "\n\n".'<a href="http://katz.si/gravityforms" class="button button-secondary button-large button-hero">' , '<em>', '</em>', '</a>'),
239
+				'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_MIN_GF_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . GFCommon::$version . '</span>', "\n\n" . '<a href="http://katz.si/gravityforms" class="button button-secondary button-large button-hero">', '<em>', '</em>', '</a>' ),
240 240
 				'cap' => 'update_plugins',
241 241
 				'dismiss' => 'gf_version',
242 242
 			);
@@ -251,42 +251,42 @@  discard block
 block discarded – undo
251 251
 		 * OR
252 252
 		 * It's the Network Admin and we just don't know whether the sites have GF activated themselves.
253 253
 		 */
254
-		if( true === $gf_status || is_network_admin() ) {
254
+		if ( true === $gf_status || is_network_admin() ) {
255 255
 			return true;
256 256
 		}
257 257
 
258 258
 		// If GFCommon doesn't exist, assume GF not active
259 259
 		$return = false;
260 260
 
261
-		switch( $gf_status ) {
261
+		switch ( $gf_status ) {
262 262
 			case 'inactive':
263 263
 
264 264
 				// Required for multisite
265
-				if( ! function_exists('wp_create_nonce') ) {
265
+				if ( ! function_exists( 'wp_create_nonce' ) ) {
266 266
 					require_once ABSPATH . WPINC . '/pluggable.php';
267 267
 				}
268 268
 
269 269
 				// Otherwise, throws an error on activation & deactivation "Use of undefined constant LOGGED_IN_COOKIE"
270
-				if( is_multisite() ) {
270
+				if ( is_multisite() ) {
271 271
 					wp_cookie_constants();
272 272
 				}
273 273
 
274 274
 				$return = false;
275 275
 
276
-				$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">';
276
+				$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">';
277 277
 
278
-				self::$notices['gf_inactive'] = array(
278
+				self::$notices[ 'gf_inactive' ] = array(
279 279
 					'class' => 'error',
280
-					'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>' ),
280
+					'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>' ),
281 281
 					'cap' => 'activate_plugins',
282 282
 					'dismiss' => 'gf_inactive',
283 283
 				);
284 284
 
285 285
 				break;
286 286
 			default:
287
-				self::$notices['gf_installed'] = array(
287
+				self::$notices[ 'gf_installed' ] = array(
288 288
 					'class' => 'error',
289
-					'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>'),
289
+					'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>' ),
290 290
 					'cap' => 'install_plugins',
291 291
 					'dismiss' => 'gf_installed',
292 292
 				);
@@ -303,10 +303,10 @@  discard block
 block discarded – undo
303 303
 	 */
304 304
 	private static function check_gf_directory() {
305 305
 
306
-		if( class_exists( 'GFDirectory' ) ) {
307
-			self::$notices['gf_directory'] = array(
306
+		if ( class_exists( 'GFDirectory' ) ) {
307
+			self::$notices[ 'gf_directory' ] = array(
308 308
 				'class' => 'error is-dismissible',
309
-				'title' => __('Potential Conflict', 'gravityview' ),
309
+				'title' => __( 'Potential Conflict', 'gravityview' ),
310 310
 				'message' => __( 'GravityView and Gravity Forms Directory are both active. This may cause problems. If you experience issues, disable the Gravity Forms Directory plugin.', 'gravityview' ),
311 311
 				'dismiss' => 'gf_directory',
312 312
 				'cap' => 'activate_plugins',
@@ -325,21 +325,21 @@  discard block
 block discarded – undo
325 325
 	 */
326 326
 	public static function get_plugin_status( $location = '' ) {
327 327
 
328
-		if( ! function_exists('is_plugin_active') ) {
328
+		if ( ! function_exists( 'is_plugin_active' ) ) {
329 329
 			include_once( ABSPATH . '/wp-admin/includes/plugin.php' );
330 330
 		}
331 331
 
332
-		if( is_network_admin() && is_plugin_active_for_network( $location ) ) {
332
+		if ( is_network_admin() && is_plugin_active_for_network( $location ) ) {
333 333
 			return true;
334 334
 		}
335 335
 
336
-		if( !is_network_admin() && is_plugin_active( $location ) ) {
336
+		if ( ! is_network_admin() && is_plugin_active( $location ) ) {
337 337
 			return true;
338 338
 		}
339 339
 
340
-		if(
341
-			!file_exists( trailingslashit( WP_PLUGIN_DIR ) . $location ) &&
342
-			!file_exists( trailingslashit( WPMU_PLUGIN_DIR ) . $location )
340
+		if (
341
+			! file_exists( trailingslashit( WP_PLUGIN_DIR ) . $location ) &&
342
+			! file_exists( trailingslashit( WPMU_PLUGIN_DIR ) . $location )
343 343
 		) {
344 344
 			return false;
345 345
 		}
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
@@ -195,9 +195,9 @@  discard block
 block discarded – undo
195 195
 		 * @internal Reported to GF Support on 12/3
196 196
 		 * @internal Fixed in Gravity Forms
197 197
 		 */
198
-		$form['title']  = isset( $form['title'] ) ? $form['title'] : '';
199
-		$form['id']     = isset( $form['id'] ) ? $form['id'] : '';
200
-		$form['fields'] = isset( $form['fields'] ) ? $form['fields'] : array();
198
+		$form[ 'title' ]  = isset( $form[ 'title' ] ) ? $form[ 'title' ] : '';
199
+		$form[ 'id' ]     = isset( $form[ 'id' ] ) ? $form[ 'id' ] : '';
200
+		$form[ 'fields' ] = isset( $form[ 'fields' ] ) ? $form[ 'fields' ] : array();
201 201
 
202 202
 		return GFCommon::replace_variables( $text, $form, $entry, $url_encode, $esc_html );
203 203
 	}
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	 *
218 218
 	 * @return mixed
219 219
 	 */
220
-	public static function replace_gv_merge_tags(  $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
220
+	public static function replace_gv_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
221 221
 
222 222
 		/**
223 223
 		 * This prevents the gform_replace_merge_tags filter from being called twice, as defined in:
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 		 * @see GFCommon::replace_variables_prepopulate()
226 226
 		 * @todo Remove eventually: Gravity Forms fixed this issue in 1.9.14
227 227
 		 */
228
-		if( false === $form ) {
228
+		if ( false === $form ) {
229 229
 			return $text;
230 230
 		}
231 231
 
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
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}
260
-			'time' => in_array( 'time', $exploded ),  // {date_created:time}
260
+			'time' => in_array( 'time', $exploded ), // {date_created:time}
261 261
 		);
262 262
 
263 263
 		$formatted_date = GVCommon::format_date( $date_created, $atts );
@@ -320,14 +320,14 @@  discard block
 block discarded – undo
320 320
 		preg_match_all( "/{get:(.*?)}/ism", $text, $matches, PREG_SET_ORDER );
321 321
 
322 322
 		// If there are no matches OR the Entry `created_by` isn't set or is 0 (no user)
323
-		if( empty( $matches ) ) {
323
+		if ( empty( $matches ) ) {
324 324
 			return $text;
325 325
 		}
326 326
 
327 327
 		foreach ( $matches as $match ) {
328 328
 
329
-			$full_tag = $match[0];
330
-			$property = $match[1];
329
+			$full_tag = $match[ 0 ];
330
+			$property = $match[ 1 ];
331 331
 
332 332
 			$value = stripslashes_deep( rgget( $property ) );
333 333
 
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 			 * @since 1.15
352 352
 			 * @param bool $esc_html Whether to esc_html() the value. Default: `true`
353 353
 			 */
354
-			$esc_html = apply_filters('gravityview/merge_tags/get/esc_html/' . $property, true );
354
+			$esc_html = apply_filters( 'gravityview/merge_tags/get/esc_html/' . $property, true );
355 355
 
356 356
 			$value = $esc_html ? esc_html( $value ) : $value;
357 357
 
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 			 * @param[in] array $form Gravity Forms form array
363 363
 			 * @param[in] array $entry Entry array
364 364
 			 */
365
-			$value = apply_filters('gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry );
365
+			$value = apply_filters( 'gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry );
366 366
 
367 367
 			$text = str_replace( $full_tag, $value, $text );
368 368
 		}
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.