ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 86 of file class.ilExternalMediaAnalyzer.php.

87 {
88 $par = array();
89 $pos1 = strpos($a_location, "flickr.com/photos/");
90 $pos2 = strpos($a_location, "/", $pos1+18);
91 if ($pos1 > 0)
92 {
93 $len = ($pos2 > 0)
94 ? $pos2
95 : $a_location;
96 $par["user_id"] = substr($a_location, $pos1+18, $len - ($pos1+18));
97 }
98
99 // tags
100 $pos1 = strpos($a_location, "/tags/");
101 $pos2 = strpos($a_location, "/", $pos1+6);
102 if ($pos1 > 0)
103 {
104 $len = ($pos2 > 0)
105 ? $pos2
106 : strlen($a_location);
107 $par["tags"] = substr($a_location, $pos1+6, $len - ($pos1+6));
108 }
109
110 // sets
111 $pos1 = strpos($a_location, "/sets/");
112 $pos2 = strpos($a_location, "/", $pos1+6);
113 if ($pos1 > 0)
114 {
115 $len = ($pos2 > 0)
116 ? $pos2
117 : $a_location;
118 $par["sets"] = substr($a_location, $pos1+6, $len - ($pos1+6));
119 }
120
121 return $par;
122 }

Referenced by extractUrlParameters().

+ Here is the caller graph for this function:

◆ extractGoogleDocumentParameters()

static ilExternalMediaAnalyzer::extractGoogleDocumentParameters (   $a_location)
static

Extract GoogleDocument Parameter.

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

202 {
203 $par = array();
204 $pos1 = strpos($a_location, "id=");
205 $pos2 = strpos($a_location, "&", $pos1 + 3);
206 if ($pos1 > 0)
207 {
208 $len = ($pos2 > 0)
209 ? $pos2
210 : strlen($a_location);
211 $par["docid"] = substr($a_location, $pos1+3, $len - ($pos1+3));
212 }
213 $pos1 = strpos($a_location, "docID=");
214 $pos2 = strpos($a_location, "&", $pos1 + 6);
215 if ($pos1 > 0)
216 {
217 $len = ($pos2 > 0)
218 ? $pos2
219 : strlen($a_location);
220 $par["docid"] = substr($a_location, $pos1+6, $len - ($pos1+6));
221 }
222 if (strpos($a_location, "Presentation?") > 0)
223 {
224 $par["type"] = "Presentation";
225 }
226 if (strpos($a_location, "View?") > 0)
227 {
228 $par["type"] = "Document";
229 }
230
231 return $par;
232 }

Referenced by extractUrlParameters().

+ Here is the caller graph for this function:

◆ extractGoogleVideoParameters()

static ilExternalMediaAnalyzer::extractGoogleVideoParameters (   $a_location)
static

Extract GoogleVideo Parameter.

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

140 {
141 $par = array();
142 $pos1 = strpos($a_location, "docid=");
143 $pos2 = strpos($a_location, "&", $pos1 + 6);
144 if ($pos1 > 0)
145 {
146 $len = ($pos2 > 0)
147 ? $pos2
148 : strlen($a_location);
149 $par["docid"] = substr($a_location, $pos1+6, $len - ($pos1+6));
150 }
151
152 return $par;
153 }

Referenced by extractUrlParameters().

+ 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 237 of file class.ilExternalMediaAnalyzer.php.

