Bug #19580 » 0009748.patch

Administrator Admin, 2008-11-06 15:34

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;
......
6388 6389
		if (isset($config['includeLibs']) && $config['includeLibs']) {
6389 6390
			$libraries = t3lib_div::trimExplode(',', $config['includeLibs'], true);
6390 6391
			$GLOBALS['TSFE']->includeLibraries($libraries);
6392
			return true;
6391 6393
		}
6394
		return false;
6392 6395
	}
6393 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
	 */
6415
	protected function isClassAvailable($className, array $config) {
6416
		if (class_exists($className)) {
6417
			return true;
6418
		} else {
6419
			$pluginConfiguration =& $GLOBALS['TSFE']->tmpl->setup['plugin.'][$className . '.'];
6420
			if (isset($pluginConfiguration['includeLibs']) && $pluginConfiguration['includeLibs']) {
6421
				$config['includeLibs'] = $pluginConfiguration['includeLibs'];
6422
				return $this->includeLibs($config);
6423
			}
6424
		}
6425
		return false;
6426
	}
6394 6427

  
6395 6428

  
6396 6429

  
......
6418 6451

  
6419 6452

  
6420 6453

  
6454

  
6421 6455
	/***********************************************
6422 6456
	 *
6423 6457
	 * Database functions, making of queries
(1-1/2)