本文整理汇总了PHP中WT_I18N::installed_languages方法的典型用法代码示例。如果您正苦于以下问题:PHP WT_I18N::installed_languages方法的具体用法?PHP WT_I18N::installed_languages怎么用?PHP WT_I18N::installed_languages使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WT_I18N
的用法示例。
在下文中一共展示了WT_I18N::installed_languages方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: configureBlock
public function configureBlock($block_id)
{
if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
set_block_setting($block_id, 'gedcom', WT_Filter::post('gedcom'));
set_block_setting($block_id, 'title', WT_Filter::post('title'));
set_block_setting($block_id, 'html', WT_Filter::post('html'));
set_block_setting($block_id, 'show_timestamp', WT_Filter::postBool('show_timestamp'));
set_block_setting($block_id, 'timestamp', WT_Filter::post('timestamp'));
$languages = array();
foreach (WT_I18N::installed_languages() as $code => $name) {
if (WT_Filter::postBool('lang_' . $code)) {
$languages[] = $code;
}
}
set_block_setting($block_id, 'languages', implode(',', $languages));
exit;
}
require_once WT_ROOT . 'includes/functions/functions_edit.php';
$templates = array(WT_I18N::translate('Keyword examples') => '#getAllTagsTable#', WT_I18N::translate('Narrative description') => WT_I18N::translate('This GEDCOM (family tree) was last updated on #gedcomUpdated#. There are #totalSurnames# surnames in this family tree. The earliest recorded event is the #firstEventType# of #firstEventName# in #firstEventYear#. The most recent event is the #lastEventType# of #lastEventName# in #lastEventYear#.<br><br>If you have any comments or feedback please contact #contactWebmaster#.'), WT_I18N::translate('Statistics') => '<div class="gedcom_stats">
<span style="font-weight: bold"><a href="index.php?command=gedcom">#gedcomTitle#</a></span><br>
' . WT_I18N::translate('This family tree was last updated on %s.', '#gedcomUpdated#') . '
<table id="keywords">
<tr>
<td valign="top" class="width20">
<table cellspacing="1" cellpadding="0">
<tr>
<td class="facts_label">' . WT_I18N::translate('Individuals') . '</td>
<td class="facts_value" align="right"><a href="indilist.php?surname_sublist=no">#totalIndividuals#</a></td>
</tr>
<tr>
<td class="facts_label">' . WT_I18N::translate('Males') . '</td>
<td class="facts_value" align="right">#totalSexMales#<br>#totalSexMalesPercentage#</td>
</tr>
<tr>
<td class="facts_label">' . WT_I18N::translate('Females') . '</td>
<td class="facts_value" align="right">#totalSexFemales#<br>#totalSexFemalesPercentage#</td>
</tr>
<tr>
<td class="facts_label">' . WT_I18N::translate('Total surnames') . '</td>
<td class="facts_value" align="right"><a href="indilist.php?show_all=yes&surname_sublist=yes&ged=' . WT_GEDURL . '">#totalSurnames#</a></td>
</tr>
<tr>
<td class="facts_label">' . WT_I18N::translate('Families') . '</td>
<td class="facts_value" align="right"><a href="famlist.php?ged=' . WT_GEDURL . '">#totalFamilies#</a></td>
</tr>
<tr>
<td class="facts_label">' . WT_I18N::translate('Sources') . '</td>
<td class="facts_value" align="right"><a href="sourcelist.php?ged=' . WT_GEDURL . '">#totalSources#</a></td>
</tr>
<tr>
<td class="facts_label">' . WT_I18N::translate('Media objects') . '</td>
<td class="facts_value" align="right"><a href="medialist.php?ged=' . WT_GEDURL . '">#totalMedia#</a></td>
</tr>
<tr>
<td class="facts_label">' . WT_I18N::translate('Repositories') . '</td>
<td class="facts_value" align="right"><a href="repolist.php?ged=' . WT_GEDURL . '">#totalRepositories#</a></td>
</tr>
<tr>
<td class="facts_label">' . WT_I18N::translate('Total events') . '</td>
<td class="facts_value" align="right">#totalEvents#</td>
</tr>
<tr>
<td class="facts_label">' . WT_I18N::translate('Total users') . '</td>
<td class="facts_value" align="right">#totalUsers#</td>
</tr>
</table>
</td>
<td><br></td>
<td valign="top">
<table cellspacing="1" cellpadding="0" border="0">
<tr>
<td class="facts_label">' . WT_I18N::translate('Earliest birth year') . '</td>
<td class="facts_value" align="right">#firstBirthYear#</td>
<td class="facts_value">#firstBirth#</td>
</tr>
<tr>
<td class="facts_label">' . WT_I18N::translate('Latest birth year') . '</td>
<td class="facts_value" align="right">#lastBirthYear#</td>
<td class="facts_value">#lastBirth#</td>
</tr>
<tr>
<td class="facts_label">' . WT_I18N::translate('Earliest death year') . '</td>
<td class="facts_value" align="right">#firstDeathYear#</td>
<td class="facts_value">#firstDeath#</td>
</tr>
<tr>
<td class="facts_label">' . WT_I18N::translate('Latest death year') . '</td>
<td class="facts_value" align="right">#lastDeathYear#</td>
<td class="facts_value">#lastDeath#</td>
</tr>
<tr>
<td class="facts_label">' . WT_I18N::translate('Individual who lived the longest') . '</td>
<td class="facts_value" align="right">#longestLifeAge#</td>
<td class="facts_value">#longestLife#</td>
</tr>
<tr>
<td class="facts_label">' . WT_I18N::translate('Average age at death') . '</td>
<td class="facts_value" align="right">#averageLifespan#</td>
<td class="facts_value"></td>
</tr>
//.........这里部分代码省略.........
示例2: array
$ALL_THEME_DIRS[] = $themedir;
}
$ALL_EDIT_OPTIONS = array('none' => WT_I18N::translate('Visitor'), 'access' => WT_I18N::translate('Member'), 'edit' => WT_I18N::translate('Editor'), 'accept' => WT_I18N::translate('Moderator'), 'admin' => WT_I18N::translate('Manager'));
// Form actions
$action = WT_Filter::get('action', null, 'listusers');
$usrlang = WT_Filter::post('usrlang', implode('|', array_keys(WT_I18N::installed_languages())), WT_LOCALE);
$username = WT_Filter::post('username', WT_REGEX_USERNAME);
$filter = WT_Filter::post('filter');
$ged = WT_Filter::post('ged');
// Extract form variables
$realname = WT_Filter::post('realname');
$pass1 = WT_Filter::post('pass1', WT_REGEX_PASSWORD);
$pass2 = WT_Filter::post('pass2', WT_REGEX_PASSWORD);
$emailaddress = WT_Filter::postEmail('emailaddress');
$user_theme = WT_Filter::post('user_theme', implode('|', $ALL_THEME_DIRS));
$user_language = WT_Filter::post('user_language', implode('|', array_keys(WT_I18N::installed_languages())), WT_LOCALE);
$new_contact_method = WT_Filter::post('new_contact_method');
$new_comment = WT_Filter::post('new_comment');
$new_auto_accept = WT_Filter::postBool('new_auto_accept');
$canadmin = WT_Filter::postBool('canadmin');
$visibleonline = WT_Filter::postBool('visibleonline');
$editaccount = WT_Filter::postBool('editaccount');
$verified = WT_Filter::postBool('verified');
$verified_by_admin = WT_Filter::postBool('verified_by_admin');
switch ($action) {
case 'loadrows':
// Generate an AJAX/JSON response for datatables to load a block of rows
$search = WT_Filter::get('search');
$search = $search['value'];
$start = WT_Filter::getInteger('start');
$length = WT_Filter::getInteger('length');
示例3: edit
private function edit()
{
require_once WT_ROOT . 'includes/functions/functions_edit.php';
if (WT_USER_CAN_EDIT) {
if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
$block_id = WT_Filter::postInteger('block_id');
if ($block_id) {
WT_DB::prepare("UPDATE `##block` SET gedcom_id=?, xref=? WHERE block_id=?")->execute(array(WT_Filter::postInteger('gedcom_id'), WT_Filter::post('xref', WT_REGEX_XREF), $block_id));
} else {
WT_DB::prepare("INSERT INTO `##block` (gedcom_id, xref, module_name, block_order) VALUES (?, ?, ?, ?)")->execute(array(WT_Filter::postInteger('gedcom_id'), WT_Filter::post('xref', WT_REGEX_XREF), $this->getName(), 0));
$block_id = WT_DB::getInstance()->lastInsertId();
}
set_block_setting($block_id, 'title', WT_Filter::post('title'));
set_block_setting($block_id, 'story_body', WT_Filter::post('story_body'));
$languages = array();
foreach (WT_I18N::installed_languages() as $code => $name) {
if (WT_Filter::postBool('lang_' . $code)) {
$languages[] = $code;
}
}
set_block_setting($block_id, 'languages', implode(',', $languages));
$this->config();
} else {
$block_id = WT_Filter::getInteger('block_id');
$controller = new WT_Controller_Page();
if ($block_id) {
$controller->setPageTitle(WT_I18N::translate('Edit story'));
$title = get_block_setting($block_id, 'title');
$story_body = get_block_setting($block_id, 'story_body');
$gedcom_id = WT_DB::prepare("SELECT gedcom_id FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne();
$xref = WT_DB::prepare("SELECT xref FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne();
} else {
$controller->setPageTitle(WT_I18N::translate('Add a story'));
$title = '';
$story_body = '';
$gedcom_id = WT_GED_ID;
$xref = WT_Filter::get('xref', WT_REGEX_XREF);
}
$controller->pageHeader()->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')->addInlineJavascript('autocomplete();');
if (array_key_exists('ckeditor', WT_Module::getActiveModules())) {
ckeditor_WT_Module::enableEditor($controller);
}
echo '<form name="story" method="post" action="module.php?mod=', $this->getName(), '&mod_action=admin_edit">';
echo WT_Filter::getCsrf();
echo '<input type="hidden" name="save" value="1">';
echo '<input type="hidden" name="block_id" value="', $block_id, '">';
echo '<input type="hidden" name="gedcom_id" value="', WT_GED_ID, '">';
echo '<table id="story_module">';
echo '<tr><th>';
echo WT_I18N::translate('Story title');
echo '</th></tr><tr><td><textarea name="title" rows="1" cols="90" tabindex="2">', WT_Filter::escapeHtml($title), '</textarea></td></tr>';
echo '<tr><th>';
echo WT_I18N::translate('Story');
echo '</th></tr><tr><td>';
echo '<textarea name="story_body" class="html-edit" rows="10" cols="90" tabindex="2">', WT_Filter::escapeHtml($story_body), '</textarea>';
echo '</td></tr>';
echo '</table><table id="story_module2">';
echo '<tr>';
echo '<th>', WT_I18N::translate('Individual'), '</th>';
echo '<th>', WT_I18N::translate('Show this block for which languages?'), '</th>';
echo '</tr>';
echo '<tr>';
echo '<td class="optionbox">';
echo '<input data-autocomplete-type="INDI" type="text" name="xref" id="pid" size="4" value="' . $xref . '">';
echo print_findindi_link('pid');
if ($xref) {
$person = WT_Individual::getInstance($xref);
if ($person) {
echo ' ', $person->format_list('span');
}
}
echo '</td>';
$languages = get_block_setting($block_id, 'languages');
echo '<td class="optionbox">';
echo edit_language_checkboxes('lang_', $languages);
echo '</td></tr></table>';
echo '<p><input type="submit" value="', WT_I18N::translate('save'), '" tabindex="5">';
echo '</p>';
echo '</form>';
exit;
}
} else {
header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH);
exit;
}
}
示例4: getLanguageMenu
public static function getLanguageMenu()
{
global $SEARCH_SPIDER;
if ($SEARCH_SPIDER) {
return null;
} else {
$menu = new WT_Menu(WT_I18N::translate('Language'), '#', 'menu-language');
foreach (WT_I18N::installed_languages() as $lang => $name) {
$submenu = new WT_Menu($name, get_query_url(array('lang' => $lang), '&'), 'menu-language-' . $lang);
if (WT_LOCALE == $lang) {
$submenu->addClass('', '', 'lang-active');
}
$menu->addSubMenu($submenu);
}
if (count($menu->submenus) > 1) {
return $menu;
} else {
return null;
}
}
}
示例5: edit_field_language_inline
function edit_field_language_inline($name, $selected = false, $controller = null)
{
return select_edit_control_inline($name, WT_I18N::installed_languages(), null, $selected, $controller);
}
示例6: edit
private function edit()
{
require_once WT_ROOT . 'includes/functions/functions_edit.php';
if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
$block_id = WT_Filter::postInteger('block_id');
if ($block_id) {
WT_DB::prepare("UPDATE `##block` SET gedcom_id=NULLIF(?, '0'), block_order=? WHERE block_id=?")->execute(array(WT_Filter::postInteger('gedcom_id'), WT_Filter::postInteger('block_order'), $block_id));
} else {
WT_DB::prepare("INSERT INTO `##block` (gedcom_id, module_name, block_order) VALUES (NULLIF(?, '0'), ?, ?)")->execute(array(WT_Filter::postInteger('gedcom_id'), $this->getName(), WT_Filter::postInteger('block_order')));
$block_id = WT_DB::getInstance()->lastInsertId();
}
set_block_setting($block_id, 'header', WT_Filter::post('header'));
set_block_setting($block_id, 'faqbody', WT_Filter::post('faqbody'));
$languages = array();
foreach (WT_I18N::installed_languages() as $code => $name) {
if (WT_Filter::postBool('lang_' . $code)) {
$languages[] = $code;
}
}
set_block_setting($block_id, 'languages', implode(',', $languages));
$this->config();
} else {
$block_id = WT_Filter::getInteger('block_id');
$controller = new WT_Controller_Page();
if ($block_id) {
$controller->setPageTitle(WT_I18N::translate('Edit FAQ item'));
$header = get_block_setting($block_id, 'header');
$faqbody = get_block_setting($block_id, 'faqbody');
$block_order = WT_DB::prepare("SELECT block_order FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne();
$gedcom_id = WT_DB::prepare("SELECT gedcom_id FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne();
} else {
$controller->setPageTitle(WT_I18N::translate('Add an FAQ item'));
$header = '';
$faqbody = '';
$block_order = WT_DB::prepare("SELECT IFNULL(MAX(block_order)+1, 0) FROM `##block` WHERE module_name=?")->execute(array($this->getName()))->fetchOne();
$gedcom_id = WT_GED_ID;
}
$controller->pageHeader();
if (array_key_exists('ckeditor', WT_Module::getActiveModules())) {
ckeditor_WT_Module::enableEditor($controller);
}
// "Help for this page" link
echo '<div id="page_help">', help_link('add_faq_item', $this->getName()), '</div>';
echo '<form name="faq" method="post" action="module.php?mod=', $this->getName(), '&mod_action=admin_edit">';
echo WT_Filter::getCsrf();
echo '<input type="hidden" name="save" value="1">';
echo '<input type="hidden" name="block_id" value="', $block_id, '">';
echo '<table id="faq_module">';
echo '<tr><th>';
echo WT_I18N::translate('Question');
echo '</th></tr><tr><td><input type="text" name="header" size="90" tabindex="1" value="' . WT_Filter::escapeHtml($header) . '"></td></tr>';
echo '<tr><th>';
echo WT_I18N::translate('Answer');
echo '</th></tr><tr><td>';
echo '<textarea name="faqbody" class="html-edit" rows="10" cols="90" tabindex="2">', WT_Filter::escapeHtml($faqbody), '</textarea>';
echo '</td></tr>';
echo '</table><table id="faq_module2">';
echo '<tr>';
echo '<th>', WT_I18N::translate('Show this block for which languages?'), '</th>';
echo '<th>', WT_I18N::translate('FAQ position'), help_link('add_faq_order', $this->getName()), '</th>';
echo '<th>', WT_I18N::translate('FAQ visibility'), help_link('add_faq_visibility', $this->getName()), '</th>';
echo '</tr><tr>';
echo '<td>';
$languages = get_block_setting($block_id, 'languages');
echo edit_language_checkboxes('lang_', $languages);
echo '</td><td>';
echo '<input type="text" name="block_order" size="3" tabindex="3" value="', $block_order, '"></td>';
echo '</td><td>';
echo select_edit_control('gedcom_id', WT_Tree::getIdList(), WT_I18N::translate('All'), $gedcom_id, 'tabindex="4"');
echo '</td></tr>';
echo '</table>';
echo '<p><input type="submit" value="', WT_I18N::translate('save'), '" tabindex="5">';
echo '</form>';
exit;
}
}
示例7: commonCountriesList
function commonCountriesList()
{
$countries = $this->_statsPlaces();
if (!is_array($countries)) {
return '';
}
$top10 = array();
$i = 1;
// Get the country names for each language
$country_names = array();
foreach (WT_I18N::installed_languages() as $code => $lang) {
WT_I18N::init($code);
$all_countries = self::get_all_countries();
foreach ($all_countries as $country_code => $country_name) {
$country_names[$country_name] = $country_code;
}
}
WT_I18N::init(WT_LOCALE);
$all_db_countries = array();
foreach ($countries as $place) {
$country = trim($place['country']);
if (array_key_exists($country, $country_names)) {
if (!isset($all_db_countries[$country_names[$country]][$country])) {
$all_db_countries[$country_names[$country]][$country] = $place['tot'];
} else {
$all_db_countries[$country_names[$country]][$country] += $place['tot'];
}
}
}
// get all the user’s countries names
$all_countries = self::get_all_countries();
foreach ($all_db_countries as $country_code => $country) {
$top10[] = '<li>';
foreach ($country as $country_name => $tot) {
$tmp = new WT_Place($country_name, $this->_ged_id);
$place = '<a href="' . $tmp->getURL() . '" class="list_item">' . $all_countries[$country_code] . '</a>';
$top10[] .= $place . ' - ' . WT_I18N::number($tot);
}
$top10[] .= '</li>';
if ($i++ == 10) {
break;
}
}
$top10 = join('', $top10);
return '<ul>' . $top10 . '</ul>';
}