本文整理匯總了PHP中PEAR_PackageFile_v1::getDate方法的典型用法代碼示例。如果您正苦於以下問題:PHP PEAR_PackageFile_v1::getDate方法的具體用法?PHP PEAR_PackageFile_v1::getDate怎麽用?PHP PEAR_PackageFile_v1::getDate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PEAR_PackageFile_v1
的用法示例。
在下文中一共展示了PEAR_PackageFile_v1::getDate方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: validateDate
/**
* @access protected
*/
function validateDate()
{
if ($this->_state == PEAR_VALIDATE_NORMAL || $this->_state == PEAR_VALIDATE_PACKAGING) {
if (!preg_match('/(\\d\\d\\d\\d)\\-(\\d\\d)\\-(\\d\\d)/', $this->_packagexml->getDate(), $res) || count($res) < 4 || !checkdate($res[2], $res[3], $res[1])) {
$this->_addFailure('date', 'invalid release date "' . $this->_packagexml->getDate() . '"');
return false;
}
if ($this->_state == PEAR_VALIDATE_PACKAGING && $this->_packagexml->getDate() != date('Y-m-d')) {
$this->_addWarning('date', 'Release Date "' . $this->_packagexml->getDate() . '" is not today');
}
}
return true;
}
示例2: validateDate
/**
* @access protected
*/
function validateDate()
{
if ($this->_state == PEAR_VALIDATE_NORMAL || $this->_state == PEAR_VALIDATE_PACKAGING) {
if (!preg_match('/\\d\\d\\d\\d\\-\\d\\d\\-\\d\\d/', $this->_packagexml->getDate())) {
$this->_addFailure('date', 'invalid release date "' . $this->_packagexml->getDate() . '"');
return false;
}
if (strtotime($this->_packagexml->getDate()) == -1) {
$this->_addFailure('date', 'invalid release date "' . $this->_packagexml->getDate() . '"');
return false;
}
if ($this->_state == PEAR_VALIDATE_PACKAGING && $this->_packagexml->getDate() != date('Y-m-d')) {
$this->_addWarning('date', 'Release Date "' . $this->_packagexml->getDate() . '"is not today');
}
}
return true;
}
示例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');
//.........這裏部分代碼省略.........