|
From: <nma...@us...> - 2006-03-10 15:09:04
|
Revision: 14 Author: nmarkgraf Date: 2006-03-10 07:08:52 -0800 (Fri, 10 Mar 2006) ViewCVS: http://svn.sourceforge.net/opendocumentphp/?rev=14&view=rev Log Message: ----------- Added some PHPDocumentor comments, some minor bug fixes and some minor changes. Modified Paths: -------------- poc/src/OpenDocumentAbstract.php poc/src/OpenDocumentFactory.php poc/src/OpenDocumentManifest.php poc/src/OpenDocumentMeta.php poc/src/OpenDocumentObjectAbstract.php Modified: poc/src/OpenDocumentAbstract.php =================================================================== --- poc/src/OpenDocumentAbstract.php 2006-03-10 10:48:24 UTC (rev 13) +++ poc/src/OpenDocumentAbstract.php 2006-03-10 15:08:52 UTC (rev 14) @@ -5,7 +5,8 @@ * * OpenDocumentAbstract is the basic class for all OpenDocument classes * - * @copyright GNU General Public License + * @license GNU General Public License + * @copyright Copyright © 2006, Norman Markgraf, et. al. * @author Norman Markgraf <nma...@us...> * @version $Revision$ * @package OpenDocument @@ -21,6 +22,7 @@ const Release = "0.4.2"; const Copyright = "(C) in 2006 by Norman Markgraf published under GPL 2.0"; const PackageName = "OpenDocumentPHP"; + const defaultMimeType = "application/vnd.oasis.opendocument.text"; protected $logger; Modified: poc/src/OpenDocumentFactory.php =================================================================== --- poc/src/OpenDocumentFactory.php 2006-03-10 10:48:24 UTC (rev 13) +++ poc/src/OpenDocumentFactory.php 2006-03-10 15:08:52 UTC (rev 14) @@ -2,7 +2,8 @@ /** * OpenDocumentFactoy Class * - * @copyright GNU General Public License + * @license GNU General Public License + * @copyright Copyright © 2006, Norman Markgraf, Alex Latchford, et. al. * @author Norman Markgraf <nma...@us...> * @author Alex Latchford <yaw...@us...> * @version $Revision$ @@ -12,6 +13,12 @@ * $Id$ */ +/** + * + * @author Alex Latchford <yaw...@us...> + * + * @since 0.4.1 + */ function __autoload($class_name) { // There is no "void" class, so we must ignore it if ($class_name != "void" ) { @@ -20,14 +27,44 @@ } } +/** + * The main factory class of OpenDocumentPHP + * + * This is the main factory class for OpenDocumentPHP. You can use like this: + * <code> + * <?php + * $SingleDoc = OpenDocumentFactory::createOpenDocument( + * "test.odc", "", true, "application/vnd.oasis.opendocument.calc" + * ); + * $PackageDoc = OpenDocumentFactory::createOpenDocument( + * "test.odt", "", false + * ); + * ?> + * </code> + * + * @acess public + * @final + * + * @since 0.4.0 + */ final class OpenDocumentFactory { - + const defaultMimeType = "application/vnd.oasis.opendocument.text"; /** * Creates a OpenDocument. + * + * @param string $documentName + * @param string $documentPath + * @param bool $singleDocument + * @param string $mimeType + * + * @return OpenDocument + * + * @access public + * @static + * * @since 0.4.0 - * @return OpenDocument */ - static public function createOpenDocument( $documentName, $documentPath=0, $singleDocument = TRUE, $mimeType="application/vnd.oasis.opendocument.text" ) { + static public function createOpenDocument( $documentName, $documentPath=0, $singleDocument = TRUE, $mimeType=self::defaultMimeType ) { if ( $singleDocument ) { return new OpenDocumentSingle( $mimeType ); } else { Modified: poc/src/OpenDocumentManifest.php =================================================================== --- poc/src/OpenDocumentManifest.php 2006-03-10 10:48:24 UTC (rev 13) +++ poc/src/OpenDocumentManifest.php 2006-03-10 15:08:52 UTC (rev 14) @@ -2,15 +2,14 @@ /** * OpenDocumentManifest.php * - * Release information: - * 0.1 - 0.3 : 17/21-Feb-2006 (nm) Initial programmings - * 0.4 : 22-Feb-2006 (nm) Declared <c>getManifest<c> as deprecated. - * - * @copyright GNU General Public License + * @license GNU General Public License + * @copyright Copyright © 2006, Norman Markgraf, et. al. * @author Norman Markgraf <nma...@us...> * @version $Revision$ * @package OpenDocument * + * @since 0.3.0 + * * $Id$ */ @@ -18,19 +17,26 @@ const odmPUBLIC = "-//OpenOffice.org//DTD Manifest 1.0//EN"; const odmSYSTEM = "Manifest.dtd"; const odmROOT = "manifest:manifest"; + const defaultMimeType = "application/vnd.oasis.opendocument.text"; private $root; /** * + * @access public + * + * @since 0.4.0 */ - public function __construct( $mimetype = "application/vnd.oasis.opendocument.text" ) { + public function __construct( $mimetype = self::defaultMimeType ) { parent::__construct( $mimetype ); $this->createManifestDOM(); } /** * + * @access public + * + * @since 0.4.0 */ public function __destruct() { unset( $dom ); @@ -41,6 +47,9 @@ /** * * @access private + * @final + * + * @since 0.4.0 */ final private function createManifestDOM() { $impl = new DOMImplementation; @@ -66,6 +75,10 @@ /** * + * @access public + * @final + * + * @since 0.4.0 */ final public function addEntryToManifest( $fullpath, $mimetype, $size=-1, $encrypt=0 ) { $node = $this->dom->createElementNS( self::NS_MANIFEST, "manifest:file-entry" ); @@ -83,6 +96,10 @@ /** * + * @access public + * @final + * + * @since 0.4.0 */ final public function createEncryptionData( ) { return $this->dom->createElmentNS( self::NS_MANIFEST, "manifest:encryption-data" ); @@ -91,9 +108,12 @@ /** * Returns the whole OpenDocument Manifest as DOM. * + * @return DOMDocument manifest as DOM. + * * @access public + * @final * - * @return DOM manifest as DOM. + * @since 0.4.0 */ final public function get() { $this->dom->appendChild( $this->root ); @@ -104,9 +124,12 @@ /** * Save the whole OpenDocument Manifest in a file * + * @param string name of file + * * @access public + * @final * - * @param string name of file + * @since 0.4.0 */ final public function save( $filename ) { $this->get()->save( $filename ); Modified: poc/src/OpenDocumentMeta.php =================================================================== --- poc/src/OpenDocumentMeta.php 2006-03-10 10:48:24 UTC (rev 13) +++ poc/src/OpenDocumentMeta.php 2006-03-10 15:08:52 UTC (rev 14) @@ -2,11 +2,14 @@ /** * OpenDocumentMeta Class * - * @copyright GNU General Public License + * @license GNU General Public License + * @copyright Copyright © 2006, Norman Markgraf, et. al. * @author Norman Markgraf <nma...@us...> * @version $Revision$ * @package OpenDocument * + * @since 0.3.0 + * * $Id$ */ @@ -17,7 +20,9 @@ /** * - * @since 0.4.0 + * @access public + * + * @since 0.3.0 */ public function __construct( $dom=0 ) { parent::__construct(); @@ -45,6 +50,9 @@ /** * + * @access public + * + * @since 0.3.0 */ public function __destruct() { unset( $dom ); @@ -57,6 +65,9 @@ } /** + * + * @access public + * * @since 0.4.0 */ public function load( $filename ) { @@ -87,6 +98,9 @@ /** * + * @access public + * + * @since 0.3.2 */ public function addDublinCore( $dc, $value) { $this->logger->debug( "OpenDocumentMeta->addDublinCore: ". $value ."." ); @@ -96,6 +110,9 @@ } /** + * + * @access public + * * @since 0.4.0 */ public function getDublicCore( $dc ) { @@ -110,7 +127,20 @@ } /** + * Add the "Creation Date" of the current OpenDocument to the Meta file. + * + * You can give a timestamp made by <c>mktime()</c> or nothing as parameter. + * If no parameter is given, the current time and date will be used. + * <code> + * // This will set the current date and time: + * Document->getMeta()->addCreationDate() + * // This will set the creation date to (April, 4th 1968 - 10:11:12) + * Document->getMeta()->addCreationDate( mktime( 10, 11, 12, 4, 3, 1968 ) ); + * </code> * @param $date Timestamp or 0 = now. + * + * @access public + * * @since 0.4.2 */ public function addCreationDate( $date=0 ) { @@ -118,7 +148,7 @@ // 2006-02-14T16:36:10 $creation_time = date( "Y-m-d\TH:i:s" ); } else { - $creation_time = date( "Y-m-d\TH:i:s", $date ) + $creation_time = date( "Y-m-d\TH:i:s", $date ); } $this->logger->debug( "OpenDocumentMeta->addCreationTime: ". $creation_time ."." ); @@ -132,6 +162,9 @@ /** * + * @access public + * + * @since 0.4.0 */ public function addGenerator( $generator ) { $lgenerator = ""; @@ -153,6 +186,8 @@ /** * + * @access public + * * @since 0.4.0 */ public function getGenerator() { @@ -170,6 +205,9 @@ /** * + * @access public + * + * @since 0.4.0 */ public function addInitialCreator( $initialCreator ) { $this->logger->debug( "OpenDocumentMeta->addInitialCreator: ". $initialCreator ."." ); @@ -179,6 +217,9 @@ /** * + * @access public + * + * @since 0.4.0 */ public function getInitialCreator() { $retValue = ""; @@ -193,6 +234,8 @@ /** * + * @access public + * * @since 0.4.0 */ public function addUserDefinedMetadata( $name, $type, $value ) { @@ -209,7 +252,11 @@ } /** + * Commits all changes to Meta and normalize them. After a commit call, you couldn't add + * new things to Meta. * + * @access public + * * @since 0.4.0 */ public function commit() { @@ -220,16 +267,17 @@ } /** - * @depricated - * @since 0.4.0 - */ - final public function getMeta() { - return $this->get(); - } - - /** + * Get Meta as DOMDocument. + * + * If this object is not commited, this method will first call <c>commit()</c> and return the + * Meta as DOMDocument after that. + * + * @return DOMDocument Meta as DOMDocument. + * + * @access public + * @final + * * @since 0.4.0 - * @return */ final public function get() { if (!$this->isCommited) { @@ -240,12 +288,15 @@ } /** + * + * @access public + * @final + * * @since 0.4.0 - * */ final public function save( $filename ) { $this->logger->debug( "OpenDocumentMeta->save(". $filename .")." ); $this->get()->save( $filename ); } - -} \ No newline at end of file +} +?> \ No newline at end of file Modified: poc/src/OpenDocumentObjectAbstract.php =================================================================== --- poc/src/OpenDocumentObjectAbstract.php 2006-03-10 10:48:24 UTC (rev 13) +++ poc/src/OpenDocumentObjectAbstract.php 2006-03-10 15:08:52 UTC (rev 14) @@ -2,11 +2,14 @@ /** * OpenDocumentObjectAbstract Class * - * @copyright GNU General Public License + * @license GNU General Public License + * @copyright Copyright © 2006, Norman Markgraf, et. al. * @author Norman Markgraf <nma...@us...> * @version $Revision$ * @package OpenDocument * + * @since 0.4.0 + * * $Id$ */ @@ -76,14 +79,16 @@ * namespace OpenDocument form */ const NS_FORM = "urn:oasis:names:tc:opendocument:xmlns:form:1.0"; - - + protected $dom; protected $isCommited; /** * + * @access public + * + * @since 0.4.0 */ public function __construct( $mimetype = 0 ) { parent::__construct( $mimetype ); @@ -93,18 +98,30 @@ /** * + * @access public + * + * @since 0.4.0 */ public function __destruct() { $this->logger->debug( "OpenDocumentObjectAbstract destructed." ); parent::__destruct(); } - + /** + * + * @return DOMDocument + * @access public + * + * @since 0.4.0 + */ public function get() { return $this->dom; } /** * + * @access public + * + * @since 0.4.0 */ public function save( $filename ) { $tmp =& $this->dom; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |