Пример #1
0
 /**
  * returns value to display in HTML
  */
 public function html($key, $default = '')
 {
     $value = $this->get($key, $default);
     $type = substr($this->properties[$key], 0, 3);
     switch ($type) {
         case 'DTE':
             return tzn_tools::format_date($value);
         case 'DTM':
             return tzn_tools::format_datetime($value);
             break;
         case 'DUR':
             return tzn_tools::format_duration($value);
         case 'TIM':
             return tzn_tools::format_time($value);
         case 'TMZ':
             // timezone
             // TODO
         // timezone
         // TODO
         case 'BOL':
             return $value ? 1 : 0;
         case 'LVL':
             break;
         case 'STR':
         case 'TXT':
             $spe = array('&', '<', '>');
             $sfe = array('&amp;', '&lt;', '&gt;');
             return str_replace(array("\r\n", "\r", "\n"), "<br />", str_replace($spe, $sfe, $value));
         case 'BBS':
             $value = preg_replace("/(?<!\")((http|ftp)+(s)?" . ":\\/\\/[^<>\\s]+)/i", "<a href=\"\\0\" target=\"_blank\">\\0</a>", $val);
             return str_replace(array("\r\n", "\r", "\n"), "<br />", str_replace('"', '&quot;', $value));
         case 'HTM':
             return preg_replace("/<script[^>]*>[^<]+<\\/script[^>]*>/is", "", $value);
             break;
         case 'DOC':
             // TODO
         // TODO
         case 'IMG':
             // TODO
         // TODO
         case 'OBJ':
             if (is_object($value)) {
                 return $value->get_uid();
             }
         case 'UID':
         case 'NUM':
             // positive number
         // positive number
         case 'INT':
             // any integer
         // any integer
         case 'DEC':
             // float (TODO check regional settings, look for decimal separator . or ,)
         // float (TODO check regional settings, look for decimal separator . or ,)
         default:
             return $value;
             break;
     }
 }
Пример #2
0
					<?php 
}
?>
				</select>
				<?php 
echo $this->data->errors['priority'];
?>
			</li>
			<li>
				<label for="tfk_deadline_date"><?php 
_e('Deadline', 'taskfreak');
?>
</label>
				<input type="text" name="deadline_date" id="tfk_deadline_date" 
					value="<?php 
echo $this->pid && $this->data->value('deadline_date') ? tzn_tools::format_date($this->data->value('deadline_date'), $this->options['format_date']) : '';
?>
">
				<img id="tfk_cal_btn" 
					src="<?php 
echo plugins_url('taskfreak');
?>
/img/calendar.png" 
					alt="<?php 
_e('Calendar', 'taskfreak');
?>
" 
					title="<?php 
_e('Click to show calendar', 'taskfreak');
?>
"