• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Texy类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: blockHandler

/**
 * User handler for code block
 *
 * @param TexyHandlerInvocation  handler invocation
 * @param string  block type
 * @param string  text to highlight
 * @param string  language
 * @param TexyModifier modifier
 * @return TexyHtml
 */
function blockHandler($invocation, $blocktype, $content, $lang, $modifier)
{
    if ($blocktype !== 'block/code') {
        return $invocation->proceed();
    }
    $lang = strtoupper($lang);
    if ($lang == 'JAVASCRIPT') {
        $lang = 'JS';
    }
    $fshl = new fshlParser('HTML_UTF8', P_TAB_INDENT);
    if (!$fshl->isLanguage($lang)) {
        return $invocation->proceed();
    }
    $texy = $invocation->getTexy();
    $content = Texy::outdent($content);
    $content = $fshl->highlightString($lang, $content);
    $content = $texy->protect($content, Texy::CONTENT_BLOCK);
    $elPre = TexyHtml::el('pre');
    if ($modifier) {
        $modifier->decorate($texy, $elPre);
    }
    $elPre->attrs['class'] = strtolower($lang);
    $elCode = $elPre->create('code', $content);
    return $elPre;
}
开发者ID:jiripudil,项目名称:texy,代码行数:35,代码来源:demo-fshl.php


示例2: __construct

 public function __construct(Texy $texy, HtmlElement $element, $indented)
 {
     $this->texy = $texy;
     $this->element = $element;
     $this->indented = (bool) $indented;
     $this->patterns = $texy->getBlockPatterns();
 }
开发者ID:dg,项目名称:texy,代码行数:7,代码来源:BlockParser.php


示例3: createTemplate

 protected function createTemplate($class = NULL)
 {
     $template = parent::createTemplate($class);
     $texy = new \Texy();
     $texy->encoding = 'utf-8';
     $texy->setOutputMode(\Texy::HTML5);
     // config as in \TexyConfigurator::safeMode($texy);
     $safeTags = array('a' => array('href', 'title'), 'acronym' => array('title'), 'b' => array(), 'br' => array(), 'cite' => array(), 'code' => array(), 'em' => array(), 'i' => array(), 'strong' => array(), 'sub' => array(), 'sup' => array(), 'q' => array(), 'small' => array());
     $texy->allowedClasses = \Texy::NONE;
     // no class or ID are allowed
     $texy->allowedStyles = \Texy::NONE;
     // style modifiers are disabled
     $texy->allowedTags = $safeTags;
     // only some "safe" HTML tags and attributes are allowed
     $texy->urlSchemeFilters[\Texy::FILTER_ANCHOR] = '#https?:|ftp:|mailto:#A';
     $texy->urlSchemeFilters[\Texy::FILTER_IMAGE] = '#https?:#A';
     $texy->allowed['image'] = FALSE;
     // disable images
     $texy->allowed['link/definition'] = FALSE;
     // disable [ref]: URL  reference definitions
     $texy->allowed['html/comment'] = FALSE;
     // disable HTML comments
     # zakázaní nadpisů
     $texy->allowed['heading/surrounded'] = FALSE;
     $texy->allowed['heading/underlined'] = FALSE;
     # zalamování textu v odstavcích po enteru
     # false => nebude spojovat řádky, vloží místo enteru <br>
     # true => řádky po jednom enteru spojí
     $texy->mergeLines = false;
     $texy->linkModule->forceNoFollow = TRUE;
     // force rel="nofollow"
     $template->registerHelper('texy', callback($texy, 'process'));
     return $template;
 }
开发者ID:BroukPytlik,项目名称:agility,代码行数:34,代码来源:itemList.php


示例4: commentTexy

 public function commentTexy($text)
 {
     if (!isset($this->commentTexy)) {
         $this->commentTexy = $this->texyFactory->createTexyForComment();
     }
     return $this->commentTexy->process($text);
 }
开发者ID:blitzik,项目名称:CMS,代码行数:7,代码来源:FilterLoader.php


