/** * Foreach plugin used in a object content call its save handler, * if one exist, and send email notifications when it has pending * status, if preference is enabled. * * A plugin save handler is a function defined on the plugin file * with the following format: wikiplugin_$pluginName_save() * * This function is called from object_post_save. Do not call directly. * * @param array $context object type and id * @param array $data * @return void */ private function plugin_post_save_actions($context, $data = null) { global $prefs; $parserlib = TikiLib::lib('parser'); if (is_null($data)) { $content = array(); if (isset($context['values'])) { $content = $context['values']; } if (isset($context['data'])) { $content[] = $context['data']; } $data['content'] = implode(' ', $content); } $argumentParser = new WikiParser_PluginArgumentParser(); $matches = WikiParser_PluginMatcher::match($data['content']); foreach ($matches as $match) { $plugin_name = $match->getName(); $body = $match->getBody(); $arguments = $argumentParser->parse($match->getArguments()); $dummy_output = ''; if ($parserlib->plugin_enabled($plugin_name, $dummy_output)) { $status = $parserlib->plugin_can_execute($plugin_name, $body, $arguments, true); // when plugin status is pending, $status equals plugin fingerprint if ($prefs['wikipluginprefs_pending_notification'] == 'y' && $status !== true && $status != 'rejected') { $this->plugin_pending_notification($plugin_name, $body, $arguments, $context); } $alias = new WikiPlugin_Negotiator_Wiki_Alias(); $alias->findImplementation($plugin_name, $body, $arguments); $func_name = 'wikiplugin_' . $plugin_name . '_save'; if (function_exists($func_name)) { $func_name($context, $body, $arguments); } } } }
public static function getList($includeReal = true, $includeAlias = true) { $real = array(); $alias = array(); foreach (glob('lib/wiki-plugins/wikiplugin_*.php') as $file) { $base = basename($file); $plugin = substr($base, 11, -4); $real[] = $plugin; } //Check for existence of Zend wiki plugins foreach (glob('lib/core/WikiPlugin/*.php', GLOB_NOCHECK) as $file) { if (is_file($file)) { $base = basename($file); if (strtolower($base) == $base) { //the zend plugins all have lower case names $plugin = substr($base, 0, -4); $real[] = $plugin; } } } if ($includeReal && $includeAlias) { $plugins = array_merge($real, WikiPlugin_Negotiator_Wiki_Alias::getList()); } elseif ($includeReal) { $plugins = $real; } elseif ($includeAlias) { $plugins = WikiPlugin_Negotiator_Wiki_Alias::getList(); } else { $plugins = array(); } $plugins = array_filter($plugins); sort($plugins); return $plugins; }
} } } } } WikiPlugin_Negotiator_Wiki_Alias::store($_POST['plugin_alias'], $info); if (!in_array($_POST['plugin_alias'], $pluginsAlias)) { $pluginAlias[] = $_POST['plugins']; } foreach (glob('temp/cache/wikiplugin_*') as $file) { unlink($file); } $pluginsAlias = WikiPlugin_Negotiator_Wiki_Alias::getList(); } } if (isset($_REQUEST['plugin_alias']) && ($pluginInfo = WikiPlugin_Negotiator_Wiki_Alias::info($_REQUEST['plugin_alias']))) { // Add an extra empty parameter to create new ones $pluginInfo['description']['params']['__NEW__'] = array('name' => '', 'description' => '', 'required' => '', 'safe' => ''); $pluginInfo['body']['params']['__NEW__'] = array('encoding' => '', 'input' => '', 'default' => ''); $pluginInfo['params']['__NEW__'] = array('pattern' => '', 'params' => array()); foreach ($pluginInfo['params'] as &$p) { if (is_array($p)) { $p['params']['__NEW__'] = array('encoding' => '', 'input' => '', 'default' => ''); } } $smarty->assign('plugin_admin', $pluginInfo); $cookietab = 3; } else { $smarty->assign('plugin_admin', array()); } $smarty->assign('plugins_alias', $pluginsAlias);
function plugin_alias_delete($name) { return WikiPlugin_Negotiator_Wiki_Alias::delete($name); }