Inheritance: use trait Illuminate\Support\Traits\Macroable, use trait Collective\Html\Componentable
コード例 #1
0
ファイル: PostPresenter.php プロジェクト: Wol/posts-module
 /**
  * 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());
 }
コード例 #2
0
 /**
  * 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());
 }
コード例 #3
0
 /**
  * Return the obfuscated email.
  *
  * @return null|string
  */
 public function obfuscated()
 {
     if (!($email = $this->object->getValue())) {
         return null;
     }
     return $this->html->obfuscate($email);
 }
コード例 #4
0
 /**
  * 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);
 }
コード例 #5
0
 /**
  * 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);
 }
コード例 #6
0
 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')]);
 }
コード例 #7
0
 /**
  * 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()]);
 }
コード例 #8
0
 /**
  * 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>';
 }
コード例 #9
0
 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);
 }
コード例 #10
0
 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>';
     });
 }
コード例 #11
0
ファイル: Sorter.php プロジェクト: laravellegends/sorter
 /**
  * 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);
 }
コード例 #12
0
ファイル: Asset.php プロジェクト: huglester/streams-platform
 /**
  * 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));
 }
コード例 #13
0
ファイル: Builder.php プロジェクト: rikardote/agenda
 /**
  * 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;
 }
コード例 #14
0
ファイル: FormBuilder.php プロジェクト: laravie/html
 /**
  * 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>');
 }
コード例 #15
0
 /**
  * Create <script> tag for a reCAPTCHA widget
  *
  * @param  array $options
  *
  * @return string
  */
 public function script()
 {
     return $this->html->script($this->jsApi);
 }
コード例 #16
0
ファイル: hooks.php プロジェクト: hakoncms/hakoncms
<?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) {
        }
    }
});
コード例 #17
0
ファイル: HtmlBuilder.php プロジェクト: jolupeza/wactas
 public function __construct(Config $config, View $view, UrlGenerator $url = null)
 {
     parent::__construct($url);
     $this->view = $view;
     $this->config = $config;
 }
コード例 #18
0
ファイル: _ide_helper.php プロジェクト: blargent/pimplot
 /**
  * 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);
 }
コード例 #19
0
 /**
  * Checks if macro is registered.
  *
  * @param string $name
  * @return bool 
  * @static 
  */
 public static function hasMacro($name)
 {
     return \Collective\Html\HtmlBuilder::hasMacro($name);
 }
コード例 #20
0
 /**
  * Get a form group.
  *
  * @param  string $name
  * @param  string $element
  *
  * @return string
  */
 public function getFormGroup($name = null, $element)
 {
     $options = $this->getFormGroupOptions($name);
     return '<div' . $this->html->attributes($options) . '>' . $element . '</div>';
 }
コード例 #21
0
ファイル: Builder.php プロジェクト: filipac/menus
 /**
  * Converts the defined attributes into HTML.
  *
  * @param  array  $attributes
  * @return string
  */
 public function attributes($attributes = array())
 {
     return $this->html->attributes($attributes);
 }
コード例 #22
0
ファイル: _ide_helper.php プロジェクト: puresolcom/ether
 /**
  * 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);
 }
コード例 #23
0
ファイル: Image.php プロジェクト: jacksun101/streams-platform
 /**
  * Return a source tag.
  *
  * @return string
  */
 public function source()
 {
     $this->addAttribute('srcset', $this->srcset() ?: $this->path() . ' 2x, ' . $this->path() . ' 1x');
     $attributes = $this->html->attributes($this->getAttributes());
     if ($srcset = $this->srcset()) {
         $attributes['srcset'] = $srcset;
     }
     return "<source {$attributes}>";
 }
コード例 #24
0
ファイル: ThemeHtmlBuilder.php プロジェクト: gmonte/midig-cms
 /**
  * Generate a HTML link to an asset.
  *
  * @param  string  $url
  * @param  string  $title
  * @param  array   $attributes
  * @param  bool    $secure
  * @return string
  */
 public function linkAsset($url, $title = null, $attributes = array(), $secure = null)
 {
     return $this->html->linkAsset($this->assetUrl($url), $title, $attributes, $secure);
 }
コード例 #25
0
 /**
  * Get a form group.
  *
  * @param  string  $name
  * @param  string  $element
  * @return string
  */
 public function getFormGroup($name = null, $element, $extra = null)
 {
     $options = $this->getFormGroupOptions($name);
     $element = substr($element, 0, strlen($element) - 6) . $extra . substr($element, -6);
     return '<div' . $this->html->attributes($options) . '>' . $element . '</div>';
 }
コード例 #26
0
ファイル: Builder.php プロジェクト: haster312/laravel_rikkei
 /**
  * Generate DataTable's table html.
  *
  * @param  array $attributes
  * @return string
  */
 public function table(array $attributes = [])
 {
     $this->tableAttributes = array_merge($this->tableAttributes, $attributes);
     return '<table ' . $this->html->attributes($this->tableAttributes) . '></table>';
 }
コード例 #27
0
 /**
  * Generate DataTable's table html
  *
  * @param  array $attributes
  * @return string
  */
 public function table(array $attributes = [])
 {
     $this->tableAttributes = $attributes ?: $this->tableAttributes;
     return '<table' . $this->html->attributes($this->tableAttributes) . '></table>';
 }