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


PHP Texy::unescapeHtml方法代码示例

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


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

示例1: patternTag

 /**
  * Callback for: <tag attr="...">.
  *
  * @param  TexyLineParser
  * @param  array      regexp matches
  * @param  string     pattern name
  * @return TexyHtml|string|FALSE
  */
 public function patternTag($parser, $matches)
 {
     list(, $mEnd, $mTag, $mAttr, $mEmpty) = $matches;
     // [1] => /
     // [2] => tag
     // [3] => attributes
     // [4] => /
     $tx = $this->texy;
     $isStart = $mEnd !== '/';
     $isEmpty = $mEmpty === '/';
     if (!$isEmpty && substr($mAttr, -1) === '/') {
         // uvizlo v $mAttr?
         $mAttr = substr($mAttr, 0, -1);
         $isEmpty = TRUE;
     }
     // error - can't close empty element
     if ($isEmpty && !$isStart) {
         return FALSE;
     }
     // error - end element with atttrs
     $mAttr = trim(strtr($mAttr, "\n", ' '));
     if ($mAttr && !$isStart) {
         return FALSE;
     }
     $el = TexyHtml::el($mTag);
     if ($isStart) {
         // parse attributes
         $matches2 = NULL;
         preg_match_all('#([a-z0-9:-]+)\\s*(?:=\\s*(\'[^\']*\'|"[^"]*"|[^\'"\\s]+))?()#isu', $mAttr, $matches2, PREG_SET_ORDER);
         foreach ($matches2 as $m) {
             $key = strtolower($m[1]);
             $value = $m[2];
             if ($value == NULL) {
                 $el->attrs[$key] = TRUE;
             } elseif ($value[0] === '\'' || $value[0] === '"') {
                 $el->attrs[$key] = Texy::unescapeHtml(substr($value, 1, -1));
             } else {
                 $el->attrs[$key] = Texy::unescapeHtml($value);
             }
         }
     }
     $res = $tx->invokeAroundHandlers('htmlTag', $parser, array($el, $isStart, $isEmpty));
     if ($res instanceof TexyHtml) {
         return $tx->protect($isStart ? $res->startTag() : $res->endTag(), $res->getContentType());
     }
     return $res;
 }
开发者ID:eduardobenito10,项目名称:jenkins-php-quickstart,代码行数:55,代码来源:TexyHtmlModule.php

示例2: patternPhrase

 public function patternPhrase($parser, $matches, $phrase)
 {
     list(, $mContent, $mMod, $mLink) = $matches;
     $tx = $this->texy;
     $mod = new TexyModifier($mMod);
     $link = NULL;
     $parser->again = $phrase !== 'phrase/code' && $phrase !== 'phrase/quicklink';
     if ($phrase === 'phrase/span' || $phrase === 'phrase/span-alt') {
         if ($mLink == NULL) {
             if (!$mMod) {
                 return FALSE;
             }
         } else {
             $link = $tx->linkModule->factoryLink($mLink, $mMod, $mContent);
         }
     } elseif ($phrase === 'phrase/acronym' || $phrase === 'phrase/acronym-alt') {
         $mod->title = trim(Texy::unescapeHtml($mLink));
     } elseif ($phrase === 'phrase/quote') {
         $mod->cite = $tx->blockQuoteModule->citeLink($mLink);
     } elseif ($mLink != NULL) {
         $link = $tx->linkModule->factoryLink($mLink, NULL, $mContent);
     }
     return $tx->invokeAroundHandlers('phrase', $parser, array($phrase, $mContent, $mod, $link));
 }
开发者ID:radimklaska,项目名称:Drupal.cz,代码行数:24,代码来源:texy.compact.5.php

示例3: patternPhrase

 /**
  * Callback for: **.... .(title)[class]{style}**:LINK.
  *
  * @param  TexyLineParser
  * @param  array      regexp matches
  * @param  string     pattern name
  *
  * @return TexyHtml|string|FALSE
  */
 public function patternPhrase($parser, $matches, $phrase)
 {
     list(, $mContent, $mMod, $mLink) = $matches;
     //    [1] => **
     //    [2] => ...
     //    [3] => .(title)[class]{style}
     //    [4] => LINK
     $tx = $this->texy;
     $mod = new TexyModifier($mMod);
     $link = null;
     $parser->again = $phrase !== 'phrase/code' && $phrase !== 'phrase/quicklink';
     if ($phrase === 'phrase/span' || $phrase === 'phrase/span-alt') {
         if ($mLink == null) {
             if (!$mMod) {
                 return false;
             }
             // means "..."
         } else {
             $link = $tx->linkModule->factoryLink($mLink, $mMod, $mContent);
         }
     } elseif ($phrase === 'phrase/acronym' || $phrase === 'phrase/acronym-alt') {
         $mod->title = trim(Texy::unescapeHtml($mLink));
     } elseif ($phrase === 'phrase/quote') {
         $mod->cite = $tx->blockQuoteModule->citeLink($mLink);
     } elseif ($mLink != null) {
         $link = $tx->linkModule->factoryLink($mLink, null, $mContent);
     }
     return $tx->invokeAroundHandlers('phrase', $parser, array($phrase, $mContent, $mod, $link));
 }
开发者ID:BozzaCoon,项目名称:SPHERE-Framework,代码行数:38,代码来源:TexyPhraseModule.php

示例4: setProperties

 public function setProperties($mod)
 {
     if (!$mod) {
         return;
     }
     $p = 0;
     $len = strlen($mod);
     while ($p < $len) {
         $ch = $mod[$p];
         if ($ch === '(') {
             // title
             $a = strpos($mod, ')', $p) + 1;
             $this->title = Texy::unescapeHtml(trim(substr($mod, $p + 1, $a - $p - 2)));
             $p = $a;
         } elseif ($ch === '{') {
             // style & attributes
             $a = strpos($mod, '}', $p) + 1;
             foreach (explode(';', substr($mod, $p + 1, $a - $p - 2)) as $value) {
                 $pair = explode(':', $value, 2);
                 $prop = strtolower(trim($pair[0]));
                 if ($prop === '' || !isset($pair[1])) {
                     continue;
                 }
                 $value = trim($pair[1]);
                 if (isset(self::$elAttrs[$prop])) {
                     $this->attrs[$prop] = $value;
                 } elseif ($value !== '') {
                     $this->styles[$prop] = $value;
                 }
             }
             $p = $a;
         } elseif ($ch === '[') {
             // classes & ID
             $a = strpos($mod, ']', $p) + 1;
             $s = str_replace('#', ' #', substr($mod, $p + 1, $a - $p - 2));
             foreach (explode(' ', $s) as $value) {
                 if ($value === '') {
                     continue;
                 }
                 if ($value[0] === '#') {
                     $this->id = substr($value, 1);
                 } else {
                     $this->classes[$value] = true;
                 }
             }
             $p = $a;
         } elseif ($ch === '^') {
             $this->vAlign = 'top';
             $p++;
         } elseif ($ch === '-') {
             $this->vAlign = 'middle';
             $p++;
         } elseif ($ch === '_') {
             $this->vAlign = 'bottom';
             $p++;
         } elseif ($ch === '=') {
             $this->hAlign = 'justify';
             $p++;
         } elseif ($ch === '>') {
             $this->hAlign = 'right';
             $p++;
         } elseif (substr($mod, $p, 2) === '<>') {
             $this->hAlign = 'center';
             $p += 2;
         } elseif ($ch === '<') {
             $this->hAlign = 'left';
             $p++;
         } else {
             break;
         }
     }
 }
开发者ID:BozzaCoon,项目名称:SPHERE-Framework,代码行数:72,代码来源:TexyModifier.php

示例5: solve

 /**
  * Finish invocation.
  *
  * @param  TexyHandlerInvocation  handler invocation
  * @param  string   blocktype
  * @param  string   content
  * @param  string   additional parameter
  * @param  TexyModifier
  * @return TexyHtml|string|FALSE
  */
 public function solve($invocation, $blocktype, $s, $param, $mod)
 {
     $tx = $this->texy;
     $parser = $invocation->parser;
     if ($blocktype === 'block/texy') {
         $el = TexyHtml::el();
         $el->parseBlock($tx, $s, $parser->isIndented());
         return $el;
     }
     if (empty($tx->allowed[$blocktype])) {
         return FALSE;
     }
     if ($blocktype === 'block/texysource') {
         $s = Texy::outdent($s);
         if ($s === '') {
             return "\n";
         }
         $el = TexyHtml::el();
         if ($param === 'line') {
             $el->parseLine($tx, $s);
         } else {
             $el->parseBlock($tx, $s);
         }
         $s = $el->toHtml($tx);
         $blocktype = 'block/code';
         $param = 'html';
         // to be continue (as block/code)
     }
     if ($blocktype === 'block/code') {
         $s = Texy::outdent($s);
         if ($s === '') {
             return "\n";
         }
         $s = Texy::escapeHtml($s);
         $s = $tx->protect($s, Texy::CONTENT_BLOCK);
         $el = TexyHtml::el('pre');
         $mod->decorate($tx, $el);
         $el->attrs['class'][] = $param;
         // lang
         $el->create('code', $s);
         return $el;
     }
     if ($blocktype === 'block/default') {
         $s = Texy::outdent($s);
         if ($s === '') {
             return "\n";
         }
         $el = TexyHtml::el('pre');
         $mod->decorate($tx, $el);
         $el->attrs['class'][] = $param;
         // lang
         $s = Texy::escapeHtml($s);
         $s = $tx->protect($s, Texy::CONTENT_BLOCK);
         $el->setText($s);
         return $el;
     }
     if ($blocktype === 'block/pre') {
         $s = Texy::outdent($s);
         if ($s === '') {
             return "\n";
         }
         $el = TexyHtml::el('pre');
         $mod->decorate($tx, $el);
         $lineParser = new TexyLineParser($tx, $el);
         // special mode - parse only html tags
         $tmp = $lineParser->patterns;
         $lineParser->patterns = array();
         if (isset($tmp['html/tag'])) {
             $lineParser->patterns['html/tag'] = $tmp['html/tag'];
         }
         if (isset($tmp['html/comment'])) {
             $lineParser->patterns['html/comment'] = $tmp['html/comment'];
         }
         unset($tmp);
         $lineParser->parse($s);
         $s = $el->getText();
         $s = Texy::unescapeHtml($s);
         $s = Texy::escapeHtml($s);
         $s = $tx->unprotect($s);
         $s = $tx->protect($s, Texy::CONTENT_BLOCK);
         $el->setText($s);
         return $el;
     }
     if ($blocktype === 'block/html') {
         $s = trim($s, "\n");
         if ($s === '') {
             return "\n";
         }
         $el = TexyHtml::el();
         $lineParser = new TexyLineParser($tx, $el);
//.........这里部分代码省略.........
开发者ID:jiripudil,项目名称:texy,代码行数:101,代码来源:TexyBlockModule.php

示例6: patternPhrase

 /**
  * Callback for: **.... .(title)[class]{style}**:LINK.
  *
  * @param  TexyLineParser
  * @param  array      regexp matches
  * @param  string     pattern name
  * @return TexyHtml|string|FALSE
  */
 public function patternPhrase($parser, $matches, $phrase)
 {
     list(, $mContent, $mMod, $mLink) = $matches;
     //    [1] => **
     //    [2] => ...
     //    [3] => .(title)[class]{style}
     //    [4] => LINK
     $tx = $this->texy;
     $mod = new TexyModifier($mMod);
     $link = NULL;
     $html5 = $tx->getOutputMode() === Texy::HTML5 || $tx->getOutputMode() === Texy::HTML5 | Texy::XML;
     if ($html5) {
         $this->tags['phrase/acronym'] = 'abbr';
         $this->tags['phrase/acronym-alt'] = 'abbr';
     }
     $parser->again = $phrase !== 'phrase/code' && $phrase !== 'phrase/quicklink';
     if ($phrase === 'phrase/span' || $phrase === 'phrase/span-alt') {
         if ($mLink == NULL) {
             if (!$mMod) {
                 return FALSE;
             }
             // means "..."
         } else {
             $link = $tx->linkModule->factoryLink($mLink, $mMod, $mContent);
         }
     } elseif ($phrase === 'phrase/acronym' || $phrase === 'phrase/acronym-alt') {
         $mod->title = trim(Texy::unescapeHtml($mLink));
     } elseif ($phrase === 'phrase/quote') {
         $mod->cite = $tx->blockQuoteModule->citeLink($mLink);
     } elseif ($mLink != NULL) {
         $link = $tx->linkModule->factoryLink($mLink, NULL, $mContent);
     }
     return $tx->invokeAroundHandlers('phrase', $parser, array($phrase, $mContent, $mod, $link));
 }
开发者ID:jiripudil,项目名称:texy,代码行数:42,代码来源:TexyPhraseModule.php


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