Skip to content

Commit

Permalink
Merge branch 'MDL-56712-master' of git://github.com/mihailges/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
David Monllao committed Jul 30, 2018
2 parents c5c618f + d77b5db commit a50b8a4
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 308 deletions.
152 changes: 0 additions & 152 deletions lib/medialib.php

This file was deleted.

127 changes: 0 additions & 127 deletions lib/outputrenderers.php
Expand Up @@ -4722,133 +4722,6 @@ public function heading($text, $level = 2, $classes = 'main', $id = null) {}
}


/**
* Renderer for media files.
*
* Used in file resources, media filter, and any other places that need to
* output embedded media.
*
* @deprecated since Moodle 3.2
* @copyright 2011 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class core_media_renderer extends plugin_renderer_base {
/** @var array Array of available 'player' objects */
private $players;
/** @var string Regex pattern for links which may contain embeddable content */
private $embeddablemarkers;

/**
* Constructor
*
* This is needed in the constructor (not later) so that you can use the
* constants and static functions that are defined in core_media class
* before you call renderer functions.
*/
public function __construct() {
debugging('Class core_media_renderer is deprecated, please use core_media_manager::instance()', DEBUG_DEVELOPER);
}

/**
* Renders a media file (audio or video) using suitable embedded player.
*
* See embed_alternatives function for full description of parameters.
* This function calls through to that one.
*
* When using this function you can also specify width and height in the
* URL by including ?d=100x100 at the end. If specified in the URL, this
* will override the $width and $height parameters.
*
* @param moodle_url $url Full URL of media file
* @param string $name Optional user-readable name to display in download link
* @param int $width Width in pixels (optional)
* @param int $height Height in pixels (optional)
* @param array $options Array of key/value pairs
* @return string HTML content of embed
*/
public function embed_url(moodle_url $url, $name = '', $width = 0, $height = 0,
$options = array()) {
return core_media_manager::instance()->embed_url($url, $name, $width, $height, $options);
}

/**
* Renders media files (audio or video) using suitable embedded player.
* The list of URLs should be alternative versions of the same content in
* multiple formats. If there is only one format it should have a single
* entry.
*
* If the media files are not in a supported format, this will give students
* a download link to each format. The download link uses the filename
* unless you supply the optional name parameter.
*
* Width and height are optional. If specified, these are suggested sizes
* and should be the exact values supplied by the user, if they come from
* user input. These will be treated as relating to the size of the video
* content, not including any player control bar.
*
* For audio files, height will be ignored. For video files, a few formats
* work if you specify only width, but in general if you specify width
* you must specify height as well.
*
* The $options array is passed through to the core_media_player classes
* that render the object tag. The keys can contain values from
* core_media::OPTION_xx.
*
* @param array $alternatives Array of moodle_url to media files
* @param string $name Optional user-readable name to display in download link
* @param int $width Width in pixels (optional)
* @param int $height Height in pixels (optional)
* @param array $options Array of key/value pairs
* @return string HTML content of embed
*/
public function embed_alternatives($alternatives, $name = '', $width = 0, $height = 0,
$options = array()) {
return core_media_manager::instance()->embed_alternatives($alternatives, $name, $width, $height, $options);
}

/**
* Checks whether a file can be embedded. If this returns true you will get
* an embedded player; if this returns false, you will just get a download
* link.
*
* This is a wrapper for can_embed_urls.
*
* @param moodle_url $url URL of media file
* @param array $options Options (same as when embedding)
* @return bool True if file can be embedded
*/
public function can_embed_url(moodle_url $url, $options = array()) {
return core_media_manager::instance()->can_embed_url($url, $options);
}

/**
* Checks whether a file can be embedded. If this returns true you will get
* an embedded player; if this returns false, you will just get a download
* link.
*
* @param array $urls URL of media file and any alternatives (moodle_url)
* @param array $options Options (same as when embedding)
* @return bool True if file can be embedded
*/
public function can_embed_urls(array $urls, $options = array()) {
return core_media_manager::instance()->can_embed_urls($urls, $options);
}

