diff -u -r -p1 -N radioactivity_orig/plugins/radioactivity_flag.info radioactivity/plugins/radioactivity_flag.info --- radioactivity_orig/plugins/radioactivity_flag.info 1969-12-31 19:00:00.000000000 -0500 +++ radioactivity/plugins/radioactivity_flag.info 2011-06-28 23:47:57.912254200 -0400 @@ -0,0 +1,6 @@ +name = Radioactivity Flag +description = "Integrates the Radioactivity module with the Flag module." +package = Radioactivity +core = 6.x +dependencies[] = flag +dependencies[] = radioactivity diff -u -r -p1 -N radioactivity_orig/plugins/radioactivity_flag.module radioactivity/plugins/radioactivity_flag.module --- radioactivity_orig/plugins/radioactivity_flag.module 1969-12-31 19:00:00.000000000 -0500 +++ radioactivity/plugins/radioactivity_flag.module 2011-06-28 23:49:01.780907300 -0400 @@ -0,0 +1,58 @@ +'. t('Adds energy via the Radioactivity module to (un)flagged content.'). '

'; + break; + } + + return $output; +} + +/** + * Implementation of hook_radioactivity_info(). + */ +function radioactivity_flag_radioactivity_info() { + $info = array('sources' => array()); + foreach (flag_get_types() as $type) { + $info['sources'][$type] = array(); + foreach (flag_get_flags($type) as $flag) { + $info['sources'][$type][$flag->name] = array( + 'title_placeholder' => t('Flag @type as @name', array( + '@type' => $type, + '@name' => $flag->title, + )), + ); + $info['sources'][$type]['un '. $flag->name] = array( + 'title_placeholder' => t('Unflag @type as @name', array( + '@type' => $type, + '@name' => $flag->title, + )), + ); + } + } + return $info; +} + +/** + * Implementation of hook_flag(). + */ +function radioactivity_flag_flag($event, $flag, $content_id, $account) { + module_load_include('inc', 'radioactivity'); + if ($event == 'flag') { + radioactivity_add_energy($content_id, $flag->content_type, $flag->name); + } + elseif ($event == 'unflag') { + radioactivity_add_energy($content_id, $flag->content_type, 'un '. $flag->name); + } +}