Completed
Branch 4.0Builder (9ef7e0)
by Stephanie
03:43
created
classes/models/FrmEntry.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -202,6 +202,7 @@  discard block
 block discarded – undo
202 202
 	 *
203 203
 	 * @param int $id
204 204
 	 * @param array $values
205
+	 * @param string $update_type
205 206
 	 *
206 207
 	 * @return boolean|int $query_results
207 208
 	 */
@@ -612,6 +613,9 @@  discard block
 block discarded – undo
612 613
 		return $new_values;
613 614
 	}
614 615
 
616
+	/**
617
+	 * @param string $name
618
+	 */
615 619
 	private static function get_entry_value( $values, $name, $default ) {
616 620
 		return isset( $values[ $name ] ) ? $values[ $name ] : $default;
617 621
 	}
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 			$metas       = FrmEntryMeta::get_entry_meta_info( $entry_exist );
77 77
 			$field_metas = array();
78 78
 			foreach ( $metas as $meta ) {
79
-				$field_metas[ $meta->field_id ] = $meta->meta_value;
79
+				$field_metas[$meta->field_id] = $meta->meta_value;
80 80
 			}
81 81
 
82 82
 			// If prev entry is empty and current entry is not, they are not duplicates
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 		$query = "SELECT it.*, fr.name as form_name, fr.form_key as form_key FROM {$wpdb->prefix}frm_items it
304 304
                   LEFT OUTER JOIN {$wpdb->prefix}frm_forms fr ON it.form_id=fr.id WHERE ";
305 305
 
306
-		$query      .= is_numeric( $id ) ? 'it.id=%d' : 'it.item_key=%s';
306
+		$query .= is_numeric( $id ) ? 'it.id=%d' : 'it.item_key=%s';
307 307
 		$query_args = array( $id );
308 308
 		$query      = $wpdb->prepare( $query, $query_args ); // WPCS: unprepared SQL ok.
309 309
 
@@ -344,19 +344,19 @@  discard block
 block discarded – undo
344 344
 		$include_key = apply_filters( 'frm_include_meta_keys', false, array( 'form_id' => $entry->form_id ) );
345 345
 		foreach ( $metas as $meta_val ) {
346 346
 			if ( $meta_val->item_id == $entry->id ) {
347
-				$entry->metas[ $meta_val->field_id ] = maybe_unserialize( $meta_val->meta_value );
347
+				$entry->metas[$meta_val->field_id] = maybe_unserialize( $meta_val->meta_value );
348 348
 				if ( $include_key ) {
349
-					$entry->metas[ $meta_val->field_key ] = $entry->metas[ $meta_val->field_id ];
349
+					$entry->metas[$meta_val->field_key] = $entry->metas[$meta_val->field_id];
350 350
 				}
351 351
 				continue;
352 352
 			}
353 353
 
354 354
 			// include sub entries in an array
355
-			if ( ! isset( $entry_metas[ $meta_val->field_id ] ) ) {
356
-				$entry->metas[ $meta_val->field_id ] = array();
355
+			if ( ! isset( $entry_metas[$meta_val->field_id] ) ) {
356
+				$entry->metas[$meta_val->field_id] = array();
357 357
 			}
358 358
 
359
-			$entry->metas[ $meta_val->field_id ][] = maybe_unserialize( $meta_val->meta_value );
359
+			$entry->metas[$meta_val->field_id][] = maybe_unserialize( $meta_val->meta_value );
360 360
 
361 361
 			unset( $meta_val );
362 362
 		}
@@ -403,13 +403,13 @@  discard block
 block discarded – undo
403 403
 
404 404
 			if ( $inc_form ) {
405 405
 				$fields = 'it.*, fr.name as form_name,fr.form_key as form_key';
406
-				$table  .= 'LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_forms fr ON it.form_id=fr.id ';
406
+				$table .= 'LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_forms fr ON it.form_id=fr.id ';
407 407
 			}
408 408
 
409 409
 			if ( preg_match( '/ meta_([0-9]+)/', $order_by, $order_matches ) ) {
410 410
 				// sort by a requested field
411 411
 				$field_id = (int) $order_matches[1];
412
-				$fields   .= ', (SELECT meta_value FROM ' . $wpdb->prefix . 'frm_item_metas WHERE field_id = ' . $field_id . ' AND item_id = it.id) as meta_' . $field_id;
412
+				$fields .= ', (SELECT meta_value FROM ' . $wpdb->prefix . 'frm_item_metas WHERE field_id = ' . $field_id . ' AND item_id = it.id) as meta_' . $field_id;
413 413
 				unset( $order_matches, $field_id );
414 414
 			}
415 415
 
@@ -447,15 +447,15 @@  discard block
 block discarded – undo
447 447
 		}
