Update of /cvsroot/phpwiki/phpwiki/lib
In directory usw-pr-cvs1:/tmp/cvs-serv27333/phpwiki/lib
Modified Files:
Tag: release-1_2-branch
stdlib.php
Log Message:
Linkicons now work for unbracketed links. Optimized Linkicon code.
Index: stdlib.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/stdlib.php,v
retrieving revision 1.21.2.8
retrieving revision 1.21.2.9
diff -C2 -r1.21.2.8 -r1.21.2.9
*** stdlib.php 2001/12/02 21:30:36 1.21.2.8
--- stdlib.php 2001/12/03 23:33:21 1.21.2.9
***************
*** 134,138 ****
if(empty($linktext))
$linktext = htmlspecialchars($url);
! return "<a href=\"$url\">$linktext</a>";
}
--- 134,156 ----
if(empty($linktext))
$linktext = htmlspecialchars($url);
! if (!defined('USE_LINK_ICONS')) {
! return "<a href=\"$url\">$linktext</a>";
! } else {
! //ideally the link image would be specified by a map file
! //similar to the interwiki.map
! $linkproto = substr($url, 0, strrpos($url, ":"));
! if ($linkproto == "mailto") {
! $linkimg = "/images/mailto.png";
! } elseif ($linkproto == "http") {
! $linkimg = "/images/http.png";
! } elseif ($linkproto == "https") {
! $linkimg = "/images/https.png";
! } elseif ($linkproto == "ftp") {
! $linkimg = "/images/ftp.png";
! } else {
! $linkimg = "/images/http.png";
! }
! return "<a href=\"$url\"><img src=\"" . DATA_PATH . $linkimg . "\" alt=\"" . $linkproto . "\">$linktext</a>";
! }
}
***************
*** 389,412 ****
} else {
$link['type'] = "url-$linktype";
!
! if (!defined("USE_LINK_ICONS")) {
! $link['link'] = LinkURL($URL, $linkname);
! } else {
! //preg_split((.*?):(.*)$, $URL, $matches);
! //preg_split("[:]", $URL, $matches);
! //$protoc = $matches[1]
! $protoc = substr($URL, 0, strrpos($URL, ":"));
! if ($protoc == "mailto") {
! $link['link'] = "<img src=\"" . DATA_PATH . "/images/mailto.png\"> " . LinkURL($URL, $linkname);
! } elseif ($protoc == "http") {
! $link['link'] = "<img src=\"" . DATA_PATH . "/images/http.png\"> " . LinkURL($URL, $linkname);
! } elseif ($protoc == "https") {
! $link['link'] = "<img src=\"" . DATA_PATH . "/images/https.png\"> " . LinkURL($URL, $linkname);
! } elseif ($protoc == "ftp") {
! $link['link'] = "<img src=\"" . DATA_PATH . "/images/ftp.png\"> " . LinkURL($URL, $linkname);
! } else {
! $link['link'] = LinkURL($URL, $linkname);
! }
! }}
} elseif (preg_match("#^phpwiki:(.*)#", $URL, $match)) {
$link['type'] = "url-wiki-$linktype";
--- 407,412 ----
} else {
$link['type'] = "url-$linktype";
! $link['link'] = LinkURL($URL, $linkname);
! }
} elseif (preg_match("#^phpwiki:(.*)#", $URL, $match)) {
$link['type'] = "url-wiki-$linktype";
|