cvs: pearweb /include pear-format-html.php

From: Date: Sat, 22 Mar 2008 00:43:36 +0000
Subject: cvs: pearweb /include pear-format-html.php
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-core+get-7359@lists.php.net to get a copy of this message
dufuz Sat Mar 22 00:43:36 2008 UTC Modified files: /pearweb/include pear-format-html.php Log: Request #13428 Add title to anchors which link to other internal bugs http://cvs.php.net/viewvc.cgi/pearweb/include/pear-format-html.php?r1=1.263&r2=1.264&diff_format=u Index: pearweb/include/pear-format-html.php diff -u pearweb/include/pear-format-html.php:1.263 pearweb/include/pear-format-html.php:1.264 --- pearweb/include/pear-format-html.php:1.263 Sun Mar 9 19:32:21 2008 +++ pearweb/include/pear-format-html.php Sat Mar 22 00:43:36 2008 @@ -15,7 +15,7 @@ +----------------------------------------------------------------------+ | Authors: | +----------------------------------------------------------------------+ - $Id: pear-format-html.php,v 1.263 2008/03/09 19:32:21 dufuz Exp $ + $Id: pear-format-html.php,v 1.264 2008/03/22 00:43:36 dufuz Exp $ */ PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'error_handler'); @@ -852,11 +852,25 @@ */ function make_ticket_links($text) { + global $dbh; $text = preg_replace('/(?<=php)\s*(bug(?:fix)?|feat(?:ure)?|doc(?:umentation)?|req(?:uest)?)\s+#([0-9]+)/i', ' <a href="http://bugs.php.net/\\2">\\1 \\2</a>', $text); - $text = preg_replace('/(?<![>a-z])(bug(?:fix)?|feat(?:ure)?|doc(?:umentation)?|req(?:uest)?)\s+#([0-9]+)/i', - '<a href="/bugs/\\2">\\0</a>', $text); + $pear_regex = '/(?<![>a-z])(bug(?:fix)?|feat(?:ure)?|doc(?:umentation)?|req(?:uest)?)\s+#([0-9]+)/i'; + //$text = preg_replace($pear_regex, '<a href="/bugs/\\2">\\0</a>', $text); + preg_match_all($pear_regex, $text, $matches); + if (!empty($matches[2])) { + $ids = implode(', ', $matches[2]); + $sql = 'SELECT package_name, sdesc FROM bugdb WHERE id IN(' . $ids . ')'; + $res = $dbh->getAll($sql, DB_FETCHMODE_ASSOC); + foreach ($res as $k => $b) { + $t = $matches[0][$k]; + $title = $b['package_name'] . ': ' . $b['sdesc']; + $link = make_link('/bugs/' . $matches[2][$k], $t, null, null, $title); + $text = str_replace($t, $link, $text); + } + } + return $text; }

« previous php.pear.core (#7359) next »