本文整理汇总了PHP中Illuminate\Html\HtmlBuilder类的典型用法代码示例。如果您正苦于以下问题:PHP HtmlBuilder类的具体用法?PHP HtmlBuilder怎么用?PHP HtmlBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HtmlBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: scriptmod
/**
* 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;
}
示例2: boot
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);
});
}
}
示例3: obfuscate
/**
* 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);
}
示例4: hasMacro
/**
* Checks if macro is registered
*
* @param string $name
* @return boolean
* @static
*/
public static function hasMacro($name)
{
return \Illuminate\Html\HtmlBuilder::hasMacro($name);
}
示例5: renderAttributes
public function renderAttributes(array $options)
{
if (!empty($options)) {
return $options = $this->html->attributes($options);
} else {
return '';
}
}
示例6: linkAction
/**
* 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);
}
示例7: button
/**
* 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>';
}
示例8: attributeElement
/**
* @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);
}
示例9: alert
/**
* 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;
}
示例10: style
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;
}
}
示例11: prepareColumns
/**
* 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;
}
示例12: scriptBust
/**
* @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);
}
示例13: attributes
/**
* Convert HTML attributes into "property = value" pairs.
*
* @param array $attributes
*
* @return string
*/
public function attributes($attributes = array())
{
return $this->html->attributes($attributes);
}
示例14: listing
/**
* 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));
}
示例15: linkSecureAsset
/**
* 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);
}