当前位置: 首页>>代码示例>>PHP>>正文


PHP Tag::linkTo方法代码示例

本文整理汇总了PHP中Phalcon\Tag::linkTo方法的典型用法代码示例。如果您正苦于以下问题:PHP Tag::linkTo方法的具体用法?PHP Tag::linkTo怎么用?PHP Tag::linkTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Phalcon\Tag的用法示例。


在下文中一共展示了Tag::linkTo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: registryFunctions

 /**
  * Registers common function in Twig
  *
  * @param \Phalcon\Mvc\ViewInterface $view
  * @param \Phalcon\DiInterface       $di
  * @param array                      $userFunctions
  */
 protected function registryFunctions($view, DiInterface $di, $userFunctions = array())
 {
     $options = array('is_safe' => array('html'));
     $functions = array(new \Twig_SimpleFunction('content', function () use($view) {
         return $view->getContent();
     }, $options), new \Twig_SimpleFunction('partial', function ($partialPath) use($view) {
         return $view->partial($partialPath);
     }, $options), new \Twig_SimpleFunction('linkTo', function ($parameters, $text = null) {
         return \Phalcon\Tag::linkTo($parameters, $text);
     }, $options), new \Twig_SimpleFunction('textField', function ($parameters) {
         return \Phalcon\Tag::textField($parameters);
     }, $options), new \Twig_SimpleFunction('passwordField', function ($parameters) {
         return \Phalcon\Tag::passwordField($parameters);
     }, $options), new \Twig_SimpleFunction('hiddenField', function ($parameters) {
         return \Phalcon\Tag::hiddenField($parameters);
     }, $options), new \Twig_SimpleFunction('fileField', function ($parameters) {
         return \Phalcon\Tag::fileField($parameters);
     }, $options), new \Twig_SimpleFunction('checkField', function ($parameters) {
         return \Phalcon\Tag::checkField($parameters);
     }, $options), new \Twig_SimpleFunction('radioField', function ($parameters) {
         return \Phalcon\Tag::radioField($parameters);
     }, $options), new \Twig_SimpleFunction('submitButton', function ($parameters) {
         return \Phalcon\Tag::submitButton($parameters);
     }, $options), new \Twig_SimpleFunction('selectStatic', function ($parameters, $data = array()) {
         return \Phalcon\Tag::selectStatic($parameters, $data);
     }, $options), new \Twig_SimpleFunction('select', function ($parameters, $data = array()) {
         return \Phalcon\Tag::select($parameters, $data);
     }, $options), new \Twig_SimpleFunction('textArea', function ($parameters) {
         return \Phalcon\Tag::textArea($parameters);
     }, $options), new \Twig_SimpleFunction('form', function ($parameters = array()) {
         return \Phalcon\Tag::form($parameters);
     }, $options), new \Twig_SimpleFunction('endForm', function () {
         return \Phalcon\Tag::endForm();
     }, $options), new \Twig_SimpleFunction('getTitle', function () {
         return \Phalcon\Tag::getTitle();
     }, $options), new \Twig_SimpleFunction('stylesheetLink', function ($parameters = null, $local = true) {
         return \Phalcon\Tag::stylesheetLink($parameters, $local);
     }, $options), new \Twig_SimpleFunction('javascriptInclude', function ($parameters = null, $local = true) {
         return \Phalcon\Tag::javascriptInclude($parameters, $local);
     }, $options), new \Twig_SimpleFunction('image', function ($parameters) {
         return \Phalcon\Tag::image($parameters);
     }, $options), new \Twig_SimpleFunction('friendlyTitle', function ($text, $separator = null, $lowercase = true) {
         return \Phalcon\Tag::friendlyTitle($text, $separator, $lowercase);
     }, $options), new \Twig_SimpleFunction('getDocType', function () {
         return \Phalcon\Tag::getDocType();
     }, $options), new \Twig_SimpleFunction('getSecurityToken', function () use($di) {
         return $di->get("security")->getToken();
     }, $options), new \Twig_SimpleFunction('getSecurityTokenKey', function () use($di) {
         return $di->get("security")->getTokenKey();
     }, $options), new \Twig_SimpleFunction('url', function ($route) use($di) {
         return $di->get("url")->get($route);
     }, $options));
     if (!empty($userFunctions)) {
         $functions = array_merge($functions, $userFunctions);
     }
     foreach ($functions as $function) {
         $this->twig->addFunction($function);
     }
 }
