diff options
| author | fisharebest <fisharebest@gmail.com> | 2013-10-22 13:19:01 +0100 |
|---|---|---|
| committer | fisharebest <fisharebest@gmail.com> | 2013-10-22 13:19:31 +0100 |
| commit | f0a555c029d14a0cecf97dde5d1ee92afd32bdbb (patch) | |
| tree | 7a16ddec95acf928b0bcd70047a950cd518a52ed /includes | |
| parent | 4c3550ab962551ce850a75e43eb8b96d2e8f9438 (diff) | |
| download | webtrees-f0a555c029d14a0cecf97dde5d1ee92afd32bdbb.tar.gz webtrees-f0a555c029d14a0cecf97dde5d1ee92afd32bdbb.tar.bz2 webtrees-f0a555c029d14a0cecf97dde5d1ee92afd32bdbb.zip | |
Two busg: #1237452 - New user/New registration mails - Family Tree Title with ' - dev; #1237458 - Webtrees messages with odd texts - dev
Diffstat (limited to 'includes')
| -rw-r--r-- | includes/functions/functions.php | 19 | ||||
| -rw-r--r-- | includes/functions/functions_print.php | 4 | ||||
| -rw-r--r-- | includes/functions/functions_print_facts.php | 12 |
3 files changed, 8 insertions, 27 deletions
diff --git a/includes/functions/functions.php b/includes/functions/functions.php index dfb394ccdf..36017aa0db 100644 --- a/includes/functions/functions.php +++ b/includes/functions/functions.php @@ -1919,25 +1919,6 @@ function isFileExternal($file) { return strpos($file, '://') !== false; } -// Turn URLs in text into HTML links. Insert breaks into long URLs -// so that the browser can word-wrap. -function expand_urls($text) { - // Some versions of RFC3987 have an appendix B which gives the following regex - // (([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))? - // This matches far too much while a “precise” regex is several pages long. - // This is a compromise. - $URL_REGEX='((https?|ftp]):)(//([^\s/?#<>]*))?([^\s?#<>]*)(\?([^\s#<>]*))?(#[^\s?#<>]+)?'; - - return preg_replace_callback( - '/'.addcslashes("(?!>)$URL_REGEX(?!</a>)", '/').'/i', - create_function( // Insert soft hyphens into the replaced string - '$m', - 'return "<a href=\"".$m[0]."\" target=\"blank\">".preg_replace("/\b/", "­", $m[0])."</a>";' - ), - nl2br(WT_Filter::escapeHtml($text), false) - ); -} - // Returns the part of the haystack before the first occurrence of the needle. // Use it to emulate the before_needle php 5.3.0 strstr function function strstrb($haystack, $needle){ diff --git a/includes/functions/functions_print.php b/includes/functions/functions_print.php index 70ae1e5211..6d36d61274 100644 --- a/includes/functions/functions_print.php +++ b/includes/functions/functions_print.php @@ -404,11 +404,11 @@ function print_note_record($text, $nlevel, $nrec, $textOnly=false) { $text = GEDFact_assistant_WT_Module::formatCensusNote($note); } else { $text = $note->getNote(); - $text = expand_urls($text); + $text = WT_Filter::expandUrls($text); } } else { $note = null; - $text = expand_urls($text); + $text = WT_Filter::expandUrls($text); } if ($textOnly) { diff --git a/includes/functions/functions_print_facts.php b/includes/functions/functions_print_facts.php index 7ad22bdad8..88a69d355b 100644 --- a/includes/functions/functions_print_facts.php +++ b/includes/functions/functions_print_facts.php @@ -259,7 +259,7 @@ function print_fact(WT_Fact $fact, WT_GedcomRecord $record) { echo '</div>'; break; case 'PUBL': // Publication details might contain URLs. - echo '<div class="field">', expand_urls(WT_Filter::escapeHtml($fact->getValue())), '</div>'; + echo '<div class="field">', WT_Filter::expandUrls($fact->getValue()), '</div>'; break; case 'REPO': if (preg_match('/^@('.WT_REGEX_XREF.')@$/', $fact->getValue(), $match)) { @@ -408,7 +408,7 @@ function print_fact(WT_Fact $fact, WT_GedcomRecord $record) { } break; case 'CALN': - echo WT_Gedcom_Tag::getLabelValue('CALN', expand_urls($match[2])); + echo WT_Gedcom_Tag::getLabelValue('CALN', WT_Filter::expandUrls($match[2])); break; case 'FORM': // 0 OBJE / 1 FILE / 2 FORM / 3 TYPE echo WT_Gedcom_Tag::getLabelValue('FORM', $match[2]); @@ -746,7 +746,7 @@ function printSourceStructure($textSOUR) { $html=''; if ($textSOUR['PAGE']) { - $html.='<div class="indent"><span class="label">'.WT_Gedcom_Tag::getLabel('PAGE').':</span> <span class="field" dir="auto">'.expand_urls($textSOUR['PAGE']).'</span></div>'; + $html.='<div class="indent"><span class="label">'.WT_Gedcom_Tag::getLabel('PAGE').':</span> <span class="field" dir="auto">'.WT_Filter::expandUrls($textSOUR['PAGE']).'</span></div>'; } if ($textSOUR['EVEN']) { @@ -762,7 +762,7 @@ function printSourceStructure($textSOUR) { $html.='<div class="indent"><span class="label">'.WT_Gedcom_Tag::getLabel('DATA:DATE').':</span> <span class="field">'.$date->Display(false).'</span></div>'; } foreach ($textSOUR['TEXT'] as $text) { - $html.='<div class="indent"><span class="label">'.WT_Gedcom_Tag::getLabel('TEXT').':</span> <span class="field" dir="auto">'.expand_urls($text).'</span></div>'; + $html.='<div class="indent"><span class="label">'.WT_Gedcom_Tag::getLabel('TEXT').':</span> <span class="field" dir="auto">'.WT_Filter::expandUrls($text).'</span></div>'; } } @@ -909,7 +909,7 @@ function print_main_notes(WT_Fact $fact, $level) { if ($fact->getTag()=='CENS' && array_key_exists('GEDFact_assistant', WT_Module::getActiveModules())) { $text = GEDFact_assistant_WT_Module::formatCensusNote($note); } else { - $text = expand_urls($text); + $text = WT_Filter::expandUrls($text); } } else { $text = '<span class="error">' . WT_Filter::escapeHtml($nid) . '</span>'; @@ -918,7 +918,7 @@ function print_main_notes(WT_Fact $fact, $level) { // Inline notes $nrec = get_sub_record($level, "$level NOTE", $factrec, $j+1); $text = $match[$j][1] . get_cont($level+1, $nrec); - $text = expand_urls($text); + $text = WT_Filter::expandUrls($text); } echo '<td class="optionbox', $styleadd, ' wrap">'; |
