[pmwiki-users] Moving a pmwiki installation to a new host

Petko Yotov 5ko at 5ko.fr
Mon Sep 30 16:29:28 CDT 2013


Leandro Fanzone writes:
> $NamePattern = '[[:upper:]\\d][\\w]*(?:-\\w+)*';
>
> And I changed it to:
>
> $NamePattern = '[\\w\\x80-\\xfe]+(?:-[[\\w\\x80-\\xfe]+)*';

I suggest you to NOT modify pmwiki.php and other core files, any such  
variable can be simply defined in config.php, so just write that line on  
config.php.

This will make future upgrades much easier - you will not have to re-edit  
pmwiki.php.

> So the Latin1 characters could be included. Likewise, in MakePageName(), I  
> changed
>
> SDV($PageNameChars,'-[:alnum:]');
> SDV($MakePageNamePatterns, array(
>     "/'/" => '',               # strip single-quotes
>     "/[^$PageNameChars]+/" => ' ',         # convert everything else to space
>     '/((^|[^-\\w])\\w)/e' => "strtoupper('$1')",
>     '/ /' => ''));
>
> to:
>
> SDV($PageNameChars,'-[:alnum:]\\x80-\\xfe');
> SDV($MakePageNamePatterns, array(
>     "/'/" => '',                           # strip single-quotes
>     "/[^$PageNameChars]+/" => ' ',         # convert everything else to space
>     "/(?<=^| )([a-z])/e" => "strtoupper('$1')",
>     "/ /" => ''));

Again, just define these variables in config.php instead of modifying  
pmwiki.php:

  $PageNameChars = '-[:alnum:]\\x80-\\xfe';
  $MakePageNamePatterns = array(
    "/'/" => '',                           # strip single-quotes
    "/[^$PageNameChars]+/" => ' ',         # convert everything else to space
    "/(?<=^| )([a-z])/e" => "strtoupper('$1')",
    "/ /" => '');

The SDV() and SDVA() functions only set values of the variables or arrays if  
the variables are not defined, for example in config.php.

Petko




More information about the pmwiki-users mailing list