Version 4.5.0

This commit is contained in:
Neo committed 2025-12-19 05:51:58 -08:00
1 parent 1a0c7fd3c2
commit f79dcf067a
3791 files changed
+248032 -76372

No files matched your search

+1 -1
View File
@@ -11,7 +11,7 @@
namespace IPS\Output\Plugin;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
+1 -1
View File
@@ -11,7 +11,7 @@
namespace IPS\Output\Plugin;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
+1 -1
View File
@@ -11,7 +11,7 @@
namespace IPS\Output\Plugin;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
+1 -1
View File
@@ -11,7 +11,7 @@
namespace IPS\Output\Plugin;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
+13 -5
View File
@@ -11,7 +11,7 @@
namespace IPS\Output\Plugin;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
@@ -37,19 +37,27 @@ class _File
public static function runPlugin( $data, $options )
{
$extension = ( isset( $options['extension'] ) ? $options['extension'] : 'core_Attachment' );
$scheme = ( isset( $options['scheme'] ) ? $options['scheme'] : NULL );
$schemeString = '';
if ( $scheme )
{
$fullScheme = ( \IPS\Request::i()->isSecure() ) ? 'https' : 'http';
$schemeString = ( $scheme == 'full' ) ? '->setScheme("' . $fullScheme .'")' : '->setScheme(NULL)';
}
if ( $data instanceof \IPS\File )
{
return "(string) " . $data . "->url";
return "(string) " . $data . "->url" . $schemeString;
}
if ( mb_substr( $extension, 0, 1 ) === '$' )
{
return "\\IPS\\File::get( {$extension}, " . $data . " )->url";
return "\\IPS\\File::get( {$extension}, " . $data . " )->url" . $schemeString;
}
else
{
return "\\IPS\\File::get( \"{$extension}\", " . $data . " )->url";
return "\\IPS\\File::get( \"{$extension}\", " . $data . " )->url" . $schemeString;
}
}
}
+2 -2
View File
@@ -11,7 +11,7 @@
namespace IPS\Output\Plugin;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
@@ -50,7 +50,7 @@ class _Filesize
*/
public static function humanReadableFilesize( $sizeInBytes, $decimal=FALSE, $json=FALSE, $get=FALSE )
{
$sizeInBytes = floatval( $sizeInBytes );
$sizeInBytes = \floatval( $sizeInBytes );
foreach ( array( 'Y' => 80, 'Z' => 70, 'E' => 60, 'P' => 50, 'T' => 40, 'G' => 30, 'M' => 20, 'k' => 10 ) as $sig => $pow )
{
+62
View File
@@ -0,0 +1,62 @@
<?php
/**
* @brief Template Plugin - Font size
* @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 9 Apr 2020
*/
namespace IPS\Output\Plugin;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
/**
* Template Plugin - Font size
*/
class _Fontsize
{
/**
* @brief Can be used when compiling CSS
*/
public static $canBeUsedInCss = TRUE;
/**
* Run the plug-in
*
* @param string $data The initial data from the tag
* @param array $options Array of options
* @return string Code to eval
*/
public static function runPlugin( $data, $options )
{
$number = 14;
// Is this a theme setting or a number?
if( preg_match('/^[0-9]+?$/', $data ) )
{
$number = \intval( $data );
}
else if ( isset( \IPS\Theme::i()->settings[ 'font_' . $data ] ) )
{
$number = \IPS\Theme::i()->settings[ 'font_' . $data ];
}
$scale = isset( \IPS\Theme::i()->settings['font_size'] ) ? \intval( \IPS\Theme::i()->settings['font_size'] ) : 100;
// Should we be scaling?
if( $scale !== 100 && ( !isset( $options['scale'] ) || $options['scale'] !== false ) )
{
$number = round( $scale * ( $number / 100 ), 1 );
}
// e.g. 100 * 0.14 = 14px
return '"' . $number . 'px"';
}
}
+8 -1
View File
@@ -11,7 +11,7 @@
namespace IPS\Output\Plugin;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
@@ -43,6 +43,13 @@ class _Hextorgb
return '\IPS\Output\Plugin\Hextorgb::convertToRGB(' . $data . ', ' . ( isset( $options['opacity'] ) ? $options['opacity'] : '1' ) . ')';
}
/**
* Convert Hex value to RGB
*
* @param string $data Hex color code
* @param float $opacity Opacity (0-1)
* @return string
*/
public static function convertToRGB( $data, $opacity )
{
$output = array();
+1 -1
View File
@@ -11,7 +11,7 @@
namespace IPS\Output\Plugin;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
+9 -4
View File
@@ -11,7 +11,7 @@
namespace IPS\Output\Plugin;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
@@ -59,13 +59,13 @@ class _Lang
if ( isset( $options['list'] ) )
{
$return['pre'] .= '$sprintf = \IPS\Member::loggedIn()->language()->formatList(' . $options['list'] . ');';
$return['pre'] .= '$sprintf = array( \IPS\Member::loggedIn()->language()->formatList(' . $options['list'] . ') );';
$params[]= '\'sprintf\' => $sprintf';
}
if ( isset( $options['htmllist'] ) )
{
$return['pre'] .= '$htmlsprintf = \IPS\Member::loggedIn()->language()->formatList(' . $options['htmllist'] . ');';
$return['pre'] .= '$htmlsprintf = array( \IPS\Member::loggedIn()->language()->formatList(' . $options['htmllist'] . ') );';
$params[]= '\'htmlsprintf\' => $htmlsprintf';
}
@@ -85,6 +85,11 @@ class _Lang
{
$return['pre'] .= '$pluralize = array( ' . $options['pluralize'] . ' ); ';
$params[] = '\'pluralize\' => $pluralize';
if ( isset( $options['format'] ) )
{
$params[] = '\'format\' => ' . "'" . $options['format'] . "'";
}
}
if( isset( $options['wordbreak'] ) )
@@ -104,7 +109,7 @@ class _Lang
$vle = 'TRUE';
if( count( $params ) )
if( \count( $params ) )
{
$vle = 'FALSE';
}
+1 -1
View File
@@ -11,7 +11,7 @@
namespace IPS\Output\Plugin;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
+10 -1
View File
@@ -11,7 +11,7 @@
namespace IPS\Output\Plugin;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
@@ -36,6 +36,15 @@ class _Number
*/
public static function runPlugin( $data, $options )
{
if ( isset( $options['format'] ) and $options['format'] === 'short' )
{
return "\IPS\Member::loggedIn()->language()->formatNumberShort( {$data} )";
}
elseif ( isset( $options['decimals'] ) )
{
return "\IPS\Member::loggedIn()->language()->formatNumber( {$data}, {$options['decimals']} )";
}
return "\IPS\Member::loggedIn()->language()->formatNumber( {$data} )";
}
}
+3 -3
View File
@@ -11,7 +11,7 @@
namespace IPS\Output\Plugin;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
@@ -33,7 +33,7 @@ class _Prefix
* @brief The styles this plugin will prefix
*/
protected static $supportedStyles = array(
'transition', 'transform', 'animation', 'animation-name', 'animation-duration', 'animation-fill-mode', 'animation-timing-function', 'user-select', 'box-sizing', 'background-size'
'user-select'
);
/**
@@ -51,7 +51,7 @@ class _Prefix
*/
public static function runPlugin( $data, $options )
{
if ( in_array( $data, static::$supportedStyles ) )
if ( \in_array( $data, static::$supportedStyles ) )
{
$output = array();
+1 -1
View File
@@ -11,7 +11,7 @@
namespace IPS\Output\Plugin;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
+1 -1
View File
@@ -11,7 +11,7 @@
namespace IPS\Output\Plugin;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
+1 -1
View File
@@ -11,7 +11,7 @@
namespace IPS\Output\Plugin;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
+1 -1
View File
@@ -11,7 +11,7 @@
namespace IPS\Output\Plugin;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
+2 -2
View File
@@ -11,7 +11,7 @@
namespace IPS\Output\Plugin;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
@@ -36,7 +36,7 @@ class _Template
*/
public static function runPlugin( $data, $options, $functionName=NULL, $calledClass='IPS\Theme' )
{
$params = ( in_array( 'params', array_keys( $options ) ) ) ? $options['params'] : '';
$params = ( \in_array( 'params', array_keys( $options ) ) ) ? $options['params'] : '';
if( mb_strpos( $data, '$' ) === 0 )
{
$data = '{' . $data . '}';
+5 -1
View File
@@ -11,7 +11,7 @@
namespace IPS\Output\Plugin;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
@@ -33,6 +33,7 @@ class _Theme
* @param string $data The initial data from the tag
* @param array $options Array of options
* @return string Code to eval
* @note Using this plugin to call the sharer logos or favicon is deprecated and will be removed in a future version
*/
public static function runPlugin( $data, $options )
{
@@ -47,6 +48,9 @@ class _Theme
case 'logo_favicon':
return "\IPS\Theme::i()->logo_favicon";
break;
case 'logo_height':
return ( isset( \IPS\Theme::i()->logo['front']['height'] ) ) ? '\IPS\Theme::i()->logo[\'front\'][\'height\']' : 100;
break;
default:
return ( isset( \IPS\Theme::i()->settings[ $data ] ) ) ? "\IPS\Theme::i()->settings['{$data}']" : '';
break;
+1 -1
View File
@@ -11,7 +11,7 @@
namespace IPS\Output\Plugin;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
+21 -4
View File
@@ -11,7 +11,7 @@
namespace IPS\Output\Plugin;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
@@ -43,7 +43,7 @@ class _Url
$csrf = ' . "&csrfKey=" . \IPS\Session::i()->csrfKey';
}
$location = ( in_array( 'base', array_keys( $options ) ) ) ? '"' . $options['base'] . '"' : 'null';
$location = ( \in_array( 'base', array_keys( $options ) ) ) ? '"' . $options['base'] . '"' : 'null';
if ( !isset( $options['seoTemplate'] ) )
{
@@ -70,11 +70,28 @@ class _Url
$fragment = "->setFragment(\"{$options['fragment']}\")";
}
$ref = '';
if ( isset( $options['ref'] ) )
{
/* Is this a variable or other dynamic thing? */
if ( \in_array( \substr( $options['ref'], 0, 1 ), array( '(', '$', '\\' ) ) )
{
$ref = "->addRef(";
$ref .= $options['ref'];
$ref .= ")";
}
else
{
/* It's not - just a normal string */
$ref = "->addRef(\"{$options['ref']}\")";
}
}
$_data = mb_substr( $data, 0, 1 ) == '$' ? $data : "\"$data\"";
if ( isset( $options['plain'] ) )
{
$url = "\IPS\Http\Url::internal( {$_data}{$csrf}, {$location}, \"{$options['seoTemplate']}\", {$options['seoTitles']}, {$options['protocol']} )".$fragment;
$url = "\IPS\Http\Url::internal( {$_data}{$csrf}, {$location}, \"{$options['seoTemplate']}\", {$options['seoTitles']}, {$options['protocol']} )".$fragment.$ref;
}
elseif ( isset( $options['ips'] ) )
{
@@ -82,7 +99,7 @@ class _Url
}
else
{
$url = "str_replace( '&', '&amp;', \IPS\Http\Url::internal( {$_data}{$csrf}, {$location}, \"{$options['seoTemplate']}\", {$options['seoTitles']}, {$options['protocol']} ){$fragment} )";
$url = "htmlspecialchars( \IPS\Http\Url::internal( {$_data}{$csrf}, {$location}, \"{$options['seoTemplate']}\", {$options['seoTitles']}, {$options['protocol']} ){$fragment}{$ref}, ENT_QUOTES | ENT_DISALLOWED, 'UTF-8', TRUE )";
}
if( isset( $options['noprotocol'] ) AND $options['noprotocol'] )
+3 -3
View File
@@ -11,7 +11,7 @@
namespace IPS\Output\Plugin;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
@@ -30,13 +30,13 @@ class _Wordbreak
/**
* Run the plug-in
*
* @deprecated \IPS\Lang::wordbreak() is deprecated but we left this here to prevent breaking anything
* @deprecated This will be removed in a future release.
* @param string $data The initial data from the tag
* @param array $options Array of options
* @return string Code to eval
*/
public static function runPlugin( $data, $options )
{
return "\IPS\Lang::wordbreak( htmlspecialchars( {$data}, ENT_QUOTES | ENT_DISALLOWED, 'UTF-8', FALSE ) )";
return "htmlspecialchars( {$data}, ENT_QUOTES | ENT_DISALLOWED, 'UTF-8', FALSE )";
}
}