Location: PHPKode > projects > Aukyla Platform > doc/html/a00229.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>Aukyla PHP Framework</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link rel="StyleSheet" href="auton.css" type="text/css" media="screen">
  </head>

  <body>
    <div id="mainmenu">
      <a href="http://www.auton.nl/" class="home">Home</a>
    </div>
    <div id="submenu">
      <a class="logo" href="http://www.auton.nl/"></a>

      <div class="head">Ads</div>
      <a href="http://sourceforge.net/"><img src="http://sourceforge.net/sflogo.php?group_id=116358&amp;type=1" alt="SourceForge.net Logo" style="padding: 2px 4px; width: 88px; height: 31px; border: 0px"></a>
      <a href="http://getfirefox.com/" title="Get Firefox - The Browser, Reloaded."><img src="http://www.mozilla.org/products/firefox/buttons/getfirefox_small.png" alt="Get Firefox" style="width: 110px; height: 32px; border: 0px"></a>
    </div>
    <div id="main">
<!-- Generated by Doxygen 1.3.9.1 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
<div class="nav">
<a class="el" href="dir_000000.html">base</a></div>
<h1>Output.php</h1><div class="fragment"><pre class="fragment">00001 &lt;?php
00002 <span class="comment">/*</span>
00003 <span class="comment">     Output.php, output buffer with support for applying server-side XSLT</span>
00004 <span class="comment">                 transformations.</span>
00005 <span class="comment">     Copyright (C) 2004 Arend van Beelen, Auton Rijnsburg</span>
00006 <span class="comment"></span>
00007 <span class="comment">     This program is free software; you can redistribute it and/or modify it</span>
00008 <span class="comment">     under the terms of the GNU General Public License as published by the Free</span>
00009 <span class="comment">     Software Foundation; either version 2 of the License, or (at your option)</span>
00010 <span class="comment">     any later version.</span>
00011 <span class="comment"></span>
00012 <span class="comment">     This program is distributed in the hope that it will be useful, but WITHOUT</span>
00013 <span class="comment">     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or</span>
00014 <span class="comment">     FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for</span>
00015 <span class="comment">     more details.</span>
00016 <span class="comment"></span>
00017 <span class="comment">     You should have received a copy of the GNU General Public License along</span>
00018 <span class="comment">     with this program; if not, write to the Free Software Foundation, Inc.,</span>
00019 <span class="comment">     59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
00020 <span class="comment"></span>
00021 <span class="comment">     For any questions, comments or whatever, you may mail me at: hide@address.com</span>
00022 <span class="comment">*/</span>
00023 
00024 require_once('<a class="code" href="a00092.html">Config</a>.php');
00025 
<a name="l00038"></a><a class="code" href="a00134.html">00038</a> <span class="keyword">class </span><a class="code" href="a00134.html">Output</a>
00039 {
<a name="l00046"></a><a class="code" href="a00134.html#a0">00046</a>         <span class="keyword">public</span> function __construct()
00047         {
00048                 $this-&gt;buffer = '';
00049                 $this-&gt;transformation = <span class="keyword">true</span>;
00050                 $this-&gt;xmlVersion = <span class="stringliteral">"&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;"</span>;
00051                 $this-&gt;method = <a class="code" href="a00092.html#e0">Config::globals</a>('output', '<a class="code" href="a00169.html">XHTML</a>');
00052                 $this-&gt;serverSideXSLT = <a class="code" href="a00092.html#e0">Config::globals</a>('serverSideXSLT', '<span class="keyword">true</span>');
00053         }
00054 
<a name="l00061"></a><a class="code" href="a00134.html#a1">00061</a>         <span class="keyword">public</span> function __destruct()
00062         {
00063                 <span class="keywordflow">if</span>($this-&gt;transformation == <span class="keyword">false</span> ||
00064                    $this-&gt;buffer == '')
00065                 {
00066                         <span class="keywordflow">return</span>;
00067                 }
00068 
00069                 <span class="keywordflow">if</span>($this-&gt;serverSideXSLT == '<span class="keyword">true</span>')
00070                 {
00071                         $inputDoc = <span class="keyword">new</span> DOMDocument();
00072                         $inputDoc-&gt;loadXML($this-&gt;xmlVersion.
00073                                            $this-&gt;buffer);
00074 
00075                         $xsltDoc = <span class="keyword">new</span> DOMDocument();
00076                         <span class="keywordflow">if</span>($xsltDoc-&gt;load(AUKYLA_DIR.<span class="stringliteral">"/htdocs/resources/base/Output/{$this-&gt;method}.xsl"</span>) == <span class="keyword">false</span>)
00077                         {
00078                                 die('Could not open <a class="code" href="a00134.html">Output</a> XSLT transformation!');
00079                         }
00080 
00081                         $proc = <span class="keyword">new</span> XSLTProcessor();
00082                         $proc-&gt;importStyleSheet($xsltDoc);
00083 
00084                         $doctype = @file_get_contents(AUKYLA_DIR.<span class="stringliteral">"/htdocs/resources/base/Output/{$this-&gt;method}.doctype"</span>);
00085                         <span class="keywordflow">if</span>($doctype !== <span class="keyword">false</span>)
00086                         {
00087                                 echo $doctype;
00088                         }
00089                         echo $proc-&gt;transformToXML($inputDoc);
00090                 }
00091                 <span class="keywordflow">else</span>
00092                 {
00093                         echo $this-&gt;xmlVersion.
00094                              <span class="stringliteral">"&lt;?xml-stylesheet type=\"text/xsl\" href=\"resources/base/Output/{$this-&gt;method}.xsl\"?&gt;\n"</span>.
00095                              $this-&gt;buffer;
00096                 }
00097         }
00098 
<a name="l00106"></a><a class="code" href="a00134.html#e0">00106</a>         <span class="keyword">public</span> <span class="keyword">static</span> function disableTransformation()
00107         {
00108                 global $Output;
00109 
00110                 $Output-&gt;transformation = <span class="keyword">false</span>;
00111         }
00112 
<a name="l00126"></a><a class="code" href="a00134.html#e1">00126</a>         <span class="keyword">public</span> <span class="keyword">static</span> function setMethod($outputMethod)
00127         {
00128                 global $Output;
00129 
00130                 $Output-&gt;method = $outputMethod;
00131         }
00132 
<a name="l00140"></a><a class="code" href="a00134.html#e2">00140</a>         <span class="keyword">public</span> <span class="keyword">static</span> function method()
00141         {
00142                 global $Output;
00143 
00144                 <span class="keywordflow">return</span> $Output-&gt;method;
00145         }
00146 
<a name="l00150"></a><a class="code" href="a00134.html#e3">00150</a>         <span class="keyword">public</span> <span class="keyword">static</span> function setOutputMethod($outputMethod)
00151         {
00152                 self::setMethod($outputMethod);
00153         }
00154 
<a name="l00158"></a><a class="code" href="a00134.html#e4">00158</a>         <span class="keyword">public</span> <span class="keyword">static</span> function outputMethod()
00159         {
00160                 <span class="keywordflow">return</span> self::method();
00161         }
00162 
<a name="l00168"></a><a class="code" href="a00134.html#e5">00168</a>         <span class="keyword">public</span> <span class="keyword">static</span> function write($string)
00169         {
00170                 global $Output;
00171 
00172                 $Output-&gt;buffer .= $string;
00173         }
00174 
00175         <span class="keyword">private</span> $buffer;
00176         <span class="keyword">private</span> $doctype;
00177         <span class="keyword">private</span> $method;
00178         <span class="keyword">private</span> $serverSideXSLT;
00179         <span class="keyword">private</span> $transformation;
00180 }
00181 
00182 <span class="comment">// create one global instance of the class</span>
00183 global $Output;
00184 $Output = <span class="keyword">new</span> <a class="code" href="a00134.html">Output</a>();
00185 
00186 ?&gt;
</pre></div>    </div>
  </body>
</html>
Return current item: Aukyla Platform