本文整理汇总了PHP中admin_tools::VersionData方法的典型用法代码示例。如果您正苦于以下问题:PHP admin_tools::VersionData方法的具体用法?PHP admin_tools::VersionData怎么用?PHP admin_tools::VersionData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类admin_tools
的用法示例。
在下文中一共展示了admin_tools::VersionData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: AvailableList
function AvailableList($show_options = true)
{
global $langmessage, $config;
//search settings
$this->searchPerPage = 10;
$this->searchOrderOptions = array();
$this->searchOrderOptions['modified'] = $langmessage['Recently Updated'];
$this->searchOrderOptions['rating_score'] = $langmessage['Highest Rated'];
$this->searchOrderOptions['downloads'] = $langmessage['Most Downloaded'];
$this->SearchOrder();
// get addon information for ordering
admin_tools::VersionData($version_data);
$version_data = $version_data['packages'];
// combine remote addon information
foreach ($this->avail_addons as $theme_id => $info) {
if (isset($info['id'])) {
$id = $info['id'];
if (isset($version_data[$id])) {
$info = array_merge($info, $version_data[$id]);
$info['rt'] *= 5;
}
//use local rating
if (isset($this->addonReviews[$id])) {
$info['rt'] = $this->addonReviews[$id]['rating'];
}
} else {
$info['rt'] = 6;
//give local themes a high rating to make them appear first, rating won't actually display
}
$info += array('dn' => 0, 'rt' => 0);
//modified time
if (!isset($info['tm'])) {
$info['tm'] = self::ModifiedTime($info['full_dir']);
}
$this->avail_addons[$theme_id] = $info;
}
// sort by
uasort($this->avail_addons, array('admin_theme_content', 'SortUpdated'));
switch ($this->searchOrder) {
case 'downloads':
uasort($this->avail_addons, array('admin_theme_content', 'SortDownloads'));
break;
case 'modified':
uasort($this->avail_addons, array('admin_theme_content', 'SortRating'));
uasort($this->avail_addons, array('admin_theme_content', 'SortUpdated'));
break;
case 'rating_score':
default:
uasort($this->avail_addons, array('admin_theme_content', 'SortRating'));
break;
}
// pagination
$this->searchMax = count($this->avail_addons);
if (isset($_REQUEST['page']) && ctype_digit($_REQUEST['page'])) {
$this->searchPage = $_REQUEST['page'];
}
$start = $this->searchPage * $this->searchPerPage;
$possible = array_slice($this->avail_addons, $start, $this->searchPerPage, true);
if ($show_options) {
$this->SearchOptions();
}
// show themes
echo '<div id="gp_avail_themes">';
foreach ($possible as $theme_id => $info) {
$theme_label = str_replace('_', ' ', $info['name']);
$version = '';
$id = false;
if (isset($info['version'])) {
$version = $info['version'];
}
if (isset($info['id']) && is_numeric($info['id'])) {
$id = $info['id'];
}
$has_screenshot = file_exists($info['full_dir'] . '/screenshot.png');
//screenshot
if ($has_screenshot) {
echo '<div class="expand_child_click">';
echo '<b class="gp_theme_head">' . $theme_label . ' ' . $version . '</b>';
echo '<div style="background-image:url(\'' . common::GetDir($info['rel'] . '/screenshot.png') . '\')">';
} else {
echo '<div>';
echo '<b class="gp_theme_head">' . $theme_label . ' ' . $version . '</b>';
echo '<div>';
}
//options
echo '<div class="gp_theme_options">';
//colors
echo '<b>' . $langmessage['preview'] . '</b>';
echo '<ul>';
foreach ($info['colors'] as $color) {
echo '<li>';
$q = 'cmd=preview&theme=' . rawurlencode($theme_id . '/' . $color) . $this->searchQuery;
if ($this->searchPage) {
$q .= '&page=' . $this->searchPage;
}
echo common::Link('Admin_Theme_Content/Available', str_replace('_', ' ', $color), $q);
echo '</li>';
}
echo '</ul>';
ob_start();
//.........这里部分代码省略.........
示例2: Update
function Update()
{
global $langmessage, $gp_filesystem;
if (!$this->core_package) {
echo $langmessage['OOPS'] . ' (Core Package Not Set)';
return false;
}
if (isset($_POST['step'])) {
$this->curr_step = (int) $_POST['step'];
}
//already up to date?
if ($this->curr_step < 4 && version_compare(gpversion, $this->core_package['version'], '>=')) {
msg($langmessage['UP_TO_DATE']);
return false;
}
//filesystem
$filesystem_method = $this->DetectFileSystem();
if (!$filesystem_method) {
msg('Update Aborted: Could not establish a file writing method compatible with your server.');
return false;
}
$this->steps[1] = $langmessage['step:prepare'];
$this->steps[2] = $langmessage['step:download'];
$this->steps[3] = $langmessage['step:unpack'];
$this->steps[4] = $langmessage['step:clean'];
echo '<div>' . $langmessage['update_steps'] . '</div>';
echo '<ol class="steps">';
$curr_step_label = '';
foreach ($this->steps as $temp_step => $message) {
if ($this->curr_step == $temp_step) {
echo '<li class="current">' . $message . '</li>';
$curr_step_label = $message;
} elseif ($temp_step < $this->curr_step) {
echo '<li class="done">' . $message . '</li>';
} else {
echo '<li>' . $message . '</li>';
}
}
echo '</ol>';
echo '<h3>' . $curr_step_label . '</h3>';
echo '<form method="post" action="?cmd=update">';
if ($filesystem_method) {
echo '<input type="hidden" name="filesystem_method" value="' . htmlspecialchars($filesystem_method) . '" />';
}
$done = false;
$passed = false;
ob_start();
switch ($this->curr_step) {
case 4:
$done = $this->CleanUp();
break;
case 3:
$passed = $this->UnpackAndReplace();
$this->OldFolders();
break;
case 2:
$passed = $this->DownloadSource();
break;
case 1:
$passed = $this->GetServerInfo();
break;
}
$step_content = ob_get_clean();
$this->OutputMessages();
echo $step_content;
if ($gp_filesystem) {
$gp_filesystem->destruct();
}
admin_tools::VersionData($this->update_data);
//save any changes made by the steps
if (!$done) {
if ($passed) {
echo '<input type="hidden" name="step" value="' . min(count($this->steps), $this->curr_step + 1) . '"/>';
echo '<input type="submit" class="submit" name="" value="' . htmlspecialchars($langmessage['next_step']) . '" />';
} elseif ($this->curr_step < 3) {
echo '<input type="hidden" name="step" value="' . min(count($this->steps), $this->curr_step) . '"/>';
echo '<input type="submit" class="submit" name="" value="' . htmlspecialchars($langmessage['continue']) . '" />';
} else {
echo '<input type="hidden" name="failed_install" value="failed_install"/>';
echo '<input type="hidden" name="step" value="4"/>';
echo '<input type="submit" class="submit" name="" value="' . htmlspecialchars($langmessage['step:clean']) . '..." />';
}
}
echo '</form>';
return true;
}