本文整理汇总了PHP中eZURI::serverShardingURL方法的典型用法代码示例。如果您正苦于以下问题:PHP eZURI::serverShardingURL方法的具体用法?PHP eZURI::serverShardingURL怎么用?PHP eZURI::serverShardingURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZURI
的用法示例。
在下文中一共展示了eZURI::serverShardingURL方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: staticFile
/**
* @param string $path
* @param string $quote
* @param bool $skipSlash
* @return string
*/
public static function staticFile($path, $quote, $skipSlash)
{
$ini = eZINI::instance();
$imgDecHash = 0;
if ( $ini->variable( 'DesignSettings', 'DynamicImageSuffix' ) == 'enabled' )
{
$cluster = ClusterTool::clusterIdentifier();
$filePath = StaticData::clusterFilePath($cluster, $path);
if ( ! empty( $filePath ) )
{
$imgHash = sha1_file( $filePath );
$imgDecHash = hexdec( substr( $imgHash, 0, 7 ) );
}
}
$path = StaticData::externalUrl(ClusterTool::clusterIdentifier(), $path);
$path = (!$skipSlash ? '/' : '') . ltrim($path, '/');
if ( ! empty( $imgDecHash ) )
{
$path = preg_replace( '/^(.*)\.([^.]+)$/i', '$1.'.$imgDecHash.'.$2', $path );
}
if (! $skipSlash )
{
$serverURL = eZURI::serverShardingURL( $path );
$path = $serverURL.$path;
}
if ($quote == 'double')
$path = sprintf('"%s"', $path);
elseif ($quote == "single")
$path = sprintf("'%s'", $path);
return $path;
}
示例2: eZImage
static function eZImage( $tpl, $operatorValue, $operatorName, $skipSlash = false )
{
$sys = eZSys::instance();
if ( $skipSlash && strlen( $sys->wwwDir() ) != 0 )
{
$skipSlash = false;
}
$bases = eZTemplateDesignResource::allDesignBases();
$triedFiles = array();
$fileInfo = eZTemplateDesignResource::fileMatch( $bases, 'images', $operatorValue, $triedFiles );
if ( !$fileInfo )
{
$tpl->warning( $operatorName, "Image '$operatorValue' does not exist in any design" );
$tpl->warning( $operatorName, "Tried files: " . implode( ', ', $triedFiles ) );
$siteDesign = eZTemplateDesignResource::designSetting( 'site' );
$imgPath = "design/$siteDesign/images/$operatorValue";
}
else
{
$imgPath = $fileInfo['path'];
}
$ini = eZINI::instance();
if ( $ini->variable( 'DesignSettings', 'DynamicImageSuffix' ) == 'enabled' )
{
$imgHash = sha1_file( $imgPath );
$imgDecHash = hexdec( substr( $imgHash, 0, 7 ) );
$imgPath = preg_replace( '/^(.*)\.([^.]+)$/i', '$1.'.$imgDecHash.'.$2', $imgPath );
}
$operatorValue = $skipSlash ? $imgPath : $sys->wwwDir() . '/' . $imgPath;
$operatorValue = htmlspecialchars( $operatorValue );
if ( ! $skipSlash )
{
$serverURL = eZURI::serverShardingURL( $operatorValue );
$operatorValue = $serverURL.$operatorValue;
}
return $operatorValue;
}