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


PHP eZSiteAccess类代码示例

本文整理汇总了PHP中eZSiteAccess的典型用法代码示例。如果您正苦于以下问题:PHP eZSiteAccess类的具体用法?PHP eZSiteAccess怎么用?PHP eZSiteAccess使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了eZSiteAccess类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: modify

 function modify($tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters)
 {
     switch ($operatorName) {
         case 'ngurl':
             if (empty($namedParameters['siteaccess'])) {
                 return;
             }
             $ini = eZSiteAccess::getIni($namedParameters['siteaccess'], 'site.ini');
             $destinationLocale = $ini->variable('RegionalSettings', 'ContentObjectLocale');
             $siteLanguageList = $ini->variable('RegionalSettings', 'SiteLanguageList');
             $nodeID = eZURLAliasML::fetchNodeIDByPath($operatorValue);
             $destinationElement = eZURLAliasML::fetchByAction('eznode', $nodeID, $destinationLocale, false);
             if (empty($destinationElement) || !isset($destinationElement[0]) && !$destinationElement[0] instanceof eZURLAliasML) {
                 if ($this->isModuleUrl($operatorValue) || $this->isCurrentLocaleAvailable($siteLanguageList)) {
                     $destinationUrl = $operatorValue;
                 } else {
                     $destinationUrl = '';
                 }
             } else {
                 $destinationUrl = $destinationElement[0]->getPath($destinationLocale, $siteLanguageList);
             }
             $siteaccessUrlMapping = eZINI::instance('nglanguageswitcher.ini')->variable('LanguageSwitcher', 'SiteAccessUrlMapping');
             $destinationUrl = eZURI::encodeURL($destinationUrl);
             $operatorValue = rtrim($siteaccessUrlMapping[$namedParameters['siteaccess']], '/') . '/' . ltrim($destinationUrl, '/');
             break;
     }
 }
开发者ID:netgen,项目名称:nglanguageswitcher,代码行数:27,代码来源:nglanguageswitchertemplatefunctions.php

示例2: changeAccess

 public static function changeAccess(array $access)
 {
     eZSiteAccess::load($access);
     unset($GLOBALS['eZContentObjectDefaultLanguage']);
     eZContentLanguage::expireCache();
     eZContentObject::clearCache();
 }
开发者ID:rantoniazzi,项目名称:xrowmetadata,代码行数:7,代码来源:xrowsitemaptools.php

示例3: getSiteAccessIni

 /**
  * Get instance siteaccess specific site.ini
  *
  * @param string $sa
  * @return void
  */
 protected function getSiteAccessIni()
 {
     if ($this->destinationSiteAccessIni === null) {
         $this->destinationSiteAccessIni = eZSiteAccess::getIni($this->destinationSiteAccess, 'site.ini');
     }
     return $this->destinationSiteAccessIni;
 }
开发者ID:runelangseid,项目名称:ezpublish,代码行数:13,代码来源:ezplanguageswitcher.php

示例4: eZCheckValidity

/**
 * Checks if the installation is valid and returns a module redirect if required.
 * If CheckValidity in SiteAccessSettings is false then no check is done.
 *
 * @deprecated As of 4.4, moved to index.php for now
 * @param array $siteBasics
 * @param eZURI $uri
 */
