Project

General

Profile

Bug #19580 » 0009748.patch

Administrator Admin, 2008-11-06 15:34

View differences:

typo3/sysext/cms/tslib/class.tslib_content.php (Arbeitskopie)
$parts = explode('->',$funcName);
if (count($parts)==2) { // Class
$cls = t3lib_div::makeInstanceClassName($parts[0]);
if (class_exists ($cls)) {
// Check whether class is available and try to reload includeLibs if possible:
if ($this->isClassAvailable($cls, $conf)) {
$classObj = new $cls;
if (method_exists($classObj, $parts[1])) {
$classObj->cObj = &$this;
......
if (isset($config['includeLibs']) && $config['includeLibs']) {
$libraries = t3lib_div::trimExplode(',', $config['includeLibs'], true);
$GLOBALS['TSFE']->includeLibraries($libraries);
return true;
}
return false;
}
/**
* Checks whether a PHP class is available. If the check fails, the method tries to
* determine the correct includeLibs to make the class available automatically.
*
* TypoScript example that can cause this:
* | plugin.tx_myext_pi1 = USER
* | plugin.tx_myext_pi1 {
* | includeLibs = EXT:myext/pi1/class.tx_myext_pi1.php
* | userFunc = tx_myext_pi1->main
* | }
* | 10 = USER
* | 10.userFunc = tx_myext_pi1->renderHeader
*
* @param string $className: The name of the PHP class to be checked
* @param array $config: TypoScript configuration (naturally of a USER or COA cObject)
* @return boolean Whether the class is available
* @link http://bugs.typo3.org/view.php?id=9654
*/
protected function isClassAvailable($className, array $config) {
if (class_exists($className)) {
return true;
} else {
$pluginConfiguration =& $GLOBALS['TSFE']->tmpl->setup['plugin.'][$className . '.'];
if (isset($pluginConfiguration['includeLibs']) && $pluginConfiguration['includeLibs']) {
$config['includeLibs'] = $pluginConfiguration['includeLibs'];
return $this->includeLibs($config);
}
}
return false;
}
......
/***********************************************
*
* Database functions, making of queries
(1-1/2)