Free links
This code change allows page names to have spaces in. URL's are then in this format when you have mod_rewrite ( i havnt tested it without mod_rewrite - i suspect it would fall over so any solution to this would be good)
http://www.domain.com/Page+Name+here∞. That would go to a page called 'Page Name here'.
This also changes the format for forced links. Because pages can now have spaces obviouly the old method of the seperator being a space wont work any more. So on
JavaWoman's suggestion i changed it to a | (pipe). the new format after these changes for a forced link is [[name here|link text here]] or [[name here]]
edit:
THIS CODE IS NOT QUITE READY
just realised it breaks the category system a bit. and probly the backlink action
- A quick fix for the category problem: in wikka.php, replace :
-
function FullCategoryTextSearch($phrase) { return $this->LoadAll("select * from ".$this->config["table_prefix"]."pages where latest = 'Y' and match(body) against('".mysql_real_escape_string($phrase)."' IN BOOLEAN MODE)"); }
- by :
-
function FullCategoryTextSearch($phrase) { return $this->LoadAll("select * from ".$this->config["table_prefix"]."pages where latest = 'Y' and match(body) against('\"".mysql_real_escape_string($phrase)."\"' IN BOOLEAN MODE)"); }
- For the backlink action, I did not see a problem but I may miss something?
- -- HackArt
in wikka.php find:
// is this a full link? ie, does it contain alpha-numeric characters?
elseif (preg_match("/[^[:alnum:],ÄÖÜ,ßäöü]/",
$tag))
and replace it with:
// is this a full link? ie, does it contain characters not valid for a wiki page name?
// changed so that a space is a valid character for a wikiname
elseif (preg_match("/[^[:alnum:] ÄÖÜßäöü]/",
$tag))
- I suggest to replace the last line by this one:
-
- This enable more generic support for language specific characters (like in French).
- In a similar way, you also need to replace the line 3. in handler/page/edit.php by
-
if (!(preg_match("/^[\w ]+$/s", $this->tag))) {
- Please note that for preg_match to work properly with \w style character classes, the correct LOCALE should be configured on your host. If not, you dynamically configure it:
-
- add this line somewhere in the wikka config array of wikka.config.php (adjust to your custom LOCALE of course):
-
- and add this somewhere at the end of the wakka constructor in wikka.php
-
// set locale according to wikka config
if ($this->
config["LOCALE"])
setlocale(LC_ALL,
$this->
config["LOCALE"]);
- -- HackArt
and last but not least, find:
return ($linkedPage ? "<a href=\"".$this->Href($method, $linkedPage['tag'])."\" title=\"$title\">".$text."</a>" : "<a class=\"missingpage\" href=\"".$this->Href("edit", $tag)."\" title=\"Create this page\">".$text."</a>");
and replace with:
// changed so that the tag name is urlencoded. this converts the spaces to +'s to make the URL valid
return ($linkedPage ?
"<a href=\"".
$this->
Href($method,
urlencode($linkedPage['tag'])).
"\" title=\"$title\">".
$text.
"</a>" :
"<a class=\"missingpage\" href=\"".
$this->
Href("edit",
urlencode($tag)).
"\" title=\"Create this page\">".
$text.
"</a>");
then in handlers/page/edit.php find
if (!
(preg_match("/^[A-Za-zÄÖÜßäöü]+[A-Za-z0-9ÄÖÜßäöü]*$/s",
$this->
tag))) {
and replace with:
// changed so the edit handler allows pages with spaces in the names to be created/edited
if (!
(preg_match("/^[A-Za-zÄÖÜßäöü]+[A-Za-z 0-9+ÄÖÜßäöü]*$/s",
$this->
tag))) {
and the last file to change is formatters/wakka.php.
find:
else if (preg_match("/^\[\[(\S*)(\s+(.+))?\]\]$/s",
$thing,
$matches)) # recognize forced links across lines
and replace with:
// changed so that the seperator for forced links is a | (pipe) and not the first space.
else if (preg_match("/^\[\[(.+?)(\|(.+))?\]\]$/s",
$thing,
$matches)) # recognize forced links across lines
i THINK thats all of the changes. let me know what you think, if anything needs to be changed or whatever.
Need Help
So so.. i can't use
FreeLinks at
WikiName with Korean or Japanese.
If fill in
WikiName with Japanese, ???????? is output and can't create mySQL db field.
If fill in WikiName with Korean, i have to see just blank page.
Somebody any idea?
Categories: CategoryUserContributions