function eZCheckValidity( array &$siteBasics, eZURI $uri )
{
    eZDebug::writeStrict( 'Function eZCheckValidity() has been deprecated in 4.4', 'Deprecation' );
    $ini = eZINI::instance();
    $checkValidity = ( $ini->variable( "SiteAccessSettings", "CheckValidity" ) == "true" );
    $check = null;
    if ( $checkValidity )
    {
        $check = array( "module" => "setup",
                        'function' => 'init' );
        // Turn off some features that won't bee needed yet
//        $siteBasics['policy-check-required'] = false;
        $siteBasics['policy-check-omit-list'][] = 'setup';
        $siteBasics['url-translator-allowed'] = false;
        $siteBasics['show-page-layout'] = $ini->variable( 'SetupSettings', 'PageLayout' );
        $siteBasics['validity-check-required'] = true;
        $siteBasics['user-object-required'] = false;
        $siteBasics['session-required'] = false;
        $siteBasics['db-required'] = false;
        $siteBasics['no-cache-adviced'] = false;
        $siteBasics['site-design-override'] = $ini->variable( 'SetupSettings', 'OverrideSiteDesign' );
        $access = array( 'name' => 'setup',
                         'type' => eZSiteAccess::TYPE_URI );
        $access = eZSiteAccess::change( $access );

        eZTranslatorManager::enableDynamicTranslations();
    }
    return $check;
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:37,代码来源:pre_check.php

示例5: execute

 /**
  * Executes multivatriate test secnarios
  *
  * @param int $nodeID
  * @return int
  */
 public function execute($nodeID)
 {
     $currentSiteAccess = eZSiteAccess::current();
     $testScenario = ezpMultivariateTestScenario::fetchEnabledByNodeID($nodeID);
     if ($testScenario instanceof ezpMultivariateTestScenario && in_array($currentSiteAccess['name'], eZINI::instance('content.ini')->variable('TestingSettings', 'EnabledForSiteAccessList'))) {
         $node = $testScenario->getRandomNode();
         if ($node instanceof eZContentObjectTreeNode) {
             $nodeID = $node->attribute('node_id');
         }
     }
     return $nodeID;
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:18,代码来源:ezpmultivariatetesthandler.php

示例6: __construct

 public function __construct(array $settings = array())
 {
     $this->settings = $settings + array('use-cache-headers' => true, 'max-age' => 86400, 'siteaccess' => null, 'use-exceptions' => false);
     unset($settings);
     require_once __DIR__ . '/treemenu_functions.php';
     $this->setUseExceptions($this->settings['use-exceptions']);
     header('X-Powered-By: ' . eZPublishSDK::EDITION . ' (index_treemenu)');
     if ($this->settings['use-cache-headers'] === true) {
         define('MAX_AGE', $this->settings['max-age']);
         if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
             header($_SERVER['SERVER_PROTOCOL'] . ' 304 Not Modified');
             header('Expires: ' . gmdate('D, d M Y H:i:s', time() + MAX_AGE) . ' GMT');
             header('Cache-Control: max-age=' . MAX_AGE);
             header('Last-Modified: ' . gmdate('D, d M Y H:i:s', strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])) . ' GMT');
             header('Pragma: ');
             exit;
         }
     }
     // Tweaks ini filetime checks if not defined!
     // This makes ini system not check modified time so
     // that index_treemenu.php can assume that index.php does
     // this regular enough, set in config.php to override.
     if (!defined('EZP_INI_FILEMTIME_CHECK')) {
         define('EZP_INI_FILEMTIME_CHECK', false);
     }
     eZExecution::addFatalErrorHandler(function () {
         header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error');
     });
     eZDebug::setHandleType(eZDebug::HANDLE_FROM_PHP);
     // Trick to get eZSys working with a script other than index.php (while index.php still used in generated URLs):
     $_SERVER['SCRIPT_FILENAME'] = str_replace('/index_treemenu.php', '/index.php', $_SERVER['SCRIPT_FILENAME']);
     $_SERVER['PHP_SELF'] = str_replace('/index_treemenu.php', '/index.php', $_SERVER['PHP_SELF']);
     $ini = eZINI::instance();
     $timezone = $ini->variable('TimeZoneSettings', 'TimeZone');
     if ($timezone) {
         putenv("TZ={$timezone}");
     }
     // init uri code
     $GLOBALS['eZGlobalRequestURI'] = eZSys::serverVariable('REQUEST_URI');
     eZSys::init('index.php', $ini->variable('SiteAccessSettings', 'ForceVirtualHost') === 'true');
     $this->uri = eZURI::instance(eZSys::requestURI());
     $GLOBALS['eZRequestedURI'] = $this->uri;
     // Check for extension
     eZExtension::activateExtensions('default');
     // load siteaccess
     // Use injected siteaccess if available or match it internally.
     $this->access = isset($this->settings['siteaccess']) ? $this->settings['siteaccess'] : eZSiteAccess::match($this->uri, eZSys::hostname(), eZSys::serverPort(), eZSys::indexFile());
     eZSiteAccess::change($this->access);
     // Check for new extension loaded by siteaccess
     eZExtension::activateExtensions('access');
 }
