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; }
/** * 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; }
} // 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;
$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();