コード例 #1
0
ファイル: LinkTo.php プロジェクト: SandeepUmredkar/PortalSMIP
 public function __toString()
 {
     if ($this->view instanceof App_Mail_View && $this->view->getType() === App_Mail_View::MAIL_TYPE_PLAIN_TEXT) {
         return $this->constructUrl();
     }
     return parent::__toString();
 }
コード例 #2
0
ファイル: LinkTo.php プロジェクト: SandeepUmredkar/PortalSMIP
 public function setHref($href, $absolute = FALSE)
 {
     if ($href == '<front>') {
         $href = $this->view->baseUrl('/');
     } else {
         if (@preg_match("/^\\<current\\>(?P<url>\\/.*)?\$/", $href, $matches)) {
             $href = $this->view->url() . (isset($matches['url']) ? $matches['url'] : '');
         } else {
             if (is_array($href) && isset($href['controller']) && isset($href['action'])) {
                 $params = array('controller' => $href['controller'], 'action' => $href['action']);
                 if (isset($href['params'])) {
                     $params += $href['params'];
                 }
                 if (isset($href['module'])) {
                     $params['module'] = $href['module'];
                 }
                 if (null === self::$_urlHelper) {
                     self::$_urlHelper = Zend_Controller_Action_HelperBroker::getStaticHelper('Url');
                 }
                 $href = self::$_urlHelper->url($params, isset($href['route']) ? $href['route'] : null, TRUE);
             } else {
                 if (@preg_match('/^(?P<href>(?:http|mailto|ftp|https|ftps|ssh|news|skype|msn|jabber|apt|irc):.*?)(?:\\?(?P<arguments>.*?(?!\\#)))?(?:\\#(?P<anchor>\\w*))?$/', $href, $matches) == TRUE) {
                     $absolute = false;
                     $href = $matches['href'];
                     if (isset($matches['arguments'])) {
                         $this->setArguments($matches['arguments']);
                     }
                     if (isset($matches['anchor'])) {
                         $this->setAnchor($matches['anchor']);
                     }
                 } else {
                     if (@preg_match('/^\\/.*$/', $href) == TRUE) {
                         $href = $this->view->baseUrl($href);
                     } else {
                         $href = $this->view->baseUrl($href);
                     }
                 }
             }
         }
     }
     $this->_data['href'] = $absolute ? $this->view->serverUrl($href) : $href;
     return $this;
 }