开发者ID:lisong,项目名称:incubator,代码行数:66,代码来源:Twig.php

示例2: linkTo

 public static function linkTo($parameters, $text = null)
 {
     $tag = parent::linkTo($parameters, $text);
     $url = is_string($parameters) ? $parameters : $parameters[0];
     if (!array_key_exists('scheme', parse_url($url))) {
         return $tag;
     }
     return preg_replace('/^<a\\s+href="[^"]*/', '<a href="' . $url, $tag);
 }
开发者ID:rcardoso81,项目名称:phalcon-api-reference,代码行数:9,代码来源:Tag.php

示例3: checkUserFlags

 public function checkUserFlags(User $user)
 {
     if ($user->active != 'Y') {
         $activate = \Phalcon\Tag::linkTo("signup/sendActivationLink/{$user->id}", 'Send activation link!');
         throw new AuthException("Your account is inactive. {$activate}");
     }
     if ($user->banned != 'N') {
         throw new AuthException("Your account was banned");
     }
 }
开发者ID:adiachenko,项目名称:phstart,代码行数:10,代码来源:AuthComponent.php

示例4: registryFunctions

 /**
  * Registers common function in Twig
  *
  * @param \Phalcon\Mvc\ViewInterface $view
  */
 private function registryFunctions($view)
 {
     $options = array('is_safe' => array('html'));
     $functions = array(new \Twig_SimpleFunction('content', function () use($view) {
         return $view->getContent();
     }, $options), new \Twig_SimpleFunction('partial', function ($partialPath) use($view) {
         return $view->partial($partialPath);
     }, $options), new \Twig_SimpleFunction('linkTo', function ($parameters, $text = null) {
         return \Phalcon\Tag::linkTo($parameters, $text);
     }, $options), new \Twig_SimpleFunction('textField', function ($parameters) {
         return \Phalcon\Tag::textField($parameters);
     }, $options), new \Twig_SimpleFunction('passwordField', function ($parameters) {
         return \Phalcon\Tag::passwordField($parameters);
     }, $options), new \Twig_SimpleFunction('hiddenField', function ($parameters) {
         return \Phalcon\Tag::hiddenField($parameters);
     }, $options), new \Twig_SimpleFunction('fileField', function ($parameters) {
         return \Phalcon\Tag::fileField($parameters);
     }, $options), new \Twig_SimpleFunction('checkField', function ($parameters) {
         return \Phalcon\Tag::checkField($parameters);
     }, $options), new \Twig_SimpleFunction('radioField', function ($parameters) {
         return \Phalcon\Tag::radioField($parameters);
     }, $options), new \Twig_SimpleFunction('submitButton', function ($parameters) {
         return \Phalcon\Tag::submitButton($parameters);
     }, $options), new \Twig_SimpleFunction('selectStatic', function ($parameters, $data = []) {
         return \Phalcon\Tag::selectStatic($parameters, $data);
     }, $options), new \Twig_SimpleFunction('select', function ($parameters, $data = []) {
         return \Phalcon\Tag::select($parameters, $data);
     }, $options), new \Twig_SimpleFunction('textArea', function ($parameters) {
         return \Phalcon\Tag::textArea($parameters);
     }, $options), new \Twig_SimpleFunction('form', function ($parameters = []) {
         return \Phalcon\Tag::form($parameters);
     }, $options), new \Twig_SimpleFunction('endForm', function () {
         return \Phalcon\Tag::endForm();
     }, $options), new \Twig_SimpleFunction('getTitle', function () {
         return \Phalcon\Tag::getTitle();
     }, $options), new \Twig_SimpleFunction('getTitle', function () {
         return \Phalcon\Tag::getTitle();
     }, $options), new \Twig_SimpleFunction('stylesheetLink', function ($parameters = null, $local = true) {
         return \Phalcon\Tag::stylesheetLink($parameters, $local);
     }, $options), new \Twig_SimpleFunction('javascriptInclude', function ($parameters = null, $local = true) {
         return \Phalcon\Tag::javascriptInclude($parameters, $local);
     }, $options), new \Twig_SimpleFunction('image', function ($parameters) {
         return \Phalcon\Tag::image($parameters);
     }, $options), new \Twig_SimpleFunction('friendlyTitle', function ($text, $separator = null, $lowercase = true) {
         return \Phalcon\Tag::friendlyTitle($text, $separator, $lowercase);
     }, $options), new \Twig_SimpleFunction('getDocType', function () {
         return \Phalcon\Tag::getDocType();
     }, $options));
     foreach ($functions as $function) {
         $this->_twig->addFunction($function);
     }
 }
