### Eclipse Workspace Patch 1.0 #P Drupal Index: insert_block.module =================================================================== RCS file: /cvs/drupal/contributions/modules/insert_block/insert_block.module,v retrieving revision 1.4.2.1 diff -u -r1.4.2.1 insert_block.module --- insert_block.module 27 Jun 2007 15:09:26 -0000 1.4.2.1 +++ insert_block.module 11 Jan 2009 23:57:53 -0000 @@ -36,22 +36,12 @@ case 'prepare': return $text; case 'process': - return $text; + return _insert_block_substitute_tags($text); } } -function insert_block_nodeapi(&$node, $op, $arg) { - if ($op == 'alter') { - $node->body = _insert_block_substitute_tags($node, 'body'); - $node->teaser = _insert_block_substitute_tags($node, 'teaser'); - } - if ($op == 'print') { - $node->content['body']['#value'] = _insert_block_substitute_tags($node, 'body'); - } -} - -function _insert_block_substitute_tags(&$node, $field) { - if (preg_match_all("/\[block:([^=\\]]+)=?([^\\]]*)?\]/i", $node->$field, $match)) { +function _insert_block_substitute_tags($text) { + if (preg_match_all("/\[block:([^=\\]]+)=?([^\\]]*)?\]/i", $text, $match)) { foreach ($match[2] as $key => $value) { $module = $match[1][$key]; $delta = $match[2][$key]; @@ -61,9 +51,9 @@ $mtch[] = $match[0][$key]; $repl[] = theme('insert_block_block', $block); } - return str_replace($mtch, $repl, $node->$field); + return str_replace($mtch, $repl, $text); } - return $node->$field; + return $text; } function theme_insert_block_block($block) {