<?php if (!defined('PmWiki')) exit();
/*
    Words that should not be WikiWords, defined by a Wiki page
  COPYRIGHT
    Copyright 2004 by Thomas Pahl, tp > codework.de
  LICENSE
    Same as PmWiki, see www.pmwiki.org
  DESCRIPTION
    This PmWiki plugin enables to maintain a Wiki page that contains
    the words that should not be taken as Wiki words although they look like
    such.
    The file must contain one word per line, no other content. Empty lines
    are allowed and will be ignored.
    Example content of such a page:
      CDs
      DVDs
      OpenOffice

  IMPLEMENTATION
    It simply sets the $WikiWordCount[] array from the words found in the
    Wiki page. See PmWiki.LinkVariables for the function of $WikiWordCount.

  CONFIGURATION
    $NoWikiWordsPagename - full Wiki pagename of the Wiki page containing
      the words. Defaults to 'Main.NoWikiWords' (assuming 'Main' is your 
      default group).
   Note: you may want to restrict edit permission on this page.

  INSTALLATION
    * copy this script into the PmWiki 'local' directory
    * include it from local/config.php
      include_once('local/nowikiwords.php');

  ACKNOWLEDGEMENTS
    The code reading the Wiki page has been copied from some other script,
    I'm sorry I don't remember which one.
*/

SDV($NoWikiWordsPagename, $DefaultGroup.'/NoWikiWords');

function loadNoWikiWords() {
  global $NoWikiWordsPagename;
  global $WikiWordCount;

  $page = ReadPage($NoWikiWordsPagename);
  if (!$page) return;
  $text = $page['text'];

  foreach (explode("\n",$text) as $l) {
    $l = trim($l);
    if ($l) {
	$WikiWordCount[$l] = 0;
    }
  }
}
loadNoWikiWords();

?>