Automatic installer.php lang files by installer_builder (20070726)
[moodle-linuxchix.git] / search / documents / physical_xml.php
blob64162a252b01e3ba86771c9095edf0f29dcc3272
1 <?php
2 /**
3 * Global Search Engine for Moodle
4 * add-on 1.8+ : Valery Fremaux [valery.fremaux@club-internet.fr]
5 * 2007/08/02
7 * this is a format handler for getting text out of a proprietary binary format
8 * so it can be indexed by Lucene search engine
9 */
11 function get_text_for_indexing_xml(&$resource){
12 global $CFG, $USER;
14 // SECURITY : do not allow non admin execute anything on system !!
15 if (!isadmin($USER->id)) return;
17 // just get text
18 $text = implode('', file("{$CFG->dataroot}/{$resource->course}/($resource->reference)"));
20 // filter out all xml tags
21 $text = preg_replace("/<[^>]*>/", ' ', $text);
23 if (!empty($CFG->block_search_limit_index_body)){
24 $text = shorten($text, $CFG->block_search_limit_index_body);
26 return $text;