本文整理汇总了PHP中eZINI::setVariable方法的典型用法代码示例。如果您正苦于以下问题:PHP eZINI::setVariable方法的具体用法?PHP eZINI::setVariable怎么用?PHP eZINI::setVariable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZINI
的用法示例。
在下文中一共展示了eZINI::setVariable方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testLoginUserGetGroupsTree
/**
* Test scenario for LDAP login using GetGroupsTree
* for issue #15334: LDAP GetGroupsTree should be able to find groups in multiple tree levels
*
* Test Outline
* ------------
* 1. Set LDAPGroupMappingType = GetGroupsTree
* 2. Login with username and password
* 3. Check parent nodes of user object
* 4. Login with username and password for another user
* 5. Check parent nodes of user object
*
* @result:
* The first user is placed in the newly created Empire and Sith groups
* (the following assertions are not executed)
* @expected:
* The first user is placed in the existing Empire and Sith groups
* The second user has two node assignments
* The first assignment is the existing RebelAlliance group
* The second assignment is the newly created Jedi group
* @link http://issues.ez.no/15334
*/
public function testLoginUserGetGroupsTree()
{
$this->ldapINI->setVariable('LDAPSettings', 'LDAPGroupMappingType', 'GetGroupsTree');
$this->ldapINI->setVariable('LDAPSettings', 'LDAPGroupNameAttribute', 'ou');
$this->ldapINI->setVariable('LDAPSettings', 'LDAPGroupMemberAttribute', 'seeAlso');
$this->ldapINI->setVariable('LDAPSettings', 'KeepGroupAssignment', 'disabled');
// The Empire and Sith groups already exist
$user = eZLDAPUser::loginUser('darth.vader', 'whosyourdaddy');
$contentObject = $user->attribute('contentobject');
$parentNodeIDs = $contentObject->attribute('parent_nodes');
sort($parentNodeIDs);
self::assertEquals(array($this->empireGroupNodeId, $this->sithGroupNodeId), $parentNodeIDs);
// Change the root node id, in order to create the Jedi group under the StarWars group
$this->ldapINI->setVariable('LDAPSettings', 'LDAPGroupRootNodeId', $this->starWarsGroupNodeId);
// Try a user with a group that is not in ezp
$user = eZLDAPUser::loginUser('obi.wan', 'thesearenotthedroids');
$contentObject = $user->attribute('contentobject');
$parentNodeIDs = $contentObject->attribute('parent_nodes');
sort($parentNodeIDs);
// The user should be assigned to 2 groups
self::assertEquals(2, count($parentNodeIDs));
// The RebelAlliance group already exists
$node0 = eZContentObjectTreeNode::fetch($parentNodeIDs[0]);
self::assertEquals(array($this->rebelGroupNodeId, $this->starWarsGroupNodeId, 'RebelAlliance'), array($parentNodeIDs[0], $node0->attribute('parent_node_id'), $node0->attribute('name')));
// The Jedi group is created by the login handler
$node1 = eZContentObjectTreeNode::fetch($parentNodeIDs[1]);
self::assertEquals(array($this->starWarsGroupNodeId, 'Jedi'), array($node1->attribute('parent_node_id'), $node1->attribute('name')));
}
示例2: foreach
foreach ($valueArray as $value) {
if (preg_match("/^\\[(.+)\\]\\=(.+)\$/", $value, $matches)) {
$valuesToWriteArray[$matches[1]] = trim($matches[2], "\r\n");
} else {
$value = substr(strchr($value, '='), 1);
if ($value == "") {
if ($settingCount == 0) {
$valuesToWriteArray[] = NULL;
}
} else {
$valuesToWriteArray[] = trim($value, "\r\n");
}
}
++$settingCount;
}
$ini->setVariable($block, $settingName, $valuesToWriteArray);
} else {
$ini->setVariable($block, $settingName, $valueToWrite);
}
$writeOk = $ini->save();
// false, false, false, false, true, true );
if (!$writeOk) {
$tpl->setVariable('validation_error', true);
$tpl->setVariable('validation_error_type', 'write_error');
$tpl->setVariable('path', $path);
$tpl->setVariable('filename', $iniFile . '.append.php');
} else {
return $Module->redirectTo('/settings/view/' . $siteAccess . '/' . $iniFile);
}
} else {
$tpl->setVariable('validation_error', true);
示例3: initializePackage
//.........这里部分代码省略.........
$url = $matches[1];
}
$siteINIChanges['SiteAccessSettings'] = array('RelatedSiteAccessList' => $accessMap['accesses']);
$siteINIChanges['ContentSettings'] = array('TranslationList' => implode(';', $extraLanguageCodes));
$siteINIChanges['SiteSettings'] = array('SiteName' => $siteType['title'], 'SiteURL' => $url);
$siteINIChanges['DatabaseSettings'] = array('DatabaseImplementation' => $dbDriver, 'Server' => $dbServer, 'Port' => $dbPort, 'Database' => $dbName, 'User' => $dbUser, 'Password' => $dbPwd, 'Charset' => false);
$siteINIChanges['FileSettings'] = array('VarDir' => 'var/' . $siteType['identifier']);
if (trim($dbSocket) != '') {
$siteINIChanges['DatabaseSettings']['Socket'] = $dbSocket;
} else {
$siteINIChanges['DatabaseSettings']['Socket'] = 'disabled';
}
if ($admin['email']) {
$siteINIChanges['InformationCollectionSettings'] = array('EmailReceiver' => false);
$siteINIChanges['UserSettings'] = array('RegistrationEmail' => false);
$siteINIChanges['MailSettings'] = array('AdminEmail' => $admin['email'], 'EmailSender' => false);
}
$siteINIChanges['RegionalSettings'] = array('Locale' => $primaryLanguage->localeFullCode(), 'ContentObjectLocale' => $primaryLanguage->localeCode(), 'SiteLanguageList' => $prioritizedLanguages);
if ($primaryLanguage->localeCode() == 'eng-GB') {
$siteINIChanges['RegionalSettings']['TextTranslation'] = 'disabled';
} else {
$siteINIChanges['RegionalSettings']['TextTranslation'] = 'enabled';
}
$installParameters['ini']['siteaccess'][$adminSiteaccessName]['site.ini.append'] = $siteINIChanges;
$installParameters['ini']['siteaccess'][$userSiteaccessName]['site.ini.append'] = $siteINIChanges;
$installParameters['ini']['siteaccess'][$userSiteaccessName]['site.ini']['DesignSettings'] = array('SiteDesign' => $userDesignName);
$installParameters['variables']['user_siteaccess'] = $userSiteaccessName;
$installParameters['variables']['admin_siteaccess'] = $adminSiteaccessName;
$installParameters['variables']['design'] = $userDesignName;
$tmpSiteINI = eZINI::create('site.ini');
// Set ReadOnlySettingsCheck to false: towards
// Ignore site.ini[eZINISettings].ReadonlySettingList[] settings when saving ini variables.
$tmpSiteINI->setReadOnlySettingsCheck(false);
$tmpSiteINI->setVariable('FileSettings', 'VarDir', $siteINIChanges['FileSettings']['VarDir']);
// Change the current translation variables, before other parts start using them
$tmpSiteINI->setVariable('RegionalSettings', 'Locale', $siteINIChanges['RegionalSettings']['Locale']);
$tmpSiteINI->setVariable('RegionalSettings', 'ContentObjectLocale', $siteINIChanges['RegionalSettings']['ContentObjectLocale']);
$tmpSiteINI->setVariable('RegionalSettings', 'TextTranslation', $siteINIChanges['RegionalSettings']['TextTranslation']);
$tmpSiteINI->save(false, '.append.php', false, true, "settings/siteaccess/{$userSiteaccessName}");
/*
$typeFunctionality = eZSetupFunctionality( $siteType['identifier'] );
$extraFunctionality = array_merge( isset( $this->PersistenceList['additional_packages'] ) ?
$this->PersistenceList['additional_packages'] :
array(),
$typeFunctionality['required'] );
$extraFunctionality = array_unique( $extraFunctionality );
*/
// Add a policy to permit editors using OE
eZPolicy::createNew(3, array('ModuleName' => 'ezoe', 'FunctionName' => '*'));
// Install site package and it's required packages
$sitePackageName = $this->chosenSitePackage();
$sitePackage = eZPackage::fetch($sitePackageName);
if (!is_object($sitePackage)) {
$resultArray['errors'][] = array('code' => 'EZSW-041', 'text' => " Could not fetch site package: '{$sitePackageName}'");
return false;
}
$dependecies = $sitePackage->attribute('dependencies');
$requires = $dependecies['requires'];
$requiredPackages = array();
// Include setting files
$settingsFiles = $sitePackage->attribute('settings-files');
foreach ($settingsFiles as $settingsFileName) {
if (file_exists($sitePackage->path() . '/settings/' . $settingsFileName)) {
include_once $sitePackage->path() . '/settings/' . $settingsFileName;
}
}
示例4: loadDummySettings
/**
* Method to initialize dummy settings, mostly in rest.ini
*/
protected function loadDummySettings()
{
$this->restINI->setVariable('ApiProvider', 'ProviderClass', array('test' => 'ezpRestTestApiProvider'));
}
示例5: onPublish
function onPublish($contentObjectAttribute, $contentObject, $publishedNodes)
{
$contentClassAttribute = $contentObjectAttribute->attribute('contentclass_attribute');
$section = $contentClassAttribute->attribute(self::CLASS_SECTION_FIELD);
$parameter = $contentClassAttribute->attribute(self::CLASS_PARAMETER_FIELD);
$iniInstanceArray = explode(';', $contentClassAttribute->attribute(self::CLASS_INI_INSTANCE_FIELD));
$siteAccessArray = explode(';', $contentClassAttribute->attribute(self::SITE_ACCESS_LIST_FIELD));
$filename = $contentClassAttribute->attribute(self::CLASS_FILE_FIELD);
$makeEmptyArray = $contentObjectAttribute->attribute('data_int');
foreach ($iniInstanceArray as $iniInstance) {
if ($iniInstance == 0) {
$path = 'settings/override';
} else {
$path = 'settings/siteaccess/' . $siteAccessArray[$iniInstance];
}
$config = new eZINI($filename . '.append', $path, null, false, null, true, true);
if ($config == null) {
eZDebug::writeError('Could not open ' . $path . '/' . $filename);
continue;
}
if ($contentClassAttribute->attribute(self::CLASS_TYPE_FIELD) == self::CLASS_TYPE_ARRAY) {
if ($contentObjectAttribute->attribute('data_text') != null) {
$iniArray = array();
eZIniSettingType::parseArrayInput($contentObjectAttribute->attribute('data_text'), $iniArray, $makeEmptyArray);
$config->setVariable($section, $parameter, $iniArray);
} else {
$config->removeSetting($section, $parameter);
}
} else {
$config->setVariable($section, $parameter, $contentObjectAttribute->attribute('data_text'));
eZDebug::writeNotice('Saved ini settings to file: ' . $path . '/' . $filename . "\n" . ' [' . $section . ']' . "\n" . ' ' . $parameter . '=' . $contentObjectAttribute->attribute('data_text'), __METHOD__);
}
$config->save();
}
}
示例6: eZINI
$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 );
unset( $ini );
// Remove variable from the global override
if ( $siteAccess != "global_override" )
{