本文整理汇总了PHP中eZURI::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP eZURI::instance方法的具体用法?PHP eZURI::instance怎么用?PHP eZURI::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZURI
的用法示例。
在下文中一共展示了eZURI::instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testUserParameters
/**
* Test scenario for issue #13186: UserParameters works differently in 4.0 compared to 3.10
*
* @result $eZURI->userParameters() returns an empty array
* @expected $eZURI->userParameters() should return array( "ole" => "a", "dull" => "boy" ).
*
* @link http://issues.ez.no/13186
*/
public function testUserParameters()
{
$expectedParams = array("ole" => "a", "dull" => "boy");
$eZURI = eZURI::instance();
$userParams = $eZURI->userParameters();
$this->assertEquals($expectedParams, $userParams);
}
示例2: __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');
}
示例3: ucfirst
$tpl->setVariable('content_type_name', ucfirst(rtrim($contentType, 's')));
$tpl->setVariable('compatibility_mode', $ezoeIni->variable('EditorSettings', 'CompatibilityMode'));
$tpl->setVariable('tag_name', $tagName);
$xmlTagAliasList = $ezoeIni->variable('EditorSettings', 'XmlTagNameAlias');
if (isset($xmlTagAliasList[$tagName])) {
$tpl->setVariable('tag_name_alias', $xmlTagAliasList[$tagName]);
} else {
$tpl->setVariable('tag_name_alias', $tagName);
}
$tpl->setVariable('view_list', json_encode(array('embed' => $viewList, 'embed-inline' => $viewListInline)));
$tpl->setVariable('class_list', json_encode(array('embed' => $classList, 'embed-inline' => $classListInline)));
$tpl->setVariable('attribute_defaults', json_encode(array('embed' => $attributeDefaults, 'embed-inline' => $attributeDefaultsInline)));
$tpl->setVariable('custom_attributes', $customAttributes);
$tpl->setVariable('size_list', $sizeTypeArray);
$defaultSize = $contentIni->variable('ImageSettings', 'DefaultEmbedAlias');
$tpl->setVariable('default_size', $defaultSize);
if ($contentIni->hasVariable('ImageSettings', 'DefaultCropAlias')) {
$tpl->setVariable('default_crop_size', $contentIni->variable('ImageSettings', 'DefaultCropAlias'));
} else {
$tpl->setVariable('default_crop_size', $defaultSize);
}
$tpl->setVariable('custom_attribute_style_map', json_encode($ezoeIni->variable('EditorSettings', 'CustomAttributeStyleMap')));
$tpl->setVariable('persistent_variable', array());
$tpl->setVariable('original_uri_string', eZURI::instance()->originalURIString());
$Result = array();
$Result['content'] = $tpl->fetch('design:ezoe/tag_embed_' . $contentType . '.tpl');
$Result['pagelayout'] = 'design:ezoe/popup_pagelayout.tpl';
$Result['persistent_variable'] = $tpl->variable('persistent_variable');
return $Result;
//eZExecution::cleanExit();
//$GLOBALS['show_page_layout'] = false;
示例4: __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();
}
}
示例5: testQueryString
/**
* Test scenario for issue #18449 : Can't print search results in MSIE
* Main problem is to be able to get the query string out of eZURI
* @link http://issues.ez.no/18449
* @group issue18449
* @group ezuri_regression
*/
public function testQueryString()
{
self::assertEquals($this->queryString, eZURI::instance()->attribute("query_string"));
}
示例6: requestInit
protected function requestInit()
{
if ($this->isInitialized) {
return;
}
eZExecution::setCleanExit(false);
$scriptStartTime = microtime(true);
$GLOBALS['eZRedirection'] = false;
$this->access = eZSiteAccess::current();
eZDebug::setScriptStart($scriptStartTime);
eZDebug::addTimingPoint("Script start");
$this->uri = eZURI::instance(eZSys::requestURI());
$GLOBALS['eZRequestedURI'] = $this->uri;
// Be able to do general events early in process
ezpEvent::getInstance()->notify('request/preinput', array($this->uri));
// Initialize module loading
$this->siteBasics['module-repositories'] = eZModule::activeModuleRepositories();
eZModule::setGlobalPathList($this->siteBasics['module-repositories']);
// make sure we get a new $ini instance now that it has been reset
$ini = eZINI::instance();
// start: eZCheckValidity
// pre check, setup wizard related so needs to be before session/db init
// TODO: Move validity check in the constructor? Setup is not meant to be launched at each (sub)request is it?
if ($ini->variable('SiteAccessSettings', 'CheckValidity') === 'true') {
$this->check = array('module' => 'setup', 'function' => 'init');
// Turn off some features that won't bee needed yet
$this->siteBasics['policy-check-omit-list'][] = 'setup';
$this->siteBasics['show-page-layout'] = $ini->variable('SetupSettings', 'PageLayout');
$this->siteBasics['validity-check-required'] = true;
$this->siteBasics['session-required'] = $this->siteBasics['user-object-required'] = false;
$this->siteBasics['db-required'] = $this->siteBasics['no-cache-adviced'] = $this->siteBasics['url-translator-allowed'] = false;
$this->siteBasics['site-design-override'] = $ini->variable('SetupSettings', 'OverrideSiteDesign');
$this->access = eZSiteAccess::change(array('name' => 'setup', 'type' => eZSiteAccess::TYPE_URI));
eZTranslatorManager::enableDynamicTranslations();
}
// stop: eZCheckValidity
if ($this->siteBasics['session-required']) {
// Check if this should be run in a cronjob
if ($ini->variable('Session', 'BasketCleanup') !== 'cronjob') {
eZSession::addCallback('destroy_pre', function (eZDBInterface $db, $key, $escapedKey) {
$basket = eZBasket::fetch($key);
if ($basket instanceof eZBasket) {
$basket->remove();
}
});
eZSession::addCallback('gc_pre', function (eZDBInterface $db, $time) {
eZBasket::cleanupExpired($time);
});
eZSession::addCallback('cleanup_pre', function (eZDBInterface $db) {
eZBasket::cleanup();
});
}
// addCallBack to update session id for shop basket on session regenerate
eZSession::addCallback('regenerate_post', function (eZDBInterface $db, $escNewKey, $escOldKey) {
$db->query("UPDATE ezbasket SET session_id='{$escNewKey}' WHERE session_id='{$escOldKey}'");
});
// TODO: Session starting should be made only once in the constructor
$this->sessionInit();
}
// if $this->siteBasics['db-required'], open a db connection and check that db is connected
if ($this->siteBasics['db-required'] && !eZDB::instance()->isConnected()) {
$this->warningList[] = array('error' => array('type' => 'kernel', 'number' => eZError::KERNEL_NO_DB_CONNECTION), 'text' => 'No database connection could be made, the system might not behave properly.');
}
// eZCheckUser: pre check, RequireUserLogin & FORCE_LOGIN related so needs to be after session init
if (!isset($this->check)) {
$this->check = eZUserLoginHandler::preCheck($this->siteBasics, $this->uri);
}
ezpEvent::getInstance()->notify('request/input', array($this->uri));
// Initialize with locale settings
// TODO: Move to constructor? Is it relevant to init the locale/charset for each (sub)requests?
$this->languageCode = eZLocale::instance()->httpLocaleCode();
$phpLocale = trim($ini->variable('RegionalSettings', 'SystemLocale'));
if ($phpLocale != '') {
setlocale(LC_ALL, explode(',', $phpLocale));
}
$this->httpCharset = eZTextCodec::httpCharset();
// TODO: are these parameters supposed to vary across potential sub-requests?
$this->site = array('title' => $ini->variable('SiteSettings', 'SiteName'), 'design' => $ini->variable('DesignSettings', 'SiteDesign'), 'http_equiv' => array('Content-Type' => 'text/html; charset=' . $this->httpCharset, 'Content-language' => $this->languageCode));
// Read role settings
$this->siteBasics['policy-check-omit-list'] = array_merge($this->siteBasics['policy-check-omit-list'], $ini->variable('RoleSettings', 'PolicyOmitList'));
$this->isInitialized = true;
}
示例7: testDoubleTranslation
/**
* Tests an identified error until eZ Publish 4.2:
* a cascaded translation (uri => translation1 => translation2) will fail
* with a fatal error if the two matching wildcards are located in different
* cache files
*
* Test outline:
* 1. Create a wildcard of DIRECT type that translates A to B
* 2. Create more than 100 dummy wildcards
* 3. Create a wildcard of DIRECT type that translates B to C
*
* Expected: the test fails at #3 with a fatal error "Cannot redeclare ezurlwilcardcachedtranslate"
*/
public function testDoubleTranslation()
{
self::createWildcard("testDoubleTranslation1/*", 'testDoubleTranslation2/{1}', eZURLWildcard::TYPE_DIRECT);
// create more than 100 wildcards
for ($i = 0; $i <= 100; $i++) {
self::createWildcard("testDoubleTranslationDummy{$i}/*", '/', eZURLWildcard::TYPE_DIRECT);
}
self::createWildcard("testDoubleTranslation2/*", 'testDoubleTranslation3/{1}', eZURLWildcard::TYPE_DIRECT);
$uri = eZURI::instance('testDoubleTranslation1/foobar');
// will fail
$this->assertFalse(eZURLWildcard::translate($uri));
}
示例8: htmlBuildFullResult
/**
* @return bool
*/
public function htmlBuildFullResult()
{
/* @type $dataMap eZContentObjectAttribute[] */
/* @type $publisherNode eZContentObjectTreeNode */
$article_parameters = $this->_params['UserParameters'];
$dataMap = $this->node->dataMap();
$taxonomies = $dataMap["serialized_taxonomies"]->content();
$publisherPath = $taxonomies["publisher_folder"][0];
$publisherFolder = $this->applicationLocalized()->getPublisherFolderFromPath( $publisherPath );
$this->initChannelInformations();
$this->pushChannelResult();
if(isset($article_parameters['language']))
{
$this->node->setCurrentLanguage($article_parameters['language']);
}
$this->pushResult('article_parameters', $article_parameters);
$this->pushResult('node' , $this->node);
$this->pushResult('features' , $this->resultHandler->features);
$this->pushResult('publisher' , $publisherFolder);
// get all languages avalaible for the node
/* @type $dataMap eZContentObjectAttribute[] */
$languages = array();
$dataMap = $this->node->dataMap();
$serial = $dataMap['serialized_taxonomies']->content();
if( isset($serial['language']) && $publisherFolder instanceof PublisherFolder )
{
$publisherLanguages = $publisherFolder->getLanguages();
$languageList = $serial['language'];
$languageTranslations = FacetFilteringTool::getTaxonomyTranslation('language');
// get locales and iso of languages node
$availableLanguages = array();
foreach( array_keys($this->node->object()->allLanguages()) as $locale )
{
if ( is_array($publisherLanguages) && in_array($locale, $publisherLanguages) )
{
$key = LocaleTool::languageISO639Code($locale);
$availableLanguages[$key] = $locale;
}
}
// compare iso with the ez tag for get the name
foreach($languageList as $languageItem)
{
if(isset($availableLanguages[$languageItem]))
{
$languages[] = array(
'locale' => $availableLanguages[$languageItem],
'name' => $languageTranslations[$languageItem]
);
}
}
}
$uri = eZURI::instance();
$uriParams = $uri->UserParameters();
if(isset($uriParams['language']))
$uriLang = $uriParams['language'];
if($uriLang){
$this->node->setCurrentLanguage($uriLang);
$this->pushResult('current_language', $uriLang);
$this->pushResult('node', $this->node);
}
elseif(in_array($publisherLanguages[0], $availableLanguages)){
if($this->node->currentLanguage() != $publisherLanguages[0]){
$this->node->setCurrentLanguage($publisherLanguages[0]);
$this->pushResult('current_language', $publisherLanguages[0]);
$this->pushResult('node', $this->node);
}
}
else{
$this->pushResult('current_language' , $this->node->currentLanguage());
$this->pushResult('node', $this->node);
}
$this->pushResult('languages', $languages);
if( SolrSafeOperatorHelper::featureIsActive( 'GoogleAnalytics' ) )
$this->pushResult( 'gtm_variables', $this->getGTMTags( $this->node ) );
$this->pushResult('related_publishers', $this->getRelatedPublishers());
$this->pushResult('related_content', $this->getRelatedContent($this->node));
$this->pushResult('related_content_taxonomy', $this->getCustomParameter('RelatedContentTaxonomy'));
return true;
}
示例9: elseif
$resultParameters = BCImageAlias::instance($executionOptions)->createByNodeSubtree($node, $parameters['subtree-params']);
} else {
/**
* Perform create content requests
*/
$resultParameters = BCImageAlias::instance($executionOptions)->createByObject($node->attribute('object'), $parameters['subtree-params']);
}
if (isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], 'content/browse') === false) {
$redirectUrl = $_SERVER['HTTP_REFERER'];
} elseif ($node->hasAttribute('url_alias') && $node->attribute('url_alias') != '') {
$redirectUrl = $node->attribute('url_alias');
$redirectUrlInstance = eZURI::instance($redirectUrl);
$redirectUrlInstance->transformURI($redirectUrl, false, 'full');
} else {
$redirectUrl = '/content/view/full/' . $node->attribute('node_id');
$redirectUrlInstance = eZURI::instance($redirectUrl);
$redirectUrlInstance->transformURI($redirectUrl, false, 'full');
}
if ($parameters['redirect'] != 'default') {
//echo $redirectUrl; die();
$http->redirect($redirectUrl);
} else {
return redirectToContentBrowseModuleView(false, $Module);
}
}
}
/**
* Pass module view default template parameters
*
* @param array $parameters Array of parameters. Optional
* @param object $module Object of eZModule. Required
示例10: generateViewParametersString
private function generateViewParametersString($preSeparator = '', $postSeparator = '')
{
// taking view parameters and generate a string with them
$eZURI = eZURI::instance(eZSys::requestURI());
$viewParametersString = '';
foreach ($eZURI->UserArray as $paramName => $paramValue) {
$viewParametersString .= $preSeparator . $paramName . $postSeparator . $paramValue;
}
return $viewParametersString;
}
示例11: templateInit
}
$tpl = templateInit();
$ini = eZINI::instance();
$http = eZHTTPTool::instance();
$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 = 'styleeditorvisual-' + time();
$nodeResult['title_path'] = array(array('text' => 'Visual'), array('text' => $node->attribute('name')));
$httpCharset = eZTextCodec::httpCharset();
$locale = eZLocale::instance();
$languageCode = $locale->httpLocaleCode();
$title = $ini->variable('SiteSettings', 'SiteName');
$uri = eZURI::instance();
$GLOBALS['eZRequestedURI'] = $uri;
$site = array('title' => $title, 'uri' => $uri, 'design' => $ini->variable('DesignSettings', 'SiteDesign'), 'http_equiv' => array('Content-Type' => 'text/html; charset=' . $httpCharset, 'Content-language' => $languageCode));
$currentUser = eZUser::currentUser();
$tpl->setVariable('current_user', $currentUser);
$tpl->setVariable('ui_context', '');
$lastAccessURI = '/';
if ($http->hasSessionVariable('LastAccessesURI')) {
$lastAccessURI = $http->sessionVariable('LastAccessesURI');
}
$tpl->setVariable('last_access_uri', $lastAccessURI);
$tpl->setVariable('access_type', eZSiteAccess::current());
$tpl->setVariable('uri_string', $uri->uriString());
$tpl->setVariable('site', $site);
$tpl->setVariable('extra_cache_key', $cacheKey);
$tpl->setVariable('module_result', $nodeResult);
示例12: view_parameters_php
public static function view_parameters_php()
{
$uri = eZURI::instance();
$param = $uri->userParameters();
return $param;
}
示例13: modify
function modify($tpl, $operatorName, $operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters)
{
$ini = eZINI::instance('xrowmetadata.ini');
$page_limit = $ini->variable('EditorInputSettings', 'MaxPageLimit');
$uri = eZURI::instance(eZSys::requestURI());
$viewParameters = $uri->UserParameters();
if (count($viewParameters) == 0) {
$page_offset = 0;
} else {
$page_offset = $viewParameters['offset'];
}
switch ($operatorName) {
case 'metadata':
if (isset($namedParameters['node_id'])) {
$node = eZContentObjectTreeNode::fetch($namedParameters['node_id']);
if ($node instanceof eZContentObjectTreeNode) {
$cur_parent = $node->fetchParent();
$obj_name = $node->getName();
$obj_count = $node->subTreeCount(array('IgnoreVisibility' => true));
$localbusiness_count = $node->subTreeCount(array('IgnoreVisibility' => true, 'ClassFilterType' => 'include', 'ClassFilterArray' => array('localbusiness')));
$path_array_temp = array_reverse(explode('/', $node->pathWithNames()));
$obj_path = implode(' | ', $path_array_temp);
$obj_parentname = $cur_parent->Name;
$page_count = ceil($localbusiness_count / $page_limit);
$page_nr = $page_offset / $page_limit + 1;
$page_count_value = ezpI18n::tr('kernel/classes/datatypes', 'page') . " " . $page_nr . "/" . $page_count;
$operatorValue = xrowMetaDataFunctions::fetchByObject($node->attribute('object'));
if ($operatorValue !== false) {
if (isset($operatorValue->title)) {
$search_title = $operatorValue->title;
$placeholder_title_array = self::getPlaceholders($search_title);
if (count($placeholder_title_array) !== 0) {
foreach ($placeholder_title_array as $placeholder_title) {
switch ($placeholder_title) {
case "count":
$meta_title = str_replace("[count]", $obj_count, $search_title);
continue;
case "name":
$meta_title = str_replace("[name]", $obj_name, $search_title);
continue;
case "path":
$meta_title = str_replace("[path]", $obj_path, $search_title);
continue;
case "parentname":
$meta_title = str_replace("[parentname]", $obj_parentname, $search_title);
continue;
case "count:localbusiness":
$meta_title = str_replace("[count:localbusiness]", $localbusiness_count, $search_title);
continue;
case "pagecount":
$meta_title = str_replace("[pagecount]", $page_count_value, $search_title);
continue;
}
$search_title = $meta_title;
}
$operatorValue->title = $search_title;
unset($search_title);
}
}
if (isset($operatorValue->description)) {
$search_description = $operatorValue->description;
$placeholder_title_description = self::getPlaceholders($search_description);
if (count($placeholder_title_description) !== 0) {
foreach ($placeholder_title_description as $placeholder_description) {
switch ($placeholder_description) {
case "count":
$meta_description = str_replace("[count]", $obj_count, $search_description);
continue;
case "name":
$meta_description = str_replace("[name]", $obj_name, $search_description);
continue;
case "path":
$meta_description = str_replace("[path]", $obj_path, $search_description);
continue;
case "parentname":
$meta_description = str_replace("[parentname]", $obj_parentname, $search_description);
continue;
case "count:localbusiness":
$meta_description = str_replace("[count:localbusiness]", $localbusiness_count, $search_description);
continue;
case "pagecount":
$meta_description = str_replace("[pagecount]", $page_count_value, $search_description);
continue;
}
$search_description = $meta_description;
}
$operatorValue->description = $search_description;
unset($search_description);
}
}
}
} else {
$operatorValue = false;
}
} else {
$operatorValue = false;
}
break;
}
}
示例14: registerExtensions
/**
* Register extensions "the YMC way".
*
*
* @return void
* @access public
* @author ymc-dabe
* @see eZExtension::activateExtensions()
* @link http://issues.ez.no/IssueView.php?Id=2709
*/
public function registerExtensions($virtual_siteaccess = false)
{
if (!$this->attribute('is_enabled')) {
eZDebug::writeError("The ymcExtensionLoader is disabled, but " . __METHOD__ . " has just been called (which really shouldn't be done)!", __METHOD__);
}
$siteaccess = self::getCurrentSiteaccess();
$isBasicLoad = true;
$is_virtual_load = false;
$cache_hit = false;
$defaultActiveExtensions = self::$alwaysEnabledExtensions;
if (!in_array('ymcextensionloader', $defaultActiveExtensions)) {
$defaultActiveExtensions[] = 'ymcextensionloader';
}
if ($this->standardLoadingCompleted === true and $virtual_siteaccess !== false and $siteaccess !== $virtual_siteaccess) {
if ($this->virtualLoadingCompleted === true) {
eZDebug::writeError("Unnecessary call to 'ymcExtensionLoader::registerExtensions('.{$virtual_siteaccess}.')'!", __METHOD__);
return;
}
$siteaccess = $virtual_siteaccess;
self::setInternalSiteaccess($siteaccess);
eZDebug::accumulatorStart('OpenVolanoExtensionLoader_VirtualSiteaccess', 'OpenVolano: Enhanced Extension Loader', "After virtual siteaccess '{$siteaccess}' initialised ");
$isBasicLoad = false;
$is_virtual_load = true;
$this->rebuildIniOverrideArray($siteaccess, $isBasicLoad);
} else {
if (null !== $siteaccess) {
if ($this->standardLoadingCompleted === true) {
eZDebug::writeError("Unnecessary call to " . __METHOD__ . "!", __METHOD__);
return;
}
$isBasicLoad = false;
eZDebug::accumulatorStart('OpenVolanoExtensionLoader_Siteaccess', 'OpenVolano: Enhanced Extension Loader', "After siteaccess '{$siteaccess}' initialised ");
} else {
if (self::$earlyLoadingCompleted === true) {
eZDebug::writeWarning("Force registering additional extensions - please keep in mind, that it is not possible to unload extensions", __METHOD__);
}
eZDebug::accumulatorStart('OpenVolanoExtensionLoader_Basic', 'OpenVolano: Enhanced Extension Loader', 'Pre siteaccess initialised');
}
}
$ini = eZINI::instance();
$allExtensionsRegistered = false;
if ($isBasicLoad) {
self::$globalCacheDirectory = eZSys::cacheDirectory();
$cacheFileName = 'basic';
$cache_var_name = 'ymcExtensionLoaderRegisterExtensionBasicLoadInformation';
} else {
if ($is_virtual_load) {
$cacheFileName = 'siteaccess-' . $this->attribute('non_virtual_siteaccess') . '-virtualsiteaccess-' . $siteaccess;
$cache_var_name = 'ymcExtensionLoaderRegisterExtensionVirtualSiteaccessLoadInformation';
} else {
$cacheFileName = 'siteaccess-' . $siteaccess;
$cache_var_name = 'ymcExtensionLoaderRegisterExtensionSiteaccessLoadInformation';
}
}
$write_cache = false;
$can_write_cache = true;
$cacheDir = eZSys::cacheDirectory() . '/openvolano/extensions';
if (!is_writable($cacheDir)) {
if (!eZDir::mkdir($cacheDir, 0777, true)) {
$can_write_cache = false;
eZDebug::writeError("Couldn't create cache directory '{$cacheDir}', perhaps wrong permissions", __METHOD__);
}
}
$cacheFilePath = $cacheDir . '/' . $cacheFileName;
if (!file_exists($cacheFilePath)) {
$write_cache = $can_write_cache;
if ($isBasicLoad) {
eZDebug::writeNotice("No cache found for loading basic set of extensions", __METHOD__);
} else {
eZDebug::writeNotice("No cache found for loading per siteaccess set of extensions for siteaccess '{$siteaccess}'", __METHOD__);
}
} else {
include $cacheFilePath;
if (!isset(${$cache_var_name})) {
eZDebug::writeWarning("Cache '{$cache_var_name}' in file '{$cacheFilePath}' not found. Trying to force rewrite of this cache file...", __METHOD__);
$write_cache = $can_write_cache;
} else {
eZDebug::writeNotice("Cache hit: {$cacheFilePath}", __METHOD__);
$defaultActiveExtensions = ${$cache_var_name};
$cache_hit = true;
unset($cache_var_name);
}
}
$additional_lookups = 0;
//Loop registering of extensions until all are loaded
while (!$allExtensionsRegistered) {
//First we asume we do not need to check for new extensions
$allExtensionsRegistered = true;
//these extensions are always active
$activeExtensions = $defaultActiveExtensions;
//.........这里部分代码省略.........
示例15: getCacheKeysArray
/**
* Generate cache key array based on current user roles, requested url, layout
*
* @param $userKeys Array
* @return array
*/
public function getCacheKeysArray($userKeys)
{
if (!is_array($userKeys)) {
$userKeys = array($userKeys);
}
$user = eZUser::currentUser();
$limitedAssignmentValueList = $user->limitValueList();
$roleList = $user->roleIDList();
$discountList = eZUserDiscountRule::fetchIDListByUserID($user->attribute('contentobject_id'));
$currentSiteAccess = isset($GLOBALS['eZCurrentAccess']['name']) ? $GLOBALS['eZCurrentAccess']['name'] : false;
$res = eZTemplateDesignResource::instance();
$keys = $res->keys();
$layout = isset($keys['layout']) ? $keys['layout'] : false;
$uri = eZURI::instance(eZSys::requestURI());
$actualRequestedURI = $uri->uriString();
$userParameters = $uri->userParameters();
$cacheKeysArray = array('spdf2png', $currentSiteAccess, $layout, $actualRequestedURI, implode('.', $userParameters), implode('.', $roleList), implode('.', $limitedAssignmentValueList), implode('.', $discountList), implode('.', $userKeys));
return $cacheKeysArray;
}