Merge branch 'MDL-51483_master' of https://github.com/jinhofer/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2015-12-09 01:09:08 +01:00
commit 7955476cab
4 changed files with 35 additions and 11 deletions

View File

@ -811,7 +811,7 @@ class core_media_player_wmp extends core_media_player {
<param name="ShowGotoBar" value="false" />
<param name="EnableFullScreenControls" value="true" />
<param name="uimode" value="full" />
<!--[if !IE]>-->
<!--[if !IE]><!-->
<object data="$url" type="$mimetype" $size>
<param name="src" value="$url" />
<param name="controller" value="true" />
@ -820,7 +820,7 @@ class core_media_player_wmp extends core_media_player {
<param name="resize" value="scale" />
<!--<![endif]-->
$fallback
<!--[if !IE]>-->
<!--[if !IE]><!-->
</object>
<!--<![endif]-->
</object>
@ -875,7 +875,7 @@ class core_media_player_qt extends core_media_player {
<param name="autoplay" value="false" />
<param name="autostart" value="false" />
<param name="scale" value="aspect" />
<!--[if !IE]>-->
<!--[if !IE]><!-->
<object data="$url" type="$mimetype" $size>
<param name="src" value="$url" />
<param name="pluginurl" value="http://www.apple.com/quicktime/download/" />
@ -886,7 +886,7 @@ class core_media_player_qt extends core_media_player {
<param name="scale" value="aspect" />
<!--<![endif]-->
$fallback
<!--[if !IE]>-->
<!--[if !IE]><!-->
</object>
<!--<![endif]-->
</object>
@ -934,14 +934,14 @@ class core_media_player_rm extends core_media_player {
data="$url" width="$width" height="$height"">
<param name="src" value="$url" />
<param name="controls" value="All" />
<!--[if !IE]>-->
<!--[if !IE]><!-->
<object title="$info" type="audio/x-pn-realaudio-plugin"
data="$url" width="$width" height="$height">
<param name="src" value="$url" />
<param name="controls" value="All" />
<!--<![endif]-->
$fallback
<!--[if !IE]>-->
<!--[if !IE]><!-->
</object>
<!--<![endif]-->
</object>
@ -990,7 +990,7 @@ class core_media_player_swf extends core_media_player {
<param name="base" value="." />
<param name="allowscriptaccess" value="never" />
<param name="allowfullscreen" value="true" />
<!--[if !IE]>-->
<!--[if !IE]><!-->
<object type="application/x-shockwave-flash" data="$url" width="$width" height="$height">
<param name="controller" value="true" />
<param name="autoplay" value="true" />
@ -1001,7 +1001,7 @@ class core_media_player_swf extends core_media_player {
<param name="allowfullscreen" value="true" />
<!--<![endif]-->
$fallback
<!--[if !IE]>-->
<!--[if !IE]><!-->
</object>
<!--<![endif]-->
</object>

View File

@ -7691,6 +7691,18 @@ function shorten_text($text, $ideal=30, $exact = false, $ending='...') {
'tag' => core_text::strtolower($tagmatchings[1]),
'pos' => core_text::strlen($truncate),
);
} else if (preg_match('/^<!--\[if\s.*?\]>$/s', $linematchings[1], $tagmatchings)) {
$tagdetails[] = (object) array(
'open' => true,
'tag' => core_text::strtolower('if'),
'pos' => core_text::strlen($truncate),
);
} else if (preg_match('/^<!--<!\[endif\]-->$/s', $linematchings[1], $tagmatchings)) {
$tagdetails[] = (object) array(
'open' => false,
'tag' => core_text::strtolower('if'),
'pos' => core_text::strlen($truncate),
);
}
}
// Add html-tag to $truncate'd text.
@ -7776,7 +7788,11 @@ function shorten_text($text, $ideal=30, $exact = false, $ending='...') {
// Close all unclosed html-tags.
foreach ($opentags as $tag) {
$truncate .= '</' . $tag . '>';
if ($tag === 'if') {
$truncate .= '<!--<![endif]-->';
} else {
$truncate .= '</' . $tag . '>';
}
}
return $truncate;

View File

@ -869,6 +869,14 @@ class core_moodlelib_testcase extends advanced_testcase {
"tags that ...</blockquote></p></div>", shorten_text($text));
}
public function test_shorten_text_with_tags_and_html_comment() {
$text = "<div class='frog'><p><blockquote><!--[if !IE]><!-->Long text with ".
"tags that will<!--<![endif]--> ".
"be chopped off but <b>should be added back again</b></blockquote></p></div>";
$this->assertEquals("<div class='frog'><p><blockquote><!--[if !IE]><!-->Long text with " .
"tags that ...<!--<![endif]--></blockquote></p></div>", shorten_text($text));
}
public function test_shorten_text_with_entities() {
// Remember to allow 3 chars for the final '...'.
// ......123456789012345678901234567_____890...

View File

@ -48,14 +48,14 @@ $output = <<<OET
<param name="base" value="." />
<param name="allowscriptaccess" value="sameDomain" />
<param name="FlashVars" value="rooturl=$CFG->wwwroot" />
<!--[if !IE]>-->
<!--[if !IE]><!-->
<object type="application/x-shockwave-flash" data="$url" width="100%" height="1000">
<param name="base" value="." />
<param name="allowscriptaccess" value="sameDomain" />
<param name="FlashVars" value="rooturl=$CFG->wwwroot" />
<!--<![endif]-->
<p>You need to install Flash 9.0</p>
<!--[if !IE]>-->
<!--[if !IE]><!-->
</object>
<!--<![endif]-->
</object>