Code Duplication    Length = 19-19 lines in 2 locations

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

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

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

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