asset() public method

Generate the URL to an application asset.
public asset ( string $path, boolean | null $secure = null ) : string
$path string
$secure boolean | null
return string
 /**
  * {@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);
 }
 /**
  * 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>';
 }
Beispiel #3
0
 /**
  * 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);
 }
 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);
 }
 /**
  * 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);
 }
Beispiel #6
0
 /**
  * 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);
 }
Beispiel #7
0
 /**
  * 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);
 }
 /**
  * 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);
 }
 /**
  * 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);
 }
Beispiel #10
0
 /**
  * @param string $asset
  * @return string
  */
 public function routeToAsset($asset)
 {
     return $this->urlGenerator->asset('packages/sleeping-owl/admin/' . $asset);
 }
 /**
  * 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));
 }
Beispiel #12
0
 /**
  * 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);
 }
Beispiel #13
0
 /**
  * @return string
  */
 public function outputJsInBlade()
 {
     $path = $this->compileScriptMaterial();
     return '<script src="' . $this->url->asset($path) . '"></script>';
 }
Beispiel #14
0
 public function asset($path, $secure = null)
 {
     return parent::asset(static::revPath($path), $secure);
 }