diff --git wp-includes/comment.php wp-includes/comment.php
index d3d8db6..9987985 100644
|
|
function pingback($content, $post_ID) { |
1812 | 1812 | |
1813 | 1813 | $pung = get_pung($post_ID); |
1814 | 1814 | |
1815 | | // Variables |
1816 | | $ltrs = '\w'; |
1817 | | $gunk = '/#~:.?+=&%@!\-'; |
1818 | | $punc = '.:?\-'; |
1819 | | $any = $ltrs . $gunk . $punc; |
1820 | | |
1821 | 1815 | // Step 1 |
1822 | 1816 | // Parsing the post, external links (if any) are stored in the $post_links array |
1823 | | // This regexp comes straight from phpfreaks.com |
1824 | | // http://www.phpfreaks.com/quickcode/Extract_All_URLs_on_a_Page/15.php |
1825 | | preg_match_all("{\b http : [$any] +? (?= [$punc] * [^$any] | $)}x", $content, $post_links_temp); |
| 1817 | $post_links_temp = wp_extract_urls( $content ); |
1826 | 1818 | |
1827 | 1819 | // Step 2. |
1828 | 1820 | // Walking thru the links array |
… |
… |
function pingback($content, $post_ID) { |
1833 | 1825 | // http://dummy-weblog.org/post.php |
1834 | 1826 | // We don't wanna ping first and second types, even if they have a valid <link/> |
1835 | 1827 | |
1836 | | foreach ( (array) $post_links_temp[0] as $link_test ) : |
| 1828 | foreach ( (array) $post_links_temp as $link_test ) : |
1837 | 1829 | if ( !in_array($link_test, $pung) && (url_to_postid($link_test) != $post_ID) // If we haven't pung it already and it isn't a link to itself |
1838 | 1830 | && !is_local_attachment($link_test) ) : // Also, let's never ping local attachments. |
1839 | 1831 | if ( $test = @parse_url($link_test) ) { |
diff --git wp-includes/functions.php wp-includes/functions.php
index 6d37ede..74d4a06 100644
|
|
function xmlrpc_removepostdata( $content ) { |
393 | 393 | } |
394 | 394 | |
395 | 395 | /** |
| 396 | * Use RegEx to extract URLs from arbitrary content |
| 397 | * |
| 398 | * @since 3.7.0 |
| 399 | * |
| 400 | * @param string $content |
| 401 | * @return array URLs found in passed string |
| 402 | */ |
| 403 | function wp_extract_urls( $content ) { |
| 404 | preg_match_all( |
| 405 | "#((?:[\w-]+://?|[\w\d]+[.])[^\s()<>]+[.](?:\([\w\d]+\)|(?:[^`!()\[\]{};:'\".,<>?«»“”‘’\s]|(?:[:]\d+)?/?)+))#", |
| 406 | $content, |
| 407 | $post_links |
| 408 | ); |
| 409 | |
| 410 | $post_links = array_unique( array_map( 'html_entity_decode', $post_links[0] ) ); |
| 411 | |
| 412 | return array_values( $post_links ); |
| 413 | } |
| 414 | |
| 415 | /** |
396 | 416 | * Check content for video and audio links to add as enclosures. |
397 | 417 | * |
398 | 418 | * Will not add enclosures that have already been added and will |
… |
… |
function do_enclose( $content, $post_ID ) { |
417 | 437 | |
418 | 438 | $pung = get_enclosed( $post_ID ); |
419 | 439 | |
420 | | $ltrs = '\w'; |
421 | | $gunk = '/#~:.?+=&%@!\-'; |
422 | | $punc = '.:?\-'; |
423 | | $any = $ltrs . $gunk . $punc; |
424 | | |
425 | | preg_match_all( "{\b https? : [$any] +? (?= [$punc] * [^$any] | $)}x", $content, $post_links_temp ); |
| 440 | $post_links_temp = wp_extract_urls( $content ); |
426 | 441 | |
427 | 442 | foreach ( $pung as $link_test ) { |
428 | | if ( !in_array( $link_test, $post_links_temp[0] ) ) { // link no longer in post |
| 443 | if ( ! in_array( $link_test, $post_links_temp ) ) { // link no longer in post |
429 | 444 | $mids = $wpdb->get_col( $wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE (%s)", $post_ID, like_escape( $link_test ) . '%') ); |
430 | 445 | foreach ( $mids as $mid ) |
431 | 446 | delete_metadata_by_mid( 'post', $mid ); |
432 | 447 | } |
433 | 448 | } |
434 | 449 | |
435 | | foreach ( (array) $post_links_temp[0] as $link_test ) { |
| 450 | foreach ( (array) $post_links_temp as $link_test ) { |
436 | 451 | if ( !in_array( $link_test, $pung ) ) { // If we haven't pung it already |
437 | 452 | $test = @parse_url( $link_test ); |
438 | 453 | if ( false === $test ) |