Пример #1
0
 function IfEqScope(&$lexer, &$container)
 {
     $this->_END_TAG = 'end-if-eq';
     $this->condition_var = $lexer->current_tagparams[0];
     $this->raw = $lexer->current_tagparams[1];
     if ($this->raw[0] == '"') {
         if ($this->raw[strlen($this->raw) - 1] != '"') {
             fatal("Improperly formatted string in " . $lexer->tagtext);
         }
         $this->_value = str_replace(array('\\"', '\\\\'), array('"', '\\'), substr($this->raw, 1, strlen($this->raw) - 2));
         $this->rtype = 'literal';
     } else {
         switch ($this->raw) {
             case 'LOGGED_IN_USR_ID':
                 $this->_value = get_user_id();
                 $this->rtype = 'literal';
                 break;
             case 'LOGGED_IN_USR_NAME':
                 $this->_value = get_user_name();
                 $this->rtype = 'literal';
                 break;
             case 'LOGGED_IN_USR_USERNAME':
                 $this->_value = get_user_username();
                 $this->rtype = 'literal';
                 break;
             case 'CURRENT_TIME':
                 $this->_value = date('Y-m-d H:i:s');
                 $this->rtype = 'literal';
                 break;
             default:
                 $this->rtype = 'field';
         }
     }
     parent::Scope($lexer, $container);
 }