[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_finder/src/Indexer/Parser/ -> Rtf.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_finder
   6   *
   7   * @copyright   (C) 2011 Open Source Matters, Inc. <https://www.joomla.org>
   8   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   9   */
  10  
  11  namespace Joomla\Component\Finder\Administrator\Indexer\Parser;
  12  
  13  use Joomla\Component\Finder\Administrator\Indexer\Parser;
  14  
  15  // phpcs:disable PSR1.Files.SideEffects
  16  \defined('_JEXEC') or die;
  17  // phpcs:enable PSR1.Files.SideEffects
  18  
  19  /**
  20   * RTF Parser class for the Finder indexer package.
  21   *
  22   * @since  2.5
  23   */
  24  class Rtf extends Parser
  25  {
  26      /**
  27       * Method to process RTF input and extract the plain text.
  28       *
  29       * @param   string  $input  The input to process.
  30       *
  31       * @return  string  The plain text input.
  32       *
  33       * @since   2.5
  34       */
  35      protected function process($input)
  36      {
  37          // Remove embedded pictures.
  38          $input = preg_replace('#{\\\pict[^}]*}#mi', '', $input);
  39  
  40          // Remove control characters.
  41          $input = str_replace(array('{', '}', "\\\n"), array(' ', ' ', "\n"), $input);
  42          $input = preg_replace('#\\\([^;]+?);#m', ' ', $input);
  43          $input = preg_replace('#\\\[\'a-zA-Z0-9]+#mi', ' ', $input);
  44  
  45          return $input;
  46      }
  47  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer