/** * @param Currency $currency * * @return string */ public function getTransactionLink(Currency $currency) { if ($this->category == 'move') { return ''; } if ($currency->explorer) { return HTML::link(str_replace('%id', $this->txid, $currency->explorer), Str::limit($this->txid, 20), ['target' => '_blank']) . " <span class='fa fa-new-window'></span>"; } return HTML::link('#', Str::limit($this->txid, 20), ['data-toggle' => 'tooltip', 'title' => $this->txid]); }
/** * @param string $url * @param string $name * @param string $position * @param array $attributes * * @return $this */ public function link($url, $name, $position = "BL", $attributes = array()) { $match_url = trim(parse_url($url, PHP_URL_PATH), '/'); if (Request::path() != $match_url) { $url = Persistence::get($match_url); } $attributes = array_merge(array("class" => "btn btn-default"), $attributes); $this->button_container[$position][] = HTML::link($url, $name, $attributes); $this->links[] = $url; return $this; }
<?php /** Setting up for Namespacing **/ use Illuminate\Support\Facades\HTML; // Inspired by: http://forums.laravel.io/viewtopic.php?id=827 HTML::macro('nav_item', function ($url, $text, $a_attr = array(), $active_class = 'active', $li_attrs = array()) { $href = HTML::link($url, $text, $a_attr); $response = ''; if (Request::is($url) || Request::is($url . '/*')) { if (isset($li_attrs['class'])) { $li_attrs['class'] .= ' ' . $active_class; } else { $li_attrs['class'] = $active_class; } } return '<li ' . HTML::attributes($li_attrs) . '>' . $href . '</li>'; });
/** * 保存编辑数据 * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id) { // $item = static::queryAll()->find($id); if (null === $item) { KMessager::push('找不到对应的数据', KMessager::ERROR); return Redirect::action(static::$action . '.show.index'); } $form = $this->_form($id, $item); if ($form->validation()) { // validate ok $this->fireCMSControllerEvent('updating', [$form, $item, $id]); $this->_store($form, $item, $id); $link = ''; try { $link .= HTML::link(URL::action(static::$action . '.show.detail', [$item->id]), ' 查看详情 ', ['target' => '_blank']); } catch (InvalidArgumentException $e) { $link .= ''; } $url = \HTMLize::create($item)->url(); if ('javascript:;' != $url && $url) { $link .= HTML::link($url, ' 查看网页 ', ['target' => '_blank']); } try { $url = URL::action(static::$action . '.edit.form', [$item->id]); } catch (InvalidArgumentException $e) { $url = null; } if ($url) { $link .= HTML::link($url, ' 重新编辑 ', ['target' => '_blank']); } KMessager::push('更新记录成功' . $link); return Redirect::action(static::$action . '.show.index'); } else { // 以下方式会导致chrome崩溃掉... //Session::flash( 'flashdata_create_form' , $form ); //return Redirect::action( static::$action . '.create' ); $this->layout->content = View::make('laravel-cms::cms/form')->with('form', $form); } }
public function link($url, $title = null, $attributes = array()) { $tag = HTML::link($url, self::REPLACEMENT, $attributes); return $this->replace($title, $tag); }