]> git.mxchange.org Git - friendica.git/commitdiff
theme description with preview (non-translatable unfortunately)
authorfriendica <info@friendica.com>
Tue, 27 Mar 2012 01:15:10 +0000 (18:15 -0700)
committerfriendica <info@friendica.com>
Tue, 27 Mar 2012 01:15:10 +0000 (18:15 -0700)
include/plugin.php
js/main.js
mod/pretheme.php

index df33fd3f201975e0f63c3ebd2e331fb7e7636b2d..e37ae84357e2bba73d9a702ba3bb2fb6993d1fe9 100755 (executable)
@@ -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]);
index 0b5fb5cdc0edc786fc5bd4898ce9bb7a7d20722a..defd1f951ae6ec194437122d2a92eb9d9360f8c2 100755 (executable)
@@ -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>');
        });
 
 }
\ No newline at end of file
index 5a71bbe53e45168b8c99498254fe05f6e631da50..0efa587d8ce3b8f01b54205d205a8f412a289bc3 100644 (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();
 }