Source of file Script.php
Size: 0,759 Bytes - Last Modified: 2017-11-08T13:54:24+00:00
/home/travis/build/bluzphp/framework/src/View/Helper/Script.php
12345678910111213141516171819202122232425262728293031323334353637 | <?php /** * Bluz Framework Component * * @copyright Bluz PHP Team * @link https://github.com/bluzphp/framework */ declare(strict_types=1); namespace Bluz\View\Helper; use Bluz\View\View; /** * Generate HTML for <script> element * * @param string $src * @param array $attributes HTML attributes * * @return string */ return function ($src, array $attributes = []) { /** * @var View $this */ if (strpos($src, 'http://') !== 0 && strpos($src, 'https://') !== 0 && strpos($src, '//') !== 0 ) { $src = $this->baseUrl($src); } $attributes = $this->attributes($attributes); return "<script src=\"$src\" $attributes></script>\n"; }; |