Code Duplication    Length = 19-19 lines in 2 locations

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

@@ 548-566 (lines=19) @@
545
			}
546
		}
547
548
		if ( $atts['orderby'] ) {
549
			$atts['orderby'] = urldecode( $atts['orderby'] );
550
			$atts['orderby'] = strtolower( $atts['orderby'] );
551
			$allowed_keys = array( 'author', 'date', 'title', 'rand' );
552
553
			$parsed = array();
554
			foreach ( explode( ',', $atts['orderby'] ) as $portfolio_index_number => $orderby ) {
555
				if ( ! in_array( $orderby, $allowed_keys ) ) {
556
					continue;
557
				}
558
				$parsed[] = $orderby;
559
			}
560
561
			if ( empty( $parsed ) ) {
562
				unset( $atts['orderby'] );
563
			} else {
564
				$atts['orderby'] = implode( ' ', $parsed );
565
			}
566
		}
567
568
		// enqueue shortcode styles when shortcode is used
569
		wp_enqueue_style( 'jetpack-portfolio-style', plugins_url( 'css/portfolio-shortcode.css', __FILE__ ), array(), '20140326' );

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

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