self::$_ticker + 1)) { self::$_ticker = time(); return true; } return false; } /** * flip_class * * First initialised with an array of two class names. Subsequent calls * reverse the array then return the first element. */ public static function flip_class($classes = null) { if (is_array($classes)) { self::$_classes = $array; } else { self::$_classes = array_reverse(self::$_classes); } return self::$_classes[0]; } /** * show_header * * For now this just shows the header template */ public static function show_header() { require_once Config::get('prefix') . '/templates/header.inc.php'; } /** * show_footer * * Shows the footer template and possibly profiling info. */ public static function show_footer() { require_once Config::get('prefix') . '/templates/footer.inc.php'; if (isset($_REQUEST['profiling'])) { Dba::show_profile(); } } /** * show_box_top * * This shows the top of the box. */ public static function show_box_top($title = '', $class = '') { require Config::get('prefix') . '/templates/show_box_top.inc.php'; } /** * show_box_bottom * * This shows the bottom of the box */ public static function show_box_bottom() { require Config::get('prefix') . '/templates/show_box_bottom.inc.php'; } /** * truncate * * Limit text to a certain length; adds an ellipsis if truncation was * required. */ public static function truncate($text, $max = 27) { // If they want <3, we're having none of that if ($max <= 3) { debug_event('UI', "truncate called with $max, refusing to do stupid things to $text", 2); return $text; } if (self::check_iconv()) { $charset = Config::get('site_charset'); if (iconv_strlen($text, $charset) > $max) { $text = iconv_substr($text, 0, $max - 3, $charset); $text .= iconv('ISO-8859-1', $charset, '...'); } } else { if (strlen($text) > $max) { $text = substr($text, 0, $max - 3) . '...'; } } return $text; } }