當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ZLanguage::translateLegacyCode方法代碼示例

本文整理匯總了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;
 }
開發者ID:,項目名稱:,代碼行數:35,代碼來源:

示例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;
 }
開發者ID:nmpetkov,項目名稱:Ephemerides,代碼行數:16,代碼來源:Installer.php

示例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;
 }
開發者ID:robbrandt,項目名稱:Content,代碼行數:41,代碼來源:Installer.php

示例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;
}
開發者ID:robbrandt,項目名稱:AdminMessages,代碼行數:19,代碼來源:pninit.php

示例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;
    }
開發者ID:projectesIF,項目名稱:Sirius,代碼行數:23,代碼來源:Installer.php


注:本文中的ZLanguage::translateLegacyCode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。