spartacus: only set template fullsize preview if existing, cached
This commit is contained in:
@ -803,6 +803,7 @@ class serendipity_event_spartacus extends serendipity_event
|
||||
}
|
||||
|
||||
function &buildTemplateList(&$tree) {
|
||||
global $serendipity;
|
||||
$pluginstack = array();
|
||||
$i = 0;
|
||||
$gitloc = '';
|
||||
@ -877,7 +878,19 @@ class serendipity_event_spartacus extends serendipity_event
|
||||
|
||||
$plugname = $pluginstack[$i]['template'];
|
||||
$pluginstack[$i]['previewURL'] = $this->fixUrl($mirror . '/additional_themes/' . $gitloc . $plugname . '/preview.png?revision=1.9999');
|
||||
$pluginstack[$i]['preview_fullsizeURL'] = $this->fixUrl($mirror . '/additional_themes/' . $gitloc . $plugname . '/preview_fullsize.jpg?revision=1.9999');
|
||||
$preview_fullsizeURL = $this->fixUrl($mirror . '/additional_themes/' . $gitloc . $plugname . '/preview_fullsize.jpg?revision=1.9999');
|
||||
if (! file_exists($serendipity['serendipityPath'] . '/templates_c/template_cache')) {
|
||||
mkdir($serendipity['serendipityPath'] . '/templates_c/template_cache');
|
||||
}
|
||||
if (! file_exists($serendipity['serendipityPath'] . '/templates_c/template_cache/'. $plugname .'.jpg')) {
|
||||
$file = @fopen($preview_fullsizeURL, 'r');
|
||||
if ($file) {
|
||||
file_put_contents($serendipity['serendipityPath'] . '/templates_c/template_cache/'. $plugname .'.jpg', $file);
|
||||
}
|
||||
}
|
||||
if (file_exists($serendipity['serendipityPath'] . '/templates_c/template_cache/'. $plugname .'.jpg')) {
|
||||
$pluginstack[$i]['preview_fullsizeURL'] = $preview_fullsizeURL;
|
||||
}
|
||||
$pluginstack[$i]['customURI'] = '&serendipity[spartacus_fetch]=' . $plugname;
|
||||
$pluginstack[$i]['customIcon'] = '_spartacus';
|
||||
|
||||
|
Reference in New Issue
Block a user