From: friendica Date: Tue, 27 Mar 2012 01:15:10 +0000 (-0700) Subject: theme description with preview (non-translatable unfortunately) X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4c585f759f5c2662b2d761adccdf2c6dafd31249;p=friendica.git theme description with preview (non-translatable unfortunately) --- diff --git a/include/plugin.php b/include/plugin.php index df33fd3f20..e37ae84357 100755 --- a/include/plugin.php +++ b/include/plugin.php @@ -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]); diff --git a/js/main.js b/js/main.js index 0b5fb5cdc0..defd1f951a 100755 --- a/js/main.js +++ b/js/main.js @@ -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('' + theme + ''); + $('#theme-preview').html('
' + data.desc + '
' + theme + ''); }); } \ No newline at end of file diff --git a/mod/pretheme.php b/mod/pretheme.php index 5a71bbe53e..0efa587d8c 100644 --- a/mod/pretheme.php +++ b/mod/pretheme.php @@ -1,6 +1,16 @@ 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(); }