/**
* Obtains a list of markers that can be used in a regular expression when
* searching for URLs that can be embedded by any player type.
*
* This string is used to improve peformance of regex matching by ensuring
* that the (presumably C) regex code can do a quick keyword check on the
* URL part of a link to see if it matches one of these, rather than having
* to go into PHP code for every single link to see if it can be embedded.
*
* @return string String suitable for use in regex such as '(\.mp4|\.flv)'
*/
public function get_embeddable_markers() {
return core_media_manager::instance()->get_embeddable_markers();
}
}

/**
* The maintenance renderer.
Expand Down
18 changes: 9 additions & 9 deletions lib/tests/medialib_test.php
Expand Up @@ -129,7 +129,7 @@ public function test_list_supported_urls() {
}

/**
* Test for core_media_renderer get_players
* Test for get_players
*/
public function test_get_players() {
// All players are initially disabled (except link, which you can't).
Expand Down Expand Up @@ -158,7 +158,7 @@ public function test_get_players() {
}

/**
* Test for core_media_renderer can_embed_url
* Test for can_embed_url
*/
public function test_can_embed_url() {
// All players are initially disabled, so mp4 cannot be rendered.
Expand Down Expand Up @@ -188,7 +188,7 @@ public function test_can_embed_url() {
}

/**
* Test for core_media_renderer embed_url.
* Test for embed_url.
* Checks multiple format/fallback support.
*/
public function test_embed_url_fallbacks() {
Expand Down Expand Up @@ -264,7 +264,7 @@ public function test_embed_url_fallbacks() {
}

/**
* Test for core_media_renderer embed_url.
* Test for embed_url.
* Check SWF works including the special option required to enable it
*/
public function test_embed_url_swf() {
Expand Down Expand Up @@ -302,7 +302,7 @@ public function test_slash_arguments() {
}

/**
* Test for core_media_renderer embed_url.
* Test for embed_url.
* Checks the EMBED_OR_BLANK option.
*/
public function test_embed_or_blank() {
Expand All @@ -325,7 +325,7 @@ public function test_embed_or_blank() {
}

/**
* Test for core_media_renderer embed_url.
* Test for embed_url.
* Checks that size is passed through correctly to player objects and tests
* size support in html5video output.
*/
Expand Down Expand Up @@ -358,7 +358,7 @@ public function test_embed_url_size() {
}

/**
* Test for core_media_renderer embed_url.
* Test for embed_url.
* Checks that name is passed through correctly to player objects and tests
* name support in html5video output.
*/
Expand All @@ -379,7 +379,7 @@ public function test_embed_url_name() {
}

/**
* Test for core_media_renderer split_alternatives.
* Test for split_alternatives.
*/
public function test_split_alternatives() {
$mediamanager = core_media_manager::instance();
Expand Down Expand Up @@ -416,7 +416,7 @@ public function test_split_alternatives() {
}

/**
* Test for core_media_renderer embed_alternatives (with multiple urls)
* Test for embed_alternatives (with multiple urls)
*/
public function test_embed_alternatives() {
// Most aspects of this are same as single player so let's just try
Expand Down
4 changes: 3 additions & 1 deletion lib/upgrade.txt
Expand Up @@ -9,7 +9,6 @@ information provided here is intended especially for developers.
* The following functions have been finally deprecated and can not be used any more:
- external_function_info()
- core_renderer::update_module_button()
- external_function_info()
- events_trigger()
- events_cron()
- events_dispatch()
Expand All @@ -20,6 +19,9 @@ information provided here is intended especially for developers.
- events_queue_handler()
- events_trigger_legacy()
- events_update_definition()
* The following classes have been finally deprecated and can not be used any more:
- core_media_renderer
- core_media
* Following api's have been removed in behat_config_manager, please use behat_config_util instead.
- get_features_with_tags()
- get_components_steps_definitions()
Expand Down
1 change: 1 addition & 0 deletions lib/upgradelib.php
Expand Up @@ -431,6 +431,7 @@ function upgrade_stale_php_files_present() {

$someexamplesofremovedfiles = array(
// Removed in 3.6.
'/lib/medialib.php',
'/lib/password_compat/lib/password.php',
// Removed in 3.5.
'/lib/dml/mssql_native_moodle_database.php',
Expand Down

0 comments on commit a50b8a4

Please sign in to comment.