本文整理汇总了PHP中i18n_get_translated函数的典型用法代码示例。如果您正苦于以下问题:PHP i18n_get_translated函数的具体用法?PHP i18n_get_translated怎么用?PHP i18n_get_translated使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了i18n_get_translated函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setLink
function setLink($selector, $url, $title, $rel = 'lightbox')
{
?>
<script>
jQuery(document).ready(function() {
jQuery('<?php
echo $selector;
?>
')
.attr('href', '<?php
echo $url;
?>
')
.attr('title', '<?php
echo addslashes(htmlspecialchars(i18n_get_translated($title)));
?>
')
.attr('rel', '<?php
echo $rel;
?>
')
.attr('onmouseup', 'closeModalOnLightBoxEnable();');
});
</script>
<?php
}
示例2: DisplayThemeBar
function DisplayThemeBar($theme1)
{
global $lang,$flag_new_themes,$contact_sheet,$theme_images,$allow_share,$n,$baseurl;
# Work out theme name
$themename=$theme1;
$theme_display=getval("theme_$n","off");
$themes=get_themes(array($theme1));
if (count($themes)>0)
{
?>
<div
onclick="
var theme_display=get_cookie('theme_<?php echo $n?>');
if (theme_display=='off'){var toggle_theme_display='on';} else { var toggle_theme_display='off';}
SetCookie('theme_<?php echo $n?>',toggle_theme_display,1000);
jQuery('#themebar_<?php echo htmlspecialchars(str_replace(array("\""," "),"",$themename)) ?>').slideToggle(0.2);
return false;">
<a href='#'><b><?php echo htmlspecialchars(stripslashes(i18n_get_translated(str_replace("*","",$themename)))) ?></b></a></div>
<div id="themebar_<?php echo htmlspecialchars(str_replace(array("\""," "),"",$themename)) ?>" style="display:<?php if ($theme_display == 'off'){echo 'none';} else {echo '';}?>" >
<?php
for ($m=0;$m<count($themes);$m++)
{ ?><br>
<a href="<?php echo $baseurl?>/pages/search.php?search=!collection<?php echo $themes[$m]["ref"]?>&bc_from=themes" title="<?php echo $lang["collectionviewhover"]?>"><?php echo htmlspecialchars(i18n_get_collection_name($themes[$m])) ?></a>
<?php
}
?><br><br></div><?php
}
}
示例3: i18n_get_translated
function i18n_get_translated($text)
{
# For field names / values using the i18n syntax, return the version in the current user's language
# Format is ~en:Somename~es:Someothername
$text = trim($text);
# For multiple keywords, parse each keyword.
if (strpos($text, ",") !== false && strpos($text, "~") !== false) {
$s = explode(",", $text);
$out = "";
for ($n = 0; $n < count($s); $n++) {
if ($n > 0) {
$out .= ",";
}
$out .= i18n_get_translated(trim($s[$n]));
}
return $out;
}
global $language, $defaultlanguage;
$asdefaultlanguage = $defaultlanguage;
if (!isset($asdefaultlanguage)) {
$asdefaultlanguage = 'en';
}
# Split
$s = explode("~", $text);
# Not a translatable field?
if (count($s) < 2) {
return $text;
}
# Find the current language and return it
$default = "";
for ($n = 1; $n < count($s); $n++) {
# Not a translated string, return as-is
if (substr($s[$n], 2, 1) != ":" && substr($s[$n], 5, 1) != ":" && substr($s[$n], 0, 1) != ":") {
return $text;
}
# Support both 2 character and 5 character language codes (for example en, en-US).
$p = strpos($s[$n], ':');
$textLanguage = substr($s[$n], 0, $p);
if ($textLanguage == $language) {
return substr($s[$n], $p + 1);
}
if ($textLanguage == $asdefaultlanguage || $p == 0) {
$default = substr($s[$n], $p + 1);
}
}
# Translation not found? Return default language
# No default language entry? Then consider this a broken language string and return the string unprocessed.
if ($default != "") {
return $default;
} else {
return $text;
}
}
示例4: HookResourceconnectCollectionsThumblistextra
function HookResourceconnectCollectionsThumblistextra()
{
global $usercollection;
$thumbs = sql_query("select * from resourceconnect_collection_resources where collection='{$usercollection}' order by date_added desc");
foreach ($thumbs as $thumb) {
?>
<!--Resource Panel-->
<div class="CollectionPanelShell">
<table border="0" class="CollectionResourceAlign"><tr><td>
<a target="main" href="../plugins/resourceconnect/pages/view.php?url=<?php
echo urlencode($thumb["url"]);
?>
&k=<?php
echo getval("k", "");
?>
&col=<?php
echo $usercollection;
?>
"><img border=0 src="<?php
echo $thumb["thumb"];
?>
" class="CollectImageBorder" /></a></td>
</tr></table>
<div class="CollectionPanelInfo"><a target="main" href="../plugins/resourceconnect/pages/view.php?url=<?php
echo urlencode($thumb["url"]);
?>
&k=<?php
echo getval("k", "");
?>
&col=<?php
echo $usercollection;
?>
"><?php
echo tidy_trim(i18n_get_translated($thumb["title"]), 15);
?>
</a> </div>
<div class="CollectionPanelInfo">
<a href="collections.php?resourceconnect_remove=<?php
echo $thumb["ref"];
?>
&nc=<?php
echo time();
?>
">x Remove</a></div>
</div>
<?php
}
}
示例5: HookResourceofthedayHomeReplaceslideshow
function HookResourceofthedayHomeReplaceslideshow()
{
include_once dirname(__FILE__) . "/../inc/rotd_functions.php";
global $baseurl, $view_title_field;
$rotd = get_resource_of_the_day();
if ($rotd === false) {
return false;
}
# No ROTD, return false to disable hook and display standard slide show.
# Get preview width
$sizes = get_image_sizes($rotd, true);
foreach ($sizes as $size) {
if ($size["id"] == "pre") {
$width = $size["width"];
break;
}
}
# Fetch title
$title = sql_value("select value from resource_data where resource='{$rotd}' and resource_type_field={$view_title_field}", "");
# Fetch caption
$caption = sql_value("select value from resource_data where resource='{$rotd}' and resource_type_field=18", "");
# Show resource!
$pre = get_resource_path($rotd, false, "pre", false, "jpg");
?>
<div class="HomePicturePanel RecordPanel" style="width: <?php
echo $width;
?>
px; padding-left: 3px;">
<a onClick="return CentralSpaceLoad(this,true);" href="<?php
echo $baseurl;
?>
/pages/view.php?ref=<?php
echo $rotd;
?>
"><img class="ImageBorder" style="margin-bottom: 10px;" src="<?php
echo $pre;
?>
" /></a>
<br />
<h2 ><?php
echo i18n_get_translated(htmlspecialchars($title));
?>
</h2>
<?php
echo $caption;
?>
</div>
<?php
return true;
}
示例6: generateResourcesMetadataCSV
/**
* Generates the CSV content of the metadata for resources passed in the array
*
* @param $resources
* @return string
*/
function generateResourcesMetadataCSV(array $resources)
{
global $lang;
$return = '';
$csv_field_headers = array();
$resources_fields_data = array();
foreach ($resources as $resource) {
foreach (get_resource_field_data($resource['ref'], false, true, -1, getval("k", "") != "") as $field_data) {
if ($field_data['name'] == '') {
die('Please check field ID ' . $field_data['ref'] . ' and make sure its "' . $lang['property-shorthand_name'] . '" is set!');
}
$csv_field_headers[$field_data['name']] = $field_data['title'];
$resources_fields_data[$resource['ref']][$field_data['name']] = $field_data['value'];
}
}
$csv_field_headers = array_unique($csv_field_headers);
// Header
$return = '"' . $lang['resourceids'] . '","' . implode('","', $csv_field_headers) . "\"\n";
// Results
$csv_row = '';
foreach ($resources_fields_data as $resource_id => $resource_fields) {
// First column will always be Resource ID
$csv_row = $resource_id . ',';
// Field values
foreach ($csv_field_headers as $column_header => $column_header_title) {
if (!array_key_exists($column_header, $resource_fields)) {
$csv_row .= '"",';
continue;
}
foreach ($resource_fields as $field_name => $field_value) {
if ($column_header == $field_name) {
$csv_row .= '"' . tidylist(i18n_get_translated($field_value)) . '",';
}
}
}
$csv_row .= "\n";
$return .= $csv_row;
}
return $return;
}
示例7: HookResourceConnectAllSearchfiltertop
function HookResourceConnectAllSearchfiltertop()
{
# Option to search affiliate systems in the basic search panel
global $lang, $language, $resourceconnect_affiliates, $baseurl, $resourceconnect_selected;
if (!checkperm("resourceconnect")) {
return false;
}
?>
<div class="SearchItem"><?php
echo $lang["resourceconnect_affiliate"];
?>
<br />
<select class="SearchWidth" name="resourceconnect_selected">
<?php
for ($n = 0; $n < count($resourceconnect_affiliates); $n++) {
?>
<option value="<?php
echo $n;
?>
" <?php
if ($resourceconnect_selected == $n) {
?>
selected<?php
}
?>
><?php
echo i18n_get_translated($resourceconnect_affiliates[$n]["name"]);
?>
</option>
<?php
}
?>
</select>
</div>
<?php
}
示例8: HookResourceofthedayHomeReplaceslideshow
function HookResourceofthedayHomeReplaceslideshow()
{
include_once dirname(__FILE__) . "/../inc/rotd_functions.php";
$rotd = get_resource_of_the_day();
if ($rotd === false) {
return false;
}
# No ROTD, return false to disable hook and display standard slide show.
# Fetch resource data
$resource = get_resource_data($rotd);
# Fetch title
$title = sql_value("select value from resource_data where resource='{$rotd}' and resource_type_field=8", "");
# Fetch caption
$caption = sql_value("select value from resource_data where resource='{$rotd}' and resource_type_field=18", "");
# Show resource!
$pre = get_resource_path($rotd, false, "pre", false, "jpg");
?>
<div class="HomePicturePanel RecordPanel" style="width:350px;padding-left:4px;">
<a href="view.php?ref=<?php
echo $rotd;
?>
"><img class="ImageBorder" style="margin-bottom: 10px;" src="<?php
echo $pre;
?>
" /></a>
<br />
<h2 ><?php
echo i18n_get_translated(htmlspecialchars($title));
?>
</h2>
<?php
echo $caption;
?>
</div>
<?php
return true;
}
示例9: generateResourcesMetadataCSV
/**
* Generates the CSV content of the metadata for resources passed in the array
*
* @param $resources
* @return string
*/
function generateResourcesMetadataCSV(array $resources)
{
global $lang;
$return = '';
$csv_field_headers = array();
$resources_fields_data = array();
foreach ($resources as $resource) {
foreach (get_resource_field_data($resource['ref'], false, true, -1, getval("k", "") != "") as $field_data) {
$csv_field_headers[$field_data['resource_type_field']] = $field_data['title'];
$resources_fields_data[$resource['ref']][$field_data['resource_type_field']] = $field_data['value'];
}
}
$csv_field_headers = array_unique($csv_field_headers);
// Header
$return = '"' . $lang['resourceids'] . '","' . implode('","', $csv_field_headers) . "\"\n";
// Results
$csv_row = '';
foreach ($resources_fields_data as $resource_id => $resource_fields) {
// First column will always be Resource ID
$csv_row = $resource_id . ',';
// Field values
foreach ($csv_field_headers as $column_header => $column_header_title) {
if (!array_key_exists($column_header, $resource_fields)) {
$csv_row .= '"",';
continue;
}
foreach ($resource_fields as $field_name => $field_value) {
if ($column_header == $field_name) {
$csv_row .= '"' . str_replace(array("\\n", "\\r", "\""), "//", tidylist(i18n_get_translated($field_value))) . '",';
}
}
}
$csv_row .= "\n";
$return .= $csv_row;
}
return $return;
}
示例10: htmlspecialchars
<!--List Item-->
<tr>
<td><?php echo htmlspecialchars(nicedate($log[$n]["date"],true)) ?></td>
<td><?php echo htmlspecialchars($log[$n]["fullname"])?></td>
<td><?php
echo $lang["collectionlog-" . $log[$n]["type"]] ;
if ($log[$n]["notes"] != "" ) {
## notes field contains user IDs, collection references and /or standard texts
## Translate the standard texts
$standard = array('#all_users', '#new_resource');
$translated = array($lang["all_users"], $lang["new_resource"]);
$newnotes = str_replace($standard, $translated, $log[$n]["notes"]);
echo $newnotes;
}
?></td>
<td><?php if ($log[$n]['resource']!=0){?><a onClick="return CentralSpaceLoad(this,true);" href='<?php echo $baseurl_short?>pages/view.php?ref=<?php echo urlencode($log[$n]["resource"]) ?>'><?php echo $log[$n]["resource"]?></a><?php } ?></td>
<td><?php if ($log[$n]['resource']!=0){?><a onClick="return CentralSpaceLoad(this,true);" href='<?php echo $baseurl_short?>pages/view.php?ref=<?php echo urlencode($log[$n]["resource"]) ?>'><?php echo i18n_get_translated($log[$n]["title"])?></a><?php } ?></td>
</tr>
<?php } ?>
</table>
</div> <!-- End of Listview -->
<div class="BottomInpageNav">
<?php pager(false); ?></div>
</div> <!-- End of BasicsBox -->
<?php
include "../include/footer.php";
?>
示例11: format_display_field
function format_display_field($value)
{
// applies trim/wordwrap/highlights
global $results_title_trim, $results_title_wordwrap, $df, $x, $search;
if (isset($df[$x]['type']) && $df[$x]['type'] == 8) {
$value = strip_tags($value);
}
$string = i18n_get_translated($value);
$string = TidyList($string);
//$string=tidy_trim($string,$results_title_trim);
$string = htmlspecialchars($string);
$string = highlightkeywords($string, $search, $df[$x]['partial_index'], $df[$x]['name'], $df[$x]['indexed']);
return $string;
}
示例12: CentralSpaceLoad
'><?php
echo $log[$n]["resourceid"];
?>
</a></td>
<td><?php
if (!hook("replaceuserlogtitlelink")) {
?>
<a onClick="return CentralSpaceLoad(this,true);" href='<?php
echo $baseurl_short;
?>
pages/view.php?ref=<?php
echo $log[$n]["resourceid"];
?>
'><?php
if (!hook("replaceuserlogtitle")) {
echo i18n_get_translated($log[$n]["resourcetitle"]);
}
?>
</a><?php
}
?>
</td>
<td><?php
echo $lang["log-" . $log[$n]["type"]];
# For emailed items, append email address from the 'notes' column
if ($log[$n]["type"] == "E") {
echo " " . $log[$n]["notes"];
}
# For purchases, append size and price
if ($log[$n]["type"] == "p") {
示例13: urlencode
if (isset($metadata_template_title_field) && isset($metadata_template_resource_type))
{
if ($result[$n]['resource_type']==$metadata_template_resource_type)
{
$title=$result[$n]["field".$metadata_template_title_field];
}
}
?>
<!--Resource Panel-->
<div class="ResourcePanelShellSmall">
<table border="0" class="ResourceAlignSmall"><tr><td>
<a href="<?php echo $baseurl_short?>pages/view.php?ref=<?php echo $rref?>&search=<?php echo urlencode("!related" . $ref)?>" onClick="return CentralSpaceLoad(this,true);"><?php if ($result[$n]["has_image"]==1) { ?><img border=0 src="<?php echo get_resource_path($rref,false,"col",false,$result[$n]["preview_extension"],-1,1,checkperm("w"),$result[$n]["file_modified"])?>" class="CollectImageBorder"/><?php } else { ?><img border=0 src="../gfx/<?php echo get_nopreview_icon($result[$n]["resource_type"],$result[$n]["file_extension"],true)?>"/><?php } ?></a></td>
</tr></table>
<div class="ResourcePanelInfo"><a href="<?php echo $baseurl_short?>pages/view.php?ref=<?php echo $rref?>" onClick="return CentralSpaceLoad(this,true);"><?php echo tidy_trim(i18n_get_translated($title),15)?></a> </div>
<div class="ResourcePanelIcons"><input type="checkbox" id="share<?php echo $rref ?>" class="checkselect" onChange="UpdateRelatedField(this,<?php echo $rref ?>);"></div>
</div>
<?php
}
}
?>
</div><!-- end of sharerelatedtype -->
<div class="clearerleft"> </div>
<?php
} //end of display loop by resource extension
?>
</div>
<div class="clearerleft"> </div>
示例14: i18n_get_translated
<div class="Question" id="question_access">
<label for="archive"><?php echo $lang["access"]?></label>
<select class="stdwidth" name="access" id="access">
<?php
# List available access levels. The highest level must be the minimum user access level.
for ($n=$minaccess;$n<=1;$n++) { ?>
<option value="<?php echo $n?>"><?php echo $lang["access" . $n]?></option>
<?php } ?>
</select>
<div class="clearerleft"> </div>
</div>
<?php
for ($x=0;$x<$themecount;$x++)
{ ?>
<input type="hidden" name="theme<?php echo $x+1 ?>" id="theme<?php echo $x+1 ?>" value="<?php echo i18n_get_translated($themes[$x]) ?>">
<?php
}
?>
<div class="Question">
<label><?php echo $lang["expires"]?></label>
<select name="expires" class="stdwidth">
<option value=""><?php echo $lang["never"]?></option>
<?php for ($n=1;$n<=150;$n++)
{
$date=time()+(60*60*24*$n);
?><option <?php $d=date("D",$date);if (($d=="Sun") || ($d=="Sat")) { ?>style="background-color:#cccccc"<?php } ?> value="<?php echo date("Y-m-d",$date)?>"><?php echo nicedate(date("Y-m-d",$date),false,true)?></option>
<?php
}
?>
示例15: foreach
?>
<?php
if ($type == 3) {
# Drop down box
?>
<select name="custom<?php
echo $n;
?>
" id="custom<?php
echo $n;
?>
" class="stdwidth">
<?php
foreach ($custom_request_options[$custom[$n]] as $option) {
$val = i18n_get_translated($option);
?>
<option <?php
if (getval("custom" . $n, "") == $val) {
?>
selected<?php
}
?>
><?php
echo htmlspecialchars($val);
?>
</option>
<?php
}
?>
</select>