Ticket #17267: 17267-2.diff
File 17267-2.diff, 868 bytes (added by , 12 years ago) |
---|
-
wp-content/themes/twentyeleven/functions.php
448 448 <?php endif; 449 449 } 450 450 451 /** 452 * Grab the first URL from a Link post 453 */ 451 // Return the URL for the first link found in the post content. 454 452 function twentyeleven_url_grabber() { 455 global $post, $posts; 456 457 $first_url = ''; 458 459 ob_start(); 460 ob_end_clean(); 461 462 $output = preg_match_all('/<a.+href=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches); 463 464 $first_url = $matches [1] [0]; 465 466 if ( empty( $first_url ) ) 453 if ( ! preg_match( '/<a\s[^>]*?href=[\'"](.+?)[\'"]/is', get_the_content(), $matches ) ) 467 454 return false; 468 455 469 return $first_url;456 return esc_url_raw( $matches[1] ); 470 457 } 471 458 472 459 /**