function truncate_at_ellipsis($content) { $end = '[...]'; if (sustr::has($content, $end)) { $content = sustr::upto($content, $end); $content = sustr::rtrim_substr($content, $end); } return sustr::endwith($content, '[…]'); }
/** * Queues a CSS/JS file with WordPress if the file exists. * * @since 2.1 */ function queue_file($reldir, $filename, $ext, $func, $deps = array(), $l10n = array()) { if (!function_exists($func)) { return; } $reldir = untrailingslashit($reldir); $dirid = str_replace('/', '-', $reldir); $relurl = $reldir . '/'; $file = sustr::endwith($filename, $ext); if (file_exists($this->plugin_dir_path . $relurl . $file)) { $func("su-{$dirid}-{$filename}", $this->plugin_dir_url . $relurl . $file, $deps, SU_VERSION); } if (count($l10n)) { wp_localize_script("su-{$dirid}-{$filename}", sustr::camel_case("su {$dirid} {$filename} l10n"), $l10n); } }