diff --git a/sites/all/modules/unl/unl.module b/sites/all/modules/unl/unl.module index 5d5979f5beca942c0b5e7087b7fb23b7db9acd3b..423e5827524ee7de3d174e5ad10b318d7ad1c92d 100644 --- a/sites/all/modules/unl/unl.module +++ b/sites/all/modules/unl/unl.module @@ -882,54 +882,6 @@ function unl_still_alive() echo '200 Still Alive'; } -/** - * Implementation of hook_filter_info(). - */ -function unl_filter_info() { - return array( - 'unl_embed' => array( - 'title' => 'UNL Node Embed', - 'description' => "Allow a node's body to be embedded into another node by using tags.", - 'process callback' => 'unl_filter_embed_process', - 'cache' => FALSE, - ), - ); -} - -/** - * Implementation of hook_filter_FILTER_process pseudo-hook - * - * Replace any instances of [[node:X]] in the $text with the content of node X's body. - */ -function unl_filter_embed_process($text, $filter, $format, $langcode, $cache, $cache_id) { - static $processed_hashes = array(); - - $text_hash = hash('sha256', $text); - if (in_array($text_hash, array_keys($processed_hashes))) { - // Possible recursion detected, return the cache result. - return $processed_hashes[$text_hash]; - } - - // In case of recursion, set the cached result to this until we have the real result. - $processed_hashes[$text_hash] = 'Error: Cannot embed a node in itself..'; - - $matches = NULL; - preg_match_all('/\[\[node:([0-9]+)\]\]/', $text, $matches); - $node_ids = $matches[1]; - $nodes = entity_load('node', $node_ids); - $replace_array = array(); - foreach ($node_ids as $node_id) { - $content = node_view($nodes[$node_id]); - $replace_array["[[node:$node_id]]"] = PHP_EOL . "<!-- Node $node_id start -->" . PHP_EOL - . render($content['body']) - . PHP_EOL . "<!-- Node $node_id end -->" . PHP_EOL; - } - $text = strtr($text, $replace_array); - // Set the cached result to the real result. - $processed_hashes[$text_hash] = $text; - return $text; -} - /** * Custom function to return the current admin theme for use with hook_menu_alter(). */