Source for file html.php

Documentation is available at html.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Administrator
  4.  * @subpackage  com_finder
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE
  8.  */
  9.  
  10. defined('_JEXEC') or die;
  11.  
  12. JLoader::register('FinderIndexerParser', dirname(__DIR__) . '/parser.php');
  13.  
  14. /**
  15.  * HTML Parser class for the Finder indexer package.
  16.  *
  17.  * @package     Joomla.Administrator
  18.  * @subpackage  com_finder
  19.  * @since       2.5
  20.  */
  21. {
  22.     /**
  23.      * Method to process HTML input and extract the plain text.
  24.      *
  25.      * @param   string  $input  The input to process.
  26.      *
  27.      * @return  string  The plain text input.
  28.      *
  29.      * @since   2.5
  30.      */
  31.     protected function process($input)
  32.     {
  33.         // Strip invalid UTF-8 characters.
  34.         $input = iconv("utf-8", "utf-8//IGNORE", $input);
  35.  
  36.         // Strip all script tags.
  37.         $input = preg_replace('#<script[^>]*>.*?</script>#si', ' ', $input);
  38.  
  39.         // Deal with spacing issues in the input.
  40.         $input = str_replace('>', '> ', $input);
  41.         $input = str_replace(array('&nbsp;', '&#160;'), ' ', $input);
  42.         $input = trim(preg_replace('#\s+#u', ' ', $input));
  43.  
  44.         // Strip the tags from the input and decode entities.
  45.         $input = strip_tags($input);
  46.         $input = html_entity_decode($input, ENT_QUOTES, 'UTF-8');
  47.         $input = trim(preg_replace('#\s+#u', ' ', $input));
  48.  
  49.         return $input;
  50.     }
  51. }

Documentation generated on Tue, 19 Nov 2013 15:04:48 +0100 by phpDocumentor 1.4.3