Textpattern PHP Cross Reference Content Management Systems

Source: /textpattern/vendors/Textpattern/Textile/Parser.php - 87 lines - 2653 bytes - Summary - Text - Print

Description: Textpattern configured Textile wrapper.

   1  <?php
   2  
   3  /*
   4   * Textpattern Content Management System
   5   * https://textpattern.com/
   6   *
   7   * Copyright (C) 2020 The Textpattern Development Team
   8   *
   9   * This file is part of Textpattern.
  10   *
  11   * Textpattern is free software; you can redistribute it and/or
  12   * modify it under the terms of the GNU General Public License
  13   * as published by the Free Software Foundation, version 2.
  14   *
  15   * Textpattern is distributed in the hope that it will be useful,
  16   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18   * GNU General Public License for more details.
  19   *
  20   * You should have received a copy of the GNU General Public License
  21   * along with Textpattern. If not, see <https://www.gnu.org/licenses/>.
  22   */
  23  
  24  /**
  25   * Textpattern configured Textile wrapper.
  26   *
  27   * @since   4.6.0
  28   * @package Textile
  29   */
  30  
  31  namespace Textpattern\Textile;
  32  
  33  /**
  34   * Textile parser.
  35   *
  36   * @since   4.6.0
  37   * @package Textile
  38   */
  39  class Parser extends \Netcarver\Textile\Parser
  40  {
  41      /**
  42       * Constructor.
  43       *
  44       * @param string|null $doctype The output doctype
  45       */
  46  
  47      public function __construct($doctype = null)
  48      {
  49          if ($doctype === null) {
  50              $doctype = get_pref('doctype', 'html5');
  51          }
  52  
  53          parent::__construct($doctype);
  54          $this->setImagePrefix(ihu)->setLinkPrefix(hu)->setRawBlocks(true);
  55          $this->setSymbol('quote_single_open', gTxt('txt_quote_single_open'));
  56          $this->setSymbol('quote_single_close', gTxt('txt_quote_single_close'));
  57          $this->setSymbol('quote_double_open', gTxt('txt_quote_double_open'));
  58          $this->setSymbol('quote_double_close', gTxt('txt_quote_double_close'));
  59      }
  60  
  61      /**
  62       * Parses content in a restricted mode.
  63       *
  64       * @param  string|null $text    The input document in textile format
  65       * @param  bool|null   $lite    Optional flag to switch the parser into lite mode
  66       * @param  bool|null   $noimage Optional flag controlling the conversion of images into HTML img tags
  67       * @param  string|null $rel     Relationship to apply to all generated links
  68       * @return string The text from the input document
  69       */
  70  
  71      public function textileRestricted($text, $lite = null, $noimage = null, $rel = null)
  72      {
  73          if ($lite === null) {
  74              $lite = !get_pref('comments_use_fat_textile', 1);
  75          }
  76  
  77          if ($noimage === null) {
  78              $noimage = get_pref('comments_disallow_images', 1);
  79          }
  80  
  81          if ($rel === null && get_pref('comment_nofollow', 1)) {
  82              $rel = 'nofollow';
  83          }
  84  
  85          return parent::textileRestricted($text, $lite, $noimage, $rel);
  86      }
  87  }

title

Description

title

Description

title

Description

title

title

Body