Source for file CMS3_SemanticOutputHandler.php
Documentation is available at CMS3_SemanticOutputHandler.php
// CMS3 - A Three Content Management System.
// Copyright (C) 2007 Jop... (Jonas F. Jensen).
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*This file defines CMS3_SemanticOutputHandler
* @package SemanticOutputHandler
* @author Jonas F. Jensen <jopsen@gmail.com>
* @copyright 2007 Jonas F. Jensen.
* @license http://www.gnu.org/licenses/gpl.txt
* class CMS3_SemanticOutputHandler generates simple output readable with a xsl/xml complaint browser
protected $Title =
"Untitled";
*Sets the complete unique identifier.
*@param string Idenfitifer Complete unique identifier.
* @param CMS3_System Owner The CMS3_System that owns this plugin, gives the plugin ability to get data from
//Just save a handle for now
* Gets the pluginID of the plugin.
return "SemanticOutputHandler";
* Data provided by use of this method may be left out if the OutputHandler wishes
* to print something else the HTML, therefor don't add important information
* @param string line A line you wish to add to the header.
//Semantic ouputhandler doesn't support header extensions
//But this was documentated in the specification of IOutputHandler, so plugins should be aware of this...
//this is also why the dojo toolkit was chosen for this system.
I know it's physically possible to include the headerextension in the xmlformat and then extract it during xsl transform...
But that would NOT look good in the xml feed.
} // end of member function SetTitle
* Set the body if the page, read parameter documentation.
* Embedments may be included in the body, they shall be formatted as follows: [[EMBED|<identifier>|EMBED]], where <identifier> is the identifier returned from the IEmbedable.
* @param string body Body of the page, or description of a channel.
* @param array List Parse a list, use this feature if you wish to parse a list. This will also
* enable to OutputHandler to print a feed. This parameter is optional, if set the
* first parameter will define the description of the channel, and every body and
* title in this array will define an entry.
* [[title,body],[title,body],...]
public function SetBody( $body, $List =
null ) {
} // end of member function SetBody
* Print the content, should also be called from GetPage().
*this prints a xml page with a very simple schema:
* <title>Page Title</title>
* <para>Main paragraph</para>
* <subpara>Sub paragraph<subpara>
* <subpara headline="Optional headline of sub paragraph">Sub paragraph<subpara>
* <subpara>Sub paragraph<subpara>
* <subpara>Sub paragraph<subpara>
public function Parse() {
header('Content-Type: text/xml');
$Content =
$this->GetContent(); // Get the content first
print
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
print
"<?xml-stylesheet type=\"text/xsl\" href=\"" .
$this->Owner->GetCMS3URL() .
"bin/" .
$this->GetPluginID() .
"/template.xsl\"?>\n";
print
"<semanticpage>\n\t<title>";
print
$this->Title .
"</title>\n";
print
"\t<server>" .
$this->Owner->GetCMS3URL() .
"</server>\n";
} // end of member function Parse
*Gets content ready to be printed
*This does not include header, only the body content.
*@return string Content ready for print
$Content =
"\t<content>\n\t\t<para><![CDATA[\n" .
$this->Body .
"]]>\n\t\t</para>\n";
foreach($this->BodyList as $key =>
$value){
$Content .=
"\t\t<subpara headline=\"" .
$value[0] .
"\" ><![CDATA[";
$Content .=
$value[1] .
"]]></subpara>\n";
$Content .=
"\t\t<subpara><![CDATA[" .
$value .
"]]></subpara>\n";
return $Content .
"\t</content>\n";
*Gets the header extension
*@return string Lines to be added to the header
* Diable the OutputHandler, do this if you wish to print binary data.
// end of member function Disable
* Gets to original identifier specified as <Namespace>/<PluginID>.<ext>
* Do this if you wish to extraxt the extention and parse manually.
// end of member function GetIdentifier
} // end of CMS3_HTMLOutputHandler
Documentation generated on Mon, 30 Apr 2007 01:59:08 +0200 by phpDocumentor 1.3.1