Code Duplication    Length = 19-19 lines in 2 locations

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

@@ 470-488 (lines=19) @@
467
			}
468
		}
469
470
		if ( $atts['orderby'] ) {
471
			$atts['orderby'] = urldecode( $atts['orderby'] );
472
			$atts['orderby'] = strtolower( $atts['orderby'] );
473
			$allowed_keys = array( 'author', 'date', 'title', 'rand' );
474
475
			$parsed = array();
476
			foreach ( explode( ',', $atts['orderby'] ) as $portfolio_index_number => $orderby ) {
477
				if ( ! in_array( $orderby, $allowed_keys ) ) {
478
					continue;
479
				}
480
				$parsed[] = $orderby;
481
			}
482
483
			if ( empty( $parsed ) ) {
484
				unset( $atts['orderby'] );
485
			} else {
486
				$atts['orderby'] = implode( ' ', $parsed );
487
			}
488
		}
489
490
		// enqueue shortcode styles when shortcode is used
491
		wp_enqueue_style( 'jetpack-portfolio-style', plugins_url( 'css/portfolio-shortcode.css', __FILE__ ), array(), '20140326' );

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

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