|
|
@@ -41,8 +41,71 @@ class UrlHelper extends Helper
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Generate URL for given asset file. Depending on options passed provides full URL with domain name.
|
|
|
- * Also calls Helper::assetTimestamp() to add timestamp to local files
|
|
|
+ * Generates URL for given image file.
|
|
|
+ *
|
|
|
+ * Depending on options passed provides full URL with domain name. Also calls
|
|
|
+ * `Helper::assetTimestamp()` to add timestamp to local files.
|
|
|
+ *
|
|
|
+ * @param string|array $path Path string or URL array
|
|
|
+ * @param array $options Options array. Possible keys:
|
|
|
+ * `fullBase` Return full URL with domain name
|
|
|
+ * `pathPrefix` Path prefix for relative URLs
|
|
|
+ * `plugin` False value will prevent parsing path as a plugin
|
|
|
+ * @return string Generated URL
|
|
|
+ */
|
|
|
+ public function image($path, array $options = [])
|
|
|
+ {
|
|
|
+ $pathPrefix = Configure::read('App.imageBaseUrl');
|
|
|
+ return $this->assetUrl($path, $options + compact('pathPrefix'));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Generates URL for given CSS file.
|
|
|
+ *
|
|
|
+ * Depending on options passed provides full URL with domain name. Also calls
|
|
|
+ * `Helper::assetTimestamp()` to add timestamp to local files.
|
|
|
+ *
|
|
|
+ * @param string|array $path Path string or URL array
|
|
|
+ * @param array $options Options array. Possible keys:
|
|
|
+ * `fullBase` Return full URL with domain name
|
|
|
+ * `pathPrefix` Path prefix for relative URLs
|
|
|
+ * `ext` Asset extension to append
|
|
|
+ * `plugin` False value will prevent parsing path as a plugin
|
|
|
+ * @return string Generated URL
|
|
|
+ */
|
|
|
+ public function css($path, array $options = [])
|
|
|
+ {
|
|
|
+ $pathPrefix = Configure::read('App.cssBaseUrl');
|
|
|
+ $ext = '.css';
|
|
|
+ return $this->assetUrl($path, $options + compact('pathPrefix', 'ext'));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Generates URL for given javascript file.
|
|
|
+ *
|
|
|
+ * Depending on options passed provides full URL with domain name. Also calls
|
|
|
+ * `Helper::assetTimestamp()` to add timestamp to local files.
|
|
|
+ *
|
|
|
+ * @param string|array $path Path string or URL array
|
|
|
+ * @param array $options Options array. Possible keys:
|
|
|
+ * `fullBase` Return full URL with domain name
|
|
|
+ * `pathPrefix` Path prefix for relative URLs
|
|
|
+ * `ext` Asset extension to append
|
|
|
+ * `plugin` False value will prevent parsing path as a plugin
|
|
|
+ * @return string Generated URL
|
|
|
+ */
|
|
|
+ public function script($path, array $options = [])
|
|
|
+ {
|
|
|
+ $pathPrefix = Configure::read('App.jsBaseUrl');
|
|
|
+ $ext = '.js';
|
|
|
+ return $this->assetUrl($path, $options + compact('pathPrefix', 'ext'));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Generates URL for given asset file.
|
|
|
+ *
|
|
|
+ * Depending on options passed provides full URL with domain name. Also calls
|
|
|
+ * `Helper::assetTimestamp()` to add timestamp to local files.
|
|
|
*
|
|
|
* @param string|array $path Path string or URL array
|
|
|
* @param array $options Options array. Possible keys:
|