1
0

fixed github preview image path

This commit is contained in:
Ian
2012-08-22 20:41:58 +02:00
parent 16b4cc6741
commit 2fafa72157

View File

@ -798,6 +798,7 @@ class serendipity_event_spartacus extends serendipity_event
function &buildTemplateList(&$tree) { function &buildTemplateList(&$tree) {
$pluginstack = array(); $pluginstack = array();
$i = 0; $i = 0;
$gitloc = '';
$mirrors = $this->getMirrors('files', true); $mirrors = $this->getMirrors('files', true);
$mirror = $mirrors[$this->get_config('mirror_files', 0)]; $mirror = $mirrors[$this->get_config('mirror_files', 0)];
@ -808,6 +809,10 @@ class serendipity_event_spartacus extends serendipity_event
$mirror = $servers[0]; $mirror = $servers[0];
} }
if (stristr($mirror, 'github.com')) {
$gitloc = 'master/';
}
$this->checkArray($tree); $this->checkArray($tree);
foreach($tree[0]['children'] AS $idx => $subtree) { foreach($tree[0]['children'] AS $idx => $subtree) {
@ -825,7 +830,7 @@ class serendipity_event_spartacus extends serendipity_event
break; break;
case 'template': case 'template':
$pluginstack[$i]['template'] = $childtree['value']; $pluginstack[$i]['template'] = $childtree['value'];
break; break;
case 'description': case 'description':
@ -862,13 +867,13 @@ class serendipity_event_spartacus extends serendipity_event
} }
$plugname = $pluginstack[$i]['template']; $plugname = $pluginstack[$i]['template'];
$pluginstack[$i]['previewURL'] = $mirror . '/additional_themes/' . $plugname . '/preview.png?revision=1.9999'; $pluginstack[$i]['previewURL'] = $mirror . '/additional_themes/' . $gitloc . $plugname . '/preview.png?revision=1.9999';
$pluginstack[$i]['preview_fullsizeURL'] = $mirror . '/additional_themes/' . $plugname . '/preview_fullsize.jpg?revision=1.9999'; $pluginstack[$i]['preview_fullsizeURL'] = $mirror . '/additional_themes/' . $gitloc . $plugname . '/preview_fullsize.jpg?revision=1.9999';
$pluginstack[$i]['customURI'] = '&serendipity[spartacus_fetch]=' . $plugname; $pluginstack[$i]['customURI'] = '&serendipity[spartacus_fetch]=' . $plugname;
$pluginstack[$i]['customIcon'] = '_spartacus'; $pluginstack[$i]['customIcon'] = '_spartacus';
// Remove the temporary $i reference, as the array should be associative // Remove the temporary $i reference, as the array should be associative and fix double slashes in url string
$pluginstack[$plugname] = $pluginstack[$i]; $pluginstack[$plugname] = str_replace('//', '/', $pluginstack[$i]);
unset($pluginstack[$i]); unset($pluginstack[$i]);
} }
} }