ILIAS  release_4-4 Revision
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. More...
 
static extractYouTubeParameters ($a_location)
 Extract YouTube Parameter. More...
 
static isFlickr ($a_location)
 Identify Flickr links. More...
 
static extractFlickrParameters ($a_location)
 Extract Flickr Parameter. More...
 
static isGoogleVideo ($a_location)
 Identify GoogleVideo links. More...
 
static extractGoogleVideoParameters ($a_location)
 Extract GoogleVideo Parameter. More...
 
static isVimeo ($a_location)
 Identify Vimeo links. More...
 
static extractVimeoParameters ($a_location)
 Extract Vimeo Parameter. More...
 
static isGoogleDocument ($a_location)
 Identify Google Document links. More...
 
static extractGoogleDocumentParameters ($a_location)
 Extract GoogleDocument Parameter. More...
 
static extractUrlParameters ($a_location, $a_parameter)
 Extract URL information to parameter array. More...
 

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

◆ extractFlickrParameters()

static ilExternalMediaAnalyzer::extractFlickrParameters (   $a_location)
static

Extract Flickr Parameter.

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

Referenced by extractUrlParameters().

82  {
83  $par = array();
84  $pos1 = strpos($a_location, "flickr.com/photos/");
85  $pos2 = strpos($a_location, "/", $pos1+18);
86  if ($pos1 > 0)
87  {
88  $len = ($pos2 > 0)
89  ? $pos2
90  : $a_location;
91  $par["user_id"] = substr($a_location, $pos1+18, $len - ($pos1+18));
92  }
93 
94  // tags
95  $pos1 = strpos($a_location, "/tags/");
96  $pos2 = strpos($a_location, "/", $pos1+6);
97  if ($pos1 > 0)
98  {
99  $len = ($pos2 > 0)
100  ? $pos2
101  : strlen($a_location);
102  $par["tags"] = substr($a_location, $pos1+6, $len - ($pos1+6));
103  }
104 
105  // sets
106  $pos1 = strpos($a_location, "/sets/");
107  $pos2 = strpos($a_location, "/", $pos1+6);
108  if ($pos1 > 0)
109  {
110  $len = ($pos2 > 0)
111  ? $pos2
112  : $a_location;
113  $par["sets"] = substr($a_location, $pos1+6, $len - ($pos1+6));
114  }
115 
116  return $par;
117  }
+ Here is the caller graph for this function:

◆ extractGoogleDocumentParameters()

static ilExternalMediaAnalyzer::extractGoogleDocumentParameters (   $a_location)
static

Extract GoogleDocument Parameter.

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

Referenced by extractUrlParameters().

197  {
198  $par = array();
199  $pos1 = strpos($a_location, "id=");
200  $pos2 = strpos($a_location, "&", $pos1 + 3);
201  if ($pos1 > 0)
202  {
203  $len = ($pos2 > 0)
204  ? $pos2
205  : strlen($a_location);
206  $par["docid"] = substr($a_location, $pos1+3, $len - ($pos1+3));
207  }
208  $pos1 = strpos($a_location, "docID=");
209  $pos2 = strpos($a_location, "&", $pos1 + 6);
210  if ($pos1 > 0)
211  {
212  $len = ($pos2 > 0)
213  ? $pos2
214  : strlen($a_location);
215  $par["docid"] = substr($a_location, $pos1+6, $len - ($pos1+6));
216  }
217  if (strpos($a_location, "Presentation?") > 0)
218  {
219  $par["type"] = "Presentation";
220  }
221  if (strpos($a_location, "View?") > 0)
222  {
223  $par["type"] = "Document";
224  }
225 
226  return $par;
227  }
+ Here is the caller graph for this function:

◆ extractGoogleVideoParameters()

static ilExternalMediaAnalyzer::extractGoogleVideoParameters (   $a_location)
static

Extract GoogleVideo Parameter.

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

Referenced by extractUrlParameters().

135  {
136  $par = array();
137  $pos1 = strpos($a_location, "docid=");
138  $pos2 = strpos($a_location, "&", $pos1 + 6);
139  if ($pos1 > 0)
140  {
141  $len = ($pos2 > 0)
142  ? $pos2
143  : strlen($a_location);
144  $par["docid"] = substr($a_location, $pos1+6, $len - ($pos1+6));
145  }
146 
147  return $par;
148  }
+ Here is the caller graph for this function:

◆ extractUrlParameters()

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

Extract URL information to parameter array.

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

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