448 448
 
449 449
 		foreach ( $metas as $m_key => $meta_val ) {
450
-			if ( ! isset( $entries[ $meta_val->item_id ] ) ) {
450
+			if ( ! isset( $entries[$meta_val->item_id] ) ) {
451 451
 				continue;
452 452
 			}
453 453
 
454
-			if ( ! isset( $entries[ $meta_val->item_id ]->metas ) ) {
455
-				$entries[ $meta_val->item_id ]->metas = array();
454
+			if ( ! isset( $entries[$meta_val->item_id]->metas ) ) {
455
+				$entries[$meta_val->item_id]->metas = array();
456 456
 			}
457 457
 
458
-			$entries[ $meta_val->item_id ]->metas[ $meta_val->field_id ] = maybe_unserialize( $meta_val->meta_value );
458
+			$entries[$meta_val->item_id]->metas[$meta_val->field_id] = maybe_unserialize( $meta_val->meta_value );
459 459
 
460 460
 			unset( $m_key, $meta_val );
461 461
 		}
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
 	}
614 614
 
615 615
 	private static function get_entry_value( $values, $name, $default ) {
616
-		return isset( $values[ $name ] ) ? $values[ $name ] : $default;
616
+		return isset( $values[$name] ) ? $values[$name] : $default;
617 617
 	}
618 618
 
619 619
 	/**
Please login to merge, or discard this patch.
classes/models/FrmEntryMeta.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -338,6 +338,7 @@
 block discarded – undo
338 338
 	 * @param string|array $where
339 339
 	 * @param string $order_by
340 340
 	 * @param string $limit
341
+	 * @param boolean $unique
341 342
 	 */
342 343
 	private static function get_ids_query( $where, $order_by, $limit, $unique, $args, array &$query ) {
343 344
 		global $wpdb;
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
 		global $wpdb;
56 56
 
57
-		$values               = array(
57
+		$values = array(
58 58
 			'item_id'  => $entry_id,
59 59
 			'field_id' => $field_id,
60 60
 		);
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 
129 129
 				if ( ( is_array( $meta_value ) && empty( $meta_value ) ) || ( ! is_array( $meta_value ) && trim( $meta_value ) == '' ) ) {
130 130
 					// remove blank fields
131
-					unset( $values[ $field_id ] );
131
+					unset( $values[$field_id] );
132 132
 				} else {
133 133
 					// if value exists, then update it
134 134
 					self::update_entry_meta( $entry_id, $field_id, '', $meta_value );
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	 */
194 194
 	public static function get_meta_value( $entry, $field_id ) {
195 195
 		if ( isset( $entry->metas ) ) {
196
-			return isset( $entry->metas[ $field_id ] ) ? $entry->metas[ $field_id ] : false;
196
+			return isset( $entry->metas[$field_id] ) ? $entry->metas[$field_id] : false;
197 197
 		} else {
198 198
 			return self::get_entry_meta_by_field( $entry->id, $field_id );
199 199
 		}
@@ -211,8 +211,8 @@  discard block
 block discarded – undo
211 211
 			$cached   = FrmDb::check_cache( $entry_id, 'frm_entry' );
212 212
 		}
213 213
 
214
-		if ( $cached && isset( $cached->metas ) && isset( $cached->metas[ $field_id ] ) ) {
215
-			$result = $cached->metas[ $field_id ];
214
+		if ( $cached && isset( $cached->metas ) && isset( $cached->metas[$field_id] ) ) {
215
+			$result = $cached->metas[$field_id];
216 216
 
217 217
 			return stripslashes_deep( $result );
218 218
 		}
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 		if ( is_numeric( $field_id ) ) {
223 223
 			$query['field_id'] = $field_id;
224 224
 		} else {
225
-			$get_table             .= ' it LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_fields fi ON it.field_id=fi.id';
225
+			$get_table .= ' it LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_fields fi ON it.field_id=fi.id';
226 226
 			$query['fi.field_key'] = $field_id;
227 227
 		}
228 228
 
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 			'stripslashes' => true,
241 241
 			'is_draft'     => false,
242 242
 		);
243
-		$args     = wp_parse_args( $args, $defaults );
243
+		$args = wp_parse_args( $args, $defaults );
244 244
 
245 245
 		$query = array();
246 246
 		self::meta_field_query( $field_id, $order, $limit, $args, $query );
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 		}
255 255
 
256 256
 		foreach ( $values as $k => $v ) {
257
-			$values[ $k ] = maybe_unserialize( $v );
257
+			$values[$k] = maybe_unserialize( $v );
258 258
 			unset( $k, $v );
259 259
 		}
260 260
 
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 		}
311 311
 
312 312
 		foreach ( $results as $k => $result ) {
313
-			$results[ $k ]->meta_value = stripslashes_deep( maybe_unserialize( $result->meta_value ) );
313
+			$results[$k]->meta_value = stripslashes_deep( maybe_unserialize( $result->meta_value ) );
314 314
 			unset( $k, $result );
315 315
 		}
316 316
 
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 			'user_id'  => '',
324 324
 			'group_by' => '',
325 325
 		);
326
-		$args     = wp_parse_args( $args, $defaults );
326
+		$args = wp_parse_args( $args, $defaults );
327 327
 
328 328
 		$query = array();
329 329
 		self::get_ids_query( $where, $order_by, $limit, $unique, $args, $query );
Please login to merge, or discard this patch.
classes/models/FrmFieldOption.php 1 patch
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -31,6 +31,10 @@
 block discarded – undo
31 31
 	 */
32 32
 	protected $option_label = '';
33 33
 
34
+	/**
35
+	 * @param string $option_key
36
+	 * @param string $option
37
+	 */
34 38
 	public function __construct( $option_key, $option, $args = array() ) {
35 39
 		$this->option_key = $option_key;
36 40
 		$this->option     = $option;
Please login to merge, or discard this patch.
classes/models/FrmFormMigrator.php 2 patches
Doc Comments   +14 added lines patch added patch discarded remove patch
@@ -152,6 +152,9 @@  discard block
 block discarded – undo
152 152
 		return $this->add_form( $form );
153 153
 	}
154 154
 
155
+	/**
156
+	 * @param string $source_form_name
157
+	 */
155 158
 	protected function prepare_new_form( $source_id, $source_form_name ) {
156 159
 		return array(
157 160
 			'import_form_id' => $source_id,
@@ -201,6 +204,11 @@  discard block
 block discarded – undo
201 204
 		// customize this function
202 205
 	}
203 206
 
207
+	/**
208
+	 * @param string $type
209
+	 *
210
+	 * @return string
211
+	 */
204 212
 	protected function convert_field_type( $type ) {
205 213
 		return $type;
206 214
 	}
@@ -314,6 +322,9 @@  discard block
 block discarded – undo
314 322
 		return array();
315 323
 	}
316 324
 
325
+	/**
326
+	 * @param string $type
327
+	 */
317 328
 	private function is_unsupported_field( $type ) {
318 329
 		$fields = $this->unsupported_field_types();
319 330
 
@@ -329,6 +340,9 @@  discard block
 block discarded – undo
329 340
 		return array();
330 341
 	}
331 342
 
343
+	/**
344
+	 * @param string $type
345
+	 */
332 346
 	private function should_skip_field( $type ) {
333 347
 		$skip_pro_fields = $this->skip_pro_fields();
334 348
 
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 
237 237
 		foreach ( $form['fields'] as $key => $new_field ) {
238 238
 			$new_field['form_id']         = $form_id;
239
-			$form['fields'][ $key ]['id'] = FrmField::create( $new_field );
239
+			$form['fields'][$key]['id'] = FrmField::create( $new_field );
240 240
 		}
241 241
 
242 242
 		// create emails
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 				if ( $key === 'post_title' ) {
249 249
 					$new_action->post_title = $value;
250 250
 				} else {
251
-					$new_action->post_content[ $key ] = $this->replace_smart_tags( $value, $form['fields'] );
251
+					$new_action->post_content[$key] = $this->replace_smart_tags( $value, $form['fields'] );
252 252
 				}
253 253
 			}
254 254
 
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 
279 279
 		$imported = $this->get_tracked_import();
280 280
 
281
-		$imported[ $this->slug ][ $new_form_id ] = $source_id;
281
+		$imported[$this->slug][$new_form_id] = $source_id;
282 282
 
283 283
 		update_option( $this->tracking, $imported, false );
284 284
 	}
