diff options
author | friendica <info@friendica.com> | 2012-03-26 18:15:10 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2012-03-26 18:15:10 -0700 |
commit | 4c585f759f5c2662b2d761adccdf2c6dafd31249 (patch) | |
tree | 4490f26405409cf6101ef56d89a90aa06446ea96 | |
parent | b5d0315d55b6488d9493dd49bd35a2fe1b1492c7 (diff) | |
download | volse-hubzilla-4c585f759f5c2662b2d761adccdf2c6dafd31249.tar.gz volse-hubzilla-4c585f759f5c2662b2d761adccdf2c6dafd31249.tar.bz2 volse-hubzilla-4c585f759f5c2662b2d761adccdf2c6dafd31249.zip |
theme description with preview (non-translatable unfortunately)
-rwxr-xr-x | include/plugin.php | 1 | ||||
-rwxr-xr-x | js/main.js | 2 | ||||
-rw-r--r-- | mod/pretheme.php | 12 |
3 files changed, 13 insertions, 2 deletions
diff --git a/include/plugin.php b/include/plugin.php index df33fd3f2..e37ae8435 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 0b5fb5cdc..defd1f951 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('<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 diff --git a/mod/pretheme.php b/mod/pretheme.php index 5a71bbe53..0efa587d8 100644 --- a/mod/pretheme.php +++ b/mod/pretheme.php @@ -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(); } |