|
TYPO3 API
SVNRelease
|
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 2010-2011 Xavier Perseguers <typo3@perseguers.ch> 00006 * (c) 2010-2011 Steffen Kamper <steffen@typo3.org> 00007 * All rights reserved 00008 * 00009 * This script is part of the TYPO3 project. The TYPO3 project is 00010 * free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * The GNU General Public License can be found at 00016 * http://www.gnu.org/copyleft/gpl.html. 00017 * A copy is found in the textfile GPL.txt and important notices to the license 00018 * from the author is found in LICENSE.txt distributed with these scripts. 00019 * 00020 * 00021 * This script is distributed in the hope that it will be useful, 00022 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00024 * GNU General Public License for more details. 00025 * 00026 * This copyright notice MUST APPEAR in all copies of the script! 00027 ***************************************************************/ 00028 00029 /** 00030 * Contains PHP_SCRIPT class object. 00031 * 00032 * $Id: class.tslib_content.php 7905 2010-06-13 14:42:33Z ohader $ 00033 * @author Xavier Perseguers <typo3@perseguers.ch> 00034 * @author Steffen Kamper <steffen@typo3.org> 00035 */ 00036 class tslib_content_PhpScript extends tslib_content_Abstract { 00037 00038 /** 00039 * Rendering the cObject, PHP_SCRIPT 00040 * 00041 * @param array Array of TypoScript properties 00042 * @return string Output 00043 */ 00044 public function render($conf = array()) { 00045 00046 $file = isset($conf['file.']) 00047 ? $this->cObj->stdWrap($conf['file'], $conf['file.']) 00048 : $conf['file']; 00049 00050 $incFile = $GLOBALS['TSFE']->tmpl->getFileName($file); 00051 $content = ''; 00052 if ($incFile && $GLOBALS['TSFE']->checkFileInclude($incFile)) { 00053 // Added 31-12-00: Make backup... 00054 $this->cObj->oldData = $this->cObj->data; 00055 $RESTORE_OLD_DATA = FALSE; 00056 // Include file.. 00057 include ('./' . $incFile); 00058 // Added 31-12-00: restore... 00059 if ($RESTORE_OLD_DATA) { 00060 $this->cObj->data = $this->cObj->oldData; 00061 } 00062 } 00063 00064 if (isset($conf['stdWrap.'])) { 00065 $content = $this->cObj->stdWrap($content, $conf['stdWrap.']); 00066 } 00067 00068 return $content; 00069 } 00070 00071 /** 00072 * Allow access to other tslib_content methods. 00073 * 00074 * Provides backwards compatibility for older included PHP_SCRIPT which simply 00075 * call methods like $this->typoLink (e.g. the old "languageMenu.php" sample). 00076 * 00077 * @deprecated since 4.5, will be removed in 4.7. Use $this->cObj-><method>() instead 00078 * 00079 * @param string $method The called method 00080 * @param array $arguments The original arguments 00081 * @return mixed 00082 */ 00083 public function __call($method, $arguments) { 00084 if (method_exists($this->cObj, $method)) { 00085 $trail = debug_backtrace(); 00086 $location = $trail[1]['file'] . '#' . $trail[1]['line']; 00087 t3lib_div::deprecationLog( 00088 sprintf('%s: PHP_SCRIPT called $this->%s. Modify it to call $this->cObj->%s instead. Will be removed in 4.7.', 00089 $location, $method, $method 00090 ) 00091 ); 00092 return call_user_func_array(array($this->cObj, $method), $arguments); 00093 } else { 00094 trigger_error(sprintf('Call to undefined function: %s::%s().', get_class($this), $name), E_USER_ERROR); 00095 } 00096 } 00097 00098 /** 00099 * Allow access to other tslib_content variables. 00100 * 00101 * Provides backwards compatibility for PHP_SCRIPT which simply 00102 * accesses properties like $this->parameters. 00103 * 00104 * @deprecated since 4.5, will be removed in 4.7. Use $this->cObj-><property> instead. 00105 * 00106 * @param string $name The name of the property 00107 * @return mixed 00108 */ 00109 public function __get($name) { 00110 if (array_key_exists($name, get_object_vars($this->cObj))) { 00111 $trail = debug_backtrace(); 00112 $location = $trail[1]['file'] . '#' . $trail[1]['line']; 00113 t3lib_div::deprecationLog( 00114 sprintf('%s: PHP_SCRIPT accessed $this->%s. Modify it to access $this->cObj->%s instead. Will be removed in 4.7.', 00115 $location, $name, $name 00116 ) 00117 ); 00118 return $this->cObj->$name; 00119 } 00120 } 00121 00122 } 00123 00124 00125 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['tslib/content/class.tslib_content_phpscript.php'])) { 00126 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['tslib/content/class.tslib_content_phpscript.php']); 00127 } 00128 00129 ?>
1.8.0