<?php
  include_once '../doc-typo3-funcs.php';
  $doxygen_vars = array(	"title" => "TYPO3 4.0.1: typo3_src-4.0.1/typo3/sysext/cms/tslib/media/scripts/wapversionLib.inc Source File",
				"datetime" => "Sat Dec 2 19:22:30 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&nbsp;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&nbsp;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>&nbsp;<u>S</u>earch&nbsp;for&nbsp;</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>&nbsp;&raquo&nbsp;<a class="el" href="dir_18071ae4545d8b3e0364d30c0659c74a.html">typo3</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_57bf1ed8249c1fd5b014486d01bcb27a.html">sysext</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_21aa24ee31dafa72450e939d0692a893.html">cms</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_da3d3c31fb60c430897a32b4a10f682b.html">tslib</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_5d5928c48a24a7022098bcc9e1331896.html">media</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_cdcc1b4ce87312c897e9f35885142bfd.html">scripts</a></div>
<h1>wapversionLib.inc</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 &lt;?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="l00061"></a>00061 require_once (PATH_t3lib.'<span class="keyword">class</span>.t3lib_xml.php');
<a name="l00062"></a>00062 
<a name="l00063"></a>00063 
<a name="l00064"></a>00064 
<a name="l00065"></a>00065 
<a name="l00066"></a>00066 
<a name="l00067"></a>00067 
<a name="l00068"></a>00068 
<a name="l00069"></a>00069 
<a name="l00070"></a>00070 
<a name="l00071"></a>00071 
<a name="l00072"></a>00072 
<a name="l00073"></a>00073 
<a name="l00074"></a>00074 
<a name="l00075"></a>00075 
<a name="l00076"></a>00076 
<a name="l00077"></a>00077 
<a name="l00078"></a>00078 
<a name="l00079"></a>00079 
<a name="l00080"></a>00080 
<a name="l00081"></a>00081 
<a name="l00082"></a>00082 
<a name="l00083"></a>00083 
<a name="l00084"></a>00084 
<a name="l00129"></a><a class="code" href="classuser__wapversion.html">00129</a> <span class="keyword">class </span><a class="code" href="classuser__wapversion.html">user_wapversion</a> {
<a name="l00130"></a><a class="code" href="classuser__wapversion.html#3042d7d77ebc22a90f03122826bb6e35">00130</a>         var <a class="code" href="classuser__wapversion.html#3042d7d77ebc22a90f03122826bb6e35">$cObj</a>;              <span class="comment">// The backReference to the mother cObj object set at call time</span>
<a name="l00131"></a>00131 
<a name="l00132"></a><a class="code" href="classuser__wapversion.html#07b2ebe10eda542e92329de8e7329acf">00132</a>         var <a class="code" href="classuser__wapversion.html#07b2ebe10eda542e92329de8e7329acf">$idx</a>=0;
<a name="l00133"></a>00133 
<a name="l00141"></a><a class="code" href="classuser__wapversion.html#8cb224df9e614c7297a51dcb53e3f86e">00141</a>         function <a class="code" href="classuser__wapversion.html#8cb224df9e614c7297a51dcb53e3f86e">main_wapversion</a>($content,$conf)        {
<a name="l00142"></a>00142                 $GLOBALS['TSFE']-&gt;set_no_cache();
<a name="l00143"></a>00143 
<a name="l00144"></a>00144 
<a name="l00145"></a>00145                 $className=<a class="code" href="classt3lib__div.html#aa1c0a3d032e0841991ae355b42f2c25">t3lib_div::makeInstanceClassName</a>('<a class="code" href="classt3lib__xml.html">t3lib_xml</a>');
<a name="l00146"></a>00146                 $xmlObj = <span class="keyword">new</span> $className('wml');
<a name="l00147"></a>00147                 $xmlObj-&gt;XMLdebug=$conf['debug'];
<a name="l00148"></a>00148 
<a name="l00149"></a>00149                         <span class="comment">// Creating top level object</span>
<a name="l00150"></a>00150                 $xmlObj-&gt;WAPHeader();
<a name="l00151"></a>00151 
<a name="l00152"></a>00152                         <span class="comment">// Creating back button:</span>
<a name="l00153"></a>00153                 $xmlObj-&gt;WAPback();
<a name="l00154"></a>00154 
<a name="l00155"></a>00155                 $pageRec = $GLOBALS['TSFE']-&gt;page;
<a name="l00156"></a>00156                 <span class="keywordflow">if</span> ($GLOBALS['TSFE']-&gt;idParts[1])       {
<a name="l00157"></a>00157                                 <span class="comment">// Creating content card:</span>
<a name="l00158"></a>00158                         $xmlObj-&gt;newLevel('card',1,array(
<a name="l00159"></a>00159                                 '<span class="keywordtype">id</span>' =&gt; 'content',
<a name="l00160"></a>00160                                 'title' =&gt; ($conf['preTitle']?$conf['preTitle'].': <span class="charliteral">':'</span>').$pageRec['title']
<a name="l00161"></a>00161                         ));
<a name="l00162"></a>00162 
<a name="l00163"></a>00163                         $cParts = $this-&gt;<a class="code" href="classuser__wapversion.html#bed3fe7efb32a4414dd89ac3088ecc6f">contentAll</a>();
<a name="l00164"></a>00164                         $pointer = <a class="code" href="classt3lib__div.html#79f6a47a7658e28e3f65666f8ebc19f8">t3lib_div::intInRange</a>($GLOBALS['TSFE']-&gt;idParts[1],1,10000);
<a name="l00165"></a>00165 
<a name="l00166"></a>00166                         $msg='';
<a name="l00167"></a>00167                         <span class="keywordflow">if</span> ($pointer-1) {$msg.=$this-&gt;<a class="code" href="classuser__wapversion.html#e59c4f9a4f7cfc97c6293c4f176a80e6">navLink</a>(htmlspecialchars($conf['navLabels.']['prev']),$pointer-1).<span class="charliteral">' '</span>;}
<a name="l00168"></a>00168                         $msg.=$this-&gt;<a class="code" href="classuser__wapversion.html#e59c4f9a4f7cfc97c6293c4f176a80e6">navLink</a>(htmlspecialchars($conf['navLabels.']['up']),0).<span class="charliteral">' '</span>;
<a name="l00169"></a>00169                         <span class="keywordflow">if</span> ($pointer&lt;count($cParts))    {$msg.=$this-&gt;<a class="code" href="classuser__wapversion.html#e59c4f9a4f7cfc97c6293c4f176a80e6">navLink</a>(htmlspecialchars($conf['navLabels.']['next']),$pointer+1).<span class="charliteral">' '</span>;}
<a name="l00170"></a>00170                         $msg.= <span class="charliteral">'['</span>.$pointer.<span class="charliteral">'/'</span>.count($cParts).']&lt;br/&gt;';
<a name="l00171"></a>00171 
<a name="l00172"></a>00172                         $xmlObj-&gt;lines[] = $this-&gt;<a class="code" href="classuser__wapversion.html#9f04e134db8e60b75ad48d74e307b94b">paragraph</a>($msg);
<a name="l00173"></a>00173                         $xmlObj-&gt;lines[] = $this-&gt;<a class="code" href="classuser__wapversion.html#9f04e134db8e60b75ad48d74e307b94b">paragraph</a>($cParts[$pointer-1]);
<a name="l00174"></a>00174                         $xmlObj-&gt;lines[] = $this-&gt;<a class="code" href="classuser__wapversion.html#9f04e134db8e60b75ad48d74e307b94b">paragraph</a>('&lt;br/&gt;'.$msg);
<a name="l00175"></a>00175 
<a name="l00176"></a>00176                         $xmlObj-&gt;newLevel('card',0);
<a name="l00177"></a>00177                 } <span class="keywordflow">else</span> {
<a name="l00178"></a>00178                                 <span class="comment">// Creating menu card:</span>
<a name="l00179"></a>00179                         $xmlObj-&gt;newLevel('card',1,array(
<a name="l00180"></a>00180                                 '<span class="keywordtype">id</span>' =&gt; 'menu',
<a name="l00181"></a>00181                                 'title' =&gt; ($conf['preTitle']?$conf['preTitle'].': <span class="charliteral">':'</span>').$pageRec['title']
<a name="l00182"></a>00182                         ));
<a name="l00183"></a>00183                         $xmlObj-&gt;lines[] = $this-&gt;<a class="code" href="classuser__wapversion.html#f203e9b48c09c16badcf15bf66114c85">contentAbstract</a>();
<a name="l00184"></a>00184                         $xmlObj-&gt;lines[] = '&lt;p&gt;&lt;br/&gt;'.$this-&gt;bold('Menu:').'&lt;/p&gt;';
<a name="l00185"></a>00185                         $xmlObj-&gt;lines[] = $this-&gt;<a class="code" href="classuser__wapversion.html#76a15fa13a98f2ed6c31839f297d006e">menuCurrentLevel</a>($xmlObj-&gt;Icode);
<a name="l00186"></a>00186                         $xmlObj-&gt;newLevel('card',0);
<a name="l00187"></a>00187                 }
<a name="l00188"></a>00188 
<a name="l00189"></a>00189                         <span class="comment">// Footer</span>
<a name="l00190"></a>00190                 $xmlObj-&gt;renderFooter();
<a name="l00191"></a>00191                 <span class="keywordflow">return</span> $xmlObj-&gt;getResult();
<a name="l00192"></a>00192 
<a name="l00193"></a>00193         }
<a name="l00194"></a>00194 
<a name="l00200"></a><a class="code" href="classuser__wapversion.html#f203e9b48c09c16badcf15bf66114c85">00200</a>         function <a class="code" href="classuser__wapversion.html#f203e9b48c09c16badcf15bf66114c85">contentAbstract</a>()      {
<a name="l00201"></a>00201                 $res = $this-&gt;<a class="code" href="classuser__wapversion.html#0322dd1e4af398cf92889e9ebe7ee6c0">getContentResult</a>('tt_content');
<a name="l00202"></a>00202                 $row = $GLOBALS['TYPO3_DB']-&gt;sql_fetch_assoc($res);
<a name="l00203"></a>00203                 $out = $this-&gt;<a class="code" href="classuser__wapversion.html#01cff6f9bcbd603db203282fa1ea9040">bold</a>(<a class="code" href="classt3lib__div.html#6c2adca01abbf533fd2b06d61608fd27">t3lib_div::fixed_lgd</a>(htmlspecialchars($row['header']),20)).'&lt;br/&gt;';
<a name="l00204"></a>00204                 $out.= <a class="code" href="classt3lib__div.html#6c2adca01abbf533fd2b06d61608fd27">t3lib_div::fixed_lgd</a>(htmlspecialchars($row['bodytext']),50);
<a name="l00205"></a>00205                 $out = '&lt;p&gt;'.$out.' &lt;a href=<span class="stringliteral">"'.htmlspecialchars('?id='.$GLOBALS['TSFE']-&gt;id.',1.'.$GLOBALS['TSFE']-&gt;type).'"</span>&gt;[more]&lt;/a&gt;&lt;/p&gt;';
<a name="l00206"></a>00206                 <span class="keywordflow">return</span> $out;
<a name="l00207"></a>00207         }
<a name="l00208"></a>00208 
<a name="l00217"></a><a class="code" href="classuser__wapversion.html#bed3fe7efb32a4414dd89ac3088ecc6f">00217</a>         function <a class="code" href="classuser__wapversion.html#bed3fe7efb32a4414dd89ac3088ecc6f">contentAll</a>($chunkLgd=850)      {
<a name="l00218"></a>00218                 $res = $this-&gt;<a class="code" href="classuser__wapversion.html#0322dd1e4af398cf92889e9ebe7ee6c0">getContentResult</a>('tt_content');
<a name="l00219"></a>00219                 $overlap=5;
<a name="l00220"></a>00220                 <a class="code" href="classuser__wapversion.html#07b2ebe10eda542e92329de8e7329acf">$idx</a>=0;
<a name="l00221"></a>00221                 $out=array();
<a name="l00222"></a>00222                 <span class="keywordflow">while</span>($row = $GLOBALS['TYPO3_DB']-&gt;sql_fetch_assoc($res))       {
<a name="l00223"></a>00223                                 <span class="comment">// Header:</span>
<a name="l00224"></a>00224                         $get = '&lt;br/&gt;'.$this-&gt;cHeader($row['header']).'&lt;br/&gt;';
<a name="l00225"></a>00225                         <span class="keywordflow">if</span> (strlen($out[<a class="code" href="classuser__wapversion.html#07b2ebe10eda542e92329de8e7329acf">$idx</a>].$get)&gt;$chunkLgd)  {
<a name="l00226"></a>00226                                 <a class="code" href="classuser__wapversion.html#07b2ebe10eda542e92329de8e7329acf">$idx</a>++;
<a name="l00227"></a>00227                         }
<a name="l00228"></a>00228                         $out[<a class="code" href="classuser__wapversion.html#07b2ebe10eda542e92329de8e7329acf">$idx</a>].=$get;
<a name="l00229"></a>00229 
<a name="l00230"></a>00230                         <span class="keywordflow">switch</span>($row['CType'])   {
<a name="l00231"></a>00231                                 <span class="keywordflow">case</span> 'text':
<a name="l00232"></a>00232                                 <span class="keywordflow">case</span> 'bullets':
<a name="l00233"></a>00233                                 <span class="keywordflow">case</span> 'table':
<a name="l00234"></a>00234                                         $bodyText = $row['bodytext'];
<a name="l00235"></a>00235                                 <span class="keywordflow">break</span>;
<a name="l00236"></a>00236                                 <span class="keywordflow">case</span> 'textpic':
<a name="l00237"></a>00237                                 <span class="keywordflow">case</span> 'image':
<a name="l00238"></a>00238                                         <span class="keywordflow">if</span> ($row['CType']!='image')             {$bodyText = $row['bodytext'];}
<a name="l00239"></a>00239                                         $bodyText.= chr(10).<span class="charliteral">'['</span>.count(explode(<span class="charliteral">','</span>,$row['image'])).'images, caption: '.$row['imagecaption'].<span class="charliteral">']'</span>;
<a name="l00240"></a>00240                                 <span class="keywordflow">break</span>;
<a name="l00241"></a>00241                                 <span class="keywordflow">case</span> 'header':
<a name="l00242"></a>00242                                         $bodyText=$row['subheader'];
<a name="l00243"></a>00243                                 <span class="keywordflow">break</span>;
<a name="l00244"></a>00244                                 <span class="keywordflow">default</span>:
<a name="l00245"></a>00245                                         $bodyText = '[Un-rendered element, '.$row['CType'].<span class="charliteral">']'</span>;
<a name="l00246"></a>00246                                 <span class="keywordflow">break</span>;
<a name="l00247"></a>00247                         }
<a name="l00248"></a>00248 
<a name="l00249"></a>00249                                 <span class="comment">// Bodytext:</span>
<a name="l00250"></a>00250                         $get = $this-&gt;<a class="code" href="classuser__wapversion.html#1c70754883835b606c65afa46380407d">cBodytext</a>($bodyText).'&lt;br/&gt;';
<a name="l00251"></a>00251                         $diff = $chunkLgd - strlen($out[<a class="code" href="classuser__wapversion.html#07b2ebe10eda542e92329de8e7329acf">$idx</a>]);
<a name="l00252"></a>00252 
<a name="l00253"></a>00253                         <span class="keywordflow">if</span> ($diff&gt;strlen($get)) {
<a name="l00254"></a>00254                                 $out[$idx].=$get;
<a name="l00255"></a>00255                         } <span class="keywordflow">else</span> {
<a name="l00256"></a>00256                                 $out[$idx].=$this-&gt;<a class="code" href="classuser__wapversion.html#1c70754883835b606c65afa46380407d">cBodytext</a>($bodyText,0,$diff+$overlap).'&lt;br/&gt;';
<a name="l00257"></a>00257 
<a name="l00258"></a>00258                                 $safe=0;
<a name="l00259"></a>00259                                 <span class="keywordflow">do</span> {
<a name="l00260"></a>00260                                         $idx++;
<a name="l00261"></a>00261                                         $out[$idx].=$this-&gt;<a class="code" href="classuser__wapversion.html#1c70754883835b606c65afa46380407d">cBodytext</a>($bodyText,$diff+($safe*$chunkLgd)-$overlap,$chunkLgd+$overlap).'&lt;br/&gt;';
<a name="l00262"></a>00262                                         $safe++;
<a name="l00263"></a>00263                                         <span class="keywordflow">if</span> ($safe&gt;100) <span class="keywordflow">break</span>;
<a name="l00264"></a>00264                                 } <span class="keywordflow">while</span> (strlen($out[$idx])&gt;$chunkLgd);
<a name="l00265"></a>00265                         }
<a name="l00266"></a>00266                 }
<a name="l00267"></a>00267                 <span class="keywordflow">return</span> $out;
<a name="l00268"></a>00268         }
<a name="l00269"></a>00269 
<a name="l00277"></a><a class="code" href="classuser__wapversion.html#4c652af973694fe721aeacbf29384e1a">00277</a>         function <a class="code" href="classuser__wapversion.html#4c652af973694fe721aeacbf29384e1a">cHeader</a>($str)  {
<a name="l00278"></a>00278                 $out = $this-&gt;<a class="code" href="classuser__wapversion.html#01cff6f9bcbd603db203282fa1ea9040">bold</a>(htmlspecialchars(strip_tags($str)));
<a name="l00279"></a>00279                 <span class="keywordflow">return</span> $out;
<a name="l00280"></a>00280         }
<a name="l00281"></a>00281 
<a name="l00291"></a><a class="code" href="classuser__wapversion.html#1c70754883835b606c65afa46380407d">00291</a>         function <a class="code" href="classuser__wapversion.html#1c70754883835b606c65afa46380407d">cBodytext</a>($str,$start=0,$max=0)        {
<a name="l00292"></a>00292                 $out = <a class="code" href="classt3lib__div.html#6c2adca01abbf533fd2b06d61608fd27">t3lib_div::fixed_lgd</a>(($start?'...<span class="charliteral">':'</span>').substr($this-&gt;<a class="code" href="classuser__wapversion.html#057b6b153431a1f3ffd9252aec92b709">nl2br</a>(htmlspecialchars(strip_tags($str))),$start),($max?$max:100000));
<a name="l00293"></a>00293                 $out = str_replace(<span class="charliteral">'&amp;'</span>,'',$out);        <span class="comment">// No &amp; in WAP docs??? --&gt; or maybe just htmlspecialchar() things as the LAST thing instead!)</span>
<a name="l00294"></a>00294                 <span class="keywordflow">return</span> $out;
<a name="l00295"></a>00295         }
<a name="l00296"></a>00296 
<a name="l00303"></a><a class="code" href="classuser__wapversion.html#057b6b153431a1f3ffd9252aec92b709">00303</a>         function <a class="code" href="classuser__wapversion.html#057b6b153431a1f3ffd9252aec92b709">nl2br</a>($str)    {
<a name="l00304"></a>00304                 <span class="keywordflow">return</span> ereg_replace(chr(10),'&lt;br/&gt;',$str);
<a name="l00305"></a>00305         }
<a name="l00306"></a>00306 
<a name="l00314"></a><a class="code" href="classuser__wapversion.html#0322dd1e4af398cf92889e9ebe7ee6c0">00314</a>         function <a class="code" href="classuser__wapversion.html#0322dd1e4af398cf92889e9ebe7ee6c0">getContentResult</a>($table) {
<a name="l00315"></a>00315                 global $TCA;
<a name="l00316"></a>00316                 <span class="keywordflow">if</span> ($TCA[$table])       {
<a name="l00317"></a>00317                         $orderBy = $TCA[$table]['ctrl']['sortby'] ? 'ORDER BY '.$TCA[$table]['ctrl']['sortby'] : $TCA[$table]['ctrl']['default_sortby'];
<a name="l00318"></a>00318                         $res = $GLOBALS['TYPO3_DB']-&gt;exec_SELECTquery(<span class="charliteral">'*'</span>, $table, 'pid='.intval($GLOBALS['TSFE']-&gt;<span class="keywordtype">id</span>).$this-&gt;cObj-&gt;enableFields($table), '', $GLOBALS['TYPO3_DB']-&gt;stripOrderBy($orderBy));
<a name="l00319"></a>00319                         <span class="keywordflow">return</span> $res;
<a name="l00320"></a>00320                 }
<a name="l00321"></a>00321         }
<a name="l00322"></a>00322 
<a name="l00329"></a><a class="code" href="classuser__wapversion.html#01cff6f9bcbd603db203282fa1ea9040">00329</a>         function <a class="code" href="classuser__wapversion.html#01cff6f9bcbd603db203282fa1ea9040">bold</a>($str)     {
<a name="l00330"></a>00330                 <span class="keywordflow">return</span> strtoupper($str);
<a name="l00331"></a>00331         }
<a name="l00332"></a>00332 
<a name="l00339"></a><a class="code" href="classuser__wapversion.html#9f04e134db8e60b75ad48d74e307b94b">00339</a>         function <a class="code" href="classuser__wapversion.html#9f04e134db8e60b75ad48d74e307b94b">paragraph</a>($str)        {
<a name="l00340"></a>00340                 <span class="keywordflow">return</span> '&lt;p&gt;'.$str.'&lt;/p&gt;';
<a name="l00341"></a>00341         }
<a name="l00342"></a>00342 
<a name="l00349"></a><a class="code" href="classuser__wapversion.html#27b3cb79d598c35d5bfafb58845f8cda">00349</a>         function <a class="code" href="classuser__wapversion.html#27b3cb79d598c35d5bfafb58845f8cda">line</a>($str)     {
<a name="l00350"></a>00350                 <span class="keywordflow">return</span> $str.'&lt;br/&gt;';
<a name="l00351"></a>00351         }
<a name="l00352"></a>00352 
<a name="l00360"></a><a class="code" href="classuser__wapversion.html#e59c4f9a4f7cfc97c6293c4f176a80e6">00360</a>         function <a class="code" href="classuser__wapversion.html#e59c4f9a4f7cfc97c6293c4f176a80e6">navLink</a>($str,$pointer) {
<a name="l00361"></a>00361                 <span class="keywordflow">return</span> '&lt;a href=<span class="stringliteral">"'.htmlspecialchars('?id='.$GLOBALS['TSFE']-&gt;id.','.$pointer.'.'.$GLOBALS['TSFE']-&gt;type).'"</span>&gt;'.$str.'&lt;/a&gt;';
<a name="l00362"></a>00362         }
<a name="l00363"></a>00363 
<a name="l00370"></a><a class="code" href="classuser__wapversion.html#76a15fa13a98f2ed6c31839f297d006e">00370</a>         function <a class="code" href="classuser__wapversion.html#76a15fa13a98f2ed6c31839f297d006e">menuCurrentLevel</a>($indent)      {
<a name="l00371"></a>00371                 $rL = $GLOBALS['TSFE']-&gt;config['rootLine'];
<a name="l00372"></a>00372                 reset($rL);
<a name="l00373"></a>00373                 $preSpace='';
<a name="l00374"></a>00374                 $out=array();
<a name="l00375"></a>00375                         <span class="comment">// Hierarchy menu</span>
<a name="l00376"></a>00376                 <span class="keywordflow">while</span>(list($level,$data)=each($rL))     {
<a name="l00377"></a>00377                         $preSign = count($rL)-1 &gt; $level ? <span class="charliteral">'-'</span> : <span class="charliteral">'&gt;'</span>;
<a name="l00378"></a>00378                         $menuItem = htmlspecialchars($preSign.<span class="charliteral">' '</span>.$data['title']);
<a name="l00379"></a>00379                         $menuItem = $this-&gt;<a class="code" href="classuser__wapversion.html#a0d7db8376ea073ac007d7893c8335e6">link</a>($preSpace.$menuItem,$data['uid']);
<a name="l00380"></a>00380                         $out[]=$indent.$this-&gt;line($menuItem);
<a name="l00381"></a>00381                         $preSpace.='..';
<a name="l00382"></a>00382                 }
<a name="l00383"></a>00383                         <span class="comment">// Current page menu:</span>
<a name="l00384"></a>00384                 $menu = $this-&gt;<a class="code" href="classuser__wapversion.html#f1c5cd918a9d238d53b390680d2149b4">cleanMenuArray</a>($GLOBALS['TSFE']-&gt;sys_page-&gt;getMenu($GLOBALS['TSFE']-&gt;id));
<a name="l00385"></a>00385                 reset($menu);
<a name="l00386"></a>00386                 <span class="keywordflow">while</span>(list(,$data)=each($menu)) {
<a name="l00387"></a>00387                         $preSign = count($this-&gt;<a class="code" href="classuser__wapversion.html#f1c5cd918a9d238d53b390680d2149b4">cleanMenuArray</a>($GLOBALS['TSFE']-&gt;sys_page-&gt;getMenu($data['uid']))) ? <span class="charliteral">'+'</span> : <span class="charliteral">'*'</span>;
<a name="l00388"></a>00388                         $menuItem = htmlspecialchars($preSign.<span class="charliteral">' '</span>.$data['title']);
<a name="l00389"></a>00389                         $menuItem = $this-&gt;<a class="code" href="classuser__wapversion.html#a0d7db8376ea073ac007d7893c8335e6">link</a>($preSpace.$menuItem,$data['uid']);
<a name="l00390"></a>00390                         $out[]=$indent.$this-&gt;line($menuItem);
<a name="l00391"></a>00391                 }
<a name="l00392"></a>00392                 <span class="keywordflow">return</span> $this-&gt;<a class="code" href="classuser__wapversion.html#9f04e134db8e60b75ad48d74e307b94b">paragraph</a>(implode(chr(10),$out));
<a name="l00393"></a>00393         }
<a name="l00394"></a>00394 
<a name="l00405"></a><a class="code" href="classuser__wapversion.html#a0d7db8376ea073ac007d7893c8335e6">00405</a>         function <a class="code" href="classuser__wapversion.html#a0d7db8376ea073ac007d7893c8335e6">link</a>($str,$id,$deck='')        {
<a name="l00406"></a>00406                 <span class="keywordflow">if</span> ($GLOBALS['TSFE']-&gt;<span class="keywordtype">id</span>==$id &amp;&amp; $deck) {
<a name="l00407"></a>00407                         $out = '&lt;a href=<span class="stringliteral">"#'.$deck.'"</span>&gt;'.$str.'&lt;/a&gt;';
<a name="l00408"></a>00408                 } <span class="keywordflow">else</span> {
<a name="l00409"></a>00409                         $type = $GLOBALS['TSFE']-&gt;type;
<a name="l00410"></a>00410                         $out = '&lt;a href=<span class="stringliteral">"'.htmlspecialchars('?id='.$id.','.($GLOBALS['TSFE']-&gt;id==$id?1:$this-&gt;idx).'.'.$type).'"</span>&gt;'.$str.'&lt;/a&gt;';
<a name="l00411"></a>00411                 }
<a name="l00412"></a>00412                 <span class="keywordflow">return</span> $out;
<a name="l00413"></a>00413         }
<a name="l00414"></a>00414 
<a name="l00421"></a><a class="code" href="classuser__wapversion.html#f1c5cd918a9d238d53b390680d2149b4">00421</a>         function <a class="code" href="classuser__wapversion.html#f1c5cd918a9d238d53b390680d2149b4">cleanMenuArray</a>($menu)  {
<a name="l00422"></a>00422                 reset($menu);
<a name="l00423"></a>00423                 $newMenu=array();
<a name="l00424"></a>00424                 <span class="keywordflow">while</span>(list(,$data)=each($menu)) {
<a name="l00425"></a>00425                         <span class="keywordflow">if</span> ($data['doktype']!=5 &amp;&amp; !$data['nav_hide'])  {
<a name="l00426"></a>00426                                 $newMenu[]=$data;
<a name="l00427"></a>00427                         }
<a name="l00428"></a>00428                 }
<a name="l00429"></a>00429                 <span class="keywordflow">return</span> $newMenu;
<a name="l00430"></a>00430         }
<a name="l00431"></a>00431 }
<a name="l00432"></a>00432 
<a name="l00433"></a>00433 
<a name="l00434"></a>00434 <span class="comment">// AND HERE just some debugging content: Basically a valid WML deck.</span>
<a name="l00435"></a>00435 
<a name="l00436"></a>00436                 <span class="comment">/*</span>
<a name="l00437"></a>00437 <span class="comment">switch($id)     {</span>
<a name="l00438"></a>00438 <span class="comment">        case 1:</span>
<a name="l00439"></a>00439 <span class="comment">                &lt;wml&gt;</span>
<a name="l00440"></a>00440 <span class="comment">                        &lt;card id="Hallo" ontimer="#Login" title="wapportal.dk"&gt;</span>
<a name="l00441"></a>00441 <span class="comment">                                &lt;timer value="35"/&gt;</span>
<a name="l00442"></a>00442 <span class="comment">                                &lt;p&gt;</span>
<a name="l00443"></a>00443 <span class="comment">                                        &lt;img src="/images/logo.wbmp" alt="WAPPORTAL"/&gt;</span>
<a name="l00444"></a>00444 <span class="comment">                                        asf asdf asdf</span>
<a name="l00445"></a>00445 <span class="comment">                                &lt;/p&gt;</span>
<a name="l00446"></a>00446 <span class="comment">                        &lt;/card&gt;</span>
<a name="l00447"></a>00447 <span class="comment">                        &lt;card id="Login" title="wapportal.dk" newcontext="true"&gt;</span>
<a name="l00448"></a>00448 <span class="comment">                                &lt;p&gt;Mobil nr:</span>
<a name="l00449"></a>00449 <span class="comment">                                        &lt;input name="Login" title="Mobil nr:" value="" format="*N" size="15"/&gt;Kodeord:</span>
<a name="l00450"></a>00450 <span class="comment">                                        &lt;input name="Passwd" title="Kodeord:" value="" type="password" format="*N" size="12"/&gt;</span>
<a name="l00451"></a>00451 <span class="comment">                                        &lt;anchor&gt;Login !&lt;go href="/wap/portal/DeckPortal/menu.wml?sid=FGBNRru&amp;amp;rnd=107915&amp;amp;login=$(Login:u)&amp;amp;pwd=$(Passwd:u)"/&gt;&lt;/anchor&gt;</span>
<a name="l00452"></a>00452 <span class="comment">                                        &lt;br/&gt;</span>
<a name="l00453"></a>00453 <span class="comment">                                        &lt;anchor&gt;G&amp;#xe6;st&lt;go href="/wap/portal/DeckPortal/menu.wml?sid=FGBNRru&amp;amp;rnd=107916&amp;amp;login=visitor&amp;amp;pwd=visitor"&gt;&lt;/go&gt;&lt;/anchor&gt;</span>
<a name="l00454"></a>00454 <span class="comment">                                &lt;/p&gt;</span>
<a name="l00455"></a>00455 <span class="comment">                        &lt;/card&gt;</span>
<a name="l00456"></a>00456 <span class="comment">                &lt;/wml&gt;</span>
<a name="l00457"></a>00457 <span class="comment">        break;</span>
<a name="l00458"></a>00458 <span class="comment">        default:</span>
<a name="l00459"></a>00459 <span class="comment">                &lt;wml&gt;</span>
<a name="l00460"></a>00460 <span class="comment">                &lt;template&gt;</span>
<a name="l00461"></a>00461 <span class="comment">                        &lt;do type="accept" label="Back"&gt;&lt;prev/&gt;&lt;/do&gt;</span>
<a name="l00462"></a>00462 <span class="comment">                &lt;/template&gt;</span>
<a name="l00463"></a>00463 <span class="comment">                &lt;card id="index1" title="Hovedside"&gt;</span>
<a name="l00464"></a>00464 <span class="comment">                        &lt;p&gt;Hej Kasper.</span>
<a name="l00465"></a>00465 <span class="comment">                        Dette er noget</span>
<a name="l00466"></a>00466 <span class="comment">                        &lt;img src="/images/logo.wbmp" alt="WAPPORTAL"/&gt;</span>
<a name="l00467"></a>00467 <span class="comment">                         tekst.&lt;/p&gt;</span>
<a name="l00468"></a>00468 <span class="comment"></span>
<a name="l00469"></a>00469 <span class="comment">                &lt;/card&gt;</span>
<a name="l00470"></a>00470 <span class="comment">                &lt;/wml&gt;</span>
<a name="l00471"></a>00471 <span class="comment">        break;</span>
<a name="l00472"></a>00472 <span class="comment">}</span>
<a name="l00473"></a>00473 <span class="comment">*/</span>
<a name="l00474"></a>00474 
<a name="l00475"></a>00475 
<a name="l00476"></a>00476 
<a name="l00477"></a>00477 
<a name="l00478"></a>00478 <span class="keywordflow">if</span> (defined('TYPO3_MODE') &amp;&amp; $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['media/scripts/wapversionLib.inc']) {
<a name="l00479"></a>00479         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['media/scripts/wapversionLib.inc']);
<a name="l00480"></a>00480 }
<a name="l00481"></a>00481 
<a name="l00482"></a>00482 
<a name="l00483"></a>00483 ?&gt;
</pre></div><?php
  include_once '../doc-typo3-funcs.php';
  get_footer();
?>