当前位置: 首页>>代码示例>>PHP>>正文


PHP PEAR_PackageFile_v2::setDate方法代码示例

本文整理汇总了PHP中PEAR_PackageFile_v2::setDate方法的典型用法代码示例。如果您正苦于以下问题:PHP PEAR_PackageFile_v2::setDate方法的具体用法?PHP PEAR_PackageFile_v2::setDate怎么用?PHP PEAR_PackageFile_v2::setDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PEAR_PackageFile_v2的用法示例。


在下文中一共展示了PEAR_PackageFile_v2::setDate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: toXml

 /**
  * Return an XML document based on the package info (as returned
  * by the PEAR_Common::infoFrom* methods).
  *
  * @return string XML data
  */
 function toXml($state = PEAR_VALIDATE_NORMAL, $options = array())
 {
     $this->_packagefile->setDate(date('Y-m-d'));
     $this->_packagefile->setTime(date('H:i:s'));
     if (!$this->_packagefile->validate($state)) {
         return false;
     }
     if (is_array($options)) {
         $this->options = array_merge($this->_defaultOptions, $options);
     } else {
         $this->options = $this->_defaultOptions;
     }
     $arr = $this->_packagefile->getArray();
     if (isset($arr['filelist'])) {
         unset($arr['filelist']);
     }
     if (isset($arr['_lastversion'])) {
         unset($arr['_lastversion']);
     }
     // Fix the notes a little bit
     if (isset($arr['notes'])) {
         // This trims out the indenting, needs fixing
         $arr['notes'] = "\n" . trim($arr['notes']) . "\n";
     }
     if (isset($arr['changelog']) && !empty($arr['changelog'])) {
         // Fix for inconsistency how the array is filled depending on the changelog release amount
         if (!isset($arr['changelog']['release'][0])) {
             $release = $arr['changelog']['release'];
             unset($arr['changelog']['release']);
             $arr['changelog']['release'] = array();
             $arr['changelog']['release'][0] = $release;
         }
         foreach (array_keys($arr['changelog']['release']) as $key) {
             $c =& $arr['changelog']['release'][$key];
             if (isset($c['notes'])) {
                 // This trims out the indenting, needs fixing
                 $c['notes'] = "\n" . trim($c['notes']) . "\n";
             }
         }
     }
     if ($state ^ PEAR_VALIDATE_PACKAGING && !isset($arr['bundle'])) {
         $use = $this->_recursiveXmlFilelist($arr['contents']['dir']['file']);
         unset($arr['contents']['dir']['file']);
         if (isset($use['dir'])) {
             $arr['contents']['dir']['dir'] = $use['dir'];
         }
         if (isset($use['file'])) {
             $arr['contents']['dir']['file'] = $use['file'];
         }
         $this->options['beautifyFilelist'] = true;
     }
     $arr['attribs']['packagerversion'] = '@PEAR-VER@';
     if ($this->serialize($arr, $options)) {
         return $this->_serializedData . "\n";
     }
     return false;
 }
开发者ID:phpsource,项目名称:pear-core,代码行数:63,代码来源:v2.php

示例2: toXml

 /**
  * Return an XML document based on the package info (as returned
  * by the PEAR_Common::infoFrom* methods).
  *
  * @return string XML data
  */
 function toXml($state = PEAR_VALIDATE_NORMAL, $options = array())
 {
     $this->_packagefile->setDate(date('Y-m-d'));
     $this->_packagefile->setTime(date('H:i:s'));
     if (!$this->_packagefile->validate($state)) {
         return false;
     }
     if (is_array($options)) {
         $this->options = array_merge($this->_defaultOptions, $options);
     } else {
         $this->options = $this->_defaultOptions;
     }
     $arr = $this->_packagefile->getArray();
     if (isset($arr['filelist'])) {
         unset($arr['filelist']);
     }
     if (isset($arr['_lastversion'])) {
         unset($arr['_lastversion']);
     }
     if ($state ^ PEAR_VALIDATE_PACKAGING && !isset($arr['bundle'])) {
         $use = $this->_recursiveXmlFilelist($arr['contents']['dir']['file']);
         unset($arr['contents']['dir']['file']);
         if (isset($use['dir'])) {
             $arr['contents']['dir']['dir'] = $use['dir'];
         }
         if (isset($use['file'])) {
             $arr['contents']['dir']['file'] = $use['file'];
         }
         $this->options['beautifyFilelist'] = true;
     }
     $arr['attribs']['packagerversion'] = '1.4.2';
     if ($this->serialize($arr, $options)) {
         return $this->_serializedData . "\n";
     }
     return false;
 }
开发者ID:prometheus-ev,项目名称:promdilps,代码行数:42,代码来源:v2.php


注:本文中的PEAR_PackageFile_v2::setDate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。