function IPF_Template_dateFormat($date, $format='%b %e, %Y')
{
if (substr(PHP_OS,0,3) == 'WIN') {
- $_win_from = array ('%e', '%T', '%D');
+ $_win_from = array ('%e', '%T', '%D');
$_win_to = array ('%#d', '%H:%M:%S', '%m/%d/%y');
$format = str_replace($_win_from, $_win_to, $format);
}
return strftime($format, strtotime($date));
}
-function IPF_Template_timeFormat($time, $format='Y-m-d H:i:s'){
+function IPF_Template_timeFormat($time, $format='Y-m-d H:i:s')
+{
return date($format, $time);
}
-function IPF_Template_floatFormat($number, $decimals=2, $dec_point='.', $thousands_sep=','){
+function IPF_Template_floatFormat($number, $decimals=2, $dec_point='.', $thousands_sep=',')
+{
return number_format($number, $decimals, $dec_point, $thousands_sep);
}
function IPF_Template_safeEcho($mixed, $echo=true)
{
- if (!is_object($mixed) or 'IPF_Template_SafeString' !== get_class($mixed)) {
- if ($echo) {
- echo htmlspecialchars((string) $mixed, ENT_COMPAT, 'UTF-8');
- } else {
- return htmlspecialchars((string) $mixed, ENT_COMPAT, 'UTF-8');
- }
- } else {
- if ($echo) {
- echo $mixed->value;
- } else {
- return $mixed->value;
- }
- }
+ $result = (is_object($mixed) and 'IPF_Template_SafeString' === get_class($mixed))
+ ? $mixed->value
+ : htmlspecialchars((string) $mixed, ENT_COMPAT, 'UTF-8');
+ if ($echo)
+ echo $result;
+ else
+ return $result;
}
}
}
- function _callback($matches)
+ private function _callback($matches)
{
list(,$tag, $firstcar) = $matches;
if (!preg_match('/^\$|[\'"]|[a-zA-Z\/]$/', $firstcar)) {
}
}
- function _parseVariable($expr)
+ private function _parseVariable($expr)
{
$tok = explode('|', $expr);
$res = $this->_parseFinal(array_shift($tok), $this->_allowedInVar);
return '';
}
$targs = array($res);
- if(isset($m[2])){
+ if (isset($m[2])) {
$res = $this->_modifier[$m[1]].'('.$res.','.$m[2].')';
- }
- else if (isset($this->_modifier[$m[1]])) {
+ } elseif (isset($this->_modifier[$m[1]])) {
$res = $this->_modifier[$m[1]].'('.$res.')';
} else {
trigger_error(sprintf(__('Unknown modifier: (%s) %s'), $expr, $m[1]), E_USER_ERROR);
return $res;
}
- function _parseFunction($name, $args)
+ private function _parseFunction($name, $args)
{
switch ($name) {
case 'if':
$res = $this->_parseFinal($args, $this->_allowedAssign).'; ';
break;
case 'literal':
- if(count($this->_literals)){
+ if (count($this->_literals)) {
$res = '?>'.array_shift($this->_literals).'<?php ';
- }else{
+ } else {
trigger_error(__('End tag of a block missing: literal'), E_USER_ERROR);
}
break;
trigger_error(__('Start tag of a block missing: literal'), E_USER_ERROR);
break;
case 'block':
- if (isset($this->_extendBlocks[$args]))
- $res = '?>'.$this->_extendBlocks[$args].'<?php ';
+ if (isset($this->_extendBlocks[$args]))
+ $res = '?>'.$this->_extendBlocks[$args].'<?php ';
else
- $res = '';
+ $res = '';
break;
case 'superblock':
$res = '?>~~{~~superblock~~}~~<?php ';