Code Duplication    Length = 2-4 lines in 3 locations

projects/plugins/jetpack/_inc/lib/markdown/extra.php 2 locations

@@ 806-807 (lines=2) @@
803
	}
804
	function _doHeaders_callback_setext($matches) {
805
		# Terrible hack to check we haven't found an empty list item.
806
		if ($matches[2] == '-' && preg_match('{^-(?: |$)}', $matches[1]))
807
			return $matches[0];
808
809
		$level = $matches[2][0] == '=' ? 1 : 2;
810
		$block = "<h$level>".$this->runSpanGamut($matches[1])."</h$level>";
@@ 2509-2510 (lines=2) @@
2506
		return $text;
2507
	}
2508
	function _doHeaders_callback_setext($matches) {
2509
		if ($matches[3] == '-' && preg_match('{^- }', $matches[1]))
2510
			return $matches[0];
2511
		$level = $matches[3][0] == '=' ? 1 : 2;
2512
		$attr  = $this->doExtraAttributes("h$level", $dummy =& $matches[2]);
2513
		$block = "<h$level$attr>".$this->runSpanGamut($matches[1])."</h$level>";

projects/plugins/jetpack/modules/carousel/jetpack-carousel.php 1 location

@@ 697-700 (lines=4) @@
694
		return preg_replace_callback(
695
			'#(<a[^>]* href=(["\']?)(\S+)\2>)\s*(<img[^>]*)(class=(["\']?)[^>]*wp-image-[0-9]+[^>]*\6.*>)\s*</a>#is',
696
			static function( $matches ) {
697
				if ( ! preg_match( '#\.\w+$#', $matches[3] ) ) {
698
					// The a[href] doesn't end in a file extension like .jpeg, so this is not a link to the media file, and should get a lightbox.
699
					return $matches[4] . ' data-amp-lightbox="true" lightbox="true" ' . $matches[5]; // https://github.com/ampproject/amp-wp/blob/1094ea03bd5dc92889405a47a8c41de1a88908de/includes/sanitizers/class-amp-img-sanitizer.php#L419.
700
				}
701
702
				return $matches[0];
703
			},