示例5: createTemplate

 protected function createTemplate($class = NULL)
 {
     $template = parent::createTemplate($class);
     $texy = new \Texy();
     $texy->encoding = 'utf-8';
     $texy->setOutputMode(\Texy::HTML5);
     // config as in \TexyConfigurator::safeMode($texy);
     $safeTags = array('a' => array('href', 'title'), 'acronym' => array('title'), 'b' => array(), 'br' => array(), 'cite' => array(), 'code' => array(), 'em' => array(), 'i' => array(), 'strong' => array(), 'sub' => array(), 'sup' => array(), 'q' => array(), 'small' => array());
     $texy->allowedClasses = \Texy::NONE;
     // no class or ID are allowed
     $texy->allowedStyles = \Texy::NONE;
     // style modifiers are disabled
     $texy->allowedTags = $safeTags;
     // only some "safe" HTML tags and attributes are allowed
     $texy->urlSchemeFilters[\Texy::FILTER_ANCHOR] = '#https?:|ftp:|mailto:#A';
     $texy->urlSchemeFilters[\Texy::FILTER_IMAGE] = '#https?:#A';
     $texy->allowed['image'] = FALSE;
     // disable images
     $texy->allowed['link/definition'] = FALSE;
     // disable [ref]: URL  reference definitions
     $texy->allowed['html/comment'] = FALSE;
     // disable HTML comments
     $texy->linkModule->forceNoFollow = TRUE;
     // force rel="nofollow"
     $template->registerHelper('texy', callback($texy, 'process'));
     return $template;
 }
开发者ID:BroukPytlik,项目名称:agility,代码行数:27,代码来源:BaseNormalPresenter.php


示例6: createTemplate

 /**
  * @param null $class
  * @return Nette\Templating\ITemplate
  */
 protected function createTemplate($class = NULL)
 {
     $template = parent::createTemplate($class);
     $template->registerHelper('texy', function ($input) {
         $texy = new \Texy();
         $html = new Nette\Utils\Html();
         return $html::el()->setHtml($texy->process($input));
     });
     $template->registerHelper('vlna', function ($string) {
         $string = preg_replace('<([^a-zA-Z0-9])([ksvzaiou])\\s([a-zA-Z0-9]{1,})>i', "\$1\$2 \$3", $string);
         //&nbsp; === \xc2\xa0
         return $string;
     });
     $template->registerHelper('dateInWords', function ($time) {
         $time = Nette\Utils\DateTime::from($time);
         $months = [1 => 'leden', 'únor', 'březen', 'duben', 'květen', 'červen', 'červenec', 'srpen', 'září', 'říjen', 'listopad', 'prosinec'];
         return $time->format('j. ') . $months[$time->format('n')] . $time->format(' Y');
     });
     $template->registerHelper('timeAgoInWords', function ($time) {
         $time = Nette\Utils\DateTime::from($time);
         $delta = round((time() - $time->getTimestamp()) / 60);
         if ($delta == 0) {
             return 'před okamžikem';
         }
         if ($delta == 1) {
             return 'před minutou';
         }
         if ($delta < 45) {
             return "před {$delta} minutami";
         }
         if ($delta < 90) {
             return 'před hodinou';
         }
         if ($delta < 1440) {
             return 'před ' . round($delta / 60) . ' hodinami';
         }
         if ($delta < 2880) {
             return 'včera';
         }
         if ($delta < 43200) {
             return 'před ' . round($delta / 1440) . ' dny';
         }
         if ($delta < 86400) {
             return 'před měsícem';
         }
         if ($delta < 525960) {
             return 'před ' . round($delta / 43200) . ' měsíci';
         }
         if ($delta < 1051920) {
             return 'před rokem';
         }
         return 'před ' . round($delta / 525960) . ' lety';
     });
     return $template;
 }
开发者ID:krausv,项目名称:www.zeminem.cz,代码行数:59,代码来源:BasePresenter.php


示例7: prepareTemplate

 public static function prepareTemplate(Template $template)
 {
     $texy = new \Texy();
     $latte = $template->getLatte();
     $latte->addFilter('texy', function ($text) use($texy) {
         return Html::el('')->setHtml($texy->process($text));
     });
     $latte->addFilter('time', function ($text) {
         return date('j.n.Y G:i:s', $text);
     });
 }
