OpenDocumentPHP
[ class tree: OpenDocumentPHP ] [ index: OpenDocumentPHP ] [ all elements ]

Source for file DublinCoreFragment.php

Documentation is available at DublinCoreFragment.php

  1. <?php
  2. /*
  3.  * Created on 10.01.2007 by Norman Markgraf (nmarkgraf(at)user.sourceforge.net) 
  4.  *
  5.  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  6.  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  7.  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  8.  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  9.  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  10.  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  11.  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  12.  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  13.  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  14.  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  15.  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  16.  *
  17.  * This software consists of voluntary contributions made by many individuals
  18.  * and is licensed under the GPL. For more information please see
  19.  * <http://opendocumentphp.org>.
  20.  * 
  21.  * $Id: DublinCoreFragment.php 143 2007-03-04 09:15:56Z nmarkgraf $
  22.  */
  23. require_once 'OpenDocumentPHP/util/Fragment.php';
  24. /**
  25.  * DublinCoreFragment class.
  26.  *  
  27.  * @author         Norman Markgraf (nmarkgraf(at)user.sourceforge.net)
  28.  * @copyright     Copyright in 2006, 2007 by The OpenDocumentPHP Team
  29.  * @license     http://www.gnu.org/licenses/gpl.html GNU General Public License 2.0.
  30.  * @version        $Revision: 143 $
  31.  * @package        OpenDocumentPHP
  32.  * @subpackage    meta
  33.  * @since         0.5.0 - 08.02.2007
  34.  * @link        http://dublincore.org/ Dublin Core Metadata Initiative (R)
  35.  */
  36. class DublinCoreFragment extends Fragment {
  37.     /**
  38.      * @access         private
  39.      * @since         0.5.0 - 08.02.2007
  40.      */
  41.     private $title null;
  42.     /**
  43.      * @access         private
  44.      * @since         0.5.0 - 08.02.2007
  45.      */
  46.     private $description null;
  47.     /**
  48.      * @access         private
  49.      * @since         0.5.0 - 08.02.2007
  50.      */
  51.     private $subject null;
  52.     /**
  53.      * @access         private
  54.      * @since         0.5.0 - 08.02.2007
  55.      */
  56.     private $creator null;
  57.     /**
  58.      * @access         private
  59.      * @since         0.5.0 - 08.02.2007
  60.      */
  61.     private $date null;
  62.     /**
  63.      * @access         private
  64.      * @since         0.5.0 - 08.02.2007
  65.      */
  66.     private $language null;
  67.     /**
  68.      * Constructor method.
  69.      * 
  70.      * @since         0.5.0 - 08.02.2007
  71.      */
  72.     function __construct($domFragment$root{
  73.         parent :: __construct($domFragment$root);
  74.         $this->root = $root;
  75.     }
  76.     /**
  77.      * 
  78.      * 
  79.      * @access        public
  80.      * @since         0.5.0 - 08.02.2007
  81.      */
  82.     function getCreator({
  83.         if (!isset ($this->creator)) {
  84.             $this->creator $this->getTag('dc:creator''');
  85.         }
  86.         return $this->creator->nodeValue;
  87.     }
  88.     /**
  89.      * 
  90.      * 
  91.      * @access        public
  92.      * @since         0.5.0 - 08.02.2007
  93.      */
  94.     function setCreator($creator{
  95.         if ($this->getCreator(!= $creator{
  96.             $newNode $this->domFragment->createElementNS(self :: DC'dc:creator'$creator);
  97.             $this->setTag($this->creator$newNode);
  98.             $this->creator $newNode;
  99.         }
  100.     }
  101.     /**
  102.      * 
  103.      * 
  104.      * @access        public
  105.      * @since         0.5.0 - 08.02.2007
  106.      */
  107.     function getDescription({
  108.         if (!isset ($this->description)) {
  109.             $this->description $this->getTag('dc:description''');
  110.         }
  111.         return $this->description->nodeValue;
  112.     }
  113.     /**
  114.      * 
  115.      * 
  116.      * @access        public
  117.      * @since         0.5.0 - 08.02.2007
  118.      */
  119.     function setDescription($description{
  120.         if ($this->getDescription(!= $description{
  121.             $newNode $this->domFragment->createElementNS(self :: DC'dc:description'$description);
  122.             $this->setTag($this->description$newNode);
  123.             $this->description $newNode;
  124.         }
  125.     }
  126.     /**
  127.      * 
  128.      * 
  129.      * @access        public
  130.      * @since         0.5.0 - 08.02.2007
  131.      */
  132.     function getLanguage({
  133.         if (!isset ($this->language)) {
  134.             $this->language $this->getTag('dc:language''');
  135.         }
  136.         return $this->language->nodeValue;
  137.     }
  138.     /**
  139.      * 
  140.      * 
  141.      * @access        public
  142.      * @since         0.5.0 - 08.02.2007
  143.      */
  144.     function setLanguage($language{
  145.         if ($this->getLanguage(!= $language{
  146.             $newNode $this->domFragment->createElementNS(self :: DC'dc:language'$language);
  147.             $this->setTag($this->language$newNode);
  148.             $this->language $newNode;
  149.         }
  150.     }
  151.     /**
  152.      * 
  153.      * 
  154.      * @access        public
  155.      * @since         0.5.0 - 08.02.2007
  156.      */
  157.     function getSubject({
  158.         if (!isset ($this->subject)) {
  159.             $this->subject $this->getTag('dc:subject''');
  160.         }
  161.         return $this->subject->nodeValue;
  162.     }
  163.     /**
  164.      * 
  165.      * 
  166.      * @access        public
  167.      * @since         0.5.0 - 08.02.2007
  168.      */
  169.     function setSubject($subject{
  170.         if ($this->getSubject(!= $subject{
  171.             $newNode $this->domFragment->createElementNS(self :: DC'dc:subject'$subject);
  172.             $this->setTag($this->subject$newNode);
  173.             $this->subject $newNode;
  174.         }
  175.     }
  176.     /**
  177.      * 
  178.      * 
  179.      * @access        public
  180.      * @since         0.5.0 - 08.02.2007
  181.      */
  182.     function getTitle({
  183.         if (!isset ($this->title)) {
  184.             $this->title $this->getTag('dc:title''');
  185.         }
  186.         return $this->title->nodeValue;
  187.     }
  188.     /**
  189.      * 
  190.      * 
  191.      * @access        public
  192.      * @since         0.5.0 - 08.02.2007
  193.      */
  194.     function setTitle($title{
  195.         if ($this->getTitle(!= $title{
  196.             $newNode $this->domFragment->createElementNS(self :: DC'dc:title'$title);
  197.             $this->setTag($this->title$newNode);
  198.             $this->title $newNode;
  199.         }
  200.     }
  201.     /**
  202.      *
  203.      * 
  204.      * @access        protected
  205.      * @since         0.5.0 - 08.02.2007
  206.      */
  207.     protected function getTag($tag$defaultValue{
  208.         return parent :: getTag('//*/office:meta/' $tagself :: DC$tag$defaultValue);
  209.     }
  210. }
  211. ?>

Documentation generated on Tue, 12 Jun 2007 09:59:42 +0200 by phpDocumentor 1.3.2