Version 3.2.3
This commit is contained in:
1 parent
ae5c01cc78
commit
78706903a2
2641 files changed
+228363
-201264
No files matched your search
@@ -3,21 +3,20 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* IP.Board v3.2.3
|
||||
* Template Parser : Converts HTML "logic" into PHP code
|
||||
* Last Updated: $Date: 2010-10-12 18:11:26 -0400 (Tue, 12 Oct 2010) $
|
||||
* Last Updated: $Date: 2011-05-12 22:28:10 -0400 (Thu, 12 May 2011) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @license This is NULLED!
|
||||
* @package IP.Board
|
||||
* @subpackage Kernel
|
||||
* @link http://www.invisionpower.com
|
||||
* @link http://hatynka.in
|
||||
* @since Wednesday 23rd February 2005 13:53
|
||||
* @version $Revision: 476 $
|
||||
* @version $Revision: 8754 $
|
||||
*
|
||||
* @todo [Future] Explore converting this to an XSLT parser (ala Digi)
|
||||
*/
|
||||
|
||||
define( 'IPS_TEMPLATE_DEBUG' , 0 );
|
||||
@@ -95,10 +94,10 @@ class classTemplate
|
||||
* Foreach function blocks
|
||||
* Holds the foreach code
|
||||
*
|
||||
* @access private
|
||||
* @access protected
|
||||
* @var array Holds foreach blocks
|
||||
*/
|
||||
private $foreach_blocks = array();
|
||||
protected $foreach_blocks = array();
|
||||
|
||||
/**
|
||||
* Allow PHP code to execute
|
||||
@@ -111,30 +110,30 @@ class classTemplate
|
||||
/**
|
||||
* Modifiers path
|
||||
*
|
||||
* @access private
|
||||
* @access protected
|
||||
* @var string Path to modifiers directory
|
||||
*/
|
||||
static private $template_plugins_class_path;
|
||||
static protected $template_plugins_class_path;
|
||||
|
||||
/**
|
||||
* Modifiers clases
|
||||
*
|
||||
* @access private
|
||||
* @access protected
|
||||
* @var array Array of modifier classes
|
||||
*/
|
||||
static private $template_plugin_classes = array();
|
||||
static protected $template_plugin_classes = array();
|
||||
|
||||
private $_skinGroup = '';
|
||||
protected $_skinGroup = '';
|
||||
|
||||
/**
|
||||
* Escaped double quote replacement
|
||||
* Part of a hackish fix to retain manual escpaes in PHP code blocks
|
||||
* but not elsewhere in the code
|
||||
*
|
||||
* @access private
|
||||
* @access protected
|
||||
* @var string
|
||||
*/
|
||||
private $_dqReplacement = '{{^|^escapedDQ^|^}}';
|
||||
protected $_dqReplacement = '{{^|^escapedDQ^|^}}';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@@ -233,12 +232,12 @@ EOF;
|
||||
*
|
||||
* Extracts function data
|
||||
*
|
||||
* @access private
|
||||
* @access protected
|
||||
* @param string The actual contents of the class, php tags 'an all.
|
||||
* @param array Functions to find
|
||||
* @return string Converted content
|
||||
*/
|
||||
private function _returnFunctionData( $data='', $function_find=array() )
|
||||
protected function _returnFunctionData( $data='', $function_find=array() )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
@@ -311,6 +310,7 @@ EOF;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Build the file...
|
||||
@@ -443,6 +443,7 @@ EOF;
|
||||
|
||||
$end = $this->_processPluginTags( $end );
|
||||
|
||||
/* #todo: we don't use any IPSData or IPSActiveMember that I can remember of. We can remove it I think? */
|
||||
$end = preg_replace( '#\{IPS(Data|ActiveMember|Member|Lib|Text)\:\:([^\}]+?)\}#', '" . ' . "IPS\\1::\\2" . ' . "', $end );
|
||||
$end = preg_replace( '#\{\\\$this->(settings|request)->([^\}]+?)\}#' , '" . ' . "\$this->\\1->\\2" . ' . "', $end );
|
||||
|
||||
@@ -507,7 +508,13 @@ EOF;
|
||||
|
||||
if( strpos( $r, '=' ) )
|
||||
{
|
||||
$r = substr( $r, 0, strpos( $r, '=' ) );
|
||||
$r = trim( substr( $r, 0, strpos( $r, '=' ) ) );
|
||||
}
|
||||
|
||||
/* Try to fix fatal errors caused by type-hinting */
|
||||
if( strpos( $r, ' ' ) )
|
||||
{
|
||||
$r = trim( substr( $r, strpos( $r, ' ' ) ) );
|
||||
}
|
||||
|
||||
$_funcDataNames[] = trim( $r );
|
||||
@@ -646,12 +653,12 @@ EOF;
|
||||
*
|
||||
* Process the HTML logic 'foreach' tags
|
||||
*
|
||||
* @access private
|
||||
* @access protected
|
||||
* @param string Content
|
||||
* @param string Normal function parameters
|
||||
* @return string Converted content
|
||||
*/
|
||||
private function _processForeachLogic( $text, $normal_func_data='', $func_name='' )
|
||||
protected function _processForeachLogic( $text, $normal_func_data='', $func_name='' )
|
||||
{
|
||||
//----------------------------------------
|
||||
// INIT
|
||||
@@ -681,7 +688,7 @@ EOF;
|
||||
|
||||
foreach( $_tmp_func_data as $_i )
|
||||
{
|
||||
preg_match( "#".'\$'.'(\w+)(=|,|$)#i', $_i, $match );
|
||||
preg_match( "#".'\$'.'(\w+)\s*(=|,|$)#i', $_i, $match );
|
||||
|
||||
if( count($match) )
|
||||
{
|
||||
@@ -873,7 +880,7 @@ EOF;
|
||||
}
|
||||
}
|
||||
|
||||
$block = $this->_processForeachLogic($block, $_normal_func_data, $func_name);
|
||||
$block = $this->_processForeachLogic($block, trim($_normal_func_data, ','), $func_name);
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
@@ -900,7 +907,7 @@ EOF;
|
||||
// Create PHP statement
|
||||
//----------------------------------------
|
||||
$__i_count++;
|
||||
|
||||
|
||||
$function_name = '__f__'. md5( $__i_count . str_replace( '.', '_', uniqid( mt_rand(), TRUE ) ) );
|
||||
$php_statement = '<xxforeach_'.$function_name.'xx>$this->'.$function_name.'('.$clean_func_data.')</xxforeach_'.$function_name.'xx>';
|
||||
$php_block = $this->_processHtmlLogic( addslashes($block), $func_name );
|
||||
@@ -969,11 +976,11 @@ EOF;
|
||||
*
|
||||
* Process the HTML logic 'php' tags
|
||||
*
|
||||
* @access private
|
||||
* @access protected
|
||||
* @param string Content
|
||||
* @return string Converted content
|
||||
*/
|
||||
private function _processPhpTags( $text )
|
||||
protected function _processPhpTags( $text )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
@@ -1016,11 +1023,11 @@ EOF;
|
||||
* Process the template modifier tags
|
||||
* Convert {parse ...} tags
|
||||
*
|
||||
* @access private
|
||||
* @access protected
|
||||
* @param string Content
|
||||
* @return string Converted content
|
||||
*/
|
||||
private function _processPluginTags( $text )
|
||||
protected function _processPluginTags( $text )
|
||||
{
|
||||
$text = IPSText::replaceRecursively( $text, '{parse', '\"}', array( 'classTemplate', '_processPluginTagsCallback' ) );
|
||||
//print "\n\n========\n\n".$text."\n\n========\n\n";
|
||||
@@ -1060,12 +1067,11 @@ EOF;
|
||||
if ( ! isset( self::$template_plugin_classes[ $_plugin ] ) || ! is_object( self::$template_plugin_classes[ $_plugin ] ) )
|
||||
{
|
||||
$filepath = self::$template_plugins_class_path . '/tp_' . $_plugin . '.php';
|
||||
$classname = 'tp_' . $_plugin;
|
||||
|
||||
if ( file_exists( $filepath ) )
|
||||
|
||||
if ( is_file( $filepath ) )
|
||||
{
|
||||
require_once( $filepath );
|
||||
|
||||
$classname = IPSLib::loadLibrary( $filepath, 'tp_' . $_plugin );
|
||||
|
||||
if ( class_exists( $classname ) )
|
||||
{
|
||||
$_class = new ReflectionClass( $classname );
|
||||
@@ -1159,13 +1165,13 @@ EOF;
|
||||
*
|
||||
* Process the normal HTML logic (if, else)
|
||||
*
|
||||
* @access private
|
||||
* @access protected
|
||||
* @param string Content
|
||||
* @param string Function name
|
||||
*
|
||||
* @return string Converted content
|
||||
*/
|
||||
private function _processHtmlLogic( $text, $func_name='' )
|
||||
protected function _processHtmlLogic( $text, $func_name='' )
|
||||
{
|
||||
//----------------------------------------
|
||||
// INIT
|
||||
@@ -1543,11 +1549,11 @@ EOF;
|
||||
/**
|
||||
* Convert IPB Heredoc PHP code to html logic
|
||||
*
|
||||
* @access private
|
||||
* @access protected
|
||||
* @param string Raw PHP content
|
||||
* @return string Converted HTML Logic content
|
||||
*/
|
||||
private function _reverseIpsHtml( $code )
|
||||
protected function _reverseIpsHtml( $code )
|
||||
{
|
||||
$code = $this->_trimSlashes($code);
|
||||
|
||||
@@ -1562,11 +1568,11 @@ EOF;
|
||||
/**
|
||||
* Trim newlines
|
||||
*
|
||||
* @access private
|
||||
* @access protected
|
||||
* @param string Raw code
|
||||
* @return string Code with newlines trimmed
|
||||
*/
|
||||
private function _trimNewlines($code)
|
||||
protected function _trimNewlines($code)
|
||||
{
|
||||
$code = preg_replace("/^\n{1,}/s", "", $code );
|
||||
$code = preg_replace("/\n{1,}$/s", "", $code );
|
||||
@@ -1576,11 +1582,11 @@ EOF;
|
||||
/**
|
||||
* Trim empty if tag newlines
|
||||
*
|
||||
* @access private
|
||||
* @access protected
|
||||
* @param string Raw code
|
||||
* @return string Code with newlines trimmed
|
||||
*/
|
||||
private function _trimEmptyIfs($code)
|
||||
protected function _trimEmptyIfs($code)
|
||||
{
|
||||
return preg_replace('/\"\n\s+?\"/s', "\"\"", $code );
|
||||
}
|
||||
@@ -1588,11 +1594,11 @@ EOF;
|
||||
/**
|
||||
* Trim slashes
|
||||
*
|
||||
* @access private
|
||||
* @access protected
|
||||
* @param string Raw code
|
||||
* @return string Code with slashes trimmed
|
||||
*/
|
||||
private function _trimSlashes($code)
|
||||
protected function _trimSlashes($code)
|
||||
{
|
||||
$code = str_replace( '\"' , '"', $code );
|
||||
$code = str_replace( "\\'", "'", $code );
|
||||
@@ -1602,11 +1608,11 @@ EOF;
|
||||
/**
|
||||
* Add a debug message if debugging enabled
|
||||
*
|
||||
* @access private
|
||||
* @access protected
|
||||
* @param string Message
|
||||
* @return mixed boolean on success, void when not executed
|
||||
*/
|
||||
private function _addDebug( $msg )
|
||||
protected function _addDebug( $msg )
|
||||
{
|
||||
if ( IPS_TEMPLATE_DEBUG AND IPS_TEMPLATE_DEBUG_FILE )
|
||||
{
|
||||
@@ -1624,4 +1630,4 @@ EOF;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user