"; return $new_contents; } function write_logic_file($module_name, $contents){ $file = "modules/".$module_name . '/logic_hooks.php'; $file = create_custom_directory($file); $fp = sugar_fopen($file, 'wb'); fwrite($fp,$contents); fclose($fp); //end function write_logic_file } function build_logic_file($hook_array){ $hook_contents = ""; $hook_contents .= "// Do not store anything in this file that is not part of the array or the hook version. This file will \n"; $hook_contents .= "// be automatically rebuilt in the future. \n "; $hook_contents .= "\$hook_version = 1; \n"; $hook_contents .= "\$hook_array = Array(); \n"; $hook_contents .= "// position, file, function \n"; foreach($hook_array as $event_array => $event){ $hook_contents .= "\$hook_array['".$event_array."'] = Array(); \n"; foreach($event as $second_key => $elements){ $hook_contents .= "\$hook_array['".$event_array."'][] = "; $hook_contents .= "Array(".$elements[0].", '".$elements[1]."', '".$elements[2]."','".$elements[3]."', '".$elements[4]."'); \n"; } //end foreach hook_array as event => action_array } $hook_contents .= "\n\n"; return $hook_contents; //end function build_logic_file } ?>