From: Arno H. <aho...@us...> - 2000-10-25 14:48:32
|
Update of /cvsroot/phpwiki/phpwiki/lib In directory slayer.i.sourceforge.net:/tmp/cvs-serv15307 Modified Files: stdlib.php Log Message: adapted to changes in transform.php Inline images now have an ALT tag Also, [name|http:image] uses name as ALT tag now RenderQuickSearch() and RenderFullSearch() create a submit button Index: stdlib.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/stdlib.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** stdlib.php 2000/10/20 11:42:52 1.4 --- stdlib.php 2000/10/25 14:48:29 1.5 *************** *** 171,193 **** ! function LinkImage($url) { global $ScriptUrl; if(ereg("[<>\"]", $url)) { return "<b><u>BAD URL -- remove all of <, >, "</u></b>"; } ! return "<img src=\"$url\">"; } ! function RenderQuickSearch() { ! global $value, $ScriptUrl; ! $formtext = "<form action='$ScriptUrl'>\n<input type='text' size='40' name='search' value='$value'>\n</form>\n"; ! return $formtext; } ! function RenderFullSearch() { ! global $value, $ScriptUrl; ! $formtext = "<form action='$ScriptUrl'>\n<input type='text' size='40' name='full' value='$value'>\n</form>\n"; ! return $formtext; } --- 171,197 ---- ! function LinkImage($url, $alt="[External Image]") { global $ScriptUrl; if(ereg("[<>\"]", $url)) { return "<b><u>BAD URL -- remove all of <, >, "</u></b>"; } ! return "<img src=\"$url\" ALT=\"$alt\">"; } ! function RenderQuickSearch($value = "") { ! global $ScriptUrl; ! return "<form action=\"$ScriptUrl\">\n" . ! "<input type=text size=30 name=search value=\"$value\">\n" . ! "<input type=submit value=\"". gettext("Search") . ! "\"></form>\n"; } ! function RenderFullSearch($value = "") { ! global $ScriptUrl; ! return "<form action=\"$ScriptUrl\">\n" . ! "<input type=text size=30 name=full value=\"$value\">\n" . ! "<input type=submit value=\"". gettext("Search") . ! "\"></form>\n"; } *************** *** 385,392 **** } if($isnewpage) { ! $newpage[$k++] = "\t* [$pagename] (new) ..... $remoteuser\r"; } else { $diffurl = "$ScriptUrl?diff=" . rawurlencode($pagename); ! $newpage[$k++] = "\t* [$pagename] ([diff|$diffurl]) ..... $remoteuser\r"; } --- 389,396 ---- } if($isnewpage) { ! $newpage[$k++] = "* [$pagename] (new) ..... $remoteuser\r"; } else { $diffurl = "$ScriptUrl?diff=" . rawurlencode($pagename); ! $newpage[$k++] = "* [$pagename] ([diff|$diffurl]) ..... $remoteuser\r"; } *************** *** 410,414 **** function ParseAndLink($bracketlink) { ! global $dbi, $AllowedProtocols; // $bracketlink will start and end with brackets; in between --- 414,418 ---- function ParseAndLink($bracketlink) { ! global $dbi, $AllowedProtocols, $InlineImages; // $bracketlink will start and end with brackets; in between *************** *** 417,438 **** // strip brackets and leading space preg_match("/(\[\s*)(.+?)(\s*\])/", $bracketlink, $match); - $linkdata = $match[2]; - - // send back links that are only numbers (they are references) - if (preg_match("/^\d+$/", $linkdata)) { - $link['type'] = 'ref'; - $link['link'] = $bracketlink; - return $link; - } - - // send back escaped ([[) bracket sets - if (preg_match("/^\[/", $linkdata)) { - $link['type'] = 'none'; - $link['link'] = htmlspecialchars(substr($bracketlink, 1)); - return $link; - } - // match the contents ! preg_match("/([^|]+)(\|)?([^|]+)?/", $linkdata, $matches); --- 421,426 ---- // strip brackets and leading space preg_match("/(\[\s*)(.+?)(\s*\])/", $bracketlink, $match); // match the contents ! preg_match("/([^|]+)(\|)?([^|]+)?/", $match[2], $matches); *************** *** 445,450 **** // assert proper URL's if (preg_match("#^($AllowedProtocols):#", $URL)) { ! $link['type'] = 'url-named'; ! $link['link'] = "<a href=\"$URL\">$linkname</a>"; } else { $link['type'] = 'url-bad'; --- 433,443 ---- // assert proper URL's if (preg_match("#^($AllowedProtocols):#", $URL)) { ! if (preg_match("/($InlineImages)$/i", $URL)) { ! $link['type'] = 'image-named'; ! $link['link'] = LinkImage($URL, $linkname); ! } else { ! $link['type'] = 'url-named'; ! $link['link'] = "<a href=\"$URL\">$linkname</a>"; ! } } else { $link['type'] = 'url-bad'; *************** *** 466,471 **** } elseif (preg_match("#^($AllowedProtocols):#", $linkname)) { // if it's an image, embed it; otherwise, it's a regular link ! if (preg_match("/jpg$|png$|gif$/i", $linkname)) { ! $link['type'] = 'url-image'; $link['link'] = LinkImage($linkname); } else { --- 459,464 ---- } elseif (preg_match("#^($AllowedProtocols):#", $linkname)) { // if it's an image, embed it; otherwise, it's a regular link ! if (preg_match("/($InlineImages)$/i", $linkname)) { ! $link['type'] = 'image-simple'; $link['link'] = LinkImage($linkname); } else { *************** *** 506,512 **** } ! if (preg_match_all("#!?\b(([A-Z][a-z]+){2,})\b#", $line, $link)) { for ($i = 0; $link[0][$i]; $i++) { ! if(!strstr($link[0][$i], '!')) $wikilinks[$link[0][$i]]++; } --- 499,505 ---- } ! if (preg_match_all("/!?$WikiNameRegexp/", $line, $link)) { for ($i = 0; $link[0][$i]; $i++) { ! if($link[0][$i][0] <> '!') $wikilinks[$link[0][$i]]++; } |