Completed
Push — master ( 60bc7e...871dc9 )
by Julito
30:25
created

CustomFooterPlugin::pix_url()   B

Complexity

Conditions 4
Paths 4

Size

Total Lines 22
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 12
nc 4
nop 2
dl 0
loc 22
rs 8.9197
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Description of Custom Footer
5
 *
6
 * @copyright (c) 2014 VF Consulting
7
 * @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
8
 * @author Valery Fremaux <[email protected]>
9
 */
10
class CustomFooterPlugin extends Plugin
11
{
12
    /**
13
     *
14
     * @return CustomFooterPlugin
15
     */
16
    static function create()
17
    {
18
        static $result = null;
19
20
        return $result ? $result : $result = new self();
21
    }
22
23
    function get_name()
24
    {
25
        return 'customfooter';
26
    }
27
28
    protected function __construct()
29
    {
30
        parent::__construct('1.1', 'Valery Fremaux');
31
    }
32
33
    function pix_url($pixname, $size = 16)
34
    {
35
        global $_configuration;
36
37
        if (file_exists(
38
            $_configuration['root_sys'].'/plugin/customplugin/pix/'.$pixname.'.png'
39
        )) {
40
            return $_configuration['root_web'].'/plugin/customplugin/pix/'.$pixname.'.png';
41
        }
42
        if (file_exists(
43
            $_configuration['root_sys'].'/plugin/customplugin/pix/'.$pixname.'.jpg'
44
        )) {
45
            return $_configuration['root_web'].'/plugin/customplugin/pix/'.$pixname.'.jpg';
46
        }
47
        if (file_exists(
48
            $_configuration['root_sys'].'/plugin/customplugin/pix/'.$pixname.'.gif'
49
        )) {
50
            return $_configuration['root_web'].'/plugin/customplugin/pix/'.$pixname.'.gif';
51
        }
52
53
        return $_configuration['root_web'].'/main/img/icons/'.$size.'/'.$pixname.'.png';
54
    }
55
}