本文整理汇总了PHP中Marketplace类的典型用法代码示例。如果您正苦于以下问题:PHP Marketplace类的具体用法?PHP Marketplace怎么用?PHP Marketplace使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Marketplace类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: marketplaces
function marketplaces()
{
$objs = new Marketplace();
$objs->get();
$data = array('marketplaces' => $objs);
$this->load->view('backend/marketplaces', $data);
}
开发者ID:pojok-webdev,项目名称:pattimura,代码行数:7,代码来源:adm.php
示例2: update
function update()
{
$params = $this->input->post();
$obj = new Marketplace();
$obj->where('id', $params['id'])->update($params);
echo $obj->check_last_query();
}
开发者ID:pojok-webdev,项目名称:pattimura,代码行数:7,代码来源:marketplaces.php
示例3: 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;
}
开发者ID:rii-J,项目名称:concrete5-de,代码行数:59,代码来源:update.php
示例4: view
public function view() {
$tp = new TaskPermission();
if ($tp->canInstallPackages()) {
$mi = Marketplace::getInstance();
if ($mi->isConnected()) {
Marketplace::checkPackageUpdates();
}
}
}
开发者ID:nveid,项目名称:concrete5,代码行数:9,代码来源:update.php
示例5: getSlotContents
public static function getSlotContents() {
if (!isset(self::$slots)) {
$fh = Loader::helper('file');
Loader::library('marketplace');
$cfToken = Marketplace::getSiteToken();
$r = $fh->getContents(NEWSFLOW_SLOT_CONTENT_URL . '?cfToken=' . $cfToken);
self::$slots = NewsflowSlotItem::parseResponse($r);
}
return self::$slots;
}
开发者ID:nbourguig,项目名称:concrete5,代码行数:10,代码来源:newsflow.php
示例6: download_update
public function download_update()
{
if (MULTI_SITE == 1) {
return false;
}
$vt = Loader::helper('validation/token');
if (!$vt->validate('download_update')) {
$this->error->add($vt->getErrorMessage());
}
if (!is_dir(DIR_APP_UPDATES)) {
$this->error->add(t('The directory %s does not exist.', DIR_APP_UPDATES));
} else {
if (!is_writable(DIR_APP_UPDATES)) {
$this->error->add(t('The directory %s must be writable by the web server.', DIR_APP_UPDATES));
}
}
if (!$this->error->has()) {
$remote = Update::getApplicationUpdateInformation();
if (is_object($remote)) {
// try to download
Loader::library("marketplace");
$r = Marketplace::downloadRemoteFile($remote->url);
if (empty($r) || $r == Package::E_PACKAGE_DOWNLOAD) {
$response = array(Package::E_PACKAGE_DOWNLOAD);
} else {
if ($r == Package::E_PACKAGE_SAVE) {
$response = array($r);
}
}
if (isset($response)) {
$errors = Package::mapError($response);
foreach ($errors as $e) {
$this->error->add($e);
}
}
if (!$this->error->has()) {
// the file exists in the right spot
Loader::library('archive');
$ar = new UpdateArchive();
try {
$ar->install($r);
} catch (Exception $e) {
$this->error->add($e->getMessage());
}
}
} else {
$this->error->add(t('Unable to retrieve software from update server.'));
}
}
$this->view();
}
开发者ID:rmxdave,项目名称:concrete5,代码行数:51,代码来源:update.php
示例7: download_update
public function download_update()
{
$p = new \Permissions();
if (!$p->canUpgrade()) {
return false;
}
$vt = Loader::helper('validation/token');
if (!$vt->validate('download_update')) {
$this->error->add($vt->getErrorMessage());
}
if (!is_dir(DIR_CORE_UPDATES)) {
$this->error->add(t('The directory %s does not exist.', DIR_CORE_UPDATES));
} else {
if (!is_writable(DIR_CORE_UPDATES)) {
$this->error->add(t('The directory %s must be writable by the web server.', DIR_CORE_UPDATES));
}
}
if (!$this->error->has()) {
$remote = \Concrete\Core\Updater\Update::getApplicationUpdateInformation();
if (is_object($remote)) {
// try to download
$r = \Marketplace::downloadRemoteFile($remote->getDirectDownloadURL());
if (empty($r) || $r == \Package::E_PACKAGE_DOWNLOAD) {
$response = array(\Package::E_PACKAGE_DOWNLOAD);
} else {
if ($r == \Package::E_PACKAGE_SAVE) {
$response = array($r);
}
}
if (isset($response)) {
$errors = \Package::mapError($response);
foreach ($errors as $e) {
$this->error->add($e);
}
}
if (!$this->error->has()) {
// the file exists in the right spot
$ar = new UpdateArchive();
try {
$ar->install($r);
} catch (Exception $e) {
$this->error->add($e->getMessage());
}
}
} else {
$this->error->add(t('Unable to retrieve software from update server.'));
}
}
$this->view();
}
开发者ID:kreativmind,项目名称:concrete5-5.7.0,代码行数:50,代码来源:update.php
示例8: checkPackageUpdates
/**
* Runs through all packages on the marketplace, sees if they're installed here, and updates the available version number for them
*/
public static function checkPackageUpdates()
{
Loader::model('system_notification');
$items = Marketplace::getAvailableMarketplaceItems(false);
foreach ($items as $i) {
$p = Package::getByHandle($i->getHandle());
if (is_object($p)) {
// we only add a notification if it's newer than the last one we know about
if (version_compare($p->getPackageVersionUpdateAvailable(), $i->getVersion(), '<') && version_compare($p->getPackageVersion(), $i->getVersion(), '<')) {
SystemNotification::add(SystemNotification::SN_TYPE_ADDON_UPDATE, t('An updated version of %s is available.', $i->getName()), t('New Version: %s.', $i->getVersion()), '', View::url('/dashboard/extend/update'), $i->getRemoteURL());
}
$p->updateAvailableVersionNumber($i->getVersion());
}
}
}
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:18,代码来源:marketplace.php
示例9: 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;
}
}
//.........这里部分代码省略.........
开发者ID:VonUniGE,项目名称:concrete5-1,代码行数:101,代码来源:controller.php
示例10: 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);
}
开发者ID:ronlobo,项目名称:concrete5-de,代码行数:33,代码来源:marketplace_remote_item.php
示例11: 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');
}
}
开发者ID:ricardomccerqueira,项目名称:rcerqueira.portfolio,代码行数:61,代码来源:themes.php
示例12: addByIDAction
public function addByIDAction()
{
$request = $this->request;
$response = $this->response;
$flash = $this->flash;
if ($request->isPost()) {
$product_id = $request->getPost('product_id', 'int');
$mplace_id = $request->getPost('mplace_id', 'int');
$lang = $request->getPost('lang', 'string');
$product = PProductMain::findFirst($product_id);
$mplace = Marketplace::findFirst($mplace_id);
// Validations
if (!$product) {
$flash->error('Ошибка: товар не найден!');
return $response->redirect('seller/addbyid');
}
if ($product->hold == 1) {
$flash->error('Ошибка: товар на холде!');
return $response->redirect('seller/addbyid');
}
if (!$mplace) {
$flash->error('Ошибка: площадка не найдена!');
return $response->redirect('seller/addbyid');
}
if (!preg_match("/{$lang}/", $mplace->prefs)) {
$flash->error('Ошибка: язык не соответствует площадке!');
return $response->redirect('seller/addbyid');
}
// Check for appropriate marketseller
$marketseller = Marketseller::findFirst("user_id={$this->auth->id} AND marketplace_id={$mplace_id} AND tmaterial_id={$product->tmaterial_id} AND langcode LIKE '%{$lang}%'");
// If there is no marketseller or if the product is already placed create a new marketseller
if (!$marketseller or MPlacement::findFirst("marketseller_id={$marketseller->id} AND product_id={$product->id}")) {
$mseller = new Marketseller();
$mseller->id = $mseller->id();
$mseller->created = time();
$mseller->updated = time();
$mseller->fio = "{$product->PCategoryGroup->title} на {$mplace->title}";
$mseller->user_id = $this->auth->id;
$mseller->marketplace_id = $mplace_id;
$mseller->tmaterial_id = $product->tmaterial_id;
$mseller->langcode = $mplace->prefs;
if (!$mseller->create()) {
$flash->error('Ошибка при создании нового виртуального магазина!');
return $response->redirect('seller/addbyid');
} else {
return $response->redirect("seller/product/{$mseller->id}/{$product_id}/{$lang}");
}
} else {
return $response->redirect("seller/product/{$marketseller->id}/{$product_id}/{$lang}");
}
}
}
开发者ID:serge2300,项目名称:madeheart,代码行数:52,代码来源:SellerController.php
示例13: function
$blueprint->makeAction(['name' => 'getDetails', 'pattern' => '{vendor}/{package}', 'routeParametersCallback' => function ($action, array $options) {
return [$options['vendor'], $options['package']];
}]);
$blueprint->makeToolbarItem(['action' => 'getDetails', 'label' => 'Show Details', 'icon' => 'info-circle']);
$blueprint->makeAction(['name' => 'postRequire', 'pattern' => '{vendor}/{package}/require/{version?}', 'method' => 'POST', 'routeParametersCallback' => function ($action, array $options) {
return [$options['vendor'], $options['package']];
}]);
$blueprint->makeToolbarItem(['action' => 'postRequire', 'label' => 'Require', 'icon' => 'plus', 'color' => 'green'])->addDynamicCallback(function ($item, $arguments) {
$installer = Marketplace::getInstaller();
$package = $arguments['vendor'] . '/' . $arguments['package'];
if ($installer->isRequired($package)) {
$item->color = 'red';
$item->icon = 'trash-o';
$item->label = 'Remove';
}
});
$blueprint->makeAction(['name' => 'getInstalled', 'pattern' => 'installed']);
$blueprint->makeToolbarItem(['action' => 'getInstalled', 'label' => 'Installed Packages', 'icon' => 'list', 'color' => 'white']);
$blueprint->makeAction(['name' => 'postToggleProvider', 'pattern' => 'provider/toggle/{class}', 'method' => 'POST', 'routeParametersCallback' => function ($action, array $options) {
return [$options['provider']];
}]);
$blueprint->makeToolbarItem(['action' => 'postToggleProvider', 'label' => 'Enable', 'icon' => 'check', 'color' => 'white', 'shouldRenderCallback' => function (ActionToolbarItem $item, array $arguments) {
return $item->shouldRenderBasic($arguments) && !Marketplace::getProviderRepository()->isCore($arguments['provider']);
}])->addDynamicCallback(function ($item, $arguments) {
$repository = Marketplace::getProviderRepository();
if ($repository->isEnabled($arguments['provider'])) {
$item->icon = 'power-off';
$item->label = 'Disable';
}
});
});
开发者ID:noikiy,项目名称:mod-marketplace,代码行数:31,代码来源:marketplace.php
示例14: DisabledToolbarItem
</div>
@endif
</div>
<div class="Cell-twoThirds Cell--last">
<h1 class="heading-alpha">{{{ $package->getPrettyName() }}}</h1>
@if($package->getPrettyName() !== $package->getName())
<h2 class="heading-gamma"><code>{{{ $package->getName() }}}</code></h2>
@endif
<div class="Header-toolbar Header-toolbar--alignLeft Header-toolbar--padding">
<?php
$item = $blueprint->getToolbarItem('postRequire');
$arguments = ['vendor' => $package->getSplitName()[0], 'package' => $package->getSplitName()[1]];
if ($item->shouldRender($arguments)) {
echo $item->render($arguments);
}
$item = new DisabledToolbarItem('Status: ' . Marketplace::getInstaller()->getStatus($package->getName()));
echo $item->render();
?>
</div>
</div>
</div>
<div class="Row Row--alignTop Row--border Row--singleLine">
<div class="Cell-oneThird">
<ul class="List--bordered">
<li><span class="Icon Icon--pushRight Icon-fw Icon-star"></span>{{{ $package->favers }}} stars</li>
<li><span class="Icon Icon--pushRight Icon-fw Icon-download"></span>{{{ $package->downloads['total'] }}} downloads</li>
<li><span class="Icon Icon--pushRight Icon-fw Icon-user"></span>Authored by {{{ $package->getAuthorsAsSentence() }}}</li>
<li><span class="Icon Icon--pushRight Icon-fw Icon-clock-o"></span>Added on {{{ $package->time->toFormattedDateString() }}}</li>
<li><span class="Icon Icon--pushRight Icon-fw Icon-info-circle"></span><code>{{{ $package->getName() }}}</code></li>
<li><span class="Icon Icon--pushRight Icon-fw Icon-code-fork"></span>Latest Version: <code>{{{ $package->getLatestVersion()['version'] }}}</code></li>
@if(isset($package->homepage) && $package->homepage !== '')
开发者ID:noikiy,项目名称:mod-marketplace,代码行数:31,代码来源:view.blade.php
示例15: array_merge
$coreBlockTypes[] = $_bt;
} else {
$webBlockTypes[] = $_bt;
}
}
}
$availableArray = array_merge($btAvailableArray, $pkgAvailableArray);
usort($availableArray, 'sortAvailableArray');
/* Load featured add-ons from the marketplace.
*/
Loader::model('collection_attributes');
$db = Loader::db();
if(ENABLE_MARKETPLACE_SUPPORT && $tp->canInstallPackages()){
$purchasedBlocksSource = Marketplace::getAvailableMarketplaceItems();
}else{
$purchasedBlocksSource = array();
}
// now we iterate through the purchased items (NOT BLOCKS, THESE CAN INCLUDE THEMES) list and removed ones already downloaded
// This really should be made into a more generic object since it's not block types anymore.
$skipHandles = array();
foreach($availableArray as $ava) {
foreach($purchasedBlocksSource as $pi) {
if ($pi->getHandle() == $ava->getPackageHandle()) {
$skipHandles[] = $ava->getPackageHandle();
}
}
}
开发者ID:notzen,项目名称:concrete5,代码行数:31,代码来源:install.php
示例16: defined
<?php
defined('C5_EXECUTE') or die("Access Denied.");
session_write_close();
// first, we check to see if the dashboard image data has been set in the cache
if (DASHBOARD_BACKGROUND_INFO != false) {
if ($_REQUEST['image'] && preg_match('/([0-9]+)\\.jpg/i', $_REQUEST['image'])) {
$imageData = Cache::get('dashboard_image_data', $_REQUEST['image']);
if (!$imageData) {
// call out to the server to grab the data
Loader::library('marketplace');
$cfToken = Marketplace::getSiteToken();
$imageData = Loader::helper('file')->getContents(DASHBOARD_BACKGROUND_INFO . '?image=' . $_REQUEST['image'] . '&cfToken=' . $cfToken);
Cache::set('dashboard_image_data', $_REQUEST['image'], $imageData);
}
}
print $imageData;
}
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:18,代码来源:get_image_data.php
示例17: 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();
}
}
}
}
开发者ID:rii-J,项目名称:concrete5-de,代码行数:26,代码来源:install.php
示例18: 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'));
开发者ID:meixelsberger,项目名称:concrete5-5.7.0,代码行数:31,代码来源:update.php
示例19: stats
/**
* Common function for gathering stats
*
* @param string $input_role - user role
* @param string $selspec - identificator for various types of seller stats (marketplaces, lang)
*/
private function stats($input_role = null, $selspec = null)
{
// If there is no role specified this is a regular type of stats (phorocoder, translators, moderators...)
$user_roles = $input_role == null ? $this->user_roles : $input_role;
$months = $this->months;
$days_ru = $this->days_ru;
$month_and_year = date('m.Y', time());
// Current month and year
// Change month and year to ones selected by user
if ($this->request->isPost() && !empty($this->request->getPost('month_and_year', 'string'))) {
$month_and_year = $this->request->getPost('month_and_year', 'string');
}
$first_day_of_month = strtotime("01.{$month_and_year}");
$first_day_of_next_month = strtotime("01.{$month_and_year} + 1 month");
$num_of_days = (int) (($first_day_of_next_month - $first_day_of_month) / 86400);
// Number of days in the month
// Array of days in the selected month in unix timestamp
for ($i = 1; $i <= $num_of_days; $i++) {
$days[] = strtotime("{$i}.{$month_and_year}");
}
$days[] = $first_day_of_next_month;
// Find stats for a month
// photocoder, copywriter/moder, translator/moder
if ($input_role == null) {
$tasks = new PTasks();
// @todo remove + 7200 !!!!!!!!!!!!!!!! set db server to correct time
$sql = "SELECT COUNT(t1.id) AS count, FROM_UNIXTIME(t1.tstart + 7200, '%Y-%m-%d') AS cdate, t1.tstart, t1.trole, t1.tlang, t1.tassignee, t1.tprodid\n FROM p_tasks AS t1\n WHERE t1.tstart BETWEEN {$first_day_of_month} AND {$first_day_of_next_month} AND (t1.tstatus = 3 OR t1.tstatus = 5)\n GROUP BY t1.trole, t1.tlang, t1.tassignee, t1.tprodid, cdate\n ORDER BY t1.tassignee DESC;";
$stats = new Resultset(null, $tasks, $tasks->getReadConnection()->query($sql));
$stats = $stats->toArray();
// seller
} elseif ($input_role == 'seller') {
$field = "user_id";
if ($selspec == 'mplace') {
$field = "marketplace_id";
}
// Marketplaces stats
if ($selspec == 'lang') {
$field = "langcode";
}
// Langs stats
$tasks = new MPlacement();
$sql = "SELECT COUNT(mp.id) AS count, FROM_UNIXTIME(mp.created + 7200, '%Y-%m-%d') AS cdate, mp.created, mp.user_id, mp.marketplace_id, mp.langcode\n FROM mplacement AS mp\n WHERE mp.created BETWEEN {$first_day_of_month} AND {$first_day_of_next_month}\n GROUP BY mp.{$field}, cdate\n ORDER BY mp.{$field}, cdate";
$stats = new Resultset(null, $tasks, $tasks->getReadConnection()->query($sql));
$stats = $stats->toArray();
}
// Find regular sellers and APIs
if ($input_role == 'seller' && $selspec == null) {
$all_sellers = Accounts::getUsersByRole('seller', false, 'name');
$this->view->regular_sellers = $regular_sellers = preg_grep('/^(?!API)/', $all_sellers);
$this->view->api_sellers = $api_sellers = preg_grep('/^API/', $all_sellers);
}
// All marketplaces
if ($input_role == 'seller' && $selspec == 'mplace') {
$all_marketplaces = array_column(Marketplace::find(['columns' => 'title, id', 'order' => 'title'])->toArray(), 'title', 'id');
}
// All langs
if ($input_role == 'seller' && $selspec == 'lang') {
$all_langs = array_column(PLangs::find(['columns' => 'alias', 'order' => 'id'])->toArray(), 'alias', 'alias');
}
$roles = [];
$assignee = [];
foreach ($stats as $stat) {
// Regular stats
if ($input_role == null) {
$roles[$stat['trole']][$stat['tlang']][$stat['tassignee']][] = $stat['tstart'];
// Seller stats
} elseif ($input_role == 'seller' && $selspec == null) {
$seller_stats[$stat['user_id']][$stat['cdate']] = (int) $stat['count'];
// Seller marketplaces stats
} elseif ($input_role == 'seller' && $selspec == 'mplace') {
$seller_stats[$stat['marketplace_id']][$stat['cdate']] = (int) $stat['count'];
// Seller langs stats
} elseif ($input_role == 'seller' && $selspec == 'lang') {
$seller_stats[$stat['langcode']][$stat['cdate']] = (int) $stat['count'];
}
// Link user_id to his name if it's not already linked
// Regular stats
if ($input_role == null) {
if (empty($assignee[$stat['tassignee']])) {
if ($acc_name = Accounts::findFirst($stat['tassignee'])) {
$assignee[$stat['tassignee']] = $acc_name->name;
}
}
// Seller stats
} elseif ($input_role == 'seller' && $selspec == null) {
if (empty($assignee[$stat['user_id']])) {
foreach ($all_sellers as $seller_id => $seller_name) {
if ($stat['user_id'] == $seller_id) {
$assignee[$stat['user_id']] = $seller_name;
}
}
}
// Seller marketplaces stats
} elseif ($input_role == 'seller' && $selspec == 'mplace') {
//.........这里部分代码省略.........
开发者ID:serge2300,项目名称:madeheart,代码行数:101,代码来源:StatController.php
示例20: instance
public static function instance()
{
if (is_null(self::$_instance)) {
self::$_instance = new self();
}
return self::$_instance;
}
开发者ID:pcuervo,项目名称:mobbily-wordpress,代码行数:7,代码来源:marketplace.php
注:本文中的Marketplace类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论