开发者ID:nfrp,项目名称:ezpublish,代码行数:51,代码来源:ezpkerneltreemenu.php

示例7: testMatchHostUri

 /**
  * Test for eZContentObject::versions(), fetching all of them
  * @dataProvider providerForTestMatchHostUri
  */
 public function testMatchHostUri( $uri, $name, $type, $uriPart )
 {
     $this->assertEquals(
         array(
             "name" => $name,
             "type" => $type,
             "uri_part" => $uriPart,
         ),
         eZSiteAccess::match(
             new eZURI( $uri ),
             "www.example.com"
         )
     );
 }
开发者ID:nottavi,项目名称:ezpublish,代码行数:18,代码来源:ezsiteaccessmatchhosturi_test.php

示例8: redirect

 /**
  * Handles redirection to the mobile optimized interface
  *
  */
 public function redirect()
 {
     $http = eZHTTPTool::instance();
     $currentSiteAccess = eZSiteAccess::current();
     if ($http->hasGetVariable('notmobile')) {
         setcookie('eZMobileDeviceDetect', 1, time() + (int) eZINI::instance()->variable('SiteAccessSettings', 'MobileDeviceDetectCookieTimeout'), '/');
         $http->redirect(eZSys::indexDir());
         eZExecution::cleanExit();
     }
     if (!isset($_COOKIE['eZMobileDeviceDetect']) && !in_array($currentSiteAccess['name'], eZINI::instance()->variable('SiteAccessSettings', 'MobileSiteAccessList'))) {
         $http->redirect(eZINI::instance()->variable('SiteAccessSettings', 'MobileSiteAccessURL'));
         eZExecution::cleanExit();
     }
 }
开发者ID:netbliss,项目名称:ezpublish,代码行数:18,代码来源:ezpmobiledeviceregexpfilter.php

示例9: getSettings

 public function getSettings()
 {
     // Copied from settings/view
     $rootDir = 'settings';
     $iniFiles = eZDir::recursiveFindRelative($rootDir, '', '.ini');
     // find all .ini files in active extensions
     // Note: is this the same algorithm used by ezini? mmm...
     foreach (eZINI::globalOverrideDirs() as $iniDataSet) {
         $iniPath = $iniDataSet[1] ? $iniDataSet[0] : 'settings/' . $iniDataSet[0];
         $iniFiles = array_merge($iniFiles, eZDir::recursiveFindRelative($iniPath, '', '.ini'));
         $iniFiles = array_merge($iniFiles, eZDir::recursiveFindRelative($iniPath, '', '.ini.append.php'));
     }
     // extract all .ini files without path
     $iniFiles = preg_replace('%.*/%', '', $iniFiles);
     // remove *.ini[.append.php] from file name
     $iniFiles = preg_replace('%\\.ini.*%', '.ini', $iniFiles);
     $iniFiles = array_unique($iniFiles);
     sort($iniFiles);
     $siteIni = null;
     foreach ($iniFiles as $key => $ini) {
         if ($this->currentSiteAccess != '' && $GLOBALS['eZCurrentAccess']['name'] !== $this->currentSiteAccess) {
             // create a site ini instance using $useLocalOverrides
             if ($siteIni === null) {
                 $siteIni = eZSiteAccess::getIni($this->currentSiteAccess, 'site.ini');
             }
             // load settings file with $useLocalOverrides = true
             $iniFile = new eZINI($ini, 'settings', null, false, true, false, false, false);
             $iniFile->setOverrideDirs($siteIni->overrideDirs(false));
             $iniFile->load();
         } else {
             $iniFile = new eZINI($ini);
         }
         $iniFiles[$ini] = $iniFile->groups();
         unset($iniFiles[$key]);
     }
     return $iniFiles;
 }