238 {
239 if (!is_array($a_parameter))
240 {
241 $a_parameter = array();
242 }
243
244 $ext_par = array();
245
246 // YouTube
247 if (ilExternalMediaAnalyzer::isYouTube($a_location))
248 {
250 $a_parameter = array();
251 }
252
253 // Flickr
254 if (ilExternalMediaAnalyzer::isFlickr($a_location))
255 {
257 $a_parameter = array();
258 }
259
260 // GoogleVideo
262 {
264 $a_parameter = array();
265 }
266
267 // GoogleDocs
269 {
271 $a_parameter = array();
272 }
273
274 foreach($ext_par as $name => $value)
275 {
276 $a_parameter[$name] = $value;
277 }
278
279 return $a_parameter;
280 }
static extractYouTubeParameters($a_location)
Extract YouTube Parameter.
static extractFlickrParameters($a_location)
Extract Flickr Parameter.
static isGoogleDocument($a_location)
Identify Google Document links.
static extractGoogleVideoParameters($a_location)
Extract GoogleVideo Parameter.
static isGoogleVideo($a_location)
Identify GoogleVideo links.
static isFlickr($a_location)
Identify Flickr links.
static extractGoogleDocumentParameters($a_location)
Extract GoogleDocument Parameter.
static isYouTube($a_location)
Identify YouTube links.

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

Referenced by ilMediaItem\extractUrlParameters().

+ 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 170 of file class.ilExternalMediaAnalyzer.php.

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

Referenced by ilMediaPlayerGUI\getMp3PlayerHtml().

+ Here is the caller graph for this function:

◆ extractYouTubeParameters()

static ilExternalMediaAnalyzer::extractYouTubeParameters (   $a_location)
static

Extract YouTube Parameter.

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

52 {
53 $par = array();
54 $pos1 = strpos($a_location, "v=");
55 $pos2 = strpos($a_location, "&", $pos1);
56 if ($pos1 > 0)
57 {
58 $len = ($pos2 > 0)
59 ? $pos2
60 : strlen($a_location);
61 $par["v"] = substr($a_location, $pos1+2, $len - ($pos1+2));
62 }
63 else if (strpos($a_location, "youtu.be") > 0)
64 {
65 //$par["v"] = substr($a_location, strrpos($a_location, "/") + 1);
66 }
67
68 return $par;
69 }

Referenced by extractUrlParameters(), and ilMediaPlayerGUI\getMp3PlayerHtml().

+ Here is the caller graph for this function:

◆ isFlickr()

static ilExternalMediaAnalyzer::isFlickr (   $a_location)
static

Identify Flickr links.

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

75 {
76 if (strpos($a_location, "flickr.com") > 0)
77 {
78 return true;
79 }
80 return false;
81 }

Referenced by extractUrlParameters().

+ Here is the caller graph for this function:

◆ isGoogleDocument()

static ilExternalMediaAnalyzer::isGoogleDocument (   $a_location)
static

Identify Google Document links.

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

190 {
191 if (strpos($a_location, "docs.google") > 0)
192 {
193 return true;
194 }
195 return false;
196 }

Referenced by extractUrlParameters().

+ Here is the caller graph for this function:

◆ isGoogleVideo()

static ilExternalMediaAnalyzer::isGoogleVideo (   $a_location)
static

Identify GoogleVideo links.

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

128 {
129 if (strpos($a_location, "video.google") > 0)
130 {
131 return true;
132 }
133 return false;
134 }

Referenced by extractUrlParameters().

+ Here is the caller graph for this function:

◆ isVimeo()

static ilExternalMediaAnalyzer::isVimeo (   $a_location)
static

Identify Vimeo links.

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

159 {
160 if (strpos($a_location, "vimeo.com") > 0)
161 {
162 return true;
163 }
164 return false;
165 }

Referenced by ilMediaPlayerGUI\getMp3PlayerHtml().

+ Here is the caller graph for this function:

◆ isYouTube()

static ilExternalMediaAnalyzer::isYouTube (   $a_location)
static

Identify YouTube links.

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

39 {
40 if (strpos($a_location, "youtube.com") > 0 ||
41 strpos($a_location, "youtu.be") > 0)
42 {
43 return true;
44 }
45 return false;
46 }

Referenced by extractUrlParameters(), and ilMediaPlayerGUI\getMp3PlayerHtml().

+ Here is the caller graph for this function:

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