开发者ID:tashik,项目名称:phalcon_core,代码行数:57,代码来源:Twig.php

示例5: initialize

 /**
  * Initializes the controller
  */
 public function initialize()
 {
     Tag::setTitle('Manage Awards');
     parent::initialize();
     $this->_bc->add('Awards', 'awards');
     $auth = $this->session->get('auth');
     $add = '';
     if ($auth) {
         $add = Tag::linkTo(array('awards/add', 'Add Award'));
     }
     $this->view->setVar('addButton', $add);
     $this->view->setVar('menus', $this->constructMenu($this));
 }
开发者ID:vnlita,项目名称:phalcon-angular-harryhogfootball,代码行数:16,代码来源:AwardsController.php

示例6: getTabs

 public function getTabs($sufix = '')
 {
     $controllerName = $this->view->getControllerName();
     $actionName = $this->view->getActionName();
     $tabs = '_tabs' . $sufix;
     echo '<ul class="nav nav-tabs">';
     foreach ($this->{$tabs} as $caption => $option) {
         if ($option['controller'] == $controllerName && ($option['action'] == $actionName || $option['any'])) {
             echo '<li class="active">';
         } else {
             echo '<li>';
         }
         echo \Phalcon\Tag::linkTo('backend/' . $option['controller'] . '/' . $option['action'], $caption), '<li>';
     }
     echo '</ul>';
 }
开发者ID:devsnippet,项目名称:city_site,代码行数:16,代码来源:BackElements.php

示例7: getLink

 /**
  *	Hàm trả về link của phân trang
  *	@return string
  */
 public function getLink($column_search = null)
 {
     if ($this->page->total_pages > 1) {
         $total = $this->page->total_pages;
         $constant = new \Modules\Library\Constant();
         $subtract = $this->page->current - $constant::LIMIT_PAGE;
         $addition = $this->page->current + $constant::LIMIT_PAGE;
         if ($subtract > 0) {
             $start = $subtract;
         } else {
             $start = 1;
         }
         if ($addition <= $total) {
             $end = $addition;
         } else {
             $end = $total;
         }
         $limit = null;
         if (isset($_GET['limit'])) {
             $limit = '&limit=' . (int) $_GET['limit'];
         }
         $search = null;
         if (isset($_GET[$column_search])) {
             $search = "&{$column_search}=" . (string) $_GET[$column_search];
         }
         $str = '';
         $str .= '<ul class="paging">';
         $str .= '<li class="first">' . \Phalcon\Tag::linkTo(array("admin/{$this->controller}/index?page=1{$limit}{$search}", 'Trang đầu', 'class' => 'page gradient')) . '</li>';
         $str .= '<li class="previous">' . \Phalcon\Tag::linkTo(array("admin/{$this->controller}/index?page={$this->page->before}{$limit}{$search}", 'Trang trước', 'class' => 'page gradient')) . '</li>';
         for ($i = $start; $i <= $end; $i++) {
             if ($i != $this->page->current) {
                 $str .= '<li>' . \Phalcon\Tag::linkTo(array("admin/{$this->controller}/index?page={$i}{$limit}{$search}", "{$i}", 'class' => 'page gradient')) . '</li>';
             } else {
                 $str .= '<li><span class="page active">' . $i . '</span></li>';
             }
         }
         $str .= '<li class="next">' . \Phalcon\Tag::linkTo(array("admin/{$this->controller}/index?page={$this->page->next}{$limit}{$search}", 'Trang tiếp', 'class' => 'page gradient')) . '</li>';
         $str .= '<li class="last">' . \Phalcon\Tag::linkTo(array("admin/{$this->controller}/index?page={$this->page->last}{$limit}{$search}", 'Trang cuối', 'class' => 'page gradient')) . '</li>';
         $str .= "</ul>";
         return $str;
     }
     return null;
 }
