本文整理汇总了PHP中eZPreferences类的典型用法代码示例。如果您正苦于以下问题:PHP eZPreferences类的具体用法?PHP eZPreferences怎么用?PHP eZPreferences使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了eZPreferences类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: modify
function modify($tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters, $placement)
{
switch ($operatorName) {
case 'ezpreference':
$name = $namedParameters['name'];
$value = eZPreferences::value($name);
$operatorValue = $value;
break;
default:
eZDebug::writeError("Unknown kernel operator: {$operatorName}");
break;
}
}
示例2: switch
} else {
if ($module->isCurrentAction('UpdateAutoRates')) {
$error = eZShopFunctions::updateAutoRates();
}
}
}
}
}
if ($error !== false) {
if ($error['code'] != 0) {
$error['style'] = 'message-error';
} else {
$error['style'] = 'message-feedback';
}
}
switch (eZPreferences::value('currencies_list_limit')) {
case '2':
$limit = 25;
break;
case '3':
$limit = 50;
break;
default:
$limit = 10;
break;
}
// fetch currencies
$currencyList = eZCurrencyData::fetchList(null, true, $offset, $limit);
$currencyCount = eZCurrencyData::fetchListCount();
$viewParameters = array('offset' => $offset);
$tpl = eZTemplate::factory();
示例3: array
$conds = array();
//$conds['user_id'] = $userID;
$conds['status'] = array(array(eZWorkflow::STATUS_DEFERRED_TO_CRON, eZWorkflow::STATUS_FETCH_TEMPLATE, eZWorkflow::STATUS_REDIRECT, eZWorkflow::STATUS_WAITING_PARENT));
$db = eZDB::instance();
if ($db->databaseName() == 'oracle') {
$conds['LENGTH(memento_key)'] = array('!=', 0);
} else {
$conds['memento_key'] = array('!=', '');
}
$offset = $Params['Offset'];
if (!is_numeric($offset)) {
$offset = 0;
}
$limitList = array(1 => 10, 2 => 25, 3 => 50, 4 => 100);
$limit = 10;
$limitId = eZPreferences::value('admin_workflow_processlist_limit');
if ($limitId and isset($limitList[$limitId])) {
$limit = $limitList[$limitId];
}
$viewParameters = array('offset' => $offset);
$plist = eZWorkflowProcess::fetchList($conds, true, $offset, $limit);
$plistCount = eZWorkflowProcess::count(eZWorkflowProcess::definition(), $conds);
$totalProcessCount = 0;
$outList2 = array();
foreach ($plist as $p) {
$mementoMain = eZOperationMemento::fetchMain($p->attribute('memento_key'));
$mementoChild = eZOperationMemento::fetchChild($p->attribute('memento_key'));
if (!$mementoMain or !$mementoChild) {
continue;
}
$mementoMainData = $mementoMain->data();
示例4:
* @license For full copyright and license information view LICENSE file distributed with this source code.
* @version 2014.07.0
* @package kernel
*/
$http = eZHTTPTool::instance();
$Module = $Params['Module'];
$NodeID = $Params['NodeID'];
if ($http->hasPostVariable("BackButton")) {
$userRedirectURI = $http->sessionVariable('userRedirectURIReverseRelatedList');
$http->removeSessionVariable('userRedirectURIReverseRelatedList');
return $Module->redirectTo($userRedirectURI);
}
if (!isset($Offset)) {
$Offset = false;
}
$children_list_limit = eZPreferences::value("reverse_children_list_limit");
switch ($children_list_limit) {
case 0:
$pageLimit = 10;
break;
case 1:
$pageLimit = 10;
break;
case 2:
$pageLimit = 25;
break;
case 3:
$pageLimit = 50;
break;
default:
$pageLimit = 10;
示例5: collection
{
$cli->output( "Could not remove expired sessions, current session handler does not support session garbage collection (not backend based)." );
}
else
{
$cli->output( "Removing expired sessions,", false );
eZSession::garbageCollector();
$activeCount = eZSession::countActive();
$cli->output( " " . $cli->stylize( 'emphasize', $activeCount ) . " left" );
}
}
if ( $clean['preferences'] )
{
$cli->output( "Removing all preferences" );
eZPreferences::cleanup();
}
if ( $clean['browse'] )
{
$cli->output( "Removing all recent items and bookmarks for browse page" );
eZContentBrowseRecent::cleanup();
eZContentBrowseBookmark::cleanup();
}
if ( $clean['tipafriend'] )
{
$cli->output( "Removing all counters for tip-a-friend" );
eZTipafriendCounter::cleanup();
}
示例6: preferences
/**
* Set user preferences
* Only needed for operations, call eZPreferences::setValue() directly if you want to set user preferences
*
* @param string $key
* @param string $value
*
* @return array An array with operation status, always true
*/
public static function preferences($key, $value)
{
eZPreferences::setValue($key, $value);
return array('status' => true);
}
示例7: templateInit
* @filesource
*/
// Blacklist User by nl user id or by email
// update all nessesarry status fields to blacklisted
$module = $Params['Module'];
$templateFile = 'design:newsletter/blacklist_item_list.tpl';
require_once 'kernel/common/i18n.php';
include_once 'kernel/common/template.php';
$http = eZHTTPTool::instance();
$tpl = templateInit();
$http = eZHTTPTool::instance();
$db = eZDB::instance();
$viewParameters = array('offset' => 0, 'namefilter' => '');
$userParameters = $Params['UserParameters'];
$viewParameters = array_merge($viewParameters, $userParameters);
$limit = 10;
$limitArray = array(10, 10, 25, 50);
$limitArrayKey = eZPreferences::value('admin_blacklist_item_list_limit');
// get user limit preference
if (isset($limitArray[$limitArrayKey])) {
$limit = $limitArray[$limitArrayKey];
}
$blacklistItemList = CjwNewsletterBlacklistItem::fetchAllBlacklistItems($limit, $viewParameters['offset']);
$blacklistItemListCount = CjwNewsletterBlacklistItem::fetchAllBlacklistItemsCount();
$tpl->setVariable('view_parameters', $viewParameters);
$tpl->setVariable('blacklist_item_list', $blacklistItemList);
$tpl->setVariable('blacklist_item_list_count', $blacklistItemListCount);
$tpl->setVariable('limit', $limit);
$Result = array();
$Result['content'] = $tpl->fetch($templateFile);
$Result['path'] = array(array('url' => 'newsletter/index', 'text' => ezi18n('cjw_newsletter/path', 'Newsletter')), array('url' => false, 'text' => ezi18n('cjw_newsletter/blacklist_item_list', 'Blacklists')));
示例8: switch
<?php
/**
* @copyright Copyright (C) 1999-2013 eZ Systems AS. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
* @version 2013.11
* @package kernel
*/
$Module = $Params['Module'];
$ViewMode = $Params['ViewMode'];
if (eZPreferences::value('admin_url_list_limit')) {
switch (eZPreferences::value('admin_url_list_limit')) {
case '2':
$limit = 25;
break;
case '3':
$limit = 50;
break;
default:
$limit = 10;
break;
}
} else {
$limit = 10;
}
$offset = $Params['Offset'];
if (!is_numeric($offset)) {
$offset = 0;
}
if ($ViewMode != 'all' && $ViewMode != 'invalid' && $ViewMode != 'valid') {
$ViewMode = 'all';
示例9: array
$http = eZHTTPTool::instance();
$module = $Params['Module'];
$allSettingsList = $module->actionParameter( 'AllSettingsList' );
if ( $module->hasActionParameter( 'SelectedList' ) )
$selectedList = $module->actionParameter( 'SelectedList' );
else
$selectedList=array();
$siteAccess = $module->actionParameter( 'SiteAccess' );
if ( !$siteAccess )
$siteAccess = 'global_override';
eZPreferences::setValue( 'admin_quicksettings_siteaccess', $siteAccess );
$iniFiles = array();
foreach( $allSettingsList as $index => $setting )
{
$settingArray = explode( ';', $setting );
if ( !array_key_exists( $settingArray[2], $iniFiles ) )
$iniFiles[$settingArray[2]] = array();
$iniFiles[$settingArray[2]][] = array ( $settingArray[0], $settingArray[1], in_array( $index, $selectedList ) );
}
unset( $setting );
$iniPath = ( $siteAccess == "global_override" ) ? "settings/override" : "settings/siteaccess/$siteAccess";
示例10: array
if ($tpl->hasVariable('node_url_alias', $rootNamespace)) {
$tpl->warning('def', "Variable 'node_url_alias' is already defined.", array(0 => array(0 => 2, 1 => 0, 2 => 23), 1 => array(0 => 19, 1 => 0, 2 => 1205), 2 => 'design/admin/templates/window_controls.tpl'));
$tpl->setVariable('node_url_alias', $var, $rootNamespace);
} else {
$tpl->setLocalVariable('node_url_alias', $var, $rootNamespace);
}
// def $tabs_disabled
if ($tpl->hasVariable('tabs_disabled', $rootNamespace)) {
$tpl->warning('def', "Variable 'tabs_disabled' is already defined.", array(0 => array(0 => 2, 1 => 0, 2 => 23), 1 => array(0 => 19, 1 => 0, 2 => 1205), 2 => 'design/admin/templates/window_controls.tpl'));
$tpl->setVariable('tabs_disabled', false, $rootNamespace);
} else {
$tpl->setLocalVariable('tabs_disabled', false, $rootNamespace);
}
// def $admin_navigation_content_pref
unset($var);
$var = eZPreferences::value("admin_navigation_content");
if (!isset($var)) {
$var = NULL;
}
while (is_object($var) and method_exists($var, 'templateValue')) {
$var = $var->templateValue();
}
if ($tpl->hasVariable('admin_navigation_content_pref', $rootNamespace)) {
$tpl->warning('def', "Variable 'admin_navigation_content_pref' is already defined.", array(0 => array(0 => 2, 1 => 0, 2 => 23), 1 => array(0 => 19, 1 => 0, 2 => 1205), 2 => 'design/admin/templates/window_controls.tpl'));
$tpl->setVariable('admin_navigation_content_pref', $var, $rootNamespace);
} else {
$tpl->setLocalVariable('admin_navigation_content_pref', $var, $rootNamespace);
}
// def $default_tab
if ($tpl->hasVariable('default_tab', $rootNamespace)) {
$tpl->warning('def', "Variable 'default_tab' is already defined.", array(0 => array(0 => 2, 1 => 0, 2 => 23), 1 => array(0 => 19, 1 => 0, 2 => 1205), 2 => 'design/admin/templates/window_controls.tpl'));
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:31,代码来源:window_controls-3ff10b9e7738fc6c3534d5c40b0f2ce7.php
示例11: setCookie
public static function setCookie()
{
$ini = eZINI::instance('scachecookie.ini');
$siteIni = eZINI::instance('site.ini');
$hasUserData = false;
$displayedData = $ini->variable('CacheCookieSettings', 'DisplayedData');
$cookieValue = $ini->variable('CacheCookieSettings', 'CookieValue') || 'true';
if ($cookieValue === true) {
$cookieValue = 'true';
}
$useDetailedValue = $ini->variable('CacheCookieSettings', 'DetailedCookieValue') == 'enabled';
$detailedValue = '';
if (in_array('basket', $displayedData)) {
$http = eZHTTPTool::instance();
$sessionID = $http->sessionID();
$basket = eZBasket::fetch($sessionID);
if ($basket) {
if (!$basket->isEmpty()) {
$hasUserData = true;
if ($useDetailedValue) {
$detailedValue .= ',basket';
}
}
}
}
if ((!$hasUserData || $useDetailedValue) && in_array('wishlist', $displayedData)) {
$user = eZUser::currentUser();
$userID = $user->attribute('contentobject_id');
$WishListArray = eZPersistentObject::fetchObjectList(eZWishList::definition(), null, array("user_id" => $userID), null, null, true);
if (count($WishListArray) > 0) {
if ($WishListArray[0]->itemCount() > 0) {
$hasUserData = true;
if ($useDetailedValue) {
$detailedValue .= ',wishlist';
}
}
}
}
if (!$hasUserData || $useDetailedValue) {
$prefs = eZPreferences::values();
$hasPrefs = false;
foreach ($prefs as $key => $val) {
if ($key != '') {
if (in_array('preferences', $displayedData) || in_array($key, $displayedData)) {
if ($val != '') {
$hasUserData = true;
if ($useDetailedValue) {
if (in_array('preferences', $displayedData) && !$hasPrefs) {
$detailedValue .= ',preferences';
}
if (in_array($key, $displayedData)) {
$detailedValue .= ",{$key}:{$val}";
}
}
$hasPrefs = true;
}
}
}
}
}
$value = $hasUserData ? $cookieValue . $detailedValue : false;
$wwwDir = eZSys::wwwDir();
$cookiePath = $wwwDir != '' ? $wwwDir : '/';
setcookie($ini->variable('CacheCookieSettings', 'CookieName'), $value, time() + (int) $siteIni->variable('Session', 'SessionTimeout'), $cookiePath);
}
示例12: unset
$assignments[$key]->remove();
unset( $assignments[$key] );
eZDebugSetting::writeDebug( 'kernel-content-edit', "placement is not validated" );
}
if ( isset( $assignments[$key] ) &&
$assignments[$key]->attribute( 'is_main' ) == 1 )
{
$mainFound = true;
break;
}
}
$db->commit();
if ( !$mainFound and count( $assignments ) > 0 )
{
if( eZPreferences::value( 'admin_edit_show_locations' ) == '0' )
{
$validation[ 'placement' ][] = array( 'text' => ezpI18n::tr( 'kernel/content', 'No main node selected, please select one.' ) );
$validation[ 'processed' ] = true;
$inputValidated = false;
eZDebugSetting::writeDebug( 'kernel-content-edit', "placement is not validated" );
}
}
else
eZDebugSetting::writeDebug( 'kernel-content-edit', "placement is validated" );
}
// After the object has been validated we can check for other actions
$Result = '';
if ( $inputValidated == true )
示例13: array
eZURLWildcard::expireCache();
$infoData['wildcard_src_url'] = $wildcardSrcText;
$infoData['wildcard_dst_url'] = $wildcardDstText;
$wildcardSrcText = false;
$wildcardDstText = false;
$wildcardType = false;
$infoCode = "feedback-wildcard-created";
}
}
}
}
}
}
// User preferences
$limitList = array(array('id' => 1, 'value' => 10), array('id' => 2, 'value' => 25), array('id' => 3, 'value' => 50), array('id' => 4, 'value' => 100));
$limitID = eZPreferences::value('admin_urlwildcard_list_limit');
foreach ($limitList as $limitEntry) {
$limitIDs[] = $limitEntry['id'];
$limitValues[$limitEntry['id']] = $limitEntry['value'];
}
if (!in_array($limitID, $limitIDs)) {
$limitID = 2;
}
// Fetch wildcads
$wildcardsLimit = $limitValues[$limitID];
$wildcardsCount = eZURLWildcard::fetchListCount();
// check offset, it can be out of range if some wildcards were removed.
if ($Offset >= $wildcardsCount) {
$Offset = 0;
}
$wildcardList = eZURLWildcard::fetchList($Offset, $wildcardsLimit);
示例14:
* @license For full copyright and license information view LICENSE file distributed with this source code.
* @version 2014.07.0
* @package kernel
*/
$module = $Params['Module'];
$tpl = eZTemplate::factory();
$offset = $Params['Offset'];
$limit = 50;
if (eZPreferences::value('admin_archivelist_sortfield')) {
$sortField = eZPreferences::value('admin_archivelist_sortfield');
}
if (!isset($sortField) || $sortField != 'created' && $sortField != 'user_name') {
$sortField = 'created';
}
if (eZPreferences::value('admin_archivelist_sortorder')) {
$sortOrder = eZPreferences::value('admin_archivelist_sortorder');
}
if (!isset($sortOrder) || $sortOrder != 'asc' && $sortOrder != 'desc') {
$sortOrder = 'asc';
}
$http = eZHTTPTool::instance();
// Unarchive options.
if ($http->hasPostVariable('UnarchiveButton')) {
if ($http->hasPostVariable('OrderIDArray')) {
$orderIDArray = $http->postVariable('OrderIDArray');
if ($orderIDArray !== null) {
$http->setSessionVariable('OrderIDArray', $orderIDArray);
$Module->redirectTo($Module->functionURI('unarchiveorder') . '/');
}
}
}
示例15: generateViewCacheFile
static function generateViewCacheFile($user, $nodeID, $offset, $layout, $language, $viewMode, $viewParameters = false, $cachedViewPreferences = false, $viewCacheTweak = '')
{
$cacheNameExtra = '';
$ini = eZINI::instance();
if (!$language) {
$language = false;
}
if (!$viewCacheTweak && $ini->hasVariable('ContentSettings', 'ViewCacheTweaks')) {
$viewCacheTweaks = $ini->variable('ContentSettings', 'ViewCacheTweaks');
if (isset($viewCacheTweaks[$nodeID])) {
$viewCacheTweak = $viewCacheTweaks[$nodeID];
} else {
if (isset($viewCacheTweaks['global'])) {
$viewCacheTweak = $viewCacheTweaks['global'];
}
}
}
// should we use current siteaccess or let several siteaccesse share cache?
if (strpos($viewCacheTweak, 'ignore_siteaccess_name') === false) {
$currentSiteAccess = $GLOBALS['eZCurrentAccess']['name'];
} else {
$currentSiteAccess = $ini->variable('SiteSettings', 'DefaultAccess');
}
$cacheHashArray = array($nodeID, $viewMode, $language, $offset, $layout);
// several user related cache tweaks
if (strpos($viewCacheTweak, 'ignore_userroles') === false) {
$cacheHashArray[] = implode('.', $user->roleIDList());
}
if (strpos($viewCacheTweak, 'ignore_userlimitedlist') === false) {
$cacheHashArray[] = implode('.', $user->limitValueList());
}
if (strpos($viewCacheTweak, 'ignore_discountlist') === false) {
$cacheHashArray[] = implode('.', eZUserDiscountRule::fetchIDListByUserID($user->attribute('contentobject_id')));
}
$cacheHashArray[] = eZSys::indexFile();
// Add access type to cache hash if current access is uri type (so uri and host doesn't share cache)
if (strpos($viewCacheTweak, 'ignore_siteaccess_type') === false && $GLOBALS['eZCurrentAccess']['type'] === eZSiteAccess::TYPE_URI) {
$cacheHashArray[] = eZSiteAccess::TYPE_URI;
}
// Make the cache unique for every logged in user
if (strpos($viewCacheTweak, 'pr_user') !== false and !$user->isAnonymous()) {
$cacheNameExtra = $user->attribute('contentobject_id') . '-';
}
// Make the cache unique for every case of view parameters
if (strpos($viewCacheTweak, 'ignore_viewparameters') === false && $viewParameters) {
$vpString = '';
ksort($viewParameters);
foreach ($viewParameters as $key => $value) {
if (!$key || $key === '_custom') {
continue;
}
$vpString .= 'vp:' . $key . '=' . $value;
}
$cacheHashArray[] = $vpString;
}
// Make the cache unique for every case of the preferences
if ($cachedViewPreferences === false) {
$depPreferences = $ini->variable('ContentSettings', 'CachedViewPreferences');
} else {
$depPreferences = $cachedViewPreferences;
}
if (strpos($viewCacheTweak, 'ignore_userpreferences') === false && isset($depPreferences[$viewMode])) {
$depPreferences = explode(';', $depPreferences[$viewMode]);
$pString = '';
// Fetch preferences for the specified user
$preferences = eZPreferences::values($user);
foreach ($depPreferences as $pref) {
$pref = explode('=', $pref);
if (isset($pref[0])) {
if (isset($preferences[$pref[0]])) {
$pString .= 'p:' . $pref[0] . '=' . $preferences[$pref[0]] . ';';
} else {
if (isset($pref[1])) {
$pString .= 'p:' . $pref[0] . '=' . $pref[1] . ';';
}
}
}
}
$cacheHashArray[] = $pString;
}
$cacheFile = $nodeID . '-' . $cacheNameExtra . md5(implode('-', $cacheHashArray)) . '.cache';
$extraPath = eZDir::filenamePath($nodeID);
$cacheDir = eZDir::path(array(eZSys::cacheDirectory(), $ini->variable('ContentSettings', 'CacheDir'), $currentSiteAccess, $extraPath));
$cachePath = eZDir::path(array($cacheDir, $cacheFile));
return array('cache_path' => $cachePath, 'cache_dir' => $cacheDir, 'cache_file' => $cacheFile);
}