开发者ID:gggeek,项目名称:ggsysinfo,代码行数:37,代码来源:ezinireport.php

示例10: process

    /**
     * Parses command line arguments and kicks off the processing if required
     * arguments are passed.
     */
    public function process()
    {
        try
        {
            $this->input->process();
        }
        catch ( ezcConsoleOptionException $e )
        {
            if ( $this->helpOption->value === true )
            {
                $this->cliHelp();
                return;
            }

            echo $e->getMessage() . "\n";
            return;
        }

        if ( $this->helpOption->value === true )
        {
            $this->cliHelp();
            return;
        }

        if ( $this->siteAccessOption->value )
        {
            $access = array( 'name' => $this->siteAccessOption->value,
                             'type' => eZSiteAccess::TYPE_STATIC );
            eZSiteAccess::change( $access );
        }

        $this->_process(
            $this->dryRunOption->value,
            $this->subtreeNodeOption->value,
            $this->actionOption->value
        );
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:41,代码来源:mmcleanupscriptcontroller.php

示例11: array_intersect

    // The file settings/override/site.ini.append.php is updated like this:
    // - take the existing list of extensions from site.ini.append.php (to preserve their order)
    // - remove from the list the extensions that the user unchecked in the admin interface
    // - add to the list the extensions checked by the user in the admin interface, but to the end of the list
    $intersection = array_intersect( $selectedExtensions, $selectedExtensionArray );
    $difference = array_diff( $selectedExtensionArray, $selectedExtensions );
    $toSave = array_merge( $intersection, $difference );
    $toSave = array_unique( $toSave );

    // open settings/override/site.ini.append[.php] for writing
    $writeSiteINI = eZINI::instance( 'site.ini.append', 'settings/override', null, null, false, true );
    $writeSiteINI->setVariable( "ExtensionSettings", "ActiveExtensions", $toSave );
    $writeSiteINI->save( 'site.ini.append', '.php', false, false );
    eZCache::clearByTag( 'ini' );

    eZSiteAccess::reInitialise();

    $ini = eZINI::instance( 'module.ini' );
    $currentModules = $ini->variable( 'ModuleSettings', 'ModuleList' );
    if ( $currentModules != $oldModules )
    {
        // ensure that evaluated policy wildcards in the user info cache
        // will be up to date with the currently activated modules
        eZCache::clearByID( 'user_info_cache' );
    }

    updateAutoload( $tpl );
}

// open site.ini for reading (need to do it again to take into account the changes made to site.ini after clicking "Apply changes" button above
$siteINI = eZINI::instance();
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:31,代码来源:extensions.php

示例12: setupTranslationSAList

 /**
  * Creates an array of corresponding language switcher links and logical names.
  *
  * This mapping is set up in site.ini.[RegionalSettings].TranslationSA.
  * The purpose of this method is to assist creation of language switcher
  * links into the available translation siteaccesses on the system.
  *
  * This is used by the language_switcher template operator.
  *
  * @param string $url
  * @return void
  */
 public static function setupTranslationSAList($url = null)
 {
     $ini = eZINI::instance();
     if (!$ini->hasVariable('RegionalSettings', 'TranslationSA')) {
         return array();
     }
     $ret = array();
     $translationSiteAccesses = $ini->variable('RegionalSettings', 'TranslationSA');
     foreach ($translationSiteAccesses as $siteAccessName => $translationName) {
         $switchLanguageLink = "/switchlanguage/to/{$siteAccessName}/";
         if ($url !== null && (is_string($url) || is_numeric($url))) {
             $switchLanguageLink .= $url;
         }
         $ret[$siteAccessName] = array('url' => $switchLanguageLink, 'text' => $translationName, 'locale' => eZSiteAccess::getIni($siteAccessName)->variable('RegionalSettings', 'ContentObjectLocale'));
     }
     return $ret;
 }
