本文整理汇总了PHP中FWLanguage::init方法的典型用法代码示例。如果您正苦于以下问题:PHP FWLanguage::init方法的具体用法?PHP FWLanguage::init怎么用?PHP FWLanguage::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FWLanguage
的用法示例。
在下文中一共展示了FWLanguage::init方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: runRepublishing
public function runRepublishing()
{
$this->initRepublishing();
FWLanguage::init();
$langIds = array_keys(FWLanguage::getLanguageArray());
foreach ($langIds as $id) {
$this->createRSS($id);
}
}
示例2: modifyLanguage
//.........这里部分代码省略.........
if (!empty($_POST['submit']) and isset($_POST['addLanguage']) && $_POST['addLanguage'] == "true") {
//-----------------------------------------------
// Add new language with all variables
//-----------------------------------------------
if (!empty($_POST['newLangName']) and !empty($_POST['newLangShortname'])) {
$newLangShortname = addslashes(strip_tags($_POST['newLangShortname']));
$newLangName = addslashes(strip_tags($_POST['newLangName']));
$newLangCharset = addslashes(strip_tags($_POST['newLangCharset']));
$objResult = $objDatabase->Execute("SELECT lang FROM " . DBPREFIX . "languages WHERE lang='" . $newLangShortname . "'");
if ($objResult !== false) {
if ($objResult->RecordCount() >= 1) {
$this->strErrMessage = $_ARRAYLANG['TXT_DATABASE_QUERY_ERROR'];
return false;
} else {
$objDatabase->Execute("INSERT INTO " . DBPREFIX . "languages SET lang='" . $newLangShortname . "',\n name='" . $newLangName . "',\n charset='" . $newLangCharset . "',\n is_default='false'");
$newLanguageId = $objDatabase->Insert_ID();
if (!empty($newLanguageId)) {
$objResult = $objDatabase->SelectLimit("SELECT id FROM " . DBPREFIX . "languages WHERE is_default='true'", 1);
if ($objResult !== false && !$objResult->EOF) {
$defaultLanguage = $objResult->fields['id'];
$objResult = $objDatabase->Execute("SELECT varid,content,module FROM " . DBPREFIX . "language_variable_content WHERE 1 AND lang=" . $defaultLanguage);
if ($objResult !== false) {
while (!$objResult->EOF) {
$arrayLanguageContent[$objResult->fields['varid']] = stripslashes($objResult->fields['content']);
$arrayLanguageModule[$objResult->fields['varid']] = $objResult->fields['module'];
$objResult->MoveNext();
}
foreach ($arrayLanguageContent as $varid => $content) {
$LanguageModule = $arrayLanguageModule[$varid];
$objDatabase->Execute("INSERT INTO " . DBPREFIX . "language_variable_content SET varid=" . $varid . ", content='" . addslashes($content) . "', module=" . $LanguageModule . ", lang=" . $newLanguageId . ", status=0");
}
$this->strOkMessage = $_ARRAYLANG['TXT_NEW_LANGUAGE_ADDED_SUCCESSFUL'];
return true;
}
}
} else {
$this->strErrMessage = $_ARRAYLANG['TXT_DATABASE_QUERY_ERROR'];
return false;
}
}
}
}
} elseif (!empty($_POST['submit']) and $_POST['modLanguage'] == "true") {
$eventArgs = array('langRemovalStatus' => $langRemovalStatus);
$frontendLangIds = array_keys(\FWLanguage::getActiveFrontendLanguages());
$postLangIds = array_keys($_POST['langActiveStatus']);
foreach (array_keys(\FWLanguage::getLanguageArray()) as $langId) {
$isLangInPost = in_array($langId, $postLangIds);
$isLangInFrontend = in_array($langId, $frontendLangIds);
if ($isLangInPost == $isLangInFrontend) {
continue;
}
$eventArgs['langData'][] = array('langId' => $langId, 'status' => $isLangInPost && !$isLangInFrontend);
}
//Trigger the event 'languageStatusUpdate'
//if the language is activated/deactivated for frontend
if (!empty($eventArgs)) {
$evm = \Cx\Core\Core\Controller\Cx::instanciate()->getEvents();
$evm->triggerEvent('languageStatusUpdate', array($eventArgs, new \Cx\Core\Model\RecursiveArrayAccess(array())));
}
//-----------------------------------------------
// Update languages
//-----------------------------------------------
foreach ($_POST['langName'] as $id => $name) {
$active = 0;
if (isset($_POST['langActiveStatus'][$id]) && $_POST['langActiveStatus'][$id] == 1) {
$languageCode = \FWLanguage::getLanguageCodeById($id);
$pageRepo = \Env::get('em')->getRepository('Cx\\Core\\ContentManager\\Model\\Entity\\Page');
$alias = $pageRepo->findBy(array('type' => \Cx\Core\ContentManager\Model\Entity\Page::TYPE_ALIAS, 'slug' => $languageCode), true);
if (count($alias)) {
if (is_array($alias)) {
$alias = $alias[0];
}
$id = $alias->getNode()->getId();
$config = \Env::get('config');
$link = 'http://' . $config['domainUrl'] . ASCMS_PATH_OFFSET . '/' . $alias->getSlug();
$lang = \Env::get('lang');
$this->strErrMessage = $lang['TXT_CORE_REMOVE_ALIAS_TO_ACTIVATE_LANGUAGE'] . ':<br />
<a href="index.php?cmd=Alias&act=modify&id=' . $id . '" target="_blank">' . $link . '</a>';
return false;
}
$active = 1;
}
$status = "false";
if ($_POST['langDefaultStatus'] == $id) {
$status = "true";
}
$adminstatus = 0;
if (isset($_POST['langAdminStatus'][$id]) && $_POST['langAdminStatus'][$id] == 1) {
$adminstatus = 1;
}
$fallBack = isset($_POST['fallBack'][$id]) && $_POST['fallBack'][$id] != "" ? intval($_POST['fallBack'][$id]) : 'NULL';
$objDatabase->Execute("UPDATE " . DBPREFIX . "languages SET \n name='" . $name . "',\n frontend=" . $active . ",\n is_default='" . $status . "',\n backend='" . $adminstatus . "',\n fallback=" . $fallBack . "\n WHERE id=" . $id);
}
$this->strOkMessage = $_ARRAYLANG['TXT_DATA_RECORD_UPDATED_SUCCESSFUL'];
\FWLanguage::init();
return true;
}
return false;
}
示例3: executeContrexxUpdate
function executeContrexxUpdate()
{
global $_CORELANG, $_CONFIG, $objDatabase, $objUpdate, $_DBCONFIG;
/**
* These are the modules which MUST have new template in order for Cloudrexx
* to work correctly. CSS definitions for these modules will get updated too.
*/
$viewUpdateTable = array('newsletter' => array('version' => '3.1.0.0', 'dependencies' => array('forms')), 'calendar' => array('version' => '3.1.0.0', 'dependencies' => array()), 'shop' => array('version' => '3.0.0.0', 'dependencies' => array('forms')), 'voting' => array('version' => '2.1.0.0', 'dependencies' => array()), 'access' => array('version' => '2.0.0.0', 'dependencies' => array('forms', 'captcha', 'uploader')), 'podcast' => array('version' => '2.0.0.0', 'dependencies' => array()), 'login' => array('version' => '3.0.2.0', 'dependencies' => array('forms', 'captcha')), 'media1' => array('version' => '3.0.0.0', 'dependencies' => array()), 'media2' => array('version' => '3.0.0.0', 'dependencies' => array()), 'media3' => array('version' => '3.0.0.0', 'dependencies' => array()), 'media4' => array('version' => '3.0.0.0', 'dependencies' => array()));
$_SESSION['contrexx_update']['copyFilesFinished'] = !empty($_SESSION['contrexx_update']['copyFilesFinished']) ? $_SESSION['contrexx_update']['copyFilesFinished'] : false;
// Copy cx files to the root directory
if (!$_SESSION['contrexx_update']['copyFilesFinished']) {
if (!loadMd5SumOfOriginalCxFiles()) {
return false;
}
$copyFilesStatus = copyCxFilesToRoot(dirname(__FILE__) . '/cx_files', ASCMS_PATH . ASCMS_PATH_OFFSET);
if ($copyFilesStatus !== true) {
if ($copyFilesStatus === 'timeout') {
setUpdateMsg(1, 'timeout');
}
return false;
}
if (extension_loaded('apc') && ini_get('apc.enabled')) {
apc_clear_cache();
}
$_SESSION['contrexx_update']['copyFilesFinished'] = true;
// log modified files
DBG::msg('MODIFIED FILES:');
if (isset($_SESSION['contrexx_update']['modified_files'])) {
DBG::dump($_SESSION['contrexx_update']['modified_files']);
}
// we need to stop the script here to force a reinitialization of the update system
// this is required so that the new constants from config/set_constants.php are loaded
//setUpdateMsg($_CORELANG['TXT_UPDATE_PROCESS_HALTED'], 'title');
//setUpdateMsg($_CORELANG['TXT_UPDATE_PROCESS_HALTED_TIME_MSG'].'<br />', 'msg');
//setUpdateMsg('Installation der neuen Dateien abgeschlossen.<br /><br />', 'msg');
//setUpdateMsg('<input type="submit" value="'.$_CORELANG['TXT_CONTINUE_UPDATE'].'" name="updateNext" /><input type="hidden" name="processUpdate" id="processUpdate" />', 'button');
setUpdateMsg(1, 'timeout');
return false;
}
unset($_SESSION['contrexx_update']['copiedCxFilesIndex']);
/**
* This needs to be initialized before loading config/doctrine.php
* Because we overwrite the Gedmo model (so we need to load our model
* before doctrine loads the Gedmo one)
*/
require_once ASCMS_CORE_PATH . '/ClassLoader/ClassLoader.class.php';
$cl = new \Cx\Core\ClassLoader\ClassLoader(ASCMS_DOCUMENT_ROOT, true);
Env::set('ClassLoader', $cl);
FWLanguage::init();
if (!isset($_SESSION['contrexx_update']['update'])) {
$_SESSION['contrexx_update']['update'] = array();
}
if (!isset($_SESSION['contrexx_update']['update']['done'])) {
$_SESSION['contrexx_update']['update']['done'] = array();
}
/////////////////////
// UTF-8 MIGRATION //
/////////////////////
if (!(include_once dirname(__FILE__) . '/components/core/core.php')) {
setUpdateMsg(sprintf($_CORELANG['TXT_UPDATE_UNABLE_LOAD_UPDATE_COMPONENT'], dirname(__FILE__) . '/components/core/core.php'));
return false;
}
if (!(include_once dirname(__FILE__) . '/components/core/utf8.php')) {
setUpdateMsg(sprintf($_CORELANG['TXT_UPDATE_UNABLE_LOAD_UPDATE_COMPONENT'], dirname(__FILE__) . '/components/core/utf8.php'));
return false;
}
if (!in_array('utf8', ContrexxUpdate::_getSessionArray($_SESSION['contrexx_update']['update']['done']))) {
$result = _utf8Update();
if ($result === 'timeout') {
setUpdateMsg(1, 'timeout');
return false;
} elseif (!$result) {
if (empty($objUpdate->arrStatusMsg['title'])) {
setUpdateMsg(sprintf($_CORELANG['TXT_UPDATE_COMPONENT_BUG'], $_CORELANG['TXT_UTF_CONVERSION']), 'title');
}
return false;
}
if ($result === 'charset_changed') {
// write new charset/collation definition to config file
if (!_writeNewConfigurationFile()) {
return false;
}
}
$_SESSION['contrexx_update']['update']['done'][] = 'utf8';
// _utf8Update() might have changed the charset/collation and migrated some tables,
// therefore, we will force a reinitialization of the update system
// to ensure that all db-connections are using the proper charset/collation
\DBG::msg('Changed collation to: ' . $_DBCONFIG['collation']);
\DBG::msg('Force reinitialization of update...');
setUpdateMsg(1, 'timeout');
return false;
}
/////////////////////
/////////////////////////////
// Session Table MIGRATION //
/////////////////////////////
$isSessionVariableTableExists = \Cx\Lib\UpdateUtil::table_exist(DBPREFIX . 'session_variable');
if ($isSessionVariableTableExists) {
createOrAlterSessionVariableTable();
}
//.........这里部分代码省略.........