/**
  * Get a settings value
  * @param string $path dotted string
  * @return string
  */
 public function get($path, $default = NULL)
 {
     // get the setting
     $setting = $this->_reader->get($path, $default);
     // replace substitutes
     if (is_string($setting)) {
         $setting = strtr($setting, array(':module' => $this->_module));
     }
     return $setting;
 }
 /**
  * Get a text value
  * @param string $path dotted string
  * @param array $substitutes
  * @param bool $ucFirst
  * @return string
  */
 public function get($path, $substitutes = array(), $ucFirst = true)
 {
     // get the string
     $string = $this->_reader->get($path, '');
     // replace substitutes
     if (is_string($string)) {
         if (is_string($substitutes)) {
             // a subs string was given. Use an alternative set of subs from the loaded text
             $substitutes = $this->_substitutes($substitutes);
         } else {
             // use default subs as substitues, merge with given
             $substitutes = array_merge($this->_substitutes, $substitutes);
         }
         // replace substitues
         $string = strtr($string, $substitutes);
     }
     // Capitalize first
     if ($ucFirst && is_string($string)) {
         $string = ucfirst($string);
     }
     return $string;
 }
Exemplo n.º 3
0
#!/usr/bin/php -q
<?php 
require_once 'common.php';
require_once 'debug.php';
require_once 'reader.php';
require_once 'cleaner.php';
require_once 'lexer.php';
require_once 'interpreter.php';
try {
    //$filename = 'example.bsc';
    $filename = !empty($argv[1]) ? $argv[1] : "";
    $reader = new Reader($filename);
    $cleaner = new Cleaner($reader->get());
    $lexer = new Lexer($cleaner->get());
    throw new Debug(999, "Lexer output", $lexer->get());
    //$parser = new Parser($lexer->get());
} catch (Debug $d) {
    die($d->getDebug());
} catch (Exception $e) {
    if (VERBOSE) {
        $msg = var_dump(array('file' => $e->getFile(), 'line' => $e->getLine(), 'message' => $e->getMessage(), 'trace' => $e->getTraceAsString()));
    } else {
        $msg = $e->getMessage();
    }
    die($msg . "\n");
}