createComment() public method

public createComment ( $comment )
Esempio n. 1
0
 /**
  * Insert the directory entry into the XML at the given point.
  *
  * @param Horde_Pear_Package_Xml_Element_Directory $parent The parent.
  * @param DOMNode                                  $point  Insertion point.
  *
  * @return NULL
  */
 private function _insert(Horde_Pear_Package_Xml_Element_Directory $parent, DOMNode $point = null)
 {
     if ($point === null) {
         $point = $parent->getDirectoryNode()->lastChild;
     } else {
         if ($point->previousSibling) {
             $ws = trim($point->previousSibling->textContent);
             if (empty($ws)) {
                 $point = $point->previousSibling;
             }
         }
     }
     $dir = $this->_xml->insert(array("\n " . str_repeat(" ", $this->_level), 'dir' => array('name' => $this->_name), ' ', $this->_xml->createComment(' ' . $this->_path . ' ')), $point);
     $this->_xml->append("\n" . str_repeat(' ', $this->_level + 1), $dir);
     $this->setDirectoryNode($dir);
 }
Esempio n. 2
0
 /**
  * Execute the task.
  *
  * @return NULL
  */
 public function run()
 {
     $contents = $this->_xml->findNode('/p:package/p:contents/p:dir');
     if ($contents && !empty($this->_options['regenerate'])) {
         $contents = $this->_xml->findNode('/p:package/p:contents');
         $this->_xml->removeWhitespace($contents->previousSibling);
         $this->_xml->findNode('/p:package')->removeChild($contents);
         $contents = false;
     }
     $filelist = $this->_xml->findNode('/p:package/p:phprelease/p:filelist');
     if ($filelist && !empty($this->_options['regenerate'])) {
         $filelist = $this->_xml->findNode('/p:package/p:phprelease');
         $this->_xml->removeWhitespace($filelist->previousSibling);
         $this->_xml->findNode('/p:package')->removeChild($filelist);
         $filelist = false;
     }
     if (!$contents) {
         $root = $this->_xml->insert(array('contents' => array(), "\n "), $this->_xml->findNode('/p:package/p:dependencies'));
         $contents = $this->_xml->append(array("\n  ", 'dir' => array('baseinstalldir' => '/', 'name' => '/'), ' ', $this->_xml->createComment(' / '), "\n "), $root);
         $this->_xml->append("\n  ", $contents);
     }
     if (!$filelist) {
         $root = $this->_xml->insert(array('phprelease' => array(), "\n "), $this->_xml->findNode('/p:package/p:changelog'));
         $filelist = $this->_xml->append(array("\n  ", 'filelist' => array(), "\n "), $root);
         $this->_xml->append("\n  ", $filelist);
     }
     $current = $this->_xml->createContents($this->_xml, $contents, $filelist);
     $current->update($this->_content);
     try {
         if (empty($this->_options['no_timestamp'])) {
             $this->_xml->timestamp();
         }
         $this->_xml->syncCurrentVersion();
     } catch (Horde_Pear_Exception $e) {
         /**
          * Ignore errors in this operation as it is not mandatory for
          * updating the file list.
          */
     }
 }