Example #1
0
function confExtractArray($php, $varname)
{
    try {
        $ce = new ConfEditor("<?php {$php}");
        $vars = $ce->getVars();
        $retval = @$vars[$varname];
    } catch (Exception $e) {
        print $e . "\n";
        $retval = null;
    }
    return $retval;
}
Example #2
0
 public function getTags($type = null)
 {
     $path = $this->getFromConf('BASIC', 'metadataPath');
     if ($path === null) {
         throw new MWException("metadataPath is not configured.");
     }
     $filename = "{$path}/messageTypes.inc";
     if (!is_readable($filename)) {
         throw new MWException("{$filename} is not readable.");
     }
     $data = file_get_contents($filename);
     if ($data === false) {
         throw new MWException("Failed to read {$filename}.");
     }
     $reader = new ConfEditor($data);
     $vars = $reader->getVars();
     $tags = array();
     $tags['optional'] = $vars['wgOptionalMessages'];
     $tags['ignored'] = $vars['wgIgnoredMessages'];
     if (!$type) {
         return $tags;
     }
     if (isset($tags[$type])) {
         return $tags[$type];
     }
     return array();
 }