Code Duplication    Length = 25-25 lines in 2 locations

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

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