Code Duplication    Length = 25-25 lines in 2 locations

modules/custom-post-types/portfolios.php 2 locations

@@ 685-709 (lines=25) @@
682
	 *
683
	 * @return html
684
	 */
685
	static function get_project_type( $post_id ) {
686
		$project_types = get_the_terms( $post_id, self::CUSTOM_TAXONOMY_TYPE );
687
688
		// If no types, return empty string
689
		if ( empty( $project_types ) || is_wp_error( $project_types ) ) {
690
			return;
691
		}
692
693
		$html = '<div class="project-types"><span>' . __( 'Types', 'jetpack' ) . ':</span>';
694
		$types = array();
695
		// Loop thorugh all the types
696
		foreach ( $project_types as $project_type ) {
697
			$project_type_link = get_term_link( $project_type, self::CUSTOM_TAXONOMY_TYPE );
698
699
			if ( is_wp_error( $project_type_link ) ) {
700
				return $project_type_link;
701
			}
702
703
			$types[] = '<a href="' . esc_url( $project_type_link ) . '" rel="tag">' . esc_html( $project_type->name ) . '</a>';
704
		}
705
		$html .= ' '.implode( ', ', $types );
706
		$html .= '</div>';
707
708
		return $html;
709
	}
710
711
	/**
712
	 * Displays the project tags that a project belongs to.
@@ 716-740 (lines=25) @@
713
	 *
714
	 * @return html
715
	 */
716
	static function get_project_tags( $post_id ) {
717
		$project_tags = get_the_terms( $post_id, self::CUSTOM_TAXONOMY_TAG );
718
719
		// If no tags, return empty string
720
		if ( empty( $project_tags ) || is_wp_error( $project_tags ) ) {
721
			return false;
722
		}
723
724
		$html = '<div class="project-tags"><span>' . __( 'Tags', 'jetpack' ) . ':</span>';
725
		$tags = array();
726
		// Loop thorugh all the tags
727
		foreach ( $project_tags as $project_tag ) {
728
			$project_tag_link = get_term_link( $project_tag, self::CUSTOM_TAXONOMY_TYPE );
729
730
			if ( is_wp_error( $project_tag_link ) ) {
731
				return $project_tag_link;
732
			}
733
734
			$tags[] = '<a href="' . esc_url( $project_tag_link ) . '" rel="tag">' . esc_html( $project_tag->name ) . '</a>';
735
		}
736
		$html .= ' '. implode( ', ', $tags );
737
		$html .= '</div>';
738
739
		return $html;
740
	}
741
742
	/**
743
	 * Displays the author of the current portfolio project.