本文整理汇总了PHP中get_installed_translations函数的典型用法代码示例。如果您正苦于以下问题:PHP get_installed_translations函数的具体用法?PHP get_installed_translations怎么用?PHP get_installed_translations使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_installed_translations函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: language_selector_get_allowed_translations
function language_selector_get_allowed_translations()
{
$configured_allowed = elgg_get_plugin_setting("allowed_languages", "language_selector");
if (empty($configured_allowed)) {
$allowed = array("en");
$installed_languages = get_installed_translations();
$min_completeness = (int) elgg_get_plugin_setting("min_completeness", "language_selector");
if ($min_completeness > 0) {
$update_completeness = false;
if (elgg_is_active_plugin("translation_editor")) {
if (elgg_is_admin_logged_in()) {
$update_completeness = true;
}
$completeness_function = "translation_editor_get_language_completeness";
} else {
$completeness_function = "get_language_completeness";
}
foreach ($installed_languages as $lang_id => $lang_description) {
if ($lang_id != "en") {
if (($completeness = $completeness_function($lang_id)) >= $min_completeness) {
$allowed[] = $lang_id;
}
}
}
}
elgg_set_plugin_setting("allowed_languages", implode(",", $allowed), "language_selector");
} else {
$allowed = string_to_tag_array($configured_allowed);
}
return $allowed;
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:31,代码来源:functions.php
示例2: translation_editor_version_053
function translation_editor_version_053()
{
if ($languages = get_installed_translations()) {
foreach ($languages as $lang => $name) {
translation_editor_merge_translations($lang);
}
}
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:8,代码来源:start.php
示例3: translation_editor_actions_hook
function translation_editor_actions_hook($hook, $type, $return, $params)
{
$allowed_actions = array("admin/plugins/activate", "admin/plugins/deactivate", "admin/plugins/activate_all", "admin/plugins/deactivate_all", "admin/plugins/set_priority", "upgrading");
if (!empty($type) && in_array($type, $allowed_actions)) {
// make sure we have all translations
translation_editor_reload_all_translations();
if ($languages = get_installed_translations()) {
foreach ($languages as $key => $desc) {
remove_private_setting(elgg_get_site_entity()->getGUID(), "te_last_update_" . $key);
}
}
}
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:13,代码来源:hooks.php
示例4: blog_type_handler
/**
* Blog type handler. Sets the blog type property
*
* @param string $event create | update
* @param string $object_type object
* @param object $object Blog object
* @return boolean
*/
function blog_type_handler($event, $object_type, $object)
{
if ($object->getSubtype() == "blog") {
$blog_type = get_input("blog_type");
switch ($event) {
case "create":
case "update":
$object->clearMetadata("blog_type");
$object->set("blog_type", $blog_type);
if (!empty($type)) {
//Registering metadata in all the registered languages for easy localized search
$translations = get_installed_translations();
foreach ($translations as $key => $value) {
$var = "blog_type_{$key}";
$object->clearMetadata($var);
$object->set($var, elgg_echo($blog_type, $key));
}
}
break;
}
}
return true;
}
开发者ID:eokyere,项目名称:elgg,代码行数:31,代码来源:start.php
示例5: page_owner_entity
* @package Elgg
* @subpackage Core
* @author Curverider Ltd
* @link http://elgg.org/
*/
global $CONFIG;
$user = page_owner_entity();
if ($user) {
?>
<div class="user_settings language">
<h3><?php
echo elgg_echo('user:set:language');
?>
</h3>
<p>
<?php
echo elgg_echo('user:language:label');
?>
: <?php
$value = $CONFIG->language;
if ($user->language) {
$value = $user->language;
}
echo elgg_view("input/pulldown", array('internalname' => 'language', 'value' => $value, 'options_values' => get_installed_translations()));
?>
</p>
</div>
<?php
}
开发者ID:adamboardman,项目名称:Elgg,代码行数:31,代码来源:language.php
示例6: translation_editor_gatekeeper
<?php
/**
* display the search results
*/
translation_editor_gatekeeper();
elgg_require_js('translation_editor/edit');
// get inputs
$q = get_input('q');
if (empty($q)) {
forward(REFERER);
}
$language = get_input('language', 'en');
$found = translation_editor_search_translation($q, $language);
$trans = get_installed_translations();
if (!array_key_exists($language, $trans)) {
forward('translation_editor');
}
$trans_lan = elgg_echo($language);
if (elgg_language_key_exists($language, $language)) {
$trans_lan = elgg_echo($language, [], $language);
}
$title_text = elgg_echo('translation_editor:search', [$q, $trans_lan]);
// breadcrumb
elgg_push_breadcrumb(elgg_echo('translation_editor:menu:title'), 'translation_editor');
elgg_push_breadcrumb($trans_lan, "translation_editor/{$language}");
// build page elements
// build search form
$form_vars = ['id' => 'translation_editor_search_form', 'action' => 'translation_editor/search', 'disable_security' => true, 'class' => 'mbl', 'method' => 'GET'];
$body_vars = ['current_language' => $language, 'query' => $q];
$body = elgg_view_form('translation_editor/search', $form_vars, $body_vars);
开发者ID:coldtrick,项目名称:translation_editor,代码行数:31,代码来源:search.php
示例7: elgg_get_page_owner_entity
<?php
/**
* Provide a way of setting your language prefs
*
* @package Elgg
* @subpackage Core
*/
$user = elgg_get_page_owner_entity();
if ($user) {
$title = elgg_echo('user:set:language');
$content = elgg_echo('user:language:label') . ': ';
$content .= elgg_view("input/select", array('name' => 'language', 'value' => $user->language, 'options_values' => get_installed_translations()));
echo elgg_view_module('info', $title, $content);
}
开发者ID:ibou77,项目名称:elgg,代码行数:15,代码来源:language.php
示例8: pleio_api_change_setting
function pleio_api_change_setting($name = "", $password = "", $language = "", $email = "")
{
$fail = false;
$dirty = false;
$user = elgg_get_logged_in_user_entity();
if ($language && $language != $user->language && array_key_exists($language, get_installed_translations())) {
$user->language = $language;
$dirty = true;
}
if ($email && $email != $user->email) {
if (!is_email_address($email)) {
$fail = elgg_echo('email:save:fail');
} else {
if (!get_user_by_email($email)) {
$user->email = $email;
$dirty = true;
} else {
$fail = elgg_echo('registration:dupeemail');
}
}
}
if ($name && $name != $user->name) {
$name = strip_tags($name);
if (elgg_strlen($name) > 50) {
$fail = elgg_echo('user:name:fail');
} else {
$user->name = $name;
$dirty = true;
}
}
if ($password) {
try {
$result = validate_password($password);
if ($result) {
$user->salt = generate_random_cleartext_password();
$user->password = generate_user_password($user, $password);
$dirty = true;
} else {
$fail = elgg_echo('user:password:fail');
}
} catch (RegistrationException $e) {
$fail = $e->getMessage();
}
}
if ($fail) {
return new ErrorResult($fail);
} else {
if ($dirty) {
if ($user->canEdit() && $user->save()) {
return new SuccessResult("Instellingen opgeslagen");
} else {
return new ErrorResult("Opslaan mislukt");
}
} else {
return new SuccessResult("Instellingen niet gewijzigd");
}
}
return new ErrorResult("Niets gewijzigd");
}
开发者ID:appstaat,项目名称:pleio_api,代码行数:59,代码来源:methods.php
示例9: elgg_get_page_owner_entity
/**
* Provide a way of setting your language prefs
*
* @package Elgg
* @subpackage Core
*/
$user = elgg_get_page_owner_entity();
if ($user) {
?>
<div class="elgg-module elgg-module-info">
<div class="elgg-head">
<h3><?php
echo elgg_echo('user:set:language');
?>
</h3>
</div>
<div class="elgg-body">
<p>
<?php
echo elgg_echo('user:language:label');
?>
:
<?php
echo elgg_view("input/dropdown", array('name' => 'language', 'value' => $user->language, 'options_values' => get_installed_translations()));
?>
</p>
</div>
</div>
<?php
}
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:30,代码来源:language.php
示例10: elgg_extract
<?php
namespace hypeJunction\Prototyper;
$entity = elgg_extract('entity', $vars);
echo '<div>';
echo '<label>' . elgg_echo("prototyper:settings:default_language") . '</label>';
echo elgg_view('input/dropdown', array('name' => "params[default_language]", 'options_values' => get_installed_translations(), 'value' => $entity->default_language));
echo '</div>';
开发者ID:hypejunction,项目名称:hypeprototyper,代码行数:9,代码来源:settings.php
示例11: translation_editor_invalidate_site_cache
/**
* Reset the site timestamp that tracks the merged translation status.
*
* This will recreate the translation editor cache
*
* @param int $site_guid which site to invalidate (defaults to current site)
*
* @return void
*/
function translation_editor_invalidate_site_cache($site_guid = 0)
{
$site_guid = sanitize_int($site_guid, false);
// make sure we have all translations
translation_editor_reload_all_translations();
$languages = get_installed_translations();
if (empty($languages) || !is_array($languages)) {
return;
}
$site = elgg_get_site_entity($site_guid);
if (empty($site)) {
return;
}
foreach ($languages as $key => $desc) {
remove_private_setting($site->getGUID(), "te_last_update_{$key}");
}
}
开发者ID:coldtrick,项目名称:translation_editor,代码行数:26,代码来源:functions.php
示例12: array
<?php
/**
* Languages according to ISO 639-1
*/
$options = array("aa" => "Afar", "ab" => "Abkhazian", "af" => "Afrikaans", "am" => "Amharic", "ar" => "Arabic", "as" => "Assamese", "ay" => "Aymara", "az" => "Azerbaijani", "ba" => "Bashkir", "be" => "Byelorussian", "bg" => "Bulgarian", "bh" => "Bihari", "bi" => "Bislama", "bn" => "Bengali; Bangla", "bo" => "Tibetan", "br" => "Breton", "ca" => "Catalan", "co" => "Corsican", "cs" => "Czech", "cy" => "Welsh", "da" => "Danish", "de" => "German", "dz" => "Bhutani", "el" => "Greek", "en" => "English", "eo" => "Esperanto", "es" => "Spanish", "et" => "Estonian", "eu" => "Basque", "fa" => "Persian", "fi" => "Finnish", "fj" => "Fiji", "fo" => "Faeroese", "fr" => "French", "fy" => "Frisian", "ga" => "Irish", "gd" => "Scots / Gaelic", "gl" => "Galician", "gn" => "Guarani", "gu" => "Gujarati", "he" => "Hebrew", "ha" => "Hausa", "hi" => "Hindi", "hr" => "Croatian", "hu" => "Hungarian", "hy" => "Armenian", "ia" => "Interlingua", "id" => "Indonesian", "ie" => "Interlingue", "ik" => "Inupiak", "is" => "Icelandic", "it" => "Italian", "iu" => "Inuktitut", "iw" => "Hebrew (obsolete)", "ja" => "Japanese", "ji" => "Yiddish (obsolete)", "jw" => "Javanese", "ka" => "Georgian", "kk" => "Kazakh", "kl" => "Greenlandic", "km" => "Cambodian", "kn" => "Kannada", "ko" => "Korean", "ks" => "Kashmiri", "ku" => "Kurdish", "ky" => "Kirghiz", "la" => "Latin", "ln" => "Lingala", "lo" => "Laothian", "lt" => "Lithuanian", "lv" => "Latvian/Lettish", "mg" => "Malagasy", "mi" => "Maori", "mk" => "Macedonian", "ml" => "Malayalam", "mn" => "Mongolian", "mo" => "Moldavian", "mr" => "Marathi", "ms" => "Malay", "mt" => "Maltese", "my" => "Burmese", "na" => "Nauru", "ne" => "Nepali", "nl" => "Dutch", "no" => "Norwegian", "oc" => "Occitan", "om" => "(Afan) Oromo", "or" => "Oriya", "pa" => "Punjabi", "pl" => "Polish", "ps" => "Pashto / Pushto", "pt" => "Portuguese", "qu" => "Quechua", "rm" => "Rhaeto-Romance", "rn" => "Kirundi", "ro" => "Romanian", "ru" => "Russian", "rw" => "Kinyarwanda", "sa" => "Sanskrit", "sd" => "Sindhi", "sg" => "Sangro", "sh" => "Serbo-Croatian", "si" => "Singhalese", "sk" => "Slovak", "sl" => "Slovenian", "sm" => "Samoan", "sn" => "Shona", "so" => "Somali", "sq" => "Albanian", "sr" => "Serbian", "ss" => "Siswati", "st" => "Sesotho", "su" => "Sundanese", "sv" => "Swedish", "sw" => "Swahili", "ta" => "Tamil", "te" => "Tegulu", "tg" => "Tajik", "th" => "Thai", "ti" => "Tigrinya", "tk" => "Turkmen", "tl" => "Tagalog", "tn" => "Setswana", "to" => "Tonga", "tr" => "Turkish", "ts" => "Tsonga", "tt" => "Tatar", "tw" => "Twi", "ug" => "Uigur", "uk" => "Ukrainian", "ur" => "Urdu", "uz" => "Uzbek", "vi" => "Vietnamese", "vo" => "Volapuk", "wo" => "Wolof", "xh" => "Xhosa", "yi" => "Yiddish", "yo" => "Yoruba", "za" => "Zuang", "zh" => "Chinese", "zu" => "Zulu");
foreach (get_installed_translations() as $index => $lang) {
unset($options[$index]);
}
asort($options);
$form_body .= elgg_view("input/dropdown", array("options_values" => $options, "name" => "code"));
$form_body .= " ";
$form_body .= elgg_view("input/submit", array("value" => elgg_echo("save")));
$form = elgg_view("input/form", array("body" => $form_body, "action" => $vars["url"] . "action/translation_editor/add_language", "id" => "translation_editor_add_language_form", "class" => "hidden"));
echo "<div>";
echo "<a href='javascript:void(0);' onclick='\$(\"#translation_editor_add_language_form\").toggle();'><b>+</b> " . elgg_echo("translation_editor:language_selector:add_language") . "</a>";
echo $form;
echo "</div>";
开发者ID:remy40,项目名称:gvrs,代码行数:18,代码来源:add_language.php
示例13: settings
/**
* Site settings controller
*
* Sets the site name, URL, data directory, etc.
*
* @param array $submissionVars Submitted vars
*
* @return void
*/
protected function settings($submissionVars)
{
global $CONFIG;
$languages = get_installed_translations();
$formVars = array('sitename' => array('type' => 'text', 'value' => 'New Elgg site', 'required' => TRUE), 'siteemail' => array('type' => 'text', 'value' => '', 'required' => FALSE), 'wwwroot' => array('type' => 'text', 'value' => elgg_get_site_url(), 'required' => TRUE), 'path' => array('type' => 'text', 'value' => $CONFIG->path, 'required' => TRUE), 'dataroot' => array('type' => 'text', 'value' => '', 'required' => TRUE), 'siteaccess' => array('type' => 'access', 'value' => ACCESS_PUBLIC, 'required' => TRUE));
if ($this->isAction) {
do {
if (!$this->validateSettingsVars($submissionVars, $formVars)) {
break;
}
if (!$this->saveSiteSettings($submissionVars)) {
break;
}
system_message(elgg_echo('install:success:settings'));
$this->continueToNextStep('settings');
} while (FALSE);
// PHP doesn't support breaking out of if statements
}
$formVars = $this->makeFormSticky($formVars, $submissionVars);
$this->render('settings', array('variables' => $formVars));
}
开发者ID:rasul,项目名称:Elgg,代码行数:30,代码来源:ElggInstaller.php
示例14: foreach
<?php
/**
* @todo cleanup
*/
$form_body = "";
foreach (array('sitename', 'sitedescription', 'siteemail') as $field) {
$form_body .= "<div>";
$form_body .= elgg_echo('installation:' . $field) . "<br />";
$warning = elgg_echo('installation:warning:' . $field);
if ($warning != 'installation:warning:' . $field) {
echo "<b>" . $warning . "</b><br />";
}
$value = elgg_get_config($field);
$form_body .= elgg_view("input/text", array('name' => $field, 'value' => $value));
$form_body .= "</div>";
}
$languages = get_installed_translations();
$form_body .= "<div>" . elgg_echo('installation:language');
$form_body .= elgg_view("input/dropdown", array('name' => 'language', 'value' => elgg_get_config('language'), 'options_values' => $languages)) . "</div>";
$form_body .= '<div class="elgg-divide-top">';
$form_body .= elgg_view('input/submit', array('value' => elgg_echo("save")));
$form_body .= '</div>';
echo $form_body;
开发者ID:redvabel,项目名称:Vabelgg,代码行数:24,代码来源:update_basic.php
示例15: elgg_extract
<?php
$entity = elgg_extract('entity', $vars);
if ($entity) {
$template = $entity->template;
$language = $entity->language;
} else {
$template = elgg_extract('template', $vars);
$language = elgg_extract('language', $vars);
}
if ($language) {
echo elgg_view_input('hidden', array('name' => 'language', 'value' => $language));
} else {
echo elgg_view_input('select', array('name' => 'language', 'value' => $entity->language ?: 'en', 'options_values' => get_installed_translations(), 'label' => elgg_echo('notifications:editor:language')));
}
if ($template) {
echo elgg_view_input('hidden', array('name' => 'template', 'value' => $template));
} else {
elgg_require_js('forms/notifications/editor/edit');
$events = _elgg_services()->events->getAllHandlers();
$event_options = array_keys($events);
sort($event_options);
echo elgg_view_input('select', array('name' => 'event', 'value' => $entity->event ?: 'publish', 'options' => $event_options, 'label' => elgg_echo('notifications:editor:event')));
echo elgg_view_input('select', array('name' => 'object_type', 'value' => $entity->object_type, 'options' => array('', 'object', 'user', 'group', 'site', 'relationship', 'annotation'), 'id' => 'notifications-editor-type', 'label' => elgg_echo('notifications:editor:object_type')));
echo elgg_view_input('select', array('name' => 'object_subtype', 'value' => $entity->object_subtype, 'options' => array($entity->object_subtype ?: ''), 'id' => 'notifications-editor-subtype', 'label' => elgg_echo('notifications:editor:object_subtype')));
}
echo elgg_view_input('text', array('name' => 'subject', 'value' => $entity->subject, 'required' => true, 'label' => elgg_echo('notifications:editor:subject'), 'help' => elgg_echo('notifications:editor:subject:help')));
echo elgg_view_input('plaintext', array('name' => 'summary', 'value' => $entity->summary, 'required' => true, 'label' => elgg_echo('notifications:editor:summary')));
echo elgg_view_input('plaintext', array('name' => 'body', 'value' => $entity->body, 'required' => true, 'label' => elgg_echo('notifications:editor:body')));
echo elgg_view_input('hidden', array('name' => 'guid', 'value' => $entity->guid));
if ($entity->template_folder) {
开发者ID:hypeJunction,项目名称:Elgg-notifications_editor,代码行数:31,代码来源:edit.php
示例16: elgg_get_page_owner_entity
<?php
/**
* Provide a way of setting your language prefs
*
* @package Elgg
* @subpackage Core
*/
$user = elgg_get_page_owner_entity();
if (!$user instanceof ElggUser) {
return;
}
$title = elgg_echo('user:set:language');
$content = elgg_view_field(array('#type' => 'select', 'name' => 'language', 'value' => $user->language, 'options_values' => get_installed_translations(), '#label' => elgg_echo('user:language:label')));
echo elgg_view_module('info', $title, $content);
开发者ID:elgg,项目名称:elgg,代码行数:15,代码来源:language.php
示例17: elgg_view_field
<?php
echo elgg_view_field(['#type' => 'text', 'name' => 'sitename', '#label' => elgg_echo('installation:sitename'), 'value' => elgg_get_config('sitename')]);
echo elgg_view_field(['#type' => 'text', 'name' => 'sitedescription', '#label' => elgg_echo('installation:sitedescription'), 'value' => elgg_get_config('sitedescription')]);
echo elgg_view_field(['#type' => 'email', 'name' => 'siteemail', '#label' => elgg_echo('installation:siteemail'), 'value' => elgg_get_site_entity()->email, 'class' => 'elgg-input-text']);
echo elgg_view_field(['#type' => 'number', 'name' => 'default_limit', '#label' => elgg_echo('installation:default_limit'), 'value' => elgg_get_config('default_limit'), 'min' => 1, 'step' => 1]);
echo elgg_view_field(['#type' => 'select', 'name' => 'language', '#label' => elgg_echo('installation:language'), 'value' => elgg_get_config('language'), 'options_values' => get_installed_translations()]);
$footer = elgg_view('input/submit', ['value' => elgg_echo('save')]);
elgg_set_form_footer($footer);
开发者ID:elgg,项目名称:elgg,代码行数:9,代码来源:update_basic.php
注:本文中的get_installed_translations函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论