本文整理汇总了PHP中PackageManager::fromNameValueList方法的典型用法代码示例。如果您正苦于以下问题:PHP PackageManager::fromNameValueList方法的具体用法?PHP PackageManager::fromNameValueList怎么用?PHP PackageManager::fromNameValueList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PackageManager
的用法示例。
在下文中一共展示了PackageManager::fromNameValueList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkForUpdates
/**
* Check the SugarDepot for updates for the given type as passed in via POST
* @param type the type to check for
* @return array return an array of releases for each given installed object if an update is found
*/
function checkForUpdates()
{
$json = getJSONobj();
$type = '';
if (isset($_REQUEST['type'])) {
$type = nl2br($_REQUEST['type']);
}
$pm = new PackageManager();
$updates = $pm->checkForUpdates();
$nodes = array();
$release_map = array();
if (!empty($updates)) {
foreach ($updates as $update) {
$update = PackageManager::fromNameValueList($update);
$nodes[] = array('label' => $update['name'], 'description' => $update['description'], 'version' => $update['version'], 'build_number' => $update['build_number'], 'id' => $update['id'], 'type' => $update['type']);
$release_map[$update['id']] = array('package_id' => $update['package_id'], 'category_id' => $update['category_id'], 'type' => $update['type']);
}
}
//patches
$filter = array(array('name' => 'type', 'value' => "'patch'"));
$releases = $pm->getReleases('', '', $filter);
if (!empty($releases['packages'])) {
foreach ($releases['packages'] as $update) {
$update = PackageManager::fromNameValueList($update);
$nodes[] = array('label' => $update['name'], 'description' => $update['description'], 'version' => $update['version'], 'build_number' => $update['build_number'], 'id' => $update['id'], 'type' => $update['type']);
$release_map[$update['id']] = array('package_id' => $update['package_id'], 'category_id' => $update['category_id'], 'type' => $update['type']);
}
}
$_SESSION['ML_PATCHES'] = $release_map;
echo 'result = ' . $json->encode(array('updates' => $nodes));
}
示例2: createJavascriptPackageArray
function createJavascriptPackageArray($releases)
{
$output = "var mti_data = [";
$count = count($releases);
$index = 1;
if (!empty($releases['packages'])) {
foreach ($releases['packages'] as $release) {
$release = PackageManager::fromNameValueList($release);
$output .= "[";
$output .= "'" . $release['description'] . "', '" . $release['version'] . "', '" . $release['build_number'] . "', '" . $release['id'] . "'";
$output .= "]";
if ($index < $count) {
$output .= ",";
}
$index++;
}
}
$output .= "]\n;";
return $output;
}
示例3: buildPackageXML
function buildPackageXML($package, $releases = array())
{
$xml = '<package>';
$xml .= '<package_id>' . $package['id'] . '</package_id>';
$xml .= '<name>' . $package['name'] . '</name>';
$xml .= '<description>' . $package['description'] . '</description>';
if (!empty($releases)) {
$xml .= '<releases>';
foreach ($releases['packages'] as $release) {
$myrelease = PackageManager::fromNameValueList($release);
$xml .= '<release>';
$xml .= '<release_id>' . $myrelease['id'] . '</release_id>';
$xml .= '<version>' . $myrelease['version'] . '</version>';
$xml .= '<description>' . $myrelease['description'] . '</description>';
$xml .= '<package_id>' . $package['id'] . '</package_id>';
$xml .= '<category_id>' . $package['category_id'] . '</category_id>';
$xml .= '</release>';
}
$xml .= '</releases>';
}
$xml .= '</package>';
return $xml;
}