Inheritance: use trait Illuminate\Support\Traits\Macroable, use trait Collective\Html\Componentable
Esempio n. 1
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->settings->value('anomaly.module.posts::module_segment', 'posts'), $this->settings->value('anomaly.module.posts::tag_segment', 'tag'), $label]), $label, $attributes);
     }, (array) $this->object->getTags());
 }
Esempio n. 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());
 }
 /**
  * Return the obfuscated email.
  *
  * @return null|string
  */
 public function obfuscated()
 {
     if (!($email = $this->object->getValue())) {
         return null;
     }
     return $this->html->obfuscate($email);
 }
 /**
  * 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);
 }
 /**
  * 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);
 }
 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')]);
 }
Esempio n. 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()]);
 }
 /**
  * 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>';
 }
Esempio n. 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);
 }
 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>';
     });
 }
Esempio n. 11
0
 /**
  * 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);
 }
Esempio n. 12
0
 /**
  * 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));
 }
Esempio n. 13
0
 /**
  * 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;
 }
Esempio n. 14
0
 /**
  * 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>');
 }
 /**
  * Create <script> tag for a reCAPTCHA widget
  *
  * @param  array $options
  *
  * @return string
  */
 public function script()
 {
     return $this->html->script($this->jsApi);
 }
Esempio n. 16
0
<?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) {
        }
    }
});
Esempio n. 17
0
 public function __construct(Config $config, View $view, UrlGenerator $url = null)
 {
     parent::__construct($url);
     $this->view = $view;
     $this->config = $config;
 }
Esempio n. 18
0
 /**
  * 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);
 }
Esempio n. 19
0
 /**
  * Checks if macro is registered.
  *
  * @param string $name
  * @return bool 
  * @static 
  */
 public static function hasMacro($name)
 {
     return \Collective\Html\HtmlBuilder::hasMacro($name);
 }
 /**
  * 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>';
 }
Esempio n. 21
0
 /**
  * Converts the defined attributes into HTML.
  *
  * @param  array  $attributes
  * @return string
  */
 public function attributes($attributes = array())
 {
     return $this->html->attributes($attributes);
 }
Esempio n. 22
0
 /**
  * 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);
 }
Esempio n. 23
0
 /**
  * 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}>";
 }
Esempio n. 24
0
 /**
  * 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);
 }
Esempio n. 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>';
 }
Esempio n. 26
0
 /**
  * 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>';
 }
Esempio n. 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>';
 }