function do_extract($file, $regex) { global $total_new; $content = @file_get_contents($file); if (empty($content)) { return; } preg_match_all($regex, $content, $matches, PREG_PATTERN_ORDER); print "{$file}" . " - "; $num_added = 0; for ($i = 0; $i < count($matches[0]); $i++) { str_replace('"', "\\'", $matches[0][$i]); // remove the killer double-quotes expLang::writeTemplate($matches[0][$i]); $num_added++; } $total_new += $num_added; print $num_added . "\n"; }
<?php if (!defined('LANGUAGE')) { if (empty($_POST['sc']['LANGUAGE'])) { $_POST['sc']['LANGUAGE'] = 'English - US'; } define('LANGUAGE', $_POST['sc']['LANGUAGE']); } ?> <form method="post" action="index.php"> <!-- send us to the next page --> <input type="hidden" name="page" value="install-1" /> <div class="control"> <select name="lang" onChange="Refresh(this.value)"> <?php foreach (expLang::langList() as $currid => $currlang) { ?> <option value="<?php echo $currid; ?> "<?php if ($currid == LANGUAGE) { echo " selected"; } ?> ><?php echo $currlang; ?> </option> <?php }
output($output); unset($output); output("Now extracting phrases from the folders!\n"); exec('php ./lang_extract.php ../conf ../cron ../framework ../install ../themes', $output); output($output); unset($output); //Update each language file based on default language and then attempt to translate // Initialize the exponent environment and language subsystem include_once '../exponent_bootstrap.php'; expLang::loadLang(); global $default_lang, $cur_lang; if (empty($default_lang)) { $default_lang = (include BASE . "framework/core/lang/English - US.php"); } $orig_lang = LANG; $lang_list = expLang::langList(); foreach ($lang_list as $key => $value) { if ($key != "English - US") { output("Now attempting to translate new " . $key . " phrases\n"); expSettings::change('LANGUAGE', $key); exec('php ./lang_translate.php', $output); output($output); unset($output); } } expSettings::change('LANGUAGE', $orig_lang); print "\nCompleted Updating the Exponent Language System!\n"; function output($text) { if (!is_array($text)) { $text = array($text);
* @link http://www.gnu.org/licenses/gpl.txt GPL http://www.gnu.org/licenses/gpl.txt * @package Exponent-CMS * @copyright 2004-2011 OIC Group, Inc. * @author Adam Kessler <*****@*****.**> * @version 2.0.0 */ // Initialize the exponent environment require_once 'exponent_bootstrap.php'; // Initialize the MVC framework - for objects we need loaded now require_once BASE . 'framework/core/expFramework.php'; // Initialize the Sessions subsystem expSession::initialize(); // Initialize the Theme subsystem expTheme::initialize(); // Initialize the language subsystem expLang::loadLang(); // Initialize the Database subsystem $db = expDatabase::connect(DB_USER, DB_PASS, DB_HOST . ':' . DB_PORT, DB_NAME); // Initialize the Modules subsystem & Create the list of available/active controllers $available_controllers = expModules::initializeControllers(); //original position //$available_controllers = array(); //$available_controllers = initializeControllers(); //foreach ($db->selectObjects('modstate',1) as $mod) { // if (!empty($mod->path)) $available_controllers[$mod->module] = $mod->path; //FIXME test location //} // Initialize the History (Flow) subsystem. $history = new expHistory(); //<--This is the new flow subsystem // Initialize the javascript subsystem if (expJavascript::inAjaxAction()) {
public function configure_site() { expHistory::set('manageable', $this->params); // TYPES OF ANTISPAM CONTROLS... CURRENTLY ONLY ReCAPTCHA $as_types = array('0' => '-- ' . gt('Please Select an Anti-Spam Control') . ' --', "recaptcha" => 'reCAPTCHA'); //THEMES FOR RECAPTCHA $as_themes = array("red" => gt('DEFAULT RED'), "white" => gt('White'), "blackglass" => gt('Black Glass'), "clean" => gt('Clean (very generic)')); // Available Themes $themes = array(); if (is_readable(BASE . 'themes')) { $theme_dh = opendir(BASE . 'themes'); while (($theme_file = readdir($theme_dh)) !== false) { if (is_readable(BASE . 'themes/' . $theme_file . '/class.php')) { // Need to avoid the duplicate theme problem. if (!class_exists($theme_file)) { include_once BASE . 'themes/' . $theme_file . '/class.php'; } if (class_exists($theme_file)) { // Need to avoid instantiating non-existent classes. $t = new $theme_file(); $themes[$theme_file] = $t->name(); } } } } uasort($themes, 'strnatcmp'); // Available Languages $langs = expLang::langList(); // ksort($langs); // smtp protocol $protocol = array('ssl' => 'SSL', 'tls' => 'TLS'); // attribution $attribution = array('firstlast' => 'John Doe', 'lastfirst' => 'Doe, John', 'first' => 'John', 'username' => 'jdoe'); // These funcs need to be moved up in to new subsystems // Date/Time Format $datetime_format = expSettings::dropdownData('datetime_format'); // Date Format $date_format = expSettings::dropdownData('date_format'); // Time Format $time_format = expSettings::dropdownData('time_format'); // Start of Week $start_of_week = expSettings::dropdownData('start_of_week'); // File Permissions $file_permisions = expSettings::dropdownData('file_permissions'); // File Permissions $dir_permissions = expSettings::dropdownData('dir_permissions'); // Homepage Dropdown $section_dropdown = navigationmodule::levelDropDownControlArray(0); // Timezone Dropdown $list = DateTimeZone::listAbbreviations(); $idents = DateTimeZone::listIdentifiers(); $data = $offset = $added = array(); foreach ($list as $abbr => $info) { foreach ($info as $zone) { if (!empty($zone['timezone_id']) and !in_array($zone['timezone_id'], $added) and in_array($zone['timezone_id'], $idents)) { $z = new DateTimeZone($zone['timezone_id']); $c = new DateTime(null, $z); $zone['time'] = $c->format('H:i a'); $data[] = $zone; $offset[] = $z->getOffset($c); $added[] = $zone['timezone_id']; } } } array_multisort($offset, SORT_ASC, $data); $tzoptions = array(); foreach ($data as $key => $row) { $tzoptions[$row['timezone_id']] = self::formatOffset($row['offset']) . ' ' . $row['timezone_id']; } assign_to_template(array('as_types' => $as_types, 'as_themes' => $as_themes, 'themes' => $themes, 'langs' => $langs, 'protocol' => $protocol, 'attribution' => $attribution, 'datetime_format' => $datetime_format, 'date_format' => $date_format, 'time_format' => $time_format, 'start_of_week' => $start_of_week, 'timezones' => $tzoptions, 'file_permisions' => $file_permisions, 'dir_permissions' => $dir_permissions, 'section_dropdown' => $section_dropdown)); }
/** * Smarty {gettext} function plugin * * Type: function<br> * Name: gettext<br> * Purpose: Replace with the chosen language for this text * * @param $params * @param $smarty */ function smarty_function_gettext($params, &$smarty) { echo expLang::gettext($params['str']); }
/** * Smarty {gettext} modifier plugin * * Type: modifier<br> * Name: gettext<br> * Purpose: Replace with the chosen language for this text * * @param string $str * @return string */ function smarty_modifier_gettext($str) { return expLang::gettext($str); }
$num_extra = $num_extra ? $num_extra : 'No'; print $num_extra . " Obsolete Phases were Found and Removed from the " . utf8_decode(LANG) . " Translation\n"; // Attempt a machine translation for un-translated phrases in current language $num_untrans = 0; foreach ($cur_lang as $key => $value) { if ($key == $value) { $num_untrans++; } } print $num_untrans . " Phrases appear Un-Translated in the " . utf8_decode(LANG) . " Translation\n"; $num_added = 0; if (defined('LOCALE')) { foreach ($cur_lang as $key => $value) { if ($key == $value) { $translation = expLang::translate($value, 'en', LOCALE); if ($translation) { $translation = str_replace('"', "\\'", $translation); // remove the killer double-quotes $cur_lang[$key] = addslashes(stripslashes(strip_tags($translation))); expLang::saveCurrLangFile(); $num_added++; } } } print $num_added . " New Phases were Translated in the " . utf8_decode(LANG) . " Translation\n"; } else { print "There is no Locale Assigned for the " . utf8_decode(LANG) . " to attempt a Translation\n"; exit; } print count($cur_lang) . " Phrases are now in the " . utf8_decode(LANG) . " Translation\n"; print "\nCompleted Updating the " . utf8_decode(LANG) . " Translation!\n";
function gt($s) { return expLang::gettext($s); }