本文整理汇总了PHP中eZINI::create方法的典型用法代码示例。如果您正苦于以下问题:PHP eZINI::create方法的具体用法?PHP eZINI::create怎么用?PHP eZINI::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZINI
的用法示例。
在下文中一共展示了eZINI::create方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
$extension = ( $exploded[0] === 'extension' || $exploded[0] === 'ext-siteaccess' )
? $exploded[1]
: false;
$path = 'settings/override';
if ( $placement === 'siteaccess' )
$path = "settings/siteaccess/$currentSiteAccess";
elseif ( $exploded[0] === 'extension' && $extension !== false )
$path = "extension/$extension/settings";
elseif ( $exploded[0] === 'ext-siteaccess' && $extension !== false )
$path = "extension/$extension/settings/siteaccess/$currentSiteAccess";
// We should use "reference" if multiply removing of ini setting.
// if eZINI::instance() is called twice instance will be fetched from GLOBAL variable.
// Without reference there will be a inconsistency with GLOBAL instance and stored ini file.
$iniTemp = eZINI::create( $settingFile . '.append.php', $path, null, null, null );
$iniTemp->removeSetting( $block, $setting );
$iniTemp->save();
}
}
}
if ( $http->hasPostVariable( 'ChangeINIFile' ) or
( $Params['SiteAccess'] and $Params['INIFile'] ) )
{
if ( $GLOBALS['eZCurrentAccess']['name'] !== $currentSiteAccess )
{
// create a site ini instance using $useLocalOverrides
$siteIni = eZSiteAccess::getIni( $currentSiteAccess, 'site.ini' );
// load settings file with $useLocalOverrides = true & $addArrayDefinition = true
示例2: updateINI_1_4_0
function updateINI_1_4_0()
{
showMessage2("Updating INI-files...");
$siteaccessList = getUserInput("Please specify the eZ webin siteaccesses on your site (separated with space, for example eng nor): ");
$siteaccessList = explode(' ', $siteaccessList);
$translationSA = array();
foreach ($siteaccessList as $siteaccess) {
if (!file_exists('settings/siteaccess/' . $siteaccess)) {
continue;
}
/* Update override.ini.append.php part */
$settings = array('full_silverlight' => array('Source' => 'node/view/full.tpl', 'MatchFile' => 'full/silverlight.tpl', 'Subdir' => 'templates', 'Match' => array('class_identifier' => 'silverlight')), 'line_silverlight' => array('Source' => 'node/view/line.tpl', 'MatchFile' => 'line/silverlight.tpl', 'Subdir' => 'templates', 'Match' => array('class_identifier' => 'silverlight')), 'edit_ezsubtreesubscription_forum_topic' => array('Source' => 'content/datatype/edit/ezsubtreesubscription.tpl', 'MatchFile' => 'datatype/edit/ezsubtreesubscription/forum_topic.tpl', 'Subdir' => 'templates', 'Match' => array('class_identifier' => 'forum_topic')));
$ini = eZINI::instance('override.ini', 'settings/siteaccess/' . $siteaccess, null, null, false, true);
$ini->setReadOnlySettingsCheck(false);
$ini->setVariables($settings);
$ini->save(false, '.append.php', false, false, 'settings/siteaccess/' . $siteaccess, false);
/* Get site.ini for ContentObjectLocale code */
$ini = eZINI::instance('site.ini', 'settings/siteaccess/' . $siteaccess, null, null, false, true);
$contentObjectLocale = explode('-', $ini->variable('RegionalSettings', 'ContentObjectLocale'));
$translationSA[$siteaccess] = ucfirst($contentObjectLocale[0]);
}
$settings = array(array('name' => 'site.ini', 'settings' => array('RegionalSettings' => array('TranslationSA' => $translationSA))), array('name' => 'content.ini', 'settings' => array('table' => array('CustomAttributes' => array('0' => 'summary', '1' => 'caption')), 'td' => array('CustomAttributes' => array('0' => 'valign')), 'th' => array('CustomAttributes' => array('0' => 'scope', '1' => 'abbr', '2' => 'valign')), 'CustomTagSettings' => array('AvailableCustomTags' => array('0' => 'underline'), 'IsInline' => array('underline' => 'true')), 'embed-type_images' => array('AvailableClasses' => array()))), array('name' => 'ezoe_attributes.ini', 'settings' => array('CustomAttribute_table_summary' => array('Name' => 'Summary (WAI)', 'Required' => 'true'), 'CustomAttribute_scope' => array('Name' => 'Scope', 'Title' => 'The scope attribute defines a way to associate header cells and data cells in a table.', 'Type' => 'select', 'Selection' => array('0' => '', 'col' => 'Column', 'row' => 'Row')), 'CustomAttribute_valign' => array('Title' => 'Lets you define the vertical alignment of the table cell/ header.', 'Type' => 'select', 'Selection' => array('0' => '', 'top' => 'Top', 'middle' => 'Middle', 'bottom' => 'Bottom', 'baseline' => 'Baseline')), 'Attribute_table_border' => array('Type' => 'htmlsize', 'AllowEmpty' => 'true'), 'CustomAttribute_embed_offset' => array('Type' => 'int', 'AllowEmpty' => 'true'), 'CustomAttribute_embed_limit' => array('Type' => 'int', 'AllowEmpty' => 'true'))), array('name' => 'ezxml.ini', 'settings' => array('TagSettings' => array('TagPresets' => array('0' => '', 'mini' => 'Simple formatting')))));
foreach ($settings as $setting) {
$iniName = $setting['name'];
$onlyModified = false;
if (file_exists('settings/override/' . $iniName . '.append') || file_exists('settings/override/' . $iniName . '.append.php')) {
$ini = eZINI::instance($iniName, 'settings/override', null, null, false, true);
} else {
$ini = eZINI::create($iniName, 'settings/override');
$onlyModified = true;
}
$ini->setReadOnlySettingsCheck(false);
$ini->setVariables($setting['settings']);
$ini->save(false, '.append.php', false, $onlyModified, 'settings/override', false);
}
}
示例3: initializePackage
//.........这里部分代码省略.........
$installParameters['ini'] = array();
$siteINIChanges = array();
$url = $siteType['url'];
if (preg_match("#^[a-zA-Z0-9]+://(.*)\$#", $url, $matches)) {
$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) {
示例4: processPostData
function processPostData()
{
$primaryLanguage = $this->Http->postVariable('eZSetupDefaultLanguage');
$languages = $this->Http->hasPostVariable('eZSetupLanguages') ? $this->Http->postVariable('eZSetupLanguages') : array();
if (!in_array($primaryLanguage, $languages)) {
$languages[] = $primaryLanguage;
}
$regionalInfo = array();
$regionalInfo['language_type'] = 1;
$regionalInfo['primary_language'] = $primaryLanguage;
$regionalInfo['languages'] = $languages;
$regionalInfo['enable_unicode'] = true;
$regionalInfo['site_charset'] = 'utf-8';
$this->PersistenceList['regional_info'] = $regionalInfo;
$charset = false;
//SP experimental code 26.04.2007 commented "if"
// if ( !isset( $this->PersistenceList['database_info']['use_unicode'] ) ||
// $this->PersistenceList['database_info']['use_unicode'] == false )
// {
// If we have already figured out charset and it is utf-8
// we don't have to check the new languages
if (isset($this->PersistenceList['regional_info']['site_charset']) and $this->PersistenceList['regional_info']['site_charset'] == 'utf-8') {
$charset = 'utf-8';
} else {
$primaryLanguage = null;
$allLanguages = array();
$allLanguageCodes = array();
$variationsLanguages = array();
$primaryLanguageCode = $this->PersistenceList['regional_info']['primary_language'];
$extraLanguageCodes = isset($this->PersistenceList['regional_info']['languages']) ? $this->PersistenceList['regional_info']['languages'] : array();
$extraLanguageCodes = array_diff($extraLanguageCodes, array($primaryLanguageCode));
/*
if ( isset( $this->PersistenceList['regional_info']['variations'] ) )
{
$variations = $this->PersistenceList['regional_info']['variations'];
foreach ( $variations as $variation )
{
$locale = eZLocale::create( $variation );
if ( $locale->localeCode() == $primaryLanguageCode )
{
$primaryLanguage = $locale;
}
else
{
$variationsLanguages[] = $locale;
}
}
}
*/
if ($primaryLanguage === null) {
$primaryLanguage = eZLocale::create($primaryLanguageCode);
}
$allLanguages[] = $primaryLanguage;
foreach ($extraLanguageCodes as $extraLanguageCode) {
$allLanguages[] = eZLocale::create($extraLanguageCode);
$allLanguageCodes[] = $extraLanguageCode;
}
$canUseUnicode = isset($this->PersistenceList['database_info']['use_unicode']) ? $this->PersistenceList['database_info']['use_unicode'] : false;
$charset = $this->findAppropriateCharset($primaryLanguage, $allLanguages, $canUseUnicode);
if (!$charset) {
$this->Error = 1;
return false;
}
}
// Store the charset for later handling
$this->PersistenceList['regional_info']['site_charset'] = $charset;
//SP experimental code 26.04.2007 commented "if"
// }
if ($this->PersistenceList['regional_info']['site_charset']) {
$i18nINI = eZINI::create('i18n.ini');
// Set ReadOnlySettingsCheck to false: towards
// Ignore site.ini[eZINISettings].ReadonlySettingList[] settings when saving ini variables.
$i18nINI->setReadOnlySettingsCheck(false);
$i18nINI->setVariable('CharacterSettings', 'Charset', $this->PersistenceList['regional_info']['site_charset']);
$i18nINI->save(false, '.php', 'append', true);
}
return true;
}