Commit ca1c3ea4 authored by Thomas Maroschik's avatar Thomas Maroschik
Browse files

[TASK] Merge submodule fluid into core

parents 213707ca d48e5007
[submodule "typo3/sysext/version"]
path = typo3/sysext/version
url = git://git.typo3.org/TYPO3v4/CoreProjects/workspaces/version.git
[submodule "typo3/sysext/fluid"]
path = typo3/sysext/fluid
url = git://git.typo3.org/TYPO3v4/CoreProjects/MVC/fluid.git
fluid @ c7216e74
Subproject commit c7216e7430b3c067d49aa31a3e09d76b3672f3fa
<?php
/* *
* This script is part of the TYPO3 project - inspiring people to share! *
* *
* TYPO3 is free software; you can redistribute it and/or modify it under *
* the terms of the GNU General Public License version 2 as published by *
* the Free Software Foundation. *
* *
* This script is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- *
* TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
* Public License for more details. *
* */
/**
* @package
* @subpackage
* @version $Id$
*/
/**
* Class extending the docbook generator service for use in typo3 v4.
*
* Usage in TypoScript:
*
*
config.disableAllHeaderCode = 1
page = PAGE
page.10 = USER_INT
page.10.userFunc = Tx_Fluid_Compatibility_DocbookGeneratorService->userFunc
* @internal
*/
class Tx_Fluid_Compatibility_DocbookGeneratorService extends Tx_Fluid_Service_DocbookGenerator {
public function userFunc() {
if (!class_exists('Tx_Extbase_Utility_ClassLoader')) {
require(t3lib_extmgm::extPath('extbase') . 'Classes/Utility/ClassLoader.php');
}
$classLoader = new Tx_Extbase_Utility_ClassLoader();
spl_autoload_register(array($classLoader, 'loadClass'));
return $this->generateDocbook('Tx_Fluid_ViewHelpers');
}
protected function getClassNamesInNamespace($namespace) {
$namespaceParts = explode('_', $namespace);
if ($namespaceParts[count($namespaceParts) -1] == '') {
}
$classFilePathAndName = t3lib_extMgm::extPath(t3lib_div::camelCaseToLowerCaseUnderscored($namespaceParts[1])) . 'Classes/';
$classFilePathAndName .= implode(array_slice($namespaceParts, 2, -1), '/') . '/';
$classNames = array();
$this->recursiveClassNameSearch($namespace, $classFilePathAndName, $classNames);
sort($classNames);
return $classNames;
}
private function recursiveClassNameSearch($namespace, $directory, &$classNames) {
$dh = opendir($directory);
while (($file = readdir($dh)) !== false) {
if ($file == '.' || $file == '..' || $file == '.svn') continue;
if (is_file($directory . $file)) {
if (substr($file, 0, 8) == 'Abstract') continue;
$classNames[] = $namespace . substr($file, 0, -4);
} elseif (is_dir($directory . $file)) {
$this->recursiveClassNameSearch($namespace . $file . '_' , $directory . $file . '/', $classNames);
}
}
closedir($dh);
}
protected function instanciateViewHelper($className) {
$objectFactory = t3lib_div::makeInstance('Tx_Fluid_Compatibility_ObjectFactory');
return $objectFactory->create($className);
}
}
?>
\ No newline at end of file
<?php
/* *
* This script is part of the TYPO3 project - inspiring people to share! *
* *
* TYPO3 is free software; you can redistribute it and/or modify it under *
* the terms of the GNU General Public License version 2 as published by *
* the Free Software Foundation. *
* *
* This script is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- *
* TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
* Public License for more details. *
* */
/**
* @package
* @subpackage
* @version $Id: ObjectFactory.php 1734 2009-11-25 21:53:57Z stucki $
*/
/**
* Class emulating the object factory for Fluid v4.
*
* DO NOT USE DIRECTLY!
* @internal
*/
class Tx_Fluid_Compatibility_ObjectManager implements t3lib_Singleton {
protected $injectors = array(
'Tx_Fluid_ViewHelpers_Form_AbstractFormViewHelper' => array(
'injectPersistenceManager' => 'Tx_Extbase_Persistence_Manager'
),
'Tx_Fluid_Core_ViewHelper_AbstractViewHelper' => array(
'injectReflectionService' => 'Tx_Extbase_Reflection_Service'
),
'Tx_Fluid_Core_ViewHelper_TagBasedViewHelper' => array(
'injectTagBuilder' => 'Tx_Fluid_Core_ViewHelper_TagBuilder'
),
'Tx_Fluid_Core_Parser_ParsingState' => array(
'injectVariableContainer' => 'Tx_Fluid_Core_ViewHelper_TemplateVariableContainer'
),
'Tx_Fluid_Core_Parser_TemplateParser' => array(
'injectObjectManager' => 'Tx_Fluid_Compatibility_ObjectManager'
),
'Tx_Fluid_Core_Rendering_RenderingContext' => array(
'injectObjectManager' => 'Tx_Fluid_Compatibility_ObjectManager'
),
'Tx_Fluid_Core_Parser_Interceptor_Escape' => array(
'injectObjectManager' => 'Tx_Fluid_Compatibility_ObjectManager'
),
'Tx_Extbase_Validation_ValidatorResolver' => array(
'injectObjectManager' => 'Tx_Extbase_Object_Manager'
),
'Tx_Fluid_ViewHelpers_FormViewHelper' => array(
'injectRequestHashService' => 'Tx_Extbase_Security_Channel_RequestHashService'
)
);
/**
* Create a certain object name
*
* DO NOT USE DIRECTLY!
*
* @param string $objectName Object name to create
* @return object Object which was created
* @internal
*/
public function create($objectName) {
$constructorArguments = func_get_args();
$object = call_user_func_array(array('t3lib_div', 'makeInstance'), $constructorArguments);
$injectObjects = array();
if (isset($this->injectors[$objectName])) {
$injectObjects = array_merge($injectObjects, $this->injectors[$objectName]);
}
foreach (class_parents($objectName) as $parentObjectName) {
if (isset($this->injectors[$parentObjectName])) {
$injectObjects = array_merge($injectObjects, $this->injectors[$parentObjectName]);
}
}
foreach (class_implements($objectName) as $parentObjectName) {
if (isset($this->injectors[$parentObjectName])) {
$injectObjects = array_merge($injectObjects, $this->injectors[$parentObjectName]);
}
}
foreach ($injectObjects as $injectMethodName => $injectObjectName) {
call_user_func(array($object, $injectMethodName), $this->create($injectObjectName));
}
return $object;
}
public function get($objectName) {
return $this->create($objectName);
}
}
?>
\ No newline at end of file
<?php
/* *
* This script is part of the TYPO3 project - inspiring people to share! *
* *
* TYPO3 is free software; you can redistribute it and/or modify it under *
* the terms of the GNU General Public License version 2 as published by *
* the Free Software Foundation. *
* *
* This script is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- *
* TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
* Public License for more details. *
* */
/**
* @package
* @subpackage
* @version $Id$
*/
/**
* Build a template parser.
* Use this class to get a fresh instance of a correctly initialized Fluid template parser.
*/
class Tx_Fluid_Compatibility_TemplateParserBuilder {
/**
* Creates a new TemplateParser which is correctly initialized. This is the correct
* way to get a Fluid parser instance.
*
* @return Tx_Fluid_Core_TemplateParser A correctly initialized Template Parser
*/
static public function build() {
$templateParser = t3lib_div::makeInstance('Tx_Fluid_Core_Parser_TemplateParser');
$templateParser->injectObjectManager(t3lib_div::makeInstance('Tx_Fluid_Compatibility_ObjectManager'));
return $templateParser;
}
}
?>
\ No newline at end of file
<?php
/* *
* This script belongs to the FLOW3 package "Fluid". *
* *
* It is free software; you can redistribute it and/or modify it under *
* the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation, either version 3 of the License, or (at your *
* option) any later version. *
* *
* This script is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- *
* TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser *
* General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with the script. *
* If not, see http://www.gnu.org/licenses/lgpl.html *
* *
* The TYPO3 project - inspiring people to share! *
* */
/**
* A generic Fluid Core exception.
*
* @version $Id$
* @package Fluid
* @subpackage Core
* @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
* @api
*/
class Tx_Fluid_Core_Exception extends Tx_Fluid_Exception {
}
?>
\ No newline at end of file
<?php
/* *
* This script belongs to the FLOW3 package "Fluid". *
* *
* It is free software; you can redistribute it and/or modify it under *
* the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation, either version 3 of the License, or (at your *
* option) any later version. *
* *
* This script is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- *
* TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser *
* General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with the script. *
* If not, see http://www.gnu.org/licenses/lgpl.html *
* *
* The TYPO3 project - inspiring people to share! *
* */
/**
* The parser configuration. Contains all configuration needed to configure
* the building of a SyntaxTree.
*
* @version $Id: Configuration.php 4269 2010-05-05 10:03:16Z robert $
* @package Fluid
* @subpackage Core\Parser
* @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
* @scope prototype
*/
class Tx_Fluid_Core_Parser_Configuration {
/**
* generic interceptors registered with the configuration.
* @var array<\SplObjectStorage>
*/
protected $interceptors;
/**
* Set up the internals...
*
* @author Karsten Dambekalns <karsten@typo3.org>
*/
public function __construct() {
$this->interceptors = array();
}
/**
* Adds an interceptor to apply to values coming from object accessors.
*
* @param Tx_Fluid_Core_Parser_InterceptorInterface $interceptor
* @return void
* @author Karsten Dambekalns <karsten@typo3.org>
*/
public function addInterceptor(Tx_Fluid_Core_Parser_InterceptorInterface $interceptor) {
foreach ($interceptor->getInterceptionPoints() as $interceptionPoint) {
if (!isset($this->interceptors[$interceptionPoint])) {
$this->interceptors[$interceptionPoint] = new SplObjectStorage();
}
if (!$this->interceptors[$interceptionPoint]->contains($interceptor)) {
$this->interceptors[$interceptionPoint]->attach($interceptor);
}
}
}
/**
* Removes an interceptor to apply to values coming from object accessors.
*
* @param Tx_Fluid_Core_Parser_InterceptorInterface $interceptor
* @return void
* @author Karsten Dambekalns <karsten@typo3.org>
*/
public function removeInterceptor($interceptor) {
foreach ($interceptor->getInterceptionPoints() as $interceptionPoint) {
if ($this->interceptors[$interceptionPoint]->contains($interceptor)) {
$this->interceptors[$interceptionPoint]->detach($interceptor);
}
}
}
/**
* Returns all interceptors for a given Interception Point.
*
* @param int $interceptionPoint one of the Tx_Fluid_Core_Parser_InterceptorInterface::INTERCEPT_* constants,
* @return \SplObjectStorage<Tx_Fluid_Core_Parser_InterceptorInterface>
* @author Karsten Dambekalns <karsten@typo3.org>
*/
public function getInterceptors($interceptionPoint) {
if (isset($this->interceptors[$interceptionPoint]) && $this->interceptors[$interceptionPoint] instanceof SplObjectStorage) {
return $this->interceptors[$interceptionPoint];
}
return new SplObjectStorage();
}
}
?>
\ No newline at end of file
<?php
/* *
* This script belongs to the FLOW3 package "Fluid". *
* *
* It is free software; you can redistribute it and/or modify it under *
* the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation, either version 3 of the License, or (at your *
* option) any later version. *
* *
* This script is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- *
* TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser *
* General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with the script. *
* If not, see http://www.gnu.org/licenses/lgpl.html *
* *
* The TYPO3 project - inspiring people to share! *
* */
/**
* A Parsing Exception
*
* @version $Id$
* @package Fluid
* @subpackage Core\Parser
* @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
* @api
*/
class Tx_Fluid_Core_Parser_Exception extends Tx_Fluid_Core_Exception {
}
?>
\ No newline at end of file
<?php
/* *
* This script belongs to the FLOW3 package "Fluid". *
* *
* It is free software; you can redistribute it and/or modify it under *
* the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation, either version 3 of the License, or (at your *
* option) any later version. *
* *
* This script is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- *
* TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser *
* General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with the script. *
* If not, see http://www.gnu.org/licenses/lgpl.html *
* *
* The TYPO3 project - inspiring people to share! *
* */
/**
* An interceptor adding the escape viewhelper to the suitable places.
*
* @version $Id: Escape.php 4040 2010-04-08 16:02:57Z k-fish $
* @package Fluid
* @subpackage Core\Parser\Interceptor
* @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
*/
class Tx_Fluid_Core_Parser_Interceptor_Escape implements Tx_Fluid_Core_Parser_InterceptorInterface {
/**
* Is the interceptor enabled right now?
* @var boolean
*/
protected $interceptorEnabled = TRUE;
/**
* A stack of ViewHelperNodes which currently disable the interceptor.
* Needed to enable the interceptor again.
*
* @var array<Tx_Fluid_Core_Parser_SyntaxTree_NodeInterface>
*/
protected $viewHelperNodesWhichDisableTheInterceptor = array();
/**
* Inject object factory
*
* @param Tx_Fluid_Compatibility_ObjectManager $objectManager
* @return void
* @author Karsten Dambekalns <karsten@typo3.org>
*/
public function injectObjectManager(Tx_Fluid_Compatibility_ObjectManager $objectManager) {
$this->objectManager = $objectManager;
}
/**
* Adds a ViewHelper node using the EscapeViewHelper to the given node.
* If "escapingInterceptorEnabled" in the ViewHelper is FALSE, will disable itself inside the ViewHelpers body.
*
* @param Tx_Fluid_Core_Parser_SyntaxTree_NodeInterface $node
* @param integer $interceptorPosition One of the INTERCEPT_* constants for the current interception point
* @return Tx_Fluid_Core_Parser_SyntaxTree_NodeInterface
* @author Karsten Dambekalns <karsten@typo3.org>
* @author Sebastian Kurfürst <sebastian@typo3.org>
*/
public function process(Tx_Fluid_Core_Parser_SyntaxTree_NodeInterface $node, $interceptorPosition) {
if ($interceptorPosition === Tx_Fluid_Core_Parser_InterceptorInterface::INTERCEPT_OPENING_VIEWHELPER) {
if (!$node->getViewHelper()->isEscapingInterceptorEnabled()) {
$this->interceptorEnabled = FALSE;
$this->viewHelperNodesWhichDisableTheInterceptor[] = $node;
}
} elseif ($interceptorPosition === Tx_Fluid_Core_Parser_InterceptorInterface::INTERCEPT_CLOSING_VIEWHELPER) {
if (end($this->viewHelperNodesWhichDisableTheInterceptor) === $node) {
array_pop($this->viewHelperNodesWhichDisableTheInterceptor);
if (count($this->viewHelperNodesWhichDisableTheInterceptor) === 0) {
$this->interceptorEnabled = TRUE;
}
}
} elseif ($this->interceptorEnabled && $node instanceof Tx_Fluid_Core_Parser_SyntaxTree_ObjectAccessorNode) {
$node = $this->objectManager->create(
'Tx_Fluid_Core_Parser_SyntaxTree_ViewHelperNode',
$this->objectManager->create('Tx_Fluid_ViewHelpers_EscapeViewHelper'),
array('value' => $node)
);
}
return $node;
}
/**
* This interceptor wants to hook into object accessor creation, and opening / closing ViewHelpers.
*
* @return array Array of INTERCEPT_* constants
*/
public function getInterceptionPoints() {
return array(
Tx_Fluid_Core_Parser_InterceptorInterface::INTERCEPT_OPENING_VIEWHELPER,
Tx_Fluid_Core_Parser_InterceptorInterface::INTERCEPT_CLOSING_VIEWHELPER,
Tx_Fluid_Core_Parser_InterceptorInterface::INTERCEPT_OBJECTACCESSOR
);
}
}
?>
\ No newline at end of file
<?php
/* *
* This script belongs to the FLOW3 package "Fluid". *
* *
* It is free software; you can redistribute it and/or modify it under *
* the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation, either version 3 of the License, or (at your *
* option) any later version. *
* *
* This script is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- *
* TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser *
* General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with the script. *
* If not, see http://www.gnu.org/licenses/lgpl.html *
* *
* The TYPO3 project - inspiring people to share! *
* */
/**
* An interceptor interface. Interceptors are used in the parsing stage to change
* the syntax tree of a template, e.g. by adding viewhelper nodes.
*
* @version $Id: InterceptorInterface.php 4004 2010-03-23 14:11:29Z k-fish $
* @package Fluid
* @subpackage Core\Parser
* @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
*/
interface Tx_Fluid_Core_Parser_InterceptorInterface {
const INTERCEPT_OPENING_VIEWHELPER = 1;
const INTERCEPT_CLOSING_VIEWHELPER = 2;
const INTERCEPT_TEXT = 3;
const INTERCEPT_OBJECTACCESSOR = 4;
/**
* The interceptor can process the given node at will and must return a node
* that will be used in place of the given node.
*
* @param Tx_Fluid_Core_Parser_SyntaxTree_NodeInterface $node
* @param integer $interceptorPosition One of the INTERCEPT_* constants for the current interception point
* @return Tx_Fluid_Core_Parser_SyntaxTree_NodeInterface
*/
public function process(Tx_Fluid_Core_Parser_SyntaxTree_NodeInterface $node, $interceptorPosition);
/**
* The interceptor should define at which interception positions it wants to be called.
*
* @return array Array of INTERCEPT_* constants
*/
public function getInterceptionPoints();
}
?>
\ No newline at end of file
<?php
/* *
* This script belongs to the FLOW3 package "Fluid". *
* *
* It is free software; you can redistribute it and/or modify it under *
* the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation, either version 3 of the License, or (at your *
* option) any later version. *
* *
* This script is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- *
* TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser *
* General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with the script. *
* If not, see http://www.gnu.org/licenses/lgpl.html *
* *
* The TYPO3 project - inspiring people to share! *
* */
/**
* This interface is returned by Tx_Fluid_Core_Parser_TemplateParser->parse()
* method and is a parsed template
*
* @version $Id$