ExtBase:
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Classes / Configuration / Source / PhpSource.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 *
17 * This script is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * This copyright notice MUST APPEAR in all copies of the script!
23 ***************************************************************/
24
25 /**
26 * Configuration source based on PHP files
27 *
28 * @package TYPO3
29 * @subpackage extbase
30 * @version $ID:$
31 */
32 class Tx_ExtBase_Configuration_Source_PhpSource implements Tx_ExtBase_Configuration_SourceInterface {
33
34 /**
35 * Loads the specified configuration file and returns its content as an
36 * array. If the file does not exist or could not be loaded, an empty
37 * array is returned
38 *
39 * @param string $extensionName The extension name
40 * @return array
41 */
42 public function load($extensionName) {
43 $pathAndFilename = t3lib_extMgm::extPath(strtolower($extensionName)) . '/Configuration/Settings';
44 $c = t3lib_div::makeInstance('Tx_ExtBase_Configuration_Container');
45 if (file_exists($pathAndFilename . '.php')) {
46 require ($pathAndFilename . '.php');
47 }
48 return $c->getAsArray();
49 }
50 }
51 ?>