TYPO3 CMS  TYPO3_6-2
AbstractBackendViewHelper.php
Go to the documentation of this file.
1 <?php
3 
4 use \TYPO3\CMS\Core\Utility\GeneralUtility;
5 
6 /* *
7  * This script is backported from the TYPO3 Flow package "TYPO3.Fluid". *
8  * *
9  * It is free software; you can redistribute it and/or modify it under *
10  * the terms of the GNU Lesser General Public License, either version 3 *
11  * of the License, or (at your option) any later version. *
12  * *
13  * *
14  * This script is distributed in the hope that it will be useful, but *
15  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- *
16  * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser *
17  * General Public License for more details. *
18  * *
19  * You should have received a copy of the GNU Lesser General Public *
20  * License along with the script. *
21  * If not, see http://www.gnu.org/licenses/lgpl.html *
22  * *
23  * The TYPO3 project - inspiring people to share! *
24  * */
30 
37  public function getDocInstance() {
38  if ($this->viewHelperVariableContainer->exists(
39  'TYPO3\\CMS\\Fluid\\ViewHelpers\\Be\\AbstractBackendViewHelper',
40  'DocumentTemplate'
41  )
42  ) {
43  $doc = $this->viewHelperVariableContainer->get(
44  'TYPO3\\CMS\\Fluid\\ViewHelpers\\Be\\AbstractBackendViewHelper',
45  'DocumentTemplate'
46  );
47  } else {
49  $doc = $this->createDocInstance();
50  $doc->backPath = $GLOBALS['BACK_PATH'];
51  $this->viewHelperVariableContainer->add(
52  'TYPO3\\CMS\\Fluid\\ViewHelpers\\Be\\AbstractBackendViewHelper',
53  'DocumentTemplate',
54  $doc
55  );
56  }
57 
58  return $doc;
59  }
60 
74  protected function createDocInstance() {
75  if (
76  isset($GLOBALS['SOBE']) &&
77  is_object($GLOBALS['SOBE']) &&
78  isset($GLOBALS['SOBE']->doc) &&
79  $GLOBALS['SOBE']->doc instanceof \TYPO3\CMS\Backend\Template\DocumentTemplate
80  ) {
81  GeneralUtility::deprecationLog('Usage of $GLOBALS[\'SOBE\'] is deprecated since 6.0 and will be removed in 6.2 ->getDocInstance() should be used instead');
82  $doc = $GLOBALS['SOBE']->doc;
83  } else {
84  $doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
85  if (!isset($GLOBALS['SOBE'])) {
86  $GLOBALS['SOBE'] = new \stdClass();
87  }
88  if (!isset($GLOBALS['SOBE']->doc)) {
89  $GLOBALS['SOBE']->doc = $doc;
90  }
91  }
92 
93  return $doc;
94  }
95 }
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]