Revision [6610]

This is an old revision of FreeLinks made by SteveB on 2005-03-08 17:49:07.

 

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 JavaWomans 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]]

in wikka.php find:
  1. if (preg_match("/^([A-ZÄÖÜ][A-Za-zÄÖÜßäöü]+)[:](\S*)$/", $tag, $matches)) # before the : should be a WikiName; anything after can be (nearly) anything that's allowed in a URL


and replace it with:
  1. if (preg_match("/^([A-ZÄÖÜ][A-Z\ a-zÄÖÜßäöü]+)[:](\S*)$/", $tag, $matches))   # before the : should be a WikiName; anything after can be (nearly) anything that's allowed in a URL


then find:
  1. // is this a full link? ie, does it contain alpha-numeric characters?
  2. elseif (preg_match("/[^[:alnum:],ÄÖÜ,ßäöü]/", $tag))


and replace it with:
  1. // is this a full link? ie, does it contain characters not valid for a wiki page name?
  2. elseif (preg_match("/[^[:alnum:]\ ÄÖÜßäöü]/", $tag))


and last but not least, find:
  1. 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:
  1. return ($linkedPage ? "<a href=\"".$this->Href($method, urlencode($linkedPage['tag']))."\" title=\"$title\">".$text."</a>" : "<a class=\"missingpage\" href=\"".$this->Href("edit", $tag)."\" title=\"Create this page\">".$text."</a>");


then in handlers/page/edit.php find
  1. if (!(preg_match("/^[A-Za-zÄÖÜßäöü]+[A-Za-z0-9ÄÖÜßäöü]*$/s", $this->tag))) {


and replace with:
  1. 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:
  1. else if (preg_match("/^\[\[(\S*)(\s+(.+))?\]\]$/s", $thing, $matches))      # recognize forced links across lines


and replace with:
  1. 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.

Categories: CategoryUserContributions
There are 6 comments on this page. [Show comments]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki