Adjust for templates

Use new t() for template button text
This commit is contained in:
Adam Magness 2018-01-22 22:20:35 -05:00
parent 220c566fbd
commit 21f593bf4b
3 changed files with 25 additions and 21 deletions

View file

@ -13,8 +13,8 @@ use Friendica\Object\Image;
/** /**
* @param App $a * @param App $a
*/ */
function fbrowser_content(App $a) { function fbrowser_content(App $a)
{
if (!local_user()) { if (!local_user()) {
killme(); killme();
} }
@ -43,9 +43,12 @@ function fbrowser_content(App $a) {
dbesc(L10n::t('Contact Photos')) dbesc(L10n::t('Contact Photos'))
); );
function _map_folder1($el){return [bin2hex($el['album']),$el['album']];}; function _map_folder1($el)
$albums = array_map( "_map_folder1" , $albums); {
return [bin2hex($el['album']),$el['album']];
};
$albums = array_map("_map_folder1", $albums);
} }
$album = ""; $album = "";
@ -65,7 +68,8 @@ function fbrowser_content(App $a) {
dbesc(L10n::t('Contact Photos')) dbesc(L10n::t('Contact Photos'))
); );
function _map_files1($rr){ function _map_files1($rr)
{
$a = get_app(); $a = get_app();
$types = Image::supportedTypes(); $types = Image::supportedTypes();
$ext = $types[$rr['type']]; $ext = $types[$rr['type']];
@ -74,10 +78,11 @@ function fbrowser_content(App $a) {
// Take the largest picture that is smaller or equal 640 pixels // Take the largest picture that is smaller or equal 640 pixels
$p = q("SELECT `scale` FROM `photo` WHERE `resource-id` = '%s' AND `height` <= 640 AND `width` <= 640 ORDER BY `resource-id`, `scale` LIMIT 1", $p = q("SELECT `scale` FROM `photo` WHERE `resource-id` = '%s' AND `height` <= 640 AND `width` <= 640 ORDER BY `resource-id`, `scale` LIMIT 1",
dbesc($rr['resource-id'])); dbesc($rr['resource-id']));
if ($p) if ($p) {
$scale = $p[0]["scale"]; $scale = $p[0]["scale"];
else } else {
$scale = $rr['loq']; $scale = $rr['loq'];
}
return [ return [
System::baseUrl() . '/photos/' . $a->user['nickname'] . '/image/' . $rr['resource-id'], System::baseUrl() . '/photos/' . $a->user['nickname'] . '/image/' . $rr['resource-id'],
@ -97,9 +102,9 @@ function fbrowser_content(App $a) {
'$files' => $files, '$files' => $files,
'$cancel' => L10n::t('Cancel'), '$cancel' => L10n::t('Cancel'),
'$nickname' => $a->user['nickname'], '$nickname' => $a->user['nickname'],
'$upload' => L10n::t('Upload')
]); ]);
break; break;
case "file": case "file":
if ($a->argc==2) { if ($a->argc==2) {
@ -107,7 +112,8 @@ function fbrowser_content(App $a) {
intval(local_user()) intval(local_user())
); );
function _map_files2($rr){ function _map_files2($rr)
{
$a = get_app(); $a = get_app();
list($m1,$m2) = explode("/", $rr['filetype']); list($m1,$m2) = explode("/", $rr['filetype']);
$filetype = ( (file_exists("images/icons/$m1.png"))?$m1:"zip"); $filetype = ( (file_exists("images/icons/$m1.png"))?$m1:"zip");
@ -127,8 +133,8 @@ function fbrowser_content(App $a) {
'$files' => $files, '$files' => $files,
'$cancel' => L10n::t('Cancel'), '$cancel' => L10n::t('Cancel'),
'$nickname' => $a->user['nickname'], '$nickname' => $a->user['nickname'],
'$upload' => L10n::t('Upload')
]); ]);
} }
break; break;
@ -140,6 +146,4 @@ function fbrowser_content(App $a) {
echo $o; echo $o;
killme(); killme();
} }
} }

View file

@ -40,7 +40,7 @@
</div> </div>
<div class="upload"> <div class="upload">
<button id="upload-{{$type}}"><img id="profile-rotator" src="images/rotator.gif" alt="{{$wait}}" title="{{$wait|escape:'html'}}" style="display: none;" /> {{"Upload"|t}}</button> <button id="upload-{{$type}}"><img id="profile-rotator" src="images/rotator.gif" alt="{{$wait}}" title="{{$wait|escape:'html'}}" style="display: none;" /> {{$upload}}</button>
</div> </div>
</div> </div>

View file

@ -58,7 +58,7 @@
</div> </div>
<div class="upload"> <div class="upload">
<button id="upload-{{$type}}">{{"Upload"|t}}</button> <button id="upload-{{$type}}">{{$upload}}</button>
</div> </div>
</div> </div>