phpDocumentor OpenDocumentPHP
meta
[ 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 236 2007-07-24 07:43:40Z nmarkgraf $
  22.  */
  23.  
  24. /**
  25.  * 
  26.  */
  27. require_once 'OpenDocumentPHP/util/Fragment.php';
  28.  
  29. /**
  30.  * DublinCoreFragment class.
  31.  *  
  32.  * @author         Norman Markgraf (nmarkgraf(at)user.sourceforge.net)
  33.  * @copyright     Copyright in 2006, 2007 by The OpenDocumentPHP Team
  34.  * @license     http://www.gnu.org/licenses/gpl.html GNU General Public License 2.0.
  35.  * @version        $Revision: 236 $
  36.  * @package        OpenDocumentPHP
  37.  * @subpackage    meta
  38.  * @since         0.5.0 - 08.02.2007
  39.  * @link        http://dublincore.org/ Dublin Core Metadata Initiative (R)
  40.  */
  41. class DublinCoreFragment extends Fragment {
  42.     /**
  43.      * @access         private
  44.      * @since         0.5.0 - 08.02.2007
  45.      */
  46.     private $title null;
  47.     /**
  48.      * @access         private
  49.      * @since         0.5.0 - 08.02.2007
  50.      */
  51.     private $description null;
  52.     /**
  53.      * @access         private
  54.      * @since         0.5.0 - 08.02.2007
  55.      */
  56.     private $subject null;
  57.     /**
  58.      * @access         private
  59.      * @since         0.5.0 - 08.02.2007
  60.      */
  61.     private $creator null;
  62.     /**
  63.      * @access         private
  64.      * @since         0.5.0 - 08.02.2007
  65.      */
  66.     private $date null;
  67.     /**
  68.      * @access         private
  69.      * @since         0.5.0 - 08.02.2007
  70.      */
  71.     private $language null;
  72.     /**
  73.      * Constructor method.
  74.      * 
  75.      * @param        DOMNode $domFragment 
  76.      * @param        DOMNode    $root 
  77.      * @since         0.5.0 - 08.02.2007
  78.      */
  79.     function __construct($domFragment$root{
  80.         parent :: __construct($domFragment$root);
  81.         $this->root = $root;
  82.     }
  83.     /**
  84.      * 
  85.      * 
  86.      * @access        public
  87.      * @since         0.5.0 - 08.02.2007
  88.      */
  89.     function getCreator({
  90.         if (!isset ($this->creator)) {
  91.             $this->creator $this->getTag('creator''');
  92.         }
  93.         return $this->creator->nodeValue;
  94.     }
  95.     /**
  96.      * 
  97.      * @param        string $creator 
  98.      * @access        public
  99.      * @since         0.5.0 - 08.02.2007
  100.      */
  101.     function setCreator($creator{
  102.         if ($this->getCreator(!= $creator{
  103.             $newNode $this->domFragment->createElementNS(self :: DC'dc:creator'$creator);
  104.             $this->setTag($this->creator$newNode);
  105.             $this->creator $newNode;
  106.         }
  107.     }
  108.     /**
  109.      * 
  110.      * 
  111.      * @access        public
  112.      * @since         0.5.0 - 08.02.2007
  113.      */
  114.     function getDescription({
  115.         if (!isset ($this->description)) {
  116.             $this->description $this->getTag('description''');
  117.         }
  118.         return $this->description->nodeValue;
  119.     }
  120.     /**
  121.      * 
  122.      * @param        string $description 
  123.      * @access        public
  124.      * @since         0.5.0 - 08.02.2007
  125.      */
  126.     function setDescription($description{
  127.         if ($this->getDescription(!= $description{
  128.             $newNode $this->domFragment->createElementNS(self :: DC'dc:description'$description);
  129.             $this->setTag($this->description$newNode);
  130.             $this->description $newNode;
  131.         }
  132.     }
  133.     /**
  134.      * 
  135.      * 
  136.      * @access        public
  137.      * @since         0.5.0 - 08.02.2007
  138.      */
  139.     function getLanguage({
  140.         if (!isset ($this->language)) {
  141.             $this->language $this->getTag('language''');
  142.         }
  143.         return $this->language->nodeValue;
  144.     }
  145.     /**
  146.      * 
  147.      * @param        string $language 
  148.      * @access        public
  149.      * @since         0.5.0 - 08.02.2007
  150.      */
  151.     function setLanguage($language{
  152.         if ($this->getLanguage(!= $language{
  153.             $newNode $this->domFragment->createElementNS(self :: DC'dc:language'$language);
  154.             $this->setTag($this->language$newNode);
  155.             $this->language $newNode;
  156.         }
  157.     }
  158.     /**
  159.      * 
  160.      * 
  161.      * @access        public
  162.      * @since         0.5.0 - 08.02.2007
  163.      */
  164.     function getSubject({
  165.         if (!isset ($this->subject)) {
  166.             $this->subject $this->getTag('subject''');
  167.         }
  168.         return $this->subject->nodeValue;
  169.     }
  170.     /**
  171.      * 
  172.      * @param        string $subject 
  173.      * @access        public
  174.      * @since         0.5.0 - 08.02.2007
  175.      */
  176.     function setSubject($subject{
  177.         if ($this->getSubject(!= $subject{
  178.             $newNode $this->domFragment->createElementNS(self :: DC'dc:subject'$subject);
  179.             $this->setTag($this->subject$newNode);
  180.             $this->subject $newNode;
  181.         }
  182.     }
  183.     /**
  184.      * 
  185.      * 
  186.      * @access        public
  187.      * @since         0.5.0 - 08.02.2007
  188.      */
  189.     function getTitle({
  190.         if (!isset ($this->title)) {
  191.             $this->title $this->getTag('title''');
  192.         }
  193.         return $this->title->nodeValue;
  194.     }
  195.     /**
  196.      * 
  197.      * 
  198.      * @access        public
  199.      * @since         0.5.0 - 08.02.2007
  200.      */
  201.     function setTitle($title{
  202.         if ($this->getTitle(!= $title{
  203.             $newNode $this->domFragment->createElementNS(self :: DC'dc:title'$title);
  204.             $this->setTag($this->title$newNode);
  205.             $this->title $newNode;
  206.         }
  207.     }
  208.     /**
  209.      *
  210.      * @param        string $tag 
  211.      * @param        string $defaultValue 
  212.      * @access        protected
  213.      * @since         0.5.0 - 08.02.2007
  214.      */
  215.     protected function getTag($tag$defaultValue{
  216.         return parent :: getTag('//*/office:meta/dc:' $tagself :: DC$tag$defaultValue);
  217.     }
  218. }
  219. ?>

Documentation generated on Wed, 18 Jun 2008 06:28:15 +0200 by phpDocumentor 1.3.2