|
|
@@ -29,15 +29,35 @@ class UrlHelper extends Helper
|
|
|
/**
|
|
|
* Returns a URL based on provided parameters.
|
|
|
*
|
|
|
+ * ### Options:
|
|
|
+ *
|
|
|
+ * - `escape`: If false, the URL will be returned unescaped, do only use if it is manually
|
|
|
+ * escaped afterwards before being displayed.
|
|
|
+ * - `fullBase`: If true, the full base URL will be prepended to the result
|
|
|
+ *
|
|
|
* @param string|array|null $url Either a relative string url like `/products/view/23` or
|
|
|
* an array of URL parameters. Using an array for URLs will allow you to leverage
|
|
|
* the reverse routing features of CakePHP.
|
|
|
- * @param bool $full If true, the full base URL will be prepended to the result
|
|
|
+ * @param array|bool $options Array of options; bool `full` for BC reasons.
|
|
|
* @return string Full translated URL with base path.
|
|
|
*/
|
|
|
- public function build($url = null, $full = false)
|
|
|
+ public function build($url = null, $options = false)
|
|
|
{
|
|
|
- return h(Router::url($url, $full));
|
|
|
+ $defaults = [
|
|
|
+ 'fullBase' => false,
|
|
|
+ 'escape' => true,
|
|
|
+ ];
|
|
|
+ if (!is_array($options)) {
|
|
|
+ $options = ['fullBase' => $options];
|
|
|
+ }
|
|
|
+ $options += $defaults;
|
|
|
+
|
|
|
+ $url = Router::url($url, $options['fullBase']);
|
|
|
+ if ($options['escape']) {
|
|
|
+ $url = h($url);
|
|
|
+ }
|
|
|
+
|
|
|
+ return $url;
|
|
|
}
|
|
|
|
|
|
/**
|