开发者ID:greeny,项目名称:sandbox,代码行数:11,代码来源:Helpers.php


示例8: createTemplate

 protected function createTemplate()
 {
     $template = parent::createTemplate();
     $template->addFilter('texy', function ($text) {
         $texy = new \Texy();
         $texy->setOutputMode(\Texy::HTML4_TRANSITIONAL);
         $texy->encoding = 'utf-8';
         $texy->allowedTags = array('strong' => \Texy::NONE, 'b' => \Texy::NONE, 'a' => array('href'), 'em' => \Texy::NONE, 'p' => \Texy::NONE);
         //$texy->allowedTags = \Texy::NONE;
         return $texy->process($text);
     });
     return $template;
 }
开发者ID:blitzik,项目名称:vycetky-doctrine,代码行数:13,代码来源:MessageDetailControl.php


示例9: imageHandler

/**
 * User handler for images
 *
 * @param TexyHandlerInvocation  handler invocation
 * @param TexyImage
 * @param TexyLink
 * @return TexyHtml|string|FALSE
 */
function imageHandler($invocation, $image, $link)
{
    $texy = $invocation->getTexy();
    if (substr($image->URL, -4) === '.swf') {
        $movie = Texy::prependRoot($image->URL, $texy->imageModule->root);
        $dimensions = ($image->width ? 'width="' . $image->width . '" ' : '') . ($image->height ? 'width="' . $image->height . '" ' : '');
        $movie = htmlSpecialChars($movie);
        $altContent = htmlSpecialChars($image->modifier->title);
        // @see http://phpfashion.com/how-to-correctly-insert-a-flash-into-xhtml
        $code = '
<!--[if !IE]> -->
<object type="application/x-shockwave-flash" data="' . $movie . '" ' . $dimensions . '>
<!-- <![endif]-->

<!--[if IE]>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ' . $dimensions . '
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0">
<param name="movie" value="' . $movie . '" />
<!--><!--dgx-->

	<p>' . $altContent . '</p>
</object>
<!-- <![endif]-->
';
        return $texy->protect($code, Texy::CONTENT_BLOCK);
    }
    return $invocation->proceed();
}
开发者ID:ppwalks33,项目名称:cleansure,代码行数:36,代码来源:demo.php


示例10: wiki_texy_phraseHandler

function wiki_texy_phraseHandler($invocation, $phrase, $content, $modifier, $link)
{
    if (!$link) {
        return $invocation->proceed();
    }
    if (Texy::isRelative($link->URL)) {
        $link->URL = '?page=' . urlencode($link->URL);
    } elseif (substr($link->URL, 0, 5) === 'wiki:') {
        $link->URL = 'http://en.wikipedia.org/wiki/Special:Search?search=' . urlencode(substr($link->URL, 5));
    } elseif (substr($link->URL, 0, 4) === 'url:') {
        $link->URL = substr($link->URL, 4);
    }
    return $invocation->proceed();
}
开发者ID:Harvie,项目名称:haiwiki,代码行数:14,代码来源:texy.mod.php


示例11: processNewMessageForm

 public function processNewMessageForm(Form $form)
 {
     $values = $form->getValues();
     $recipients = is_array($values->recipients) ? $values->recipients : [$values->recipients];
     if (!$this->authorizator->isAllowed($this->user, 'message', 'sent_to_restricted_recipients')) {
         $s = $this->messagesFacade->canMessageBeSentTo($values->recipients, $this->restrictedUsers, $this->users);
         if ($s === false) {
             $form->addError('Nelze odeslat zprávu vybranému příjemci.');
             return;
         }
     }
     if ($values['isSendAsAdmin'] == true and !$this->authorizator->isAllowed($this->user, 'message', 'send_as_admin')) {
         $form->addError('Nemáte dostatečná oprávnění k akci.');
         return;
     }
     $texy = new \Texy();
     $texy->setOutputMode(\Texy::HTML4_TRANSITIONAL);
     $texy->encoding = 'utf-8';
     $texy->allowedTags = \Texy::ALL;
     $text = $texy->process($values->text);
     $message = new SentMessage($values->subject, $text, $this->user);
     if ($values['isSendAsAdmin']) {
         $message->sendByAuthorRole();
     }
     try {
         $this->messagesFacade->sendMessage($message, $recipients);
     } catch (MessageLengthException $ml) {
         $form->addError('Zprávu nelze uložit, protože je příliš dlouhá.');
         return;
     } catch (DBALException $e) {
         $this->flashMessage('Zpráva nemohla být odeslána. Zkuste akci opakovat později.', 'errror');
         $this->redirect('this');
     }
     $this->presenter->flashMessage('Zpráva byla úspěšně odeslána', 'success');
     $this->presenter->redirect('MailBox:sent');
 }
