當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Html\HtmlBuilder類代碼示例

本文整理匯總了PHP中Collective\Html\HtmlBuilder的典型用法代碼示例。如果您正苦於以下問題:PHP HtmlBuilder類的具體用法?PHP HtmlBuilder怎麽用?PHP HtmlBuilder使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了HtmlBuilder類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: 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

示例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->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

示例8: 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

示例9: 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

示例10: 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

示例11: 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 .= '&nbsp;' . $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

示例12: 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

示例13: 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

示例14: 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

示例15: 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


注:本文中的Collective\Html\HtmlBuilder類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。