Browse Source

theme description with preview (non-translatable unfortunately)

pull/175/merge
friendica 9 years ago
parent
commit
4c585f759f
3 changed files with 13 additions and 2 deletions
  1. +1
    -0
      include/plugin.php
  2. +1
    -1
      js/main.js
  3. +11
    -1
      mod/pretheme.php

+ 1
- 0
include/plugin.php View File

@ -249,6 +249,7 @@ function get_theme_info($theme){
list($k,$v) = array_map("trim", explode(":",$l,2));
$k= strtolower($k);
if ($k=="author"){
$r=preg_match("|([^<]+)<([^>]+)>|", $v, $m);
if ($r) {
$info['author'][] = array('name'=>$m[1], 'link'=>$m[2]);


+ 1
- 1
js/main.js View File

@ -591,7 +591,7 @@ Array.prototype.remove = function(item) {
function previewTheme(elm) {
theme = $(elm).val();
$.getJSON('pretheme?f=&theme=' + theme,function(data) {
$('#theme-preview').html('<a href="' + data.img + '"><img src="' + data.img + '" width="320" height="240" alt="' + theme + '" /></a>');
$('#theme-preview').html('<div id="theme-desc">' + data.desc + '</div><a href="' + data.img + '"><img src="' + data.img + '" width="320" height="240" alt="' + theme + '" /></a>');
});
}

+ 11
- 1
mod/pretheme.php View File

@ -1,6 +1,16 @@
<?php
function pretheme_init(&$a) {
if($_REQUEST['theme']) echo json_encode(array('img' => get_theme_screenshot($_REQUEST['theme'])));
if($_REQUEST['theme']) {
$theme = $_REQUEST['theme'];
$info = get_theme_info($theme);
if($info) {
// unfortunately there will be no translation for this string
$desc = $info['description'] . ' ' . $info['version'];
}
else $desc = '';
echo json_encode(array('img' => get_theme_screenshot($theme), 'desc' => $desc));
}
killme();
}

Loading…
Cancel
Save