Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
@@ -11,21 +11,26 @@
|
||||
namespace IPS\Output\Plugin;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\File as SystemFile;
|
||||
use IPS\Request;
|
||||
use function defined;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Template Plugin - File
|
||||
*/
|
||||
class _File
|
||||
class File
|
||||
{
|
||||
/**
|
||||
* @brief Can be used when compiling CSS
|
||||
*/
|
||||
public static $canBeUsedInCss = TRUE;
|
||||
public static bool $canBeUsedInCss = TRUE;
|
||||
|
||||
/**
|
||||
* Run the plug-in
|
||||
@@ -34,16 +39,16 @@ class _File
|
||||
* @param array $options Array of options
|
||||
* @return string Code to eval
|
||||
*/
|
||||
public static function runPlugin( $data, $options )
|
||||
public static function runPlugin( string $data, array $options ): string
|
||||
{
|
||||
$extension = ( isset( $options['extension'] ) ? $options['extension'] : 'core_Attachment' );
|
||||
$scheme = ( isset( $options['scheme'] ) ? $options['scheme'] : NULL );
|
||||
$cacheBust = ( isset( $options['cb'] ) ? $options['cb'] : NULL );
|
||||
$extension = ( $options['extension'] ?? 'core_Attachment' );
|
||||
$scheme = ( $options['scheme'] ?? NULL );
|
||||
$cacheBust = ( $options['cb'] ?? NULL );
|
||||
$schemeString = $cbString = '';
|
||||
|
||||
if ( $scheme )
|
||||
{
|
||||
$fullScheme = ( \IPS\Request::i()->isSecure() ) ? 'https' : 'http';
|
||||
$fullScheme = ( Request::i()->isSecure() ) ? 'https' : 'http';
|
||||
$schemeString = ( $scheme == 'full' ) ? '->setScheme("' . $fullScheme .'")' : '->setScheme(NULL)';
|
||||
}
|
||||
|
||||
@@ -51,7 +56,8 @@ class _File
|
||||
{
|
||||
$cbString = "->setQueryString( 'v', " . $cacheBust . ")";
|
||||
}
|
||||
if ( $data instanceof \IPS\File )
|
||||
|
||||
if ( $data instanceof SystemFile )
|
||||
{
|
||||
return "(string) " . $data . "->url" . $schemeString . $cbString;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user