1<?php
2
3namespace dokuwiki\Menu\Item;
4
5/**
6 * Class ImgOriginalSize
7 */
8class ImgOriginalSize extends AbstractItem
9{
10
11    /** @inheritdoc */
12    public function __construct()
13    {
14        parent::__construct();
15
16        global $lang;
17        global $IMG;
18
19        if (!$IMG) {
20            throw new \RuntimeException("image is not available");
21        }
22
23        unset($this->params['do']);
24
25        $this->label = $lang['js']['mediadirect'];
26        $this->svg   = tpl_incdir() . 'images/menu/image-size-select-large.svg';
27        $this->id    = $IMG;
28    }
29
30    public function getLink()
31    {
32        global $IMG;
33        global $REV;
34        global $INPUT;
35
36        return ml($IMG, array('cache' => $INPUT->str('cache'), 'rev' => $REV), true, '&');
37    }
38
39    public function getLinkAttributes($classprefix = 'menuitem ')
40    {
41        $attr           = parent::getLinkAttributes($classprefix);
42        $attr['target'] = '_blank';
43
44        return $attr;
45    }
46}
47