本文整理汇总了PHP中eZSiteAccess::load方法的典型用法代码示例。如果您正苦于以下问题:PHP eZSiteAccess::load方法的具体用法?PHP eZSiteAccess::load怎么用?PHP eZSiteAccess::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZSiteAccess
的用法示例。
在下文中一共展示了eZSiteAccess::load方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: changeAccess
public static function changeAccess(array $access)
{
eZSiteAccess::load($access);
unset($GLOBALS['eZContentObjectDefaultLanguage']);
eZContentLanguage::expireCache();
eZContentObject::clearCache();
}
示例2: generateObjectViewCache
static function generateObjectViewCache($objectID)
{
// Generate the view cache
$ini = eZINI::instance();
$object = eZContentObject::fetch($objectID);
$user = eZUser::currentUser();
eZDebug::accumulatorStart('generate_cache', '', 'Generating view cache');
if ($ini->variable('ContentSettings', 'PreViewCache') == 'enabled') {
$preCacheSiteaccessArray = $ini->variable('ContentSettings', 'PreCacheSiteaccessArray');
$currentSiteAccess = $GLOBALS['eZCurrentAccess'];
// This is the default view parameters for content/view
$viewParameters = array('offset' => false, 'year' => false, 'month' => false, 'day' => false, 'namefilter' => false);
if (is_array($preCacheSiteaccessArray) && count($preCacheSiteaccessArray) > 0) {
foreach ($preCacheSiteaccessArray as $changeToSiteAccess) {
$newSiteAccess = $currentSiteAccess;
$newSiteAccess['name'] = $changeToSiteAccess;
unset($newSiteAccess['uri_part']);
//eZSiteAccess::load() will take care of setting correct one
eZSiteAccess::load($newSiteAccess);
$tpl = eZTemplate::factory();
// Get the sitedesign and cached view preferences for this siteaccess
$siteini = eZINI::instance('site.ini');
$cachedViewPreferences = $siteini->variable('ContentSettings', 'CachedViewPreferences');
$language = false;
// Needs to be specified if you want to generate the cache for a specific language
$viewMode = 'full';
$assignedNodes = $object->assignedNodes();
foreach ($assignedNodes as $node) {
// We want to generate the cache for the specified user
$previewCacheUsers = $ini->variable('ContentSettings', 'PreviewCacheUsers');
foreach ($previewCacheUsers as $previewCacheUserID) {
// If the text is 'anon' we need to fetch the Anonymous user ID.
if ($previewCacheUserID === 'anonymous') {
$previewCacheUserID = $siteini->variable("UserSettings", "AnonymousUserID");
$previewCacheUser = eZUser::fetch($previewCacheUserID);
} else {
if ($previewCacheUserID === 'current') {
$previewCacheUser = $user;
} else {
$previewCacheUser = eZUser::fetch($previewCacheUserID);
}
}
if (!$previewCacheUser) {
continue;
}
// Before we generate the view cache we must change the currently logged in user to $previewCacheUser
// If not the templates might read in wrong personalized data (preferences etc.)
eZUser::setCurrentlyLoggedInUser($previewCacheUser, $previewCacheUser->attribute('contentobject_id'), eZUser::NO_SESSION_REGENERATE);
// Cache the current node
$cacheFileArray = eZNodeviewfunctions::generateViewCacheFile($previewCacheUser, $node->attribute('node_id'), false, false, $language, $viewMode, $viewParameters, $cachedViewPreferences);
$tmpRes = eZNodeviewfunctions::generateNodeView($tpl, $node, $node->attribute('object'), $language, $viewMode, false, $cacheFileArray['cache_dir'], $cacheFileArray['cache_path'], true, $viewParameters);
// Cache the parent node
$parentNode = $node->attribute('parent');
$objectID = $parentNode->attribute('contentobject_id');
// if parent objectID is null or is 0 we should not create cache.
if ($objectID) {
$cacheFileArray = eZNodeviewfunctions::generateViewCacheFile($previewCacheUser, $parentNode->attribute('node_id'), 0, false, $language, $viewMode, $viewParameters, $cachedViewPreferences);
$tmpRes = eZNodeviewfunctions::generateNodeView($tpl, $parentNode, $parentNode->attribute('object'), $language, $viewMode, 0, $cacheFileArray['cache_dir'], $cacheFileArray['cache_path'], true, $viewParameters);
}
}
}
}
// Restore the old user as the current one
eZUser::setCurrentlyLoggedInUser($user, $user->attribute('contentobject_id'), eZUser::NO_SESSION_REGENERATE);
// restore siteaccess
eZSiteAccess::load($currentSiteAccess);
}
}
if ($ini->variable('ContentSettings', 'StaticCache') == 'enabled') {
$nodes = array();
$ini = eZINI::instance();
$useURLAlias =& $GLOBALS['eZContentObjectTreeNodeUseURLAlias'];
$pathPrefix = $ini->variable('SiteAccessSettings', 'PathPrefix');
// get staticCacheHandler instance
$optionArray = array('iniFile' => 'site.ini', 'iniSection' => 'ContentSettings', 'iniVariable' => 'StaticCacheHandler');
$options = new ezpExtensionOptions($optionArray);
$staticCacheHandler = eZExtension::getHandlerClass($options);
if (!isset($useURLAlias)) {
$useURLAlias = $ini->variable('URLTranslator', 'Translation') == 'enabled';
}
eZContentCacheManager::nodeListForObject($object, true, self::CLEAR_DEFAULT, $nodes, $handledObjectList);
// If no nodes returns it means that ClearCacheMethod = self::CLEAR_NO_CACHE
if (count($nodes)) {
foreach ($nodes as $nodeID) {
if ($useURLAlias) {
$oNode = eZContentObjectTreeNode::fetch($nodeID, false, true);
if (!isset($oNode)) {
continue;
}
$urlAlias = $oNode->urlAlias();
if ($pathPrefix != '') {
$tempAlias = substr($pathPrefix, strlen($pathPrefix) - 1) == '/' ? $urlAlias . '/' : $urlAlias;
if (strncmp($tempAlias, $pathPrefix, strlen($tempAlias)) == 0) {
$urlAlias = substr($tempAlias, strlen($pathPrefix));
}
}
} else {
$urlAlias = 'content/view/full/' . $nodeID;
}
$staticCacheHandler->cacheURL('/' . $urlAlias, $nodeID);
//.........这里部分代码省略.........
示例3: array
return;
}
if (!$siteAccess) {
$contentINI = eZINI::instance('content.ini');
if ($contentINI->hasVariable('VersionView', 'DefaultPreviewDesign')) {
$siteAccess = $contentINI->variable('VersionView', 'DefaultPreviewDesign');
} else {
$siteAccess = eZTemplateDesignResource::designSetting('site');
}
}
$access = $GLOBALS['eZCurrentAccess'];
$access['name'] = $siteAccess;
if ($access['type'] === eZSiteAccess::TYPE_URI) {
$access['uri_part'] = array($siteAccess);
}
eZSiteAccess::load($access);
eZDebug::checkDebugByUser();
// Change content object default language
$GLOBALS['eZContentObjectDefaultLanguage'] = $LanguageCode;
eZTranslatorManager::resetTranslations();
ezpI18n::reset();
eZContentObject::clearCache();
eZContentLanguage::expireCache();
$Module->setTitle('View ' . $class->attribute('name') . ' - ' . $contentObject->attribute('name'));
$ini = eZINI::instance();
$res = eZTemplateDesignResource::instance();
$res->setDesignSetting($ini->variable('DesignSettings', 'SiteDesign'), 'site');
$res->setOverrideAccess($siteAccess);
$tpl = eZTemplate::factory();
if ($http->hasSessionVariable('LastAccessesVersionURI')) {
$tpl->setVariable('redirect_uri', $http->sessionVariable('LastAccessesVersionURI'));
示例4: foreach
}
foreach ($locales as $locale)
{
$cli->output("Generating cache for locale {$locale}");
if ( !isset($locale2siteAccess[$locale]) )
{
eZDebug::writeWarning( "No siteAccess found for locale $locale", 'eZTranslator::generate_cache' );
continue;
}
foreach ( $locale2siteAccess[$locale] as $siteAccess )
{
eZTranslationCache::resetGlobals();
eZSiteAccess::load( $siteAccess );
eZINI::resetAllInstances( false );
eZExtension::reorderExtensions();
$eZSQLTranslator = new eZSQLTranslator( $locale, true, true );
$eZSQLTranslator->buildCache( $locale );
$eZSQLTranslator->saveCache();
}
}
}
$script->shutdown();
function fetchLocales(eZDBInterace $db, $time = -1)
{
$query = 'SELECT DISTINCT locale FROM ezx_translation_value';