當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。