Version 5.0.0 beta 2

This commit is contained in:
Neo committed 2025-12-19 16:39:01 -08:00
1 parent 15c7beabc5
commit f61b0da85d
181 files changed
+3182 -1533

No files matched your search

-67
View File
@@ -945,12 +945,6 @@ class Output
$this->parseFileObjectUrls( $output );
}
/* Replace emoji */
if ( $output and $parseEmoji and Dispatcher::hasInstance() and Dispatcher::i()->controllerLocation !== 'setup' )
{
$output = $this->replaceEmojiWithImages( $output );
}
/* Combine some common checks for re-use */
$canCache = function( $contentType, $obj ) {
if( $obj->pageCaching and
@@ -1355,68 +1349,7 @@ class Output
/* ___base_url___ is a bit dramatic but it prevents accidental replacements with tags called base_url if a third party app or hook uses it */
$output = str_replace( '<___base_url___>', rtrim( Settings::i()->base_url, '/' ), $output );
}
/**
* Replace emoji unicode with images
*
* @param string $output The output containing emojis as unicode
* @return string
*/
public function replaceEmojiWithImages( string $output ): string
{
if ( Settings::i()->emoji_style == 'twemoji' )
{
return preg_replace_callback( '/<span class="ipsEmoji">(.+?)<\/span>/', function( $matches ) {
$hex = bin2hex( mb_convert_encoding( $matches[1], 'UTF-32', 'UTF-8' ) );
$hexLength = strlen( $hex ) / 8;
$chunks = array();
for ( $i = 0; $i < $hexLength; ++$i )
{
$tmp = substr( $hex, $i * 8, 8 );
$copy = false;
$len = strlen( $tmp );
$res = '';
for ( $j = 0; $j < $len; ++$j )
{
$ch = $tmp[ $j ];
if ( !$copy )
{
if ( $ch != '0' )
{
$copy = true;
}
else if ( ( $i + 1 ) == $len )
{
$res = '0';
}
}
if ( $copy )
{
$res .= $ch;
}
}
$chunks[ $i ] = $res;
}
$image = implode( '-', $chunks );
if ( strstr( $image, '200d' ) === FALSE or $image === '1f441-fe0f-200d-1f5e8-fe0f' )
{
$image = str_replace( '-fe0f', '', $image );
}
if ( in_array( $image, array( '0031-20e3', '0030-20e3', '0032-20e3', '0034-20e3', '0035-20e3', '0036-20e3', '0037-20e3', '0038-20e3', '0033-20e3', '0039-20e3', '0023-20e3', '002a-20e3', '00a9', '00ae' ) ) )
{
$image = str_replace( '00', '', $image );
}
return '<img src="https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/72x72/' . $image . '.png" class="ipsEmoji" alt="' . $matches[1] . '" loading="lazy">';
}, $output );
}
return $output;
}
/**
* Show Offline
*