use native function parseTemplate() - extends to S9y >= 1.3

This commit is contained in:
Ian 2013-12-10 15:22:54 +01:00
parent 83bc9badb3
commit cb977a935c
2 changed files with 18 additions and 48 deletions

View file

@ -1,4 +1,4 @@
<?php # $Id: serendipity_event_cal.php, v.1.66 2011-02-23 12:55
<?php
##error_reporting(E_ALL);
@ -76,7 +76,7 @@ class serendipity_event_cal extends serendipity_event {
)
);
$propbag->add('author', 'Ian (Timbalu)');
$propbag->add('version', '1.67');
$propbag->add('version', '1.68');
$propbag->add('groups', array('FRONTEND_FEATURES', 'BACKEND_FEATURES'));
$propbag->add('requirements', array(
'serendipity' => '1.4',
@ -371,22 +371,6 @@ class serendipity_event_cal extends serendipity_event {
global $serendipity;
return ($serendipity['rewrite'] != 'errordocs') ? $this->get_config('permalink') : $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'] . '?serendipity[subpage]=' . $this->get_config('pagetitle');
}
/* get the right template path - as default in template folder or the fallback plugin folder */
function fetchTemplatePath($filename) {
global $serendipity;
$tfile = serendipity_getTemplateFile($filename, 'serendipityPath');
if (!$tfile || $filename == $tfile) {
$tfile = dirname(__FILE__) . '/' . $filename;
}
$inclusion = $serendipity['smarty']->security_settings[@INCLUDE_ANY];
$serendipity['smarty']->security_settings[@INCLUDE_ANY] = true;
// be smarty 3 compat including the serendipity_smarty class wrappers ->fetch and ->display methods and removed unused parameters
$content = $serendipity['smarty']->fetch('file:'. $tfile);
$serendipity['smarty']->security_settings[@INCLUDE_ANY] = $inclusion;
return $content;
}
/** mysql db function
* @param type string and db vars
@ -1275,7 +1259,7 @@ class serendipity_event_cal extends serendipity_event {
)
);
$icl = $this->fetchTemplatePath('plugin_eventcal_ical.tpl');
$icl = $this->parseTemplate('plugin_eventcal_ical.tpl');
$icl = $this->strip_ical_data($icl, '##STARTICAL##', '##ENDICAL##'); // make sure we get rid of every serendipity html output around ical file
return $icl;
@ -1404,7 +1388,7 @@ class serendipity_event_cal extends serendipity_event {
/* and assign the event calendar table weekview to smarty */
$serendipity['smarty']->assign('plugin_eventcal_cal_sedweek', $sdw);
/* fetch the smarty weekly template file */
$weekdata = $this->fetchTemplatePath('plugin_eventcal_calweek.tpl');
$weekdata = $this->parseTemplate('plugin_eventcal_calweek.tpl');
/* assign result to our main plugin_eventcal_cal.tpl file */
$serendipity['smarty']->assign('plugin_eventcal_cal_buildweektable', $weekdata);
}
@ -1456,7 +1440,7 @@ class serendipity_event_cal extends serendipity_event {
}
if (is_array($months)) {
echo $this->fetchTemplatePath('plugin_eventcal_cal.tpl');
echo $this->parseTemplate('plugin_eventcal_cal.tpl');
}
} /* end of draw_cal() function */
@ -1559,7 +1543,7 @@ class serendipity_event_cal extends serendipity_event {
/* get the show_single_event page template file */
if (is_array($event) && count($event)) {
$sedata = $this->fetchTemplatePath('plugin_eventcal_entry.tpl');
$sedata = $this->parseTemplate('plugin_eventcal_entry.tpl');
}
return $sedata;
@ -1600,7 +1584,7 @@ class serendipity_event_cal extends serendipity_event {
/* get the add form page template file */
if (is_array($events) && count($events)) {
$appdata = $this->fetchTemplatePath('plugin_eventcal_app.tpl');
$appdata = $this->parseTemplate('plugin_eventcal_app.tpl');
}
return isset($appdata) ? $appdata : false;
@ -1726,7 +1710,7 @@ class serendipity_event_cal extends serendipity_event {
/* get the add form page template file */
if (is_array($months)) {
$add_data = $this->fetchTemplatePath('plugin_eventcal_add.tpl');
$add_data = $this->parseTemplate('plugin_eventcal_add.tpl');
}
return $add_data;
} /* end of draw_add() function */
@ -2892,7 +2876,7 @@ class serendipity_event_cal extends serendipity_event {
}
if (is_array($events)) {
echo $this->fetchTemplatePath('plugin_eventcal_cal.tpl');
echo $this->parseTemplate('plugin_eventcal_cal.tpl');
}
}
@ -2993,7 +2977,7 @@ class serendipity_event_cal extends serendipity_event {
}
if (is_array($events)) {
echo $this->fetchTemplatePath('plugin_eventcal_cal.tpl');
echo $this->parseTemplate('plugin_eventcal_cal.tpl');
}
}
@ -3039,7 +3023,7 @@ class serendipity_event_cal extends serendipity_event {
$serendipity['smarty']->assign('plugin_eventcal_cal_buildaddtable', $add_form);
}
echo $this->fetchTemplatePath('plugin_eventcal_cal.tpl');
echo $this->parseTemplate('plugin_eventcal_cal.tpl');
}

