当前位置: 首页>>代码示例>>PHP>>正文


PHP compileLanguage函数代码示例

本文整理汇总了PHP中compileLanguage函数的典型用法代码示例。如果您正苦于以下问题:PHP compileLanguage函数的具体用法?PHP compileLanguage怎么用?PHP compileLanguage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了compileLanguage函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: install

 function install($aParams)
 {
     $bInclude = @(include $this->sFilePath);
     if (!$bInclude || empty($LANG) || empty($LANG_INFO) || !$this->_addLanguage($LANG, $LANG_INFO)) {
         return array('operation_title' => _t('_adm_txt_modules_operation_install', $this->_aConfig['title']), 'message' => 'Language file parse error or such language already exists: ' . $this->sFileName, 'result' => false);
     }
     $iLangId = getLangIdByName($LANG_INFO['Name']);
     $this->_recompileLanguageForAllModules($iLangId);
     compileLanguage($iLangId);
     return parent::install($aParams);
 }
开发者ID:toxalot,项目名称:dolphin.pro,代码行数:11,代码来源:installer.php

示例2: assureCompiled

 function assureCompiled($language)
 {
     if (file_exists(langFile($language))) {
         return true;
     } else {
         $language = get_magic_quotes_gpc() ? $language : addslashes($language);
         $langID = mysql_query("SELECT `ID` FROM `LocalizationLanguages` WHERE `Name` = '{$language}'");
         if (mysql_num_rows($langID) <= 0) {
             return false;
         }
         $langID = mysql_fetch_row($langID);
         $langID = $langID[0];
         return compileLanguage($langID);
     }
 }
开发者ID:BackupTheBerlios,项目名称:dolphin-dwbn-svn,代码行数:15,代码来源:languages.inc.php

示例3: actionUpdateLanguages

 function actionUpdateLanguages($bInstall = true)
 {
     global $MySQL;
     $aLanguages = $MySQL->getAll("SELECT `ID` AS `id`, `Name` AS `name`, `Title` AS `title` FROM `sys_localization_languages`");
     //--- Process languages' key=>value pears ---//
     $sModuleConfig = $this->_sHomePath . 'install/config.php';
     if (!file_exists($sModuleConfig)) {
         return array('code' => BX_DOL_INSTALLER_FAILED, 'content' => '_adm_txt_modules_module_config_not_found');
     }
     include $sModuleConfig;
     $iCategoryId = (int) $MySQL->getOne("SELECT `ID` FROM `sys_localization_categories` WHERE `Name`='" . $aConfig['language_category'] . "' LIMIT 1");
     foreach ($aLanguages as $aLanguage) {
         $this->_updateLanguage($bInstall, $aLanguage, $iCategoryId);
     }
     //--- Recompile all language files ---//
     $aResult = array();
     foreach ($aLanguages as $aLanguage) {
         $bResult = compileLanguage($aLanguage['id']);
         if (!$bResult) {
             $aResult[] = $aLanguage['title'];
         }
     }
     return empty($aResult) ? BX_DOL_INSTALLER_SUCCESS : array('code' => BX_DOL_INSTALLER_FAILED, 'content' => $aResult);
 }
开发者ID:Arvindvi,项目名称:dolphin,代码行数:24,代码来源:BxDolUpdater.php

示例4: updateLangString

 function updateLangString($sKey, $sString)
 {
     if ($sKey == '') {
         return false;
     }
     $sKey_db = addslashes($sKey);
     $sString_db = addslashes($sString);
     $sQuery = "SELECT `ID` FROM `sys_localization_keys` WHERE `Key` = '{$sKey_db}'";
     $iKeyID = (int) db_value($sQuery);
     if (!$iKeyID) {
         //create key
         $sQuery = "INSERT INTO `sys_localization_keys` (`IDCategory`,`Key`) VALUES (32,'{$sKey_db}')";
         db_res($sQuery);
         $iKeyID = db_last_id();
     }
     $sQuery = "\n            SELECT COUNT( * ) FROM `sys_localization_strings`\n            WHERE `IDKey` = {$iKeyID} AND `IDLanguage` = {$this->sLangID}";
     $iCount = (int) db_value($sQuery);
     if ($iCount) {
         $sQuery = "\n                UPDATE `sys_localization_strings`\n                SET `String` = '{$sString_db}'\n                WHERE `IDKey` = {$iKeyID} AND `IDLanguage` = {$this->sLangID}";
         db_res($sQuery);
     } else {
         $sQuery = "INSERT INTO `sys_localization_strings` VALUES ( {$iKeyID}, {$this->sLangID}, '{$sString_db}' )";
         db_res($sQuery);
     }
     compileLanguage($this->sLangID);
 }
