$item) { if(!is_numeric($item) && !is_string($item)) { user_error("Bad value contained in dontInclude array, index $i: " . var_export($item,true), E_USER_WARNING); unset($dontInclude[$i]); } } // we accept in dontInclude both language codes and names, so another diff is required $usedlangs = array_diff( $usedlangs, array_flip($dontInclude) ); if (isset($usedlangs[Translatable::default_lang()])) unset($usedlangs[Translatable::default_lang()]); if ('Common-English' == $list) $languageList = i18n::get_common_languages(); else if ('Common-Native' == $list) $languageList = i18n::get_common_languages(true); else $languageList = i18n::get_locale_list(); $alllangs = array_diff( $languageList, (array)$usedlangs, $dontInclude ); $alllangs = array_flip(array_diff( array_flip($alllangs), $dontInclude )); if (isset($alllangs[Translatable::default_lang()])) unset($alllangs[Translatable::default_lang()]); asort($alllangs); if (count($usedlangs)) { asort($usedlangs); $labelAvail = _t('Form.LANGAVAIL', "Available languages"); $labelOther = _t('Form.LANGAOTHER', "Other languages"); parent::__construct($name, $title, array( $labelAvail => $usedlangs, $labelOther => $alllangs ), reset($usedlangs) ); } else { parent::__construct($name, $title, $alllangs); } } } ?>