[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/ -> medialib.php (summary)

Classes for handling embedded media (mainly audio and video). These are used only from within the core media renderer.

Copyright: 2012 The Open University
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 1276 lines (45 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 12 classes

core_media_player_vimeo:: (4 methods):
  embed_external()
  get_regex()
  get_rank()
  get_embeddable_markers()

core_media_player_youtube:: (5 methods):
  embed_external()
  get_start_time()
  get_regex()
  get_rank()
  get_embeddable_markers()

core_media_player_youtube_playlist:: (5 methods):
  is_enabled()
  embed_external()
  get_regex()
  get_rank()
  get_embeddable_markers()

core_media_player_mp3:: (3 methods):
  embed()
  get_supported_extensions()
  get_rank()

core_media_player_flv:: (3 methods):
  embed()
  get_supported_extensions()
  get_rank()

core_media_player_wmp:: (3 methods):
  embed()
  get_supported_extensions()
  get_rank()

core_media_player_qt:: (3 methods):
  embed()
  get_supported_extensions()
  get_rank()

core_media_player_rm:: (3 methods):
  embed()
  get_supported_extensions()
  get_rank()

core_media_player_swf:: (4 methods):
  embed()
  get_supported_extensions()
  list_supported_urls()
  get_rank()

core_media_player_html5video:: (4 methods):
  embed()
  get_supported_extensions()
  list_supported_urls()
  get_rank()

core_media_player_html5audio:: (4 methods):
  embed()
  get_supported_extensions()
  list_supported_urls()
  get_rank()

core_media_player_link:: (4 methods):
  embed()
  list_supported_urls()
  is_enabled()
  get_rank()

Defines 4 functions

  split_alternatives()
  get_extension()
  get_filename()
  get_mimetype()
  get_supported_extensions()
  get_embeddable_markers()
  is_enabled()
  list_supported_urls()
  get_name()
  compare_by_rank()
  pick_video_size()
  embed()
  list_supported_urls()
  get_regex()
  fix_match_count()

Class: core_media_player_vimeo  - X-Ref

Player that embeds Vimeo links.

embed_external(moodle_url $url, $name, $width, $height, $options)   X-Ref
No description

get_regex()   X-Ref
No description

get_rank()   X-Ref
No description

get_embeddable_markers()   X-Ref
No description

Class: core_media_player_youtube  - X-Ref

Player that creates YouTube embedding.

embed_external(moodle_url $url, $name, $width, $height, $options)   X-Ref
No description

get_start_time($url)   X-Ref
Check for start time parameter.  Note that it's in hours/mins/secs in the URL,
but the embedded player takes only a number of seconds as the "start" parameter.

param: moodle_url $url URL of video to be embedded.
return: int Number of seconds video should start at.

get_regex()   X-Ref
No description

get_rank()   X-Ref
No description

get_embeddable_markers()   X-Ref
No description

Class: core_media_player_youtube_playlist  - X-Ref

Player that creates YouTube playlist embedding.

is_enabled()   X-Ref
No description

embed_external(moodle_url $url, $name, $width, $height, $options)   X-Ref
No description

get_regex()   X-Ref
No description

get_rank()   X-Ref
No description

get_embeddable_markers()   X-Ref
No description

Class: core_media_player_mp3  - X-Ref

MP3 player inserted using JavaScript.

embed($urls, $name, $width, $height, $options)   X-Ref
No description

get_supported_extensions()   X-Ref
No description

get_rank()   X-Ref
No description

Class: core_media_player_flv  - X-Ref

Flash video player inserted using JavaScript.

embed($urls, $name, $width, $height, $options)   X-Ref
No description

get_supported_extensions()   X-Ref
No description

get_rank()   X-Ref
No description

Class: core_media_player_wmp  - X-Ref

Embeds Windows Media Player using object tag.

embed($urls, $name, $width, $height, $options)   X-Ref
No description

get_supported_extensions()   X-Ref
No description

get_rank()   X-Ref
No description

Class: core_media_player_qt  - X-Ref

Media player using object tag and QuickTime player.

embed($urls, $name, $width, $height, $options)   X-Ref
No description

get_supported_extensions()   X-Ref
No description

get_rank()   X-Ref
No description

Class: core_media_player_rm  - X-Ref

Media player using object tag and RealPlayer.

Hopefully nobody is using this obsolete format any more!

embed($urls, $name, $width, $height, $options)   X-Ref
No description

get_supported_extensions()   X-Ref
No description

get_rank()   X-Ref
No description

Class: core_media_player_swf  - X-Ref

Media player for Flash SWF files.

This player contains additional security restriction: it will only be used
if you add option core_media_player_swf::ALLOW = true.

Code should only set this option if it has verified that the data was
embedded by a trusted user (e.g. in trust text).

embed($urls, $name, $width, $height, $options)   X-Ref
No description

get_supported_extensions()   X-Ref
No description

list_supported_urls(array $urls, array $options = array()   X-Ref
No description

get_rank()   X-Ref
No description

Class: core_media_player_html5video  - X-Ref

Player that creates HTML5 <video> tag.

embed($urls, $name, $width, $height, $options)   X-Ref
No description

get_supported_extensions()   X-Ref
No description

list_supported_urls(array $urls, array $options = array()   X-Ref
No description

get_rank()   X-Ref
No description

Class: core_media_player_html5audio  - X-Ref

Player that creates HTML5 <audio> tag.

embed($urls, $name, $width, $height, $options)   X-Ref
No description

get_supported_extensions()   X-Ref
No description

list_supported_urls(array $urls, array $options = array()   X-Ref
No description

get_rank()   X-Ref
No description

Class: core_media_player_link  - X-Ref

Special media player class that just puts a link.

Always enabled, used as the last fallback.

embed($urls, $name, $width, $height, $options)   X-Ref
No description

list_supported_urls(array $urls, array $options = array()   X-Ref
No description

is_enabled()   X-Ref
No description

get_rank()   X-Ref
No description

Functions
Functions that are not part of a class:

split_alternatives($combinedurl, &$width, &$height)   X-Ref
Given a string containing multiple URLs separated by #, this will split
it into an array of moodle_url objects suitable for using when calling
embed_alternatives.

Note that the input string should NOT be html-escaped (i.e. if it comes
from html, call html_entity_decode first).

param: string $combinedurl String of 1 or more alternatives separated by #
param: int $width Output variable: width (will be set to 0 if not specified)
param: int $height Output variable: height (0 if not specified)
return: array Array of 1 or more moodle_url objects

get_extension(moodle_url $url)   X-Ref
Returns the file extension for a URL.

param: moodle_url $url URL

get_filename(moodle_url $url)   X-Ref
Obtains the filename from the moodle_url.

param: moodle_url $url URL
return: string Filename only (not escaped)

get_mimetype(moodle_url $url)   X-Ref
Guesses MIME type for a moodle_url based on file extension.

param: moodle_url $url URL
return: string MIME type

get_supported_extensions()   X-Ref
Gets the list of file extensions supported by this media player.

Note: This is only required for the default implementation of
list_supported_urls. If you override that function to determine
supported URLs in some way other than by extension, then this function
is not necessary.

return: array Array of strings (extension not including dot e.g. 'mp3')

get_embeddable_markers()   X-Ref
Lists keywords that must be included in a url that can be embedded with
this player. Any such keywords should be added to the array.

For example if this player supports FLV and F4V files then it should add
'.flv' and '.f4v' to the array. (The check is not case-sensitive.)

Default handling calls the get_supported_extensions function and adds
a dot to each of those values, so players only need to override this
if they don't implement get_supported_extensions.

This is used to improve performance when matching links in the media filter.

return: array Array of keywords to add to the embeddable markers list

is_enabled()   X-Ref

return: bool True if player is enabled

list_supported_urls(array $urls, array $options = array()   X-Ref
Given a list of URLs, returns a reduced array containing only those URLs
which are supported by this player. (Empty if none.)

param: array $urls Array of moodle_url
param: array $options Options (same as will be passed to embed)
return: array Array of supported moodle_url

get_name($name, $urls)   X-Ref
Obtains suitable name for media. Uses specified name if there is one,
otherwise makes one up.

param: string $name User-specified name ('' if none)
param: array $urls Array of moodle_url used to make up name
return: string Name

compare_by_rank(core_media_player $a, core_media_player $b)   X-Ref
Compares by rank order, highest first. Used for sort functions.

param: core_media_player $a Player A
param: core_media_player $b Player B
return: int Negative if A should go before B, positive for vice versa

pick_video_size(&$width, &$height)   X-Ref
Utility function that sets width and height to defaults if not specified
as a parameter to the function (will be specified either if, (a) the calling
code passed it, or (b) the URL included it).

param: int $width Width passed to function (updated with final value)
param: int $height Height passed to function (updated with final value)

embed($urls, $name, $width, $height, $options)   X-Ref
Part of a regular expression, including ending ~ symbol (note: these
regexes use ~ instead of / because URLs and HTML code typically include
/ symbol and makes harder to read if you have to escape it).
Matches the end part of a link after you have read the 'important' data
including optional #d=400x300 at end of url, plus content of <a> tag,
up to </a>.


list_supported_urls(array $urls, array $options = array()   X-Ref
Obtains HTML code to embed the link.

param: moodle_url $url Single URL to embed
param: string $name Display name; '' to use default
param: int $width Optional width; 0 to use default
param: int $height Optional height; 0 to use default
param: array $options Options array
return: string HTML code for embed

get_regex()   X-Ref
Returns regular expression used to match URLs that this player handles

return: string PHP regular expression e.g. '~^https?://example.org/~'

fix_match_count(&$matches, $count)   X-Ref
Annoyingly, preg_match $matches result does not always have the same
number of parameters - it leaves out optional ones at the end. WHAT.
Anyway, this function can be used to fix it.

param: array $matches Array that should be adjusted
param: int $count Number of capturing groups (=6 to make $matches[6] work)



Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1