本文整理汇总了PHP中Marketplace::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Marketplace::getInstance方法的具体用法?PHP Marketplace::getInstance怎么用?PHP Marketplace::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Marketplace
的用法示例。
在下文中一共展示了Marketplace::getInstance方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLatestAvailableVersionNumber
public function getLatestAvailableVersionNumber() {
if (defined('MULTI_SITE') && MULTI_SITE == 1) {
$updates = Update::getLocalAvailableUpdates();
$multiSiteVersion = 0;
foreach($updates as $up) {
if (version_compare($up->getUpdateVersion(), $multiSiteVersion, '>')) {
$multiSiteVersion = $up->getUpdateVersion();
}
}
Config::save('APP_VERSION_LATEST', $multiSiteVersion);
return $multiSiteVersion;
}
$d = Loader::helper('date');
// first, we check session
$queryWS = false;
Cache::disableCache();
$vNum = Config::get('APP_VERSION_LATEST', true);
Cache::enableCache();
if (is_object($vNum)) {
$seconds = strtotime($vNum->timestamp);
$version = $vNum->value;
if (is_object($version)) {
$versionNum = $version->version;
} else {
$versionNum = $version;
}
$diff = time() - $seconds;
if ($diff > APP_VERSION_LATEST_THRESHOLD) {
// we grab a new value from the service
$queryWS = true;
}
} else {
$queryWS = true;
}
if ($queryWS) {
Loader::library('marketplace');
$mi = Marketplace::getInstance();
if ($mi->isConnected()) {
Marketplace::checkPackageUpdates();
}
$update = Update::getLatestAvailableUpdate();
$versionNum = $update->version;
if ($versionNum) {
Config::save('APP_VERSION_LATEST', $versionNum);
if (version_compare($versionNum, APP_VERSION, '>')) {
Loader::model('system_notification');
SystemNotification::add(SystemNotification::SN_TYPE_CORE_UPDATE, t('A new version of concrete5 is now available.'), '', $update->notes, View::url('/dashboard/system/update'));
}
} else {
// we don't know so we're going to assume we're it
Config::save('APP_VERSION_LATEST', APP_VERSION);
}
}
return $versionNum;
}
示例2: view
public function view() {
$tp = new TaskPermission();
if ($tp->canInstallPackages()) {
$mi = Marketplace::getInstance();
if ($mi->isConnected()) {
Marketplace::checkPackageUpdates();
}
}
}
示例3: defined
<?php
defined('C5_EXECUTE') or die("Access Denied.");
$valt = Loader::helper('validation/token');
$ci = Loader::helper('concrete/urls');
$ch = Loader::helper('concrete/ui');
$tp = new TaskPermission();
if ($tp->canInstallPackages()) {
$mi = Marketplace::getInstance();
}
$pkgRemote = array();
$pkgLocal = array();
if (Config::get('concrete.marketplace.enabled') && is_object($mi)) {
if ($mi->isConnected()) {
$pkgArray = Package::getInstalledList();
foreach ($pkgArray as $pkg) {
if ($pkg->isPackageInstalled() && version_compare($pkg->getPackageVersion(), $pkg->getPackageVersionUpdateAvailable(), '<')) {
$pkgRemote[] = $pkg;
}
}
}
}
$pkgAvailableArray = Package::getLocalUpgradeablePackages();
foreach ($pkgAvailableArray as $pkg) {
if (!in_array($pkg, $pkgRemote)) {
$pkgLocal[] = $pkg;
}
}
?>
<?php
echo Loader::helper('concrete/dashboard')->getDashboardPaneHeaderWrapper(t('Update Add-Ons'));
示例4: view
public function view($updated = false, $aux = false)
{
$u = new User();
$this->set('site_tracking_code', Config::get('SITE_TRACKING_CODE'));
$this->set('url_rewriting', URL_REWRITING);
$this->set('marketplace_enabled_in_config', Config::get('ENABLE_MARKETPLACE_SUPPORT'));
$this->set('site', SITE);
$this->set('ui_breadcrumb', $u->config('UI_BREADCRUMB'));
$this->set('ui_filemanager', $u->config('UI_FILEMANAGER'));
$this->set('ui_sitemap', $u->config('UI_SITEMAP'));
$this->set('api_key_picnik', Config::get('API_KEY_PICNIK'));
$txtEditorMode = Config::get('CONTENTS_TXT_EDITOR_MODE');
$this->set('txtEditorMode', $txtEditorMode);
$this->set('rewriteRules', $this->getRewriteRules());
$textEditorWidth = Config::get('CONTENTS_TXT_EDITOR_WIDTH');
$this->set('textEditorWidth', $textEditorWidth);
$textEditorHeight = Config::get('CONTENTS_TXT_EDITOR_HEIGHT');
$this->set('textEditorHeight', $textEditorHeight);
$txtEditorCstmCode = Config::get('CONTENTS_TXT_EDITOR_CUSTOM_CODE');
if (!strlen($txtEditorCstmCode) || $txtEditorMode != 'CUSTOM') {
$txtEditorCstmCode = $this->get_txt_editor_default();
}
$this->set('txtEditorCstmCode', $txtEditorCstmCode);
Loader::library('marketplace');
$mi = Marketplace::getInstance();
if ($mi->isConnected()) {
$this->set('marketplacePageURL', Marketplace::getSitePageURL());
}
if ($updated) {
switch ($updated) {
case 'statistics_saved':
$this->set('message', t('Statistics tracking preference saved.'));
break;
case "tracking_code_saved":
$this->set('message', t('Your tracking code has been saved.'));
break;
/*
//moved to set_permissions
case "maintenance_enabled";
$this->set('message', t('Maintenance Mode turned on. Your site is now private.'));
break;
case "maintenance_disabled":
$this->set('message', t('Maintenance Mode turned off. Your site is public.'));
break;
*/
/*
//moved to set_permissions
case "maintenance_enabled";
$this->set('message', t('Maintenance Mode turned on. Your site is now private.'));
break;
case "maintenance_disabled":
$this->set('message', t('Maintenance Mode turned off. Your site is public.'));
break;
*/
case "marketplace_turned_on":
$this->set('message', t('Marketplace support is now enabled.'));
break;
case "marketplace_turned_off":
$this->set('message', t('Marketplace support is now disabled.'));
break;
case "favicon_saved":
$this->set('message', t('Bookmark icon saved.'));
break;
case "favicon_removed":
$this->set('message', t('Bookmark icon removed.'));
break;
case "editing_preferences_saved":
$this->set('message', t('Editing preferences saved.'));
break;
case "sitename_saved":
$this->set('message', t("Your site's name has been saved."));
break;
case "image_editing_saved":
$this->set('message', t("Image editing options have been saved."));
break;
case "debug_saved":
$this->set('message', t('Debug configuration saved.'));
break;
case "cache_cleared":
$this->set('message', t('Cached files removed.'));
break;
case "cache_updated":
$this->set('message', t('Cache settings saved.'));
break;
case "txt_editor_config_saved":
$this->set('message', t('Content text editor settings saved.'));
break;
case "rewriting_saved":
if (URL_REWRITING) {
if ($aux == 0) {
$this->set('message', t('URL rewriting enabled. Make sure you copy the lines below these URL Rewriting settings area and place them in your .htaccess or web server configuration file.'));
} else {
$this->set('message', t('URL rewriting enabled. .htaccess file updated.'));
}
} else {
$this->set('message', t('URL rewriting disabled.'));
}
break;
}
}
//.........这里部分代码省略.........
示例5: execute
public function execute()
{
$params = $this->params;
$params['version'] = APP_VERSION;
$params['itemsPerPage'] = $this->itemsPerPage;
Loader::library("marketplace");
$mi = Marketplace::getInstance();
$params['csToken'] = $mi->getSiteToken();
if ($this->includeInstalledItems) {
$params['includeInstalledItems'] = 1;
} else {
$params['includeInstalledItems'] = 0;
$list = Package::getInstalledList();
foreach ($list as $pkg) {
$params['installedPackages'][] = $pkg->getPackageHandle();
}
}
if (isset($_REQUEST[$this->queryStringPagingVariable])) {
$params[$this->queryStringPagingVariable] = $_REQUEST[$this->queryStringPagingVariable];
}
$uh = Loader::helper('url');
$url = $uh->buildQuery(MARKETPLACE_REMOTE_ITEM_LIST_WS . $this->type . '/-/get_remote_list', $params);
$r = Loader::helper('file')->getContents($url);
$r2 = @Loader::helper('json')->decode($r);
$total = 0;
$items = array();
if (is_object($r2)) {
$items = $r2->items;
$total = $r2->total;
}
$this->total = $total;
$this->setItems($items);
}
示例6: view
public function view()
{
$tp = new TaskPermission();
$mi = Marketplace::getInstance();
if ($mi->isConnected() && $tp->canInstallPackages()) {
Loader::model('marketplace_remote_item');
$mri = new MarketplaceRemoteItemList();
$mri->setItemsPerPage(9);
$sets = MarketplaceRemoteItemList::getItemSets('themes');
$setsel = array('' => t('All Items'), 'FEATURED' => t('Featured Items'));
if (is_array($sets)) {
foreach ($sets as $s) {
$setsel[$s->getMarketplaceRemoteSetID()] = $s->getMarketplaceRemoteSetName();
}
}
$sortBy = array('' => t('Recommended'), 'popular' => t('Popular'), 'recent' => t('Recently Added'), 'rating' => t('Highest Rated'), 'price_low' => t('Price: Low to High'), 'price_high' => t('Price: High to Low'));
$mri->setIncludeInstalledItems(false);
if (isset($_REQUEST['marketplaceRemoteItemSetID'])) {
$set = $_REQUEST['marketplaceRemoteItemSetID'];
}
if (isset($_REQUEST['mpID'])) {
$mri->filterByMarketplaceItemID($_REQUEST['mpID']);
}
if (isset($_REQUEST['marketplaceRemoteItemSortBy'])) {
$this->set('selectedSort', Loader::helper('text')->entities($_REQUEST['marketplaceRemoteItemSortBy']));
$mri->sortBy($_REQUEST['marketplaceRemoteItemSortBy']);
} else {
$mri->sortBy('recommended');
}
if (isset($_REQUEST['marketplaceIncludeOnlyCompatibleAddons']) && $_REQUEST['marketplaceIncludeOnlyCompatibleAddons'] == 1) {
$mri->filterByCompatibility(1);
}
if (isset($_REQUEST['marketplaceRemoteItemKeywords']) && $_REQUEST['marketplaceRemoteItemKeywords']) {
$keywords = $_REQUEST['marketplaceRemoteItemKeywords'];
$sortBy = array('relevance' => t('Relevance')) + $sortBy;
}
if ($keywords != '') {
$mri->filterByKeywords($keywords);
}
if ($set == 'FEATURED') {
$mri->filterByIsFeaturedRemotely(1);
} else {
if ($set > 0) {
$mri->filterBySet($set);
}
}
$mri->setType('themes');
$mri->execute();
$items = $mri->getPage();
$this->set('sortBy', $sortBy);
$this->set('selectedSet', $set);
$this->set('list', $mri);
$this->set('items', $items);
$this->set('form', Loader::helper('form'));
$this->set('sets', $setsel);
$this->set('pagination', $mri->getPagination());
$this->set('type', $what);
} else {
$this->redirect('/dashboard/extend/connect');
}
}
示例7: update
public function update($pkgHandle = false) {
$tp = new TaskPermission();
if ($tp->canInstallPackages()) {
if ($pkgHandle) {
$tests = Package::testForInstall($pkgHandle, false);
if (is_array($tests)) {
$tests = Package::mapError($tests);
$this->set('error', $tests);
} else {
$p = Package::getByHandle($pkgHandle);
try {
$p->upgradeCoreData();
$p->upgrade();
$this->set('message', t('The package has been updated successfully.'));
} catch(Exception $e) {
$this->set('error', $e);
}
}
} else {
$mi = Marketplace::getInstance();
if ($mi->isConnected()) {
Marketplace::checkPackageUpdates();
}
}
}
}