MDL-31989 search: Search API and search engine API

Introducing both APIs in moodle along with:
- search_box widget to add a tiny search box
- admin settings with setup steps helper
- cache for search results
- template for a search result
- php unit stuff

Many thanks to Tomasz Muras, Prateek Sachan and Daniel Neis for their contributions, for starting this development
and for pushing for it to be completed. Also thanks to other contributors: Jonathan Harker and eugeneventer.
This commit is contained in:
David Monllao
2016-02-23 10:47:58 +00:00
committed by Dan Poltawski
parent 95c6aeaf1c
commit db48207e1a
38 changed files with 3571 additions and 7 deletions
+21
View File
@@ -169,6 +169,27 @@ function editors_head_setup() {
}
}
/**
* Converts editor text input in different formats to plain text.
*
* @param string $content The text as entered by the user
* @param int $contentformat FORMAT_MOODLE, FORMAT_HTML, FORMAT_PLAIN or FORMAT_MARKDOWN
* @return string Plain text.
*/
function editor_input_to_text($content, $contentformat) {
switch ($contentformat) {
case FORMAT_PLAIN:
return $content;
case FORMAT_MARKDOWN:
$html = markdown_to_html($content);
return html_to_text($html, 75, false);
default:
// FORMAT_HTML and FORMAT_MOODLE.
return html_to_text($content, 75, false);
}
}
/**
* Base abstract text editor class.
*