Source for file OpenDocumentText.php
Documentation is available at OpenDocumentText.php
* Created on 04.01.2007 by Norman Markgraf (nmarkgraf(at)user.sourceforge.net)
* PHP versions 5.2 or better.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* This software consists of voluntary contributions made by many individuals
* and is licensed under the GPL. For more information please see
* <http://opendocumentphp.org>.
* $Id: OpenDocumentText.php 182 2007-06-11 13:32:34Z nmarkgraf $
require_once 'OpenDocumentPHP/OpenDocumentAbstract.php';
* OpenDocumentText class.
* You could uses this class as follows:
* $text = new OpenDocumentText( 'YourFavoriteTextDocument.odt' );
* // do some thing with it
* Be aware that even if <b>you</b> do not modifiy the OpenDocument, the library will!
* So do not expect the that the file is absolut the same after you run the close method.
* @author Norman Markgraf (nmarkgraf(at)user.sourceforge.net)
* @copyright Copyright in 2006, 2007 by The OpenDocumentPHP Team
* @license http://www.gnu.org/licenses/gpl.html GNU Public License 2.0 or above.
* @version $Revision: 182 $
* @package OpenDocumentPHP
* @since 0.5.0 - 08.02.2007
* Read (and if not exists create) an OpenDocument text file.
* @param string fullpath Full path and name of the document
* @since 0.5.0 - 08.02.2007
// Construct a text document
parent :: __construct(self :: odmTextNamespace);
// Is the variable $fullpath given?
if (isset ($fullpath) && is_string($fullpath)) {
// File does exist, so we can load it via open.
parent :: open($fullpath);
// File does not exist, so we can create it.
parent :: open($fullpath, self :: CREATE, self :: odmTextNamespace);
// Clean it, with a fresh init call.
// Set everything to a OpenDocument TEXT file.
// JUST A CLEAN FILE WITH NO FILE NAME JET!!!! DANGER!!!!
* @since 0.5.2 - 21.03.2007
* Setup some default data for the meta.xml.
* @since 0.5.2 - 21.03.2007
// =====================================================================
$dc = $this->getMeta()->getDublinCoreFragment();
// ---------------------------------------------------------------------
$dc->setSubject('A generated subject by OpenDocumentPHP.');
$dc->setTitle('This is a generated title by OpenDocumentPHP.');
$dc->setDescription('This is a short description by OpenDocumentPHP.');
// =====================================================================
$meta = $this->getMeta()->getMetaFragment();
// ---------------------------------------------------------------------
|