Exemplo n.º 1
0
 /**
  * Apply given replacement patterns and values
  *
  * @param string $patterns The patterns to replace
  * @param string $values   The values to use as replacement
  * @param string $input    The text to work on
  * @param bool   $strftime Apply strftime() replacements
  * @return string processed text
  */
 function replace($patterns, $values, $input, $strftime = true)
 {
     $input = preg_replace($patterns, $values, $input);
     $input = parent::replaceNSTemplatePlaceholders($input);
     if ($strftime) {
         $input = preg_replace_callback('/%./', create_function('$m', 'return strftime($m[0]);'), $input);
     }
     return $input;
 }
function syntax_plugin_bureaucracy_autoload($name)
{
    if (!preg_match('/^syntax_plugin_bureaucracy_(field|action)(?:_(.*))?$/', $name, $matches)) {
        return false;
    }
    require_once DOKU_PLUGIN . "bureaucracy/syntax.php";
    if (!isset($matches[2])) {
        // Autoloading the field / action base class
        $matches[2] = $matches[1];
    }
    $filename = DOKU_PLUGIN . "bureaucracy/{$matches[1]}s/{$matches[2]}.php";
    if (!@file_exists($filename)) {
        $plg = new syntax_plugin_bureaucracy();
        msg(sprintf($plg->getLang($matches[1] === 'field' ? 'e_unknowntype' : 'e_noaction'), hsc($matches[2])), -1);
        eval("class {$name} extends syntax_plugin_bureaucracy_{$matches[1]} { };");
        return true;
    }
    require_once $filename;
    return true;
}