开发者ID:blitzik,项目名称:vycetky-doctrine,代码行数:36,代码来源:NewMessageControl.php


示例12: phraseHandler

/**
 * @param TexyHandlerInvocation  handler invocation
 * @param string
 * @param string
 * @param TexyModifier
 * @param TexyLink
 * @return TexyHtml|string|FALSE
 */
function phraseHandler($invocation, $phrase, $content, $modifier, $link)
{
    // is there link?
    if (!$link) {
        return $invocation->proceed();
    }
    if (Texy::isRelative($link->URL)) {
        // modifiy link
        $link->URL = 'index?page=' . urlencode($link->URL);
    } elseif (substr($link->URL, 0, 5) === 'wiki:') {
        // modifiy link
        $link->URL = 'http://en.wikipedia.org/wiki/Special:Search?search=' . urlencode(substr($link->URL, 5));
    }
    return $invocation->proceed();
}
开发者ID:eduardobenito10,项目名称:jenkins-php-quickstart,代码行数:23,代码来源:demo.php


示例13: __construct

 public function __construct()
 {
     parent::__construct();
     // safe mode
     \TexyConfigurator::safeMode($this);
     // output
     $this->setOutputMode(self::HTML4_TRANSITIONAL);
     $this->htmlOutputModule->removeOptional = false;
     self::$advertisingNotice = false;
     $this->allowed['heading/surrounded'] = false;
     $this->allowed['heading/underlined'] = false;
     $this->allowed['link/definition'] = false;
     $this->allowed['image/definition'] = false;
     $this->mergeLines = false;
     $this->addHandler('phrase', array(__CLASS__, 'linkHandler'));
 }
开发者ID:janmarek,项目名称:Neuron,代码行数:16,代码来源:SafeTexy.php


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


示例15: __construct

 public function __construct()
 {
     parent::__construct();
     // output
     $this->setOutputMode(self::HTML4_TRANSITIONAL);
     $this->htmlOutputModule->removeOptional = false;
     self::$advertisingNotice = false;
     // safe mode
     TexyConfigurator::safeMode($this);
     $this->allowed['heading/surrounded'] = false;
     $this->allowed['heading/underlined'] = false;
     $this->allowed['link/definition'] = false;
     $this->allowed['image/definition'] = false;
     // spojování textu v odstavcích po enteru
     $this->mergeLines = true;
     // přidání target="_blank" k odkazům
     // $this->addHandler('phrase', array(__CLASS__, 'addTargetHandler'));
 }
开发者ID:darkmoon32,项目名称:Texyla,代码行数:18,代码来源:ForumTexy.php


示例16: solve

 /**
  * Finish invocation.
  *
  * @param  TexyHandlerInvocation  handler invocation
  * @param  string
  * @param  string
  * @return TexyHtml|FALSE
  */
 public function solve($invocation, $emoticon, $raw)
 {
     $tx = $this->texy;
     $file = $this->icons[$emoticon];
     $el = TexyHtml::el('img');
     $el->attrs['src'] = Texy::prependRoot($file, $this->root === NULL ? $tx->imageModule->root : $this->root);
     $el->attrs['alt'] = $raw;
     $el->attrs['class'][] = $this->class;
     // file path
     $file = rtrim($this->fileRoot === NULL ? $tx->imageModule->fileRoot : $this->fileRoot, '/\\') . '/' . $file;
     if (@is_file($file)) {
         // intentionally @
         $size = @getImageSize($file);
         // intentionally @
         if (is_array($size)) {
             $el->attrs['width'] = $size[0];
             $el->attrs['height'] = $size[1];
         }
     }
     $tx->summary['images'][] = $el->attrs['src'];
     return $el;
 }
