本文整理汇总了PHP中Package::getVar方法的典型用法代码示例。如果您正苦于以下问题:PHP Package::getVar方法的具体用法?PHP Package::getVar怎么用?PHP Package::getVar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Package
的用法示例。
在下文中一共展示了Package::getVar方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: system
ob_start();
if ($xoopsDB->getRowsNum($res)) {
// force clean work files
$work = XOOPS_UPLOAD_PATH . "/update/work";
if (is_dir("{$work}/{$updatedir}")) {
system("rm -rf '{$work}/{$updatedir}'");
}
if (is_dir("{$work}/{$backupdir}")) {
system("rm -rf '{$work}/{$backupdir}'");
}
while ($data = $xoopsDB->fetchArray($res)) {
$pkg = new InstallPackage($data);
$pkg->load();
$pname = $pkg->getVar('pname');
$newpkg = new Package($pname, $pkgs[$pkg->dirname]['pversion']);
if ($pkg->getVar('parent') != $newpkg->getVar('pkgid')) {
if ($op == 'exec') {
$pkg->backupPackage($newpkg, $backupdir);
$pkg->updatePackage($newpkg, $updatedir);
package_expire($pname);
} elseif ($op == 'update') {
$pkg->updatePackage($newpkg, $updatedir);
} else {
$pkg->backupPackage($newpkg, $backupdir);
}
$pkgn++;
}
}
}
$content = ob_get_contents();
ob_end_clean();
示例2: show_info_table
function show_info_table($pkg)
{
$ppkg = new Package($pkg->getVar('parent'));
$info = array('name' => _AM_PKG_NAME, 'pname' => _AM_PKG_PNAME, 'pversion' => _AM_PKG_CURRENT, 'dtime' => _AM_PKG_DTIME, 'ctime' => _AM_PKG_CTIME, 'vcheck' => _AM_PKG_DIRNAME);
$buf = "<table cellspacing='0'>\n";
$dirname = $pkg->getVar('vcheck');
$module_handler =& xoops_gethandler('module');
$module = $dirname ? $module_handler->getByDirname($dirname) : false;
list($mver, $iver) = get_current_version($pkg->getVar('pname'), $pkg->getVar('vcheck'));
$n = 0;
foreach ($info as $name => $label) {
$bg = $n++ % 2 ? "even" : "odd";
$val = $ppkg->getVar($name);
if (preg_match('/time$/', $name)) {
$val = formatTimestamp($val);
} elseif ($name == 'pversion') {
if ($iver != $val) {
$val .= " ({$iver})";
}
if (is_object($module)) {
$cver = $module->getVar('version') / 100;
if ($cver != $mver) {
$val .= " [{$cver}" . _AM_UPDATE_TO . "{$mver}]";
}
}
} elseif ($name == 'vcheck') {
if ($dirname != $val) {
$val = "{$dirname} ({$val})";
}
}
$val = htmlspecialchars($val);
$buf .= "<tr class='{$bg}'><th>{$label}</th><td>{$val}</td></tr>\n";
}
return $buf . "</table>\n";
}