diff --git a/app/Services/Utils.php b/app/Services/Utils.php index b99d8f3b..0538cc5c 100644 --- a/app/Services/Utils.php +++ b/app/Services/Utils.php @@ -84,53 +84,6 @@ class Utils return ($user->getNickName() == '') ? $user->email : $user->getNickName(); } - public static function getAvatarFname(\App\Models\User $user) - { - $fname = base64_encode($user->email).".png"; - if (\Option::get('avatar_query_string')) { - $fname .= '?v='.$user->getAvatarId(); - } - return $fname; - } - - /** - * Generate omitted string - * - * @param string $str - * @param int $length - * @param boolean $append - * @return string - */ - public static function getStringOmitted($str, $length, $append = true) - { - $str = trim($str); - $strlength = strlen($str); - - if ($length == 0 || $length >= $strlength) { - return $str; - } elseif ($length < 0) { - $length = $strlength + $length; - - if ($length < 0) { - $length = $strlength; - } - } - - if (function_exists('mb_substr')) { - $newstr = mb_substr($str, 0, $length, 'utf-8'); - } elseif (function_exists('iconv_substr')) { - $newstr = iconv_substr($str, 0, $length, 'utf-8'); - } else { - $newstr = substr($str, 0, $length); - } - - if ($append && $str != $newstr) { - $newstr .= '...'; - } - - return $newstr; - } - /** * Replace content of string according to given rules * diff --git a/app/helpers.php b/app/helpers.php index 4853d54f..a987c005 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -34,3 +34,26 @@ if (! function_exists('get_current_url')) { return get_base_url().$_SERVER["REQUEST_URI"]; } } + +if (! function_exists('avatar')) { + + function avatar(App\Models\User $user, $size) + { + $fname = base64_encode($user->email).".png"; + + if (Option::get('avatar_query_string') == "1") { + $fname .= '?v='.$user->getAvatarId(); + } + + return url("avatar/$size/$fname"); + } +} + +if (! function_exists('assets')) { + + function assets($relative_uri) + { + // add query string to fresh cache + return url("assets/$relative_uri")."?v=".config('app.version'); + } +} diff --git a/resources/views/admin/master.tpl b/resources/views/admin/master.tpl index af55fb70..8ff74d2a 100644 --- a/resources/views/admin/master.tpl +++ b/resources/views/admin/master.tpl @@ -4,15 +4,15 @@ @yield('title') - {{ Option::get('site_name') }} - + - + - + - + @yield('style') @@ -55,7 +55,7 @@