Commit 7967a311 authored by Jonny Bradley's avatar Jonny Bradley

Revert: r44599 Will find a better way

[MOD] search: Add new param to {list} to allow global php vars to be assigned to smarty for use in custom tpls...
parent df123e68
......@@ -11,7 +11,6 @@ class Search_Formatter_Plugin_SmartyTemplate implements Search_Formatter_Plugin_
private $changeDelimiters;
private $data = array();
private $fields = array();
private $assigns = array();
function __construct($templateFile, $changeDelimiters = false)
{
......@@ -24,24 +23,6 @@ class Search_Formatter_Plugin_SmartyTemplate implements Search_Formatter_Plugin_
$this->data = $data;
}
/**
* Set a list of global var names to assign to smarty so they can be used in custom templates
*
* @param array $assigns
*/
function setAssigns(array $assigns)
{
$assigns2 = array();
foreach ($assigns as $value) {
if (!isset($GLOBALS[trim($value)])) {
trigger_error('Global not found for assign var ' . $value);
} else {
$assigns2[] = trim($value);
}
}
$this->assigns = $assigns2;
}
function getFields()
{
return $this->fields;
......@@ -89,10 +70,6 @@ class Search_Formatter_Plugin_SmartyTemplate implements Search_Formatter_Plugin_
$smarty->assign($key, $value);
}
foreach ($this->assigns as $value) {
$smarty->assign($value, $GLOBALS[$value]);
}
$smarty->assign('results', $entries);
$smarty->assign('count', count($entries));
$smarty->assign('offset', $entries->getOffset());
......
......@@ -77,9 +77,6 @@ function wikiplugin_list($data, $params)
$plugin = new Search_Formatter_Plugin_SmartyTemplate($arguments['template']);
$plugin->setData($templateData);
$plugin->setFields(wp_list_findfields($templateData));
if (isset($arguments['assigns'])) {
$plugin->setAssigns(explode(',', $arguments['assigns']));
}
} elseif (isset($arguments['wiki']) && TikiLib::lib('tiki')->page_exists($arguments['wiki'])) {
$wikitpl = "tplwiki:" . $arguments['wiki'];
$wikicontent = TikiLib::lib('smarty')->fetch($wikitpl);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment