Skip to content
This repository has been archived by the owner on Jul 19, 2024. It is now read-only.

Commit

Permalink
Merge branch 'wip-MSFTMPP-343-m27' into MOODLE_27_STABLE
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmcq committed Feb 17, 2016
2 parents 9945ed8 + ed4f6af commit 1e86fe5
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 25 deletions.
17 changes: 0 additions & 17 deletions filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,6 @@ public function filter($text, array $options = array()) {
$search = '/<a\s[^>]*href="(https?:\/\/(www\.)?)(issuu\.com)\/(.*?)"(.*?)>(.*?)<\/a>/is';
$newtext = preg_replace_callback($search, 'filter_oembed_issuucallback', $newtext);
}
if (get_config('filter_oembed', 'screenr')) {
$search = '/<a\s[^>]*href="(https?:\/\/(www\.)?)(screenr\.com)\/(.*?)"(.*?)>(.*?)<\/a>/is';
$newtext = preg_replace_callback($search, 'filter_oembed_screenrcallback', $newtext);
}
if (get_config('filter_oembed', 'soundcloud')) {
$search = '/<a\s[^>]*href="(https?:\/\/(www\.)?)(soundcloud\.com)\/(.*?)"(.*?)>(.*?)<\/a>/is';
$newtext = preg_replace_callback($search, 'filter_oembed_soundcloudcallback', $newtext);
Expand Down Expand Up @@ -266,19 +262,6 @@ function filter_oembed_issuucallback($link) {
return $json === null ? '<h3>'. get_string('connection_error', 'filter_oembed') .'</h3>' : $json['html'];
}

/**
* Looks for links pointing to Screenr content and processes them.
*
* @param $link HTML tag containing a link
* @return string HTML content after processing.
*/
function filter_oembed_screenrcallback($link) {
global $CFG;
$url = "http://www.screenr.com/api/oembed.json?url=".trim($link[1]).trim($link[3]).'/'.trim($link[4]).'&maxwidth=480&maxheight=270';
$json = filter_oembed_curlcall($url);
return filter_oembed_vidembed($json);
}

/**
* Looks for links pointing to SoundCloud content and processes them.
*
Expand Down
1 change: 0 additions & 1 deletion lang/en/filter_oembed.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
$string['slideshare'] = 'SlideShare';
$string['officemix'] = 'Office Mix';
$string['issuu'] = 'Issuu';
$string['screenr'] = 'Screenr';
$string['soundcloud'] = 'SoundCloud';
$string['pollev'] = 'Poll Everywhere';
$string['sway'] = 'Sway';
Expand Down
2 changes: 0 additions & 2 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
$settings->add($item);
$item = new admin_setting_configselect('filter_oembed/officemix', get_string('officemix', 'filter_oembed'), '', 1, $torf);
$settings->add($item);
$item = new admin_setting_configselect('filter_oembed/screenr', get_string('screenr', 'filter_oembed'), '', 1, $torf);
$settings->add($item);
$item = new admin_setting_configselect('filter_oembed/issuu', get_string('issuu', 'filter_oembed'), '', 1, $torf);
$settings->add($item);
$item = new admin_setting_configselect('filter_oembed/soundcloud', get_string('soundcloud', 'filter_oembed'), '', 1, $torf);
Expand Down
6 changes: 1 addition & 5 deletions tests/filter_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,10 @@ public function test_filter() {
$tedlink = '<p><a href="https://www.ted.com/talks/aj_jacobs_how_healthy_living_nearly_killed_me">Ted</a></p>';
$slidesharelink = '<p><a href="http://www.slideshare.net/timbrown/ideo-values-slideshare1">slideshare</a></p>';
$issuulink = '<p><a href="http://issuu.com/hujawes/docs/dehorew">issuu</a></p>';
$screenrlink = '<p><a href="https://www.screenr.com/wxVH">screenr</a></p>';
$polleverywherelink = '<p><a href="https://www.polleverywhere.com/multiple_choice_polls/AyCp2jkJ2HqYKXc/web">';
$polleverywherelink .= '$popolleverywhere</a></p>';

$filterinput = $souncloudlink.$youtubelink.$officemixlink.$vimeolink.$tedlink.$slidesharelink.$issuulink.$screenrlink;
$filterinput = $souncloudlink.$youtubelink.$officemixlink.$vimeolink.$tedlink.$slidesharelink.$issuulink;
$filterinput .= $polleverywherelink;

$filteroutput = $this->filter->filter($filterinput);
Expand Down Expand Up @@ -94,9 +93,6 @@ public function test_filter() {
$issuuoutput .= '</script>';
$this->assertContains($issuuoutput, $filteroutput, 'Issuu filter fails');

$screenroutput = '<iframe src="https://www.screenr.com/embed/wxVH" width="650" height="396" frameborder="0"></iframe>';
$this->assertContains($screenroutput, $filteroutput, 'Screenr filter fails');

$polleverywhereoutput = '<script src="http://www.polleverywhere.com/multiple_choice_polls/AyCp2jkJ2HqYKXc/web.js';
$polleverywhereoutput .= '?results_count_format=percent"></script>';
$this->assertContains($polleverywhereoutput, $filteroutput, 'Poll everywhare filter fails');
Expand Down

0 comments on commit 1e86fe5

Please sign in to comment.