开发者ID:anagio,项目名称:woocommerce,代码行数:30,代码来源:TexyEmoticonModule.php


示例17: blockHandler

 /**
  * User handler for code block.
  *
  * @param  TexyHandlerInvocation  handler invocation
  * @param  string  block type
  * @param  string  text to highlight
  * @param  string  language
  * @param  TexyModifier modifier
  * @return TexyHtml
  */
 public static function blockHandler($invocation, $blocktype, $content, $lang, $modifier)
 {
     if (preg_match('#^block/(php|neon|javascript|js|css|html|htmlcb|latte)$#', $blocktype)) {
         list(, $lang) = explode('/', $blocktype);
     } elseif ($blocktype !== 'block/code') {
         return $invocation->proceed();
     }
     $lang = strtolower($lang);
     if ($lang === 'htmlcb' || $lang === 'latte') {
         $lang = 'html';
     } elseif ($lang === 'javascript') {
         $lang = 'js';
     }
     if ($lang === 'html') {
         $langClass = 'FSHL\\Lexer\\LatteHtml';
     } elseif ($lang === 'js') {
         $langClass = 'FSHL\\Lexer\\LatteJavascript';
     } else {
         $langClass = 'FSHL\\Lexer\\' . ucfirst($lang);
     }
     $texy = $invocation->getTexy();
     $content = Texy::outdent($content);
     if (class_exists($langClass)) {
         $fshl = new FSHL\Highlighter(new FSHL\Output\Html(), FSHL\Highlighter::OPTION_TAB_INDENT);
         $content = $fshl->highlight($content, new $langClass());
     } else {
         $content = htmlSpecialChars($content);
     }
     $content = $texy->protect($content, Texy::CONTENT_BLOCK);
     $elPre = TexyHtml::el('pre');
     if ($modifier) {
         $modifier->decorate($texy, $elPre);
     }
     $elPre->attrs['class'] = 'src-' . strtolower($lang);
     $elCode = $elPre->create('code', $content);
     return $elPre;
 }
开发者ID:JanTvrdik,项目名称:planette,代码行数:47,代码来源:TexyFactory.php


示例18: blockHandler

/**
 * User handler for code block
 *
 * @param TexyHandlerInvocation  handler invocation
 * @param string  block type
 * @param string  text to highlight
 * @param string  language
 * @param TexyModifier modifier
 * @return TexyHtml
 */
function blockHandler($invocation, $blocktype, $content, $lang, $modifier)
{
    if ($blocktype !== 'block/code') {
        return $invocation->proceed();
    }
    $texy = $invocation->getTexy();
    global $geshiPath;
    if ($lang == 'html') {
        $lang = 'html4strict';
    }
    $content = Texy::outdent($content);
    $geshi = new GeSHi($content, $lang, $geshiPath . 'geshi/');
    // GeSHi could not find the language
    if ($geshi->error) {
        return $invocation->proceed();
    }
    // do syntax-highlighting
    $geshi->set_encoding('UTF-8');
    $geshi->set_header_type(GESHI_HEADER_PRE);
    $geshi->enable_classes();
    $geshi->set_overall_style('color: #000066; border: 1px solid #d0d0d0; background-color: #f0f0f0;', true);
    $geshi->set_line_style('font: normal normal 95% \'Courier New\', Courier, monospace; color: #003030;', 'font-weight: bold; color: #006060;', true);
    $geshi->set_code_style('color: #000020;', 'color: #000020;');
    $geshi->set_link_styles(GESHI_LINK, 'color: #000060;');
    $geshi->set_link_styles(GESHI_HOVER, 'background-color: #f0f000;');
    // save generated stylesheet
    $texy->styleSheet .= $geshi->get_stylesheet();
    $content = $geshi->parse_code();
    // check buggy GESHI, it sometimes produce not UTF-8 valid code :-((
    $content = iconv('UTF-8', 'UTF-8//IGNORE', $content);
    // protect output is in HTML
    $content = $texy->protect($content, Texy::CONTENT_BLOCK);
    $el = TexyHtml::el();
    $el->setText($content);
    return $el;
}
开发者ID:eduardobenito10,项目名称:jenkins-php-quickstart,代码行数:46,代码来源:demo-geshi.php


