本文整理汇总了PHP中eZINI::save方法的典型用法代码示例。如果您正苦于以下问题:PHP eZINI::save方法的具体用法?PHP eZINI::save怎么用?PHP eZINI::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZINI
的用法示例。
在下文中一共展示了eZINI::save方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: substr
$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);
$tpl->setVariable('validation_error_type', $validationResult['type']);
$tpl->setVariable('validation_error_message', $validationResult['message']);
}
} else {
示例2: initializePackage
//.........这里部分代码省略.........
$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;
}
}
// Call user function for additional setup tasks.
if (function_exists('eZSitePreInstall')) {
eZSitePreInstall($siteType);
}
// Make sure objects use the selected main language instead of eng-GB
示例3: unset
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" )
{
$ini = new eZINI( $fileName . '.append', "settings/override", null, null, null, true, true );
foreach( $settings as $setting )
{
if ( $ini->hasVariable( $setting[0], $setting[1] ) )
$ini->removeSetting( $setting[0], $setting[1] );
}
if ( !$ini->save() )
{
eZDebug::writeError( "Can't save ini file: $iniPath/$fileName.append" );
}
unset($ini);
}
}
$uri = $http->postVariable( 'RedirectURI', $http->sessionVariable( 'LastAccessedModifyingURI', '/' ) );
$module->redirectTo( $uri );
?>
示例4: 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();
}
}
示例5: trim
}
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 // found validation errors...
{