CoreFiles by mySites.guru
Rtf.php43 lines, 1,123 bytes, from Joomla_4.2.0-Stable-Full_Package.zip
Raw History Compare with 4.1.5
md5
78442be857226b03abe0bf6746a64ba4
sha1
d557df5f51abb030e2a4bf81e1398b7d4b67d06e
sha256
6da2fa3317c922cc936f193e0caf4185907fc880ac9cd66d229777a16cd19643
<?php

/**
 * @package     Joomla.Administrator
 * @subpackage  com_finder
 *
 * @copyright   (C) 2011 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\Component\Finder\Administrator\Indexer\Parser;

use Joomla\Component\Finder\Administrator\Indexer\Parser;

/**
 * RTF Parser class for the Finder indexer package.
 *
 * @since  2.5
 */
class Rtf extends Parser
{
    /**
     * Method to process RTF input and extract the plain text.
     *
     * @param   string  $input  The input to process.
     *
     * @return  string  The plain text input.
     *
     * @since   2.5
     */
    protected function process($input)
    {
        // Remove embedded pictures.
        $input = preg_replace('#{\\\pict[^}]*}#mi', '', $input);

        // Remove control characters.
        $input = str_replace(array('{', '}', "\\\n"), array(' ', ' ', "\n"), $input);
        $input = preg_replace('#\\\([^;]+?);#m', ' ', $input);
        $input = preg_replace('#\\\[\'a-zA-Z0-9]+#mi', ' ', $input);

        return $input;
    }
}

The same content is in 5 releases, Joomla 4.2.0-beta3 to 4.2.1-rc2. See them all, or every version of this file.