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];
}
/**
* get_icon
*
* Returns an
tag for the specified icon
*/
public static function get_icon($name, $title = null, $id = null) {
if (is_array($name)) {
$hover_name = $name[1];
$name = $name[0];
}
$title = $title ?: T_(ucfirst($name));
$icon_url = self::_find_icon($name);
if ($hover_name) {
$hover_url = self::_find_icon($hover_text);
}
$tag = '
$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;
}
/**
* update_text
*
* Convenience function that, if the output is going to a browser,
* blarfs JS to do a fancy update. Otherwise it just outputs the text.
*/
public static function update_text($field, $value) {
if (defined('CLI')) {
echo $value . "\n";
return;
}
echo '\n";
ob_flush();
flush();
}
}