本文整理汇总了PHP中Illuminate\Routing\UrlGenerator::asset方法的典型用法代码示例。如果您正苦于以下问题:PHP UrlGenerator::asset方法的具体用法?PHP UrlGenerator::asset怎么用?PHP UrlGenerator::asset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Routing\UrlGenerator
的用法示例。
在下文中一共展示了UrlGenerator::asset方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUrl
/**
* {@inheritdoc}
* @throws \Plank\Mediable\Exceptions\MediaUrlException If media's disk is not publicly accessible
*/
public function getUrl()
{
$path = $this->getPublicPath();
$url = $this->getDiskConfig('url');
if ($url) {
if ($this->isInWebroot()) {
$path = $this->media->getDiskPath();
}
return rtrim($url, '/') . '/' . trim($path, '/');
}
return $this->url->asset($path);
}
示例2: asset
/**
* Generate a HTML link to an asset
*
* @param string $url
* @param string $title
* @param array $attributes
* @param bool $https
* @return string
*/
public function asset($url, $title = null, $attributes = array(), $https = null)
{
$url = $this->url->asset($url, $https);
if (is_null($title)) {
$title = $url;
}
return '<a href="' . $url . '"' . $this->attributes($attributes) . '>' . $this->entities($title) . '</a>';
}
示例3: asset
/**
* Generate a URL to an application asset.
*
* @param string $path
* @param bool|null $secure
* @return string
*/
public function asset($path, $secure = null)
{
// add support for remote urls
if (stristr($path, '//') !== false) {
return $path;
}
$path = $this->fallback($path);
return parent::asset($path, $secure);
}
示例4: asset
public function asset($path, $secure = null)
{
if ($this->manifest->contains($path)) {
$path = $this->manifest->get($path);
if (strpos($path, 'http') === 0 || strpos($path, '//')) {
return $path;
}
}
return parent::asset($path, $secure);
}
示例5: asset
/**
* Generate a URL to an application asset.
*
* @param string $path
* @param bool $secure
* @return string
*/
public function asset($path, $secure = null)
{
// Start looking for a CDN json file
$checkDir = dirname(public_path() . '/' . $path);
// Look up through the directories looking for a
// CDN json file
while ($checkDir !== public_path()) {
$cdnJsonPath = $checkDir . '.cdn.json';
if (File::isFile($cdnJsonPath)) {
$json = File::get($cdnJsonPath);
$cdnObject = json_decode($json);
$baseUrl = $secure || Request::secure() ? $cdnObject->https : $cdnObject->http;
return $baseUrl . '/' . $cdnObject->prefix . '/' . $path;
}
$checkDir = dirname($checkDir);
}
return parent::asset($path, $secure);
}
示例6: asset
/**
* Generate a URL to an application asset.
*
* @param string $path
* @param bool|null $secure
* @return string
*/
public function asset($path, $secure = null)
{
if ($this->isValidUrl($path)) {
return $path;
}
if (!LanguageDetector::isRtl()) {
return parent::asset($path, $secure);
}
if (!strpos($path, '/rtlweb/rtler/assets/css/rtl.css')) {
$backendUri = Config::get('cms.backendUri', 'backend');
$requestUrl = Request::url();
if (File::exists(base_path(dirname($path)) . '.rtl.' . File::extension($path))) {
$path = dirname($path) . '.rtl.' . File::extension($path);
} else {
if (File::extension($path) == 'css' && (strpos($requestUrl, $backendUri) || strpos($path, 'plugins/') || strpos($path, 'modules/'))) {
$path = CssFlipper::flipCss($path);
}
}
}
return parent::asset($path, $secure);
}
示例7: asset
/**
* Generate a URL to an application asset.
*
* @param string $path
* @param bool|null $secure
* @return string
* @static
*/
public static function asset($path, $secure = null)
{
return \Illuminate\Routing\UrlGenerator::asset($path, $secure);
}
示例8: image
/**
* Create a HTML image input element.
*
* @param string $url
* @param string $name
* @param array $attributes
* @return string
*/
public function image($url, $name = null, $attributes = array())
{
$attributes['src'] = $this->url->asset($url);
return $this->input('image', $name, null, $attributes);
}
示例9: linkAsset
/**
* Generate a HTML link to an asset.
*
* @param string $url
* @param string $title
* @param array $attributes
* @param bool $secure
* @return string
*/
public function linkAsset($url, $title = null, $attributes = array(), $secure = null)
{
$url = $this->url->asset($url, $secure);
return $this->link($url, $title ?: $url, $attributes, $secure);
}
示例10: routeToAsset
/**
* @param string $asset
* @return string
*/
public function routeToAsset($asset)
{
return $this->urlGenerator->asset('packages/sleeping-owl/admin/' . $asset);
}
示例11: getPathUrl
/**
* Returns the corresponding URL for the given fully qualified path.
* If a URL cannot be determined a Runtime Exception is thrown.
*
* @param string $path
* @return string
* @throws \RuntimeException
*/
public function getPathUrl($path)
{
$path = $this->stripPublicPath($path);
return $this->urlGenerator->asset($this->removeWindowsSeparator($path));
}
示例12: asset
/**
* Generate a asset url for the specified module.
*
* @param string $name
* @param string $url
* @param boolean $secure
* @return string
*/
public function asset($name, $url, $secure = false)
{
return $this->url->asset(basename($this->getAssetsPath()) . "/{$name}/" . $url, $secure);
}
示例13: outputJsInBlade
/**
* @return string
*/
public function outputJsInBlade()
{
$path = $this->compileScriptMaterial();
return '<script src="' . $this->url->asset($path) . '"></script>';
}
示例14: asset
public function asset($path, $secure = null)
{
return parent::asset(static::revPath($path), $secure);
}