Definition at line 23 of file CSSBuilder.php.
◆ __construct()
ILIAS\Style\Content\Style\CSSBuilder::__construct |
( |
protected \ilObjStyleSheet |
$style, |
|
|
protected string |
$image_dir |
|
) |
| |
◆ getCss()
ILIAS\Style\Content\Style\CSSBuilder::getCss |
( |
| ) |
|
Definition at line 32 of file CSSBuilder.php.
References ILIAS\Repository\int().
34 $style = $this->style->getStyle();
37 $page_background =
"";
39 $mqs = array(array(
"mquery" =>
"",
"id" => 0));
40 foreach ($this->style->getMediaQueries() as $mq) {
45 foreach ($mqs as $mq) {
47 $css .=
"@media " . $mq[
"mquery"] .
" {\n";
50 foreach ($style as $tag) {
51 if ($tag[0][
"mq_id"] != $mq[
"id"]) {
54 if (is_int(strpos($tag[0][
"class"],
"before")) && !is_int(strpos($tag[0][
"class"],
"::before"))) {
55 $tag[0][
"class"] = str_replace(
":before",
"::before", $tag[0][
"class"]);
57 $css .= $tag[0][
"tag"] .
".ilc_" . $tag[0][
"type"] .
"_" . $tag[0][
"class"] .
"\n";
60 if ($tag[0][
"tag"] ==
"td") {
61 $css .=
",th" .
".ilc_" . $tag[0][
"type"] .
"_" . $tag[0][
"class"] .
"\n";
63 if (in_array($tag[0][
"tag"], array(
"h1",
"h2",
"h3"))) {
64 $css .=
",div.ilc_text_block_" . $tag[0][
"class"] .
"\n";
65 $css .=
",html.il-no-tiny-bg body#tinymce.ilc_text_block_" . $tag[0][
"class"] .
"\n";
67 if ($tag[0][
"type"] ==
"section") {
68 $css .=
",a.ilc_" . $tag[0][
"type"] .
"_" . $tag[0][
"class"] .
"\n";
70 if ($tag[0][
"type"] ==
"strong") {
71 $css .=
",span.ilc_text_inline_" . $tag[0][
"class"] .
"\n";
73 if ($tag[0][
"type"] ==
"em") {
74 $css .=
",span.ilc_text_inline_" . $tag[0][
"class"] .
"\n";
76 if ($tag[0][
"type"] ==
"text_block") {
77 $css .=
",html.il-no-tiny-bg body#tinymce.ilc_text_block_" . $tag[0][
"class"] .
"\n";
79 if ($tag[0][
"class"] ==
"VAccordCntr") {
80 $css .=
",div.ilc_va_cntr_AccordCntr\n";
82 if ($tag[0][
"class"] ==
"VAccordICntr") {
83 $css .=
",div.ilc_va_icntr_AccordICntr\n";
85 if ($tag[0][
"class"] ==
"VAccordICont") {
86 $css .=
",div.ilc_va_icont_AccordICont\n";
88 if ($tag[0][
"class"] ==
"VAccordIHead") {
89 $css .=
",div.ilc_va_ihead_AccordIHead\n";
91 if ($tag[0][
"class"] ==
"VAccordIHead:hover") {
92 $css .=
",div.ilc_va_ihead_AccordIHead:hover\n";
94 if ($tag[0][
"class"] ==
"VAccordIHeadActive") {
95 $css .=
",div.ilc_va_iheada_AccordIHeadActive\n";
97 if ($tag[0][
"class"] ==
"VAccordIHeadActive:hover") {
98 $css .=
",div.ilc_va_iheada_AccordIHeadActive:hover\n";
105 foreach ($tag as $par) {
106 $cur_par = $par[
"parameter"];
107 $cur_val = $par[
"value"];
110 if (is_int(strpos($cur_par,
"color")) && substr(trim($cur_val), 0, 1) ==
"!") {
111 $cur_val = $this->style->getColorCodeForName(substr($cur_val, 1));
114 if ($tag[0][
"type"] ==
"table" && is_int(strpos($par[
"parameter"],
"border"))) {
115 $t_border[$cur_par] = $cur_val;
118 if (in_array($cur_par, array(
"background-image",
"list-style-image"))) {
119 if (is_int(strpos($cur_val,
"/"))) {
120 $cur_val =
"url('" . $cur_val .
"')";
122 if ($this->image_dir ==
"") {
123 $cur_val =
"url('images/" . $cur_val .
"')";
125 $cur_val =
"url('" . $this->image_dir .
"/" . $cur_val .
"')";
130 if ($cur_par ==
"opacity") {
131 $cur_val = ((
int) $cur_val) / 100;
134 $css .=
"\t" . $cur_par .
": " . $cur_val .
";\n";
137 if ($cur_par ==
"opacity") {
138 $css .=
"\t" .
'-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=' . ($cur_val * 100) .
')"' .
";\n";
139 $css .=
"\t" .
'filter: alpha(opacity=' . ($cur_val * 100) .
')' .
";\n";
140 $css .=
"\t" .
'-moz-opacity: ' . $cur_val .
";\n";
144 if ($cur_par ==
"transform") {
145 $css .=
"\t" .
'-webkit-transform: ' . $cur_val .
";\n";
146 $css .=
"\t" .
'-moz-transform: ' . $cur_val .
";\n";
147 $css .=
"\t" .
'-ms-transform: ' . $cur_val .
";\n";
151 if ($cur_par ==
"transform-origin") {
152 $css .=
"\t" .
'-webkit-transform-origin: ' . $cur_val .
";\n";
153 $css .=
"\t" .
'-moz-transform-origin: ' . $cur_val .
";\n";
154 $css .=
"\t" .
'-ms-transform-origin: ' . $cur_val .
";\n";
158 if ($tag[0][
"tag"] ==
"div" && $tag[0][
"class"] ==
"Page" 159 && $cur_par ==
"background-color") {
160 $page_background = $cur_val;
167 if ($page_background !=
"") {
168 $css .=
"td.ilc_Page\n";
170 $css .=
"\t" .
"background-color: " . $page_background .
";\n";
The documentation for this class was generated from the following file: