2025-04-10 21:52:11 +08:00

43 lines
1.7 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// +----------------------------------------------------------------------
// | Center Plugin for ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2025 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
// | 免责声明 ( https://thinkadmin.top/disclaimer )
// | 开源协议 ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | gitee 代码仓库https://gitee.com/zoujingli/think-plugs-center
// | github 代码仓库https://github.com/zoujingli/think-plugs-center
// +----------------------------------------------------------------------
declare (strict_types=1);
if (!function_exists('plguri')) {
/**
* 生成插件后台 URL 地址
* @param string $url 路由地址
* @param array $vars PATH 变量
* @param boolean|string $suffix 后缀
* @param boolean|string $domain 域名
* @return string
*/
function plguri(string $url = '', array $vars = [], $suffix = true, $domain = false): string
{
$encode = encode(sysvar('CurrentPluginCode'));
return sysuri("layout/{$encode}", [], false) . '#' . url($url, $vars, $suffix, $domain)->build();
}
}
if (!function_exists('random_bgc')) {
function random_bgc(?int $idx = null): string
{
$colors = ['red', 'blue', 'orig', 'green', 'violet', 'purple', 'brown'];
$color = is_null($idx) ? $colors[array_rand($colors)] : $colors[$idx % count($colors)];
return "think-bg-{$color}";
}
}