@@ -298,8 +298,8 @@  discard block
 block discarded – undo
298 298
 	private function is_imported( $source_id ) {
299 299
 		$imported    = $this->get_tracked_import();
300 300
 		$new_form_id = 0;
301
-		if ( isset( $imported[ $this->slug ] ) && in_array( $source_id, $imported[ $this->slug ] ) ) {
302
-			$new_form_id = array_search( $source_id, array_reverse( $imported[ $this->slug ], true ) );
301
+		if ( isset( $imported[$this->slug] ) && in_array( $source_id, $imported[$this->slug] ) ) {
302
+			$new_form_id = array_search( $source_id, array_reverse( $imported[$this->slug], true ) );
303 303
 		}
304 304
 
305 305
 		return $new_form_id;
Please login to merge, or discard this patch.
classes/models/FrmReviews.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,6 @@
 block discarded – undo
63 63
 	 *
64 64
 	 * @since 3.04.03
65 65
 	 *
66
-	 * @param int $asked
67 66
 	 */
68 67
 	private function review() {
69 68
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -71,12 +71,12 @@
 block discarded – undo
71 71
 		$show_intervals = array( 50, 200, 500 );
72 72
 		$asked          = $this->review_status['asked'];
73 73
 
74
-		if ( ! isset( $show_intervals[ $asked ] ) ) {
74
+		if ( ! isset( $show_intervals[$asked] ) ) {
75 75
 			return;
76 76
 		}
77 77
 
78 78
 		$entries = FrmEntry::getRecordCount();
79
-		$count   = $show_intervals[ $asked ];
79
+		$count   = $show_intervals[$asked];
80 80
 		$user    = wp_get_current_user();
81 81
 
82 82
 		// Only show review request if the site has collected enough entries
Please login to merge, or discard this patch.
classes/models/FrmStyle.php 2 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 	public $id = 0; // the id of the post
6 6
 
7 7
 	/**
8
-	 * @param int|string $id The id of the stylsheet or 'default'
8
+	 * @param integer $id The id of the stylsheet or 'default'
9 9
 	 */
10 10
 	public function __construct( $id = 0 ) {
11 11
 		$this->id = $id;
@@ -150,6 +150,9 @@  discard block
 block discarded – undo
150 150
 		set_transient( 'frmpro_css', $css, MONTH_IN_SECONDS );
151 151
 	}
152 152
 
153
+	/**
154
+	 * @param string $filename
155
+	 */
153 156
 	private function get_css_content( $filename ) {
154 157
 		$css = '/* ' . __( 'WARNING: Any changes made to this file will be lost when your Formidable settings are updated', 'formidable' ) . ' */' . "\n";
155 158
 
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 			$new_instance = stripslashes_deep( (array) $new_instance );
54 54
 			$this->id     = $new_instance['ID'];
55 55
 			if ( $id != $this->id || ! $_POST || ! isset( $_POST['frm_style_setting'] ) ) {
56
-				$all_instances[ $number ] = $new_instance;
56
+				$all_instances[$number] = $new_instance;
57 57
 
58 58
 				if ( $new_instance['menu_order'] && $_POST && empty( $_POST['prev_menu_order'] ) && isset( $_POST['frm_style_setting']['menu_order'] ) ) {
59 59
 					// this style was set to default, so remove default setting on previous default style
@@ -78,22 +78,22 @@  discard block
 block discarded – undo
78 78
 			$default_settings = $this->get_defaults();
79 79
 
80 80
 			foreach ( $default_settings as $setting => $default ) {
81
-				if ( ! isset( $new_instance['post_content'][ $setting ] ) ) {
82
-					$new_instance['post_content'][ $setting ] = $default;
81
+				if ( ! isset( $new_instance['post_content'][$setting] ) ) {
82
+					$new_instance['post_content'][$setting] = $default;
83 83
 				}
84 84
 
85 85
 				if ( $this->is_color( $setting ) ) {
86
-					$new_instance['post_content'][ $setting ] = str_replace( '#', '', $new_instance['post_content'][ $setting ] );
86
+					$new_instance['post_content'][$setting] = str_replace( '#', '', $new_instance['post_content'][$setting] );
87 87
 				} elseif ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ) )
88
-					&& ! isset( $new_instance['post_content'][ $setting ] )
88
+					&& ! isset( $new_instance['post_content'][$setting] )
89 89
 					) {
90
-					$new_instance['post_content'][ $setting ] = 0;
90
+					$new_instance['post_content'][$setting] = 0;
91 91
 				} elseif ( $setting == 'font' ) {
92
-					$new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] );
92
+					$new_instance['post_content'][$setting] = $this->force_balanced_quotation( $new_instance['post_content'][$setting] );
93 93
 				}
94 94
 			}
95 95
 
96
-			$all_instances[ $number ] = $new_instance;
96
+			$all_instances[$number] = $new_instance;
97 97
 
98 98
 			$action_ids[] = $this->save( $new_instance );
99 99
 
@@ -265,13 +265,13 @@  discard block
 block discarded – undo
265 265
 			$style->post_content = $this->override_defaults( $style->post_content );
266 266
 			$style->post_content = wp_parse_args( $style->post_content, $default_values );
267 267
 
268
-			$styles[ $style->ID ] = $style;
268
+			$styles[$style->ID] = $style;
269 269
 		}
270 270
 
271 271
 		if ( ! $default_style ) {
272 272
 			$default_style = reset( $styles );
273 273
 
274
-			$styles[ $default_style->ID ]->menu_order = 1;
274
+			$styles[$default_style->ID]->menu_order = 1;
275 275
 		}
276 276
 
277 277
 		return $styles;
Please login to merge, or discard this patch.
classes/models/fields/FrmFieldEmail.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
 	public function validate( $args ) {
37 37
 		$errors = array();
38 38
 		if ( $args['value'] != '' && ! is_email( $args['value'] ) ) {
39
-			$errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' );
39
+			$errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' );
40 40
 		}
41 41
 
42 42
 		return $errors;
Please login to merge, or discard this patch.
classes/models/fields/FrmFieldUrl.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 			'sep'  => ', ',
40 40
 			'html' => false,
41 41
 		);
42
-		$atts     = wp_parse_args( $atts, $defaults );
42
+		$atts = wp_parse_args( $atts, $defaults );
43 43
 
44 44
 		if ( $atts['html'] ) {
45 45
 			$atts['sep'] = ' ';
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
 
62 62
 		// validate the url format
63 63
 		if ( ! empty( $value ) && ! preg_match( '/^http(s)?:\/\/(?:localhost|(?:[\da-z\.-]+\.[\da-z\.-]+))/i', $value ) ) {
64
-			$errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' );
64
+			$errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' );
65 65
 		} elseif ( $this->field->required == '1' && empty( $value ) ) {
66
-			$errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'blank' );
66
+			$errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $this->field, 'blank' );
67 67
 		}
68 68
 
69 69
 		return $errors;
Please login to merge, or discard this patch.
classes/models/fields/FrmFieldUserID.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
 
42 42
 		$user_ID      = get_current_user_id();
43 43
 		$user_ID      = ( $user_ID ? $user_ID : '' );
44
-		$posted_value = ( FrmAppHelper::is_admin() && $_POST && isset( $_POST['item_meta'][ $this->field['id'] ] ) ); // WPCS: CSRF ok.
44
+		$posted_value = ( FrmAppHelper::is_admin() && $_POST && isset( $_POST['item_meta'][$this->field['id']] ) ); // WPCS: CSRF ok.
45 45
 		$updating     = ( isset( $args['action'] ) && $args['action'] == 'update' );
46 46
 		$value        = ( is_numeric( $this->field['value'] ) || $posted_value || $updating ) ? $this->field['value'] : $user_ID;
47 47
 
Please login to merge, or discard this patch.