SourceForge logo
SourceForge logo
Menu

phpwiki-checkins

From: Carsten K. <car...@us...> - 2001年12月02日 07:39:17
Update of /cvsroot/phpwiki/phpwiki/lib
In directory usw-pr-cvs1:/tmp/cvs-serv26587/phpwiki/lib
Modified Files:
 Tag: release-1_2-branch
	stdlib.php 
Log Message:
//define("USE_LINK_ICONS", 1); this turns on url indicator icons, inserted before embedded links to indicate the type of link.
//define("autosplit_wikiwords", 1); option to automatically split WikiWords by inserting spaces for all WikiWords everywhere in a document.
Index: stdlib.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/stdlib.php,v
retrieving revision 1.21.2.6
retrieving revision 1.21.2.7
diff -C2 -r1.21.2.6 -r1.21.2.7
*** stdlib.php	2001年11月08日 22:20:19	1.21.2.6
--- stdlib.php	2001年12月02日 07:39:15	1.21.2.7
***************
*** 4,7 ****
--- 4,9 ----
 Standard functions for Wiki functionality
 ExitWiki($errormsg)
+ pcre_fix_posix_classes($regexp)
+ split_pagename($page)
 LinkExistingWikiWord($wikiword, $linktext) 
 LinkUnknownWikiWord($wikiword, $linktext) 
***************
*** 42,45 ****
--- 44,108 ----
 
 
+ /**
+ * pcre_fix_posix_classes is required to autosplit_wikiwords.
+ * Called by the split_pagename function.
+ */
+ function pcre_fix_posix_classes ($regexp) {
+ // First check to see if our PCRE lib supports POSIX character
+ // classes. If it does, there's nothing to do.
+ if (preg_match('/[[:upper:]]/', 'A'))
+ return $regexp;
+ 
+ static $classes = array(
+ 'alnum' => "0-9A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\xff",
+ 'alpha' => "A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\xff",
+ 'upper' => "A-Z\xc0-\xd6\xd8-\xde",
+ 'lower' => "a-z\xdf-\xf6\xf8-\xff"
+ );
+ 
+ $keys = join('|', array_keys($classes));
+ 
+ return preg_replace("/\[:($keys):]/e", '$classes["1円"]', $regexp);
+ }
+ 
+ 
+ /**
+ * Split WikiWords in page names.
+ *
+ * It has been deemed useful to split WikiWords (into "Wiki Words")
+ * in places like page titles. This is rumored to help search engines
+ * quite a bit.
+ *
+ * @param $page string The page name.
+ *
+ * @return string The split name.
+ */
+ function split_pagename ($page) {
+ 
+ if (preg_match("/\s/", $page))
+ return $page; // Already split --- don't split any more.
+ 
+ // FIXME: this algorithm is Anglo-centric.
+ static $RE;
+ if (!isset($RE)) {
+ // This mess splits between a lower-case letter followed by either an upper-case
+ 	// or a numeral; except that it wont split the prefixes 'Mc', 'De', or 'Di' off
+ // of their tails.
+ 			$RE[] = '/([[:lower:]])((?<!Mc|De|Di)[[:upper:]]|\d)/';
+ // This the single-letter words 'I' and 'A' from any following capitalized words.
+ $RE[] = '/(?: |^)([AI])([[:upper:]])/';
+ 	// Split numerals from following letters.
+ $RE[] = '/(\d)([[:alpha:]])/';
+ 
+ foreach ($RE as $key => $val)
+ $RE[$key] = pcre_fix_posix_classes($val);
+ }
+ 
+ foreach ($RE as $regexp)
+ $page = preg_replace($regexp, '\1円 \2円', $page);
+ return $page;
+ }
+ 
+ 
 function LinkExistingWikiWord($wikiword, $linktext='') {
 global $ScriptUrl;
***************
*** 47,50 ****
--- 110,116 ----
 if(empty($linktext))
 $linktext = htmlspecialchars($wikiword);
+ if (defined("autosplit_wikiwords"))
+ $linktext=split_pagename($linktext);
+ 
 return "<a href=\"$ScriptUrl?$enc_word\">$linktext</a>";
 }
***************
*** 55,58 ****
--- 121,127 ----
 if(empty($linktext))
 $linktext = htmlspecialchars($wikiword);
+ if (defined("autosplit_wikiwords"))
+ $linktext=split_pagename($linktext);
+ 
 return "<u>$linktext</u><a href=\"$ScriptUrl?edit=$enc_word\">?</a>";
 }
***************
*** 320,324 ****
 } else {
 	 $link['type'] = "url-$linktype";
! $link['link'] = LinkURL($URL, $linkname);
 	 }
 } elseif (preg_match("#^phpwiki:(.*)#", $URL, $match)) {
--- 389,411 ----
 } 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)) {
***************
*** 489,493 ****
 
 _dotoken('SCRIPTURL', $ScriptUrl, $page);
! _dotoken('PAGE', htmlspecialchars($name), $page);
 _dotoken('ALLOWEDPROTOCOLS', $AllowedProtocols, $page);
 _dotoken('LOGO', $logo, $page);
--- 576,580 ----
 
 _dotoken('SCRIPTURL', $ScriptUrl, $page);
! _dotoken('PAGE', split_pagename(htmlspecialchars($name)), $page);
 _dotoken('ALLOWEDPROTOCOLS', $AllowedProtocols, $page);
 _dotoken('LOGO', $logo, $page);
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /