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


PHP Texy::escapeHtml方法代码示例

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


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

示例1: solve

 public function solve($invocation, $phrase, $content, $mod, $link)
 {
     $tx = $this->texy;
     $tag = isset($this->tags[$phrase]) ? $this->tags[$phrase] : NULL;
     if ($tag === 'a') {
         $tag = $link && $this->linksAllowed ? NULL : 'span';
     }
     if ($phrase === 'phrase/code') {
         $content = $tx->protect(Texy::escapeHtml($content), Texy::CONTENT_TEXTUAL);
     }
     if ($phrase === 'phrase/strong+em') {
         $el = TexyHtml::el($this->tags['phrase/strong']);
         $el->create($this->tags['phrase/em'], $content);
         $mod->decorate($tx, $el);
     } elseif ($tag) {
         $el = TexyHtml::el($tag)->setText($content);
         $mod->decorate($tx, $el);
         if ($tag === 'q') {
             $el->attrs['cite'] = $mod->cite;
         }
     } else {
         $el = $content;
     }
     if ($link && $this->linksAllowed) {
         return $tx->linkModule->solve(NULL, $link, $el);
     }
     return $el;
 }
开发者ID:radimklaska,项目名称:Drupal.cz,代码行数:28,代码来源:texy.compact.5.php

示例2: 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


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