开发者ID:quyquoc,项目名称:rmt-studio.com,代码行数:47,代码来源:Paginator.php

示例8: getMenuFront

 /**
  * Builds header menu with left and right items
  *
  * @return string
  */
 public function getMenuFront()
 {
     $controllerName = $this->view->getControllerName();
     foreach ($this->_headerMenuFront as $position => $menu) {
         echo '<ul class="nav navbar-nav navbar-right">';
         foreach ($menu as $controller => $option) {
             if ($controllerName == $controller) {
                 echo '<li class="active">';
             } else {
                 echo '<li>';
             }
             if ($controller == "search") {
                 echo $option['caption'];
             } else {
                 echo \Phalcon\Tag::linkTo($controller . '/' . $option['action'], _($option['caption']));
             }
             echo '</li>';
         }
         echo '</ul>';
     }
 }
开发者ID:kjmtrue,项目名称:blog,代码行数:26,代码来源:Elements.php

示例9: restorePasswordAction

 public function restorePasswordAction()
 {
     $form = new RestorePasswordForm();
     if ($this->request->isPost()) {
         if ($form->isValid($this->request->getPost())) {
             $recipient = $this->request->getPost('email');
             $user = User::findFirstByEmail($recipient);
             if ($user) {
                 $code = $this->getRandomToken(true);
                 $user->emailCode = $code;
                 if ($user->save()) {
                     $href = $this->url->getBaseUri() . 'new-password?id=' . $user->id . '&code=' . $code;
                     $subject = 'Restore Password';
                     $body = 'Use the following link to change your password:<br>';
                     $body .= \Phalcon\Tag::linkTo($href, $href);
                     $this->mail->send($recipient, $subject, $body);
                 }
             }
             $this->flash->notice('A link with instructions on how to change an email was send to specified adress');
             return $this->response->redirect('index');
         }
     }
     $this->view->form = $form;
 }
开发者ID:adiachenko,项目名称:phstart,代码行数:24,代码来源:SigninController.php

示例10: testLinkToWithArrayNamed

 /**
  * Tests linkTo with named array as parameters (more than the basic)
  *
  * @author Nikos Dimopoulos <nikos@phalconphp.com>
  * @since  2012-09-08
  */
 public function testLinkToWithArrayNamed()
 {
     $params = array('action' => 'some_url', 'text' => 'some_name', 'class' => 'btn btn-primary');
     $expected = '<a href="/some_url" class="btn btn-primary">some_name</a>';
     $actual = \Phalcon\Tag::linkTo($params);
     $this->assertEquals($expected, $actual, sprintf($this->message, 'linkTo with named array as parameters (full params)'));
 }
开发者ID:lisong,项目名称:cphalcon,代码行数:13,代码来源:UnitTest.php