Referenced by ilMediaItem\extractUrlParameters().

233  {
234  if (!is_array($a_parameter))
235  {
236  $a_parameter = array();
237  }
238 
239  $ext_par = array();
240 
241  // YouTube
242  if (ilExternalMediaAnalyzer::isYouTube($a_location))
243  {
245  $a_parameter = array();
246  }
247 
248  // Flickr
249  if (ilExternalMediaAnalyzer::isFlickr($a_location))
250  {
251  $ext_par = ilExternalMediaAnalyzer::extractFlickrParameters($a_location);
252  $a_parameter = array();
253  }
254 
255  // GoogleVideo
257  {
259  $a_parameter = array();
260  }
261 
262  // GoogleDocs
264  {
266  $a_parameter = array();
267  }
268 
269  foreach($ext_par as $name => $value)
270  {
271  $a_parameter[$name] = $value;
272  }
273 
274  return $a_parameter;
275  }
static isYouTube($a_location)
Identify YouTube links.
static isGoogleVideo($a_location)
Identify GoogleVideo links.
static extractGoogleDocumentParameters($a_location)
Extract GoogleDocument Parameter.
static isFlickr($a_location)
Identify Flickr links.
static extractGoogleVideoParameters($a_location)
Extract GoogleVideo Parameter.
static extractFlickrParameters($a_location)
Extract Flickr Parameter.
static extractYouTubeParameters($a_location)
Extract YouTube Parameter.
static isGoogleDocument($a_location)
Identify Google Document links.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ extractVimeoParameters()

static ilExternalMediaAnalyzer::extractVimeoParameters (   $a_location)
static

Extract Vimeo Parameter.

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

166  {
167  $par = array();
168  $pos1 = strpos($a_location, "vimeo.com/");
169  $pos2 = strpos($a_location, "&", $pos1 + 10);
170  if ($pos1 > 0)
171  {
172  $len = ($pos2 > 0)
173  ? $pos2
174  : strlen($a_location);
175  $par["id"] = substr($a_location, $pos1+10, $len - ($pos1+10));
176  }
177 
178  return $par;
179  }

◆ extractYouTubeParameters()

static ilExternalMediaAnalyzer::extractYouTubeParameters (   $a_location)
static

Extract YouTube Parameter.

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

Referenced by extractUrlParameters().

51  {
52  $par = array();
53  $pos1 = strpos($a_location, "v=");
54  $pos2 = strpos($a_location, "&", $pos1);
55  if ($pos1 > 0)
56  {
57  $len = ($pos2 > 0)
58  ? $pos2
59  : strlen($a_location);
60  $par["v"] = substr($a_location, $pos1+2, $len - ($pos1+2));
61  }
62 
63  return $par;
64  }
+ Here is the caller graph for this function:

◆ isFlickr()

static ilExternalMediaAnalyzer::isFlickr (   $a_location)
static

Identify Flickr links.

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

Referenced by extractUrlParameters().

70  {
71  if (strpos($a_location, "flickr.com") > 0)
72  {
73  return true;
74  }
75  return false;
76  }
+ Here is the caller graph for this function:

◆ isGoogleDocument()

static ilExternalMediaAnalyzer::isGoogleDocument (   $a_location)
static

Identify Google Document links.

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

Referenced by extractUrlParameters().

185  {
186  if (strpos($a_location, "docs.google") > 0)
187  {
188  return true;
189  }
190  return false;
191  }
+ Here is the caller graph for this function:

◆ isGoogleVideo()

static ilExternalMediaAnalyzer::isGoogleVideo (   $a_location)
static

Identify GoogleVideo links.

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

Referenced by extractUrlParameters().

123  {
124  if (strpos($a_location, "video.google") > 0)
125  {
126  return true;
127  }
128  return false;
129  }
+ Here is the caller graph for this function:

◆ isVimeo()

static ilExternalMediaAnalyzer::isVimeo (   $a_location)
static

Identify Vimeo links.

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

154  {
155  if (strpos($a_location, "vimeo.com") > 0)
156  {
157  return true;
158  }
159  return false;
160  }

◆ isYouTube()

static ilExternalMediaAnalyzer::isYouTube (   $a_location)
static

Identify YouTube links.

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

Referenced by extractUrlParameters().

39  {
40  if (strpos($a_location, "youtube.com") > 0)
41  {
42  return true;
43  }
44  return false;
45  }
+ Here is the caller graph for this function:

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