开发者ID:netbliss,项目名称:ezpublish,代码行数:29,代码来源:ezplanguageswitcher.php

示例13: __construct

 /**
  * @param array $settings
  * @param null $responseWriterClass Name of the ezpRestHttpResponseWriter implementation to use during request
  */
 public function __construct(array $settings = array(), $responseWriterClass = null)
 {
     $this->responseWriterClass = $responseWriterClass;
     if (isset($settings['injected-settings'])) {
         $injectedSettings = array();
         foreach ($settings['injected-settings'] as $keySetting => $injectedSetting) {
             list($file, $section, $setting) = explode('/', $keySetting);
             $injectedSettings[$file][$section][$setting] = $injectedSetting;
         }
         // Those settings override anything else in local .ini files and their overrides
         eZINI::injectSettings($injectedSettings);
     }
     if (isset($settings['injected-merge-settings'])) {
         $injectedSettings = array();
         foreach ($settings['injected-merge-settings'] as $keySetting => $injectedSetting) {
             list($file, $section, $setting) = explode('/', $keySetting);
             $injectedSettings[$file][$section][$setting] = $injectedSetting;
         }
         // Those settings override anything else in local .ini files and their overrides
         eZINI::injectMergeSettings($injectedSettings);
     }
     $this->settings = $settings + array('use-cache-headers' => true, 'max-age' => 86400, 'siteaccess' => null, 'use-exceptions' => false);
     unset($settings, $injectedSettings, $file, $section, $setting, $keySetting, $injectedSetting);
     // lazy loaded database driver
     include __DIR__ . '/lazy.php';
     $this->setUseExceptions($this->settings['use-exceptions']);
     // Tweaks ini filetime checks if not defined!
     // This makes ini system not check modified time so
     // that index_treemenu.php can assume that index.php does
     // this regular enough, set in config.php to override.
     if (!defined('EZP_INI_FILEMTIME_CHECK')) {
         define('EZP_INI_FILEMTIME_CHECK', false);
     }
     eZExecution::addFatalErrorHandler(function () {
         if (!headers_sent()) {
             header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error');
         }
     });
     eZDebug::setHandleType(eZDebug::HANDLE_FROM_PHP);
     // Trick to get eZSys working with a script other than index.php (while index.php still used in generated URLs):
     $_SERVER['SCRIPT_FILENAME'] = str_replace('/index_rest.php', '/index.php', $_SERVER['SCRIPT_FILENAME']);
     $_SERVER['PHP_SELF'] = str_replace('/index_rest.php', '/index.php', $_SERVER['PHP_SELF']);
     $ini = eZINI::instance();
     $timezone = $ini->variable('TimeZoneSettings', 'TimeZone');
     if ($timezone) {
         putenv("TZ={$timezone}");
     }
     eZDebug::setHandleType(eZDebug::HANDLE_NONE);
     $GLOBALS['eZGlobalRequestURI'] = eZSys::serverVariable('REQUEST_URI');
     $ini = eZINI::instance();
     eZSys::init('index_rest.php', $ini->variable('SiteAccessSettings', 'ForceVirtualHost') == 'true');
     $uri = eZURI::instance(eZSys::requestURI());
     $GLOBALS['eZRequestedURI'] = $uri;
     // load extensions
     eZExtension::activateExtensions('default');
     require_once __DIR__ . '/restkernel_functions.php';
     // set siteaccess from X-Siteaccess header if given and exists
     if (isset($_SERVER['HTTP_X_SITEACCESS']) && eZSiteAccess::exists($_SERVER['HTTP_X_SITEACCESS'])) {
         $access = array('name' => $_SERVER['HTTP_X_SITEACCESS'], 'type' => eZSiteAccess::TYPE_STATIC);
     } else {
         $access = eZSiteAccess::match($uri, eZSys::hostname(), eZSys::serverPort(), eZSys::indexFile());
     }
     eZSiteAccess::change($access);
     // load siteaccess extensions
     eZExtension::activateExtensions('access');
     // Now that all extensions are activated and siteaccess has been changed, reset
     // all eZINI instances as they may not take into account siteaccess specific settings.
     eZINI::resetAllInstances(false);
     if (ezpRestDebug::isDebugEnabled()) {
         $debug = ezpRestDebug::getInstance();
         $debug->updateDebugSettings();
     }
 }
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:77,代码来源:ezpkernelrest.php