示例11: getPaginator

 /**
  *	Hàm lấy đường dẫn phân trang của frontend
  * 	@param $controller [string] news->tin-tuc
  *	@param $category [string]	category->the-thao
  *	@param $page [string]
  */
 public function getPaginator($option, $page)
 {
     if ($page->total_pages > 1) {
         $menu_code = null;
         if ($option['menu_code'] == null) {
             $menu_code = null;
         } else {
             $menu_code = '/' . $option['menu_code'];
         }
         switch ($option['style_paginator']) {
             case '1':
                 // Xem them
                 $str = '';
                 $str .= '<div class="pagination><ul class="paging">';
                 $str .= '<li class="next">' . \Phalcon\Tag::linkTo(array("{$option['controller']}{$menu_code}?page={$page->next}", 'Xem thêm', 'class' => 'page gradient')) . '</li>';
                 $str .= "</ul></div>";
                 return $str;
             default:
                 // Binh thuong
                 $total = $page->total_pages;
                 $subtract = $page->current - 3;
                 $addition = $page->current + 3;
                 if ($subtract > 0) {
                     $start = $subtract;
                 } else {
                     $start = 1;
                 }
                 if ($addition <= $total) {
                     $end = $addition;
                 } else {
                     $end = $total;
                 }
                 $str = '<div class="pagination">';
                 $str .= '<ul class="paging">';
                 $str .= '<li class="first">' . \Phalcon\Tag::linkTo(array("{$option['controller']}{$menu_code}?page=1", 'Trang đầu', 'class' => 'page gradient')) . '</li>';
                 $str .= '<li class="previous">' . \Phalcon\Tag::linkTo(array("{$option['controller']}{$menu_code}?page={$page->before}", 'Trang trước', 'class' => 'page gradient')) . '</li>';
                 for ($i = $start; $i <= $end; $i++) {
                     if ($i != $page->current) {
                         $str .= '<li>' . \Phalcon\Tag::linkTo(array("{$option['controller']}{$menu_code}?page={$i}", "{$i}", 'class' => 'page gradient')) . '</li>';
                     } else {
                         $str .= '<li><span class="page active">' . $i . '</span></li>';
                     }
                 }
                 $str .= '<li class="next">' . \Phalcon\Tag::linkTo(array("{$option['controller']}{$menu_code}?page={$page->next}", 'Trang tiếp', 'class' => 'page gradient')) . '</li>';
                 $str .= '<li class="last">' . \Phalcon\Tag::linkTo(array("{$option['controller']}{$menu_code}?page={$page->last}", 'Trang cuối', 'class' => 'page gradient')) . '</li>';
                 $str .= "</ul></div>";
                 return $str;
         }
     }
     return null;
 }
开发者ID:quyquoc,项目名称:rmt-studio.com,代码行数:57,代码来源:Plugin.php

示例12: linkTo

 public static function linkTo($parameters, $text = null, $local = true)
 {
     return parent::linkTo($parameters, $text, $local);
 }
开发者ID:mattvb91,项目名称:cphalcon,代码行数:4,代码来源:Tag.php

示例13: getTagLinks

 /**
  * @return array a list of links that point to the post list filtered by every tag of this post
  */
 public function getTagLinks()
 {
     $links = array();
     foreach (\Helpers\TextHelper::string2array($this->tags) as $tag) {
         $links[] = \Phalcon\Tag::linkTo('posts/index?tags=' . $tag, $tag);
     }
     return $links;
 }
开发者ID:devsnippet,项目名称:city_site,代码行数:11,代码来源:Posts.php

示例14: sortByLink

 /**
  * Returns sort by link for paginated table headers
  *
  * @param CareerCross\View\Helpers\PaginationMeta $meta
  * @param string $action
  * @param string $text
  * @param string $sort_by
  * @return string
  */
 public function sortByLink(PaginationMeta $meta, $action, $text, $sort_by)
 {
     //rebuild the query string if there's an existing one
     $query_params = $this->request->getQuery();
     unset($query_params['_url'], $query_params['submit_search']);
     $query_string = $query_params ? '?' . http_build_query(array_filter($query_params)) : null;
     // Change icon depending on request
     $icon = '<i class="fa fa-sort"></i>';
     if ($meta->orderColumn == $sort_by && $meta->order) {
         $icon = '<i class="fa fa-sort-alpha-desc"></i>';
     } else {
         if ($meta->orderColumn == $sort_by) {
             $icon = '<i class="fa fa-sort-alpha-asc"></i>';
         }
     }
     $page_link = $action . '/' . $sort_by . '/' . (int) (!$meta->order);
     $page_link .= $query_string != '?' ? '/' . $query_string : null;
     return \Phalcon\Tag::linkTo(array($page_link, $text . '&nbsp;' . $icon));
 }
