本文整理汇总了PHP中Marketplace::generateSiteToken方法的典型用法代码示例。如果您正苦于以下问题:PHP Marketplace::generateSiteToken方法的具体用法?PHP Marketplace::generateSiteToken怎么用?PHP Marketplace::generateSiteToken使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Marketplace
的用法示例。
在下文中一共展示了Marketplace::generateSiteToken方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMarketplaceFrame
public function getMarketplaceFrame($width = '100%', $height = '300', $completeURL = false, $connectMethod = 'view')
{
// 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()) {
if (!$completeURL) {
$completeURL = BASE_URL . View::url('/dashboard/extend/connect', 'connect_complete');
}
$csReferrer = urlencode($completeURL);
$csiURL = urlencode(BASE_URL . DIR_REL);
$csiBaseURL = urlencode(BASE_URL);
if ($this->hasConnectionError()) {
if ($this->connectionError == E_DELETED_SITE_TOKEN) {
$connectMethod = 'view';
$csToken = Marketplace::generateSiteToken();
} else {
$csToken = $this->getSiteToken();
}
} else {
// new connection
$csToken = Marketplace::generateSiteToken();
}
$url = MARKETPLACE_URL_CONNECT . '/-/' . $connectMethod;
$url = $url . '?ts=' . time() . '&csiBaseURL=' . $csiBaseURL . '&csiURL=' . $csiURL . '&csToken=' . $csToken . '&csReferrer=' . $csReferrer . '&csName=' . htmlspecialchars(SITE, ENT_QUOTES, APP_CHARSET);
} else {
$csiBaseURL = urlencode(BASE_URL);
$url = MARKETPLACE_URL_CONNECT_SUCCESS . '?csToken=' . $this->getSiteToken() . '&csiBaseURL=' . $csiBaseURL;
}
if ($csToken == false && !$this->isConnected()) {
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 {
$time = time();
$ifr = '<script type="text/javascript">$(function() { $.receiveMessage(function(e) {
jQuery.fn.dialog.hideLoader();
if (e.data == "loading") {
jQuery.fn.dialog.showLoader();
} else {
var eh = e.data;
eh = parseInt(eh) + 20;
$("#ccm-marketplace-frame-' . $time . '").attr("height", eh);
}
}, \'' . CONCRETE5_ORG_URL . '\');
});
</script>';
$ifr .= '<iframe class="ccm-marketplace-frame-connect" id="ccm-marketplace-frame-' . $time . '" frameborder="0" width="' . $width . '" height="' . $height . '" src="' . $url . '"></iframe>';
return $ifr;
}
} else {
return '<div class="ccm-error">' . t('You do not have permission to connect this site to the marketplace.') . '</div>';
}
}
示例2: 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>';
}
}