Version 4.2.0
This commit is contained in:
1 parent
0dc2aee5ed
commit
96997ddd8e
2074 files changed
+125454
-55780
No files matched your search
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Legacy Text Parser
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 12 Jun 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\Text;
|
||||
@@ -636,7 +635,7 @@ class _LegacyParser
|
||||
}
|
||||
|
||||
/* Get rid of empty hyperlinks, which can be present from bugs in older versions of IPB */
|
||||
preg_match_all( '#<a.+?href=[\'"]["\'].*?>(.+?)\<\/a\>#is', $value, $matches );
|
||||
preg_match_all( '#<a(?:[^>]+?)href=[\'"]["\'](?:[^>]*?)>(.+?)\<\/a\>#is', $value, $matches );
|
||||
|
||||
foreach( $matches[0] as $k => $v )
|
||||
{
|
||||
@@ -688,8 +687,22 @@ class _LegacyParser
|
||||
|
||||
foreach( $matches[0] as $k => $m )
|
||||
{
|
||||
$url = $matches[1][ $k ];
|
||||
|
||||
if( mb_strpos( $url, '#entry' ) !== FALSE )
|
||||
{
|
||||
$sep = '?';
|
||||
|
||||
if( mb_strpos( $url, '?' ) )
|
||||
{
|
||||
$sep = '&';
|
||||
}
|
||||
|
||||
$url = preg_replace( "/#entry(\d+)/", $sep . "do=findComment&comment=$1", $url );
|
||||
}
|
||||
|
||||
$c = count( $urls );
|
||||
$urls[ $c ] = $m;
|
||||
$urls[ $c ] = str_replace( $matches[1][ $k ], $url, $m );
|
||||
|
||||
$replacement = '<!--url{' . $c . '}-->';
|
||||
|
||||
@@ -748,7 +761,7 @@ class _LegacyParser
|
||||
$sep = '&';
|
||||
}
|
||||
|
||||
$url = preg_replace( "/#entry(\d+)/", $sep . 'do=findComment' . $sep . "comment=$1", $m );
|
||||
$url = preg_replace( "/#entry(\d+)/", $sep . "do=findComment&comment=$1", $m );
|
||||
}
|
||||
|
||||
try
|
||||
@@ -807,7 +820,6 @@ class _LegacyParser
|
||||
$value = str_replace( array( '<br>', '<br />' ), '</p><p>', $value );
|
||||
}
|
||||
|
||||
/* https://community.invisionpower.com/4bugtrack/active-reports/4081-editing-posts-ads-extra-spacing-r6742/ */
|
||||
$value = preg_replace( '/<p>\s*<\/p>/i', '<p> </p>', $value );
|
||||
|
||||
/* But that may break blockquotes, which are block elements */
|
||||
@@ -905,10 +917,10 @@ class _LegacyParser
|
||||
}, $value );
|
||||
|
||||
/* Put the dynamic replacements back now */
|
||||
$value = preg_replace( '#<([^>]+?)(href|src|srcset)=(\'|")%7BfileStore\.([\d\w\_]+?)%7D/#i', '<\1\2=\3<fileStore.\4>/', $value );
|
||||
$value = preg_replace( '#<([^>]+?)(srcset)=(\'|")%7BfileStore\.([\d\w\_]+?)%7D/#i', '<\1\2=\3<fileStore.\4>/', $value );
|
||||
$value = preg_replace( '#<([^>]+?)(href|src|srcset)=(\'|")%7B___base_url___%7D/#i', '<\1\2=\3<___base_url___>/', $value );
|
||||
$value = preg_replace( '#<([^>]+?)(data-fileid)=(\'|")%7B___base_url___%7D/#i', '<\1\2=\3<___base_url___>/', $value );
|
||||
$value = preg_replace( '#<([^>]+?)(href|src|srcset)=(\'|")(?:{|%7B)fileStore\.([\d\w\_]+?)(?:}|%7D)/#i', '<\1\2=\3<fileStore.\4>/', $value );
|
||||
$value = preg_replace( '#<([^>]+?)(srcset)=(\'|")(?:{|%7B)fileStore\.([\d\w\_]+?)(?:}|%7D)/#i', '<\1\2=\3<fileStore.\4>/', $value );
|
||||
$value = preg_replace( '#<([^>]+?)(href|src|srcset)=(\'|")(?:{|%7B)___base_url___(?:}|%7D)/#i', '<\1\2=\3<___base_url___>/', $value );
|
||||
$value = preg_replace( '#<([^>]+?)(data-fileid)=(\'|")(?:{|%7B)___base_url___(?:}|%7D)/#i', '<\1\2=\3<___base_url___>/', $value );
|
||||
|
||||
//print htmlspecialchars( $value );print "<hr style='color:red;'>";print $value;print "<hr style='color:red;'>";
|
||||
|
||||
|
||||
Reference in new issue
Block a user