本文整理汇总了PHP中eZINI::variable方法的典型用法代码示例。如果您正苦于以下问题:PHP eZINI::variable方法的具体用法?PHP eZINI::variable怎么用?PHP eZINI::variable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZINI
的用法示例。
在下文中一共展示了eZINI::variable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateDebugSettings
/**
* Initializes/updates debug settings, system wide
*/
public function updateDebugSettings()
{
$ini = eZINI::instance();
$debugSettings = array();
$debugSettings['debug-enabled'] = ($ini->variable('DebugSettings', 'DebugOutput') == 'enabled' and $this->restINI->variable('DebugSettings', 'Debug') == 'enabled');
$debugSettings['debug-by-ip'] = $ini->variable('DebugSettings', 'DebugByIP') == 'enabled';
$debugSettings['debug-ip-list'] = $ini->variable('DebugSettings', 'DebugIPList');
$logList = $ini->variable('DebugSettings', 'AlwaysLog');
$logMap = array('notice' => eZDebug::LEVEL_NOTICE, 'warning' => eZDebug::LEVEL_WARNING, 'error' => eZDebug::LEVEL_ERROR, 'debug' => eZDebug::LEVEL_DEBUG, 'strict' => eZDebug::LEVEL_STRICT);
$debugSettings['always-log'] = array();
foreach ($logMap as $name => $level) {
$debugSettings['always-log'][$level] = in_array($name, $logList);
}
eZDebug::updateSettings($debugSettings);
}
示例2: archiveFiles
/**
* @param string $publisher
* @param string $xmlFile
* @param array $blobedFiles
*/
public function archiveFiles( $publisher, $xmlFile, $blobedFiles )
{
$this->buildArchiveFolder( $publisher );
$rootImport = $this->importINI->variable( 'XMLImportSettings', 'RootImport' );
$publisherFolder = "$rootImport/{$this->rootImportFolder}/$publisher";
$publisherArchiveFolder = "$publisherFolder/archived";
self::handleModeUATFile( "$publisherFolder/$xmlFile", "$publisherArchiveFolder/$xmlFile" );
XMLImportMonitor::log( "Archive xml file : $publisherFolder/$xmlFile => $publisherArchiveFolder/$xmlFile", 'info' );
XMLImportMonitor::setMonitorData('nb_of_retry', 0);
foreach ( $blobedFiles as $blobedFile )
{
$tmpFile = str_replace( "$publisherFolder/", '', $blobedFile );
if ( $tmpFile == $blobedFile )
{
XMLImportMonitor::log( "Unarchivable blobed file : $blobedFile", 'warning' );
}
else
{
self::handleModeUATFile( "$publisherFolder/$tmpFile", "$publisherArchiveFolder/$tmpFile" );
XMLImportMonitor::log( "Archive blobed file : $publisherFolder/$tmpFile => $publisherArchiveFolder/$tmpFile", 'info' );
}
}
}
示例3: testLoginUserSimpleMappingExistingUser
/**
* Test scenario for LDAP login using SimpleMapping, moving a user when the groups change
*
* Test Outline
* ------------
* 1. Set LDAPGroupMappingType = SimpleMapping but add no mappings
* 2. Login with username and password
* 3. Check parent nodes of user object
*
* @result: User is placed under the node given by LDAPGroupRootNodeId
* @expected: User is placed under the node given by LDAPGroupRootNodeId
*
* 1. Set LDAPGroupMappingType = SimpleMapping and mapping settings
* 2. Login with username and password
* 3. Check parent nodes of user object
*
* @result: User is placed in the RebelAlliance group
* @expected: User is placed in the RebelAlliance group
*
* 1. Change mapping settings, RebelAlliance => StarWars
* 2. Login with username and password
* 3. Check parent nodes of user object
*
* @result: User is placed in the StarWars group
* @expected: User is placed in the StarWars group
*/
public function testLoginUserSimpleMappingExistingUser()
{
// First login, to get an existing user object
$this->ldapINI->setVariable('LDAPSettings', 'LDAPGroupMappingType', 'SimpleMapping');
$this->ldapINI->setVariable('LDAPSettings', 'LDAPGroupNameAttribute', 'ou');
$this->ldapINI->setVariable('LDAPSettings', 'LDAPGroupMemberAttribute', 'seeAlso');
$this->ldapINI->setVariable('LDAPSettings', 'LDAPUserGroupMap', array());
$this->ldapINI->setVariable('LDAPSettings', 'KeepGroupAssignment', 'disabled');
// The user should be placed under the node given by LDAPGroupRootNodeId
$user = eZLDAPUser::loginUser('leia', 'bunhead');
$contentObject = $user->attribute('contentobject');
self::assertEquals(array($this->ldapINI->variable('LDAPSettings', 'LDAPGroupRootNodeId')), $contentObject->attribute('parent_nodes'));
// Then login again, with correct group mapping
$this->ldapINI->setVariable('LDAPSettings', 'LDAPUserGroupMap', array('StarWars' => 'StarWars', 'RebelAlliance' => 'RebelAlliance', 'Rogues' => 'Rogues'));
// The user should have moved to the RebelAlliance group
$user = eZLDAPUser::loginUser('leia', 'bunhead');
$contentObject = $user->attribute('contentobject');
self::assertEquals(array($this->rebelGroupNodeId), $contentObject->attribute('parent_nodes'));
// Change mapping and login again
$this->ldapINI->setVariable('LDAPSettings', 'LDAPUserGroupMap', array('StarWars' => 'StarWars', 'RebelAlliance' => 'StarWars', 'Rogues' => 'Rogues'));
// The user should have moved to the StarWars group
$user = eZLDAPUser::loginUser('leia', 'bunhead');
$contentObject = $user->attribute('contentobject');
self::assertEquals(array($this->starWarsGroupNodeId), $contentObject->attribute('parent_nodes'));
}
示例4: loadHandlers
protected function loadHandlers()
{
$handlers = (array) $this->extraParametersIni->variable('AvailableHandlers', 'Handlers');
foreach ($handlers as $identifier => $className) {
if (class_exists($className)) {
$interfaces = class_implements($className);
if (in_array('OCClassExtraParametersHandlerInterface', $interfaces)) {
$this->handlers[$identifier] = new $className($this->class);
} else {
eZDebug::writeError("{$className} not implements OCClassExtraParametersHandlerInterface", __METHOD__);
}
} else {
eZDebug::writeError("{$className} not found", __METHOD__);
}
}
}
示例5: isCacheEnabled
/**
* Checks if application cache is enabled for this controller/action, as set in rest.ini
*
* Default value will be [CacheSettings].ApplicationCache
* This can be refined by setting a [<controllerClass>_<action>_CacheSettings] section (see comments in rest.ini).
*
* @return bool
*/
private function isCacheEnabled()
{
// Global switch
if ( $this->restINI->variable( 'CacheSettings', 'ApplicationCache' ) !== 'enabled' )
{
return false;
}
$routingInfos = $this->getRouter()->getRoutingInformation();
// Check if we have a specific setting for this controller/action
$actionSectionName = $routingInfos->controllerClass . '_' . $routingInfos->action . '_CacheSettings';
if ( $this->restINI->hasVariable( $actionSectionName, 'ApplicationCache' ) )
{
return $this->restINI->variable( $actionSectionName, 'ApplicationCache' ) === 'enabled';
}
// Nothing at controller/action level, check at controller level
$controllerSectionName = $routingInfos->controllerClass . '_CacheSettings';
if ( $this->restINI->hasVariable( $controllerSectionName, 'ApplicationCache' ) )
{
return $this->restINI->variable( $controllerSectionName, 'ApplicationCache' ) === 'enabled';
}
// Nothing at controller level, take the default value
return $this->restINI->variable( 'CacheSettings', 'ApplicationCacheDefault' ) === 'enabled';
}
示例6: getAdjustedType
/**
* @param array $fieldArray
* @param string $type
* @return string
*/
public static function getAdjustedType( $fieldArray, $type )
{
/* @type $availableRelatedContent array */
$availableRelatedContent = self::$importINI->variable( 'XMLImportSettings', 'AvailableRelatedContent' );
if ( $type == 'article' )
$realType = $type;
elseif ( $type == 'media_content' )
{
$mediaTypeField = is_array($fieldArray['media_type'])?$fieldArray['media_type'][0]:$fieldArray['media_type'];
if ( $mediaTypeField )
$realType = $mediaTypeField->fieldNode->nodeValue;
else
{
$fieldMapping = XMLImportMapping::getByFieldName( $type, 'media_type' );
$realType = $fieldMapping['default'];
}
}
elseif ( in_array( $type, $availableRelatedContent ) )
$realType = $type;
else
$realType = false;
return $realType;
}
示例7: init
/**
* @param eZINI $importINI
* @return void
*/
public static function init(eZINI $importINI)
{
$extDir = eZSys::rootDir() . '/extension/';
//Get generated mapping config file
$jsonFile = $extDir . $importINI->variable('XMLImportSettings', 'MappingConfigGeneratedFile');
$jsonString = file_get_contents($jsonFile);
$mapGenerated = json_decode($jsonString, true);
//Get fixed mapping config file
$jsonFile = $extDir . $importINI->variable('XMLImportSettings', 'MappingConfigFixedFile');
$jsonString = file_get_contents($jsonFile);
$mapFixed = json_decode($jsonString, true);
//Merge both file
self::$mapping = $mapGenerated + $mapFixed;
}
示例8: testSendHTTPRequestRetryTimeout
/**
* Test for {@link eZSolrBase::sendHTTPRequestRetry()} with a timedout Solr server
* @link http://issues.ez.no/17862
* @group issue17862
*/
public function testSendHTTPRequestRetryTimeout()
{
ezpINIHelper::setINISetting('solr.ini', 'SolrBase', 'SearchServerURI', $this->nonReachableSolr);
$connectionTimeout = $this->solrINI->variable('SolrBase', 'ConnectionTimeout');
$maxRetries = $this->solrINI->variable('SolrBase', 'ProcessMaxRetries');
$solrBase = new eZSolrBase();
$refObj = new ReflectionObject($solrBase);
$refMethod = $refObj->getMethod('sendHTTPRequestRetry');
$refMethod->setAccessible(true);
$startTime = time();
$postString = $solrBase->buildPostString($this->postParams);
$res = $refMethod->invoke($solrBase, $solrBase->SearchServerURI . $this->testURI, $postString);
$stopTime = time();
$diffTime = $stopTime - $startTime;
self::assertFalse($res, 'Failed HTTP request to Solr must return false');
self::assertEquals($diffTime, $maxRetries * $connectionTimeout, "Sending HTTP Request to Solr must be retried a setted number of times (in solr.ini) if server has timed out");
}
示例9: handleSearchIndexPrevention
/**
* May activate SearchSettings.DelayedIndexing for current import script if so configured
* Result is faster import but imported content objects will need to be indexed later
* (by indexcontent cronjob or sqliimport_cleanup cronjob)
*/
private function handleSearchIndexPrevention()
{
$siteINI = eZINI::instance();
$objectIndexingEnabled = $this->importINI->variable('ImportSettings', 'ObjectIndexing') === 'enabled';
if (!$objectIndexingEnabled) {
$this->delayedIndexingEnabledGlobal = $siteINI->variable('SearchSettings', 'DelayedIndexing') === 'enabled';
$siteINI->setVariable('SearchSettings', 'DelayedIndexing', 'enabled');
}
}
示例10: getRealRoot
/**
* @return DOMElement
* @throws RootNodeException
*/
public function getRealRoot()
{
$rootDocument = $this->importINI->variable('XMLImportSettings', 'RootXMLDocument');
$nodeList = $this->xmlParser->getElementsByTagName($rootDocument);
if ($nodeList->length == 1)
return $nodeList->item(0);
else
throw new RootNodeException('Root document Node not found');
}
示例11: setRootNode
/**
* @param DOMElement $rootNode
* @throws RootNodeException
* @return void
*/
public function setRootNode($rootNode)
{
if (is_null($rootNode))
{
$rootDocument = $this->importINI->variable('XMLImportSettings', 'RootXMLDocument');
$nodeList = $this->xmlParser->getElementsByTagName($rootDocument);
if ($nodeList->length == 1)
{
$this->rootNode = $nodeList->item(0);
return;
}
else
{
throw new RootNodeException('Root Node not found in file');
}
}
else
{
$this->rootNode = $rootNode;
}
}
示例12: processObject
/**
* Processes Open Graph metadata from object attributes
*
* @param eZContentObject $contentObject
* @param array $returnArray
*
* @return array
*/
function processObject($contentObject, $returnArray)
{
if ($this->ogIni->hasVariable($contentObject->contentClassIdentifier(), 'LiteralMap')) {
$literalValues = $this->ogIni->variable($contentObject->contentClassIdentifier(), 'LiteralMap');
if ($this->debug) {
eZDebug::writeDebug($literalValues, 'LiteralMap');
}
if ($literalValues) {
foreach ($literalValues as $key => $value) {
if (!empty($value)) {
$returnArray[$key] = $value;
}
}
}
}
if ($this->ogIni->hasVariable($contentObject->contentClassIdentifier(), 'AttributeMap')) {
$attributeValues = $this->ogIni->variableArray($contentObject->contentClassIdentifier(), 'AttributeMap');
if ($this->debug) {
eZDebug::writeDebug($attributeValues, 'AttributeMap');
}
if ($attributeValues) {
foreach ($attributeValues as $key => $value) {
$contentObjectAttributeArray = $contentObject->fetchAttributesByIdentifier(array($value[0]));
if (!is_array($contentObjectAttributeArray)) {
continue;
}
$contentObjectAttributeArray = array_values($contentObjectAttributeArray);
$contentObjectAttribute = $contentObjectAttributeArray[0];
if ($contentObjectAttribute instanceof eZContentObjectAttribute) {
$openGraphHandler = ngOpenGraphBase::getInstance($contentObjectAttribute);
if (count($value) == 1) {
$data = $openGraphHandler->getData();
} else {
if (count($value) == 2) {
$data = $openGraphHandler->getDataMember($value[1]);
} else {
$data = "";
}
}
if (!empty($data)) {
$returnArray[$key] = $data;
}
}
}
}
}
return $returnArray;
}
示例13: checkESBMethod
protected function checkESBMethod( $method, $postData )
{
$url = sprintf( "%s%s%s?Country_of_Registration=%s",
\eZINI::instance( 'merck.ini' )->variable( 'WebService', 'BaseUrl' ),
\eZINI::instance( 'merck.ini' )->variable( 'WebService', 'Prefix' ),
$method,
$this->_clusterSiteIni->variable( 'RegionalSettings', 'CountryOfRegistration' )
);
$ch = curl_init( $url );
curl_setopt_array( $ch, array(
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => $postData,
CURLOPT_HEADER => 1,
CURLOPT_HTTPHEADER => array( 'Content-type: application/json' ),
CURLOPT_RETURNTRANSFER => 1,
));
$response = curl_exec( $ch );
list ( $headers, $body ) = explode( "\r\n\r\n", $response, 2 );
$responseCode = curl_getinfo( $ch, CURLINFO_HTTP_CODE );
$curlErrorNo = curl_errno( $ch );
$curlError = curl_error( $ch );
curl_close( $ch );
if ( !$response )
$this->script->shutdown( 1, "Curl error calling calling $url:\n\t[$curlErrorNo] $curlError" );
if ( $responseCode != 200 )
$this->script->shutdown( 1, $response );
$data = json_decode( $body, true );
if( !is_array( $data ) )
$this->script->shutdown( 1, "Could not parse JSON:\n".$response );
return array(
'data' => $data['Data'],
'headers' => $headers,
'body' => $body );
}
示例14: pushConfigurationToSolr
/**
* Pushes the configuration XML to Solr through a custom requestHandler ( HTTP/ReST ).
* The requestHandler ( Solr extension ) will take care of reloading the configuration.
*
* @see $configurationXML
* @param null $shard
* @throws Exception
*/
protected static function pushConfigurationToSolr($shard = null)
{
// Keep previous behaviour, but should not be needed
if ($shard === null) {
$shard = new eZSolrBase();
}
$syncMethodConf = self::$solrINI->variable('Elevate', 'SyncMethod');
$result = false;
if (class_exists($syncMethodConf['name'])) {
$syncMethod = new $syncMethodConf['name']();
$result = $syncMethod->synchronise($shard, self::getConfiguration(), $syncMethodConf);
} else {
eZDebug::writeError("Unable to find the PHP class " . $syncMethodConf['name'] . " defined for elevate synchronisation ", __METHOD__);
}
if (!$result) {
$message = ezpI18n::tr('extension/ezfind/elevate', 'An error occured in updating Solr\'s elevate configuration.');
eZDebug::writeError($message, __METHOD__);
throw new Exception($message);
} elseif (isset($result['error'])) {
eZDebug::writeError($result['error'], __METHOD__);
} else {
eZDebug::writeNotice("Successful update of Solr's configuration through " . $syncMethodConf['name'], __METHOD__);
}
}
示例15: array
$iniFiles[$settingArray[2]][] = array ( $settingArray[0], $settingArray[1], in_array( $index, $selectedList ) );
}
unset( $setting );
$iniPath = ( $siteAccess == "global_override" ) ? "settings/override" : "settings/siteaccess/$siteAccess";
foreach( $iniFiles as $fileName => $settings )
{
$ini = new eZINI( $fileName . '.append', $iniPath, null, null, null, true, true );
$baseIni = eZINI::instance( $fileName );
foreach( $settings as $setting )
{
if ( $ini->hasVariable( $setting[0], $setting[1] ) )
$value = $ini->variable( $setting[0], $setting[1] );
else
$value = $baseIni->variable( $setting[0], $setting[1] );
if ( $value == 'true' || $value == 'false' )
$ini->setVariable( $setting[0], $setting[1], $setting[2] ? 'true' : 'false' );
else
$ini->setVariable( $setting[0], $setting[1], $setting[2] ? 'enabled' : 'disabled' );
}
if ( !$ini->save() )
{
eZDebug::writeError( "Can't save ini file: $iniPath/$fileName.append" );
}
unset( $baseIni );