fixes HTM files parsing
This commit is contained in:
@@ -24,16 +24,16 @@ function get_text_for_indexing_htm(&$resource){
|
||||
if (!isadmin($USER->id)) return;
|
||||
|
||||
// just get text
|
||||
$text = implode('', file("{$CFG->dataroot}/{$resource->course}/($resource->reference)"));
|
||||
$text = implode('', file("{$CFG->dataroot}/{$resource->course}/{$resource->reference}"));
|
||||
|
||||
// extract keywords and other interesting meta information and put it back as real content for indexing
|
||||
if (preg_match('/(.*)<meta ([^>]*)>(.*)/is',$text, $matches)){
|
||||
if (preg_match('/(.*)<meta ([^>]*)>(.*)/is', $text, $matches)){
|
||||
$prefix = $matches[1];
|
||||
$meta_attributes = $matches[2];
|
||||
$suffix = $matches[3];
|
||||
if (preg_match('/name="(keywords|description)"/i', $attributes)){
|
||||
preg_match('/content="[^"]+"/i', $attributes, $matches);
|
||||
$text = $prefix.' '.$matches[1].' '.$suffix;
|
||||
if (preg_match('/name="(keywords|description)"/i', $meta_attributes)){
|
||||
preg_match('/content="[^"]+"/i', $meta_attributes, $matches);
|
||||
$text = $prefix.' '.$matches[0].' '.$suffix;
|
||||
}
|
||||
}
|
||||
// filter all html tags
|
||||
|
||||
Reference in New Issue
Block a user