Version 4.0.13.1

This commit is contained in:
Neo committed 2025-12-19 04:57:54 -08:00
1 parent f9e857d255
commit c6a86f0d9b
7517 files changed
+597400 -668041

No files matched your search

+44
View File
@@ -0,0 +1,44 @@
<?php
/**
* @brief Template Plugin - Address formatter
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @since 6 Aug 2013
* @version SVN_VERSION_NUMBER
*/
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 - Address formatting
*/
class _Address
{
/**
* 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 )
{
if( mb_substr( $data, 0, 1 ) === '\\' OR mb_substr( $data, 0, 1 ) === '$' )
{
return '\IPS\GeoLocation::parseForOutput( ' . $data . ' )';
}
else
{
return '\IPS\GeoLocation::parseForOutput( \'' . $data . '\' )';
}
}
}
+42
View File
@@ -0,0 +1,42 @@
<?php
/**
* @brief Template Plugin - Advertisement
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @since 27 Sep 2013
* @version SVN_VERSION_NUMBER
*/
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 - Advertisement
*/
class _Advertisement
{
/**
* @brief Can be used when compiling CSS
*/
public static $canBeUsedInCss = FALSE;
/**
* 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 )
{
return "\IPS\core\Advertisement::loadByLocation( '{$data}' )";
}
}
+58
View File
@@ -0,0 +1,58 @@
<?php
/**
* @brief Template Plugin - DateTime
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @since 15 July 2013
* @version SVN_VERSION_NUMBER
*/
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 - DateTime
*/
class _Datetime
{
/**
* @brief Can be used when compiling CSS
*/
public static $canBeUsedInCss = FALSE;
/**
* 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 )
{
$return = array();
$return['pre'] = '$val = ( ' . $data . ' instanceof \IPS\DateTime ) ? ' . $data . ' : \IPS\DateTime::ts( ' . $data . ' );';
if( isset( $options['dateonly'] ) )
{
$return['return'] = '(string) $val->localeDate()';
}
else if( isset( $options['norelative'] ) )
{
$return['return'] = '(string) $val';
}
else
{
$return['return'] = '$val->html()';
}
return $return;
}
}
+49
View File
@@ -0,0 +1,49 @@
<?php
/**
* @brief Template Plugin - Expression
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @since 18 Feb 2013
* @version SVN_VERSION_NUMBER
*/
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 - Expression
*/
class _Expression
{
/**
* @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 )
{
if( isset( $options['raw'] ) AND $options['raw'] )
{
return \IPS\Theme::expandShortcuts( $data );
}
else
{
return 'htmlspecialchars( ' . \IPS\Theme::expandShortcuts( $data ) . ', ENT_QUOTES | \IPS\HTMLENTITIES, \'UTF-8\', FALSE )';
}
}
}
+56
View File
@@ -0,0 +1,56 @@
<?php
/**
* @brief Template Plugin - File
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @since 21 April 2015
* @version SVN_VERSION_NUMBER
*/
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 - File
*/
class _File
{
/**
* @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 )
{
$extension = ( isset( $options['extension'] ) ? $options['extension'] : 'core_Attachment' );
if ( $data instanceof \IPS\File )
{
return "(string) " . $data . "->url";
}
if ( mb_substr( $extension, 0, 1 ) === '$' )
{
return "\\IPS\\File::get( {$extension}, " . $data . " )->url";
}
else
{
return "\\IPS\\File::get( \"{$extension}\", " . $data . " )->url";
}
}
}
+80
View File
@@ -0,0 +1,80 @@
<?php
/**
* @brief Template Plugin - Filesize
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @since 18 Nov 2013
* @version SVN_VERSION_NUMBER
*/
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 - Filesize
*/
class _Filesize
{
/**
* @brief Can be used when compiling CSS
*/
public static $canBeUsedInCss = FALSE;
/**
* Run the plug-in
*
* @param string $data The initial data from the tag
* @param array $options Array of options
* @return array array( 'pre' => Code to eval before 'return', 'return' => Code to eval to return desired value )
*/
public static function runPlugin( $data, $options )
{
return '\IPS\Output\Plugin\Filesize::humanReadableFilesize( ' . $data . ( ( isset( $options['decimal'] ) and $options['decimal'] ) ? ', TRUE' : '' ) . ' )';
}
/**
* Get human readable filesize (to 2SF)
*
* @param int $sizeInBytes Size in bytes
* @param bool $decimal If TRUE, will calculate based on decimal figures rather than binary
* @param bool $json If TRUE, will format for json
* @return string
*/
public static function humanReadableFilesize( $sizeInBytes, $decimal=FALSE, $json=FALSE )
{
$sizeInBytes = floatval( $sizeInBytes );
foreach ( array( 'Y' => 80, 'Z' => 70, 'E' => 60, 'P' => 50, 'T' => 40, 'G' => 30, 'M' => 20, 'k' => 10 ) as $sig => $pow )
{
$raised = $decimal ? pow( 1000, $pow / 10 ) : pow( 2, $pow );
if ( $sizeInBytes >= $raised )
{
$format = array( 'sprintf' => round( ( $sizeInBytes / $raised ), 1 ) );
if( $json === TRUE )
{
$format['json'] = TRUE;
}
return \IPS\Member::loggedIn()->language()->addToStack( 'filesize_' . $sig, FALSE, $format );
}
}
$format = array( 'sprintf' => $sizeInBytes );
if( $json === TRUE )
{
$format['json'] = TRUE;
}
return \IPS\Member::loggedIn()->language()->addToStack( 'filesize_b', FALSE, $format );
}
}
+42
View File
@@ -0,0 +1,42 @@
<?php
/**
* @brief Template Plugin - Include PHP File
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @since 5 Feb 2015
* @version SVN_VERSION_NUMBER
*/
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 - Include PHP file
*/
class _Insert
{
/**
* @brief Can be used when compiling CSS
*/
public static $canBeUsedInCss = FALSE;
/**
* 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 )
{
return '\IPS\Output::safeInclude( "' . $data . '" )';
}
}
+101
View File
@@ -0,0 +1,101 @@
<?php
/**
* @brief Template Plugin - Lang
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @since 18 Feb 2013
* @version SVN_VERSION_NUMBER
*/
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 - Lang
*/
class _Lang
{
/**
* @brief Can be used when compiling CSS
*/
public static $canBeUsedInCss = FALSE;
/**
* Run the plug-in
*
* @param string $data The initial data from the tag
* @param array $options Array of options
* @return array array( 'pre' => Code to eval before 'return', 'return' => Code to eval to return desired value )
*/
public static function runPlugin( $data, $options )
{
$return = array();
$return['pre'] = null;
$params = array();
$data = \IPS\Theme::expandShortcuts( $data );
if( \substr( $data, 0, 1 ) !== '\\' and \strpos( $data, '$' ) !== FALSE )
{
if ( \strpos( $data, '$' ) === 0 )
{
$data = '{' . $data . '}';
}
$return['pre'] .= '$val = "' . $data . "\"; ";
$data = '$val';
}
else
{
$data = "'{$data}'";
}
if( isset( $options['sprintf'] ) )
{
$return['pre'] .= '$sprintf = array(' . $options['sprintf'] . '); ';
$params[]= '\'sprintf\' => $sprintf';
}
if( isset( $options['htmlsprintf'] ) )
{
$return['pre'] .= '$htmlsprintf = array(' . $options['htmlsprintf'] . '); ';
$params[]= '\'htmlsprintf\' => $htmlsprintf';
}
if( isset( $options['pluralize'] ) )
{
$return['pre'] .= '$pluralize = array( ' . $options['pluralize'] . ' ); ';
$params[] = '\'pluralize\' => $pluralize';
}
if( isset( $options['wordbreak'] ) )
{
$params[] = '\'wordbreak\' => TRUE';
}
if( isset( $options['ucfirst'] ) )
{
$params[] = '\'ucfirst\' => TRUE';
}
$vle = 'TRUE';
if( count( $params ) )
{
$vle = 'FALSE';
}
$return['return'] = '\IPS\Member::loggedIn()->language()->addToStack( htmlspecialchars( ' . $data . ', \IPS\HTMLENTITIES, \'UTF-8\', FALSE ), ' . $vle . ', array( ' . implode( ", ", $params ) . ' ) )';
return $return;
}
}
+65
View File
@@ -0,0 +1,65 @@
<?php
/**
* @brief Template Plugin - Member Data
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @since 18 Feb 2013
* @version SVN_VERSION_NUMBER
*/
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 - Member Data
*/
class _Member
{
/**
* @brief Can be used when compiling CSS
*/
public static $canBeUsedInCss = FALSE;
/**
* 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 )
{
if ( $data !== 'link()' and isset( $options['group'] ) )
{
$data = "group['{$data}']";
}
$raw = ( isset( $options['raw'] ) AND $options['raw'] ) ? TRUE : FALSE;
if ( isset( $options['id'] ) )
{
$member = "\IPS\Member::load( {$options['id']} )";
}
else
{
$member = "\IPS\Member::loggedIn()";
}
if( $raw )
{
return "{$member}->$data";
}
else
{
return "htmlspecialchars( {$member}->$data, ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', FALSE )";
}
}
}
+42
View File
@@ -0,0 +1,42 @@
<?php
/**
* @brief Template Plugin - Number
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @since 23 Jan 2014
* @version SVN_VERSION_NUMBER
*/
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 - Number
*/
class _Number
{
/**
* @brief Can be used when compiling CSS
*/
public static $canBeUsedInCss = FALSE;
/**
* 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 )
{
return "\IPS\Member::loggedIn()->language()->formatNumber( {$data} )";
}
}
+71
View File
@@ -0,0 +1,71 @@
<?php
/**
* @brief Template Plugin - Vendor prefix. Takes a CSS property name and returns a prefixed string.
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @since 12 Aug 2013
* @version SVN_VERSION_NUMBER
*/
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 - Vendor prefix
*/
class _Prefix
{
/**
* @brief Can be used when compiling CSS
*/
public static $canBeUsedInCss = TRUE;
/**
* Defined here so that we can remove names later as browser support for the non-prefixed version improves, without changing our css.
*
* @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'
);
/**
* @brief Supported vendor prefixes
*/
protected static $prefixes = array( '-webkit-', '-moz-', '-ms-', '-o-', '' );
/**
* Run the plug-in
*
* @param string $data The initial data from the tag
* @param array $options Array of options
* @return string Code to eval
* @note Occasionally a style isn't consistent between browsers, so simply adding a prefix isn't always sufficient - you may need other CSS to resolve browser inconsistencies
*/
public static function runPlugin( $data, $options )
{
if ( in_array( $data, static::$supportedStyles ) )
{
$output = '';
foreach ( static::$prefixes as $prefix )
{
$output[] = $prefix . $data . ': ' . $options['value'] . ";";
}
return '"' . implode( "\r\n\t", $output ) . '"';
}
else
{
return '"' . $data . ': ' . $options['value'] . ";\r\n" . '"';
}
}
}
+49
View File
@@ -0,0 +1,49 @@
<?php
/**
* @brief Template Plugin - Request
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @since 18 Feb 2013
* @version SVN_VERSION_NUMBER
*/
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 - Request
*/
class _Request
{
/**
* @brief Can be used when compiling CSS
*/
public static $canBeUsedInCss = FALSE;
/**
* 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 )
{
if( isset( $options['raw'] ) AND $options['raw'] )
{
return "\IPS\Request::i()->$data";
}
else
{
return "htmlspecialchars( \IPS\Request::i()->$data, ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', FALSE )";
}
}
}
+48
View File
@@ -0,0 +1,48 @@
<?php
/**
* @brief Template Plugin - Theme Resource (image, font, theme-specific JS, etc)
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @since 18 Feb 2013
* @version SVN_VERSION_NUMBER
*/
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 - Theme Resource (image, font, theme-specific JS, etc)
*/
class _Resource
{
/**
* @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
* @param string $context The name of the calling function
* @return string Code to eval
*/
public static function runPlugin( $data, $options, $context )
{
$exploded = explode( '_', $context );
$app = ( isset( $options['app'] ) ? $options['app'] : ( isset( $exploded[1] ) ? $exploded[1] : '' ) );
$location = ( isset( $options['location'] ) ? $options['location'] : ( isset( $exploded[2] ) ? $exploded[2] : '' ) );
$noProtocol = ( isset( $options['noprotocol'] ) ) ? $options['noprotocol'] : "false";
return "\\IPS\\Theme::i()->resource( \"{$data}\", \"{$app}\", '{$location}', {$noProtocol} )";
}
}
+43
View File
@@ -0,0 +1,43 @@
<?php
/**
* @brief Template Plugin - Setting
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @since 18 Feb 2013
* @version SVN_VERSION_NUMBER
*/
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 - Setting
*/
class _Setting
{
/**
* @brief Can be used when compiling CSS
* @note Using setting in plugins will require a rebuild of the CSS file they're used in when the setting is changed
*/
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 )
{
return "\IPS\Settings::i()->$data";
}
}
+42
View File
@@ -0,0 +1,42 @@
<?php
/**
* @brief Template Plugin - Strip HTML tags
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @since 18 Dec 2013
* @version SVN_VERSION_NUMBER
*/
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 - Strip HTML tags
*/
class _Striptags
{
/**
* @brief Can be used when compiling CSS
*/
public static $canBeUsedInCss = FALSE;
/**
* 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 )
{
return "strip_tags( $data )";
}
}
+74
View File
@@ -0,0 +1,74 @@
<?php
/**
* @brief Template Plugin - Template
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @since 18 Feb 2013
* @version SVN_VERSION_NUMBER
*/
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 - Template
*/
class _Template
{
/**
* @brief Can be used when compiling CSS
*/
public static $canBeUsedInCss = FALSE;
/**
* 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, $functionName=NULL, $calledClass='IPS\Theme' )
{
$params = ( in_array( 'params', array_keys( $options ) ) ) ? $options['params'] : '';
if( mb_strpos( $data, '$' ) === 0 )
{
$data = '{' . $data . '}';
}
if ( isset( $options['object'] ) )
{
return $options['object'] . "->{$data}( {$params} )";
}
else
{
$app = isset( $options['app'] ) ? "\"{$options['app']}\"" : '\IPS\Request::i()->app';
if ( isset( $options['location'] ) )
{
$app .= ", '{$options['location']}'";
}
if ( isset( $options['themeClass'] ) )
{
$calledClass = $options['themeClass'];
}
$it = array( 'return' => '\\' . $calledClass . "::i()->getTemplate( \"{$options['group']}\", {$app} )->{$data}( {$params} )" );
if ( isset( $options['if'] ) )
{
$it['pre'] = "if ( " . \IPS\Theme::expandShortcuts( $options['if'] ) . " ):\n";
$it['post'] = "\nendif;";
}
return $it;
}
}
}
+56
View File
@@ -0,0 +1,56 @@
<?php
/**
* @brief Template Plugin - Theme Setting
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @since 18 Feb 2013
* @version SVN_VERSION_NUMBER
*/
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 - Theme settings
*/
class _Theme
{
/**
* @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 )
{
switch( $data )
{
case 'logo_front':
return "\IPS\Theme::i()->logo_front";
break;
case 'logo_sharer':
return "\IPS\Theme::i()->logo_sharer";
break;
case 'logo_favicon':
return "\IPS\Theme::i()->logo_favicon";
break;
default:
return ( isset( \IPS\Theme::i()->settings[ $data ] ) ) ? "\IPS\Theme::i()->settings['{$data}']" : '';
break;
}
}
}
+53
View File
@@ -0,0 +1,53 @@
<?php
/**
* @brief Template Plugin - Truncate
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @since 28 Aug 2013
* @version SVN_VERSION_NUMBER
*/
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 - Truncate
*/
class _Truncate
{
/**
* @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 )
{
if( !$options['length'] )
{
return "\"{$data}\"";
}
$options['start'] = ( !empty($options['start']) ) ? $options['start'] : 0;
$options['append'] = ( !empty($options['append']) ) ? $options['append'] : "&hellip;";
$_argument = ( mb_strpos( $data, '$' ) !== FALSE ) ? $data : '"' . $data . '"';
$_length = ( mb_strpos( $options['length'], '$' ) !== FALSE ) ? $options['length'] : '"' . $options['length'] . '"';
return "htmlentities( mb_substr( {$_argument}, '{$options['start']}', {$_length} ), ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', FALSE ) . ( ( mb_strlen( {$_argument} ) > {$_length} ) ? '{$options['append']}' : '' )";
}
}
+96
View File
@@ -0,0 +1,96 @@
<?php
/**
* @brief Template Plugin - URL
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @since 18 Feb 2013
* @version SVN_VERSION_NUMBER
*/
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 - URL
*/
class _Url
{
/**
* @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 )
{
$csrf = '';
if ( isset( $options['csrf'] ) )
{
$csrf = ' . "&csrfKey=" . \IPS\Session::i()->csrfKey';
}
$location = ( in_array( 'base', array_keys( $options ) ) ) ? '"' . $options['base'] . '"' : 'null';
if ( !isset( $options['seoTemplate'] ) )
{
$options['seoTemplate'] = '';
}
if ( isset( $options['seoTitle'] ) )
{
$options['seoTitles'] = "array( {$options['seoTitle']} )";
}
elseif( !isset( $options['seoTitles'] ) )
{
$options['seoTitles'] = 'array()';
}
if ( !isset( $options['protocol'] ) )
{
$options['protocol'] = \IPS\Http\Url::PROTOCOL_AUTOMATIC;
}
$fragment = "";
if ( isset( $options['fragment'] ) )
{
$fragment = "->setFragment(\"{$options['fragment']}\")";
}
$_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;
}
elseif ( isset( $options['ips'] ) )
{
$url = "\IPS\Http\Url::ips( \"docs/$data\" )";
}
else
{
$url = "str_replace( '&', '&amp;', \IPS\Http\Url::internal( {$_data}{$csrf}, {$location}, \"{$options['seoTemplate']}\", {$options['seoTitles']}, {$options['protocol']} ){$fragment} )";
}
if( isset( $options['noprotocol'] ) AND $options['noprotocol'] )
{
$url = "str_replace( array( 'http://', 'https://' ), '//', {$url} )";
}
return $url;
}
}
+42
View File
@@ -0,0 +1,42 @@
<?php
/**
* @brief Template Plugin - Wordbreak
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @since 28 Aug 2013
* @version SVN_VERSION_NUMBER
*/
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 - Truncate
*/
class _Wordbreak
{
/**
* @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 )
{
return "\IPS\Lang::wordbreak( htmlentities( {$data}, ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', FALSE ) )";
}
}
View File
Whitespace-only changes.