e9691f624d066a3af91fe22b6fec7dd6813cec01
[TYPO3CMS/Extensions/vcc.git] / Classes / Service / TsConfigService.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2012 Nicole Cordes <cordes@cps-it.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 * Service to handle TSConfig settings
27 *
28 * @author Nicole Cordes <cordes@cps-it.de>
29 * @package TYPO3
30 * @subpackage vcc
31 */
32 class tx_vcc_service_tsConfigService implements t3lib_Singleton {
33
34 /**
35 * @var tx_vcc_service_loggingService|NULL
36 */
37 var $loggingService = NULL;
38
39 /**
40 * @var array
41 */
42 var $configurationArray = array();
43
44 /**
45 * Initialize the object
46 *
47 * @return void
48 */
49 public function __construct() {
50 $loggingService = t3lib_div::makeInstance('tx_vcc_service_loggingService');
51 $this->injectLoggingService($loggingService);
52 }
53
54 /**
55 * Injects the logging service
56 *
57 * @param tx_vcc_service_loggingService $loggingService
58 *
59 * @return void
60 */
61 public function injectLoggingService(tx_vcc_service_loggingService $loggingService) {
62 $this->loggingService = $loggingService;
63 }
64
65 /**
66 * Returns the configuration
67 *
68 * @param integer $id
69 *
70 * @return array
71 */
72 public function getConfiguration($id) {
73 if (!isset($this->configurationArray[$id])) {
74 $modTsConfig = t3lib_BEfunc::getModTSconfig($id, 'mod.vcc');
75 $this->configurationArray[$id] = $modTsConfig['properties'];
76
77 // Log debug information
78 $logData = array(
79 'id' => $id,
80 'configuration' => $modTsConfig['properties']
81 );
82 $this->loggingService->debug('TsConfigService::getConfiguration id: ' . $id, $logData);
83 }
84
85 return $this->configurationArray[$id];
86 }
87 }
88
89 if (defined('TYPO3_MODE') && $GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/vcc/Classes/Service/TsConfigService.php']) {
90 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/vcc/Classes/Service/TsConfigService.php']);
91 }
92
93 ?>