示例19: imageHandler

 */
function imageHandler($invocation, $image, $link)
{
    $parts = explode(':', $image->URL);
    if (count($parts) !== 2) {
        return $invocation->proceed();
    }
    switch ($parts[0]) {
        case 'youtube':
            $video = htmlSpecialChars($parts[1]);
            $dimensions = 'width="' . ($image->width ? $image->width : 425) . '" height="' . ($image->height ? $image->height : 350) . '"';
            $code = '<div><object ' . $dimensions . '>' . '<param name="movie" value="http://www.youtube.com/v/' . $video . '" /><param name="wmode" value="transparent" />' . '<embed src="http://www.youtube.com/v/' . $video . '" type="application/x-shockwave-flash" wmode="transparent" ' . $dimensions . ' /></object></div>';
            $texy = $invocation->getTexy();
            return $texy->protect($code, Texy::CONTENT_BLOCK);
    }
    return $invocation->proceed();
}
$texy = new Texy();
$texy->addHandler('image', 'imageHandler');
// processing
$text = file_get_contents('sample.texy');
$html = $texy->process($text);
// that's all folks!
// echo formated output
header('Content-type: text/html; charset=utf-8');
echo $html;
// echo generated HTML code
echo '<hr />';
echo '<pre>';
echo htmlSpecialChars($html);
echo '</pre>';
开发者ID:jiripudil,项目名称:texy,代码行数:31,代码来源:demo.php


示例20: process

 public function process($text, $singleLine = FALSE)
 {
     if ($this->processing) {
         throw new InvalidStateException('Processing is in progress yet.');
     }
     $this->marks = array();
     $this->processing = TRUE;
     if (is_array($this->allowedClasses)) {
         $this->_classes = array_flip($this->allowedClasses);
     } else {
         $this->_classes = $this->allowedClasses;
     }
     if (is_array($this->allowedStyles)) {
         $this->_styles = array_flip($this->allowedStyles);
     } else {
         $this->_styles = $this->allowedStyles;
     }
     $text = TexyUtf::toUtf($text, $this->encoding);
     if ($this->removeSoftHyphens) {
         $text = str_replace("Β­", '', $text);
     }
     $text = self::normalize($text);
     $this->tabWidth = max(1, (int) $this->tabWidth);
     while (strpos($text, "\t") !== FALSE) {
         $text = preg_replace_callback('#^(.*)\\t#mU', array($this, 'tabCb'), $text);
     }
     $this->invokeHandlers('beforeParse', array($this, &$text, $singleLine));
     $this->_linePatterns = $this->linePatterns;
     $this->_blockPatterns = $this->blockPatterns;
     foreach ($this->_linePatterns as $name => $foo) {
         if (empty($this->allowed[$name])) {
             unset($this->_linePatterns[$name]);
         }
     }
     foreach ($this->_blockPatterns as $name => $foo) {
         if (empty($this->allowed[$name])) {
             unset($this->_blockPatterns[$name]);
         }
     }
     $this->DOM = TexyHtml::el();
     if ($singleLine) {
         $this->DOM->parseLine($this, $text);
     } else {
         $this->DOM->parseBlock($this, $text);
     }
     $this->invokeHandlers('afterParse', array($this, $this->DOM, $singleLine));
     $html = $this->DOM->toHtml($this);
     if (self::$advertisingNotice) {
         $html .= "\n<!-- by Texy2! -->";
         if (self::$advertisingNotice === 'once') {
             self::$advertisingNotice = FALSE;
         }
     }
     $this->processing = FALSE;
     return TexyUtf::utf2html($html, $this->encoding);
 }
开发者ID:radimklaska,项目名称:Drupal.cz,代码行数:56,代码来源:texy.compact.5.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP TexyHtml类代码示例发布时间:2022-05-23
下一篇:
PHP Textile类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap