本文整理汇总了PHP中Collective\Html\HtmlBuilder类的典型用法代码示例。如果您正苦于以下问题:PHP HtmlBuilder类的具体用法?PHP HtmlBuilder怎么用?PHP HtmlBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HtmlBuilder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: boot
public function boot()
{
$config = $this->app['config'];
$autoMinify = $config->get('assets.auto_minify');
if ($autoMinify !== true && $autoMinify !== false) {
$autoMinify = $config->get('app.debug', false);
}
Asset::$autoMinifyDefault = $autoMinify;
foreach ($config->get('assets.compilers', []) as $extensions => $class) {
$options = [];
if (is_array($class)) {
$options = array_get($class, 'options', []);
$class = $class['class'];
}
$compiler = new $class($autoMinify, $options);
foreach (explode(',', $extensions) as $extension) {
Asset::registerCompiler($extension, $compiler);
}
}
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(Console\PublishCommand::class, Console\UnpublishCommand::class, Console\InstallToolchainCommand::class);
if (class_exists('\\Collective\\Html\\HtmlBuilder')) {
\Collective\Html\HtmlBuilder::macro('assetPath', function ($path) {
return Asset::publishedPath($path);
});
}
$this->publishes([$this->configPath => config_path('assets.php')]);
}
开发者ID:shnhrrsn,项目名称:laravel-assets,代码行数:35,代码来源:ServiceProvider.php
示例2: registerHtmlButtonBack
private function registerHtmlButtonBack()
{
HtmlBuilder::macro('button_back', function () {
return '<a href="javascript:history.back()" class="btn btn-primary">
<span class="glyphicon glyphicon-back-arrow-left"></span> Retour
</a>';
});
}
开发者ID:WizzerOmega,项目名称:webstock,代码行数:8,代码来源:HtmlFormServiceProvider.php
示例3: function
<?php
use App\Events;
use App\Hooks;
use Collective\Html\HtmlBuilder as Html;
Html::macro("Hook", function ($name = null, $param = null) {
if ($name) {
try {
Event::Fire(new Hooks\Handler($name, $param));
} catch (Exception $e) {
}
}
});
开发者ID:hakoncms,项目名称:hakoncms,代码行数:13,代码来源:hooks.php
示例4: componentCall
/**
* Dynamically handle calls to the class.
*
* @param string $method
* @param array $parameters
* @return \Illuminate\Contracts\View\View|mixed
* @throws \BadMethodCallException
* @static
*/
public static function componentCall($method, $parameters)
{
return \Collective\Html\HtmlBuilder::componentCall($method, $parameters);
}
开发者ID:blargent,项目名称:pimplot,代码行数:13,代码来源:_ide_helper.php
示例5: hasMacro
/**
* Checks if macro is registered.
*
* @param string $name
* @return bool
* @static
*/
public static function hasMacro($name)
{
return \Collective\Html\HtmlBuilder::hasMacro($name);
}
开发者ID:GorshkovNikita,项目名称:EasyCMS,代码行数:11,代码来源:_ide_helper.php
示例6: obfuscate
/**
* Obfuscate a string to prevent spam-bots from sniffing it.
*
* @param string $value
* @return string
* @static
*/
public static function obfuscate($value)
{
return \Collective\Html\HtmlBuilder::obfuscate($value);
}
开发者ID:puresolcom,项目名称:ether,代码行数:11,代码来源:_ide_helper.php
示例7: tagLinks
/**
* Return the tag links.
*
* @param array $attributes
* @return string
*/
public function tagLinks(array $attributes = [])
{
array_set($attributes, 'class', array_get($attributes, 'class', 'label label-default'));
return array_map(function ($label) use($attributes) {
return $this->html->link(implode('/', [$this->settings->value('anomaly.module.posts::module_segment', 'posts'), $this->settings->value('anomaly.module.posts::tag_segment', 'tag'), $label]), $label, $attributes);
}, (array) $this->object->getTags());
}
开发者ID:Wol,项目名称:posts-module,代码行数:13,代码来源:PostPresenter.php
示例8: tagLinks
/**
* Return the tag links.
*
* @param array $attributes
* @return string
*/
public function tagLinks(array $attributes = [])
{
array_set($attributes, 'class', array_get($attributes, 'class', 'label label-default'));
return array_map(function ($label) use($attributes) {
return $this->html->link(implode('/', [$this->config->get('anomaly.module.posts::paths.module'), $this->config->get('anomaly.module.posts::paths.tag'), $label]), $label, $attributes);
}, (array) $this->object->getTags());
}
开发者ID:jacksun101,项目名称:posts-module,代码行数:13,代码来源:PostPresenter.php
示例9: obfuscated
/**
* Return the obfuscated email.
*
* @return null|string
*/
public function obfuscated()
{
if (!($email = $this->object->getValue())) {
return null;
}
return $this->html->obfuscate($email);
}
开发者ID:visualturk,项目名称:email-field_type,代码行数:12,代码来源:EmailFieldTypePresenter.php
示例10: qr_code
/**
* Return an HTML mailto link.
*
* @param null|string $text
* @return null|string
*/
public function qr_code()
{
if (!($user = $this->object->getEntry())) {
return null;
}
$twofa = new Google2FA();
$url = $twofa->getQRCodeGoogleUrl('The%20Linden%20Tree', $user->email, $this->object->getValue());
return $this->html->image($url);
}
开发者ID:minioak,项目名称:twofa-field_type,代码行数:15,代码来源:TwofaFieldTypePresenter.php
示例11: link
/**
* Return a link.
*
* @param null $text
* @return bool
*/
public function link($title = null, $attributes = [])
{
if (!($url = $this->object->getValue())) {
return null;
}
if (!$title) {
$title = $this->object->getValue();
}
return $this->html->link($url, $title, $attributes);
}
开发者ID:AkibaTech,项目名称:url-field_type,代码行数:16,代码来源:UrlFieldTypePresenter.php
示例12: logs
/**
* Log viewer.
*
* @param \Illuminate\Http\Request $request
* @param \Yajra\Datatables\Datatables $datatables
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\View\View|\Symfony\Component\HttpFoundation\BinaryFileResponse
* @throws \Exception
*/
public function logs(Request $request, Datatables $datatables)
{
if ($request->input('l')) {
LaravelLogViewer::setFile(base64_decode($request->input('l')));
}
if ($request->input('dl')) {
return response()->download(LaravelLogViewer::pathToLogFile(base64_decode($request->input('dl'))));
} elseif ($request->has('del')) {
File::delete(LaravelLogViewer::pathToLogFile(base64_decode($request->input('del'))));
return redirect()->to($request->url());
}
$logs = LaravelLogViewer::all();
if ($request->wantsJson()) {
return $datatables->collection(collect($logs))->editColumn('stack', '{!! nl2br($stack) !!}')->editColumn('level', function ($log) {
$content = $this->html->tag('span', '', ['class' => "glyphicon glyphicon-{$log['level_img']}-sign"]);
$content .= ' ' . $log['level'];
return $this->html->tag('span', $content, ['class' => "text-{$log['level_class']}"]);
})->addColumn('content', function ($log) {
$html = '';
if ($log['stack']) {
$html = '<a class="pull-right expand btn btn-default btn-xs"><span class="glyphicon glyphicon-search"></span></a>';
}
$html .= $log['text'];
if (isset($log['in_file'])) {
$html .= '<br>' . $log['in_file'];
}
return $html;
})->make(true);
}
return view('administrator.utilities.log', ['logs' => $logs, 'files' => LaravelLogViewer::getFiles(true), 'current_file' => LaravelLogViewer::getFileName()]);
}
开发者ID:yajra,项目名称:cms-core,代码行数:39,代码来源:UtilitiesController.php
示例13: 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>';
}
开发者ID:GeorgeShazkho,项目名称:micros-de-conce,代码行数:14,代码来源:FormBuilder.php
示例14: linkRouteDefault
public function linkRouteDefault($name, $parameters = [], $attributes = [], $title = null)
{
if (!$title) {
$title = keyVal('desc', app()['router']->getRoutes()->getByName($name)->getAction());
}
return parent::linkRoute($name, $title, $parameters, $attributes);
}
开发者ID:pkirkaas,项目名称:PkExtensions,代码行数:7,代码来源:PkHtmlBuilder.php
示例15: link
/**
* Generates a link for sor url
*
* @param string $field
* @param string|null $name
* @param array $attributes
* @param string|null $path
*
*/
public function link($field, $name = null, array $attributes = [], $path = null)
{
if ($name === null) {
$name = ucwords(strtr($field, ['_' => ' ', '-' => ' ']));
}
$attributes += ['data-laravel-sorter-direction' => $this->getConditionallyDirection($field)];
return $this->html->link($this->url($field, $path), $name, $attributes);
}
开发者ID:laravellegends,项目名称:sorter,代码行数:17,代码来源:Sorter.php
示例16: styles
/**
* Return an array of style tags.
*
* @param $collection
* @param array $filters
* @param array $attributes
* @return array
*/
public function styles($collection, array $filters = [], array $attributes = [])
{
return array_map(function ($path) use($attributes) {
$defaults = ['media' => 'all', 'type' => 'text/css', 'rel' => 'stylesheet'];
$attributes = $attributes + $defaults;
$attributes['href'] = $path;
return '<link' . $this->html->attributes($attributes) . '>';
}, $this->paths($collection, $filters));
}
开发者ID:huglester,项目名称:streams-platform,代码行数:17,代码来源:Asset.php
示例17: compileTableHeaders
/**
* Compile table headers and to support responsive extension.
*
* @return array
*/
private function compileTableHeaders()
{
$th = [];
foreach ($this->collection->toArray() as $row) {
$thAttr = $this->html->attributes(array_only($row, ['class', 'id', 'width', 'style', 'data-class', 'data-hide']));
$th[] = '<th ' . $thAttr . '>' . $row['title'] . '</th>';
}
return $th;
}
开发者ID:rikardote,项目名称:agenda,代码行数:14,代码来源:Builder.php
示例18: button
/**
* Create a button element.
*
* @param string $value
* @param array $options
* @param bool $escape
*
* @return \Illuminate\Support\HtmlString
*/
public function button($value = null, $options = [], $escape = true)
{
if (!array_key_exists('type', $options)) {
$options['type'] = 'button';
}
if ($escape) {
$value = $this->html->entities($value);
}
return $this->toHtmlString('<button' . $this->html->attributes($options) . '>' . $value . '</button>');
}
开发者ID:laravie,项目名称:html,代码行数:19,代码来源:FormBuilder.php
示例19: script
/**
* Create <script> tag for a reCAPTCHA widget
*
* @param array $options
*
* @return string
*/
public function script()
{
return $this->html->script($this->jsApi);
}
开发者ID:noylecorp,项目名称:laravel-recaptcha,代码行数:11,代码来源:RecaptchaBuilder.php
示例20: __construct
public function __construct(Config $config, View $view, UrlGenerator $url = null)
{
parent::__construct($url);
$this->view = $view;
$this->config = $config;
}
开发者ID:jolupeza,项目名称:wactas,代码行数:6,代码来源:HtmlBuilder.php
注:本文中的Collective\Html\HtmlBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论