Textpattern PHP Cross Reference Content Management Systems

Source: /textpattern/vendors/Textpattern/Textfilter/Textile.php - 91 lines - 2308 bytes - Summary - Text - Print

Description: Textile filter.

   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   * Textile filter.
  26   *
  27   * @since   4.6.0
  28   * @package Textfilter
  29   */
  30  
  31  namespace Textpattern\Textfilter;
  32  
  33  class Textile extends Base implements TextfilterInterface
  34  {
  35      /**
  36       * Instance of Textile.
  37       *
  38       * @var Textile
  39       */
  40  
  41      protected $textile;
  42  
  43      /**
  44       * Constructor.
  45       */
  46  
  47      public function __construct()
  48      {
  49          parent::__construct(USE_TEXTILE, gTxt('use_textile'));
  50          $this->textile = new \Textpattern\Textile\Parser();
  51          $this->textileRestricted = new \Textpattern\Textile\RestrictedParser();
  52          $this->version = $this->textile->getVersion();
  53      }
  54  
  55      /**
  56       * Filter.
  57       *
  58       * @param string $thing
  59       * @param array  $options
  60       */
  61  
  62      public function filter($thing, $options)
  63      {
  64          parent::filter($thing, $options);
  65  
  66          if (($this->options['restricted'])) {
  67              return $this->textileRestricted
  68                  ->setLite($this->options['lite'])
  69                  ->setImages(!$this->options['noimage'])
  70                  ->setLinkRelationShip($this->options['rel'])
  71                  ->parse($thing);
  72          } else {
  73              return $this->textile
  74                  ->setLite($this->options['lite'])
  75                  ->setImages(!$this->options['noimage'])
  76                  ->setLinkRelationShip($this->options['rel'])
  77                  ->parse($thing);
  78          }
  79      }
  80  
  81      /**
  82       * Help link for Textile syntax.
  83       *
  84       * @return string HTML
  85       */
  86  
  87      public function getHelp()
  88      {
  89          return 'https://textpattern.com/textile-sandbox';
  90      }
  91  }

title

Description

title

Description

title

Description

title

title

Body