示例14: time

$contentObject = $node->attribute('object');
$nodeResult = eZNodeviewfunctions::generateNodeViewData($tpl, $node, $contentObject, $languageCode, 'full', 0);
// Generate a unique cache key for use in cache-blocks in pagelayout.tpl.
// This should be looked as a temporary fix as ideally all cache-blocks
// should be disabled by this view.
$cacheKey = "timeline-" + time();
$nodeResult["title_path"] = array(array("text" => "Timeline Preview"), array("text" => $node->attribute('name')));
$httpCharset = eZTextCodec::httpCharset();
$locale = eZLocale::instance();
$languageCode = $locale->httpLocaleCode();
$nodeResult['content_info']['persistent_variable']['extra_template_list'] = array('timeline.tpl');
$nodeResult['content_info']['persistent_variable']['pagestyle_css_classes'] = array('yui-skin-sam', 'yui-skin-ezflow');
$site = array('title' => $ini->variable('SiteSettings', 'SiteName'), 'design' => $ini->variable('DesignSettings', 'SiteDesign'), 'uri' => eZURI::instance(eZSys::requestURI()), 'http_equiv' => array('Content-Type' => 'text/html; charset=' . $httpCharset, 'Content-language' => $languageCode));
$currentUser = eZUser::currentUser();
$tpl->setVariable("current_user", $currentUser);
$tpl->setVariable('ui_context', "");
$uri = eZURI::instance(eZSys::requestURI());
$GLOBALS['eZRequestedURI'] = $uri;
$access = eZSiteAccess::match($uri, eZSys::hostname(), eZSys::serverPort(), eZSys::indexFile());
$tpl->setVariable('access_type', $access);
$tpl->setVariable('uri_string', $uri->uriString());
$tpl->setVariable("site", $site);
$tpl->setVariable("extra_cache_key", $cacheKey);
$tpl->setVariable("module_result", $nodeResult);
$tpl->setVariable("node", $node);
$tpl->setVariable("display_timeline_sider", true);
$pagelayoutResult = $tpl->fetch('design:pagelayout.tpl');
eZDisplayResult($pagelayoutResult);
// Stop execution at this point, if we do not we'll have the
// pagelayout.tpl inside another pagelayout.tpl.
eZExecution::cleanExit();
开发者ID:heliopsis,项目名称:ezflow,代码行数:31,代码来源:timeline.php

示例15: setCurrentSite

 /**
  * Sets the current site.
  *
  * From eZ Publish.
  *
  * @param string $site Eg. 'plain_site_user'
  * @todo remove or move in another class?
  */
 public function setCurrentSite($site)
 {
     eZWebDAVContentBackend::appendLogEntry(__FUNCTION__ . '1:' . $site);
     $access = array('name' => $site, 'type' => eZSiteAccess::TYPE_STATIC);
     $access = eZSiteAccess::change($access);
     eZWebDAVContentBackend::appendLogEntry(__FUNCTION__ . '2:' . $site);
     eZDebugSetting::writeDebug('kernel-siteaccess', $access, 'current siteaccess');
     // Clear/flush global database instance.
     $nullVar = null;
     eZDB::setInstance($nullVar);
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:19,代码来源:ezwebdavcontentbackend.php


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