[Proposal] Add $secure parameter to script, style and image methods (#3863)
This commit is contained in:
1 parent
1ee86dc424
commit
1f5cb27899
1 file changed
+9
-6
+9
-6
@@ -68,11 +68,12 @@ class HtmlBuilder {
|
||||
*
|
||||
* @param string $url
|
||||
* @param array $attributes
|
||||
* @param bool $secure
|
||||
* @return string
|
||||
*/
|
||||
public function script($url, $attributes = array())
|
||||
public function script($url, $attributes = array(), $secure = null)
|
||||
{
|
||||
$attributes['src'] = $this->url->asset($url);
|
||||
$attributes['src'] = $this->url->asset($url, $secure);
|
||||
|
||||
return '<script'.$this->attributes($attributes).'></script>'.PHP_EOL;
|
||||
}
|
||||
@@ -82,15 +83,16 @@ class HtmlBuilder {
|
||||
*
|
||||
* @param string $url
|
||||
* @param array $attributes
|
||||
* @param bool $secure
|
||||
* @return string
|
||||
*/
|
||||
public function style($url, $attributes = array())
|
||||
public function style($url, $attributes = array(), $secure = null)
|
||||
{
|
||||
$defaults = array('media' => 'all', 'type' => 'text/css', 'rel' => 'stylesheet');
|
||||
|
||||
$attributes = $attributes + $defaults;
|
||||
|
||||
$attributes['href'] = $this->url->asset($url);
|
||||
$attributes['href'] = $this->url->asset($url, $secure);
|
||||
|
||||
return '<link'.$this->attributes($attributes).'>'.PHP_EOL;
|
||||
}
|
||||
@@ -101,13 +103,14 @@ class HtmlBuilder {
|
||||
* @param string $url
|
||||
* @param string $alt
|
||||
* @param array $attributes
|
||||
* @param bool $secure
|
||||
* @return string
|
||||
*/
|
||||
public function image($url, $alt = null, $attributes = array())
|
||||
public function image($url, $alt = null, $attributes = array(), $secure = null)
|
||||
{
|
||||
$attributes['alt'] = $alt;
|
||||
|
||||
return '<img src="'.$this->url->asset($url).'"'.$this->attributes($attributes).'>';
|
||||
return '<img src="'.$this->url->asset($url, $secure).'"'.$this->attributes($attributes).'>';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user