Ticket #24484: 24484.patch
File 24484.patch, 2.5 KB (added by , 11 years ago) |
---|
-
wp-includes/media.php
2424 2424 if ( strstr( $shortcode[0], $url ) ) { 2425 2425 if ( ! $matched ) 2426 2426 $matched = do_shortcode_tag( $shortcode ); 2427 // $content = str_replace( $shortcode[0], '', $content, $count );2428 2427 } 2429 2428 } 2430 2429 } … … 2438 2437 if ( strstr( $match[0], $url ) ) { 2439 2438 if ( ! $matched ) 2440 2439 $matched = $match[0]; 2441 // $content = str_replace( $match[0], '', $content, $count );2442 2440 } 2443 2441 } 2444 2442 } … … 2505 2503 if ( ! preg_match( '#class=([\'"])(.+?)\1#is', $matched_html, $matches ) || empty( $matches ) ) 2506 2504 return $attachment_id; 2507 2505 2508 $classes = $matches[2]; 2509 if ( ! empty( $classes ) && false !== strpos( $classes, 'wp-image-' ) ) 2510 if ( preg_match( '#wp-image-([0-9]+)#i', $classes, $matches ) ) 2506 $classes = $matches[2]; 2507 if ( ! empty( $classes ) && false !== strpos( $classes, 'wp-image-' ) ) 2508 if ( preg_match( '#wp-image-([0-9]+)#i', $classes, $matches ) ) 2511 2509 $attachment_id = absint( $matches[1] ); 2512 2510 2513 2511 return $attachment_id; -
wp-includes/post-formats.php
240 240 * 241 241 * @since 3.6.0 242 242 * 243 * @param string $content A string which might contain a URL, passed by reference. 244 * @param boolean $remove Whether to remove the found URL from the passed content. 243 * @param string $content A string which might contain a URL. 245 244 * @return string The found URL. 246 245 */ 247 function get_content_url( &$content, $remove = false) {246 function get_content_url( $content ) { 248 247 if ( empty( $content ) ) 249 248 return ''; 250 249 251 250 // the content is a URL 252 251 $trimmed = trim( $content ); 253 252 if ( 0 === stripos( $trimmed, 'http' ) && ! preg_match( '#\s#', $trimmed ) ) { 254 if ( $remove ) 255 $content = ''; 253 return $trimmed; 256 254 257 return $trimmed;258 255 // the content is HTML so we grab the first href 259 256 } elseif ( preg_match( '/<a\s[^>]*?href=([\'"])(.+?)\1/is', $content, $matches ) ) { 260 257 return esc_url_raw( $matches[2] ); … … 264 261 $line = trim( array_shift( $lines ) ); 265 262 266 263 // the content is a URL followed by content 267 if ( 0 === stripos( $line, 'http' ) ) { 268 if ( $remove ) 269 $content = trim( join( "\n", $lines ) ); 270 264 if ( 0 === stripos( $line, 'http' ) ) 271 265 return esc_url_raw( $line ); 272 }273 266 274 267 return ''; 275 268 }