* Invision Power Services * IP.Board v3.4.8 * Text Parsing: LEGACY CR..STUFF * Last Updated: $Date: 2012-06-08 09:28:02 +0100 (Fri, 08 Jun 2012) $ * * * @author $Author: mmecham $ * @copyright (c) 2001 - 2012 Invision Power Services, Inc. * @license http://www.invisionpower.com/company/standards.php#license * @package IP.Board * @link http://www.invisionpower.com * @since 9th March 2005 11:03 * @version $Revision: 10894 $ * * Revised in 3.4 by Matt Mecham * Refactored into a text parsing module * */ if ( ! defined( 'IN_IPB' ) ) { print "
_postPurifyCodeBoxes( $content );
return $content;
}
/**
* Check and make safe embedded codes (removes mark-up HTML purify might have added)
* @param array $matches
*/
protected function _postPurifyCodeBoxes( $content )
{
/* Fetch paired opening and closing tags */
$data = $this->getTagPositions( $content, 'CODE', array( '[', ']') );
if ( is_array( $data ) && count( $data ) )
{
foreach( $data['open'] as $id => $val )
{
$o = $data['open'][ $id ];
$c = $data['close'][ $id ] - $o;
$slice = substr( $content, $o, $c );
$_origLen = strlen( $slice );
$slice = IPSText::stripTags( $slice, ',
' );
$slice = str_replace( "
" , "\n", $slice );
$slice = str_replace( "\n" , "", $slice );
$slice = preg_replace( '#(https|http|ftp)://#' , '\1://', $slice );
$content = substr_replace( $content, $slice, $o, $c );
$_newLen = strlen( $slice );
if ( $_newLen != $_origLen )
{
/* Bump up next */
foreach( $data['open'] as $_id => $_val )
{
$_o = $data['open'][ $_id ];
/* Ascii face alert */
if ( $_o > $o )
{
$data['open'][ $_id ] += ( $_newLen - $_origLen );
$data['close'][ $_id ] += ( $_newLen - $_origLen );
}
}
}
}
}
return $content;
}
}