--- freelinking.module.orig 2009-09-15 15:15:33.000000000 -0500 +++ freelinking.module 2009-10-26 11:52:28.000000000 -0500 @@ -8,6 +8,30 @@ function _freelinking_include_all_plugin } // endforeach looping through plugins } // endfunction _freelinking_include_all_plugins + +function freelinking_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) { + switch($op) { + case 'view': + if ($node->type == variable_get('freelinking_node_scan', '')) { + if (strpos($node->body, 'freelink notfound') !== False) { + // get raw body from DB + $rbody = db_fetch_array(db_query('SELECT r.body FROM {node_revisions} r WHERE r.nid = %d ORDER BY r.timestamp DESC', $node->nid)); + // we must replicate the behavior of node_build_content() to get the right cache id + $body = str_replace('', '', $rbody['body']); + // find any cached entries + $cache_entries = db_fetch_array(db_query('SELECT cid FROM {cache_filter} c WHERE c.cid LIKE "%s"', "%:" . md5($body))); + // now clear them out + if($cache_entries != False) { + foreach ($cache_entries as $cid) { + drupal_set_message('clearing cache!'); + cache_clear_all($cid, 'cache_filter'); + } + } + } //endif strpos searching for not found freelink + } //endif node type check + } // endswitch $op +} // endfunction freelinking_nodeapi + function freelinking_filter($op, $delta = 0, $format = -1, $text = '', $langcode = '', $cache_id = 0) { global $freelinking; switch ($op) { @@ -100,6 +124,14 @@ function freelinking_settings() { } // endif plugin has a settings function } // endforeach looping through plugins + $form['freelinking_node_scan'] = array( + '#title' => t('Node type to scan'), + '#type' => 'select', + '#options' => node_get_types('names'), + '#default_value' => variable_get('freelinking_node_scan', 'story'), + '#description' => t('Scan this node type for updated freelinks.'), + ); + $form['freelinking_default'] = array( '#title' => t('Plugin to use when not indicated in the freelink'), '#type' => 'select',