当前位置: 首页>>代码示例>>PHP>>正文


PHP eZTemplateDesignResource::designStartPath方法代码示例

本文整理汇总了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;
 }
开发者ID:patrickallaert,项目名称:ezpublish-legacy-php7,代码行数:77,代码来源:eztemplatedesignresource.php

示例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;
    }
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:61,代码来源:ezcontentobjectpackagehandler.php


注:本文中的eZTemplateDesignResource::designStartPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。