Savant2_Plugin_quote.php
1.08 KB
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
<?php
/**
* Base plugin class.
*/
require_once 'Savant2/Plugin.php';
/**
*
* Outputs a quoted string.
*
* $Id: Savant2_Plugin_quote.php,v 1.1.1.1 2006/10/30 08:50:53 georg Exp $
*
* @author Georg Steffers <georg@steffers.org>
*
* @package None
*
* @license LGPL http://www.gnu.org/copyleft/lesser.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*/
class Savant2_Plugin_quote extends Savant2_Plugin {
/**
*
* Output the given string with quoted ' and ".
*
* @access public
*
* @param string $text The text to be quoted.
*
*/
function plugin($text)
{
return preg_replace ('/([\'"])/i', '\\\${1}', $text);
}
}
?>