Update cs of some files, use Category model in Category class

This commit is contained in:
DariusIII
2017-10-06 14:09:28 +02:00
parent bfa31d07eb
commit cb7cf5b8c8
13 changed files with 251 additions and 265 deletions
+30 -30
View File
@@ -14,20 +14,20 @@ if (! isset($smarty)) {
$smarty = new Smarty();
}
switch (true) {
case is_string($smarty->plugins_dir) && is_dir($smarty->plugins_dir):
$plugins_dir = $smarty->plugins_dir;
break;
case is_array($smarty->plugins_dir):
$plugins_dir = '';
foreach ($smarty->plugins_dir as $dir) {
if (is_string($dir) && is_dir($dir)) {
$plugins_dir = $dir;
break;
}
}
break;
default:
$plugins_dir = '';
case is_string($smarty->plugins_dir) && is_dir($smarty->plugins_dir):
$plugins_dir = $smarty->plugins_dir;
break;
case is_array($smarty->plugins_dir):
$plugins_dir = '';
foreach ($smarty->plugins_dir as $dir) {
if (is_string($dir) && is_dir($dir)) {
$plugins_dir = $dir;
break;
}
}
break;
default:
$plugins_dir = '';
}
if (! is_dir($plugins_dir)) {
exit('Fatal: Unable to find smarty plugins directory.'.PHP_EOL);
@@ -55,24 +55,24 @@ require_once $plugins_dir.'shared.make_timestamp.php';
function smarty_modifier_phpdate_format($string, $format = 'Y/m/d H:i:s', $default_date = null)
{
/* if (substr(PHP_OS,0,3) == 'WIN') {
$_win_from = array ('%e', '%T', '%D');
$_win_to = array ('%#d', '%H:%M:%S', '%m/%d/%y');
$format = str_replace($_win_from, $_win_to, $format);
}*/
$_win_from = array ('%e', '%T', '%D');
$_win_to = array ('%#d', '%H:%M:%S', '%m/%d/%y');
$format = str_replace($_win_from, $_win_to, $format);
}*/
if (substr($format, 0, 5) == 'DATE_') {
switch ($format) {
case 'DATE_ATOM': $nformat = DATE_ATOM; break;
case 'DATE_COOKIE': $nformat = DATE_COOKIE; break;
case 'DATE_ISO8601': $nformat = DATE_ISO8601; break;
case 'DATE_RFC822': $nformat = 'D, d M y H:i:s O'; break; //The php constant is not quite right - as the time-zone comes out with invalid values like "UTC"...
case 'DATE_RFC850': $nformat = DATE_RFC850; break;
case 'DATE_RFC1036': $nformat = DATE_RFC1036; break;
case 'DATE_RFC1123': $nformat = DATE_RFC1123; break;
case 'DATE_RFC2822': $nformat = DATE_RFC2822; break;
case 'DATE_RFC3339': $nformat = DATE_RFC3339; break;
case 'DATE_RSS': $nformat = 'D, d M Y H:i:s O'; break; //as rfc822 ...
case 'DATE_W3C': $nformat = DATE_W3C; break;
}
case 'DATE_ATOM': $nformat = DATE_ATOM; break;
case 'DATE_COOKIE': $nformat = DATE_COOKIE; break;
case 'DATE_ISO8601': $nformat = DATE_ISO8601; break;
case 'DATE_RFC822': $nformat = 'D, d M y H:i:s O'; break; //The php constant is not quite right - as the time-zone comes out with invalid values like "UTC"...
case 'DATE_RFC850': $nformat = DATE_RFC850; break;
case 'DATE_RFC1036': $nformat = DATE_RFC1036; break;
case 'DATE_RFC1123': $nformat = DATE_RFC1123; break;
case 'DATE_RFC2822': $nformat = DATE_RFC2822; break;
case 'DATE_RFC3339': $nformat = DATE_RFC3339; break;
case 'DATE_RSS': $nformat = 'D, d M Y H:i:s O'; break; //as rfc822 ...
case 'DATE_W3C': $nformat = DATE_W3C; break;
}
} else {
$nformat = $format;
}