19declare(strict_types=1);
27 protected string $image_dir
34 $style = $this->style->getStyle();
36 $page_background =
"";
38 $mqs = array(array(
"mquery" =>
"",
"id" => 0));
39 foreach ($this->style->getMediaQueries() as $mq) {
43 foreach ($mqs as $mq) {
45 $css .=
"@media " . $mq[
"mquery"] .
" {\n";
48 foreach ($style as $tag) {
49 if ($tag[0][
"mq_id"] != $mq[
"id"]) {
52 if (is_int(strpos($tag[0][
"class"],
"before")) && !is_int(strpos($tag[0][
"class"],
"::before"))) {
53 $tag[0][
"class"] = str_replace(
":before",
"::before", $tag[0][
"class"]);
55 $css .= $tag[0][
"tag"] .
".ilc_" . $tag[0][
"type"] .
"_" . $tag[0][
"class"] .
"\n";
58 if ($tag[0][
"tag"] ==
"td") {
59 $css .=
",th" .
".ilc_" . $tag[0][
"type"] .
"_" . $tag[0][
"class"] .
"\n";
61 if (in_array($tag[0][
"tag"], array(
"h1",
"h2",
"h3"))) {
62 $css .=
",div.ilc_text_block_" . $tag[0][
"class"] .
"\n";
63 $css .=
",html.il-no-tiny-bg body#tinymce.ilc_text_block_" . $tag[0][
"class"] .
"\n";
65 if ($tag[0][
"type"] ==
"section") {
66 $css .=
",a.ilc_" . $tag[0][
"type"] .
"_" . $tag[0][
"class"] .
"\n";
68 if ($tag[0][
"type"] ==
"strong") {
69 $css .=
",span.ilc_text_inline_" . $tag[0][
"class"] .
"\n";
71 if ($tag[0][
"type"] ==
"em") {
72 $css .=
",span.ilc_text_inline_" . $tag[0][
"class"] .
"\n";
74 if ($tag[0][
"type"] ==
"text_block") {
75 $css .=
",html.il-no-tiny-bg body#tinymce.ilc_text_block_" . $tag[0][
"class"] .
"\n";
77 if ($tag[0][
"class"] ==
"VAccordCntr" &&
78 $this->style->hasCharacteristic(
"va_cntr",
"VAccordCntr")) {
79 $css .=
",div.ilc_va_cntr_AccordCntr\n";
81 if ($tag[0][
"class"] ==
"VAccordICntr" &&
82 $this->style->hasCharacteristic(
"va_icntr",
"VAccordICntr")) {
83 $css .=
",div.ilc_va_icntr_AccordICntr\n";
85 if ($tag[0][
"class"] ==
"VAccordICont" &&
86 $this->style->hasCharacteristic(
"va_icont",
"VAccordICont")) {
87 $css .=
",div.ilc_va_icont_AccordICont\n";
89 if ($tag[0][
"class"] ==
"VAccordIHead" &&
90 $this->style->hasCharacteristic(
"va_ihead",
"VAccordIHead")) {
91 $css .=
",div.ilc_va_ihead_AccordIHead\n";
93 if ($tag[0][
"class"] ==
"VAccordIHead:hover" &&
94 $this->style->hasCharacteristic(
"va_ihead",
"VAccordIHead")) {
95 $css .=
",div.ilc_va_ihead_AccordIHead:hover\n";
97 if ($tag[0][
"class"] ==
"VAccordIHeadActive" &&
98 $this->style->hasCharacteristic(
"va_iheada",
"VAccordIHeadActive")) {
99 $css .=
",div.ilc_va_iheada_AccordIHeadActive\n";
101 if ($tag[0][
"class"] ==
"VAccordIHeadActive:hover" &&
102 $this->style->hasCharacteristic(
"va_iheada",
"VAccordIHeadActive")) {
103 $css .=
",div.ilc_va_iheada_AccordIHeadActive:hover\n";
110 foreach ($tag as $par) {
111 $cur_par = $par[
"parameter"];
112 $cur_val = $par[
"value"];
115 if (is_int(strpos($cur_par,
"color")) && substr(trim($cur_val), 0, 1) ==
"!") {
116 $cur_val = $this->style->getColorCodeForName(substr($cur_val, 1));
119 if ($tag[0][
"type"] ==
"table" && is_int(strpos($par[
"parameter"],
"border"))) {
120 $t_border[$cur_par] = $cur_val;
123 if (in_array($cur_par, array(
"background-image",
"list-style-image"))) {
124 if (is_int(strpos($cur_val,
"/"))) {
125 $cur_val =
"url('" . $cur_val .
"')";
127 if ($this->image_dir ==
"") {
128 $cur_val =
"url('images/" . $cur_val .
"')";
130 $cur_val =
"url('" . $this->image_dir .
"/" . $cur_val .
"')";
135 if ($cur_par ==
"opacity") {
136 $cur_val = ((
int) $cur_val) / 100;
139 $css .=
"\t" . $cur_par .
": " . $cur_val .
";\n";
142 if ($cur_par ==
"opacity") {
143 $css .=
"\t" .
'-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=' . ($cur_val * 100) .
')"' .
";\n";
144 $css .=
"\t" .
'filter: alpha(opacity=' . ($cur_val * 100) .
')' .
";\n";
145 $css .=
"\t" .
'-moz-opacity: ' . $cur_val .
";\n";
149 if ($cur_par ==
"transform") {
150 $css .=
"\t" .
'-webkit-transform: ' . $cur_val .
";\n";
151 $css .=
"\t" .
'-moz-transform: ' . $cur_val .
";\n";
152 $css .=
"\t" .
'-ms-transform: ' . $cur_val .
";\n";
156 if ($cur_par ==
"transform-origin") {
157 $css .=
"\t" .
'-webkit-transform-origin: ' . $cur_val .
";\n";
158 $css .=
"\t" .
'-moz-transform-origin: ' . $cur_val .
";\n";
159 $css .=
"\t" .
'-ms-transform-origin: ' . $cur_val .
";\n";
163 if ($tag[0][
"tag"] ==
"div" && $tag[0][
"class"] ==
"Page"
164 && $cur_par ==
"background-color") {
165 $page_background = $cur_val;
172 if ($page_background !=
"") {
173 $css .=
"td.ilc_Page\n";
175 $css .=
"\t" .
"background-color: " . $page_background .
";\n";
__construct(protected \ilObjStyleSheet $style, protected string $image_dir)