CoreFiles by mySites.guru
Rtf.php44 lines, 1,072 bytes, from Joomla_4.0.2-Stable-Full_Package.zip
Raw History Compare with 4.0.1
md5
0f4a0b3867ba8c0f8355fe3c8ee886a1
sha1
968de92a7255f460c93bb6ec77d606983167a57e
sha256
52dce7d3abf343b15de11ff70c76bff46130997d2c0937b1c26fb89b0e79ad79
<?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;

\defined('_JEXEC') or die;

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 51 releases, Joomla 4.0.0-beta6 to 4.2.0-beta2. See them all, or every version of this file.