Stud.IP  4.0
 All Data Structures Namespaces Files Functions Variables Groups
Studip\MarkupPrivate\MediaProxy Namespace Reference

Data Structures

class  UrlException
 
class  InvalidInternalLinkException
 
class  ExternalMediaDeniedException
 

Functions

 getMediaUrl ($url)
 
 encodeMediaProxyUrl ($url)
 
 decodeMediaProxyUrl ($url)
 
 getMediaProxyUrl ()
 
 isStudipMediaUrl ($url)
 
 isInternalLink ($url)
 
 removeStudipDomain ($url)
 
 getStudipRelativePath ($url)
 
 getParsedStudipUrl ()
 
 isStudipMediaUrlPath ($path)
 
 transformInternalIdnaLink ($url)
 

Function Documentation

Studip\MarkupPrivate\MediaProxy\decodeMediaProxyUrl (   $url)

Extract the original URL from a media proxy URL.

Parameters
string$urlThe media proxy URL. return string The original URL. If $url does not point to the media proxy then this is the exact same value given by $url.
Studip\MarkupPrivate\MediaProxy\encodeMediaProxyUrl (   $url)

Return media proxy URL for an unproxied URL.

string $url Unproxied media URL.

Returns
string Media proxy URL for accessing the same resource.
Studip\MarkupPrivate\MediaProxy\getMediaProxyUrl ( )

Return Stud.IP's absolute media proxy URL.

Studip\MarkupPrivate\MediaProxy\getMediaUrl (   $url)

Check if media proxy should be used and if so return the respective URL.

Parameters
string$urlURL to media file.
Returns
mixed URL string to media file (possibly 'proxied') or NULL if URL is invalid.
Studip\MarkupPrivate\MediaProxy\getParsedStudipUrl ( )

Return an associative array containing the Stud.IP URL elements.

see also: http://php.net/manual/en/function.parse-url.php

Returns
mixed Same values that PHP's parse_url() returns.
Studip\MarkupPrivate\MediaProxy\getStudipRelativePath (   $url)

Return a URL's path component with the absolute Stud.IP path removed.

NOTE: If the URL is not an internal Stud.IP URL, the path component will nevertheless be returned without issuing an error message.

Example:

getStudipRelativePath('http://localhost:8080'

. '/studip/sendfile.php?type=0&file_id=ABC123&file_name=nice.jpg') 'sendfile.php'

Parameters
string$urlThe URL from which to return the Stud.IP-relative path component. returns string Stud.IP-relative path component of $url.
Studip\MarkupPrivate\MediaProxy\isInternalLink (   $url)
Studip\MarkupPrivate\MediaProxy\isStudipMediaUrl (   $url)

Test if an URL points to a valid internal Stud.IP media path.

Parameters
string$urlInternal Stud.IP URL.
Returns
boolean TRUE for internal media link URLs, FALSE otherwise.
Studip\MarkupPrivate\MediaProxy\isStudipMediaUrlPath (   $path)

Test if path is valid for internal Stud.IP media URLs.

string $path The path component of an URL. return boolean TRUE for valid media paths, FALSE otherwise.

Studip\MarkupPrivate\MediaProxy\removeStudipDomain (   $url)

Remove domain name from internal URLs.

Remove scheme, domain and authentication information from internal Stud.IP URLs. Leave external URLs untouched.

Parameters
string$urlURL from which to remove internal domain.
Returns
string URL without internal domain or the exact same value as $url for external URLs.
Studip\MarkupPrivate\MediaProxy\transformInternalIdnaLink (   $url)

Return a normalized, internal URL.

string $url An internal URL.

Returns
string Normalized internal URL.