Changeset 1788

Show
Ignore:
Timestamp:
04/30/2011 03:24:46 PM (2 years ago)
Author:
BrianKoontz
Message:

Fixes broken interwiki links embedded as forced links. Refs #1053

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/formatters/wakka.php

    r1784 r1788  
    758758                                $output .= $wakka->FormOpen("grabcode"); 
    759759                                // build form 
    760                                 $output .= '<input type="submit" class="grabcode" name="save" value="'.T_("Grab").'" title="'.rtrim(sprintf(T_("Download %s"), $valid_filename)).'" />'; 
     760                                $output .= '<input type="submit" class="grabcode" name="save" value="'.GRABCODE_BUTTON.'" title="'.rtrim(sprintf(GRABCODE_BUTTON_TITLE, $valid_filename)).'" />'; 
    761761                                $output .= '<input type="hidden" name="filename" value="'.urlencode($valid_filename).'" />'; 
    762762                                $output .= '<input type="hidden" name="code" value="'.urlencode($code).'" />'; 
     
    776776                                return ""; 
    777777 
    778                         // Case 1: Deprecated...(first part is a URL followed by 
     778                        // Case 1: Interwiki link followed by | separator 
     779                        if(preg_match("/^([A-ZÄÖÜ][A-Za-zÄÖÜßäöü]+[:].*?)\s*\|\s*(.*?)$/s", $contents, $matches)) 
     780                        { 
     781                                $url = $matches[1]; 
     782                                $text = $matches[2]; 
     783                        } 
     784 
     785                        // Case 2: Deprecated...(interwiki link followed by 
     786                        // whitespace separator) 
     787                        else if(preg_match("/^([A-ZÄÖÜ][A-Za-zÄÖÜßäöü]+[:]\S*)\s+(.*)$/s", $contents, $matches)) 
     788                        { 
     789                                $url = $matches[1]; 
     790                                $text = $matches[2]; 
     791                        } 
     792 
     793                        // Case 3: Deprecated...(first part is a URL followed by 
    779794                        // one or more whitespaces) 
    780                         if (preg_match("/^((http|https|ftp|news|irc|gopher):\/\/([^\|\\s\"<>]+))\s+([^\|]+)$/s", $contents, $matches))          # recognize forced links across lines 
     795                        else if (preg_match("/^((http|https|ftp|news|irc|gopher):\/\/([^\|\\s\"<>]+))\s+([^\|]+)$/s", $contents, $matches))             # recognize forced links across lines 
    781796                        { 
    782797                                if (!isset($matches[1])) $matches[1] = ''; #38 
     
    786801                        } 
    787802 
    788                         // Case 2: Deprecated...(first part is a string 
     803                        // Case 4: Deprecated...(first part is a string 
    789804                        // followed by one or more whitespaces) 
    790805                        else if(preg_match("/^(.*?)\s+([^|]+)$/s", $contents, $matches) &&  
     
    795810                        } 
    796811 
    797                         // Case 3: If no "|" exists in $contents, assume the match 
     812                        // Case 5: If no "|" exists in $contents, assume the match 
    798813                        // refers to an internal page 
    799814                        else if(preg_match("/^([^\|]+)$/s", $contents, $matches)) 
     
    803818                        } 
    804819 
    805                         // Case 4: If a "|" symbol exists, assume two parts, a URL and 
     820                        // Case 6: If a "|" symbol exists, assume two parts, a URL and 
    806821                        // text 
    807822                        else if(preg_match("/^(.*?)\s*\|\s*(.*?)$/s", $contents, $matches)) 
     
    9851000                } 
    9861001                // interwiki links! 
     1002                // Deprecated; use forced links with | separator instead 
    9871003                elseif (preg_match("/^[A-ZÄÖÜ][A-Za-zÄÖÜßäöü]+[:]\S*$/s", $thing)) 
    9881004                { 
     
    11011117        # action 
    11021118        "\{\{.*?\}\}|". 
    1103         # InterWiki link 
     1119        # InterWiki link (deprecated, as pagenames may now contain spaces) 
     1120        # Use forced links with a | separator instead 
    11041121        "\b[A-ZÄÖÜ][A-Za-zÄÖÜßäöü]+[:](?![=_])\S*\b|". 
    11051122        # CamelWords