Remove helper function "get_string_replaced"

This commit is contained in:
Pig Fang 2019-12-25 18:37:10 +08:00
parent 56e63b8c38
commit 7f46e1510b
4 changed files with 5 additions and 24 deletions

View File

@ -2,7 +2,6 @@
namespace App\Providers;
use App\Exceptions\PrettyPageException;
use App\Services;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redis;

View File

@ -49,16 +49,11 @@ class ViewServiceProvider extends ServiceProvider
View::composer('shared.user-panel', Composers\UserPanelComposer::class);
View::composer('shared.copyright', function ($view) {
$customCopyright = get_string_replaced(
option_localized('copyright_text'),
[
'{site_name}' => option_localized('site_name'),
'{site_url}' => option('site_url'),
]
);
$view->with([
'copyright' => option_localized('copyright_prefer', 0),
'custom_copyright' => $customCopyright,
'custom_copyright' => option_localized('copyright_text'),
'site_name' => option_localized('site_name'),
'site_url' => option('site_url'),
]);
});

View File

@ -83,20 +83,6 @@ if (!function_exists('option_localized')) {
}
}
if (!function_exists('get_string_replaced')) {
/**
* Replace content of string according to given rules.
*/
function get_string_replaced(string $str, array $rules): string
{
foreach ($rules as $search => $replace) {
$str = str_replace($search, $replace, $str);
}
return $str;
}
}
if (!function_exists('png')) {
function png($resource)
{

View File

@ -15,4 +15,5 @@
{% endif %}
</div>
{{ custom_copyright|raw }}
{% set rules = {'{site_name}': site_name, '{site_url}': site_url} %}
{{ custom_copyright|replace(rules)|raw }}