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


PHP PEAR_PackageFile_v2::getArray方法代码示例

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


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

示例3: validate

 /**
  * @param PEAR_PackageFile_v2
  * @param int
  */
 function validate(&$pf, $state = PEAR_VALIDATE_NORMAL)
 {
     $this->_pf =& $pf;
     $this->_curState = $state;
     $this->_packageInfo = $this->_pf->getArray();
     $this->_isValid = $this->_pf->_isValid;
     $this->_filesValid = $this->_pf->_filesValid;
     $this->_stack =& $pf->_stack;
     $this->_stack->getErrors(true);
     if (($this->_isValid & $state) == $state) {
         return true;
     }
     if (!isset($this->_packageInfo) || !is_array($this->_packageInfo)) {
         return false;
     }
     if (!isset($this->_packageInfo['attribs']['version']) || $this->_packageInfo['attribs']['version'] != '2.0' && $this->_packageInfo['attribs']['version'] != '2.1') {
         $this->_noPackageVersion();
     }
     $structure = array('name', 'channel|uri', '*extends', 'summary', 'description', '+lead', '*developer', '*contributor', '*helper', 'date', '*time', 'version', 'stability', 'license->?uri->?filesource', 'notes', 'contents', '*compatible', 'dependencies', '*usesrole', '*usestask', '*providesextension', '*srcpackage|*srcuri', '+phprelease|+extsrcrelease|+extbinrelease|' . '+zendextsrcrelease|+zendextbinrelease|bundle', '*changelog');
     $test = $this->_packageInfo;
     if (isset($test['dependencies']) && isset($test['dependencies']['required']) && isset($test['dependencies']['required']['pearinstaller']) && isset($test['dependencies']['required']['pearinstaller']['min']) && version_compare('1.8.0', $test['dependencies']['required']['pearinstaller']['min'], '<')) {
         $this->_pearVersionTooLow($test['dependencies']['required']['pearinstaller']['min']);
         return false;
     }
     // ignore post-installation array fields
     if (array_key_exists('filelist', $test)) {
         unset($test['filelist']);
     }
     if (array_key_exists('_lastmodified', $test)) {
         unset($test['_lastmodified']);
     }
     if (array_key_exists('#binarypackage', $test)) {
         unset($test['#binarypackage']);
     }
     if (array_key_exists('old', $test)) {
         unset($test['old']);
     }
     if (array_key_exists('_lastversion', $test)) {
         unset($test['_lastversion']);
     }
     if (!$this->_stupidSchemaValidate($structure, $test, '<package>')) {
         return false;
     }
     if (empty($this->_packageInfo['name'])) {
         $this->_tagCannotBeEmpty('name');
     }
     $test = isset($this->_packageInfo['uri']) ? 'uri' : 'channel';
     if (empty($this->_packageInfo[$test])) {
         $this->_tagCannotBeEmpty($test);
     }
     if (is_array($this->_packageInfo['license']) && (!isset($this->_packageInfo['license']['_content']) || empty($this->_packageInfo['license']['_content']))) {
         $this->_tagCannotBeEmpty('license');
     } elseif (empty($this->_packageInfo['license'])) {
         $this->_tagCannotBeEmpty('license');
     }
     if (empty($this->_packageInfo['summary'])) {
         $this->_tagCannotBeEmpty('summary');
     }
     if (empty($this->_packageInfo['description'])) {
         $this->_tagCannotBeEmpty('description');
     }
     if (empty($this->_packageInfo['date'])) {
         $this->_tagCannotBeEmpty('date');
     }
     if (empty($this->_packageInfo['notes'])) {
         $this->_tagCannotBeEmpty('notes');
     }
     if (isset($this->_packageInfo['time']) && empty($this->_packageInfo['time'])) {
         $this->_tagCannotBeEmpty('time');
     }
     if (isset($this->_packageInfo['dependencies'])) {
         $this->_validateDependencies();
     }
     if (isset($this->_packageInfo['compatible'])) {
         $this->_validateCompatible();
     }
     if (!isset($this->_packageInfo['bundle'])) {
         if (empty($this->_packageInfo['contents'])) {
             $this->_tagCannotBeEmpty('contents');
         }
         if (!isset($this->_packageInfo['contents']['dir'])) {
             $this->_filelistMustContainDir('contents');
             return false;
         }
         if (isset($this->_packageInfo['contents']['file'])) {
             $this->_filelistCannotContainFile('contents');
             return false;
         }
     }
     $this->_validateMaintainers();
     $this->_validateStabilityVersion();
     $fail = false;
     if (array_key_exists('usesrole', $this->_packageInfo)) {
         $roles = $this->_packageInfo['usesrole'];
         if (!is_array($roles) || !isset($roles[0])) {
             $roles = array($roles);
//.........这里部分代码省略.........
开发者ID:racontemoi,项目名称:mamp,代码行数:101,代码来源:Validator.php


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