本文整理汇总了PHP中ZLanguage::translateLegacyCode方法的典型用法代码示例。如果您正苦于以下问题:PHP ZLanguage::translateLegacyCode方法的具体用法?PHP ZLanguage::translateLegacyCode怎么用?PHP ZLanguage::translateLegacyCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZLanguage
的用法示例。
在下文中一共展示了ZLanguage::translateLegacyCode方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upgrade_MigrateLanguageCodes
public function upgrade_MigrateLanguageCodes()
{
$objArray = DBUtil::selectObjectArray('categories_category');
DBUtil::truncateTable('categories_category');
$newObjArray = array();
foreach ($objArray as $category) {
// translate display_name l3 -> l2
$data = unserialize($category['display_name']);
if (is_array($data)) {
$array = array();
foreach ($data as $l3 => $v) {
$l2 = ZLanguage::translateLegacyCode($l3);
if ($l2) {
$array[$l2] = $v;
}
}
$category['display_name'] = serialize($array);
}
// translate display_desc l3 -> l2
$data = unserialize($category['display_desc']);
if (is_array($data)) {
$array = array();
foreach ($data as $l3 => $v) {
$l2 = ZLanguage::translateLegacyCode($l3);
if ($l2) {
$array[$l2] = $v;
}
}
$category['display_desc'] = serialize($array);
}
// commit
DBUtil::insertObject($category, 'categories_category', 'id', true);
}
return;
}
示例2: ephemerides_upgrade_updateEphemeridesLanguages
private function ephemerides_upgrade_updateEphemeridesLanguages()
{
$obj = DBUtil::selectObjectArray('ephem');
if (count($obj) == 0) {
// nothing to do
return;
}
foreach ($obj as $ephemerid) {
// translate l3 -> l2
if ($l2 = ZLanguage::translateLegacyCode($ephemerid['language'])) {
$ephemerid['language'] = $l2;
}
DBUtil::updateObject($ephemerid, 'ephem', '', 'eid', true);
}
return true;
}
示例3: contentUpgrade_3_1_0
protected function contentUpgrade_3_1_0($oldVersion)
{
$tables = DBUtil::getTables();
// Fix serialisations
foreach (array('content' => 'id', 'history' => 'id', 'translatedcontent' => 'contentId') as $table => $idField) {
$obj = DBUtil::selectObjectArray('content_' . $table);
foreach ($obj as $contentItem) {
$data = DataUtil::mb_unserialize($contentItem['data']);
$contentItem['data'] = serialize($data);
DBUtil::updateObject($contentItem, 'content_' . $table, '', $idField, true);
}
}
// Add active and visiblefor columns in content_content and update tables for indexes etc.
DBUtil::changeTable('content_page');
DBUtil::changeTable('content_content');
// Fix language codes
// Loop through tables to update
foreach (array('page' => 'id', 'translatedcontent' => 'contentId', 'translatedpage' => 'pageId') as $tbl => $idField) {
$table = 'content_' . $tbl;
$obj = DBUtil::selectObjectArray($table);
// if there are records in this table
if (count($obj)) {
$newobj = array();
// Set up object to insert
/// Loop through all records in the table
foreach ($obj as $contentItem) {
// translate l3 -> l2
$l2 = ZLanguage::translateLegacyCode($contentItem['language']);
if ($l2) {
$newobj[] = array($idField => $contentItem[$idField], 'language' => $l2);
}
}
// If anything was updated, insert the object(s)
if (count($newobj)) {
DBUtil::updateObjectArray($newobj, $table, false, $idField);
}
}
// endif count($obj)
}
return true;
}
示例4: Admin_Messages_migrateLanguage
function Admin_Messages_migrateLanguage()
{
$obj = DBUtil::selectObjectArray('message');
if (count($obj) == 0) {
// nothing to do
return;
}
foreach ($obj as $message) {
if (empty($message['language'])) {
continue;
}
$l2 = ZLanguage::translateLegacyCode($message['language']);
if ($l2) {
$message['language'] = $l2;
DBUtil::updateObject($message, 'message', '', 'mid', true);
}
}
return;
}
示例5: _migrategtlanguage
/**
* Migrate the language dbfield to a gettext code
*/
private function _migrategtlanguage()
{
$obj = DBUtil::selectObjectArray('pages');
if (count($obj) == 0) {
// nothing to do
return;
}
foreach ($obj as $pageid) {
// translate l3 -> l2
if ($l2 = ZLanguage::translateLegacyCode($pageid['language'])) {
$pageid['language'] = $l2;
}
DBUtil::updateObject($pageid, 'pages', '', 'pageid', true);
}
return true;
}