本文整理汇总了PHP中eZTemplateDesignResource::designStartPath方法的典型用法代码示例。如果您正苦于以下问题:PHP eZTemplateDesignResource::designStartPath方法的具体用法?PHP eZTemplateDesignResource::designStartPath怎么用?PHP eZTemplateDesignResource::designStartPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZTemplateDesignResource
的用法示例。
在下文中一共展示了eZTemplateDesignResource::designStartPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: overrideArray
/**
* Get an array of all the current templates and overrides for them.
* The current siteaccess is used if none is specified.
*
* @static
* @return array
*/
static function overrideArray($siteAccess = false)
{
if ($siteAccess === false and self::$overrideArrayCache !== null) {
return self::$overrideArrayCache;
}
$bases = eZTemplateDesignResource::allDesignBases($siteAccess);
// fetch the override array from a specific siteacces
if ($siteAccess) {
$overrideINI = eZSiteAccess::getIni($siteAccess, 'override.ini');
} else {
$overrideINI = eZINI::instance('override.ini');
}
$designStartPath = eZTemplateDesignResource::designStartPath();
// Generate match cache for all templates
// Build arrays of available files, start with standard design and end with most prefered design
$matchFileArray = array();
$reverseBases = array_reverse($bases);
foreach ($reverseBases as $base) {
$templateResource = $base . '/templates';
$sourceFileArray = eZDir::recursiveFindRelative($templateResource, "", "tpl");
foreach ($sourceFileArray as $source) {
$matchFileArray[$source]['base_dir'] = $templateResource;
$matchFileArray[$source]['template'] = $source;
}
}
// Load override templates
$overrideSettingGroups = $overrideINI->groups();
if (isset($GLOBALS['eZDesignOverrides'])) {
$overrideSettingGroups = array_merge($overrideSettingGroups, $GLOBALS['eZDesignOverrides']);
}
foreach ($overrideSettingGroups as $overrideName => $overrideSetting) {
if (!isset($overrideSetting['Source'])) {
continue;
}
$overrideSource = "/" . $overrideSetting['Source'];
$overrideMatchFile = $overrideSetting['MatchFile'];
// Find the matching file in the available resources
$triedFiles = array();
$fileInfo = eZTemplateDesignResource::fileMatch($bases, 'override/templates', $overrideMatchFile, $triedFiles);
$resourceInUse = is_array($fileInfo) ? $fileInfo['resource'] : false;
$overrideMatchFilePath = is_array($fileInfo) ? $fileInfo['path'] : false;
// if the override template is not found
// then we probably shouldn't use it
// there should be added a check around the following code
// if ( $overrideMatchFilePath )
// {
$customMatchArray = array();
$customMatchArray['conditions'] = isset($overrideSetting['Match']) ? $overrideSetting['Match'] : null;
$customMatchArray['match_file'] = $overrideMatchFilePath;
$customMatchArray['override_name'] = $overrideName;
$matchFileArray[$overrideSource]['custom_match'][] = $customMatchArray;
// }
// if overriding a non-existing template
// then we use the override template as main template
// this code should probably be removed
// because we should not allow an override if the main template is missing
if ($resourceInUse && !isset($matchFileArray[$overrideSource]['base_dir'])) {
$matchFileArray[$overrideSource]['base_dir'] = $resourceInUse;
$matchFileArray[$overrideSource]['template'] = $overrideSource;
}
if (!$overrideMatchFilePath) {
eZDebug::writeError("Custom match file: path '{$overrideMatchFile}' not found in any resource. Check the template settings in settings/override.ini", __METHOD__);
eZDebug::writeError(implode(', ', $triedFiles), __METHOD__ . ' tried files');
}
}
if ($siteAccess === false) {
self::$overrideArrayCache = $matchFileArray;
}
return $matchFileArray;
}
示例2: installTemplates
function installTemplates( $templateList, $package, $subdirectory, &$installParameters )
{
if ( !$templateList )
{
return true;
}
$siteAccessDesignPathArray = array();
$templateRootPath = $package->path() . '/' . $subdirectory;
foreach( $templateList->getElementsByTagName( 'file' ) as $fileNode )
{
$originalSiteAccess = $fileNode->getAttribute( 'site-access' );
if ( isset( $installParameters['site_access_map'][$originalSiteAccess] ) )
{
$newSiteAccess = $installParameters['site_access_map'][$originalSiteAccess];
}
else
{
$newSiteAccess = $installParameters['site_access_map']['*'];
}
if ( !isset( $siteAccessDesignPathArray[$newSiteAccess] ) )
{
$ini = eZINI::instance( 'site.ini', 'settings', null, null, true );
$ini->prependOverrideDir( "siteaccess/$newSiteAccess", false, 'siteaccess' );
$ini->loadCache();
if ( isset( $installParameters['design_map'] ) )
{
$designMap = $installParameters['design_map'];
if ( isset( $designMap[$originalSiteAccess] ) )
$siteAccessDesignPathArray[$newSiteAccess] = eZTemplateDesignResource::designStartPath() . '/' . $designMap[$originalSiteAccess];
else
$siteAccessDesignPathArray[$newSiteAccess] = eZTemplateDesignResource::designStartPath() . '/' . $designMap['*'];
}
else
{
$siteAccessDesignPathArray[$newSiteAccess] = eZTemplateDesignResource::designStartPath() . '/' . $ini->variable( "DesignSettings", "StandardDesign" );
}
}
$path = '';
foreach( $fileNode->childNodes as $pathNode )
{
if ( $pathNode->nodeName == 'path' )
{
$path = $pathNode->nodeValue;
break;
}
}
$sourcePath = $templateRootPath . $path;
$destinationPath = $siteAccessDesignPathArray[$newSiteAccess] . $path;
eZDir::mkdir( eZDir::dirpath( $destinationPath ), false, true );
if ( !eZFileHandler::copy( $sourcePath, $destinationPath ) )
return false;
// eZDebug::writeNotice( 'Copied: "' . $sourcePath . '" to: "' . $destinationPath . '"', __METHOD__ );
}
return true;
}