public function download() { $file = Marketplace::downloadRemoteFile($this->getRemoteFileURL()); if (empty($file) || $file == Package::E_PACKAGE_DOWNLOAD) { return array(Package::E_PACKAGE_DOWNLOAD); } else { if ($file == Package::E_PACKAGE_SAVE) { return array($file); } else { if ($file == Package::E_PACKAGE_INVALID_APP_VERSION) { return array($file); } } } try { Loader::model('package_archive'); $am = new PackageArchive($this->getHandle()); $am->install($file, true); } catch (Exception $e) { return array($e->getMessage()); } if ($install) { $tests = Package::testForInstall($this->getHandle()); if (is_array($tests)) { return $tests; } else { $p = Loader::package($this->getHandle()); try { $p->install(); } catch (Exception $e) { return array(Package::E_PACKAGE_INSTALL); } } } }