Exemplo n.º 1
0
 protected function renderConstant(Text_Renderer $renderer)
 {
     $constants = Project_Config::get('constants');
     if (array_key_exists($this->name, $constants)) {
         $constant = $constants[$this->name];
     } else {
         throw new Template_Invalid_Argument_Exception('name', $this->name);
     }
     $renderer->renderText($this->raw ? $constant : htmlspecialchars($constant));
 }
 protected static function populateConfig()
 {
     require __DIR__ . '/../config/project_config.inc.php';
     if (!isset($config) || !is_array($config)) {
         throw new Config_Exception('Config file "project_config.inc.php" did not define the "config" array!');
     }
     self::$_config = new Var_Pool();
     foreach ($config as $ckey => $citem) {
         self::$_config->register($ckey, $citem);
     }
     self::$_config->lock();
 }
 protected function getDOFormattedValue($eid, $dop)
 {
     if ($eid === 'cas_registrace') {
         $constants = Project_Config::get('constants');
         // format time of registration
         $ckey = $this->_lang . '_datetime_format';
         $time_format = array_key_exists($ckey, $constants) ? $constants[$ckey] : 'r';
         $cas_registrace = new Date($this->_do->get($dop));
         return $cas_registrace->format($time_format);
     } else {
         return parent::getDOFormattedValue($eid, $dop);
     }
 }
Exemplo n.º 4
0
 protected function resolveHRef()
 {
     if ($this->contact !== null) {
         $contacts = Project_Config::get('contacts');
         if (array_key_exists($this->contact, $contacts)) {
             $contact = $contacts[$this->contact];
         } else {
             throw new Template_Invalid_Argument_Exception('contact', $this->contact);
         }
         if (!array_key_exists('email', $contact)) {
             throw new Config_Exception('contact has no email address defined: ' . $this->contact);
         }
         $email = $contact['email'];
         $name = array_key_exists('name', $contact) ? $contact['name'] : '';
         if (is_array($email)) {
             // if contact has multiple email addresses assigned, use the first one
             $email = $email[0];
         }
         $qs = $this->qs === null ? '' : "?{$this->qs}";
         switch ($this->method) {
             case 'js':
                 $mailto_str = $this->formatMailtoJS($email, $name, $qs);
                 break;
             default:
                 $mailto_str = $this->formatMailto($email, $name, $qs);
                 break;
         }
         $this->_a->href = $mailto_str;
         if ($this->content !== null) {
             $this->_a->clear();
             $this->_a->add($this->content, false);
         } else {
             $this->_a->clear();
             $content = $this->at === null ? $contact['name'] : str_replace('@', $this->at, $contact['email']);
             $this->_a->add(new HTML_Text($content));
         }
     } else {
         throw new Data_Insufficient_Exception('contact');
     }
 }
Exemplo n.º 5
0
<?php

require_once 'mod_debug_handlers.inc.php';
require_once 'utils.inc.php';
require_once 'autoload.inc.php';
if (!extension_loaded('pdo')) {
    throw new Feature_Not_Available_Exception('PDO module not installed');
}
try {
    date_default_timezone_set(Project_Config::get('timezone'));
} catch (No_Such_Variable_Exception $e) {
}
try {
    setlocale(LC_ALL, Project_Config::get('locale'));
} catch (No_Such_Variable_Exception $e) {
}
try {
    setlocale(LC_NUMERIC, Project_Config::get('locale_numeric'));
} catch (No_Such_Variable_Exception $e) {
}
 public function initialize()
 {
     $this->_data = new Session_Var_Pool(Project_Config::get('project') . '_client');
 }
 public function getMailBodySimpleTable()
 {
     $table = array();
     $do_fields = $this->_do->getFields();
     $constants = Project_Config::get('constants');
     foreach ($do_fields as $key => $value) {
         $ckey = $this->_lang . '_' . $key;
         $text = array_key_exists($ckey, $constants) ? $constants[$ckey] : mb_str_replace('_', ' ', $key, 'UTF-8');
         $table[$key] = mb_ucfirst($text, 'UTF-8') . ": %s\n";
     }
     return $table;
 }
 protected function createMailBodySimple()
 {
     $constants = Project_Config::get('constants');
     $key = 'nevyplneno';
     try {
         $lang = $this->_mvo->lang;
     } catch (Exception $e) {
         $lang = Project_Config::get('default_language');
     }
     $ckey = $lang . '_' . $key;
     $nevyplneno_str = array_key_exists($ckey, $constants) ? $constants[$ckey] : mb_str_replace('_', ' ', $key, 'UTF-8');
     $body = '';
     $table = $this->_mvo->getMailBodySimpleTable();
     foreach ($table as $key => $text) {
         if (isset($this->_fields[$key])) {
             $body .= sprintf($text, $this->_fields[$key] !== '' ? $this->_fields[$key] : $nevyplneno_str);
         } else {
             $body .= $text;
         }
     }
     return $body;
 }
Exemplo n.º 9
0
 protected function getFieldsFromLanguageConstants($keys)
 {
     $table = array();
     $constants = Project_Config::get('constants');
     foreach ($keys as $key) {
         $ckey = $this->lang . '_' . $key;
         $text = array_key_exists($ckey, $constants) ? $constants[$ckey] : mb_str_replace('_', ' ', $key, 'UTF-8');
         $table[$key] = mb_ucfirst($text, 'UTF-8') . ": %s\n";
     }
     return $table;
 }