[TASK] Remove function index
[Packages/TYPO3.CMS.git] / typo3 / sysext / rsaauth / sv1 / storage / class.tx_rsaauth_storagefactory.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2009-2011 Dmitry Dulepov <dmitry@typo3.org>
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 require_once(t3lib_extMgm::extPath('rsaauth', 'sv1/storage/class.tx_rsaauth_abstract_storage.php'));
26
27 /**
28 * This class contains a factory for the RSA backends.
29 *
30 * @author Dmitry Dulepov <dmitry@typo3.org>
31 * @package TYPO3
32 * @subpackage tx_rsaauth
33 */
34 class tx_rsaauth_storagefactory {
35
36 /**
37 * A list of all available storages. Currently this list cannot be extended.
38 * This is for security reasons to avoid inserting some dummy storage to
39 * the list.
40 *
41 * @var string
42 */
43 static protected $preferredStorage = 'EXT:rsaauth/sv1/storage/class.tx_rsaauth_split_storage.php:tx_rsaauth_split_storage';
44
45 /**
46 * An instance of the storage. This member is set in the getStorage() function.
47 * It will not be an abstract storage as shown below but a real class, which is
48 * derieved from the tx_rsaauth_abstract_storage.
49 *
50 * <!-- Please, keep the variable type! It helps IDEs to provide autocomple! -->
51 *
52 * @var tx_rsaauth_abstract_storage
53 */
54 static protected $storageInstance = NULL;
55
56 /**
57 * Obtains a storage. This function will return a non-abstract class, which
58 * is derieved from the tx_rsaauth_abstract_storage. Applications should
59 * not use anoy methods that are not declared in the tx_rsaauth_abstract_storage.
60 *
61 * @return tx_rsaauth_abstract_storage A storage
62 */
63 static public function getStorage() {
64 if (is_null(self::$storageInstance)) {
65 self::$storageInstance = t3lib_div::getUserObj(self::$preferredStorage);
66 }
67 return self::$storageInstance;
68 }
69
70 /**
71 * Sets the preffered storage to the factory. This method can be called from
72 * another extension or ext_localconf.php
73 *
74 * @param string $preferredStorage Preffered storage
75 * @return void
76 */
77 static public function setPreferredStorage($preferredStorage) {
78 self::$preferredStorage = $preferredStorage;
79 }
80 }
81
82 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/rsaauth/sv1/storage/class.tx_rsaauth_storagefactory.php'])) {
83 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/rsaauth/sv1/storage/class.tx_rsaauth_storagefactory.php']);
84 }
85
86 ?>