ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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  $len = ($pos2 > 0)
88  ? $pos2
89  : $a_location;
90  $par["user_id"] = substr($a_location, $pos1 + 18, $len - ($pos1 + 18));
91  }
92 
93  // tags
94  $pos1 = strpos($a_location, "/tags/");
95  $pos2 = strpos($a_location, "/", $pos1 + 6);
96  if ($pos1 > 0) {
97  $len = ($pos2 > 0)
98  ? $pos2
99  : strlen($a_location);
100  $par["tags"] = substr($a_location, $pos1 + 6, $len - ($pos1 + 6));
101  }
102 
103  // sets
104  $pos1 = strpos($a_location, "/sets/");
105  $pos2 = strpos($a_location, "/", $pos1 + 6);
106  if ($pos1 > 0) {
107  $len = ($pos2 > 0)
108  ? $pos2
109  : $a_location;
110  $par["sets"] = substr($a_location, $pos1 + 6, $len - ($pos1 + 6));
111  }
112 
113  return $par;
114  }
+ Here is the caller graph for this function:

◆ extractGoogleDocumentParameters()

static ilExternalMediaAnalyzer::extractGoogleDocumentParameters (   $a_location)
static

Extract GoogleDocument Parameter.

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

Referenced by extractUrlParameters().

189  {
190  $par = array();
191  $pos1 = strpos($a_location, "id=");
192  $pos2 = strpos($a_location, "&", $pos1 + 3);
193  if ($pos1 > 0) {
194  $len = ($pos2 > 0)
195  ? $pos2
196  : strlen($a_location);
197  $par["docid"] = substr($a_location, $pos1 + 3, $len - ($pos1 + 3));
198  }
199  $pos1 = strpos($a_location, "docID=");
200  $pos2 = strpos($a_location, "&", $pos1 + 6);
201  if ($pos1 > 0) {
202  $len = ($pos2 > 0)
203  ? $pos2
204  : strlen($a_location);
205  $par["docid"] = substr($a_location, $pos1 + 6, $len - ($pos1 + 6));
206  }
207  if (strpos($a_location, "Presentation?") > 0) {
208  $par["type"] = "Presentation";
209  }
210  if (strpos($a_location, "View?") > 0) {
211  $par["type"] = "Document";
212  }
213 
214  return $par;
215  }
+ Here is the caller graph for this function:

◆ extractGoogleVideoParameters()

static ilExternalMediaAnalyzer::extractGoogleVideoParameters (   $a_location)
static

Extract GoogleVideo Parameter.

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

Referenced by extractUrlParameters().

131  {
132  $par = array();
133  $pos1 = strpos($a_location, "docid=");
134  $pos2 = strpos($a_location, "&", $pos1 + 6);
135  if ($pos1 > 0) {
136  $len = ($pos2 > 0)
137  ? $pos2
138  : strlen($a_location);
139  $par["docid"] = substr($a_location, $pos1 + 6, $len - ($pos1 + 6));
140  }
141 
142  return $par;
143  }
+ 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 220 of file class.ilExternalMediaAnalyzer.php.

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

Referenced by ilMediaItem\extractUrlParameters().

221  {
222  if (!is_array($a_parameter)) {
223  $a_parameter = array();
224  }
225 
226  $ext_par = array();
227 
228  // YouTube
229  if (ilExternalMediaAnalyzer::isYouTube($a_location)) {
231  $a_parameter = array();
232  }
233 
234  // Flickr
235  if (ilExternalMediaAnalyzer::isFlickr($a_location)) {
236  $ext_par = ilExternalMediaAnalyzer::extractFlickrParameters($a_location);
237  $a_parameter = array();
238  }
239 
240  // GoogleVideo
241  if (ilExternalMediaAnalyzer::isGoogleVideo($a_location)) {
243  $a_parameter = array();
244  }
245 
246  // GoogleDocs
249  $a_parameter = array();
250  }
251 
252  foreach ($ext_par as $name => $value) {
253  $a_parameter[$name] = $value;
254  }
255 
256  return $a_parameter;
257  }
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 159 of file class.ilExternalMediaAnalyzer.php.

Referenced by ilMediaPlayerGUI\getMp3PlayerHtml().

160  {
161  $par = array();
162  $pos1 = strpos($a_location, "vimeo.com/");
163  $pos2 = strpos($a_location, "&", $pos1 + 10);
164  if ($pos1 > 0) {
165  $len = ($pos2 > 0)
166  ? $pos2
167  : strlen($a_location);
168  $par["id"] = substr($a_location, $pos1 + 10, $len - ($pos1 + 10));
169  }
170 
171  return $par;
172  }
+ Here is the caller graph for this function:

◆ extractYouTubeParameters()

static ilExternalMediaAnalyzer::extractYouTubeParameters (   $a_location)
static

Extract YouTube Parameter.

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

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

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

◆ isFlickr()

static ilExternalMediaAnalyzer::isFlickr (   $a_location)
static

Identify Flickr links.

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

Referenced by extractUrlParameters().

71  {
72  if (strpos($a_location, "flickr.com") > 0) {
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 177 of file class.ilExternalMediaAnalyzer.php.

Referenced by extractUrlParameters().

178  {
179  if (strpos($a_location, "docs.google") > 0) {
180  return true;
181  }
182  return false;
183  }
+ Here is the caller graph for this function:

◆ isGoogleVideo()

static ilExternalMediaAnalyzer::isGoogleVideo (   $a_location)
static

Identify GoogleVideo links.

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

Referenced by extractUrlParameters().

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

◆ isVimeo()

static ilExternalMediaAnalyzer::isVimeo (   $a_location)
static

Identify Vimeo links.

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

Referenced by ilMediaPlayerGUI\getMp3PlayerHtml().

149  {
150  if (strpos($a_location, "vimeo.com") > 0) {
151  return true;
152  }
153  return false;
154  }
+ 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.

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

39  {
40  if (strpos($a_location, "youtube.com") > 0 ||
41  strpos($a_location, "youtu.be") > 0) {
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: