/** * Returns an excerpt. * Will return up to n chars stopping at the nearest space. * If no spaces are found (like in Japanese) will crop off at the * n char mark. Adds ... if any text was chopped. * * @param string $text The full text to excerpt * @param int $num_chars Return a string up to $num_chars long * * @return string * @since 1.7.2 */ function elgg_get_excerpt($text, $num_chars = 250) { $view = 'output/excerpt'; $vars = ['text' => $text, 'num_chars' => $num_chars]; $viewtype = elgg_view_exists($view) ? '' : 'default'; return _elgg_view_under_viewtype($view, $vars, $viewtype); }
/** * Displays a UNIX timestamp in a friendly way * * @see elgg_get_friendly_time() * * @param int $time A UNIX epoch timestamp * * @return string The friendly time HTML * @since 1.7.2 */ function elgg_view_friendly_time($time) { $view = 'output/friendlytime'; $vars = ['time' => $time]; $viewtype = elgg_view_exists($view) ? '' : 'default'; return _elgg_view_under_viewtype($view, $vars, $viewtype); }