Example #1
0
 /**
  * Check for complex potions that include table definitions.
  */
 function verifyPotions()
 {
     require_once WIKI_CLASSES . 'WikiPotion.php';
     // Loop all enabled potions.
     $conf = VoodooIni::load('wiki');
     $tables = array();
     foreach ($conf['potions'] as $p => $enabled) {
         // If the potion is not enabled, we do not care for it.
         if (!$enabled) {
             continue;
         }
         $name = WikiPotionHandler::requirePotion($p);
         if (!$name) {
             continue;
         }
         if (!class_exists($name . 'Setup')) {
             continue;
         }
         $class = $name . 'Setup';
         $s = new $class($this);
         // Merge the output with the already set tables.
         $tables = array_merge($tables, $s->getTables());
     }
     return $tables;
 }
Example #2
0
 /**
  * 
  */
 function __callbackPotion($matches)
 {
     if ($matches[1] == '!') {
         return substr($matches[0], 1);
     }
     $potion = $matches[2];
     $args = isset($matches[3]) ? explode(',', str_replace('(', '', str_replace(')', '', $matches[3]))) : array();
     if (!isset($this->wikipotions[$potion]) || !$this->wikipotions[$potion]) {
         return $this->__disabledPotion($potion);
     }
     require_once WIKI_CLASSES . 'WikiPotion.php';
     $potionObj = WikiPotionHandler::createPotion($this, $potion, $args);
     if (is_numeric($potionObj)) {
         return $this->__notinstalledPotion($potion);
     }
     return $potionObj->display();
 }
Example #3
0
 /**
  * Create a new WikiPotion object by the name supplied
  * 
  * <p>
  * WikiPotion are enabled in the wiki.ini in the WikiController conf directory
  * 
  * WikiPotions are located in the Potions directory. Each other Controller can have their own 
  * Potions directory. This function check by the name of the potion where to look for it.
  * If the potion cant be found, it triggers a VoodooError
  * 
  * [[WikiLogin]] This potion will be found in the WikiController/Potions directory
  * [[Chat_WikiLurkers]] This potion will be found in the ChatController/Potions directory 
  * </p>
  * 
  * @param WikiFormatter &$formatter
  * @param string $potion
  * @param array $args
  * @return WikiPotion
  */
 function createPotion(&$formatter, $potion, $args = array())
 {
     $p = WikiPotionHandler::requirePotion($potion);
     if (!$p) {
         return new WikiPotion($formatter, $args, sprintf('Error, Potion `%s` (%s) could not be included.', $p, $potion . '.php'));
     }
     return new $p($formatter, $args);
 }