Conditions | 6 |
Paths | 17 |
Total Lines | 31 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 14 |
CRAP Score | 6 |
1 | <?php |
||
6 | 7 | public static function parse_youtube($arguments, $caption = null, $parser = null, $tagName) { |
|
7 | // first things first, if we dont have a video ID, then we don't need to |
||
8 | // go any further |
||
9 | 7 | if (empty($arguments['id'])) { |
|
10 | 1 | return; |
|
11 | } |
||
12 | |||
13 | 6 | $customise = array(); |
|
14 | |||
15 | // YouTube video id |
||
16 | 6 | $customise['YouTubeID'] = $arguments['id']; |
|
17 | |||
18 | //play the video on page load |
||
19 | 6 | $set = isset($arguments['autoplay']); |
|
20 | 6 | $customise['AutoPlay'] = $set ? true : false; |
|
21 | |||
22 | //set the caption |
||
23 | 6 | $customise['Caption'] = $caption ? Convert::raw2xml($caption) : false; |
|
24 | |||
25 | //set dimensions |
||
26 | 6 | $widthSet = isset($arguments['width']); |
|
27 | 6 | $heightSet = isset($arguments['height']); |
|
28 | 6 | $customise['Width'] = $widthSet ? $arguments['width'] : 560; |
|
29 | 6 | $customise['Height'] = $heightSet ? $arguments['height'] : 315; |
|
30 | |||
31 | //get our YouTube template |
||
32 | 6 | $template = new SSViewer('YouTube'); |
|
33 | |||
34 | //return the customised template |
||
35 | 6 | return $template->process(new ArrayData($customise)); |
|
36 | } |
||
37 | } |
||
38 |