/usr/share/php/Horde/Text/Filter/Cleanascii.php is in php-horde-text-filter 2.3.3-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | <?php
/**
* Removes some common entities and high-ascii or otherwise nonstandard
* characters common in text pasted from Microsoft Word into a browser.
*
* This function should NOT be used on non-ASCII text; it may and probably
* will butcher other character sets indescriminately. Use it only to clean
* US-ASCII (7-bit) text which you suspect (or know) may have invalid or
* non-printing characters in it.
*
* Copyright 2004-2016 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.horde.org/licenses/lgpl21.
*
* @author Jan Schneider <jan@horde.org>
* @category Horde
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @package Text_Filter
*/
class Horde_Text_Filter_Cleanascii extends Horde_Text_Filter_Base
{
/**
* Executes any code necessary before applying the filter patterns.
*
* @param string $text The text before the filtering.
*
* @return string The modified text.
*/
public function preProcess($text)
{
if (preg_match('/|([^#]*)#.*/', $text, $regs)) {
$text = $regs[1];
if (!empty($text)) {
$text = $text . "\n";
}
}
return $text;
}
/**
* Returns a hash with replace patterns.
*
* @return array Patterns hash.
*/
public function getPatterns()
{
/* Remove control characters. */
$regexp = array('/[\x00-\x1f]+/' => '');
/* The '�' entry may look wrong, depending on your editor,
* but it's not - that's not really a single quote. */
$replace = array(
chr(150) => '-',
chr(167) => '*',
'��' => '*',
'�' => '...',
'�' => "'",
'�' => "'",
'�' => '"',
'�' => '"',
'�' => '*',
'�' => '-',
'�' => '-',
'�' => '*',
'' => '.',
'' => '*',
'' => '*',
'' => '-',
'' => '-',
'' => '*',
'' => '*',
'' => '*',
'•' => '*',
'►' => '>',
);
return array('regexp' => $regexp, 'replace' => $replace);
}
}
|