@@ -82,10 +82,10 @@ |
||
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | $page->smarty->assign(['queueType' => $queueType, 'error' => $error, 'user', $userData]); |
| 85 | -$page->title = "Your $queueType Download Queue"; |
|
| 86 | -$page->meta_title = "View $queueType Queue"; |
|
| 85 | +$page->title = "your $queueType Download Queue"; |
|
| 86 | +$page->meta_title = "view $queueType Queue"; |
|
| 87 | 87 | $page->meta_keywords = "view," . strtolower($queueType) . ",queue"; |
| 88 | -$page->meta_description = "View $queueType Queue"; |
|
| 88 | +$page->meta_description = "view $queueType Queue"; |
|
| 89 | 89 | |
| 90 | 90 | $page->content = $page->smarty->fetch('viewqueue.tpl'); |
| 91 | 91 | $page->render(); |
@@ -26,14 +26,11 @@ |
||
| 26 | 26 | $page->meta_description = ""; |
| 27 | 27 | $page->smarty->registerPlugin('modifier', 'ss', 'stripslashes'); |
| 28 | 28 | |
| 29 | - if (isset($_GET['modal'])) |
|
| 30 | - { |
|
| 29 | + if (isset($_GET['modal'])) { |
|
| 31 | 30 | $page->content = $page->smarty->fetch('viewmovie.tpl'); |
| 32 | 31 | $page->smarty->assign('modal', true); |
| 33 | 32 | echo $page->content; |
| 34 | - } |
|
| 35 | - else |
|
| 36 | - { |
|
| 33 | + } else { |
|
| 37 | 34 | $page->content = $page->smarty->fetch('viewmoviefull.tpl'); |
| 38 | 35 | $page->render(); |
| 39 | 36 | } |
@@ -14,20 +14,20 @@ |
||
| 14 | 14 | $smarty = new Smarty(); |
| 15 | 15 | } |
| 16 | 16 | switch (true) { |
| 17 | - case is_string($smarty->plugins_dir) && is_dir($smarty->plugins_dir): |
|
| 18 | - $plugins_dir = $smarty->plugins_dir; |
|
| 19 | - break; |
|
| 20 | - case is_array($smarty->plugins_dir): |
|
| 21 | - $plugins_dir = ''; |
|
| 22 | - foreach ($smarty->plugins_dir as $dir) { |
|
| 23 | - if (is_string($dir) && is_dir($dir)) { |
|
| 24 | - $plugins_dir = $dir; |
|
| 25 | - break; |
|
| 17 | + case is_string($smarty->plugins_dir) && is_dir($smarty->plugins_dir): |
|
| 18 | + $plugins_dir = $smarty->plugins_dir; |
|
| 19 | + break; |
|
| 20 | + case is_array($smarty->plugins_dir): |
|
| 21 | + $plugins_dir = ''; |
|
| 22 | + foreach ($smarty->plugins_dir as $dir) { |
|
| 23 | + if (is_string($dir) && is_dir($dir)) { |
|
| 24 | + $plugins_dir = $dir; |
|
| 25 | + break; |
|
| 26 | + } |
|
| 26 | 27 | } |
| 27 | - } |
|
| 28 | - break; |
|
| 29 | - default: |
|
| 30 | - $plugins_dir = ''; |
|
| 28 | + break; |
|
| 29 | + default: |
|
| 30 | + $plugins_dir = ''; |
|
| 31 | 31 | } |
| 32 | 32 | if (!is_dir($plugins_dir)) { |
| 33 | 33 | exit('Fatal: Unable to find smarty plugins directory.' . PHP_EOL); |
@@ -52,31 +52,31 @@ |
||
| 52 | 52 | * @return string|void |
| 53 | 53 | * @uses smarty_make_timestamp() |
| 54 | 54 | */ |
| 55 | -function smarty_modifier_phpdate_format($string, $format="Y/m/d H:i:s", $default_date=null) |
|
| 55 | +function smarty_modifier_phpdate_format($string, $format = "Y/m/d H:i:s", $default_date = null) |
|
| 56 | 56 | { |
| 57 | 57 | /* if (substr(PHP_OS,0,3) == 'WIN') { |
| 58 | 58 | $_win_from = array ('%e', '%T', '%D'); |
| 59 | 59 | $_win_to = array ('%#d', '%H:%M:%S', '%m/%d/%y'); |
| 60 | 60 | $format = str_replace($_win_from, $_win_to, $format); |
| 61 | 61 | }*/ |
| 62 | - if (substr($format,0,5)=='DATE_'){ |
|
| 63 | - switch ($format){ |
|
| 64 | - case 'DATE_ATOM': $nformat=DATE_ATOM; break; |
|
| 65 | - case 'DATE_COOKIE': $nformat=DATE_COOKIE; break; |
|
| 66 | - case 'DATE_ISO8601': $nformat=DATE_ISO8601; break; |
|
| 67 | - 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"... |
|
| 68 | - case 'DATE_RFC850': $nformat=DATE_RFC850; break; |
|
| 69 | - case 'DATE_RFC1036': $nformat=DATE_RFC1036; break; |
|
| 70 | - case 'DATE_RFC1123': $nformat=DATE_RFC1123; break; |
|
| 71 | - case 'DATE_RFC2822': $nformat=DATE_RFC2822; break; |
|
| 72 | - case 'DATE_RFC3339': $nformat=DATE_RFC3339; break; |
|
| 73 | - case 'DATE_RSS': $nformat="D, d M Y H:i:s O"; break; //as rfc822 ... |
|
| 74 | - case 'DATE_W3C': $nformat=DATE_W3C; break; |
|
| 62 | + if (substr($format, 0, 5) == 'DATE_') { |
|
| 63 | + switch ($format) { |
|
| 64 | + case 'DATE_ATOM': $nformat = DATE_ATOM; break; |
|
| 65 | + case 'DATE_COOKIE': $nformat = DATE_COOKIE; break; |
|
| 66 | + case 'DATE_ISO8601': $nformat = DATE_ISO8601; break; |
|
| 67 | + 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"... |
|
| 68 | + case 'DATE_RFC850': $nformat = DATE_RFC850; break; |
|
| 69 | + case 'DATE_RFC1036': $nformat = DATE_RFC1036; break; |
|
| 70 | + case 'DATE_RFC1123': $nformat = DATE_RFC1123; break; |
|
| 71 | + case 'DATE_RFC2822': $nformat = DATE_RFC2822; break; |
|
| 72 | + case 'DATE_RFC3339': $nformat = DATE_RFC3339; break; |
|
| 73 | + case 'DATE_RSS': $nformat = "D, d M Y H:i:s O"; break; //as rfc822 ... |
|
| 74 | + case 'DATE_W3C': $nformat = DATE_W3C; break; |
|
| 75 | 75 | } |
| 76 | 76 | } else { |
| 77 | - $nformat=$format; |
|
| 77 | + $nformat = $format; |
|
| 78 | 78 | } |
| 79 | - if($string != '') { |
|
| 79 | + if ($string != '') { |
|
| 80 | 80 | return date($nformat, smarty_make_timestamp($string)); |
| 81 | 81 | } elseif (isset($default_date) && $default_date != '') { |
| 82 | 82 | return date($nformat, smarty_make_timestamp($default_date)); |
@@ -59,8 +59,8 @@ |
||
| 59 | 59 | $_win_to = array ('%#d', '%H:%M:%S', '%m/%d/%y'); |
| 60 | 60 | $format = str_replace($_win_from, $_win_to, $format); |
| 61 | 61 | }*/ |
| 62 | - if (substr($format,0,5)=='DATE_'){ |
|
| 63 | - switch ($format){ |
|
| 62 | + if (substr($format,0,5)=='DATE_') { |
|
| 63 | + switch ($format) { |
|
| 64 | 64 | case 'DATE_ATOM': $nformat=DATE_ATOM; break; |
| 65 | 65 | case 'DATE_COOKIE': $nformat=DATE_COOKIE; break; |
| 66 | 66 | case 'DATE_ISO8601': $nformat=DATE_ISO8601; break; |
@@ -48,14 +48,14 @@ discard block |
||
| 48 | 48 | case 'name': |
| 49 | 49 | case 'class': |
| 50 | 50 | case 'id': |
| 51 | - $$_key = (string) $_val; |
|
| 51 | + $$_key = (string)$_val; |
|
| 52 | 52 | break; |
| 53 | 53 | case 'options': |
| 54 | - $options = (array) $_val; |
|
| 54 | + $options = (array)$_val; |
|
| 55 | 55 | break; |
| 56 | 56 | case 'values': |
| 57 | 57 | case 'output': |
| 58 | - $$_key = array_values((array) $_val); |
|
| 58 | + $$_key = array_values((array)$_val); |
|
| 59 | 59 | break; |
| 60 | 60 | case 'selected': |
| 61 | 61 | if (is_array($_val)) { |
@@ -63,24 +63,24 @@ discard block |
||
| 63 | 63 | foreach ($_val as $_sel) { |
| 64 | 64 | if (is_object($_sel)) { |
| 65 | 65 | if (method_exists($_sel, "__toString")) { |
| 66 | - $_sel = smarty_function_escape_special_chars((string) $_sel->__toString()); |
|
| 66 | + $_sel = smarty_function_escape_special_chars((string)$_sel->__toString()); |
|
| 67 | 67 | } else { |
| 68 | - trigger_error("html_options_multiple: selected attribute contains an object of class '". get_class($_sel) ."' without __toString() method", E_USER_NOTICE); |
|
| 68 | + trigger_error("html_options_multiple: selected attribute contains an object of class '" . get_class($_sel) . "' without __toString() method", E_USER_NOTICE); |
|
| 69 | 69 | continue; |
| 70 | 70 | } |
| 71 | 71 | } else { |
| 72 | - $_sel = smarty_function_escape_special_chars((string) $_sel); |
|
| 72 | + $_sel = smarty_function_escape_special_chars((string)$_sel); |
|
| 73 | 73 | } |
| 74 | 74 | $selected[$_sel] = true; |
| 75 | 75 | } |
| 76 | 76 | } elseif (is_object($_val)) { |
| 77 | 77 | if (method_exists($_val, "__toString")) { |
| 78 | - $selected = smarty_function_escape_special_chars((string) $_val->__toString()); |
|
| 78 | + $selected = smarty_function_escape_special_chars((string)$_val->__toString()); |
|
| 79 | 79 | } else { |
| 80 | - trigger_error("html_options_multiple: selected attribute is an object of class '". get_class($_val) ."' without __toString() method", E_USER_NOTICE); |
|
| 80 | + trigger_error("html_options_multiple: selected attribute is an object of class '" . get_class($_val) . "' without __toString() method", E_USER_NOTICE); |
|
| 81 | 81 | } |
| 82 | 82 | } else { |
| 83 | - $selected = smarty_function_escape_special_chars((string) $_val); |
|
| 83 | + $selected = smarty_function_escape_special_chars((string)$_val); |
|
| 84 | 84 | } |
| 85 | 85 | break; |
| 86 | 86 | case 'strict': break; |
@@ -122,8 +122,8 @@ discard block |
||
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | 124 | if (!empty($name)) { |
| 125 | - $_html_class = !empty($class) ? ' class="'.$class.'"' : ''; |
|
| 126 | - $_html_id = !empty($id) ? ' id="'.$id.'"' : ''; |
|
| 125 | + $_html_class = !empty($class) ? ' class="' . $class . '"' : ''; |
|
| 126 | + $_html_id = !empty($id) ? ' id="' . $id . '"' : ''; |
|
| 127 | 127 | // the name needs to have [] added (this is html text [] not PHP, so that the return for the multiselect is an array |
| 128 | 128 | $_html_result = '<select multiple="multiple" name="' . $name . '[]"' . $_html_class . $_html_id . $extra . '>' . "\n" . $_html_result . '</select>' . "\n"; |
| 129 | 129 | } |
@@ -141,23 +141,23 @@ discard block |
||
| 141 | 141 | } elseif ($_key === $selected) { |
| 142 | 142 | $_html_result .= ' selected="selected"'; |
| 143 | 143 | } |
| 144 | - $_html_class = !empty($class) ? ' class="'.$class.' option"' : ''; |
|
| 145 | - $_html_id = !empty($id) ? ' id="'.$id.'-'.$idx.'"' : ''; |
|
| 144 | + $_html_class = !empty($class) ? ' class="' . $class . ' option"' : ''; |
|
| 145 | + $_html_id = !empty($id) ? ' id="' . $id . '-' . $idx . '"' : ''; |
|
| 146 | 146 | if (is_object($value)) { |
| 147 | 147 | if (method_exists($value, "__toString")) { |
| 148 | - $value = smarty_function_escape_special_chars((string) $value->__toString()); |
|
| 148 | + $value = smarty_function_escape_special_chars((string)$value->__toString()); |
|
| 149 | 149 | } else { |
| 150 | - trigger_error("html_options_multiple: value is an object of class '". get_class($value) ."' without __toString() method", E_USER_NOTICE); |
|
| 150 | + trigger_error("html_options_multiple: value is an object of class '" . get_class($value) . "' without __toString() method", E_USER_NOTICE); |
|
| 151 | 151 | return ''; |
| 152 | 152 | } |
| 153 | 153 | } else { |
| 154 | - $value = smarty_function_escape_special_chars((string) $value); |
|
| 154 | + $value = smarty_function_escape_special_chars((string)$value); |
|
| 155 | 155 | } |
| 156 | 156 | $_html_result .= $_html_class . $_html_id . '>' . $value . '</option>' . "\n"; |
| 157 | 157 | $idx++; |
| 158 | 158 | } else { |
| 159 | 159 | $_idx = 0; |
| 160 | - $_html_result = smarty_function_html_options_multiple_optgroup($key, $value, $selected, !empty($id) ? ($id.'-'.$idx) : null, $class, $_idx); |
|
| 160 | + $_html_result = smarty_function_html_options_multiple_optgroup($key, $value, $selected, !empty($id) ? ($id . '-' . $idx) : null, $class, $_idx); |
|
| 161 | 161 | $idx++; |
| 162 | 162 | } |
| 163 | 163 | return $_html_result; |
@@ -17,25 +17,25 @@ |
||
| 17 | 17 | { |
| 18 | 18 | if ($date == "") |
| 19 | 19 | return "n/a"; |
| 20 | - $sec = mktime(0,0,0,date("m"), date("d"), date("Y")) - (( strtotime($date)) ? strtotime(date("Y-m-d", strtotime($date))) : strtotime(date("Y-m-d", $date))); |
|
| 20 | + $sec = mktime(0, 0, 0, date("m"), date("d"), date("Y")) - ((strtotime($date)) ? strtotime(date("Y-m-d", strtotime($date))) : strtotime(date("Y-m-d", $date))); |
|
| 21 | 21 | $min = $sec / 60; |
| 22 | 22 | $hrs = $min / 60; |
| 23 | - $days = $sec/60/60/24; |
|
| 24 | - if ( $hrs <= 24) return ' Today'; |
|
| 23 | + $days = $sec / 60 / 60 / 24; |
|
| 24 | + if ($hrs <= 24) return ' Today'; |
|
| 25 | 25 | if ($days >= 365) |
| 26 | 26 | { |
| 27 | - $years = round(($days/365), 1); |
|
| 28 | - return $years.' Yr'.($years!=1?"s":"").' ago'; |
|
| 27 | + $years = round(($days / 365), 1); |
|
| 28 | + return $years . ' Yr' . ($years != 1 ? "s" : "") . ' ago'; |
|
| 29 | 29 | } |
| 30 | 30 | else if ($days >= 90) |
| 31 | 31 | { |
| 32 | - return round($days/7).' Wks ago'; |
|
| 32 | + return round($days / 7) . ' Wks ago'; |
|
| 33 | 33 | } |
| 34 | 34 | else if ($days <= 2) |
| 35 | 35 | return 'Yesterday'; |
| 36 | 36 | else |
| 37 | 37 | { |
| 38 | - return round($days, 0).'d ago'; |
|
| 38 | + return round($days, 0) . 'd ago'; |
|
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | ?> |
| 42 | 42 | \ No newline at end of file |
@@ -15,26 +15,24 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | function smarty_modifier_daysAgo($date) |
| 17 | 17 | { |
| 18 | - if ($date == "") |
|
| 19 | - return "n/a"; |
|
| 18 | + if ($date == "") { |
|
| 19 | + return "n/a"; |
|
| 20 | + } |
|
| 20 | 21 | $sec = mktime(0,0,0,date("m"), date("d"), date("Y")) - (( strtotime($date)) ? strtotime(date("Y-m-d", strtotime($date))) : strtotime(date("Y-m-d", $date))); |
| 21 | 22 | $min = $sec / 60; |
| 22 | 23 | $hrs = $min / 60; |
| 23 | 24 | $days = $sec/60/60/24; |
| 24 | - if ( $hrs <= 24) return ' Today'; |
|
| 25 | - if ($days >= 365) |
|
| 26 | - { |
|
| 25 | + if ( $hrs <= 24) { |
|
| 26 | + return ' Today'; |
|
| 27 | + } |
|
| 28 | + if ($days >= 365) { |
|
| 27 | 29 | $years = round(($days/365), 1); |
| 28 | 30 | return $years.' Yr'.($years!=1?"s":"").' ago'; |
| 29 | - } |
|
| 30 | - else if ($days >= 90) |
|
| 31 | - { |
|
| 31 | + } else if ($days >= 90) { |
|
| 32 | 32 | return round($days/7).' Wks ago'; |
| 33 | - } |
|
| 34 | - else if ($days <= 2) |
|
| 35 | - return 'Yesterday'; |
|
| 36 | - else |
|
| 37 | - { |
|
| 33 | + } else if ($days <= 2) { |
|
| 34 | + return 'Yesterday'; |
|
| 35 | + } else { |
|
| 38 | 36 | return round($days, 0).'d ago'; |
| 39 | 37 | } |
| 40 | 38 | } |
@@ -29,28 +29,28 @@ |
||
| 29 | 29 | * 2003-02-21 Version 0.1 - initial release |
| 30 | 30 | * ------------------------------------------------------------- |
| 31 | 31 | */ |
| 32 | -function smarty_modifier_fsize_format($size,$format = '',$precision = 2, $dec_point = ".", $thousands_sep = ",") |
|
| 32 | +function smarty_modifier_fsize_format($size, $format = '', $precision = 2, $dec_point = ".", $thousands_sep = ",") |
|
| 33 | 33 | { |
| 34 | 34 | $format = strtoupper($format); |
| 35 | 35 | static $sizes = array(); |
| 36 | - if(!count($sizes)) { |
|
| 36 | + if (!count($sizes)) { |
|
| 37 | 37 | $b = 1024; |
| 38 | - $sizes["B"] = 1; |
|
| 39 | - $sizes["KB"] = $sizes["B"] * $b; |
|
| 40 | - $sizes["MB"] = $sizes["KB"] * $b; |
|
| 41 | - $sizes["GB"] = $sizes["MB"] * $b; |
|
| 42 | - $sizes["TB"] = $sizes["GB"] * $b; |
|
| 43 | - $sizes["PB"] = $sizes["TB"] * $b; |
|
| 44 | - $sizes["EB"] = $sizes["PB"] * $b; |
|
| 45 | - $sizes["ZB"] = $sizes["EB"] * $b; |
|
| 46 | - $sizes["YB"] = $sizes["ZB"] * $b; |
|
| 47 | - $sizes = array_reverse($sizes,true); |
|
| 38 | + $sizes["B"] = 1; |
|
| 39 | + $sizes["KB"] = $sizes["B"] * $b; |
|
| 40 | + $sizes["MB"] = $sizes["KB"] * $b; |
|
| 41 | + $sizes["GB"] = $sizes["MB"] * $b; |
|
| 42 | + $sizes["TB"] = $sizes["GB"] * $b; |
|
| 43 | + $sizes["PB"] = $sizes["TB"] * $b; |
|
| 44 | + $sizes["EB"] = $sizes["PB"] * $b; |
|
| 45 | + $sizes["ZB"] = $sizes["EB"] * $b; |
|
| 46 | + $sizes["YB"] = $sizes["ZB"] * $b; |
|
| 47 | + $sizes = array_reverse($sizes, true); |
|
| 48 | 48 | } |
| 49 | 49 | //~ get "human" filesize |
| 50 | - foreach($sizes AS $unit => $bytes) { |
|
| 51 | - if($size > $bytes || $unit == $format) { |
|
| 50 | + foreach ($sizes AS $unit => $bytes) { |
|
| 51 | + if ($size > $bytes || $unit == $format) { |
|
| 52 | 52 | //~ return formatted size |
| 53 | - return number_format($size / $bytes,$precision,$dec_point,$thousands_sep)." ".$unit; |
|
| 53 | + return number_format($size / $bytes, $precision, $dec_point, $thousands_sep) . " " . $unit; |
|
| 54 | 54 | } //~ end if |
| 55 | 55 | } //~ end foreach |
| 56 | 56 | } //~ end function |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | $sizes = array_reverse($sizes,true); |
| 48 | 48 | } |
| 49 | 49 | //~ get "human" filesize |
| 50 | - foreach($sizes AS $unit => $bytes) { |
|
| 50 | + foreach($sizes as $unit => $bytes) { |
|
| 51 | 51 | if($size > $bytes || $unit == $format) { |
| 52 | 52 | //~ return formatted size |
| 53 | 53 | return number_format($size / $bytes,$precision,$dec_point,$thousands_sep)." ".$unit; |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | * @param string |
| 15 | 15 | * @return string |
| 16 | 16 | */ |
| 17 | -function smarty_modifier_magicurl($str, $dereferrer="") { |
|
| 18 | - return preg_replace('/(https?):\/\/([A-Za-z0-9\._\-\/\?=&;%]+)/is', '<a href="'.$dereferrer.'$1://$2" target="_blank">$1://$2</a>', $str); |
|
| 17 | +function smarty_modifier_magicurl($str, $dereferrer = "") { |
|
| 18 | + return preg_replace('/(https?):\/\/([A-Za-z0-9\._\-\/\?=&;%]+)/is', '<a href="' . $dereferrer . '$1://$2" target="_blank">$1://$2</a>', $str); |
|
| 19 | 19 | } |
| 20 | 20 | ?> |
| 21 | 21 | \ No newline at end of file |
@@ -14,7 +14,8 @@ |
||
| 14 | 14 | * @param string |
| 15 | 15 | * @return string |
| 16 | 16 | */ |
| 17 | -function smarty_modifier_magicurl($str, $dereferrer="") { |
|
| 17 | +function smarty_modifier_magicurl($str, $dereferrer="") |
|
| 18 | +{ |
|
| 18 | 19 | return preg_replace('/(https?):\/\/([A-Za-z0-9\._\-\/\?=&;%]+)/is', '<a href="'.$dereferrer.'$1://$2" target="_blank">$1://$2</a>', $str); |
| 19 | 20 | } |
| 20 | 21 | ?> |
| 21 | 22 | \ No newline at end of file |
@@ -1,9 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | -function smarty_modifier_parray ($string,$explode,$limit=NULL) |
|
| 2 | +function smarty_modifier_parray($string, $explode, $limit = NULL) |
|
| 3 | 3 | { |
| 4 | - if($limit == NULL) |
|
| 5 | - return explode( $explode , $string ); |
|
| 4 | + if ($limit == NULL) |
|
| 5 | + return explode($explode, $string); |
|
| 6 | 6 | else |
| 7 | - return explode( $explode , $string , $limit); |
|
| 7 | + return explode($explode, $string, $limit); |
|
| 8 | 8 | } |
| 9 | 9 | ?> |
| 10 | 10 | \ No newline at end of file |
@@ -1,9 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | function smarty_modifier_parray ($string,$explode,$limit=NULL) |
| 3 | 3 | { |
| 4 | - if($limit == NULL) |
|
| 5 | - return explode( $explode , $string ); |
|
| 6 | - else |
|
| 7 | - return explode( $explode , $string , $limit); |
|
| 8 | -} |
|
| 4 | + if($limit == NULL) { |
|
| 5 | + return explode( $explode , $string ); |
|
| 6 | + } else { |
|
| 7 | + return explode( $explode , $string , $limit); |
|
| 8 | + } |
|
| 9 | + } |
|
| 9 | 10 | ?> |
| 10 | 11 | \ No newline at end of file |
@@ -13,37 +13,37 @@ |
||
| 13 | 13 | * @param string |
| 14 | 14 | * @return string |
| 15 | 15 | */ |
| 16 | -function smarty_modifier_timeAgo( $date) |
|
| 16 | +function smarty_modifier_timeAgo($date) |
|
| 17 | 17 | { |
| 18 | 18 | if ($date == "") |
| 19 | 19 | return "n/a"; |
| 20 | - $timeStrings = array( 'now', // 0 |
|
| 21 | - 'Sec', 'Secs', // 1,1 |
|
| 22 | - 'Min','Mins', // 3,3 |
|
| 23 | - 'Hour', 'Hrs', // 5,5 |
|
| 20 | + $timeStrings = array('now', // 0 |
|
| 21 | + 'Sec', 'Secs', // 1,1 |
|
| 22 | + 'Min', 'Mins', // 3,3 |
|
| 23 | + 'Hour', 'Hrs', // 5,5 |
|
| 24 | 24 | 'Day', 'Days'); |
| 25 | - $sec = time() - (( !is_numeric($date) && strtotime($date)) ? strtotime($date) : $date); |
|
| 26 | - if ( $sec <= 0) return $timeStrings[0]; |
|
| 27 | - if ( $sec < 2) return $sec." ".$timeStrings[1]; |
|
| 28 | - if ( $sec < 60) return $sec." ".$timeStrings[2]; |
|
| 25 | + $sec = time() - ((!is_numeric($date) && strtotime($date)) ? strtotime($date) : $date); |
|
| 26 | + if ($sec <= 0) return $timeStrings[0]; |
|
| 27 | + if ($sec < 2) return $sec . " " . $timeStrings[1]; |
|
| 28 | + if ($sec < 60) return $sec . " " . $timeStrings[2]; |
|
| 29 | 29 | $min = $sec / 60; |
| 30 | - if ( floor($min+0.5) < 2) return floor($min+0.5)." ".$timeStrings[3]; |
|
| 31 | - if ( $min < 60) return floor($min+0.5)." ".$timeStrings[4]; |
|
| 30 | + if (floor($min + 0.5) < 2) return floor($min + 0.5) . " " . $timeStrings[3]; |
|
| 31 | + if ($min < 60) return floor($min + 0.5) . " " . $timeStrings[4]; |
|
| 32 | 32 | $hrs = $min / 60; |
| 33 | - if ( floor($hrs+0.5) < 2) return floor($hrs+0.5)." ".$timeStrings[5]; |
|
| 34 | - if ( $hrs < 24) return floor($hrs+0.5)." ".$timeStrings[6]; |
|
| 35 | - $days = $sec/60/60/24; |
|
| 33 | + if (floor($hrs + 0.5) < 2) return floor($hrs + 0.5) . " " . $timeStrings[5]; |
|
| 34 | + if ($hrs < 24) return floor($hrs + 0.5) . " " . $timeStrings[6]; |
|
| 35 | + $days = $sec / 60 / 60 / 24; |
|
| 36 | 36 | if ($days > 365) |
| 37 | 37 | { |
| 38 | - return round(($days/365), 1).' Yrs'; |
|
| 38 | + return round(($days / 365), 1) . ' Yrs'; |
|
| 39 | 39 | } |
| 40 | 40 | else if ($days > 90) |
| 41 | 41 | { |
| 42 | - return round($days/7).' Wks'; |
|
| 42 | + return round($days / 7) . ' Wks'; |
|
| 43 | 43 | } |
| 44 | 44 | else |
| 45 | 45 | { |
| 46 | - return round($days, 1).'d'; |
|
| 46 | + return round($days, 1) . 'd'; |
|
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | ?> |
| 50 | 50 | \ No newline at end of file |
@@ -15,34 +15,44 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | function smarty_modifier_timeAgo( $date) |
| 17 | 17 | { |
| 18 | - if ($date == "") |
|
| 19 | - return "n/a"; |
|
| 18 | + if ($date == "") { |
|
| 19 | + return "n/a"; |
|
| 20 | + } |
|
| 20 | 21 | $timeStrings = array( 'now', // 0 |
| 21 | 22 | 'Sec', 'Secs', // 1,1 |
| 22 | 23 | 'Min','Mins', // 3,3 |
| 23 | 24 | 'Hour', 'Hrs', // 5,5 |
| 24 | 25 | 'Day', 'Days'); |
| 25 | 26 | $sec = time() - (( !is_numeric($date) && strtotime($date)) ? strtotime($date) : $date); |
| 26 | - if ( $sec <= 0) return $timeStrings[0]; |
|
| 27 | - if ( $sec < 2) return $sec." ".$timeStrings[1]; |
|
| 28 | - if ( $sec < 60) return $sec." ".$timeStrings[2]; |
|
| 27 | + if ( $sec <= 0) { |
|
| 28 | + return $timeStrings[0]; |
|
| 29 | + } |
|
| 30 | + if ( $sec < 2) { |
|
| 31 | + return $sec." ".$timeStrings[1]; |
|
| 32 | + } |
|
| 33 | + if ( $sec < 60) { |
|
| 34 | + return $sec." ".$timeStrings[2]; |
|
| 35 | + } |
|
| 29 | 36 | $min = $sec / 60; |
| 30 | - if ( floor($min+0.5) < 2) return floor($min+0.5)." ".$timeStrings[3]; |
|
| 31 | - if ( $min < 60) return floor($min+0.5)." ".$timeStrings[4]; |
|
| 37 | + if ( floor($min+0.5) < 2) { |
|
| 38 | + return floor($min+0.5)." ".$timeStrings[3]; |
|
| 39 | + } |
|
| 40 | + if ( $min < 60) { |
|
| 41 | + return floor($min+0.5)." ".$timeStrings[4]; |
|
| 42 | + } |
|
| 32 | 43 | $hrs = $min / 60; |
| 33 | - if ( floor($hrs+0.5) < 2) return floor($hrs+0.5)." ".$timeStrings[5]; |
|
| 34 | - if ( $hrs < 24) return floor($hrs+0.5)." ".$timeStrings[6]; |
|
| 44 | + if ( floor($hrs+0.5) < 2) { |
|
| 45 | + return floor($hrs+0.5)." ".$timeStrings[5]; |
|
| 46 | + } |
|
| 47 | + if ( $hrs < 24) { |
|
| 48 | + return floor($hrs+0.5)." ".$timeStrings[6]; |
|
| 49 | + } |
|
| 35 | 50 | $days = $sec/60/60/24; |
| 36 | - if ($days > 365) |
|
| 37 | - { |
|
| 51 | + if ($days > 365) { |
|
| 38 | 52 | return round(($days/365), 1).' Yrs'; |
| 39 | - } |
|
| 40 | - else if ($days > 90) |
|
| 41 | - { |
|
| 53 | + } else if ($days > 90) { |
|
| 42 | 54 | return round($days/7).' Wks'; |
| 43 | - } |
|
| 44 | - else |
|
| 45 | - { |
|
| 55 | + } else { |
|
| 46 | 56 | return round($days, 1).'d'; |
| 47 | 57 | } |
| 48 | 58 | } |