本文整理汇总了PHP中Package::getAvailablePackages方法的典型用法代码示例。如果您正苦于以下问题:PHP Package::getAvailablePackages方法的具体用法?PHP Package::getAvailablePackages怎么用?PHP Package::getAvailablePackages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Package
的用法示例。
在下文中一共展示了Package::getAvailablePackages方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
public function render()
{
$file = '<?php namespace PHPSTORM_META { $STATIC_METHOD_TYPES = array(\\Core::make(\'\') => array(' . PHP_EOL;
$legacyHelpers = array();
$bindings = Core::getBindings();
foreach ($bindings as $name => $binding) {
/** @var \Closure $binding */
$reflection = new \ReflectionFunction($binding['concrete']);
$static = $reflection->getStaticVariables();
$className = null;
if (!isset($static['concrete'])) {
try {
$class = Core::make($name);
if (is_object($class)) {
$className = get_class($class);
}
} catch (\Exception $e) {
}
} else {
$className = $static['concrete'];
}
if ($className !== null && $className !== get_class($this)) {
if ($className[0] !== '\\') {
$className = '\\' . $className;
}
$file .= '\'' . $name . '\' instanceof ' . $className . ',' . PHP_EOL;
if (substr($name, 0, 7) === 'helper/') {
$legacyHelpers[substr($name, 7)] = $className;
}
}
}
$app = Core::make('app');
$reflection = new \ReflectionClass($app);
$instances = $reflection->getProperty("instances");
$instances->setAccessible(true);
// :)
foreach ($instances->getValue($app) as $name => $instance) {
if (!isset($bindings[$name])) {
$className = get_class($instance);
$file .= '\'' . $name . '\' instanceof ' . $className . ',' . PHP_EOL;
}
}
$file .= '), \\Loader::helper(\'\') => array(';
foreach ($legacyHelpers as $legacyHelper => $className) {
$file .= '\'' . $legacyHelper . '\' instanceof ' . $className . ',' . PHP_EOL;
}
$file .= '), \\Package::getByHandle(\'\') => array(';
$packages = \Package::getAvailablePackages(false);
foreach ($packages as $package) {
/** @var \Package $package */
$file .= '\'' . $package->getPackageHandle() . '\' instanceof \\' . get_class($package) . ',' . PHP_EOL;
}
$file .= '));}';
return $file;
}
示例2: getLocalUpgradeablePackages
/**
* Returns an array of packages that have newer versions in the local packages directory
* than those which are in the Packages table. This means they're ready to be upgraded
*/
public static function getLocalUpgradeablePackages()
{
$packages = Package::getAvailablePackages(false);
$upgradeables = array();
$db = Loader::db();
foreach ($packages as $p) {
$row = $db->GetRow("select pkgID, pkgVersion from Packages where pkgHandle = ? and pkgIsInstalled = 1", array($p->getPackageHandle()));
if ($row['pkgID'] > 0) {
if (version_compare($p->getPackageVersion(), $row['pkgVersion'], '>')) {
$p->pkgCurrentVersion = $row['pkgVersion'];
$upgradeables[] = $p;
}
}
}
return $upgradeables;
}
示例3: array
}
// now we strip out any dupes for the total
$updates = 0;
$localHandles = array();
foreach($local as $_pkg) {
$updates++;
$localHandles[] = $_pkg->getPackageHandle();
}
foreach($remote as $_pkg) {
if (!in_array($_pkg->getPackageHandle(), $localHandles)) {
$updates++;
}
}
if ($tp->canInstallPackages()) {
$pkgAvailableArray = Package::getAvailablePackages();
}
$thisURL = $this->url('/dashboard/install');
$btArray = BlockTypeList::getInstalledList();
$btAvailableArray = BlockTypeList::getAvailableList();
$coreBlockTypes = array();
$webBlockTypes = array();
foreach($btArray as $_bt) {
if ($_bt->getPackageID() == 0) {
if ($_bt->isCoreBlockType()) {
$coreBlockTypes[] = $_bt;
示例4: array
$remote = Package::getRemotelyUpgradeablePackages();
}
// now we strip out any dupes for the total
$updates = 0;
$localHandles = array();
foreach ($local as $_pkg) {
$updates++;
$localHandles[] = $_pkg->getPackageHandle();
}
foreach ($remote as $_pkg) {
if (!in_array($_pkg->getPackageHandle(), $localHandles)) {
$updates++;
}
}
if ($tp->canInstallPackages()) {
foreach (Package::getAvailablePackages() as $_pkg) {
$_pkg->setupPackageLocalization();
$pkgAvailableArray[] = $_pkg;
}
if (count($pkgAvailableArray) > 0) {
Localization::clearCache();
}
}
$thisURL = $view->url('/dashboard/extend/install');
$availableArray = $pkgAvailableArray;
usort($availableArray, function ($a, $b) {
return strcasecmp($a->getPackageName(), $b->getPackageName());
});
/* Load featured add-ons from the marketplace.
*/
$db = Loader::db();