Skip to content
Snippets Groups Projects
Unverified Commit 840b2ba7 authored by Tobias Reischmann's avatar Tobias Reischmann
Browse files

Moved get_config out of for loop

parent a31e6ab3
No related branches found
No related tags found
No related merge requests found
......@@ -43,6 +43,12 @@ class filter_opencast extends moodle_text_filter {
public function filter($text, array $options = array()) {
global $PAGE;
// Get baseurl either from engageurl setting or from opencast tool.
$baseurl = get_config('filter_opencast', 'engageurl');
if (empty($baseurl)) {
$baseurl = get_config('tool_opencast', 'apiurl');
}
if (stripos($text, '</video>') === false) {
// Performance shortcut - if there are no </video> tags, nothing can match.
return $text;
......@@ -73,12 +79,6 @@ class filter_opencast extends moodle_text_filter {
$video = false;
if (substr($match, 0, 7) === "<source") {
// Get baseurl either from engageurl setting or from opencast tool.
$baseurl = get_config('filter_opencast', 'engageurl');
if (empty($baseurl)) {
$baseurl = get_config('tool_opencast', 'apiurl');
}
// Check if video is from opencast.
if (strpos($match, $baseurl) === false) {
continue;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment