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


PHP Horde_Url::setScheme方法代码示例

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


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

示例1: testUrlMissingScheme

 public function testUrlMissingScheme()
 {
     $url = new Horde_Url('example.com/test?foo=1&bar=2');
     $url->setScheme();
     $this->assertEquals('/test?foo=1&bar=2', $url->toString(true, false));
     $this->assertEquals('http://example.com/test?foo=1&bar=2', $url->toString(true, true));
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:7,代码来源:TostringTest.php

示例2: _node

 /**
  */
 protected function _node($doc, $node)
 {
     parent::_node($doc, $node);
     if (empty($this->_imptmp) || !$node instanceof DOMElement) {
         if ($node instanceof DOMText && $node->length > 1) {
             /* Filter bad language. */
             $text = IMP::filterText($node->data);
             if ($node->data != $text) {
                 $node->replaceData(0, $node->length, $text);
             }
         }
         return;
     }
     $tag = Horde_String::lower($node->tagName);
     /* Remove 'height' styles from HTML messages, because it can break
      * sizing of IFRAME. */
     foreach ($node->attributes as $key => $val) {
         if ($key == 'style') {
             /* Do simplistic style parsing here. */
             $parts = array_filter(explode(';', $val->value));
             foreach ($parts as $k2 => $v2) {
                 if (preg_match("/^\\s*height:\\s*/i", $v2)) {
                     unset($parts[$k2]);
                 }
             }
             $val->value = implode(';', $parts);
         }
     }
     switch ($tag) {
         case 'a':
         case 'area':
             /* Convert links to open in new windows. Ignore mailto: links and
              * links that already have a target. */
             if ($node->hasAttribute('href')) {
                 $url = parse_url($node->getAttribute('href'));
                 if (isset($url['scheme']) && $url['scheme'] == 'mailto') {
                     /* We don't include HordePopup in IFRAME, so need to use
                      * 'simple' links. */
                     $clink = new IMP_Compose_Link($node->getAttribute('href'));
                     $node->setAttribute('href', $clink->link(true));
                     $node->removeAttribute('target');
                 } elseif (!empty($this->_imptmp['inline']) && isset($url['fragment']) && empty($url['path']) && $GLOBALS['browser']->isBrowser('mozilla')) {
                     /* See Bug #8695: internal anchors are broken in
                      * Mozilla. */
                     $node->removeAttribute('href');
                 } elseif (empty($url)) {
                     /* Empty URL - remove href/target so the link is not
                      * clickable. */
                     $node->removeAttribute('href');
                     $node->removeAttribute('target');
                 } else {
                     $node->setAttribute('target', strval(new Horde_Support_Randomid()));
                 }
             }
             break;
         case 'body':
             $style = $node->hasAttribute('style') ? rtrim($node->getAttribute('style'), ';') . ';' : '';
             $node->setAttribute('style', $style . 'width:auto !important');
             break;
         case 'img':
         case 'input':
             if ($node->hasAttribute('src')) {
                 $val = $node->getAttribute('src');
                 /* Multipart/related. */
                 if ($tag == 'img' && ($id = $this->_cidSearch($val))) {
                     $val = $this->getConfigParam('imp_contents')->urlView(null, 'view_attach', array('params' => array('ctype' => 'image/*', 'id' => $id, 'imp_img_view' => 'data')));
                 }
                 /* Block images.*/
                 if ($this->_imgBlock()) {
                     if (Horde_Url_Data::isData($val)) {
                         $url = new Horde_Url_Data($val);
                     } else {
                         /* Check for relative URLs. These won't be loaded and
                          * will cause unnecessary 404 hits to the local web
                          * server. */
                         $parsed_url = parse_url($val);
                         if (isset($parsed_url['host'])) {
                             $url = new Horde_Url($val);
                             $url->setScheme();
                         } else {
                             $url = null;
                         }
                     }
                     if ($url) {
                         $node->setAttribute(self::IMGBLOCK, $url);
                         $node->setAttribute('src', $this->_imgBlockImg());
                         $this->_imptmp['imgblock'] = true;
                     } else {
                         $node->parentNode->removeChild($node);
                         $this->_imptmp['imgbroken'] = true;
                     }
                 } else {
                     $node->removeAttribute('src');
                     $node->setAttribute('data-src', $val);
                 }
             }
             /* IMG only */
             if ($tag == 'img' && $this->_imgBlock() && $node->hasAttribute('srcset')) {
//.........这里部分代码省略.........
开发者ID:jubinpatel,项目名称:horde,代码行数:101,代码来源:Html.php


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