staticpage sidebar fixed smarty load in backend and use parseTemplate()

This commit is contained in:
Ian 2012-02-02 14:22:17 +01:00
parent 72a701ff18
commit cd3c811e50
3 changed files with 22 additions and 16 deletions

View file

@ -1,6 +1,8 @@
3.89: bump version (sidebar 1.18) Fixed smarty load in backend (Timbalu)
3.88: Fixed guestbook link generation for non-rewrites (Timbalu)
(sidebar) 1.16: Added smartify option (by Timbalu)
1.16: (sidebar) Added smartify option (by Timbalu)
3.87: Add foreach check to prevent error

View file

@ -85,7 +85,7 @@ class serendipity_event_staticpage extends serendipity_event
$propbag->add('page_configuration', $this->config);
$propbag->add('type_configuration', $this->config_types);
$propbag->add('author', 'Marco Rinck, Garvin Hicking, David Rolston, Falk Doering, Stephan Manske, Pascal Uhlmann, Ian');
$propbag->add('version', '3.88');
$propbag->add('version', '3.89');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'smarty' => '2.6.7',

View file

@ -1,6 +1,6 @@
<?php # $Id: serendipity_plugin_staticpage.php, v1.0 2005/06/01
<?php # $Id$
# (c) by Rob Antonishen
# serendipity_plugin_staticpage.php, v1.0 2005/06/01 (c) by Rob Antonishen
if (IN_serendipity !== true) {
die ("Don't hack!");
@ -24,7 +24,7 @@ class serendipity_plugin_staticpage extends serendipity_plugin {
$propbag->add('description', PLUGIN_STATICPAGELIST_NAME_DESC);
$propbag->add('author', "Rob Antonishen, Falk Doering, Ian (Timbalu)");
$propbag->add('stackable', true);
$propbag->add('version', '1.17');
$propbag->add('version', '1.18');
$propbag->add('configuration', array(
'title',
'limit',
@ -117,7 +117,15 @@ class serendipity_plugin_staticpage extends serendipity_plugin {
return true;
}
function generate_content(&$title) {
function generate_content(&$title) {
$title = STATICPAGE_TITLE;
// do not load the tpl in backend
if(!defined('IN_serendipity_admin')) {
$this->show_content();
}
}
function show_content() {
global $serendipity;
static $smartify = null;
@ -196,17 +204,13 @@ class serendipity_plugin_staticpage extends serendipity_plugin {
}
if ($smartify) {
$serendipity['smarty']->assign('staticpage_jsStr', $str);
$serendipity['smarty']->assign('staticpage_listContent', $smartcar);
$serendipity['smarty']->assign(array(
'staticpage_jsStr' => $str,
'staticpage_listContent' => $smartcar
));
$filename = 'plugin_staticpage_sidebar.tpl';
$tfile = serendipity_getTemplateFile($filename, 'serendipityPath');
if (!$tfile || $tfile == $filename) {
$tfile = dirname(__FILE__) . '/' . $filename;
}
$inclusion = $serendipity['smarty']->security_settings[INCLUDE_ANY];
$serendipity['smarty']->security_settings[INCLUDE_ANY] = true;
$content = $serendipity['smarty']->fetch('file:'. $tfile);
$serendipity['smarty']->security_settings[INCLUDE_ANY] = $inclusion;
// use serendipity's own function here! ;-)
$content = $this->parseTemplate($filename);
echo $content;
} else {
echo $str;