本文整理匯總了PHP中TaskPermission::canInstallPackages方法的典型用法代碼示例。如果您正苦於以下問題:PHP TaskPermission::canInstallPackages方法的具體用法?PHP TaskPermission::canInstallPackages怎麽用?PHP TaskPermission::canInstallPackages使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TaskPermission
的用法示例。
在下文中一共展示了TaskPermission::canInstallPackages方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: view
public function view()
{
$this->set('latest_version', Config::get('APP_VERSION_LATEST'));
$tp = new TaskPermission();
$updates = 0;
$local = array();
$remote = array();
if ($tp->canInstallPackages()) {
$local = Package::getLocalUpgradeablePackages();
$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++;
}
}
$this->set('updates', $updates);
}
示例2: prepare_remote_upgrade
public function prepare_remote_upgrade($remoteMPID = 0){
$tp = new TaskPermission();
if ($tp->canInstallPackages()) {
Loader::model('marketplace_remote_item');
$mri = MarketplaceRemoteItem::getByID($remoteMPID);
if (!is_object($mri)) {
$this->set('error', array(t('Invalid marketplace item ID.')));
return;
}
$local = Package::getbyHandle($mri->getHandle());
if (!is_object($local) || $local->isPackageInstalled() == false) {
$this->set('error', array(Package::E_PACKAGE_NOT_FOUND));
return;
}
$r = $mri->downloadUpdate();
if ($r != false) {
if (!is_array($r)) {
$this->set('error', array($r));
} else {
$errors = Package::mapError($r);
$this->set('error', $errors);
}
} else {
$this->redirect('/dashboard/extend/update', 'do_update', $mri->getHandle());
}
}
}
示例3: view
public function view()
{
$this->set('latest_version', \Concrete\Core\Updater\Update::getLatestAvailableVersionNumber());
$tp = new \TaskPermission();
$updates = 0;
$local = array();
$remote = array();
if ($tp->canInstallPackages()) {
$local = Package::getLocalUpgradeablePackages();
$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++;
}
}
$this->set('updates', $updates);
}
示例4: connect_complete
public function connect_complete() {
$tp = new TaskPermission();
if ($tp->canInstallPackages()) {
if (!$_POST['csToken']) {
$this->set('error', array(t('An unexpected error occurred when connecting your site to the marketplace.')));
} else {
Config::save('MARKETPLACE_SITE_TOKEN', $_POST['csToken']);
Config::save('MARKETPLACE_SITE_URL_TOKEN', $_POST['csURLToken']);
print '<script type="text/javascript">parent.window.location.href=\'' . View::url('/dashboard/install', 'view', 'community_connect_success') . '\';</script>';
exit;
}
} else {
$this->set('error', array(t('You do not have permission to connect this site to the marketplace.')));
}
}
示例5: install
public function install($btHandle = null) {
$tp = new TaskPermission();
if ($tp->canInstallPackages()) {
try {
$resp = BlockType::installBlockType($btHandle);
if ($resp != '') {
$this->error->add($resp);
} else {
$this->set('message', t('Block Type Installed.'));
}
} catch(Exception $e) {
$this->error->add($e);
$this->set('error', $this->error);
}
} else {
$this->error->add(t('You do not have permission to install custom block types or add-ons.'));
$this->set('error', $this->error);
}
$this->view();
}
示例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: if
<table cellspacing="0" cellpadding="0">
<tr>
<td class="ccm-installed-items-icon"><img src="<?=$ci->getBlockTypeIconURL($bt)?>" /></td>
<td class="ccm-addon-list-description"><h3><?=$bt->getBlockTypeName()?></a></h3><?=$bt->getBlockTypeDescription()?></td>
<td><?=$ch->button(t("Edit"), View::url('/dashboard/install', 'inspect_block_type', $bt->getBlockTypeID()), "right")?></td>
</tr>
</table>
</div>
<? } ?>
<? } ?>
</div>
</div>
<? if ($tp->canInstallPackages()) { ?>
<div class="ccm-module" style="width: 350px; margin-bottom: 20px">
<? if ($updates > 0) { ?>
<h1><span><?=t('Updates')?></span></h1>
<div class="ccm-dashboard-inner">
<? if ($updates == 1) { ?>
<?=t('There is currently <strong>1</strong> update available.')?>
<? } else { ?>
<?=t('There are currently <strong>%s</strong> updates available.', $updates)?>
<? } ?>
<? print $ch->button(t('Update Addons'), $this->url('/dashboard/install', 'update'))?>
<div class="ccm-spacer"> </div>
</div>
示例8: t
<p><?php
echo $pkg->getPackageDescription();
?>
</p>
</div>
</div>
<?php
}
} else {
?>
<p><?php
echo t('No packages have been installed.');
?>
</p><?php
}
if ($tp->canInstallPackages()) {
?>
<hr/>
<h3><?php
echo t('Awaiting Installation');
?>
</h3>
<?php
if (count($availableArray) == 0 && count($purchasedBlocks) == 0) {
if (!$mi->isConnected()) {
?>
<p><?php
echo t('Nothing currently available to install.');
?>
</p><?php
}
示例9: t
<div><a href="<?php
echo Loader::helper('navigation')->getLinkToCollection($settingsPage, false, true);
?>
"><strong><?php
echo t('System & Settings');
?>
</strong></a> - <?php
echo t('Secure and setup your site.');
?>
</div>
<?php
}
$tpa = new TaskPermission();
$extendPage = Page::getByPath('/dashboard/extend');
$extendPageP = new Permissions($extendPage);
if ($tpa->canInstallPackages() && $extendPageP->canRead()) {
?>
<div><a href="<?php
echo View::url('/dashboard/extend');
?>
"><strong><?php
echo t("Extend concrete5");
?>
</strong></a> –
<?php
if (ENABLE_MARKETPLACE_SUPPORT) {
?>
<?php
echo sprintf(t('<a href="%s">Install</a>, <a href="%s">update</a> or download more <a href="%s">themes</a> and <a href="%s">add-ons</a>.'), View::url('/dashboard/extend/install'), View::url('/dashboard/extend/update'), View::url('/dashboard/extend/themes'), View::url('/dashboard/extend/add-ons'));
?>
<?php
示例10: t
<td class="ccm-marketplace-list-install-button"><?php
echo $ch->button(t("Edit"), View::url('/dashboard/extend/install', 'inspect_package', $pkg->getPackageID()), "");
?>
</td>
</tr>
<? } ?>
</table>
<? } else { ?>
<p><?php
echo t('No packages have been installed.');
?>
</p>
<? } ?>
<? if ($tp->canInstallPackages()) { ?>
<h3><?php
echo t('Awaiting Installation');
?>
</h3>
<? if (count($availableArray) == 0 && count($purchasedBlocks) == 0) { ?>
<? if (!$mi->isConnected()) { ?>
<?php
echo t('Nothing currently available to install.');
?>
<? } ?>
<? } else { ?>
<table class="table table-bordered table-striped">
示例11: t
if ($newsPageP->canRead()) {
?>
<div><a href="<?php
echo Loader::helper('navigation')->getLinkToCollection($settingsPage, false, true);
?>
"><strong><?php
echo t('System & Settings');
?>
</strong></a> - <?php
echo t('Secure and setup your site.');
?>
</div>
<?php
}
$tpa = new TaskPermission();
if ($tpa->canInstallPackages()) {
?>
<div><a href="<?php
echo View::url('/dashboard/extend');
?>
"><strong><?php
echo t("Extend concrete5");
?>
</strong></a> –
<?php
if (ENABLE_MARKETPLACE_SUPPORT) {
?>
<?php
echo sprintf(t('<a href="%s">Install</a>, <a href="%s">update</a> or download more <a href="%s">themes</a> and <a href="%s">add-ons</a>.'), View::url('/dashboard/extend/install'), View::url('/dashboard/extend/update'), View::url('/dashboard/extend/themes'), View::url('/dashboard/extend/add-ons'));
?>
<?php
示例12: getDashboardAndSearchMenus
//.........這裏部分代碼省略.........
<?php
}
?>
<?php
if ($itemsChanged) {
$u = new User();
$u->saveConfig('QUICK_NAV_BOOKMARKS', serialize($d));
}
?>
<?php
if ($currentHeader != false) {
?>
</ul>
</div>
<?php
}
?>
</div>
</div>
<div id="ccm-dashboard-overlay-misc" class="ccm-dashboard-overlay-misc-rounded">
<div class="ccm-dashboard-overlay-inner">
<?php
// Before we throw in a UL, we check permissions, etc. to see if any of the LI items need to be shown.
$systemNews = Page::getByPath('/dashboard/news');
$systemNewsP = new Permissions($systemNews);
$canAccessNews = $systemNewsP->canRead();
$systemSettings = Page::getByPath('/dashboard/system');
$systemSettingsP = new Permissions($systemSettings);
$canAccessSystem = $systemSettingsP->canRead();
$tpa = new TaskPermission();
$canAccessExtend = $tpa->canInstallPackages();
$systemExtend = Page::getByPath('/dashboard/extend');
$systemExtendP = new Permissions($systemExtend);
$canViewExtend = $systemExtendP->canRead();
// If any need to be shown then we proceed...
if ($canAccessNews || $canAccessSystem || $canAccessExtend && $canViewExtend) {
?>
<ul>
<?php
if ($canAccessNews) {
?>
<li><a href="<?php
echo View::url('/dashboard/news');
?>
"><strong><?php
echo t('News');
?>
</strong></a> – <?php
echo t('Learn about your site and concrete5.');
?>
</li>
<?php
}
?>
<?php
if ($canAccessSystem) {
?>
<li><a href="<?php
echo View::url('/dashboard/system');
?>
示例13: download
public function download($remoteMPID = null)
{
$tp = new TaskPermission();
if ($tp->canInstallPackages()) {
Loader::model('marketplace_remote_item');
$mri = MarketplaceRemoteItem::getByID($remoteMPID);
if (!is_object($mri)) {
$this->set('error', array(t('Invalid marketplace item ID.')));
return;
}
$r = $mri->download();
if ($r != false) {
if (!is_array($r)) {
$this->set('error', array($r));
} else {
$errors = Package::mapError($r);
$this->set('error', $errors);
}
} else {
$this->set('message', t('Marketplace item %s downloaded successfully.', $mri->getName()));
}
} else {
$this->error->add(t('You do not have permission to download add-ons.'));
$this->set('error', $this->error);
}
}
示例14: die
<?php
defined('C5_EXECUTE') or die("Access Denied.");
Loader::model('collection_types');
Loader::library('marketplace');
$mi = Marketplace::getInstance();
$tp = new TaskPermission();
if ($mi->isConnected() && $tp->canInstallPackages()) {
$previewCID = intval($_REQUEST['previewCID']);
$themeCID = intval($_REQUEST['themeCID']);
$themeHandle = $_REQUEST['themeHandle'];
$postStr = '&themeHandle=' . $themeHandle . '&ctID=' . $ctID . '&ctHandle=' . $ctHandle;
if (!function_exists('curl_init')) {
?>
<div><?php
echo t('curl must be enabled to preview external themes.');
?>
</div>
<?php
} else {
$curl_handle = curl_init();
// Check to see if there are proxy settings
if (Config::get('HTTP_PROXY_HOST') != null) {
@curl_setopt($curl_handle, CURLOPT_PROXY, Config::get('HTTP_PROXY_HOST'));
@curl_setopt($curl_handle, CURLOPT_PROXYPORT, Config::get('HTTP_PROXY_PORT'));
// Check if there is a username/password to access the proxy
if (Config::get('HTTP_PROXY_USER') != null) {
@curl_setopt($curl_handle, CURLOPT_PROXYUSERPWD, Config::get('HTTP_PROXY_USER') . ':' . Config::get('HTTP_PROXY_PWD'));
}
}
curl_setopt($curl_handle, CURLOPT_URL, MARKETPLACE_THEME_PREVIEW_URL);
示例15: getMarketplaceFrame
public function getMarketplaceFrame($width = '100%', $height = '530', $completeURL = false)
{
// if $mpID is passed, we are going to either
// a. go to its purchase page
// b. pass you through to the page AFTER connecting.
$tp = new TaskPermission();
if ($tp->canInstallPackages()) {
if (!$this->isConnected()) {
$url = MARKETPLACE_URL_CONNECT;
if (!$completeURL) {
$completeURL = BASE_URL . View::url('/dashboard/settings/marketplace', 'connect_complete');
}
$csReferrer = urlencode($completeURL);
$csiURL = urlencode(BASE_URL . DIR_REL);
if ($this->hasConnectionError()) {
$csToken = $this->getSiteToken();
} else {
// new connection
$csToken = Marketplace::generateSiteToken();
}
$url = $url . '?ts=' . time() . '&csiURL=' . $csiURL . '&csToken=' . $csToken . '&csReferrer=' . $csReferrer . '&csName=' . htmlspecialchars(SITE, ENT_QUOTES, APP_CHARSET);
}
if ($csToken == false) {
return '<div class="ccm-error">' . t('Unable to generate a marketplace token. Please ensure that allow_url_fopen is turned on, or that cURL is enabled on your server. If these are both true, It\'s possible your site\'s IP address may be blacklisted for some reason on our server. Please ask your webhost what your site\'s outgoing cURL request IP address is, and email it to us at <a href="mailto:help@concrete5.org">help@concrete5.org</a>.') . '</div>';
} else {
return '<iframe id="ccm-marketplace-frame-' . time() . '" frameborder="0" width="' . $width . '" height="' . $height . '" src="' . $url . '"></iframe>';
}
} else {
return '<div class="ccm-error">' . t('You do not have permission to connect this site to the marketplace.') . '</div>';
}
}