/** * 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); } } } }