Code Duplication    Length = 19-19 lines in 2 locations

modules/shortcodes.php 2 locations

@@ 76-94 (lines=19) @@
73
 * @param String $search
74
 * @return String $content
75
 */
76
function jetpack_preg_replace_outside_tags( $pattern, $replacement, $content, $search = null ) {
77
	if( ! function_exists( 'wp_html_split' ) ) {
78
		return $content;
79
	}
80
81
	if ( $search && false === strpos( $content, $search ) ) {
82
		return $content;
83
	}
84
85
	$textarr = wp_html_split( $content );
86
	unset( $content );
87
	foreach( $textarr as &$element ) {
88
	    if ( '' === $element || '<' === $element{0} )
89
	        continue;
90
	    $element = preg_replace( $pattern, $replacement, $element );
91
	}
92
93
	return join( $textarr );
94
}
95
96
/**
97
 * Runs preg_replace_callback so that replacements don't happen within open tags.
@@ 106-124 (lines=19) @@
103
 * @param String $search
104
 * @return String $content
105
 */
106
function jetpack_preg_replace_callback_outside_tags( $pattern, $callback, $content, $search = null ) {
107
	if( ! function_exists( 'wp_html_split' ) ) {
108
		return $content;
109
	}
110
111
	if ( $search && false === strpos( $content, $search ) ) {
112
		return $content;
113
	}
114
115
	$textarr = wp_html_split( $content );
116
	unset( $content );
117
	foreach( $textarr as &$element ) {
118
	    if ( '' === $element || '<' === $element{0} )
119
	        continue;
120
	    $element = preg_replace_callback( $pattern, $callback, $element );
121
	}
122
123
	return join( $textarr );
124
}
125
126
if ( ! function_exists( 'jetpack_shortcode_get_wpvideo_id' ) ) {
127
	function jetpack_shortcode_get_wpvideo_id( $atts ) {