|
@@ -318,7 +318,7 @@ class Asset
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (mb_strpos($name, '@') !== 0) {
|
|
if (mb_strpos($name, '@') !== 0) {
|
|
|
- $name = '@' . $name;
|
|
|
|
|
|
|
+ $name = '@'.$name;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$this->alias[$name] = $value;
|
|
$this->alias[$name] = $value;
|
|
@@ -340,7 +340,7 @@ class Asset
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (mb_strpos($alias, '@') !== 0) {
|
|
if (mb_strpos($alias, '@') !== 0) {
|
|
|
- $alias = '@' . $alias;
|
|
|
|
|
|
|
+ $alias = '@'.$alias;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$this->js($this->alias[$alias]['js'] ?? null);
|
|
$this->js($this->alias[$alias]['js'] ?? null);
|
|
@@ -354,7 +354,7 @@ class Asset
|
|
|
*/
|
|
*/
|
|
|
public function css($css)
|
|
public function css($css)
|
|
|
{
|
|
{
|
|
|
- if (!$css) {
|
|
|
|
|
|
|
+ if (! $css) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
$this->css = array_merge(
|
|
$this->css = array_merge(
|
|
@@ -384,7 +384,7 @@ class Asset
|
|
|
*/
|
|
*/
|
|
|
public function js($js)
|
|
public function js($js)
|
|
|
{
|
|
{
|
|
|
- if (!$js) {
|
|
|
|
|
|
|
+ if (! $js) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
$this->js = array_merge(
|
|
$this->js = array_merge(
|
|
@@ -409,7 +409,7 @@ class Asset
|
|
|
|
|
|
|
|
$paths = isset($this->alias[$path][$type]) ? (array) $this->alias[$path][$type] : null;
|
|
$paths = isset($this->alias[$path][$type]) ? (array) $this->alias[$path][$type] : null;
|
|
|
|
|
|
|
|
- if (!$paths) {
|
|
|
|
|
|
|
+ if (! $paths) {
|
|
|
return $paths;
|
|
return $paths;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -429,14 +429,14 @@ class Asset
|
|
|
*/
|
|
*/
|
|
|
public function url($path)
|
|
public function url($path)
|
|
|
{
|
|
{
|
|
|
- if (!$path) {
|
|
|
|
|
|
|
+ if (! $path) {
|
|
|
return $path;
|
|
return $path;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$path = $this->getRealPath($path);
|
|
$path = $this->getRealPath($path);
|
|
|
|
|
|
|
|
if (mb_strpos($path, '//') === false) {
|
|
if (mb_strpos($path, '//') === false) {
|
|
|
- $path = config('admin.assets_server') . '/' . trim($path, '/');
|
|
|
|
|
|
|
+ $path = config('admin.assets_server').'/'.trim($path, '/');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return (config('admin.https') || config('admin.secure')) ? secure_asset($path) : asset($path);
|
|
return (config('admin.https') || config('admin.secure')) ? secure_asset($path) : asset($path);
|
|
@@ -451,7 +451,7 @@ class Asset
|
|
|
*/
|
|
*/
|
|
|
public function getRealPath(?string $path)
|
|
public function getRealPath(?string $path)
|
|
|
{
|
|
{
|
|
|
- if (!$this->containsAlias($path)) {
|
|
|
|
|
|
|
+ if (! $this->containsAlias($path)) {
|
|
|
return $path;
|
|
return $path;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -459,7 +459,7 @@ class Asset
|
|
|
'/',
|
|
'/',
|
|
|
array_map(
|
|
array_map(
|
|
|
function ($v) {
|
|
function ($v) {
|
|
|
- if (!$this->isPathAlias($v)) {
|
|
|
|
|
|
|
+ if (! $this->isPathAlias($v)) {
|
|
|
return $v;
|
|
return $v;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -513,7 +513,7 @@ class Asset
|
|
|
*/
|
|
*/
|
|
|
public function headerJs($js)
|
|
public function headerJs($js)
|
|
|
{
|
|
{
|
|
|
- if (!$js) {
|
|
|
|
|
|
|
+ if (! $js) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -543,7 +543,7 @@ class Asset
|
|
|
*/
|
|
*/
|
|
|
public function script($script, bool $direct = false)
|
|
public function script($script, bool $direct = false)
|
|
|
{
|
|
{
|
|
|
- if (!$script) {
|
|
|
|
|
|
|
+ if (! $script) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
if ($direct) {
|
|
if ($direct) {
|
|
@@ -560,7 +560,7 @@ class Asset
|
|
|
*/
|
|
*/
|
|
|
public function style($style)
|
|
public function style($style)
|
|
|
{
|
|
{
|
|
|
- if (!$style) {
|
|
|
|
|
|
|
+ if (! $style) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
$this->style = array_merge($this->style, (array) $style);
|
|
$this->style = array_merge($this->style, (array) $style);
|
|
@@ -601,7 +601,7 @@ class Asset
|
|
|
$html = '';
|
|
$html = '';
|
|
|
|
|
|
|
|
foreach (array_unique($this->css) as &$v) {
|
|
foreach (array_unique($this->css) as &$v) {
|
|
|
- if (!$paths = $this->get($v, 'css')) {
|
|
|
|
|
|
|
+ if (! $paths = $this->get($v, 'css')) {
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -620,13 +620,13 @@ class Asset
|
|
|
*/
|
|
*/
|
|
|
public function withVersionQuery($url)
|
|
public function withVersionQuery($url)
|
|
|
{
|
|
{
|
|
|
- if (!Str::contains($url, '?')) {
|
|
|
|
|
|
|
+ if (! Str::contains($url, '?')) {
|
|
|
$url .= '?';
|
|
$url .= '?';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- $ver = 'v' . Admin::VERSION;
|
|
|
|
|
|
|
+ $ver = 'v'.Admin::VERSION;
|
|
|
|
|
|
|
|
- return Str::endsWith($url, '?') ? $url . $ver : $url . '&' . $ver;
|
|
|
|
|
|
|
+ return Str::endsWith($url, '?') ? $url.$ver : $url.'&'.$ver;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -651,7 +651,7 @@ class Asset
|
|
|
$html = '';
|
|
$html = '';
|
|
|
|
|
|
|
|
foreach (array_unique($this->js) as &$v) {
|
|
foreach (array_unique($this->js) as &$v) {
|
|
|
- if (!$paths = $this->get($v, 'js')) {
|
|
|
|
|
|
|
+ if (! $paths = $this->get($v, 'js')) {
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -671,7 +671,7 @@ class Asset
|
|
|
$html = '';
|
|
$html = '';
|
|
|
|
|
|
|
|
foreach (array_unique($this->headerJs) as &$v) {
|
|
foreach (array_unique($this->headerJs) as &$v) {
|
|
|
- if (!$paths = $this->get($v, 'js')) {
|
|
|
|
|
|
|
+ if (! $paths = $this->get($v, 'js')) {
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
|