Code Duplication    Length = 19-19 lines in 2 locations

modules/custom-post-types/testimonial.php 1 location

@@ 558-576 (lines=19) @@
555
			}
556
		}
557
558
		if ( $atts['orderby'] ) {
559
			$atts['orderby'] = urldecode( $atts['orderby'] );
560
			$atts['orderby'] = strtolower( $atts['orderby'] );
561
			$allowed_keys = array('author', 'date', 'title', 'rand');
562
563
			$parsed = array();
564
			foreach ( explode( ',', $atts['orderby'] ) as $testimonial_index_number => $orderby ) {
565
				if ( ! in_array( $orderby, $allowed_keys ) ) {
566
					continue;
567
				}
568
				$parsed[] = $orderby;
569
			}
570
571
			if ( empty( $parsed ) ) {
572
				unset($atts['orderby']);
573
			} else {
574
				$atts['orderby'] = implode( ' ', $parsed );
575
			}
576
		}
577
578
		// enqueue shortcode styles when shortcode is used
579
		wp_enqueue_style( 'jetpack-testimonial-style', plugins_url( 'css/testimonial-shortcode.css', __FILE__ ), array(), '20140326' );

modules/custom-post-types/portfolios.php 1 location

@@ 613-631 (lines=19) @@
610
			}
611
		}
612
613
		if ( $atts['orderby'] ) {
614
			$atts['orderby'] = urldecode( $atts['orderby'] );
615
			$atts['orderby'] = strtolower( $atts['orderby'] );
616
			$allowed_keys = array( 'author', 'date', 'title', 'rand' );
617
618
			$parsed = array();
619
			foreach ( explode( ',', $atts['orderby'] ) as $portfolio_index_number => $orderby ) {
620
				if ( ! in_array( $orderby, $allowed_keys ) ) {
621
					continue;
622
				}
623
				$parsed[] = $orderby;
624
			}
625
626
			if ( empty( $parsed ) ) {
627
				unset( $atts['orderby'] );
628
			} else {
629
				$atts['orderby'] = implode( ' ', $parsed );
630
			}
631
		}
632
633
		// enqueue shortcode styles when shortcode is used
634
		wp_enqueue_style( 'jetpack-portfolio-style', plugins_url( 'css/portfolio-shortcode.css', __FILE__ ), array(), '20140326' );