Code Duplication    Length = 19-19 lines in 2 locations

modules/shortcodes.php 2 locations

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