You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

38 lines
1.2 KiB

<?php
function smarty_block_packageplugin($params, $content, $smarty)
{
extract($params, EXTR_SKIP);
if (empty($params['package']) || empty($params['plugin'])) {
return tra("Please specify the name of the package and the wiki plugin.");
}
if (! $extensionPackage = \Tiki\Package\ExtensionManager::get($params['package'])) {
return tr('Package %0 is not enabled', $params['package']);
}
$path = $extensionPackage->getPath() . '/lib/wiki-plugins/' . $params['plugin'] . '.php';
if (! file_exists($path)) {
return tra("Error: Unable to locate wiki plugin file for the package.");
}
require_once($path);
$namespace = $extensionPackage->getBaseNamespace();
if (! empty($namespace)) {
$namespace .= '\\PackagePlugins\\';
}
$functionname = $namespace . $params['plugin'];
if (! function_exists($functionname)) {
return tra("Error: Unable to locate function name for the package plugin.");
}
if ($params['assign']) {
$smarty->assign($params['assign'], $functionname($content, $params, $smarty));
} else {
return $functionname($content, $params, $smarty);
}
}