ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilExternalMediaAnalyzer Class Reference

Analyzes external media locations and extracts important information into parameter field. More...

+ Collaboration diagram for ilExternalMediaAnalyzer:

Static Public Member Functions

static isYouTube ($a_location)
 Identify YouTube links.
static extractYouTubeParameters ($a_location)
 Extract YouTube Parameter.
static isFlickr ($a_location)
 Identify Flickr links.
static extractFlickrParameters ($a_location)
 Extract Flickr Parameter.
static isGoogleVideo ($a_location)
 Identify GoogleVideo links.
static extractGoogleVideoParameters ($a_location)
 Extract GoogleVideo Parameter.
static isGoogleDocument ($a_location)
 Identify Google Document links.
static extractGoogleDocumentParameters ($a_location)
 Extract GoogleDocument Parameter.
static extractUrlParameters ($a_location, $a_parameter)
 Extract URL information to parameter array.

Detailed Description

Analyzes external media locations and extracts important information into parameter field.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 33 of file class.ilExternalMediaAnalyzer.php.

Member Function Documentation

static ilExternalMediaAnalyzer::extractFlickrParameters (   $a_location)
static

Extract Flickr Parameter.

Definition at line 81 of file class.ilExternalMediaAnalyzer.php.

Referenced by extractUrlParameters().

{
$par = array();
$pos1 = strpos($a_location, "flickr.com/photos/");
$pos2 = strpos($a_location, "/", $pos1+18);
if ($pos1 > 0)
{
$len = ($pos2 > 0)
? $pos2
: $a_location;
$par["user_id"] = substr($a_location, $pos1+18, $len - ($pos1+18));
}
// tags
$pos1 = strpos($a_location, "/tags/");
$pos2 = strpos($a_location, "/", $pos1+6);
if ($pos1 > 0)
{
$len = ($pos2 > 0)
? $pos2
: strlen($a_location);
$par["tags"] = substr($a_location, $pos1+6, $len - ($pos1+6));
}
// sets
$pos1 = strpos($a_location, "/sets/");
$pos2 = strpos($a_location, "/", $pos1+6);
if ($pos1 > 0)
{
$len = ($pos2 > 0)
? $pos2
: $a_location;
$par["sets"] = substr($a_location, $pos1+6, $len - ($pos1+6));
}
return $par;
}

+ Here is the caller graph for this function:

static ilExternalMediaAnalyzer::extractGoogleDocumentParameters (   $a_location)
static

Extract GoogleDocument Parameter.

Definition at line 165 of file class.ilExternalMediaAnalyzer.php.

Referenced by extractUrlParameters().

{
$par = array();
$pos1 = strpos($a_location, "id=");
$pos2 = strpos($a_location, "&", $pos1 + 3);
if ($pos1 > 0)
{
$len = ($pos2 > 0)
? $pos2
: strlen($a_location);
$par["docid"] = substr($a_location, $pos1+3, $len - ($pos1+3));
}
$pos1 = strpos($a_location, "docID=");
$pos2 = strpos($a_location, "&", $pos1 + 6);
if ($pos1 > 0)
{
$len = ($pos2 > 0)
? $pos2
: strlen($a_location);
$par["docid"] = substr($a_location, $pos1+6, $len - ($pos1+6));
}
if (strpos($a_location, "Presentation?") > 0)
{
$par["type"] = "Presentation";
}
if (strpos($a_location, "View?") > 0)
{
$par["type"] = "Document";
}
return $par;
}

+ Here is the caller graph for this function:

static ilExternalMediaAnalyzer::extractGoogleVideoParameters (   $a_location)
static

Extract GoogleVideo Parameter.

Definition at line 134 of file class.ilExternalMediaAnalyzer.php.

Referenced by extractUrlParameters().

{
$par = array();
$pos1 = strpos($a_location, "docid=");
$pos2 = strpos($a_location, "&", $pos1 + 6);
if ($pos1 > 0)
{
$len = ($pos2 > 0)
? $pos2
: strlen($a_location);
$par["docid"] = substr($a_location, $pos1+6, $len - ($pos1+6));
}
return $par;
}

+ Here is the caller graph for this function:

static ilExternalMediaAnalyzer::extractUrlParameters (   $a_location,
  $a_parameter 
)
static

Extract URL information to parameter array.

Definition at line 201 of file class.ilExternalMediaAnalyzer.php.

References $name, extractFlickrParameters(), extractGoogleDocumentParameters(), extractGoogleVideoParameters(), extractYouTubeParameters(), isFlickr(), isGoogleDocument(), isGoogleVideo(), and isYouTube().

{
if (!is_array($a_parameter))
{
$a_parameter = array();
}
$ext_par = array();
// YouTube
{
$a_parameter = array();
}
// Flickr
{
$a_parameter = array();
}
// GoogleVideo
{
$a_parameter = array();
}
// GoogleDocs
{
$a_parameter = array();
}
foreach($ext_par as $name => $value)
{
$a_parameter[$name] = $value;
}
return $a_parameter;
}

+ Here is the call graph for this function:

static ilExternalMediaAnalyzer::extractYouTubeParameters (   $a_location)
static

Extract YouTube Parameter.

Definition at line 50 of file class.ilExternalMediaAnalyzer.php.

Referenced by extractUrlParameters().

{
$par = array();
$pos1 = strpos($a_location, "v=");
$pos2 = strpos($a_location, "&", $pos1);
if ($pos1 > 0)
{
$len = ($pos2 > 0)
? $pos2
: strlen($a_location);
$par["v"] = substr($a_location, $pos1+2, $len - ($pos1+2));
}
return $par;
}

+ Here is the caller graph for this function:

static ilExternalMediaAnalyzer::isFlickr (   $a_location)
static

Identify Flickr links.

Definition at line 69 of file class.ilExternalMediaAnalyzer.php.

Referenced by extractUrlParameters().

{
if (strpos($a_location, "flickr.com") > 0)
{
return true;
}
return false;
}

+ Here is the caller graph for this function:

static ilExternalMediaAnalyzer::isGoogleDocument (   $a_location)
static

Identify Google Document links.

Definition at line 153 of file class.ilExternalMediaAnalyzer.php.

Referenced by extractUrlParameters().

{
if (strpos($a_location, "docs.google") > 0)
{
return true;
}
return false;
}

+ Here is the caller graph for this function:

static ilExternalMediaAnalyzer::isGoogleVideo (   $a_location)
static

Identify GoogleVideo links.

Definition at line 122 of file class.ilExternalMediaAnalyzer.php.

Referenced by extractUrlParameters().

{
if (strpos($a_location, "video.google") > 0)
{
return true;
}
return false;
}

+ Here is the caller graph for this function:

static ilExternalMediaAnalyzer::isYouTube (   $a_location)
static

Identify YouTube links.

Definition at line 38 of file class.ilExternalMediaAnalyzer.php.

Referenced by extractUrlParameters().

{
if (strpos($a_location, "youtube.com") > 0)
{
return true;
}
return false;
}

+ Here is the caller graph for this function:


The documentation for this class was generated from the following file: