-
Notifications
You must be signed in to change notification settings - Fork 4
/
mediaLink.php
67 lines (66 loc) · 1.54 KB
/
mediaLink.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
* Description of mediaLink
*
* @author olamedia
*/
class mediaLink{
protected $_driver = null;
public function __construct($url){
//$this->_url = $url;
$this->url = $url;
$this->getDriver();
}
public function getDomainName(){
if (preg_match("#http://(www\.)?(([a-z0-9\.-]+)\.([a-z]+))/#ims", $this->getUrl(), $subs)){
return $subs[2];
}
return false;
}
public function getUrl(){
return $this->url->getValue();
}
public function getFixedUrl(){
if ($this->getDriver()){
return $this->getDriver()->getFixedUrl();
}
return $this->getUrl();
}
public function getPreviewUrl(){
return $this->getDriver()->getPreviewUrl();
}
public function getOnClick($playerId){
return $this->getDriver()->getOnClick($playerId);
}
public function getTitle(){
return $this->getDriver()->getTitle();
}
public function getEmbedUrl(){
return $this->getDriver()->getEmbedUrl();
}
public function getFlashVars(){
return $this->getDriver()->getFlashVars();
}
public function getEmbedHtml(){
return $this->getDriver()->getEmbedHtml();
}
public function getDriver(){
if ($this->_driver===null){
$path = dirname(__FILE__).'/mediaDrivers/';
foreach (glob($path.'*') as $f){
$class = array_shift(explode('.', basename($f)));
require_once $f;
/* @var $driver mediaLinkDriver */
$driver = new $class($this);
if ($driver->load()){
$this->_driver = $driver;
}
}
}
return $this->_driver;
}
}