本文整理汇总了PHP中S::unprefix方法的典型用法代码示例。如果您正苦于以下问题:PHP S::unprefix方法的具体用法?PHP S::unprefix怎么用?PHP S::unprefix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类S
的用法示例。
在下文中一共展示了S::unprefix方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: assetPath
function assetPath($url)
{
$url = asset($url);
$base = rtrim(\URL::to_asset(''), '/') . '/';
if (S::unprefix($url, $base)) {
if (strtok($url, '/') === 'bundles') {
$bundle = strtok('/');
$path = strtok(null);
return \Bundle::path($bundle) . 'public' . DS . ltrim($path, '\\/');
} else {
return \path('public') . ltrim($url, '\\/');
}
}
}
示例2: get_index
function get_index()
{
$source = $this->in('source');
if ($this->in('hash') !== static::hash($this->in())) {
return E_DENIED;
}
$source = File::storage($source);
$thumb = static::configure(\ThumbGen::make($source), $this->in());
$regen = $this->in('regen', false);
if ($regen and !$this->can('manager') and !$this->can('thumb.regen')) {
$regen = false;
}
$url = $thumb->scaled($regen);
if (!S::unprefix($url, $thumb->temp())) {
throw new Exception("Cannot determine thumbnail URL from [{$url}].");
}
return Redirect::to(asset("thumbs/{$url}"));
}
示例3: can
function can($feature)
{
$perms = $this->perms;
if (!is_string($feature) or "{$perms}" === '') {
return false;
} elseif ($feature === '') {
return true;
}
$hasWildcards = strrchr(ltrim($perms, '*'), '*') !== false;
$perms = explode(' ', $perms);
$allBut = S::unprefix($perms, array('*'));
if ($feature === '*') {
// Is this a superuser (who can do anything)?
return $allBut and !$perms;
} elseif (!$hasWildcards) {
return (bool) ($allBut ^ in_array($feature, $perms));
} else {
$matched = array_first($perms, function ($i, $perm) use($feature) {
return fnmatch($perm, $feature, FNM_NOESCAPE | FNM_PATHNAME | FNM_CASEFOLD);
});
return (bool) ($allBut ^ !!$matched);
}
}