开发者ID:Arvindvi,项目名称:dolphin,代码行数:26,代码来源:BxDolPFM.php

示例5: manageLanguagesBlock

function manageLanguagesBlock()
{
    global $site;
    function copyLanguage()
    {
        $newLangName = get_magic_quotes_gpc() ? $_POST['CopyLanguage_Name'] : addslashes($_POST['CopyLanguage_Name']);
        $sFlag = htmlspecialchars_adv($_POST['Flag']);
        $sourceLangID = (int) $_POST['CopyLanguage_SourceLangID'];
        if (strlen($newLangName) <= 0) {
            return '<font color="red">Error: please specify a name for the new language.</font>';
        }
        mysql_query("\r\n\t\t\tINSERT INTO `LocalizationLanguages`\r\n\t\t\t(`Name`, `Flag`) VALUES\r\n\t\t\t('{$newLangName}', '{$sFlag}')\r\n\t\t");
        if (mysql_affected_rows() <= 0) {
            return '<font color="red">Error: could not add a new language to the database.</font>';
        }
        $newLangID = mysql_insert_id();
        $resSourceLangStrings = mysql_query("\r\n\t\t\tSELECT\t`IDKey`, `String`\r\n\t\t\tFROM\t`LocalizationStrings`\r\n\t\t\tWHERE\t`IDLanguage` = {$sourceLangID}\r\n\t\t");
        while ($arr = mysql_fetch_assoc($resSourceLangStrings)) {
            $arr['String'] = addslashes($arr['String']);
            mysql_query("\r\n\t\t\t\tINSERT INTO `LocalizationStrings`\r\n\t\t\t\t(`IDKey`, `IDLanguage`, `String`) VALUES\r\n\t\t\t\t('{$arr['IDKey']}', {$newLangID}, '{$arr['String']}')\r\n\t\t\t\t");
            if (mysql_affected_rows() <= 0) {
                return '<font color="red">Error: could not add a language string to the database.</font>';
            }
        }
        return '<font color="green"><b>' . htmlspecialchars(stripslashes($newLangName)) . '</b> language has been successfully created.</font>';
    }
    function getLangName($langID)
    {
        $langName = mysql_query('SELECT `Name` FROM `LocalizationLanguages` WHERE `ID` = ' . (int) $langID);
        $langName = mysql_fetch_row($langName);
        return $langName[0];
    }
    if ($_POST['CopyLanguage']) {
        $resultMsg = copyLanguage();
    } else {
        if (isset($_POST['CompileLanguage'])) {
            $langName = getLangName($_POST['CompileLanguage']);
            if (compileLanguage((int) $_POST['CompileLanguage'])) {
                $resultMsg = '<font color="green"><b>' . htmlspecialchars($langName) . '</b> language has been successfully compiled.</font>';
            } else {
                $resultMsg = '<font color="red>Error: could not compile a language.</font>';
            }
        } else {
            if (isset($_POST['DeleteLanguage'])) {
                $langName = getLangName($_POST['DeleteLanguage']);
                if ($langName == getParam('lang_default')) {
                    $resultMsg = '<font color="red">Cannot delete the default language. You have to set another default language for the site in <b>global settings -> Change language settings</b> to be able to delete this one.</font>';
                } else {
                    if (deleteLanguage((int) $_POST['DeleteLanguage'])) {
                        $resultMsg = '<font color="green"><b>' . htmlspecialchars($langName) . '</b> language has been successfully removed.</font>';
                    } else {
                        $resultMsg = '<font color="red">Error: could not delete a language.</font>';
                    }
                }
            }
        }
    }
    ob_start();
    $arrLangs = getLocalizationLanguages();
    displayLanguageSettings();
    $contents = ob_get_contents();
    ob_end_clean();
    $sCon1 = panelSection('Language', $contents);
    ob_start();
    ?>
<form action="<?php 
    echo $_SERVER['PHP_SELF'];
    ?>
" method="post" style="margin:0px">
New language:
<input type="text" name="CopyLanguage_Name" style="width: 80px" />
Copy from:
<select name="CopyLanguage_SourceLangID" style="width: 80px">
<?php 
    foreach ($arrLangs as $langID => $langName) {
        ?>
	<option value="<?php 
        echo $langID;
        ?>
"><?php 
        echo htmlspecialchars($langName);
        ?>
</option>
<?php 
    }
    ?>
</select>
Flag: 
<?php 
    echo showLangIcons();
    ?>
<br />
<br />
<center>
<input type="submit" name="CopyLanguage" value="Create" />
</center>
</form>
<br />
<?php 
    if (strlen($resultMsg) > 0) {
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:dolphin-dwbn-svn,代码行数:101,代码来源:lang_file.php

示例6: updateLangFile

function updateLangFile($key, $string)
{
    // clear from special chars ;
    $key = preg_replace('|\\{([^\\}]+)\\}|', '', $key);
    $langName = getParam('lang_default');
    $langID = db_value("SELECT `ID` FROM `sys_localization_languages` WHERE `Name` = '" . addslashes($langName) . "'");
    $keyID = db_value("SELECT `ID` FROM `sys_localization_keys` WHERE `Key` = '" . process_db_input($key) . "'");
    if ($keyID) {
        db_res("UPDATE `sys_localization_strings` SET `String` = '" . process_db_input($string) . "' WHERE `IDKey`={$keyID} AND `IDLanguage`={$langID}");
    } else {
        db_res("INSERT INTO `sys_localization_keys` SET `IDCategory` = 2, `Key` = '" . process_db_input($key) . "'");
        db_res("INSERT INTO `sys_localization_strings` SET `IDKey` = " . db_last_id() . ", `IDLanguage` = {$langID}, `String` = '" . process_db_input($string) . "'");
    }
    compileLanguage($langID);
}
开发者ID:noormcs,项目名称:studoro,代码行数:15,代码来源:member_menu_compose.php

示例7: actionUpdateLanguages

 function actionUpdateLanguages($bInstall = true)
 {
     $aLanguages = array();
     $rLanguages = db_res("SELECT `ID` AS `id`, `Name` AS `name`, `Title` AS `title` FROM `sys_localization_languages`");
     while ($aLanguage = mysql_fetch_assoc($rLanguages)) {
         $aLanguages[] = $aLanguage;
     }
     //--- Process Language Category ---//
     $iCategoryId = 100;
     $sCategoryName = isset($this->_aConfig['language_category']) ? $this->_aConfig['language_category'] : '';
     if ($bInstall && !empty($sCategoryName)) {
         db_res("INSERT IGNORE INTO `sys_localization_categories` SET `Name`='" . $sCategoryName . "'");
         if (db_affected_rows() <= 0) {
             $iCategoryId = (int) db_value("SELECT `ID` FROM `sys_localization_categories` WHERE `Name`='" . $sCategoryName . "' LIMIT 1");
         } else {
             $iCategoryId = db_last_id();
         }
     } else {
         if (!$bInstall && !empty($sCategoryName)) {
             db_res("DELETE FROM `sys_localization_categories` WHERE `Name`='" . $sCategoryName . "'");
         }
     }
     //--- Process languages' key=>value pears ---//
     foreach ($aLanguages as $aLanguage) {
         $this->_updateLanguage($bInstall, $aLanguage, $iCategoryId);
     }
     //--- Recompile all language files ---//
     $aResult = array();
     foreach ($aLanguages as $aLanguage) {
         $bResult = compileLanguage($aLanguage['id']);
         if (!$bResult) {
             $aResult[] = $aLanguage['title'];
         }
     }
     return empty($aResult) ? BX_DOL_INSTALLER_SUCCESS : array('code' => BX_DOL_INSTALLER_FAILED, 'content' => $aResult);
 }
开发者ID:Gotgot59,项目名称:dolphin.pro,代码行数:36,代码来源:BxDolInstaller.php

示例8: updateLangFile

function updateLangFile($key, $string)
{
    global $sTableName;
    $langName = getParam('lang_default');
    $langID = db_value("SELECT `ID` FROM `LocalizationLanguages` WHERE `Name` = '" . addslashes($langName) . "'");
    $keyID = db_value("SELECT `ID` FROM `LocalizationKeys` WHERE `Key` = '" . process_db_input($key) . "'");
    if ($keyID) {
        db_res("UPDATE `LocalizationStrings` SET `String` = '" . process_db_input($string) . "' WHERE `IDKey`={$keyID} AND `IDLanguage`={$langID}");
    } else {
        db_res("INSERT INTO `LocalizationKeys` SET `IDCategory` = 2, `Key` = '" . process_db_input($key) . "'");
        db_res("INSERT INTO `LocalizationStrings` SET `IDKey` = " . mysql_insert_id() . ", `IDLanguage` = {$langID}, `String` = '" . process_db_input($string) . "'");
    }
    compileLanguage($langID);
}
开发者ID:BackupTheBerlios,项目名称:dolphin-dwbn-svn,代码行数:14,代码来源:pageComposer.php

示例9: performInstallLanguages

function performInstallLanguages()
{
    db_res("TRUNCATE TABLE `sys_localization_languages`");
    db_res("TRUNCATE TABLE `sys_localization_keys`");
    db_res("TRUNCATE TABLE `sys_localization_strings`");
    if (!($sLangsDir = opendir(BX_DIRECTORY_PATH_ROOT . 'install/langs/'))) {
        return;
    }
    while (false !== ($sFilename = readdir($sLangsDir))) {
        if (substr($sFilename, -3) == 'php') {
            unset($LANG);
            unset($LANG_INFO);
            require_once BX_DIRECTORY_PATH_ROOT . 'install/langs/' . $sFilename;
            walkThroughLanguage($LANG, $LANG_INFO);
        }
    }
    closedir($sLangsDir);
    compileLanguage();
}
开发者ID:Arvindvi,项目名称:dolphin,代码行数:19,代码来源:index.php

示例10: updateLangFile

function updateLangFile($key, $string)
{
    $langName = getParam('lang_default');
    $langID = db_value("SELECT `ID` FROM `sys_localization_languages` WHERE `Name` = '" . addslashes($langName) . "'");
    $keyID = db_value("SELECT `ID` FROM `sys_localization_keys` WHERE `Key` = '" . process_db_input($key) . "'");
    if ($keyID) {
        db_res("UPDATE `sys_localization_strings` SET `String` = '" . process_db_input($string) . "' WHERE `IDKey`='{$keyID}' AND `IDLanguage`='{$langID}'");
    } else {
        db_res("INSERT INTO `sys_localization_keys` SET `IDCategory` = 2, `Key` = '" . process_db_input($key) . "'");
        db_res("INSERT INTO `sys_localization_strings` SET `IDKey` = " . db_last_id() . ", `IDLanguage` = '{$langID}', `String` = '" . process_db_input($string) . "'");
    }
    compileLanguage($langID);
}
开发者ID:noormcs,项目名称:studoro,代码行数:13,代码来源:nav_menu_compose.php

示例11: importLanguage

function importLanguage(&$aData, &$aFiles)
{
    global $MySQL;
    $sTmpPath = $GLOBALS['dir']['tmp'] . mktime() . ".php";
    if (!file_exists($aFiles['ImportLanguage_File']['tmp_name']) || !move_uploaded_file($aFiles['ImportLanguage_File']['tmp_name'], $sTmpPath)) {
        return '_adm_txt_langs_cannot_upload_file';
    }
    require_once $sTmpPath;
    $aLangInfo = isset($aLangInfo) ? $aLangInfo : $LANG_INFO;
    $aLangContent = isset($aLangContent) ? $aLangContent : $LANG;
    if (empty($aLangInfo) || empty($aLangContent)) {
        return '_adm_txt_langs_cannot_create';
    }
    if (_checkLangUnique($aLangInfo['Name']) === true) {
        return '_adm_txt_langs_cannot_create';
    }
    $mixedResult = $MySQL->query("INSERT INTO `sys_localization_languages` (`Name`, `Flag`, `Title`, `Direction`, `LanguageCountry`) \n                                  VALUES (?, ?, ?, ?, ?)", [$aLangInfo['Name'], $aLangInfo['Flag'], $aLangInfo['Title'], $aLangInfo['Direction'], $aLangInfo['LanguageCountry']]);
    if ($mixedResult === false) {
        @unlink($sTmpPath);
        return '_adm_txt_langs_cannot_create';
    }
    $iId = (int) $MySQL->lastId();
    $MySQL->cleanCache('sys_localization_languages');
    $aKeys = $MySQL->getAllWithKey("SELECT `ID` AS `id`, `Key` AS `key` FROM `sys_localization_keys`", "key");
    foreach ($aLangContent as $sKey => $sString) {
        if (!isset($aKeys[$sKey])) {
            continue;
        }
        $MySQL->query("INSERT INTO `sys_localization_strings`(`IDKey`, `IDLanguage`, `String`) VALUES ('" . $aKeys[$sKey]['id'] . "', " . $iId . ", '" . addslashes($sString) . "')");
    }
    compileLanguage($iId);
    @unlink($sTmpPath);
    return '_adm_txt_langs_success_import';
}
开发者ID:Prashank25,项目名称:dolphin.pro,代码行数:34,代码来源:lang_file.php

示例12: addStringToLanguage

function addStringToLanguage($langKey, $langString, $langID = -1, $categoryID = BX_DOL_LANGUAGE_CATEGORY_SYSTEM)
{
    // input validation
    $langID = (int) $langID;
    $categoryID = (int) $categoryID;
    if ($langID == -1) {
        $resLangs = db_res('SELECT `ID`, `Name` FROM `sys_localization_languages`');
    } else {
        $resLangs = db_res('
            SELECT	`ID`, `Name`
            FROM	`sys_localization_languages`
            WHERE	`ID` = ' . $langID);
    }
    $langKey = process_db_input($langKey, BX_TAGS_STRIP);
    $langString = process_db_input($langString, BX_TAGS_VALIDATE);
    $resInsertKey = db_res("\n        INSERT INTO\t`sys_localization_keys`\n        SET\t\t\t`IDCategory` = {$categoryID},\n                    `Key` = '{$langKey}'", false);
    if (!$resInsertKey || db_affected_rows() <= 0) {
        return false;
    }
    $keyID = db_last_id();
    while ($arrLanguage = mysql_fetch_assoc($resLangs)) {
        $resInsertString = db_res("\n            INSERT INTO\t`sys_localization_strings`\n            SET\t\t\t`IDKey` = {$keyID},\n                        `IDLanguage` = {$arrLanguage['ID']},\n                        `String` = '{$langString}'", false);
        if (!$resInsertString || db_affected_rows() <= 0) {
            return false;
        }
        compileLanguage($arrLanguage['ID']);
    }
    return true;
}
开发者ID:Gotgot59,项目名称:dolphin.pro,代码行数:29,代码来源:languages.inc.php

示例13: edit_or_add_field


//.........这里部分代码省略.........
    $type = '';
    // Generate field type for Profiles table.
    switch ($field_type) {
        case 'c':
            $type = 'VARCHAR(255)';
            break;
        case 'e':
        case 'rb':
            $arr = explode("\r\n", $_POST['choices']);
            $type = '';
            foreach ($arr as $value) {
                $value = process_pass_data($value);
                $value = str_replace("'", '`', $value);
                $replace_arr = array(' ', '.', ',', "\\");
                $value = str_replace($replace_arr, '_', $value);
                $type = cat_string($type, "'{$value}'");
            }
            $type = "ENUM ({$type})";
            break;
        case 'a':
            $type = 'MEDIUMTEXT';
            break;
        case 'set':
            $arr = explode("\r\n", $_POST['choices']);
            $type = '';
            foreach ($arr as $value) {
                $value = process_pass_data($value);
                $value = str_replace("'", '`', $value);
                $replace_arr = array(' ', '.', ',', "\\");
                $value = str_replace($replace_arr, '_', $value);
                $type = cat_string($type, "'{$value}'");
            }
            $type = "SET ({$type})";
            break;
    }
    if ($field_type != '0' && 'add' == $_GET['action']) {
        // Generate query to add new field to Profiles.
        $vals = split(",", $name);
        $db_name = $vals[0];
        $q_str = "ALTER TABLE `Profiles` ADD `{$db_name}` {$type} NOT NULL";
        db_res($q_str);
    }
    // Generate language file content.
    $lang_file = '';
    $langFailFields = '';
    if ($namedisp_changed) {
        $lang_file .= "'{$_POST['caption']}';<br />";
        if (!addStringToLanguage($namedisp, $_POST['caption']) && !updateStringInLanguage($namedisp, $_POST['caption'])) {
            $langFailFields .= "'{$namedisp}';<br />";
        }
    }
    if ($namenote_changed && $namenote) {
        $lang_file .= "'{$_POST['desc']}';<br />";
        if (!addStringToLanguage($namenote, $_POST['desc']) && !updateStringInLanguage($namenote, $_POST['desc'])) {
            $langFailFields .= "'{$namenote}';<br />";
        }
    }
    // Error message.
    if ($err_msg_changed) {
        $lang_file .= "'{$_POST['err_msg']}';<br />";
        if (!addStringToLanguage($err_msg, $_POST['err_msg']) && !updateStringInLanguage($err_msg, $_POST['err_msg'])) {
            $langFailFields .= "'{$err_msg}';<br />";
        }
    }
    // Drop-down box options.
    if ($_POST['choices']) {
        $arr = explode("\r\n", $_POST['choices']);
        foreach ($arr as $value) {
            $value = process_pass_data($value);
            $entered_value = $value;
            $value = str_replace("'", '`', $value);
            $replace_arr = array(' ', '.', ',', "\\");
            $value = str_replace($replace_arr, '_', $value);
            $lang_file .= "'{$entered_value}';<br />";
            if (!addStringToLanguage("_{$value}", $entered_value) && !updateStringInLanguage("_{$value}", $entered_value)) {
                $langFailFields .= "'{$entered_value}';<br />";
            }
        }
    }
    // Compile language files if needed
    if (strlen($lang_file)) {
        compileLanguage();
    }
    if ('add' == $_GET['action']) {
        echo "<p><span style=\"color:#ff6666;font-weight:bold\">New field has been added.</span></p>";
    } else {
        if ('edit' == $_GET['action']) {
            echo "<p><span style=\"color:#ff6666;font-weight:bold\">Field has been updated.</span></p>";
        }
    }
    if (strlen($lang_file)) {
        echo "Following strings were added or updated in your language files:<br />";
        echo "<pre>{$lang_file}</pre>";
        if (strlen($langFailFields)) {
            echo "Fail to insert or update following strings:<br />";
            echo "<pre>{$langFailFields}</pre>";
        }
    }
    echo "<p><a href=\"profile_fields.php\">Continue</a></p>";
}
开发者ID:BackupTheBerlios,项目名称:dolphin-dwbn-svn,代码行数:101,代码来源:profile_fields.php

示例14: checkLangExists

function checkLangExists($sLang)
{
    global $dir;
    if (file_exists("{$dir['root']}langs/lang-{$sLang}.php")) {
        return true;
    }
    $sQuery = "SELECT `ID` FROM `LocalizationLanguages` WHERE `Name` = '{$sLang}'";
    $iLangID = (int) db_value($sQuery);
    if (!$iLangID) {
        return false;
    }
    if (compileLanguage($iLangID)) {
        return true;
    }
    return false;
}
开发者ID:BackupTheBerlios,项目名称:dolphin-dwbn-svn,代码行数:16,代码来源:languages.inc.php


注:本文中的compileLanguage函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。