<?php include_once '../doc-typo3-funcs.php'; $doxygen_vars = array( "title" => "TYPO3 4.0.1: typo3_src-4.0.1/typo3/sysext/lang/lang.php Source File", "datetime" => "Sat Dec 2 19:22:34 2006", "date" => "2 Dec 2006", "doxygenversion" => "1.4.6", "projectname" => "TYPO3 4.0.1", "projectnumber" => "4.0.1" ); get_header($doxygen_vars); ?> <!-- Generated by Doxygen 1.4.6 --> <div class="tabs"> <ul> <li><a href="main.html"><span>Main Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="classes.html"><span>Classes</span></a></li> <li id="current"><a href="files.html"><span>Files</span></a></li> <li><a href="dirs.html"><span>Directories</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="examples.html"><span>Examples</span></a></li> <li> <form action="search.php" method="get"> <table cellspacing="0" cellpadding="0" border="0"> <tr> <td><label> <u>S</u>earch for </label></td> <td><input type="text" name="query" value="" size="20" accesskey="s"/></td> </tr> </table> </form> </li> </ul></div> <div class="nav"> <a class="el" href="dir_c8daf1ad746050abf985cc546c89e248.html">typo3_src-4.0.1</a> » <a class="el" href="dir_18071ae4545d8b3e0364d30c0659c74a.html">typo3</a> » <a class="el" href="dir_57bf1ed8249c1fd5b014486d01bcb27a.html">sysext</a> » <a class="el" href="dir_3e853acd7f13fecd090cf7f6f2f35c6e.html">lang</a></div> <h1>lang.php</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <?php <a name="l00002"></a>00002 <span class="comment">/***************************************************************</span> <a name="l00003"></a>00003 <span class="comment">* Copyright notice</span> <a name="l00004"></a>00004 <span class="comment">*</span> <a name="l00005"></a>00005 <span class="comment">* (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)</span> <a name="l00006"></a>00006 <span class="comment">* All rights reserved</span> <a name="l00007"></a>00007 <span class="comment">*</span> <a name="l00008"></a>00008 <span class="comment">* This script is part of the TYPO3 project. The TYPO3 project is</span> <a name="l00009"></a>00009 <span class="comment">* free software; you can redistribute it and/or modify</span> <a name="l00010"></a>00010 <span class="comment">* it under the terms of the GNU General Public License as published by</span> <a name="l00011"></a>00011 <span class="comment">* the Free Software Foundation; either version 2 of the License, or</span> <a name="l00012"></a>00012 <span class="comment">* (at your option) any later version.</span> <a name="l00013"></a>00013 <span class="comment">*</span> <a name="l00014"></a>00014 <span class="comment">* The GNU General Public License can be found at</span> <a name="l00015"></a>00015 <span class="comment">* http://www.gnu.org/copyleft/gpl.html.</span> <a name="l00016"></a>00016 <span class="comment">* A copy is found in the textfile GPL.txt and important notices to the license</span> <a name="l00017"></a>00017 <span class="comment">* from the author is found in LICENSE.txt distributed with these scripts.</span> <a name="l00018"></a>00018 <span class="comment">*</span> <a name="l00019"></a>00019 <span class="comment">*</span> <a name="l00020"></a>00020 <span class="comment">* This script is distributed in the hope that it will be useful,</span> <a name="l00021"></a>00021 <span class="comment">* but WITHOUT ANY WARRANTY; without even the implied warranty of</span> <a name="l00022"></a>00022 <span class="comment">* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span> <a name="l00023"></a>00023 <span class="comment">* GNU General Public License for more details.</span> <a name="l00024"></a>00024 <span class="comment">*</span> <a name="l00025"></a>00025 <span class="comment">* This copyright notice MUST APPEAR in all copies of the script!</span> <a name="l00026"></a>00026 <span class="comment">***************************************************************/</span> <a name="l00088"></a><a class="code" href="classlanguage.html">00088</a> <span class="keyword">class </span><a class="code" href="classlanguage.html">language</a> { <a name="l00089"></a><a class="code" href="classlanguage.html#66dac30e2add2db0bef4b2397f5385af">00089</a> var <a class="code" href="classlanguage.html#66dac30e2add2db0bef4b2397f5385af">$lang</a>='<span class="keywordflow">default</span>'; <span class="comment">// This is set to the language that is currently running for the user</span> <a name="l00090"></a><a class="code" href="classlanguage.html#2a7e2c6ce9206818e681bc0f9cfabe17">00090</a> var <a class="code" href="classlanguage.html#2a7e2c6ce9206818e681bc0f9cfabe17">$langSplit</a>='<span class="keywordflow">default</span>'; <span class="comment">// Values like the labels in the tables.php-document are split by '|'. This values defines which language is represented by which position in the resulting array after splitting a value. (NOTICE: Obsolete concept!)</span> <a name="l00091"></a>00091 <a name="l00092"></a>00092 <span class="comment">// Default charset in backend</span> <a name="l00093"></a><a class="code" href="classlanguage.html#8da2c07d763911c62b21898b274b3b7f">00093</a> var <a class="code" href="classlanguage.html#8da2c07d763911c62b21898b274b3b7f">$charSet</a> = 'iso-8859-1'; <a name="l00094"></a>00094 <a name="l00095"></a>00095 <span class="comment">// Array with alternative charsets for other languages. (Moved to t3lib_cs, Set from csConvObj!)</span> <a name="l00096"></a><a class="code" href="classlanguage.html#2ff111be5e570b0d99d90ea5ef665f43">00096</a> var <a class="code" href="classlanguage.html#2ff111be5e570b0d99d90ea5ef665f43">$charSetArray</a> = array(); <a name="l00097"></a>00097 <a name="l00098"></a>00098 <span class="comment">// This is the url to the TYPO3 manual</span> <a name="l00099"></a><a class="code" href="classlanguage.html#528d7e926cba09d54d85252869f28af3">00099</a> var <a class="code" href="classlanguage.html#528d7e926cba09d54d85252869f28af3">$typo3_help_url</a>= 'http:<span class="comment">//www.typo3.com/man_uk/';</span> <a name="l00100"></a>00100 <span class="comment">// Array with alternative URLs based on language.</span> <a name="l00101"></a><a class="code" href="classlanguage.html#e52cd5b5d65b05f84d8413c969c637f5">00101</a> var <a class="code" href="classlanguage.html#e52cd5b5d65b05f84d8413c969c637f5">$helpUrlArray</a> = array( <a name="l00102"></a>00102 'dk' => 'http:<span class="comment">//www.typo3.com/man_dk/',</span> <a name="l00103"></a>00103 ); <a name="l00104"></a>00104 <a name="l00105"></a><a class="code" href="classlanguage.html#1a350b40ce7b8c9ee6fb79d3089099cc">00105</a> var <a class="code" href="classlanguage.html#1a350b40ce7b8c9ee6fb79d3089099cc">$debugKey</a> = FALSE; <span class="comment">// If true, will show the key/location of labels in the backend.</span> <a name="l00106"></a>00106 <a name="l00107"></a>00107 <a name="l00108"></a><a class="code" href="classlanguage.html#3f0917c2fd9c2a066deb0851b65c7d6f">00108</a> var <a class="code" href="classlanguage.html#3f0917c2fd9c2a066deb0851b65c7d6f">$moduleLabels</a> = Array(); <span class="comment">// Can contain labels and image references from the backend modules. Relies on t3lib_loadmodules to initialize modules after a global instance of $LANG has been created.</span> <a name="l00109"></a>00109 <a name="l00110"></a>00110 <span class="comment">// Internal</span> <a name="l00111"></a><a class="code" href="classlanguage.html#c530dfa5b2b736fb18bbffb35bc55193">00111</a> var <a class="code" href="classlanguage.html#c530dfa5b2b736fb18bbffb35bc55193">$langSplitIndex</a>=0; <span class="comment">// Points to the position of the current language key as found in constant TYPO3_languages</span> <a name="l00112"></a><a class="code" href="classlanguage.html#e686212c8bdae36b5ed4909a1a7b1b7a">00112</a> var <a class="code" href="classlanguage.html#e686212c8bdae36b5ed4909a1a7b1b7a">$LL_files_cache</a>=array(); <span class="comment">// Internal cache for read LL-files</span> <a name="l00113"></a><a class="code" href="classlanguage.html#f638f3cfa4e6b187620c97547591584a">00113</a> var <a class="code" href="classlanguage.html#f638f3cfa4e6b187620c97547591584a">$LL_labels_cache</a>=array(); <span class="comment">// Internal cache for ll-labels (filled as labels are requested)</span> <a name="l00114"></a>00114 <a name="l00115"></a>00115 <span class="comment">// Internal charset conversion:</span> <a name="l00116"></a><a class="code" href="classlanguage.html#e06678cac0395a4693d4b79667f2abee">00116</a> var <a class="code" href="classlanguage.html#e06678cac0395a4693d4b79667f2abee">$origCharSet</a>=''; <span class="comment">// If set, then it means that the this->charSet is set to a forced, common value for the WHOLE backend regardless of user language. And THIS variable will contain the original charset for the language labels. With ->csConvObj we must then convert the original charset to the charset used in the backend from now on.</span> <a name="l00117"></a><a class="code" href="classlanguage.html#69be992df11be62302a3c1a60b2b36a4">00117</a> var <a class="code" href="classlanguage.html#69be992df11be62302a3c1a60b2b36a4">$csConvObj</a>; <span class="comment">// An instance of the "t3lib_cs" class. May be used by any application.</span> <a name="l00118"></a>00118 <a name="l00119"></a>00119 <a name="l00120"></a>00120 <a name="l00121"></a>00121 <a name="l00122"></a>00122 <a name="l00123"></a>00123 <a name="l00124"></a>00124 <a name="l00125"></a>00125 <a name="l00138"></a><a class="code" href="classlanguage.html#6f360c8da83e68c033a73eeabcfd3f0b">00138</a> function <a class="code" href="classlanguage.html#6f360c8da83e68c033a73eeabcfd3f0b">init</a>(<a class="code" href="classlanguage.html#66dac30e2add2db0bef4b2397f5385af">$lang</a>,$altPath='') { <a name="l00139"></a>00139 <a name="l00140"></a>00140 <span class="comment">// Initialize the conversion object:</span> <a name="l00141"></a>00141 $this->csConvObj = <a class="code" href="classt3lib__div.html#b47f8a8e8be44b79a0b8064dcd427bc1">t3lib_div::makeInstance</a>('<a class="code" href="classt3lib__cs.html">t3lib_cs</a>'); <a name="l00142"></a>00142 $this->charSetArray = $this->csConvObj->charSetArray; <a name="l00143"></a>00143 <a name="l00144"></a>00144 <span class="comment">// Internally setting the list of TYPO3 backend languages.</span> <a name="l00145"></a>00145 $this->langSplit=TYPO3_languages; <a name="l00146"></a>00146 <a name="l00147"></a>00147 <span class="comment">// Finding the requested language in this list based on the $lang key being inputted to this function.</span> <a name="l00148"></a>00148 $ls = explode(<span class="charliteral">'|'</span>,$this->langSplit); <a name="l00149"></a>00149 <span class="keywordflow">while</span>(list($i,$v)=each($ls)) { <a name="l00150"></a>00150 <span class="keywordflow">if</span> ($v==<a class="code" href="classlanguage.html#66dac30e2add2db0bef4b2397f5385af">$lang</a>) { <span class="comment">// Language is found. Configure it:</span> <a name="l00151"></a>00151 $this->langSplitIndex=$i; <span class="comment">// The index of the language as found in the TYPO3_languages list</span> <a name="l00152"></a>00152 $this->lang = <a class="code" href="classlanguage.html#66dac30e2add2db0bef4b2397f5385af">$lang</a>; <span class="comment">// The current language key</span> <a name="l00153"></a>00153 <span class="keywordflow">if</span> ($this->helpUrlArray[$this->lang]) $this->typo3_help_url=$this->helpUrlArray[$this->lang]; <span class="comment">// The help URL if different from the default.</span> <a name="l00154"></a>00154 <span class="keywordflow">if</span> ($this->charSetArray[$this->lang]) $this->charSet=$this->charSetArray[$this->lang]; <span class="comment">// The charset if different from the default.</span> <a name="l00155"></a>00155 } <a name="l00156"></a>00156 } <a name="l00157"></a>00157 <a name="l00158"></a>00158 <span class="comment">// If a forced charset is used and different from the charset otherwise used:</span> <a name="l00159"></a>00159 <span class="keywordflow">if</span> ($GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'] && $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset']!=$this->charSet) { <a name="l00160"></a>00160 <span class="comment">// Set the forced charset:</span> <a name="l00161"></a>00161 $this->origCharSet = $this->charSet; <a name="l00162"></a>00162 $this->charSet = $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset']; <a name="l00163"></a>00163 <a name="l00164"></a>00164 <span class="keywordflow">if</span> ($this->charSet!='utf-8' && !$this->csConvObj->initCharset($this->charSet)) { <a name="l00165"></a>00165 <a class="code" href="classt3lib__BEfunc.html#5128bd912d99ed04990947fe9ca68e1e">t3lib_BEfunc::typo3PrintError</a> ('The forced character set <span class="stringliteral">"'.$this->charSet.'"</span> was not found in t3lib/csconvtbl/<span class="charliteral">','</span>Forced charset not found'); <a name="l00166"></a>00166 exit; <a name="l00167"></a>00167 } <a name="l00168"></a>00168 <span class="keywordflow">if</span> ($this->origCharSet!='utf-8' && !$this->csConvObj->initCharset($this->origCharSet)) { <a name="l00169"></a>00169 <a class="code" href="classt3lib__BEfunc.html#5128bd912d99ed04990947fe9ca68e1e">t3lib_BEfunc::typo3PrintError</a> ('The original character set <span class="stringliteral">"'.$this->origCharSet.'"</span> was not found in t3lib/csconvtbl/<span class="charliteral">','</span>Forced charset not found'); <a name="l00170"></a>00170 exit; <a name="l00171"></a>00171 } <a name="l00172"></a>00172 } <a name="l00173"></a>00173 } <a name="l00174"></a>00174 <a name="l00183"></a><a class="code" href="classlanguage.html#866a4f3b1ac4e542ca79f987ef06e048">00183</a> function addModuleLabels($arr,$prefix) { <a name="l00184"></a>00184 <span class="keywordflow">if</span> (is_array($arr)) { <a name="l00185"></a>00185 reset($arr); <a name="l00186"></a>00186 <span class="keywordflow">while</span>(list($k,$larr)=each($arr)) { <a name="l00187"></a>00187 <span class="keywordflow">if</span> (!isset($this->moduleLabels[$k])) { <a name="l00188"></a>00188 $this->moduleLabels[$k]=array(); <a name="l00189"></a>00189 } <a name="l00190"></a>00190 <span class="keywordflow">if</span> (is_array($larr)) { <a name="l00191"></a>00191 reset($larr); <a name="l00192"></a>00192 <span class="keywordflow">while</span>(list($l,$v)=each($larr)) { <a name="l00193"></a>00193 $this->moduleLabels[$k][$prefix.$l]=$v; <a name="l00194"></a>00194 } <a name="l00195"></a>00195 } <a name="l00196"></a>00196 } <a name="l00197"></a>00197 } <a name="l00198"></a>00198 } <a name="l00199"></a>00199 <a name="l00209"></a><a class="code" href="classlanguage.html#b6b1272effe6cfee9ca47f1e7d5e2e33">00209</a> function hscAndCharConv($lStr,$hsc) { <a name="l00210"></a>00210 $lStr = $hsc ? htmlspecialchars($lStr) : $lStr; <a name="l00211"></a>00211 <span class="keywordflow">if</span> ($this->origCharSet) { <a name="l00212"></a>00212 $lStr = $this->csConvObj->conv($lStr,$this->origCharSet,$this->charSet,1); <a name="l00213"></a>00213 } <a name="l00214"></a>00214 <span class="keywordflow">return</span> $lStr; <a name="l00215"></a>00215 } <a name="l00216"></a>00216 <a name="l00224"></a><a class="code" href="classlanguage.html#079fd94f0eeb1087c6c51bb1312ac44c">00224</a> function makeEntities($str) { <a name="l00225"></a>00225 <span class="comment">// Convert string to UTF-8:</span> <a name="l00226"></a>00226 <span class="keywordflow">if</span> ($this->charSet!='utf-8') $str = $this->csConvObj->utf8_encode($str,$this->charSet); <a name="l00227"></a>00227 <a name="l00228"></a>00228 <span class="comment">// Convert string back again, but using the full entity conversion:</span> <a name="l00229"></a>00229 $str = $this->csConvObj->utf8_to_entities($str); <a name="l00230"></a>00230 <span class="keywordflow">return</span> $str; <a name="l00231"></a>00231 } <a name="l00232"></a>00232 <a name="l00241"></a><a class="code" href="classlanguage.html#5e45af130fb21df357f3453a4bb1af48">00241</a> function JScharCode($str) { <a name="l00242"></a>00242 <a name="l00243"></a>00243 <span class="comment">// Convert string to UTF-8:</span> <a name="l00244"></a>00244 <span class="keywordflow">if</span> ($this->charSet!='utf-8') $str = $this->csConvObj->utf8_encode($str,$this->charSet); <a name="l00245"></a>00245 <a name="l00246"></a>00246 <span class="comment">// Convert the UTF-8 string into a array of char numbers:</span> <a name="l00247"></a>00247 $nArr = $this->csConvObj->utf8_to_numberarray($str); <a name="l00248"></a>00248 <a name="l00249"></a>00249 <span class="keywordflow">return</span> 'String.fromCharCode('.implode(<span class="charliteral">','</span>,$nArr).<span class="charliteral">')'</span>; <a name="l00250"></a>00250 } <a name="l00251"></a>00251 <a name="l00260"></a><a class="code" href="classlanguage.html#944ef2442d780cf0b72c5a609b822e61">00260</a> function getLL($index,$hsc=0) { <a name="l00261"></a>00261 <span class="comment">// Get Local Language</span> <a name="l00262"></a>00262 <span class="keywordflow">if</span> (strcmp($GLOBALS['LOCAL_LANG'][$this->lang][$index],'')) { <a name="l00263"></a>00263 $output = $this->hscAndCharConv($GLOBALS['LOCAL_LANG'][$this->lang][$index], $hsc); <span class="comment">// Returns local label if not blank.</span> <a name="l00264"></a>00264 } <span class="keywordflow">else</span> { <a name="l00265"></a>00265 $output = $this->hscAndCharConv($GLOBALS['LOCAL_LANG']['<span class="keywordflow">default</span>'][$index], $hsc); <span class="comment">// Returns default label</span> <a name="l00266"></a>00266 } <a name="l00267"></a>00267 <span class="keywordflow">return</span> $output.($this->debugKey ? ' ['.$index.<span class="charliteral">']'</span>:''); <a name="l00268"></a>00268 } <a name="l00269"></a>00269 <a name="l00278"></a><a class="code" href="classlanguage.html#97db270938ef07a63db3e8b5ce3d6469">00278</a> function getLLL($index,$LOCAL_LANG,$hsc=0) { <a name="l00279"></a>00279 <span class="comment">// Get Local Language</span> <a name="l00280"></a>00280 <span class="keywordflow">if</span> (strcmp($LOCAL_LANG[$this->lang][$index],'')) { <a name="l00281"></a>00281 $output = $this->hscAndCharConv($LOCAL_LANG[$this->lang][$index], $hsc); <span class="comment">// Returns local label if not blank.</span> <a name="l00282"></a>00282 } <span class="keywordflow">else</span> { <a name="l00283"></a>00283 $output = $this->hscAndCharConv($LOCAL_LANG['<span class="keywordflow">default</span>'][$index], $hsc); <span class="comment">// Returns default label</span> <a name="l00284"></a>00284 } <a name="l00285"></a>00285 <span class="keywordflow">return</span> $output.($this->debugKey ? ' ['.$index.<span class="charliteral">']'</span>:''); <a name="l00286"></a>00286 } <a name="l00287"></a>00287 <a name="l00299"></a><a class="code" href="classlanguage.html#243f83d86167af6f77054f60d0c27ab1">00299</a> function sL($input,$hsc=0) { <a name="l00300"></a>00300 <span class="keywordflow">if</span> (strcmp(substr($input,0,4),'LLL:')) { <span class="comment">// Using obsolete 'language-splitted' labels:</span> <a name="l00301"></a>00301 $t = explode(<span class="charliteral">'|'</span>,$input); <a name="l00302"></a>00302 $out = $t[$this->langSplitIndex] ? $t[$this->langSplitIndex] : $t[0]; <a name="l00303"></a>00303 <span class="keywordflow">return</span> $this->hscAndCharConv($out, $hsc); <a name="l00304"></a>00304 } <span class="keywordflow">else</span> { <span class="comment">// LOCAL_LANG:</span> <a name="l00305"></a>00305 <span class="keywordflow">if</span> (!isset($this->LL_labels_cache[$this->lang][$input])) { <span class="comment">// If cached label</span> <a name="l00306"></a>00306 $restStr = trim(substr($input,4)); <a name="l00307"></a>00307 $extPrfx=''; <a name="l00308"></a>00308 <span class="keywordflow">if</span> (!strcmp(substr($restStr,0,4),'EXT:')) { <span class="comment">// ll-file refered to is found in an extension.</span> <a name="l00309"></a>00309 $restStr = trim(substr($restStr,4)); <a name="l00310"></a>00310 $extPrfx='EXT:'; <a name="l00311"></a>00311 } <a name="l00312"></a>00312 $parts = explode(<span class="charliteral">':'</span>,$restStr); <a name="l00313"></a>00313 $parts[0]=$extPrfx.$parts[0]; <a name="l00314"></a>00314 <span class="keywordflow">if</span> (!isset($this->LL_files_cache[$parts[0]])) { <span class="comment">// Getting data if not cached</span> <a name="l00315"></a>00315 $this->LL_files_cache[$parts[0]] = $this->readLLfile($parts[0]); <a name="l00316"></a>00316 <a name="l00317"></a>00317 <span class="comment">// If the current language is found in another file, load that as well:</span> <a name="l00318"></a>00318 $lFileRef = $this->localizedFileRef($parts[0]); <a name="l00319"></a>00319 <span class="keywordflow">if</span> ($lFileRef && is_string($this->LL_files_cache[$parts[0]][$this->lang]) && $this->LL_files_cache[$parts[0]][$this->lang]=='EXT') { <a name="l00320"></a>00320 $tempLL = $this->readLLfile($lFileRef); <a name="l00321"></a>00321 $this->LL_files_cache[$parts[0]][$this->lang] = $tempLL[$this->lang]; <a name="l00322"></a>00322 } <a name="l00323"></a>00323 <a name="l00324"></a>00324 <span class="comment">// Overriding file?</span> <a name="l00325"></a>00325 <span class="keywordflow">if</span> (isset($GLOBALS['TYPO3_CONF_VARS']['BE']['XLLfile'][$parts[0]])) { <a name="l00326"></a>00326 $ORarray = $this->readLLfile($GLOBALS['TYPO3_CONF_VARS']['BE']['XLLfile'][$parts[0]]); <a name="l00327"></a>00327 $this->LL_files_cache[$parts[0]] = <a class="code" href="classt3lib__div.html#3830505faadac8ae3b0fcb60077a2bf1">t3lib_div::array_merge_recursive_overrule</a>($this->LL_files_cache[$parts[0]],$ORarray); <a name="l00328"></a>00328 } <a name="l00329"></a>00329 } <a name="l00330"></a>00330 $this->LL_labels_cache[$this->lang][$input] = $this->getLLL($parts[1],$this->LL_files_cache[$parts[0]]); <a name="l00331"></a>00331 } <a name="l00332"></a>00332 $output = $hsc ? <a class="code" href="classt3lib__div.html#6f22285e9535ceb6f91b8d528e2a2d09">t3lib_div::deHSCentities</a>(htmlspecialchars($this->LL_labels_cache[$this->lang][$input])) : $this->LL_labels_cache[$this->lang][$input]; <span class="comment">// For the cached output charset conversion has already happend! So perform HSC right here.</span> <a name="l00333"></a>00333 <span class="keywordflow">return</span> $output.($this->debugKey ? ' ['.$input.<span class="charliteral">']'</span>:''); <a name="l00334"></a>00334 } <a name="l00335"></a>00335 } <a name="l00336"></a>00336 <a name="l00344"></a><a class="code" href="classlanguage.html#3e7400c642ee9cde79896496f638d5f6">00344</a> function loadSingleTableDescription($table) { <a name="l00345"></a>00345 global $TCA_DESCR; <a name="l00346"></a>00346 <a name="l00347"></a>00347 <span class="keywordflow">if</span> (is_array($TCA_DESCR[$table]) <a name="l00348"></a>00348 && !isset($TCA_DESCR[$table]['columns']) <a name="l00349"></a>00349 && is_array($TCA_DESCR[$table]['refs'])) { <span class="comment">// First the 'table' cannot already be loaded in [columns] and secondly there must be a references to locallang files available in [refs]</span> <a name="l00350"></a>00350 <a name="l00351"></a>00351 <span class="comment">// Init $TCA_DESCR for $table-key</span> <a name="l00352"></a>00352 $TCA_DESCR[$table]['columns']=array(); <a name="l00353"></a>00353 <a name="l00354"></a>00354 <span class="comment">// Get local-lang for each file in $TCA_DESCR[$table]['refs'] as they are ordered.</span> <a name="l00355"></a>00355 foreach ($TCA_DESCR[$table]['refs'] as $llfile) { <a name="l00356"></a>00356 $LOCAL_LANG = $this->includeLLFile($llfile,0,1); <a name="l00357"></a>00357 <a name="l00358"></a>00358 <span class="comment">// Traverse all keys</span> <a name="l00359"></a>00359 <span class="keywordflow">if</span> (is_array($LOCAL_LANG['<span class="keywordflow">default</span>'])) { <a name="l00360"></a>00360 foreach($LOCAL_LANG['<span class="keywordflow">default</span>'] as $lkey => $lVal) { <a name="l00361"></a>00361 <a name="l00362"></a>00362 <span class="comment">// exploding by '.':</span> <a name="l00363"></a>00363 <span class="comment">// 0 => fieldname,</span> <a name="l00364"></a>00364 <span class="comment">// 1 => type from (alttitle,description,details,syntax,image_descr,image,seeAlso),</span> <a name="l00365"></a>00365 <span class="comment">// 2 => special instruction, see switch construct</span> <a name="l00366"></a>00366 $kParts = explode(<span class="charliteral">'.'</span>,$lkey); <a name="l00367"></a>00367 <a name="l00368"></a>00368 <span class="comment">// Detecting 'hidden' labels, converting to normal fieldname</span> <a name="l00369"></a>00369 <span class="keywordflow">if</span> ($kParts[0]==<span class="charliteral">'_'</span>) $kParts[0]=''; <a name="l00370"></a>00370 <span class="keywordflow">if</span> (substr($kParts[0],0,1)==<span class="charliteral">'_'</span>) { $kParts[0] = substr($kParts[0],1); } <a name="l00371"></a>00371 <a name="l00372"></a>00372 <span class="comment">// Add label:</span> <a name="l00373"></a>00373 <span class="keywordflow">switch</span>((string)$kParts[2]) { <a name="l00374"></a>00374 <span class="keywordflow">case</span> <span class="charliteral">'+'</span>: <span class="comment">// adding</span> <a name="l00375"></a>00375 $TCA_DESCR[$table]['columns'][$kParts[0]][$kParts[1]].= chr(10).$lVal; <a name="l00376"></a>00376 <span class="keywordflow">break</span>; <a name="l00377"></a>00377 <span class="keywordflow">default</span>: <span class="comment">// Substituting:</span> <a name="l00378"></a>00378 $TCA_DESCR[$table]['columns'][$kParts[0]][$kParts[1]] = $lVal; <a name="l00379"></a>00379 <span class="keywordflow">break</span>; <a name="l00380"></a>00380 } <a name="l00381"></a>00381 } <a name="l00382"></a>00382 } <a name="l00383"></a>00383 } <a name="l00384"></a>00384 } <a name="l00385"></a>00385 } <a name="l00386"></a>00386 <a name="l00396"></a><a class="code" href="classlanguage.html#0f2ffdd6940c19a0798e5fe3f54a4416">00396</a> function includeLLFile($fileRef,$setGlobal=1,$mergeLocalOntoDefault=0) { <a name="l00397"></a>00397 <span class="comment">// Configure for global flag:</span> <a name="l00398"></a>00398 <span class="keywordflow">if</span> ($setGlobal) { <a name="l00399"></a>00399 global $LOCAL_LANG; <a name="l00400"></a>00400 } <a name="l00401"></a>00401 <a name="l00402"></a>00402 <span class="comment">// Get default file:</span> <a name="l00403"></a>00403 $llang = $this->readLLfile($fileRef); <a name="l00404"></a>00404 <a name="l00405"></a>00405 <span class="keywordflow">if</span> (count($llang)) { <a name="l00406"></a>00406 <a name="l00407"></a>00407 $LOCAL_LANG = <a class="code" href="classt3lib__div.html#3830505faadac8ae3b0fcb60077a2bf1">t3lib_div::array_merge_recursive_overrule</a>($LOCAL_LANG,$llang); <a name="l00408"></a>00408 <a name="l00409"></a>00409 <span class="comment">// Localized addition?</span> <a name="l00410"></a>00410 $lFileRef = $this->localizedFileRef($fileRef); <a name="l00411"></a>00411 <span class="keywordflow">if</span> ($lFileRef && (string)$LOCAL_LANG[$this->lang]=='EXT') { <a name="l00412"></a>00412 $llang = $this->readLLfile($lFileRef); <a name="l00413"></a>00413 $LOCAL_LANG = <a class="code" href="classt3lib__div.html#3830505faadac8ae3b0fcb60077a2bf1">t3lib_div::array_merge_recursive_overrule</a>($LOCAL_LANG,$llang); <a name="l00414"></a>00414 } <a name="l00415"></a>00415 <a name="l00416"></a>00416 <span class="comment">// Overriding file?</span> <a name="l00417"></a>00417 <span class="keywordflow">if</span> (isset($GLOBALS['TYPO3_CONF_VARS']['BE']['XLLfile'][$fileRef])) { <a name="l00418"></a>00418 $ORarray = $this->readLLfile($GLOBALS['TYPO3_CONF_VARS']['BE']['XLLfile'][$fileRef]); <a name="l00419"></a>00419 $LOCAL_LANG = <a class="code" href="classt3lib__div.html#3830505faadac8ae3b0fcb60077a2bf1">t3lib_div::array_merge_recursive_overrule</a>($LOCAL_LANG,$ORarray); <a name="l00420"></a>00420 } <a name="l00421"></a>00421 <a name="l00422"></a>00422 <span class="comment">// Merge local onto default:</span> <a name="l00423"></a>00423 <span class="keywordflow">if</span> ($mergeLocalOntoDefault && strcmp($this->lang,'<span class="keywordflow">default</span>') && is_array($LOCAL_LANG[$this->lang]) && is_array($LOCAL_LANG['<span class="keywordflow">default</span>'])) { <a name="l00424"></a>00424 $LOCAL_LANG['<span class="keywordflow">default</span>'] = array_merge($LOCAL_LANG['<span class="keywordflow">default</span>'],$LOCAL_LANG[$this->lang]); <span class="comment">// array_merge can be used so far the keys are not numeric - which we assume they are not...</span> <a name="l00425"></a>00425 unset($LOCAL_LANG[$this->lang]); <a name="l00426"></a>00426 } <a name="l00427"></a>00427 } <a name="l00428"></a>00428 <a name="l00429"></a>00429 <span class="comment">// Return value if not global is set.</span> <a name="l00430"></a>00430 <span class="keywordflow">if</span> (!$setGlobal) { <a name="l00431"></a>00431 <span class="keywordflow">return</span> $LOCAL_LANG; <a name="l00432"></a>00432 } <a name="l00433"></a>00433 } <a name="l00434"></a>00434 <a name="l00441"></a><a class="code" href="classlanguage.html#20786628899ce40d11dc9c641fa0fb24">00441</a> function readLLfile($fileRef) { <a name="l00442"></a>00442 <span class="keywordflow">return</span> <a class="code" href="classt3lib__div.html#8534c45aeb7e8fda1ac1d2e0fc9dd25e">t3lib_div::readLLfile</a>($fileRef,$this->lang); <a name="l00443"></a>00443 } <a name="l00444"></a>00444 <a name="l00451"></a><a class="code" href="classlanguage.html#ee8d37a979f6b86221bb3897dd2aaebd">00451</a> function localizedFileRef($fileRef) { <a name="l00452"></a>00452 <span class="keywordflow">if</span> ($this->lang!='<span class="keywordflow">default</span>' && substr($fileRef,-4)=='.php') { <a name="l00453"></a>00453 <span class="keywordflow">return</span> substr($fileRef,0,-4).<span class="charliteral">'.'</span>.$this->lang.'.php'; <a name="l00454"></a>00454 } <a name="l00455"></a>00455 } <a name="l00456"></a>00456 } <a name="l00457"></a>00457 <a name="l00458"></a>00458 <span class="comment">// Include extension to the template class?</span> <a name="l00459"></a>00459 <span class="keywordflow">if</span> (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/lang/lang.php']) { <a name="l00460"></a>00460 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/lang/lang.php']); <a name="l00461"></a>00461 } <a name="l00462"></a>00462 ?> </pre></div><?php include_once '../doc-typo3-funcs.php'; get_footer(); ?>