protected function _regexCallback($reg)
{
switch ($reg[0]) {
case '%b':
return $this->strftime(Horde_Nls::getLangInfo(constant('ABMON_' . (int) $this->_month)));
case '%B':
return $this->strftime(Horde_Nls::getLangInfo(constant('MON_' . (int) $this->_month)));
case '%C':
return (int) ($this->_year / 100);
case '%-d':
case '%#d':
return sprintf('%d', $this->_mday);
case '%d':
return sprintf('%02d', $this->_mday);
case '%D':
return $this->strftime('%m/%d/%y');
case '%e':
return sprintf('%2d', $this->_mday);
case '%-H':
case '%#H':
return sprintf('%d', $this->_hour);
case '%H':
return sprintf('%02d', $this->_hour);
case '%-I':
case '%#I':
return sprintf('%d', $this->_hour == 0 ? 12 : ($this->_hour > 12 ? $this->_hour - 12 : $this->_hour));
case '%I':
return sprintf('%02d', $this->_hour == 0 ? 12 : ($this->_hour > 12 ? $this->_hour - 12 : $this->_hour));
case '%-m':
case '%#m':
return sprintf('%d', $this->_month);
case '%m':
return sprintf('%02d', $this->_month);
case '%-M':
case '%#M':
return sprintf('%d', $this->_min);
case '%M':
return sprintf('%02d', $this->_min);
case '%n':
return "\n";
case '%p':
return $this->strftime(Horde_Nls::getLangInfo($this->_hour < 12 ? AM_STR : PM_STR));
case '%R':
return $this->strftime('%H:%M');
case '%-S':
case '%#S':
return sprintf('%d', $this->_sec);
case '%S':
return sprintf('%02d', $this->_sec);
case '%t':
return "\t";
case '%T':
return $this->strftime('%H:%M:%S');
case '%x':
return $this->strftime(Horde_Nls::getLangInfo(D_FMT));
case '%X':
return $this->strftime(Horde_Nls::getLangInfo(T_FMT));
case '%y':
return substr(sprintf('%04d', $this->_year), -2);
case '%Y':
return (int) $this->_year;
case '%%':
return '%';
}
return $reg[0];
}