Completed
Push — master ( 885fbd...5a8fbc )
by Mike
02:40
created
includes/class-test-content.php 1 patch
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
  * @subpackage Evans
15 15
  * @author     Old Town Media
16 16
  */
17
-class TestContent{
17
+class TestContent {
18 18
 
19 19
 	/**
20 20
 	 * Title function.
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 * @param int $num_words Number of words to return.
27 27
 	 * @return string Random title string.
28 28
 	 */
29
-	public static function title( $num_words = '' ){
29
+	public static function title($num_words = '') {
30 30
 
31 31
 		$title = '';
32 32
 
@@ -67,16 +67,16 @@  discard block
 block discarded – undo
67 67
 		);
68 68
 
69 69
 		// If we didn't choose a count, make one
70
-		if ( empty( $num_words ) ){
71
-			$num_words = rand( 2, 10 );
70
+		if (empty($num_words)) {
71
+			$num_words = rand(2, 10);
72 72
 		}
73 73
 
74 74
 		// Pull random words
75
-		for( $i = 1; $i <= $num_words; $i++ ){
76
-			$title .= $random_words[ rand( 0, 31 ) ] . " ";
75
+		for ($i = 1; $i <= $num_words; $i++) {
76
+			$title .= $random_words[rand(0, 31)] . " ";
77 77
 		}
78 78
 
79
-		return apply_filters( "tc_title_data", substr( $title, 0, -1 ) );
79
+		return apply_filters("tc_title_data", substr($title, 0, -1));
80 80
 
81 81
 	}
82 82
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 *
90 90
 	 * @return string Paragraph(s) of text.
91 91
 	 */
92
-	public static function paragraphs(){
92
+	public static function paragraphs() {
93 93
 
94 94
 		$content = '';
95 95
 
@@ -351,12 +351,12 @@  discard block
 block discarded – undo
351 351
 		);
352 352
 
353 353
 		$used_keys = array();
354
-		for( $i = 1; $i < 7; $i++ ){
354
+		for ($i = 1; $i < 7; $i++) {
355 355
 
356 356
 			// Pull a new random key and make sure we're not repeating any elements
357
-			$key = rand( 0, 12 );
358
-			while( in_array( $key, $used_keys ) ){
359
-				$key = rand( 0, 12 );
357
+			$key = rand(0, 12);
358
+			while (in_array($key, $used_keys)) {
359
+				$key = rand(0, 12);
360 360
 			}
361 361
 
362 362
 			$content .= $random_content_types[$key];
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 			$used_keys[] = $key;
365 365
 		}
366 366
 
367
-		return apply_filters( "tc_paragraphs_data", $content );
367
+		return apply_filters("tc_paragraphs_data", $content);
368 368
 
369 369
 	}
370 370
 
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 	 *
377 377
 	 * @return string Plain text paragraphs.
378 378
 	 */
379
-	public static function plain_text(){
379
+	public static function plain_text() {
380 380
 
381 381
 		$paragraphs = array(
382 382
 			'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean tincidunt luctus eros, a tincidunt massa aliquet sit amet. Sed faucibus, eros non lacinia porttitor, risus odio efficitur sapien, id porta urna massa ac est. Cras efficitur lacinia magna eget tempus. Fusce ex felis, finibus consectetur mi at, finibus rhoncus augue. In ut tortor lacinia, rutrum mauris vel, maximus tortor. Praesent ac arcu nec eros pharetra tristique. Morbi congue leo sed ipsum fermentum vulputate. Ut nulla eros, porta varius pulvinar eget, bibendum quis dolor. Morbi sed diam eu dui semper ornare nec quis nisl.',
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 			'Fusce semper erat tortor, at pulvinar risus luctus suscipit. Phasellus quis enim nisl. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas semper dapibus odio, nec pellentesque sem laoreet sit amet. Maecenas ut enim tellus. Fusce malesuada mattis sem, porta interdum ex fermentum quis. Ut eget quam mi. In molestie volutpat feugiat. Nulla vel viverra nunc. Integer lobortis nisl vitae placerat egestas. Curabitur tristique nulla at libero blandit, a eleifend augue tempus.',
392 392
 		);
393 393
 
394
-		return apply_filters( "tc_plain_text_data", $paragraphs[ rand( 0, 9 ) ] );
394
+		return apply_filters("tc_plain_text_data", $paragraphs[rand(0, 9)]);
395 395
 
396 396
 	}
397 397
 
@@ -407,49 +407,49 @@  discard block
 block discarded – undo
407 407
 	 * @param int $post_id Post ID.
408 408
 	 * @return mixed Attachment ID or WP Error.
409 409
 	 */
410
-	public static function image( $post_id ){
410
+	public static function image($post_id) {
411 411
 		$file_array = array();
412 412
 
413 413
 		// Get the image from the API
414 414
 		$url = self::get_image_link();
415 415
 
416 416
 		// If the returned string is empty or it's not a string, try again.
417
-		if ( empty( $url ) || !is_string( $url ) ){
417
+		if (empty($url) || !is_string($url)) {
418 418
 
419 419
 			// Try again
420 420
 			$url = self::get_image_link();
421 421
 
422 422
 			// If it fails again, just give up
423
-			if ( empty( $url ) || !is_string( $url ) ){
423
+			if (empty($url) || !is_string($url)) {
424 424
 				return;
425 425
 			}
426 426
 
427 427
 		}
428 428
 
429 429
 		// Download the file
430
-	    $tmp = \download_url( $url );
430
+	    $tmp = \download_url($url);
431 431
 
432
-	    preg_match( '/[^\?]+\.(jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/', $url, $matches );
432
+	    preg_match('/[^\?]+\.(jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/', $url, $matches);
433 433
 
434
-        $file_array['name'] = basename( $matches[0] );
434
+        $file_array['name'] = basename($matches[0]);
435 435
         $file_array['tmp_name'] = $tmp;
436 436
 
437 437
 	    // Check for download errors
438
-	    if ( is_wp_error( $tmp ) ) {
439
-	        unlink( $file_array[ 'tmp_name' ] );
440
-	        error_log( $tmp->get_error_message() );
438
+	    if (is_wp_error($tmp)) {
439
+	        unlink($file_array['tmp_name']);
440
+	        error_log($tmp->get_error_message());
441 441
 	    }
442 442
 
443 443
 		// Pull the image into the media library
444
-	    $image_id = media_handle_sideload( $file_array, $post_id );
444
+	    $image_id = media_handle_sideload($file_array, $post_id);
445 445
 
446 446
 	    // Check for handle sideload errors.
447
-	    if ( is_wp_error( $image_id ) ) {
448
-	        unlink( $file_array['tmp_name'] );
449
-	        error_log( $image_id->get_error_message() );
447
+	    if (is_wp_error($image_id)) {
448
+	        unlink($file_array['tmp_name']);
449
+	        error_log($image_id->get_error_message());
450 450
 	    }
451 451
 
452
-	    return apply_filters( "tc_image_data", $image_id );
452
+	    return apply_filters("tc_image_data", $image_id);
453 453
 
454 454
 	}
455 455
 
@@ -461,31 +461,31 @@  discard block
 block discarded – undo
461 461
 	 *
462 462
 	 * @return string Image URL.
463 463
 	 */
464
-	private static function get_image_link(){
464
+	private static function get_image_link() {
465 465
 
466 466
 		// cURL an image API for a completely random photo
467
-		$curl = curl_init( "http://www.splashbase.co/api/v1/images/random?images_only=true" );
467
+		$curl = curl_init("http://www.splashbase.co/api/v1/images/random?images_only=true");
468 468
 
469
-		curl_setopt( $curl, CURLOPT_RETURNTRANSFER, TRUE );
469
+		curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
470 470
 
471
-		$curl_response = curl_exec( $curl );
471
+		$curl_response = curl_exec($curl);
472 472
 
473 473
 		// If our cURL failed
474
-		if ( $curl_response === false ) {
475
-		    $info = curl_getinfo( $curl );
476
-		    curl_close( $curl );
477
-		    die( 'error occured during curl exec. Additional info: ' . var_export( $info ) );
474
+		if ($curl_response === false) {
475
+		    $info = curl_getinfo($curl);
476
+		    curl_close($curl);
477
+		    die('error occured during curl exec. Additional info: ' . var_export($info));
478 478
 		}
479 479
 
480
-		curl_close( $curl );
480
+		curl_close($curl);
481 481
 
482 482
 		// Decode the data
483
-		$response = json_decode( $curl_response, true );
483
+		$response = json_decode($curl_response, true);
484 484
 
485 485
 		// Check to make sure that the return contains a valid image extensions
486 486
 		preg_match('/[^\?]+\.(jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/', $response['url'], $matches);
487 487
 
488
-		if ( !empty( $matches ) ){
488
+		if (!empty($matches)) {
489 489
 			return $response['url'];
490 490
 		}
491 491
 
@@ -500,12 +500,12 @@  discard block
 block discarded – undo
500 500
 	 * @param string $format PHP Date format.
501 501
 	 * @return mixed Date in the format requested.
502 502
 	 */
503
-	public static function date( $format ){
503
+	public static function date($format) {
504 504
 
505
-		$num_days = rand( 1, 60 );
506
-		$date = date( $format, strtotime( " +$num_days days" ) );
505
+		$num_days = rand(1, 60);
506
+		$date = date($format, strtotime(" +$num_days days"));
507 507
 
508
-		return apply_filters( "tc_date_data", $date );
508
+		return apply_filters("tc_date_data", $date);
509 509
 
510 510
 	}
511 511
 
@@ -517,19 +517,19 @@  discard block
 block discarded – undo
517 517
 	 *
518 518
 	 * @return string Time string
519 519
 	 */
520
-	public static function time(){
520
+	public static function time() {
521 521
 
522 522
 		$times = array(
523 523
 			'8:00 am',
524 524
 			'5:00PM',
525 525
 			'13:00',
526 526
 			'2015',
527
-			date( 'G:i', strtotime( " +".rand( 4, 24 )." hours" ) ),
528
-			date( 'g:i', strtotime( " +".rand( 4, 24 )." hours" ) ),
529
-			date( 'G:i A', strtotime( " +".rand( 4, 24 )." hours" ) )
527
+			date('G:i', strtotime(" +" . rand(4, 24) . " hours")),
528
+			date('g:i', strtotime(" +" . rand(4, 24) . " hours")),
529
+			date('G:i A', strtotime(" +" . rand(4, 24) . " hours"))
530 530
 		);
531 531
 
532
-		return apply_filters( "tc_time_data", $times[ rand( 0, 6 ) ] );
532
+		return apply_filters("tc_time_data", $times[rand(0, 6)]);
533 533
 
534 534
 	}
535 535
 
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
 	 *
542 542
 	 * @return string Timezone
543 543
 	 */
544
-	public static function timezone(){
544
+	public static function timezone() {
545 545
 
546 546
 		$timezones = array(
547 547
 			'America/Denver',
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 			'UTC',
560 560
 		);
561 561
 
562
-		return apply_filters( "tc_timezone_data", $timezones[ rand( 0, 12 ) ] );
562
+		return apply_filters("tc_timezone_data", $timezones[rand(0, 12)]);
563 563
 
564 564
 	}
565 565
 
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
 	 *
573 573
 	 * @return string Phone #.
574 574
 	 */
575
-	public static function phone(){
575
+	public static function phone() {
576 576
 
577 577
 		$phone_numbers = array(
578 578
 			'7203893101',
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
 			'+43 780 0047112',
589 589
 		);
590 590
 
591
-		return apply_filters( "tc_phone_data", $phone_numbers[ rand( 0, 10 ) ] );
591
+		return apply_filters("tc_phone_data", $phone_numbers[rand(0, 10)]);
592 592
 
593 593
 	}
594 594
 
@@ -600,11 +600,11 @@  discard block
 block discarded – undo
600 600
 	 *
601 601
 	 * @return string Email address.
602 602
 	 */
603
-	public static function email( $superrandom = false ){
603
+	public static function email($superrandom = false) {
604 604
 
605 605
 		// In certain situations we need to ensure that the email is never
606 606
 		// duplicated, like in creating new users.
607
-		if ( $superrandom !== false ){
607
+		if ($superrandom !== false) {
608 608
 			$user = $domain = '';
609 609
 
610 610
 			$tlds = array(
@@ -619,18 +619,18 @@  discard block
 block discarded – undo
619 619
 
620 620
 			$char = '0123456789abcdefghijklmnopqrstuvwxyz';
621 621
 
622
-			$user_length = mt_rand( 5, 20 );
623
-		    $domain_length = mt_rand( 7, 12 );
622
+			$user_length = mt_rand(5, 20);
623
+		    $domain_length = mt_rand(7, 12);
624 624
 
625
-			for ( $i = 1; $i <= $user_length; $i++ ){
626
-				$user .= substr( $char, mt_rand( 0, strlen( $char ) ), 1 );
625
+			for ($i = 1; $i <= $user_length; $i++) {
626
+				$user .= substr($char, mt_rand(0, strlen($char)), 1);
627 627
 			}
628 628
 
629
-			for ( $i = 1; $i <= $domain_length; $i++ ){
630
-				$domain .= substr( $char, mt_rand( 0, strlen( $char ) ), 1 );
629
+			for ($i = 1; $i <= $domain_length; $i++) {
630
+				$domain .= substr($char, mt_rand(0, strlen($char)), 1);
631 631
 			}
632 632
 
633
-			$tld = $tlds[ mt_rand( 0, ( sizeof( $tlds ) - 1 ) ) ];
633
+			$tld = $tlds[mt_rand(0, (sizeof($tlds) - 1))];
634 634
 
635 635
 			$email = $user . "@" . $domain . '.' . $tld;
636 636
 
@@ -647,12 +647,12 @@  discard block
 block discarded – undo
647 647
 				'[email protected]'
648 648
 			);
649 649
 
650
-			$email = $email_addresses[ rand( 0, 7 ) ];
650
+			$email = $email_addresses[rand(0, 7)];
651 651
 
652 652
 		}
653 653
 
654 654
 
655
-		return apply_filters( "tc_email_data", $email );
655
+		return apply_filters("tc_email_data", $email);
656 656
 
657 657
 	}
658 658
 
@@ -666,12 +666,12 @@  discard block
 block discarded – undo
666 666
 	 *
667 667
 	 * @return string URL.
668 668
 	 */
669
-	public static function link(){
669
+	public static function link() {
670 670
 
671 671
 		$links = array(
672 672
 			'http://google.com',
673 673
 			'https://www.twitter.com',
674
-			site_url( '/?iam=anextravariable' ),
674
+			site_url('/?iam=anextravariable'),
675 675
 			'github.com',
676 676
 			'http://filebase.com',
677 677
 			'http://facebook.com',
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
 			'https://jalopnik.com/',
680 680
 		);
681 681
 
682
-		return apply_filters( "tc_link_data", $links[ rand( 0, 7 ) ] );
682
+		return apply_filters("tc_link_data", $links[rand(0, 7)]);
683 683
 
684 684
 	}
685 685
 
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
 	 *
691 691
 	 * @return string URL.
692 692
 	 */
693
-	public static function oembed(){
693
+	public static function oembed() {
694 694
 
695 695
 		$links = array(
696 696
 			'https://www.youtube.com/watch?v=A85-YQsm6pY',
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
 			'https://www.instagram.com/p/-eyLo0RMfX',
702 702
 		);
703 703
 
704
-		return apply_filters( "tc_oembed_data", $links[ rand( 0, 5 ) ] );
704
+		return apply_filters("tc_oembed_data", $links[rand(0, 5)]);
705 705
 
706 706
 	}
707 707
 
@@ -715,10 +715,10 @@  discard block
 block discarded – undo
715 715
 	 * @param	string $type Video service to get link from
716 716
 	 * @return	string URL.
717 717
 	 */
718
-	public static function video( $type ){
718
+	public static function video($type) {
719 719
 
720 720
 		// Switch through our video types. Expecting to add more in the future
721
-		switch( $type ){
721
+		switch ($type) {
722 722
 
723 723
 			// YouTube videos
724 724
 			case 'youtube' :
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
 
760 760
 		}
761 761
 
762
-		return apply_filters( "tc_video_data", $links[ rand( 0, 8 ) ] );
762
+		return apply_filters("tc_video_data", $links[rand(0, 8)]);
763 763
 
764 764
 	}
765 765
 
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
 	 *
771 771
 	 * @return array Randomly strung together name.
772 772
 	 */
773
-	public static function name(){
773
+	public static function name() {
774 774
 
775 775
 		$first_names = array(
776 776
 			'Jacqui',
@@ -819,11 +819,11 @@  discard block
 block discarded – undo
819 819
 		);
820 820
 
821 821
 		$name = array(
822
-			'first'	=> $first_names[ rand( 0, 19 ) ],
823
-			'last'	=> $last_names[ rand( 0, 19 ) ]
822
+			'first'	=> $first_names[rand(0, 19)],
823
+			'last'	=> $last_names[rand(0, 19)]
824 824
 		);
825 825
 
826
-		return apply_filters( "tc_name_data", $name );
826
+		return apply_filters("tc_name_data", $name);
827 827
 
828 828
 	}
829 829
 
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
 	 *
833 833
 	 * @return	string Organization name.
834 834
 	 */
835
-	public static function organization(){
835
+	public static function organization() {
836 836
 
837 837
 		$orgs = array(
838 838
 			'Red Cross',
@@ -847,7 +847,7 @@  discard block
 block discarded – undo
847 847
 			'Raviga',
848 848
 		);
849 849
 
850
-		return apply_filters( "tc_organization_data", $orgs[ rand( 0, 9 ) ] );
850
+		return apply_filters("tc_organization_data", $orgs[rand(0, 9)]);
851 851
 
852 852
 	}
853 853
 
Please login to merge, or discard this patch.
includes/class-metabox-values.php 1 patch
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @subpackage Evans
9 9
  * @author     Old Town Media
10 10
  */
11
-class MetaboxValues{
11
+class MetaboxValues {
12 12
 
13 13
 	/**
14 14
 	 * Assigns the proper testing data to a custom metabox.
@@ -22,62 +22,62 @@  discard block
 block discarded – undo
22 22
 	 * @param int $post_id Single post ID.
23 23
 	 * @param array $cmb custom metabox array from CMB2.
24 24
 	 */
25
-	public function get_values( $post_id, $cmb, $connected ){
25
+	public function get_values($post_id, $cmb, $connected) {
26 26
 		$value = '';
27 27
 
28 28
 		// First check that our post ID & cmb array aren't empty
29
-		if ( empty( $cmb ) || empty( $post_id ) || ! is_user_logged_in() ){
29
+		if (empty($cmb) || empty($post_id) || !is_user_logged_in()) {
30 30
 			return;
31 31
 		}
32 32
 
33 33
 		// Fetch the appropriate type of data and return
34
-		switch( $cmb['type'] ){
34
+		switch ($cmb['type']) {
35 35
 
36 36
 			case 'text':
37 37
 			case 'text_small':
38 38
 			case 'text_medium':
39 39
 
40
-				$value = $this->text( $cmb );
40
+				$value = $this->text($cmb);
41 41
 
42 42
 				break;
43 43
 
44 44
 			case 'text_url':
45 45
 
46
-				$value = $this->url( $cmb );
46
+				$value = $this->url($cmb);
47 47
 
48 48
 				break;
49 49
 
50 50
 			case 'text_email' :
51 51
 			case 'email':
52 52
 
53
-				$value = $this->email( $cmb );
53
+				$value = $this->email($cmb);
54 54
 
55 55
 				break;
56 56
 
57 57
 			case 'number' :
58 58
 			case 'text_money':
59 59
 
60
-				$value = $this->number( $cmb );
60
+				$value = $this->number($cmb);
61 61
 
62 62
 				break;
63 63
 
64 64
 			case 'text_time':
65 65
 			case 'time':
66 66
 
67
-				$value = $this->time( $cmb );
67
+				$value = $this->time($cmb);
68 68
 
69 69
 				break;
70 70
 
71 71
 			case 'select_timezone':
72 72
 
73
-				$value = $this->timezone( $cmb );
73
+				$value = $this->timezone($cmb);
74 74
 
75 75
 				break;
76 76
 
77 77
 			case 'text_date':
78 78
 			case 'date':
79 79
 
80
-				$value = $this->date( $cmb );
80
+				$value = $this->date($cmb);
81 81
 
82 82
 				break;
83 83
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 			case 'date_unix':
87 87
 			case 'datetime_unix':
88 88
 
89
-				$value = $this->timestamp( $cmb );
89
+				$value = $this->timestamp($cmb);
90 90
 
91 91
 				break;
92 92
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 
95 95
 			case 'test_colorpicker':
96 96
 
97
-				$value = $this->color( $cmb );
97
+				$value = $this->color($cmb);
98 98
 
99 99
 				break;
100 100
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 			case 'textarea_small':
103 103
 			case 'textarea_code':
104 104
 
105
-				$value = $this->textarea( $cmb );
105
+				$value = $this->textarea($cmb);
106 106
 
107 107
 				break;
108 108
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 			case 'radio_inline':
111 111
 			case 'radio':
112 112
 
113
-				$value = $this->radio( $cmb );
113
+				$value = $this->radio($cmb);
114 114
 
115 115
 				break;
116 116
 
@@ -120,30 +120,30 @@  discard block
 block discarded – undo
120 120
 
121 121
 			case 'checkbox':
122 122
 
123
-				if ( isset( $cmb['source'] ) && 'acf' === $cmb['source'] ){
124
-					$value = $this->multicheck( $cmb );
123
+				if (isset($cmb['source']) && 'acf' === $cmb['source']) {
124
+					$value = $this->multicheck($cmb);
125 125
 				} else {
126
-					$value = $this->checkbox( $cmb );
126
+					$value = $this->checkbox($cmb);
127 127
 				}
128 128
 
129 129
 				break;
130 130
 
131 131
 			case 'multicheck':
132 132
 
133
-				$value = $this->multicheck( $cmb );
133
+				$value = $this->multicheck($cmb);
134 134
 
135 135
 				break;
136 136
 
137 137
 			case 'wysiwyg':
138 138
 
139
-				$value = $this->wysiwyg( $cmb );
139
+				$value = $this->wysiwyg($cmb);
140 140
 
141 141
 				break;
142 142
 
143 143
 			case 'file':
144 144
 			case 'image':
145 145
 
146
-				$value = $this->file( $cmb, $post_id, $connected );
146
+				$value = $this->file($cmb, $post_id, $connected);
147 147
 
148 148
 				break;
149 149
 
@@ -151,19 +151,19 @@  discard block
 block discarded – undo
151 151
 
152 152
 			case 'oembed':
153 153
 
154
-				$value = $this->oembed( $cmb );
154
+				$value = $this->oembed($cmb);
155 155
 
156 156
 				break;
157 157
 
158 158
 		}
159 159
 
160 160
 		// Value must exist to attempt to insert
161
-		if ( ! empty( $value ) && ! is_wp_error( $value ) ){
161
+		if (!empty($value) && !is_wp_error($value)) {
162 162
 
163
-			$this->update_meta( $post_id, $value, $cmb );
163
+			$this->update_meta($post_id, $value, $cmb);
164 164
 
165 165
 		// If we're dealing with a WP Error object, just return the message for debugging
166
-		} elseif ( is_wp_error( $value ) ){
166
+		} elseif (is_wp_error($value)) {
167 167
 
168 168
 			return $value->get_error_message();
169 169
 
@@ -180,31 +180,31 @@  discard block
 block discarded – undo
180 180
 	 * @param array $cmb Metabox data
181 181
 	 * @return string cmb value
182 182
 	 */
183
-	private function text( $cmb ){
183
+	private function text($cmb) {
184 184
 
185 185
 		// If phone is in the id, fetch a phone #
186
-		if ( stripos( $cmb['id'], 'phone' ) ){
186
+		if (stripos($cmb['id'], 'phone')) {
187 187
 			$value = TestContent::phone();
188 188
 
189 189
 		// If email is in the id, fetch an email address
190
-		} elseif ( stripos( $cmb['id'], 'email' ) ){
190
+		} elseif (stripos($cmb['id'], 'email')) {
191 191
 			$value = TestContent::email();
192 192
 
193 193
 		// If time is in the id, fetch a time string
194
-		} elseif ( stripos( $cmb['id'], 'time' ) ){
194
+		} elseif (stripos($cmb['id'], 'time')) {
195 195
 			$value = TestContent::time();
196 196
 
197 197
 		// If company|organization is in the ID, fetch a company name
198
-		} elseif ( stripos( $cmb['id'], 'company' ) || stripos( $cmb['id'], 'organization' ) ){
198
+		} elseif (stripos($cmb['id'], 'company') || stripos($cmb['id'], 'organization')) {
199 199
 			$value = TestContent::organization();
200 200
 
201 201
 		// Otherwise, just a random text string
202 202
 		} else {
203
-			$value = TestContent::title( rand( 10, 50 ) );
203
+			$value = TestContent::title(rand(10, 50));
204 204
 		}
205 205
 
206
-		if ( 'acf' === $cmb['source'] && !empty( $cmb['extras']->chars ) ){
207
-			$value = substr( $value, 0, $cmb['extras']->chars );
206
+		if ('acf' === $cmb['source'] && !empty($cmb['extras']->chars)) {
207
+			$value = substr($value, 0, $cmb['extras']->chars);
208 208
 		}
209 209
 
210 210
 		return $value;
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 	 * @param array $cmb Metabox data
221 221
 	 * @return string cmb value
222 222
 	 */
223
-	private function url( $cmb ){
223
+	private function url($cmb) {
224 224
 
225 225
 		return TestContent::link();
226 226
 
@@ -235,9 +235,9 @@  discard block
 block discarded – undo
235 235
 	 * @param array $cmb Metabox data
236 236
 	 * @return string cmb value
237 237
 	 */
238
-	private function email( $cmb ){
238
+	private function email($cmb) {
239 239
 
240
-		return TestContent::email();;
240
+		return TestContent::email(); ;
241 241
 
242 242
 	}
243 243
 
@@ -248,20 +248,20 @@  discard block
 block discarded – undo
248 248
 	 * @param array $cmb Metabox data
249 249
 	 * @return int cmb value
250 250
 	 */
251
-	private function number( $cmb ){
251
+	private function number($cmb) {
252 252
 
253 253
 		$min = 1;
254 254
 		$max = 10000000;
255 255
 
256
-		if ( 'acf' == $cmb['source'] && !empty( $cmb['extras']->min ) ){
256
+		if ('acf' == $cmb['source'] && !empty($cmb['extras']->min)) {
257 257
 			$min = $cmb['extras']->min;
258 258
 		}
259 259
 
260
-		if ( 'acf' == $cmb['source'] && !empty( $cmb['extras']->max ) ){
260
+		if ('acf' == $cmb['source'] && !empty($cmb['extras']->max)) {
261 261
 			$max = $cmb['extras']->max;
262 262
 		}
263 263
 
264
-		return rand( $min, $max );
264
+		return rand($min, $max);
265 265
 
266 266
 	}
267 267
 
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 	 * @param array $cmb Metabox data
275 275
 	 * @return string cmb value
276 276
 	 */
277
-	private function time( $cmb ){
277
+	private function time($cmb) {
278 278
 
279 279
 		return TestContent::time();
280 280
 
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 	 * @param array $cmb Metabox data
290 290
 	 * @return string cmb value
291 291
 	 */
292
-	private function timezone( $cmb ){
292
+	private function timezone($cmb) {
293 293
 
294 294
 		return TestContent::timezone();
295 295
 
@@ -304,9 +304,9 @@  discard block
 block discarded – undo
304 304
 	 * @param array $cmb Metabox data
305 305
 	 * @return string cmb value
306 306
 	 */
307
-	private function date( $cmb ){
307
+	private function date($cmb) {
308 308
 
309
-		return TestContent::date( 'm/d/Y' );
309
+		return TestContent::date('m/d/Y');
310 310
 
311 311
 	}
312 312
 
@@ -319,9 +319,9 @@  discard block
 block discarded – undo
319 319
 	 * @param array $cmb Metabox data
320 320
 	 * @return string cmb value
321 321
 	 */
322
-	private function timestamp( $cmb ){
322
+	private function timestamp($cmb) {
323 323
 
324
-		return TestContent::date( 'U' );
324
+		return TestContent::date('U');
325 325
 
326 326
 	}
327 327
 
@@ -332,9 +332,9 @@  discard block
 block discarded – undo
332 332
 	 * @param array $cmb Metabox data
333 333
 	 * @return string cmb value
334 334
 	 */
335
-	private function color( $cmb ){
335
+	private function color($cmb) {
336 336
 
337
-		return '#' . str_pad( dechex( mt_rand( 0, 0xFFFFFF ) ), 6, '0', STR_PAD_LEFT );
337
+		return '#' . str_pad(dechex(mt_rand(0, 0xFFFFFF)), 6, '0', STR_PAD_LEFT);
338 338
 
339 339
 	}
340 340
 
@@ -347,12 +347,12 @@  discard block
 block discarded – undo
347 347
 	 * @param array $cmb Metabox data
348 348
 	 * @return string cmb value
349 349
 	 */
350
-	private function textarea( $cmb ){
350
+	private function textarea($cmb) {
351 351
 
352 352
 		$value = TestContent::plain_text();
353 353
 
354
-		if ( 'acf' == $cmb['source'] && !empty( $cmb['extras']->chars ) ){
355
-			$value = substr( $value, 0,  $cmb['extras']->chars );
354
+		if ('acf' == $cmb['source'] && !empty($cmb['extras']->chars)) {
355
+			$value = substr($value, 0, $cmb['extras']->chars);
356 356
 		}
357 357
 
358 358
 		return $value;
@@ -368,11 +368,11 @@  discard block
 block discarded – undo
368 368
 	 * @param array $cmb Metabox data
369 369
 	 * @return string cmb value
370 370
 	 */
371
-	private function radio( $cmb ){
371
+	private function radio($cmb) {
372 372
 
373 373
 		// Grab a random item out of the array and return the key
374
-		$new_val = array_slice( $cmb['options'], rand( 0, count( $cmb['options'] ) ), 1 );
375
-		$value = key( $new_val );
374
+		$new_val = array_slice($cmb['options'], rand(0, count($cmb['options'])), 1);
375
+		$value = key($new_val);
376 376
 
377 377
 		return $value;
378 378
 
@@ -387,11 +387,11 @@  discard block
 block discarded – undo
387 387
 	 * @param array $cmb Metabox data
388 388
 	 * @return string cmb value
389 389
 	 */
390
-	private function checkbox( $cmb ){
390
+	private function checkbox($cmb) {
391 391
 		$value = '';
392 392
 
393 393
 		// 50/50 odds of being turned on
394
-		if ( rand( 0, 1 ) == 1 ){
394
+		if (rand(0, 1) == 1) {
395 395
 			$value = 'on';
396 396
 		}
397 397
 
@@ -408,15 +408,15 @@  discard block
 block discarded – undo
408 408
 	 * @param array $cmb Metabox data
409 409
 	 * @return array cmb value
410 410
 	 */
411
-	private function multicheck( $cmb ){
411
+	private function multicheck($cmb) {
412 412
 
413 413
 		$new_option = array();
414 414
 
415 415
 		// Loop through each of our options
416
-		foreach ( $cmb['options'] as $key => $value ){
416
+		foreach ($cmb['options'] as $key => $value) {
417 417
 
418 418
 			// 50/50 chance of being included
419
-			if ( rand( 0, 1 ) ){
419
+			if (rand(0, 1)) {
420 420
 				$new_option[] = $key;
421 421
 			}
422 422
 
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 	 * @param array $cmb Metabox data
436 436
 	 * @return string cmb value
437 437
 	 */
438
-	private function wysiwyg( $cmb ){
438
+	private function wysiwyg($cmb) {
439 439
 
440 440
 		return TestContent::paragraphs();
441 441
 
@@ -452,11 +452,11 @@  discard block
 block discarded – undo
452 452
 	 * @param bool $connected Whether we're connected to the Internets or not
453 453
 	 * @return mixed string|object cmb value or WP_Error object
454 454
 	 */
455
-	private function file( $cmb, $post_id, $connected ){
455
+	private function file($cmb, $post_id, $connected) {
456 456
 		$value = '';
457 457
 
458
-		if ( true === $connected ){
459
-			$value = TestContent::image( $post_id );
458
+		if (true === $connected) {
459
+			$value = TestContent::image($post_id);
460 460
 		}
461 461
 
462 462
 		return $value;
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 	 * @param array $cmb Metabox data
473 473
 	 * @return string cmb value
474 474
 	 */
475
-	private function oembed( $cmb ){
475
+	private function oembed($cmb) {
476 476
 
477 477
 		return TestContent::oembed();
478 478
 
@@ -490,25 +490,25 @@  discard block
 block discarded – undo
490 490
 	 * @param string $value Value to add into the database.
491 491
 	 * @param array $cmb SMB data.
492 492
 	 */
493
-	private function update_meta( $post_id, $value, $cmb ){
493
+	private function update_meta($post_id, $value, $cmb) {
494 494
 
495 495
 		$type 	= $cmb['type'];
496
-		$id		= $cmb['id'];
497
-		$value = apply_filters( "tc_{$type}_metabox", $value );	// Filter by metabox type
498
-		$value = apply_filters( "tc_{$id}_metabox", $value ); // Filter by metabox ID
496
+		$id = $cmb['id'];
497
+		$value = apply_filters("tc_{$type}_metabox", $value); // Filter by metabox type
498
+		$value = apply_filters("tc_{$id}_metabox", $value); // Filter by metabox ID
499 499
 
500 500
 		// Files must be treated separately - they use the attachment ID
501 501
 		// & url of media for separate cmb values. (only in cmb1 & cmb2 though)
502
-		if ( 'file'!== $cmb['type'] || ( 'file' === $cmb['type'] && 'cmb_hm' === $cmb['source'] ) ){
503
-			add_post_meta( $post_id, $cmb['id'], $value, true );
502
+		if ('file' !== $cmb['type'] || ('file' === $cmb['type'] && 'cmb_hm' === $cmb['source'])) {
503
+			add_post_meta($post_id, $cmb['id'], $value, true);
504 504
 		} else {
505
-			add_post_meta( $post_id, $cmb['id'].'_id', $value, true );
506
-			add_post_meta( $post_id, $cmb['id'], wp_get_attachment_url( $value ), true );
505
+			add_post_meta($post_id, $cmb['id'] . '_id', $value, true);
506
+			add_post_meta($post_id, $cmb['id'], wp_get_attachment_url($value), true);
507 507
 		}
508 508
 
509 509
 		// Add extra, redundant meta. Because, why not have two rows for the price of one?
510
-		if ( isset( $cmb['source'] ) && 'acf' === $cmb['source'] ){
511
-			add_post_meta( $post_id, '_' . $cmb['id'], $cmb['key'], true );
510
+		if (isset($cmb['source']) && 'acf' === $cmb['source']) {
511
+			add_post_meta($post_id, '_' . $cmb['id'], $cmb['key'], true);
512 512
 		}
513 513
 
514 514
 	}
Please login to merge, or discard this patch.