Making WordPress.org

Changeset 1941


Ignore:
Timestamp:
10/06/2015 10:26:09 AM (10 years ago)
Author:
dd32
Message:

Custom Warnings: Don't trigger when // exists within a string but not as a URL, and Array is not a URL..
See https://wordpress.slack.com/archives/polyglots-warnings/p1444078695000028

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/translate.wordpress.org/includes/gp-plugins/wporg-warnings.php

    r1932 r1941  
    1919    function warning_mismatching_urls( $original, $translation ) {
    2020        // Any http/https/schemeless URLs which are not encased in quotation marks nor contain whitespace
    21         $urls_regex = '@(?<![\'"])((https?://|(?<!:)//)[^\s]+)(?![\'"])@';
     21        $urls_regex = '@(?<![\'"])((https?://|(?<![:\w])//)[^\s]+)(?![\'"])@i';
    2222
    23         if ( preg_match_all( $urls_regex, $original, $original_urls ) ) {
    24             $original_urls = array_unique( $original_urls[0] );
    25         }
    26         if ( preg_match_all( $urls_regex, $translation, $translation_urls ) ) {
    27             $translation_urls = array_unique( $translation_urls[0] );
    28         }
     23        preg_match_all( $urls_regex, $original, $original_urls );
     24        $original_urls = array_unique( $original_urls[0] );
     25       
     26        preg_match_all( $urls_regex, $translation, $translation_urls );
     27        $translation_urls = array_unique( $translation_urls[0] );
    2928
    3029        $missing_urls = array_diff( $original_urls, $translation_urls );
Note: See TracChangeset for help on using the changeset viewer.