开发者ID:mrbubblesort,项目名称:waitlist,代码行数:28,代码来源:Pagination.php

示例15: send

 public function send(Notifications $notification)
 {
     if ($notification->sent == 'Y') {
         return;
     }
     $post = $notification->post;
     $user = $notification->user;
     if ($notification->type != 'P') {
         $reply = $notification->reply;
     } else {
         $reply = true;
     }
     $from = $this->config->mail->fromEmail;
     $url = rtrim($this->config->site->url, '/');
     if ($post && $user && $reply) {
         $isGitHubEmail = strpos($user->email, '@users.noreply.github.com');
         if ($user->email && $user->notifications != 'N' && false === $isGitHubEmail) {
             try {
                 $message = new \Swift_Message("[{$this->config->site->name} Forum] " . $post->title);
                 $message->setTo([$user->email => $user->name]);
                 $message->addReplyTo('reply-i' . $post->id . '-' . time() . '@phosphorum.com');
                 $e = $this->escaper;
                 if ($notification->type == 'P') {
                     $originalContent = $post->content;
                     $htmlContent = $this->markdown->render($e->escapeHtml($post->content));
                     $message->setFrom([$from => $post->user->name]);
                 } else {
                     $reply = $notification->reply;
                     $originalContent = $reply->content;
                     $htmlContent = $this->markdown->render($e->escapeHtml($reply->content));
                     $message->setFrom([$from => $reply->user->name]);
                 }
                 if (trim($originalContent)) {
                     $textContent = strip_tags($originalContent);
                     $htmlContent .= '<p style="font-size:small;-webkit-text-size-adjust:none;color:#717171;">';
                     $href = "{$url}/discussion/{$post->id}/{$post->slug}";
                     $title = $this->config->site->name;
                     $link = function ($href) use($title) {
                         return Tag::linkTo([$href, $title, "local" => false]);
                     };
                     if ($notification->type == 'P') {
                         $link = $link($href);
                     } else {
                         $link = $link($href . '#C' . $reply->id);
                     }
                     $htmlContent .= '&mdash;<br>Reply to this email directly or view the complete thread on ' . PHP_EOL . $link . PHP_EOL . 'Change your e-mail preferences <a href="' . $url . '/settings">here</a></p>';
                     $bodyMessage = new \Swift_MimePart($htmlContent, 'text/html');
                     $bodyMessage->setCharset('UTF-8');
                     $message->attach($bodyMessage);
                     $bodyMessage = new \Swift_MimePart($textContent, 'text/plain');
                     $bodyMessage->setCharset('UTF-8');
                     $message->attach($bodyMessage);
                     if (!$this->transport) {
                         $this->transport = \Swift_SmtpTransport::newInstance($this->config->smtp->host, $this->config->smtp->port, $this->config->smtp->security);
                         $this->transport->setUsername($this->config->smtp->username);
                         $this->transport->setPassword($this->config->smtp->password);
                     }
                     if (!$this->mailer) {
                         $this->mailer = \Swift_Mailer::newInstance($this->transport);
                     }
                     $this->mailer->send($message);
                 }
             } catch (\Exception $e) {
                 echo $e->getMessage(), PHP_EOL;
             }
         }
     }
     $notification->sent = 'Y';
     if ($notification->save() == false) {
         foreach ($notification->getMessages() as $message) {
             echo $message->getMessage(), PHP_EOL;
         }
     }
 }
开发者ID:phalcon,项目名称:forum,代码行数:74,代码来源:SendSpool.php


注:本文中的Phalcon\Tag::linkTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。