| 1 | <?php |
||
| 16 | class YouTube_VideoModel extends BaseModel |
||
| 17 | { |
||
| 18 | /** |
||
| 19 | * YouTube Embed URL prefix. |
||
| 20 | */ |
||
| 21 | const YOUTUBE_EMBED_PREFIX = 'https://www.youtube.com/embed/'; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * YouTube Watch URL prefix. |
||
| 25 | */ |
||
| 26 | const YOUTUBE_WATCH_PREFIX = 'https://www.youtube.com/watch?v='; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Define model attributes. |
||
| 30 | * |
||
| 31 | * @return array |
||
| 32 | */ |
||
| 33 | public function defineAttributes() |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Return ID as string. |
||
| 42 | * |
||
| 43 | * @return string |
||
| 44 | */ |
||
| 45 | public function __toString() |
||
| 46 | { |
||
| 47 | return $this->id; |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * Return full YouTube (embed) url. |
||
| 52 | * |
||
| 53 | * @param bool $embed |
||
| 54 | * |
||
| 55 | * @return string |
||
| 56 | */ |
||
| 57 | public function getUrl($embed = true) |
||
| 65 | } |
||
| 66 |