本文整理汇总了PHP中eZSys::serverURL方法的典型用法代码示例。如果您正苦于以下问题:PHP eZSys::serverURL方法的具体用法?PHP eZSys::serverURL怎么用?PHP eZSys::serverURL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZSys
的用法示例。
在下文中一共展示了eZSys::serverURL方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getObject
/**
* Performs PDF content generation and caching
*
* @param $url String URL
* @param $denisty Integer
* @param $keys Mixed Keys for Cache key(s) - either as a string or an array of strings
* @param $subtree_expiry Mixed The parameter $subtreeExpiryParameter is expiry value is usually taken
* from the template operator and can be one of:
* - A numerical value which represents the node ID (the fastest approach)
* - A string containing 'content/view/full/xxx' where xx is the node ID number,
* the number will be extracted.
* - A string containing a nice url which will be decoded into a node ID using
* the database (slowest approach).
* @param $expiry Integer The number of seconds that the pdf cache should be allowed to live.A value of
* zero will produce a cache block that will never expire
* @param $ignore_content_expiry Boolean Disables cache expiry when new content is published.
* @return void
*/
public function getObject($url = '', $density, $keys, $subtree_expiry, $expiry, $ignore_content_expiry = false)
{
$pngUrl = '';
$obj = false;
$mtime = eZDateTime::currentTimeStamp();
$httpExpiry = $this->cacheTTL;
if (strpos("://", $url) === false) {
$url = eZSys::serverURL() . $url;
}
//eZDebug::writeError($url, 'sPdf2png::exportPng');
if ($this->cacheEnabled) {
$use_global_expiry = !$ignore_content_expiry;
//$keys = self::getCacheKeysArray($keys);
$expiry = is_numeric($expiry) ? $expiry : $this->cacheTTL;
list($handler, $pngUrl) = eZTemplateCacheBlock::retrieve($keys, $subtree_expiry, $expiry, $use_global_expiry);
if ($pngUrl instanceof eZClusterFileFailure || !file_get_contents($pngUrl)) {
eZDebug::writeError("cache invalid", 'sPdf2png::exportPng');
$obj = $this->generatePng($url, $density, $keys);
$handler->storeCache(array('scope' => 'template-block', 'binarydata' => $obj['url']));
}
//eZDebug::writeError("cache", 'sPdf2png::exportPng');
} else {
$obj = $this->generatePng($url, $density, $keys);
}
if (!$obj) {
$obj = $this->getPngData($pngUrl);
}
$obj['url'] = self::getWwwDir() . $obj['url'];
return $obj;
}
示例2: getDataMember
/**
* Returns part of the data for the attribute
*
* @param string $dataMember
*
* @return string
*/
public function getDataMember($dataMember)
{
if ($dataMember === 'related_images') {
$images = array();
$relations = $this->ContentObjectAttribute->attribute('content');
foreach ($relations['relation_list'] as $relation) {
$object = eZContentObject::fetch($relation['contentobject_id']);
if ($object instanceof eZContentObject) {
$dataMap = $object->attribute('data_map');
foreach ($dataMap as $attribute) {
/** @var eZContentObjectAttribute $attribute */
if ($attribute->attribute('data_type_string') !== eZImageType::DATA_TYPE_STRING) {
continue;
}
if ($attribute->hasContent()) {
$imageAliasHandler = $attribute->attribute('content');
$imageAlias = $imageAliasHandler->imageAlias('opengraph');
if ($imageAlias['is_valid'] == 1) {
$images[] = eZSys::serverURL() . '/' . $imageAlias['full_path'];
}
}
}
}
}
if (empty($images)) {
$images[] = eZSys::serverURL() . eZURLOperator::eZImage(null, 'opengraph_default_image.png', '');
}
return $images;
}
return $this->getData();
}
示例3: getData
/**
* Returns data for the attribute
*
* @return string
*/
public function getData()
{
if ($this->ContentObjectAttribute->hasContent()) {
$imageAliasHandler = $this->ContentObjectAttribute->attribute('content');
$imageAlias = $imageAliasHandler->imageAlias('opengraph');
if ($imageAlias['is_valid'] == 1) {
return eZSys::serverURL() . '/' . $imageAlias['full_path'];
}
}
return eZSys::serverURL() . eZURLOperator::eZImage(null, 'opengraph_default_image.png', '');
}
示例4: createRedirectionUrl
function createRedirectionUrl($process)
{
//__DEBUG__
$this->logger->writeTimedString("createRedirectionUrl");
//___end____
$paypalINI = eZINI::instance('paypal.ini');
$paypalServer = $paypalINI->variable('ServerSettings', 'ServerName');
$requestURI = $paypalINI->variable('ServerSettings', 'RequestURI');
$business = urlencode($paypalINI->variable('PaypalSettings', 'Business'));
$processParams = $process->attribute('parameter_list');
$orderID = $processParams['order_id'];
$indexDir = eZSys::indexDir();
$localHost = eZSys::serverURL();
$localURI = eZSys::serverVariable('REQUEST_URI');
$order = eZOrder::fetch($orderID);
$amount = urlencode($order->attribute('total_inc_vat'));
$currency = urlencode($order->currencyCode());
// include_once( 'lib/ezlocale/classes/ezlocale.php' );
$locale = eZLocale::instance();
$countryCode = urlencode($locale->countryCode());
$maxDescLen = $paypalINI->variable('PaypalSettings', 'MaxDescriptionLength');
$itemName = urlencode($this->createShortDescription($order, $maxDescLen));
$accountInfo = $order->attribute('account_information');
$first_name = urlencode($accountInfo['first_name']);
$last_name = urlencode($accountInfo['last_name']);
$street = urlencode($accountInfo['street2']);
$zip = urlencode($accountInfo['zip']);
$state = urlencode($accountInfo['state']);
$place = urlencode($accountInfo['place']);
$image_url = "{$localHost}" . urlencode($paypalINI->variable('PaypalSettings', 'LogoURI'));
$background = urlencode($paypalINI->variable('PaypalSettings', 'BackgroundColor'));
$pageStyle = urlencode($paypalINI->variable('PaypalSettings', 'PageStyle'));
$noNote = urlencode($paypalINI->variable('PaypalSettings', 'NoNote'));
$noteLabel = $noNote == 1 ? '' : urlencode($paypalINI->variable('PaypalSettings', 'NoteLabel'));
$noShipping = 1;
$url = $paypalServer . $requestURI . "?cmd=_ext-enter" . "&redirect_cmd=_xclick" . "&business={$business}" . "&item_name={$itemName}" . "&custom={$orderID}" . "&amount={$amount}" . "¤cy_code={$currency}" . "&first_name={$first_name}" . "&last_name={$last_name}" . "&address1={$street}" . "&zip={$zip}" . "&state={$state}" . "&city={$place}" . "&image_url={$image_url}" . "&cs={$background}" . "&page_style={$pageStyle}" . "&no_shipping={$noShipping}" . "&cn={$noteLabel}" . "&no_note={$noNote}" . "&lc={$countryCode}" . "¬ify_url={$localHost}" . $indexDir . "/paypal/notify_url/" . "&return={$localHost}" . $indexDir . "/shop/checkout/" . "&cancel_return={$localHost}" . $indexDir . "/shop/basket/";
//__DEBUG__
$this->logger->writeTimedString("business = {$business}");
$this->logger->writeTimedString("item_name = {$itemName}");
$this->logger->writeTimedString("custom = {$orderID}");
$this->logger->writeTimedString("no_shipping = {$noShipping}");
$this->logger->writeTimedString("localHost = {$localHost}");
$this->logger->writeTimedString("amount = {$amount}");
$this->logger->writeTimedString("currency_code = {$currency}");
$this->logger->writeTimedString("notify_url = {$localHost}" . $indexDir . "/paypal/notify_url/");
$this->logger->writeTimedString("return = {$localHost}" . $indexDir . "/shop/checkout/");
$this->logger->writeTimedString("cancel_return = {$localHost}" . $indexDir . "/shop/basket/");
//___end____
return $url;
}
示例5: header
<?php
/* @type $Params string[] */
$nodeID = $Params['nodeID'];
$node = eZContentObjectTreeNode::fetch($nodeID);
header('Pragma: no-cache');
header('cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
//TODO add context to login
if(MMUsers::isAnonymous(MMUsers::getCurrentUserId()))
{
$host = eZSys::serverURL();
$siteIni = eZINI::instance( 'site.ini' );
$loginUrl = preg_replace('#^https?//[^/]+#', '', $siteIni->variable('SiteSettings', 'LoginPage'));
$context = $host . '/esibuild/download/' . $nodeID;
header( 'Location: ' . $loginUrl . '?context='.urlencode($context) );
eZExecution::cleanExit();
}
//test if application allow download
if(!SecurityTool::getFileApplicationCanRead($node))
{
header('HTTP/1.1 403 Forbidden');
echo "<h1>Forbidden access</h1>\n";
eZExecution::cleanExit();
}
if($node)
{
示例6: redirect
/**
* Handles redirection to the mobile optimized interface
*
*/
public function redirect()
{
$http = eZHTTPTool::instance();
$currentSiteAccess = eZSiteAccess::current();
if ($http->hasGetVariable('notmobile')) {
setcookie('eZMobileDeviceDetect', 1, time() + (int) eZINI::instance()->variable('SiteAccessSettings', 'MobileDeviceDetectCookieTimeout'), '/');
$http->redirect(eZSys::indexDir());
eZExecution::cleanExit();
}
if (!isset($_COOKIE['eZMobileDeviceDetect']) && !in_array($currentSiteAccess['name'], eZINI::instance()->variable('SiteAccessSettings', 'MobileSiteAccessList'))) {
$currentUrl = eZSys::serverURL() . eZSys::requestURI();
$redirectUrl = eZINI::instance()->variable('SiteAccessSettings', 'MobileSiteAccessURL');
// Do not redirect if already on the redirect url
if (strpos($currentUrl, $redirectUrl) !== 0) {
// Default siteaccess name needs to be removed from the uri when redirecting
$uri = explode('/', ltrim(eZSys::requestURI(), '/'));
if (array_shift($uri) == $currentSiteAccess['name']) {
$http->redirect($redirectUrl . '/' . implode('/', $uri));
} else {
$http->redirect($redirectUrl . eZSys::requestURI());
}
}
eZExecution::cleanExit();
}
}
示例7: fixURL
/**
* Make image and css urls relative to ezpublish root directory
*
* @param $html String
* @param $absolute Boolean Generate absolute urls
* @return String html with fixed urls
*/
private function fixURL($html, $relative = false)
{
$base_url = $relative ? '../..' : eZSys::serverURL();
$htmlfixed = preg_replace('#(<\\s*(img|link)\\s+[^>]*(href|src)\\s*=\\s*["\'])/?([^:"\'>]*)(["\'])#i', '$1' . $base_url . '/$4$5', $html);
#$htmlfixed = preg_replace('#(@import)?\s*(url)?\s*(\()?\s*["\']/?([^"\'\);]*)["\']?\s*(\))?\s*;#i','$1 $2 $3"'.$base_url.'/$4"$5',$htmlfixed);
return $htmlfixed;
}
示例8: domain
/**
* @return string
*/
public function domain()
{
$serverUrl = eZSys::serverURL();
// we were redirected by varnish on the mobile version - we need to trick a little
if( isset( $_SERVER['HTTP_X_REQ_HOST'] ) )
{
$serverUrl = 'http://'.$_SERVER['HTTP_X_REQ_HOST'];
}
return $serverUrl;
}