本文整理汇总了PHP中eZPackage::languageInfoFromPackageList方法的典型用法代码示例。如果您正苦于以下问题:PHP eZPackage::languageInfoFromPackageList方法的具体用法?PHP eZPackage::languageInfoFromPackageList怎么用?PHP eZPackage::languageInfoFromPackageList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZPackage
的用法示例。
在下文中一共展示了eZPackage::languageInfoFromPackageList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
function init()
{
/*
if( $this->hasKickstartData() )
{
$data = $this->kickstartData();
return $this->kickstartContinueNextStep();
}
*/
//
// Get all available languages
//
$languages = false;
$defaultLanguage = false;
$defaultExtraLanguages = false;
eZSetupLanguageList($languages, $defaultLanguage, $defaultExtraLanguages);
//
// Get info about package and site languages
//
$siteLanguageLocaleList = $this->PersistenceList['regional_info']['languages'];
$packageNameList = array();
$packageLanguageLocaleList = array();
$sitePackageName = $this->chosenSitePackage();
$sitePackage = eZPackage::fetch($sitePackageName, false, false, false);
if (is_object($sitePackage)) {
$dependencies = $sitePackage->attribute('dependencies');
$requirements = $dependencies['requires'];
foreach ($requirements as $req) {
$packageNameList[] = $req['name'];
}
$packageLanguageLocaleList = eZPackage::languageInfoFromPackageList($packageNameList, false);
}
// Explicitly add 'eng-GB' cause clean data is in 'eng-GB'.
if (!in_array('eng-GB', $packageLanguageLocaleList)) {
$packageLanguageLocaleList[] = 'eng-GB';
}
//
// Exclude languages which exist both in packges and site.
//
$packageLanguageLocaleList = array_diff($packageLanguageLocaleList, $siteLanguageLocaleList);
if (count($packageLanguageLocaleList) > 0) {
//
// Get language names
//
$siteLanguageList = array();
$packageLanguageList = array();
foreach ($languages as $language) {
$locale = $language->attribute('locale_code');
$name = $language->attribute('intl_language_name');
if (in_array($locale, $siteLanguageLocaleList)) {
$siteLanguageList[] = array('locale' => $locale, 'name' => $name);
}
if (in_array($locale, $packageLanguageLocaleList)) {
$packageLanguageList[] = array('locale' => $locale, 'name' => $name);
}
}
$this->MissedPackageLanguageList = $packageLanguageList;
$this->SiteLanguageList = $siteLanguageList;
return false;
}
// There are no language conflicts => proceed with next step
return true;
}