Code Duplication    Length = 8-10 lines in 2 locations

_inc/lib/class.media-extractor.php 2 locations

@@ 96-105 (lines=10) @@
93
94
		// ----------------------------------- MENTIONS ------------------------------
95
96
		if ( self::MENTIONS & $what_to_extract ) {
97
			if ( preg_match_all( '/(^|\s)@(\w+)/u', $stripped_content, $matches ) ) {
98
				$mentions = array_values( array_unique( $matches[2] ) ); //array_unique() retains the keys!
99
				$mentions = array_map( 'strtolower', $mentions );
100
				$extracted['mention'] = array( 'name' => $mentions );
101
				if ( !isset( $extracted['has'] ) )
102
					$extracted['has'] = array();
103
				$extracted['has']['mention'] = count( $mentions );
104
			}
105
		}
106
107
		// ----------------------------------- HASHTAGS ------------------------------
108
		/** Some hosts may not compile with --enable-unicode-properties and kick a warning:
@@ 116-123 (lines=8) @@
113
			//This regex does not exactly match Twitter's
114
			// if there are problems/complaints we should implement this:
115
			//   https://github.com/twitter/twitter-text/blob/master/java/src/com/twitter/Regex.java
116
			if ( preg_match_all( '/(?:^|\s)#(\w*\p{L}+\w*)/u', $stripped_content, $matches ) ) {
117
				$hashtags = array_values( array_unique( $matches[1] ) ); //array_unique() retains the keys!
118
				$hashtags = array_map( 'strtolower', $hashtags );
119
				$extracted['hashtag'] = array( 'name' => $hashtags );
120
				if ( !isset( $extracted['has'] ) )
121
					$extracted['has'] = array();
122
				$extracted['has']['hashtag'] = count( $hashtags );
123
			}
124
		}
125
126
		// ----------------------------------- SHORTCODES ------------------------------