View file

@ -1,4 +1,6 @@
<?php # $Id: serendipity_event_downloadmanager.php, v.0.26 - 2011-02-15 20:21 ian
<?php
# serendipity_event_downloadmanager.php, v.0.26 - 2011-02-15 20:21 ian
if (IN_serendipity !== true) {
die ("Don't hack!");
@ -43,12 +45,12 @@ class serendipity_event_downloadmanager extends serendipity_event {
$propbag->add('name', PLUGIN_DOWNLOADMANAGER_TITLE);
$propbag->add('description', PLUGIN_DOWNLOADMANAGER_DESC);
$propbag->add('requirements', array(
'serendipity' => '0.8',
'serendipity' => '1.3',
'smarty' => '2.6.7',
'php' => '5.0.0'
));
$propbag->add('version', '0.28');
$propbag->add('version', '0.29');
$propbag->add('author', 'Alexander \'dma147\' Mieland, Grischa Brockhaus, Ian (Timbalu)');
$propbag->add('stackable', false);
$propbag->add('event_hooks', array(
@ -1014,7 +1016,7 @@ class serendipity_event_downloadmanager extends serendipity_event {
}
/* get the frontend dlm template file */
echo $this->fetchTemplatePath($filename);
echo $this->parseTemplate($filename);
}
@ -1466,22 +1468,6 @@ class serendipity_event_downloadmanager extends serendipity_event {
}
/* get the right template path - as default in template folder or the fallback plugin folder */
function fetchTemplatePath($filename) {
global $serendipity;
$tfile = serendipity_getTemplateFile($filename, 'serendipityPath');
if (!$tfile || $filename == $tfile) {
$tfile = dirname(__FILE__) . '/' . $filename;
}
$inclusion = $serendipity['smarty']->security_settings[@INCLUDE_ANY];
$serendipity['smarty']->security_settings[@INCLUDE_ANY] = true;
// be smarty 3 compat including the serendipity_smarty class wrappers ->fetch and ->display methods and remove changed parameter number 4
$content = $serendipity['smarty']->fetch('file:'. $tfile);//, false
$serendipity['smarty']->security_settings[@INCLUDE_ANY] = $inclusion;
return $content;
}
function ADMIN_showDownloads() {
global $serendipity;
@ -1694,7 +1680,7 @@ class serendipity_event_downloadmanager extends serendipity_event {
}
/* get the backend dlm index template file */
echo $this->fetchTemplatePath('backend.dlm.index.tpl');
echo $this->parseTemplate('backend.dlm.index.tpl');
} // logged-in end
}