作者:Graphem
项目:amwa
/**
* Generate a link to a JavaScript file.
*
* @param string $url
* @param array $attributes
* @param bool $secure
* @return string
*/
public static function scriptmod($url, $attributes = array(), $secure = null)
{
$HtmlBuilder = new HtmlBuilder();
$filemtime = @filemtime(@dirname(@$_SERVER['SCRIPT_FILENAME']) . "/" . $url);
$attributes['src'] = asset($url, $secure) . ($filemtime > 0 ? "?" . $filemtime : "");
return '<script' . $HtmlBuilder->attributes($attributes) . '></script>' . PHP_EOL;
}
作者:saveri
项目:laravel-asset
public function boot()
{
if ($this->app->resolved('router') || $this->app->bound('router')) {
$router = $this->app['router'];
$router->get('assets/img/{a?}/{b?}/{c?}/{d?}/{e?}', '\\Assets\\Http\\Controller@img');
$router->get('assets/font/{a?}/{b?}/{c?}/{d?}/{e?}', '\\Assets\\Http\\Controller@font');
$router->get('assets/fonts/{a?}/{b?}/{c?}/{d?}/{e?}', '\\Assets\\Http\\Controller@font');
$router->get('assets/css/{a?}/{b?}/{c?}/{d?}/{e?}', '\\Assets\\Http\\Controller@css');
$router->get('assets/{type}/{a?}/{b?}/{c?}/{d?}/{e?}', '\\Assets\\Http\\Controller@compile');
}
$this->commands('\\Assets\\Console\\PublishCommand', '\\Assets\\Console\\UnpublishCommand');
if (class_exists('\\Illuminate\\Html\\HtmlBuilder')) {
\Illuminate\Html\HtmlBuilder::macro('assetPath', function ($path) {
return Asset::publishedPath($path);
});
}
}
作者:jorzhikgi
项目:MLM-Nexu
/**
* Obfuscate a string to prevent spam-bots from sniffing it.
*
* @param string $value
* @return string
* @static
*/
public static function obfuscate($value)
{
return \Illuminate\Html\HtmlBuilder::obfuscate($value);
}
作者:nmk
项目:basic-starte
/**
* Checks if macro is registered
*
* @param string $name
* @return boolean
* @static
*/
public static function hasMacro($name)
{
return \Illuminate\Html\HtmlBuilder::hasMacro($name);
}
作者:overturelab
项目:men
public function renderAttributes(array $options)
{
if (!empty($options)) {
return $options = $this->html->attributes($options);
} else {
return '';
}
}
作者:leito
项目:rol
/**
* Generate a HTML link to a controller action.
*
* @param string $action
* @param string $title
* @param array $parameters
* @param array $attributes
* @return string
*/
public function linkAction($action, $title = null, $parameters = array(), $attributes = array())
{
if (!$this->manager->hasActionAccess('GET', $action)) {
return;
}
return parent::linkAction($action, $title, $parameters, $attributes);
}
作者:manhvu121
项目:videoplatfor
/**
* Create a button element.
*
* @param string $value
* @param array $options
* @return string
*/
public function button($value = null, $options = array())
{
if (!array_key_exists('type', $options)) {
$options['type'] = 'button';
}
return '<button' . $this->html->attributes($options) . '>' . $value . '</button>';
}
作者:procoder
项目:admi
/**
* @param string $key
* @param string $value
* @return string
*/
protected function attributeElement($key, $value)
{
if (is_array($value)) {
$value = implode(' ', $value);
}
return parent::attributeElement($key, $value);
}
作者:jamalapriad
项目:si
/**
* Create an alert item with optional emphasis.
*
* @param string $type
* @param string $content
* @param string $emphasis
* @param boolean $dismissible
* @param array $attributes
*
* @return string
*/
protected function alert($type = 'message', $content = null, $emphasis = null, $dismissible = false, array $attributes = array())
{
$attributes = array_merge(array('class' => 'alert' . ($dismissible ? ' alert-dismissable' : '') . ' alert-' . ($type != 'message' ? $type : 'default')), $attributes);
$return = '<div ' . $this->html->attributes($attributes) . '>';
if ($dismissible !== null) {
$return .= '<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>';
}
$return .= ($emphasis !== null && is_string($emphasis) ? '<strong>' . $emphasis . '</strong> ' : '') . $content . '</div>';
return $return;
}
作者:charioth
项目:laravel4-sa
public function style($url, $attributes = array(), $secure = null)
{
if ($this->url->isValidUrl($url) or !$this->app->environment('sae')) {
return parent::style($url, $attributes, $secure);
} else {
$defaults = array('media' => 'all', 'type' => 'text/css', 'rel' => 'stylesheet');
$attributes = $attributes + $defaults;
$attributes['href'] = $this->patchUrl($url, $secure, 'style');
return '<link' . $this->attributes($attributes) . '>' . PHP_EOL;
}
}
作者:sohailaammaroc
项目:lf
/**
* Prepare data grid columns.
*
* @param bool $results
* @return array
*/
protected function prepareColumns($model)
{
$el = [];
foreach ($this->dataGridColumns as $attributes) {
$type = array_pull($attributes, 'type');
if ($type) {
if ($type === 'a') {
$elementContent = '<%= r.' . array_pull($attributes, 'content') . ' %>';
$link = $this->html->decode($this->html->link('#', $elementContent, $attributes));
$link = str_replace('href="#"', 'href="<%= r.edit_uri %>"', $link);
$el[] = $link;
} elseif ($type === 'checkbox') {
$checkBoxName = array_pull($attributes, 'name');
$value = array_pull($attributes, 'value');
$value = '<%= r.' . $value . ' %>';
$el[] = $this->html->decode($this->form->checkbox($checkBoxName, $value, null, $attributes));
}
} else {
$el[] = '<%= r.' . array_pull($attributes, 'content') . ' %>';
}
}
return $el;
}
作者:metalmatz
项目:laravel-html-cachebustin
/**
* @param $url
* @param array $attributes
* @param null $secure
* @param bool $force
* @return string
*/
public function scriptBust($url, $attributes = array(), $secure = null, $overrideConfig = true)
{
return parent::script($this->tryBuildBustableUrl($url, $overrideConfig), $attributes, $secure);
}
作者:kiwin
项目:laravel5-men
/**
* Convert HTML attributes into "property = value" pairs.
*
* @param array $attributes
*
* @return string
*/
public function attributes($attributes = array())
{
return $this->html->attributes($attributes);
}
作者:minor
项目:htm
/**
* Create a listing HTML element.
*
* @param string $type
* @param array $list
* @param array $attributes
* @return \Illuminate\Support\HtmlString
*/
protected function listing($type, $list, $attributes = array())
{
return new HtmlString(parent::listing($type, $list, $attributes));
}
作者:gawdl3
项目:asset-prefixe
/**
* Generate a HTTPS HTML link to an asset.
*
* @param string $url
* @param string $title
* @param array $attributes
* @param bool $enablePrefix
* @return string
*/
public function linkSecureAsset($url, $title = null, $attributes = array(), $enablePrefix = true)
{
return parent::linkSecureAsset(($enablePrefix ? $this->prefix : null) . $url, $title, $attributes);
}
作者:acmad
项目:modules-
/**
* Generate a link to a JavaScript file.
*
* @param string $name
* @param string $url
* @param array $attributes
* @return string
*/
public function script($name, $url, $attributes = array(), $secure = false)
{
$attributes['src'] = $this->asset($name, $url, $secure);
return '<script' . $this->html->attributes($attributes) . '></script>' . PHP_EOL;
}
作者:onlystar199
项目:mtd
/**
* Create a new HTML builder instance.
*
* @param \Illuminate\Routing\UrlGenerator $url
* @return void
*/
public function __construct(UrlGenerator $url = null)
{
parent::__construct($url);
}
作者:foxte
项目:met
/**
* Generate a self-closing tag
* @param $tagName
* @param $tagContent
* @param array $tagAttributes
* @return array
*/
private function pairedTag($tagName, $tagContent, $tagAttributes = [])
{
return ['type' => MetaFacade::PAIRED_TAG, 'tag' => $tagName, 'content' => $tagContent, 'attributes' => $this->htmlBuilder->attributes($tagAttributes)];
}
作者:iyowork
项目:form-builde
/**
* @param Element $row
* @return string
*/
public function rowOpen(Element $row)
{
$_atts = $this->htmlBuilder->attributes($row->getAttributes());
return '<div' . $_atts . '><div class="row">';
}
作者:anahkiase
项目:cerberu
/**
* Some shortcuts
*/
public function __call($method, $parameters)
{
// Resource verbs
if (String::endsWith($method, 'Resource')) {
$verb = String::remove($method, 'Resource');
$parameters = Arrays::prepend($parameters, $verb);
return call_user_func_array(array($this, 'resource'), $parameters);
}
return parent::__call($method, $parameters);
}