Version 5.0.0 beta 1

This commit is contained in:
Neo committed 2025-12-19 16:27:35 -08:00
1 parent 25ddeb65d6
commit 15c7beabc5
6736 files changed
+627902 -497943

No files matched your search

+25 -13
View File
@@ -12,9 +12,21 @@
namespace IPS\convert\Tools;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
use InvalidArgumentException;
use IPS\Image;
use IPS\Image\Gd;
use OutOfRangeException;
use UnderflowException;
use function defined;
use function file_exists;
use function file_get_contents;
use function is_null;
use function unserialize;
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
@@ -37,7 +49,7 @@ trait Xenforo
}
else
{
return \unserialize( $value );
return unserialize( $value );
}
}
@@ -52,10 +64,10 @@ trait Xenforo
{
try
{
$title = ( static::$isLegacy === FALSE OR \is_null( static::$isLegacy ) ) ? $xfTwoTitle : $xfOneTitle;
$title = ( static::$isLegacy === FALSE OR is_null( static::$isLegacy ) ) ? $xfTwoTitle : $xfOneTitle;
return $this->db->select( 'phrase_text', 'xf_phrase', array( "title=?", $title ) )->first();
}
catch( \UnderflowException $e )
catch( UnderflowException $e )
{
return NULL;
}
@@ -75,8 +87,8 @@ trait Xenforo
* @param array $spriteParams Sprite parameters
* @return array
*
* @throws \OutOfRangeException
* @throws \InvalidArgumentException
* @throws OutOfRangeException
* @throws InvalidArgumentException
*/
protected function _imageFromSprite( $sprite, $spriteParams )
{
@@ -85,15 +97,15 @@ trait Xenforo
/* Set up image canvas */
if( !isset( $this->_spriteImages[ $key ] ) )
{
if( !\file_exists( $sprite ) )
if( !file_exists( $sprite ) )
{
throw new \OutOfRangeException;
throw new OutOfRangeException;
}
// Check valid image
$image = \file_get_contents( $sprite );
\IPS\Image::create( $image );
$this->_spriteImages[ $key ] = new \IPS\Image\Gd( $image );
$image = file_get_contents( $sprite );
Image::create( $image );
$this->_spriteImages[ $key ] = new Gd( $image );
}
/* x2 image? */
@@ -103,7 +115,7 @@ trait Xenforo
$multiplier = 2;
}
$image = \IPS\Image\Gd::newImageCanvas( $spriteParams['w'] * $multiplier, $spriteParams['h'] * $multiplier, array( 0, 0, 0 ) );
$image = Gd::newImageCanvas( $spriteParams['w'] * $multiplier, $spriteParams['h'] * $multiplier, array( 0, 0, 0 ) );
/* Set the background to transparent */
imagefill( $image->image, 0, 0, imagecolorallocatealpha( $image->image, 0, 0, 0, 127 ) );