Completed
Push — master ( cd12ec...fb91d6 )
by Gino
03:28
created

CssStyles::render()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 33
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 33
rs 8.8571
cc 1
eloc 10
nc 1
nop 0
1
<?php
2
3
/*
4
 You may not change or alter any portion of this comment or credits
5
 of supporting developers from this source code or any supporting source code
6
 which is considered copyrighted (c) material of the original comment or credit authors.
7
8
 This program is distributed in the hope that it will be useful,
9
 but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
 */
12
/**
13
 * tdmcreate module.
14
 *
15
 * @copyright       The XOOPS Project http://sourceforge.net/projects/xoops/
16
 * @license         GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
17
 *
18
 * @since           2.5.0
19
 *
20
 * @author          Txmod Xoops http://www.txmodxoops.org
21
 *
22
 * @version         $Id: 1.91 CssStyles.php 12258 2014-01-02 09:33:29Z timgno $
23
 */
24
25
/**
26
 * Class CssStyles.
27
 */
28
class CssStyles extends TDMCreateFile
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
29
{
30
    /*
31
    *  @public function constructor
32
    *  @param null
33
    */
34
    /**
35
     *
36
     */
37
    public function __construct()
38
    {
39
        parent::__construct();
40
    }
41
42
    /*
43
    *  @static function &getInstance
44
    *  @param null
45
    */
46
    /**
47
     * @return CssStyles
48
     */
49
    public static function &getInstance()
50
    {
51
        static $instance = false;
52
        if (!$instance) {
53
            $instance = new self();
54
        }
55
56
        return $instance;
57
    }
58
59
    /*
60
    *  @public function write
61
    *  @param string $module
62
    *  @param string $filename
63
    */
64
    /**
65
     * @param $module
66
     * @param $filename
67
     */
68
    public function write($module, $filename)
69
    {
70
        $this->setModule($module);
71
        $this->setFileName($filename);
72
    }
73
74
    /*
75
    *  @public function render
76
    *  @param null
77
    */
78
    /**
79
     * @return bool|string
80
     */
81
    public function render()
82
    {
83
        $module = $this->getModule();
84
        $filename = $this->getFileName();
85
        $moduleDirname = $module->getVar('mod_dirname');
86
        $content = $this->getHeaderFilesComments($module, $filename, '@charset "UTF-8";');
87
        $content .= <<<EOT
88
ul.menu {
89
	list-style: none;
90
	background-color: #f5f5f5;
91
	border-radius: 4px;
92
}
93
94
ul.menu > li {
95
	display: inline-block;
96
}
97
98
ul.menu > li + li:before {  
99
    content: "|\00a0";
100
}
101
102
.printOnly {
103
	display: none;
104
}
105
106
img {
107
	max-width: 300px;
108
}
109
EOT;
110
        $this->create($moduleDirname, 'assets/css', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
111
112
        return $this->renderFile();
113
    }
114
}
115