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


PHP PEAR_PackageFile_v1::getPackage方法代码示例

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


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

示例1: getPackage

 function getPackage()
 {
     if (isset($this->_packagefile)) {
         return $this->_packagefile->getPackage();
     } elseif (isset($this->_downloadURL['info'])) {
         return $this->_downloadURL['info']->getPackage();
     }
     return false;
 }
开发者ID:upmunspel,项目名称:abiturient,代码行数:9,代码来源:Package.php

示例2: validateVersion

 /**
  * @access protected
  */
 function validateVersion()
 {
     if ($this->_state != PEAR_VALIDATE_PACKAGING) {
         if (!$this->validVersion($this->_packagexml->getVersion())) {
             $this->_addFailure('version', 'Invalid version number "' . $this->_packagexml->getVersion() . '"');
         }
         return false;
     }
     $version = $this->_packagexml->getVersion();
     $versioncomponents = explode('.', $version);
     if (count($versioncomponents) != 3) {
         $this->_addWarning('version', 'A version number should have 3 decimals (x.y.z)');
         return true;
     }
     $name = $this->_packagexml->getPackage();
     // version must be based upon state
     switch ($this->_packagexml->getState()) {
         case 'snapshot':
             return true;
         case 'devel':
             if ($versioncomponents[0] . 'a' == '0a') {
                 return true;
             }
             if ($versioncomponents[0] == 0) {
                 $versioncomponents[0] = '0';
                 $this->_addWarning('version', 'version "' . $version . '" should be "' . implode('.', $versioncomponents) . '"');
             } else {
                 $this->_addWarning('version', 'packages with devel stability must be < version 1.0.0');
             }
             return true;
             break;
         case 'alpha':
         case 'beta':
             // check for a package that extends a package,
             // like Foo and Foo2
             if ($this->_state == PEAR_VALIDATE_PACKAGING) {
                 if (substr($versioncomponents[2], 1, 2) == 'rc') {
                     $this->_addFailure('version', 'Release Candidate versions ' . 'must have capital RC, not lower-case rc');
                     return false;
                 }
             }
             if (!$this->_packagexml->getExtends()) {
                 if ($versioncomponents[0] == '1') {
                     if ($versioncomponents[2][0] == '0') {
                         if ($versioncomponents[2] == '0') {
                             // version 1.*.0000
                             $this->_addWarning('version', 'version 1.' . $versioncomponents[1] . '.0 probably should not be alpha or beta');
                             return true;
                         } elseif (strlen($versioncomponents[2]) > 1) {
                             // version 1.*.0RC1 or 1.*.0beta24 etc.
                             return true;
                         } else {
                             // version 1.*.0
                             $this->_addWarning('version', 'version 1.' . $versioncomponents[1] . '.0 probably should not be alpha or beta');
                             return true;
                         }
                     } else {
                         $this->_addWarning('version', 'bugfix versions (1.3.x where x > 0) probably should ' . 'not be alpha or beta');
                         return true;
                     }
                 } elseif ($versioncomponents[0] != '0') {
                     $this->_addWarning('version', 'major versions greater than 1 are not allowed for packages ' . 'without an <extends> tag or an identical postfix (foo2 v2.0.0)');
                     return true;
                 }
                 if ($versioncomponents[0] . 'a' == '0a') {
                     return true;
                 }
                 if ($versioncomponents[0] == 0) {
                     $versioncomponents[0] = '0';
                     $this->_addWarning('version', 'version "' . $version . '" should be "' . implode('.', $versioncomponents) . '"');
                 }
             } else {
                 $vlen = strlen($versioncomponents[0] . '');
                 $majver = substr($name, strlen($name) - $vlen);
                 while ($majver && !is_numeric($majver[0])) {
                     $majver = substr($majver, 1);
                 }
                 if ($versioncomponents[0] != 0 && $majver != $versioncomponents[0]) {
                     $this->_addWarning('version', 'first version number "' . $versioncomponents[0] . '" must match the postfix of ' . 'package name "' . $name . '" (' . $majver . ')');
                     return true;
                 }
                 if ($versioncomponents[0] == $majver) {
                     if ($versioncomponents[2][0] == '0') {
                         if ($versioncomponents[2] == '0') {
                             // version 2.*.0000
                             $this->_addWarning('version', "version {$majver}." . $versioncomponents[1] . '.0 probably should not be alpha or beta');
                             return false;
                         } elseif (strlen($versioncomponents[2]) > 1) {
                             // version 2.*.0RC1 or 2.*.0beta24 etc.
                             return true;
                         } else {
                             // version 2.*.0
                             $this->_addWarning('version', "version {$majver}." . $versioncomponents[1] . '.0 cannot be alpha or beta');
                             return true;
                         }
                     } else {
                         $this->_addWarning('version', "bugfix versions ({$majver}.x.y where y > 0) should " . 'not be alpha or beta');
//.........这里部分代码省略.........
开发者ID:arkosoft,项目名称:S-Admin,代码行数:101,代码来源:Validate.php

示例3: array

 /**
  * Convert a package.xml version 1.0 into version 2.0
  *
  * Note that this does a basic conversion, to allow more advanced
  * features like bundles and multiple releases
  * @param string the classname to instantiate and return.  This must be
  *               PEAR_PackageFile_v2 or a descendant
  * @param boolean if true, only valid, deterministic package.xml 1.0 as defined by the
  *                strictest parameters will be converted
  * @return PEAR_PackageFile_v2|PEAR_Error
  */
 function &toV2($class = 'PEAR_PackageFile_v2', $strict = false)
 {
     if ($strict) {
         if (!$this->_packagefile->validate()) {
             $a = PEAR::raiseError('invalid package.xml version 1.0 cannot be converted' . ' to version 2.0', null, null, null, $this->_packagefile->getValidationWarnings(true));
             return $a;
         }
     }
     $arr = array('attribs' => array('version' => '2.0', 'xmlns' => 'http://pear.php.net/dtd/package-2.0', 'xmlns:tasks' => 'http://pear.php.net/dtd/tasks-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => "http://pear.php.net/dtd/tasks-1.0\n" . "http://pear.php.net/dtd/tasks-1.0.xsd\n" . "http://pear.php.net/dtd/package-2.0\n" . 'http://pear.php.net/dtd/package-2.0.xsd'), 'name' => $this->_packagefile->getPackage(), 'channel' => 'pear.php.net');
     $arr['summary'] = $this->_packagefile->getSummary();
     $arr['description'] = $this->_packagefile->getDescription();
     $maintainers = $this->_packagefile->getMaintainers();
     foreach ($maintainers as $maintainer) {
         if ($maintainer['role'] != 'lead') {
             continue;
         }
         $new = array('name' => $maintainer['name'], 'user' => $maintainer['handle'], 'email' => $maintainer['email'], 'active' => 'yes');
         $arr['lead'][] = $new;
     }
     if (!isset($arr['lead'])) {
         // some people... you know?
         $arr['lead'] = array('name' => 'unknown', 'user' => 'unknown', 'email' => 'noleadmaintainer@example.com', 'active' => 'no');
     }
     if (count($arr['lead']) == 1) {
         $arr['lead'] = $arr['lead'][0];
     }
     foreach ($maintainers as $maintainer) {
         if ($maintainer['role'] == 'lead') {
             continue;
         }
         $new = array('name' => $maintainer['name'], 'user' => $maintainer['handle'], 'email' => $maintainer['email'], 'active' => 'yes');
         $arr[$maintainer['role']][] = $new;
     }
     if (isset($arr['developer']) && count($arr['developer']) == 1) {
         $arr['developer'] = $arr['developer'][0];
     }
     if (isset($arr['contributor']) && count($arr['contributor']) == 1) {
         $arr['contributor'] = $arr['contributor'][0];
     }
     if (isset($arr['helper']) && count($arr['helper']) == 1) {
         $arr['helper'] = $arr['helper'][0];
     }
     $arr['date'] = $this->_packagefile->getDate();
     $arr['version'] = array('release' => $this->_packagefile->getVersion(), 'api' => $this->_packagefile->getVersion());
     $arr['stability'] = array('release' => $this->_packagefile->getState(), 'api' => $this->_packagefile->getState());
     $licensemap = array('php' => 'http://www.php.net/license', 'php license' => 'http://www.php.net/license', 'lgpl' => 'http://www.gnu.org/copyleft/lesser.html', 'bsd' => 'http://www.opensource.org/licenses/bsd-license.php', 'bsd style' => 'http://www.opensource.org/licenses/bsd-license.php', 'bsd-style' => 'http://www.opensource.org/licenses/bsd-license.php', 'mit' => 'http://www.opensource.org/licenses/mit-license.php', 'gpl' => 'http://www.gnu.org/copyleft/gpl.html', 'apache' => 'http://www.opensource.org/licenses/apache2.0.php');
     if (isset($licensemap[strtolower($this->_packagefile->getLicense())])) {
         $arr['license'] = array('attribs' => array('uri' => $licensemap[strtolower($this->_packagefile->getLicense())]), '_content' => $this->_packagefile->getLicense());
     } else {
         // don't use bogus uri
         $arr['license'] = $this->_packagefile->getLicense();
     }
     $arr['notes'] = $this->_packagefile->getNotes();
     $temp = array();
     $arr['contents'] = $this->_convertFilelist2_0($temp);
     $this->_convertDependencies2_0($arr);
     $release = $this->_packagefile->getConfigureOptions() || $this->_isExtension ? 'extsrcrelease' : 'phprelease';
     if ($release == 'extsrcrelease') {
         $arr['channel'] = 'pecl.php.net';
         $arr['providesextension'] = $arr['name'];
         // assumption
     }
     $arr[$release] = array();
     if ($this->_packagefile->getConfigureOptions()) {
         $arr[$release]['configureoption'] = $this->_packagefile->getConfigureOptions();
         foreach ($arr[$release]['configureoption'] as $i => $opt) {
             $arr[$release]['configureoption'][$i] = array('attribs' => $opt);
         }
         if (count($arr[$release]['configureoption']) == 1) {
             $arr[$release]['configureoption'] = $arr[$release]['configureoption'][0];
         }
     }
     $this->_convertRelease2_0($arr[$release], $temp);
     if ($release == 'extsrcrelease' && count($arr[$release]) > 1) {
         // multiple extsrcrelease tags added in PEAR 1.4.1
         $arr['dependencies']['required']['pearinstaller']['min'] = '1.4.1';
     }
     if ($cl = $this->_packagefile->getChangelog()) {
         foreach ($cl as $release) {
             $rel = array();
             $rel['version'] = array('release' => $release['version'], 'api' => $release['version']);
             if (!isset($release['release_state'])) {
                 $release['release_state'] = 'stable';
             }
             $rel['stability'] = array('release' => $release['release_state'], 'api' => $release['release_state']);
             if (isset($release['release_date'])) {
                 $rel['date'] = $release['release_date'];
             } else {
                 $rel['date'] = date('Y-m-d');
//.........这里部分代码省略.........
开发者ID:laiello,项目名称:kangle-php-mysql,代码行数:101,代码来源:v1.php

示例4: Array


//.........这里部分代码省略.........
     if (!is_array($xml) || !isset($xml['paramgroup'])) {
         $script->run(array(), '_default');
     } else {
         if (!isset($xml['paramgroup'][0])) {
             $xml['paramgroup'] = array($xml['paramgroup']);
         }
         foreach ($xml['paramgroup'] as $i => $group) {
             if (isset($_SESSION['_PEAR_Frontend_Web_ScriptSkipSections'][$group['id']])) {
                 continue;
             }
             if (isset($_SESSION['_PEAR_Frontend_Web_ScriptSection'])) {
                 if ($i < $_SESSION['_PEAR_Frontend_Web_ScriptSection']) {
                     $lastgroup = $group;
                     continue;
                 }
             }
             if (isset($_SESSION['_PEAR_Frontend_Web_answers'])) {
                 $answers = $_SESSION['_PEAR_Frontend_Web_answers'];
             }
             if (isset($group['name'])) {
                 if (isset($answers)) {
                     if (isset($answers[$group['name']])) {
                         switch ($group['conditiontype']) {
                             case '=':
                                 if ($answers[$group['name']] != $group['value']) {
                                     continue 2;
                                 }
                                 break;
                             case '!=':
                                 if ($answers[$group['name']] == $group['value']) {
                                     continue 2;
                                 }
                                 break;
                             case 'preg_match':
                                 if (!@preg_match('/' . $group['value'] . '/', $answers[$group['name']])) {
                                     continue 2;
                                 }
                                 break;
                             default:
                                 $this->_clearScriptSession();
                                 return;
                         }
                     }
                 } else {
                     $this->_clearScriptSession();
                     return;
                 }
             }
             if (!isset($group['param'][0])) {
                 $group['param'] = array($group['param']);
             }
             $_SESSION['_PEAR_Frontend_Web_ScriptSection'] = $i;
             if (!isset($answers)) {
                 $answers = array();
             }
             if (isset($group['param'])) {
                 if (method_exists($script, 'postProcessPrompts')) {
                     $prompts = $script->postProcessPrompts($group['param'], $group['name']);
                     if (!is_array($prompts) || count($prompts) != count($group['param'])) {
                         $this->outputData('postinstall', 'Error: post-install script did not ' . 'return proper post-processed prompts');
                         $prompts = $group['param'];
                     } else {
                         foreach ($prompts as $i => $var) {
                             if (!is_array($var) || !isset($var['prompt']) || !isset($var['name']) || $var['name'] != $group['param'][$i]['name'] || $var['type'] != $group['param'][$i]['type']) {
                                 $this->outputData('postinstall', 'Error: post-install script ' . 'modified the variables or prompts, severe security risk. ' . 'Will instead use the defaults from the package.xml');
                                 $prompts = $group['param'];
                             }
                         }
                     }
                     $answers = array_merge($answers, $this->confirmDialog($prompts, $pkg->getChannel() . '/' . $pkg->getPackage()));
                 } else {
                     $answers = array_merge($answers, $this->confirmDialog($group['param'], $pkg->getChannel() . '/' . $pkg->getPackage()));
                 }
             }
             if ($answers) {
                 array_unshift($_SESSION['_PEAR_Frontend_Web_ScriptCompletedPhases'], $group['id']);
                 if (!$script->run($answers, $group['id'])) {
                     $script->run($_SESSION['_PEAR_Frontend_Web_ScriptCompletedPhases'], '_undoOnError');
                     $this->_clearScriptSession();
                     return;
                 }
             } else {
                 $script->run(array(), '_undoOnError');
                 $this->_clearScriptSession();
                 return;
             }
             $lastgroup = $group;
             foreach ($group['param'] as $param) {
                 // rename the current params to save for future tests
                 $answers[$group['id'] . '::' . $param['name']] = $answers[$param['name']];
                 unset($answers[$param['name']]);
             }
             // save the script's variables and user answers for the next round
             $_SESSION['_PEAR_Frontend_Web_ScriptObj'] = (array) $script;
             $_SESSION['_PEAR_Frontend_Web_answers'] = $answers;
             $_SERVER['REQUEST_METHOD'] = '';
         }
     }
     $this->_clearScriptSession();
 }
开发者ID:Bobsel,项目名称:gn-tic,代码行数:101,代码来源:Web.php


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