Code Duplication    Length = 25-25 lines in 2 locations

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

@@ 831-855 (lines=25) @@
828
	 *
829
	 * @return html
830
	 */
831
	static function get_project_type( $post_id ) {
832
		$project_types = get_the_terms( $post_id, self::CUSTOM_TAXONOMY_TYPE );
833
834
		// If no types, return empty string
835
		if ( empty( $project_types ) || is_wp_error( $project_types ) ) {
836
			return;
837
		}
838
839
		$html = '<div class="project-types"><span>' . __( 'Types', 'jetpack' ) . ':</span>';
840
		$types = array();
841
		// Loop thorugh all the types
842
		foreach ( $project_types as $project_type ) {
843
			$project_type_link = get_term_link( $project_type, self::CUSTOM_TAXONOMY_TYPE );
844
845
			if ( is_wp_error( $project_type_link ) ) {
846
				return $project_type_link;
847
			}
848
849
			$types[] = '<a href="' . esc_url( $project_type_link ) . '" rel="tag">' . esc_html( $project_type->name ) . '</a>';
850
		}
851
		$html .= ' '.implode( ', ', $types );
852
		$html .= '</div>';
853
854
		return $html;
855
	}
856
857
	/**
858
	 * Displays the project tags that a project belongs to.
@@ 862-886 (lines=25) @@
859
	 *
860
	 * @return html
861
	 */
862
	static function get_project_tags( $post_id ) {
863
		$project_tags = get_the_terms( $post_id, self::CUSTOM_TAXONOMY_TAG );
864
865
		// If no tags, return empty string
866
		if ( empty( $project_tags ) || is_wp_error( $project_tags ) ) {
867
			return false;
868
		}
869
870
		$html = '<div class="project-tags"><span>' . __( 'Tags', 'jetpack' ) . ':</span>';
871
		$tags = array();
872
		// Loop thorugh all the tags
873
		foreach ( $project_tags as $project_tag ) {
874
			$project_tag_link = get_term_link( $project_tag, self::CUSTOM_TAXONOMY_TYPE );
875
876
			if ( is_wp_error( $project_tag_link ) ) {
877
				return $project_tag_link;
878
			}
879
880
			$tags[] = '<a href="' . esc_url( $project_tag_link ) . '" rel="tag">' . esc_html( $project_tag->name ) . '</a>';
881
		}
882
		$html .= ' '. implode( ', ', $tags );
883
		$html .= '</div>';
884
885
		return $html;
886
	}
887
888
	/**
889
	 * Displays the author of the current portfolio project.