Conditions | 5 |
Paths | 5 |
Total Lines | 22 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 0 |
1 | <?php |
||
27 | public function alternateFormats(array $formats, $title = null) |
||
28 | { |
||
29 | $formatLinks = []; |
||
30 | foreach ($formats as $format => $url) { |
||
31 | // Inject format and locale parameters |
||
32 | if (mb_strpos($url, '?') === false) { |
||
33 | $url .= '?'; |
||
34 | } else { |
||
35 | $url .= '&'; |
||
36 | } |
||
37 | |||
38 | $url .= 'format=' . $format . '&lang=' . Zend_Registry::get('Zend_Locale')->getLanguage(); |
||
39 | |||
40 | $formatLinks[] = '<a class="' . $format . '" href="' . $url . '">' . self::$supportedFormats[$format]['name'] . '</a>'; |
||
41 | if ($title && isset(self::$supportedFormats[$format]['mime'])) { |
||
42 | $this->view->headLink()->appendAlternate($url, self::$supportedFormats[$format]['mime'], $title); |
||
43 | } |
||
44 | } |
||
45 | |||
46 | $result = '<p class="alternateFormats">' . $this->view->translate('Also available in:') . ' ' . implode(' | ', $formatLinks) . '</p>'; |
||
47 | |||
48 | return $result; |
||
49 | } |
||
51 |