Textpattern PHP Cross Reference Content Management Systems

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

Description: Textile filter.

   1  <?php
   2  
   3  /*
   4   * Textpattern Content Management System
   5   * http://textpattern.com
   6   *
   7   * Copyright (C) 2016 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 <http://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->version = $this->textile->getVersion();
  52      }
  53  
  54      /**
  55       * Filter.
  56       *
  57       * @param string $thing
  58       * @param array  $options
  59       */
  60  
  61      public function filter($thing, $options)
  62      {
  63          parent::filter($thing, $options);
  64  
  65          if (($this->options['restricted'])) {
  66              return $this->textile->textileRestricted(
  67                  $thing,
  68                  $this->options['lite'],
  69                  $this->options['noimage'],
  70                  $this->options['rel']
  71              );
  72          } else {
  73              return $this->textile->textileThis(
  74                  $thing,
  75                  $this->options['lite'],
  76                  '',
  77                  $this->options['noimage'],
  78                  '',
  79                  $this->options['rel']
  80              );
  81          }
  82      }
  83  
  84      /**
  85       * Help for Textile syntax.
  86       *
  87       * Gives some basic Textile syntax examples, wrapped in an &lt;ul&gt;.
  88       *
  89       * @return string HTML
  90       */
  91  
  92      public function getHelp()
  93      {
  94          return
  95              n.'<ul class="textile plain-list">'.
  96              n.'<li>'.gTxt('header').': <strong>h<em>n</em>.</strong>'.
  97              popHelpSubtle('header', 400, 400).'</li>'.
  98              n.'<li>'.gTxt('blockquote').': <strong>bq.</strong>'.
  99              popHelpSubtle('blockquote', 400, 400).'</li>'.
 100              n.'<li>'.gTxt('numeric_list').': <strong>#</strong>'.
 101              popHelpSubtle('numeric', 400, 400).'</li>'.
 102              n.'<li>'.gTxt('bulleted_list').': <strong>*</strong>'.
 103              popHelpSubtle('bulleted', 400, 400).'</li>'.
 104              n.'<li>'.gTxt('definition_list').': <strong>; :</strong>'.
 105              popHelpSubtle('definition', 400, 400).'</li>'.
 106              n.'<li>'.'_<em>'.gTxt('emphasis').'</em>_'.
 107              popHelpSubtle('italic', 400, 400).'</li>'.
 108              n.'<li>'.'*<strong>'.gTxt('strong').'</strong>*'.
 109              popHelpSubtle('bold', 400, 400).'</li>'.
 110              n.'<li>'.'??<cite>'.gTxt('citation').'</cite>??'.
 111              popHelpSubtle('cite', 500, 300).'</li>'.
 112              n.'<li>'.'-'.gTxt('deleted_text').'-'.
 113              popHelpSubtle('delete', 400, 300).'</li>'.
 114              n.'<li>'.'+'.gTxt('inserted_text').'+'.
 115              popHelpSubtle('insert', 400, 300).'</li>'.
 116              n.'<li>'.'^'.gTxt('superscript').'^'.
 117              popHelpSubtle('super', 400, 300).'</li>'.
 118              n.'<li>'.'~'.gTxt('subscript').'~'.
 119              popHelpSubtle('subscript', 400, 400).'</li>'.
 120              n.'<li>'.'"'.gTxt('linktext').'":url'.
 121              popHelpSubtle('link', 400, 300).'</li>'.
 122              n.'<li>'.'!'.gTxt('imageurl').'!'.
 123              popHelpSubtle('image', 400, 400).'</li>'.
 124              n.'</ul>'.
 125              graf(
 126                  href(gTxt('documentation').sp.span(gTxt('opens_external_link'), array('class' => 'ui-icon ui-icon-extlink')), 'http://textpattern.com/textile-sandbox', array(
 127                      'class' => 'textile-docs-link',
 128                      'rel'    => 'external',
 129                      'target' => '_blank',
 130                  ))
 131              );
 132      }
 133  }

title

Description

title

Description

title

Description

title

title

Body