Bug #19580 » 0009748_v2.patch

Administrator Admin, 2008-11-12 13:10

View differences:

typo3/sysext/cms/tslib/class.tslib_content.php (Arbeitskopie)
5984 5984
		$parts = explode('->',$funcName);
5985 5985
		if (count($parts)==2)	{	// Class
5986 5986
			$cls = t3lib_div::makeInstanceClassName($parts[0]);
5987
			if (class_exists ($cls))	{
5987
				// Check whether class is available and try to reload includeLibs if possible:
5988
			if ($this->isClassAvailable($cls, $conf)) {
5988 5989
				$classObj = new $cls;
5989 5990
				if (method_exists($classObj, $parts[1]))	{
5990 5991
					$classObj->cObj = &$this;
......
6393 6394
		return false;
6394 6395
	}
6395 6396

  
6397
	/**
6398
	 * Checks whether a PHP class is available. If the check fails, the method tries to
6399
	 * determine the correct includeLibs to make the class available automatically.
6400
	 *
6401
	 * TypoScript example that can cause this:
6402
	 * | plugin.tx_myext_pi1 = USER
6403
	 * | plugin.tx_myext_pi1 {
6404
	 * |   includeLibs = EXT:myext/pi1/class.tx_myext_pi1.php
6405
	 * |   userFunc = tx_myext_pi1->main
6406
	 * | }
6407
	 * | 10 = USER
6408
	 * | 10.userFunc = tx_myext_pi1->renderHeader
6409
	 *
6410
	 * @param	string		$className: The name of the PHP class to be checked
6411
	 * @param	array		$config: TypoScript configuration (naturally of a USER or COA cObject)
6412
	 * @return	boolean		Whether the class is available
6413
	 * @link	http://bugs.typo3.org/view.php?id=9654
6414
	 * @TODO	This method was introduced in TYPO3 4.3 and can be removed if the autoload was integrated
6415
	 */
6416
	protected function isClassAvailable($className, array $config) {
6417
		if (class_exists($className)) {
6418
			return true;
6419
		} else {
6420
			$pluginConfiguration =& $GLOBALS['TSFE']->tmpl->setup['plugin.'][$className . '.'];
6421
			if (isset($pluginConfiguration['includeLibs']) && $pluginConfiguration['includeLibs']) {
6422
				$config['includeLibs'] = $pluginConfiguration['includeLibs'];
6423
				return $this->includeLibs($config);
6424
			}
6425
		}
6426
		return false;
6427
	}
6396 6428

  
6397 6429

  
6398 6430

  
......
6420 6452

  
6421 6453

  
6422 6454

  
6455

  
6423 6456
	/***********************************************
6424 6457
	 *
6425 6458
	 * Database functions, making of queries
(2-2/2)