Source for file _texturize.plugin.php
Documentation is available at _texturize.plugin.php
* This file implements the Texturize plugin for b2evolution
* @author WordPress team - http://sourceforge.net/project/memberlist.php?group_id=51422
if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
$this->short_desc =
T_('Smart quotes + additional typographic replacements.');
$this->long_desc =
T_('This renderer will replace standard and double quotes with typographic quotes were appropriate.<br />
It will also perform the following replacements:
* @param array Associative array of parameters
* 'data': the data (by reference). You probably want to modify this.
* 'format': see {@link format_to_output()}. Only 'htmlbody' and 'entityencoded' will arrive here.
* @return boolean true if we can render something for the required output format
$content =
& $params['data'];
$textarr =
preg_split("/(<.*>)/Us", $content, -
1, PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between
$stop =
count($textarr); $next =
true; // loop stuff
for ($i =
0; $i <
$stop; $i++
) {
if (strlen($curl) &&
'<' !=
$curl{0} &&
$next) { // If it's not a tag
// This is a hack, look at this more later. It works pretty well though.
$cockney =
array("'tain't","'twere","'twas","'tis","'twill","'til","'bout","'nuff","'round");
$cockneyreplace =
array("’tain’t","’twere","’twas","’tis","’twill","’til","’bout","’nuff","’round");
$curl =
preg_replace("/'(\d\d(?:’|')?s)/", "’$1", $curl);
$curl =
preg_replace("/(\S)'([^'\s])/", "$1’$2", $curl);
$curl =
preg_replace('/(\s|\A)"(?!\s)/', '$1“$2', $curl);
$curl =
preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $curl);
* @uses RenderItemAsHtml()
* $Log: _texturize.plugin.php,v $
* Revision 1.13.2.3 2006/12/26 03:18:51 fplanque
* assigned a few significant plugin groups
* Revision 1.13.2.2 2006/11/04 19:55:12 fplanque
* Reinjected old Log blocks. Removing them from CVS was a bad idea -- especially since Daniel has decided branch 1.9 was his HEAD...
* Revision 1.13 2006/07/10 20:19:30 blueyed
* Fixed PluginInit behaviour. It now gets called on both installed and non-installed Plugins, but with the "is_installed" param appropriately set.
* Revision 1.12 2006/07/07 21:26:49 blueyed
* Revision 1.11 2006/06/16 21:30:57 fplanque
* Started clean numbering of plugin versions (feel free do add dots...)
* Revision 1.10 2006/05/30 19:39:55 fplanque
* Revision 1.9 2006/04/11 21:22:26 fplanque