Savant2_Plugin_quote.php 1.08 KB
<?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);
	}
}
?>