Outputs Confusion Matrix in an HTML table. Cascading Style Sheets (CSS) can control the table's
appearance by defining the empty-space, actual-count-header, predicted-class-header, and
count-element classes. For example

@return html string
179725
public String toHTML() {
        StringBuilder builder = new StringBuilder();

        int numClasses = classes.size();
        // Header Row
        builder.append("<table>\n");
        builder.append("<tr><th class=\"empty-space\" colspan=\"2\" rowspan=\"2\">");
        builder.append(String.format("<th class=\"predicted-class-header\" colspan=\"%d\">Predicted Class</th></tr>%n",
                        numClasses + 1));

        // Predicted Classes Header Row
        builder.append("<tr>");
        // builder.append("<th></th><th></th>");
        for (T predicted : classes) {
            builder.append("<th class=\"predicted-class-header\">");
            builder.append(predicted);
            builder.append("</th>");
        }
        builder.append("<th class=\"predicted-class-header\">Total</th>");
        builder.append("</tr>\n");

        // Data Rows
        String firstColumnLabel = String.format(
                        "<tr><th class=\"actual-class-header\" rowspan=\"%d\">Actual Class</th>", numClasses + 1);
        for (T actual : classes) {
            builder.append(firstColumnLabel);
            firstColumnLabel = "<tr>";
            builder.append(String.format("<th class=\"actual-class-header\" >%s</th>", actual));

            for (T predicted : classes) {
                builder.append("<td class=\"count-element\">");
                builder.append(getCount(actual, predicted));
                builder.append("</td>");
            }

            // Actual Class Totals Column
            builder.append("<td class=\"count-element\">");
            builder.append(getActualTotal(actual));
            builder.append("</td>");
            builder.append("</tr>\n");
        }

        // Predicted Class Totals Row
        builder.append("<tr><th class=\"actual-class-header\">Total</th>");
        for (T predicted : classes) {
            builder.append("<td class=\"count-element\">");
            builder.append(getPredictedTotal(predicted));
            builder.append("</td>");
        }
        builder.append("<td class=\"empty-space\"></td>\n");
        builder.append("</tr>\n");
        builder.append("</table>\n");

        return builder.toString();
    }
914222
public function getStylesheets()
    {
        $stylesheets = '';
        foreach ($this->stylesheets as $stylesheet) {
            $stylesheets .= $stylesheet . "\n";
        }
        $stylesheets = rtrim($stylesheets, "\n");
        return $stylesheets;
    }
1081124
public function renderTableHeader()
    {
        $cells = [];
        foreach ($this->columns as $column) {
            /* @var $column TreeColumn */
            $cells[] = $column->renderHeaderCell();
        }
        $content = Html::tag('tr', implode('', $cells), $this->headerRowOptions);
        return "<thead>\n" . $content . "\n</thead>";
    }
1288085
public function table()
    {
        $first = true;
        $result = "<table>\n";

        foreach ($this as $record) {
            if ($first) {
                $result .= "<tr>";
                foreach ($record as $k => $v) {
                    $result .= "<th>" . Convert::raw2xml($k) . "</th> ";
                }
                $result .= "</tr> \n";
            }

            $result .= "<tr>";
            foreach ($record as $k => $v) {
                $result .= "<td>" . Convert::raw2xml($v) . "</td> ";
            }
            $result .= "</tr> \n";

            $first = false;
        }
        $result .= "</table>\n";

        if ($first) {
            return "No records found";
        }
        return $result;
    }
1271768
public static String makeHTMLTable(String[][] table, String[] rowLabels, String[] colLabels) {
    StringBuilder buff = new StringBuilder();
    buff.append("<table class=\"auto\" border=\"1\" cellspacing=\"0\">\n");
    // top row
    buff.append("<tr>\n");
    buff.append("<td></td>\n"); // the top left cell
    for (int j = 0; j < table[0].length; j++) { // assume table is a rectangular matrix
      buff.append("<td class=\"label\">").append(colLabels[j]).append("</td>\n");
    }
    buff.append("</tr>\n");
    // all other rows
    for (int i = 0; i < table.length; i++) {
      // one row
      buff.append("<tr>\n");
      buff.append("<td class=\"label\">").append(rowLabels[i]).append("</td>\n");
      for (int j = 0; j < table[i].length; j++) {
        buff.append("<td class=\"data\">");
        buff.append(((table[i][j] != null) ? table[i][j] : ""));
        buff.append("</td>\n");
      }
      buff.append("</tr>\n");
    }
    buff.append("</table>");
    return buff.toString();
  }
589546
public function render()
    {
        if (!$this->grid->showColumnSelector()) {
            return '';
        }
        $show = array_filter(explode(',', request(static::SELECT_COLUMN_NAME)));

        $columns = $this->getGridColumns();

        $this->setupScript();

        $lists = $columns->map(function ($val, $key) use ($show) {
            if (empty($show)) {
                $checked = 'checked';
            } else {
                $checked = in_array($key, $show) ? 'checked' : '';
            }

            return <<<HTML
<li class="checkbox icheck" style="margin: 0;">
    <label style="width: 100%;padding: 3px;">
        <input type="checkbox" class="column-select-item" value="{$key}" {$checked}/>&nbsp;&nbsp;&nbsp;{$val}
    </label>
</li>
HTML;
        })->implode("\r\n");

        $btns = [
            'all'    => __('admin.all'),
            'submit' => __('admin.submit'),
        ];

        return <<<EOT

<div class="dropdown pull-right column-selector" style="margin-right: 10px">
    <button type="button" class="btn btn-sm btn-instagram dropdown-toggle" data-toggle="dropdown">
        <i class="fa fa-table"></i>
        &nbsp;
        <span class="caret"></span>
    </button>
    <ul class="dropdown-menu" role="menu" style="padding: 10px;">
        <li>
            <ul style='padding: 0;'>
                {$lists}
            </ul>
        </li>
        <li class="divider"></li>
        <li class="text-right">
            <button class="btn btn-sm btn-defalut column-select-all">{$btns['all']}</button>&nbsp;&nbsp;
            <button class="btn btn-sm btn-primary column-select-submit">{$btns['submit']}</button>
        </li>
    </ul>
</div>
EOT;
    }
80436
public function description() {
		$output = null;
		if ( ! empty( $this->struct['description'] ) ) {
			$output .= ' <small>' . esc_html( $this->struct['description'] ) . '</small>';
		}

		return $output;
	}
457475
public String toHtml() {

        CmsMacroResolver resolver = new CmsMacroResolver();
        if (CmsStringUtil.isEmpty(m_title)) {
            m_title = m_messages.key(Messages.GUI_ERROR_0, new Object[] {});
        }
        resolver.addMacro("title", m_title);
        resolver.addMacro("label_error", m_messages.key(Messages.GUI_ERROR_0, new Object[] {}));
        resolver.addMacro("errorstack", CmsException.getFormattedErrorstack(m_throwable));
        resolver.addMacro("message", CmsStringUtil.escapeHtml(getErrorMessage()));
        resolver.addMacro(
            "styleuri",
            OpenCms.getLinkManager().substituteLink(m_cms, "/system/workplace/commons/style/workplace.css"));
        if (CmsStringUtil.isEmpty(m_buttons)) {
            resolver.addMacro("buttons", getDefaultButtonsHtml());
        } else {
            resolver.addMacro("buttons", m_buttons);
            resolver.addMacro("paramaction", m_paramAction);
        }

        if (CmsStringUtil.isNotEmpty(m_hiddenParams)) {
            resolver.addMacro("hiddenparams", m_hiddenParams);
        }
        resolver.addMacro(
            "erroricon",
            OpenCms.getLinkManager().substituteLink(m_cms, "/system/workplace/resources/commons/error.png"));
        Properties errorpage = new Properties();
        try {
            errorpage.load(CmsErrorBean.class.getClassLoader().getResourceAsStream(ERRORPAGE));
        } catch (Throwable th) {
            CmsLog.INIT.error(
                org.opencms.main.Messages.get().getBundle().key(
                    org.opencms.main.Messages.INIT_ERR_LOAD_HTML_PROPERTY_FILE_1,
                    ERRORPAGE),
                th);
        }
        return resolver.resolveMacros(errorpage.getProperty("ERRORPAGE"));
    }
244994
public function getTableElementStartAsString()
    {
        $escapedSheetName = $this->stringsEscaper->escape($this->externalSheet->getName());
        $tableStyleName = 'ta' . ($this->externalSheet->getIndex() + 1);

        $tableElement  = '<table:table table:style-name="' . $tableStyleName . '" table:name="' . $escapedSheetName . '">';
        $tableElement .= '<table:table-column table:default-cell-style-name="ce1" table:style-name="co1" table:number-columns-repeated="' . $this->maxNumColumns . '"/>';

        return $tableElement;
    }
53465
@HtmlSafe
	public String getStylesheetHtml()
	{
		Space space = gpUtil.getSpaceManager().getSpace(getSpaceKey());
		return String.format("<style>\n%s\n</style>\n<base href=\"%s\"/>\n",
							 StyleSheetExtractorFactory.getInstance().renderStyleSheet(space), gpUtil.getBaseUrl());
	}
531522
public function getHtmlHeadEntrySet()
    {
        $set = parent::getHtmlHeadEntrySet();

        foreach ($this->columns as $column) {
            $set->addEntrySet($column->getHtmlHeadEntrySet());
        }

        foreach ($this->spanning_columns as $column) {
            $set->addEntrySet($column->getHtmlHeadEntrySet());
        }

        foreach ($this->extra_rows as $row) {
            $set->addEntrySet($row->getHtmlHeadEntrySet());
        }

        foreach ($this->groups as $group) {
            $set->addEntrySet($group->getHtmlHeadEntrySet());
        }

        return $set;
    }
210624
protected function parseCss()
    {
        // Init variables
        $this->styleSheet = new StyleSheet();
        $cssContent = "";

        // Prepare CSS content to allow easy parsing;
        // temporarily replace all strings.
        $blockCount = 0;
        $ruleCount = 0;
        $ruleBlock = 0;
        $inBrackets = false;
        $charsetIgnored = true;
        $charsetReplaced = false;

        if (($handle = $this->getCssResource()) !== false) {
            // Determine charset in the correct order, defined in
            // http://www.w3.org/TR/css-syntax-3/#input-byte-stream
            $charset = null;
            $fileContainsBom = false;
            if (($firstLine = fgets($handle)) === false) {
                $firstLine = "";
            }

            // Check for a BOM and use it, if it exists. "The decode algorithm gives precedence to a byte order mark
            // (BOM), and only uses the fallback when none is found."
            $bom = pack("CCC", 0xef, 0xbb, 0xbf);
            if (strlen($firstLine) >= 3 && strncmp($firstLine, $bom, 3) === 0) {
                $charset = "UTF-8";
                $fileContainsBom = true;
            } else {
                // Fallback 1: The encoding defined in HTTP or equivalent protocol
                $charset = $this->getProtocolEncoding();

                // Fallback 2: The charset as defined in the CSS file
                if ($charset === null) {
                    if (preg_match('/^@charset\s+(["\'])([-a-zA-Z0-9_]+)\g{1}/i', $firstLine, $matches)) {
                        $charset = $matches[2];
                        $charsetIgnored = false;

                        // Auto-correction of the defined charset.
                        //"If the return value was utf-16be or utf-16le, use utf-8 as the fallback encoding".
                        if (in_array(strtoupper($charset), ["UTF-16BE", "UTF-16LE"])) {
                            $charset = "UTF-8";
                            $charsetReplaced = true;
                        }
                    }
                }

                // Fallback 3: The environment encoding of the referencing document
                if ($charset === null) {
                    $charset = $this->getEnvironmentEncoding();
                }

                // Fallback 4: Default to UTF-8
                if ($charset === null) {
                    $charset = "UTF-8";
                }
            }
            $this->setCharset($charset);

            // Set position back to the beginning (but skip BOMs)
            fseek($handle, ($fileContainsBom?3:0));

            while (($css = fgets($handle)) !== false) {
                // Required check to avoid errors when the encoding of the
                // file doesn't match the set/detected charset.
                if (mb_check_encoding($css, $charset) === false) {
                    throw new \RuntimeException("Invalid '$charset' encoding in CSS file.");
                }

                if (preg_match('/[^\x00-\x7f]/', $css)) {
                    $isAscii = false;
                    $strLen  = mb_strlen($css, $charset);
                } else {
                    $isAscii = true;
                    $strLen = strlen($css);
                }

                for ($i = 0, $j = $strLen; $i < $j; $i++) {
                    if ($isAscii === true) {
                        $char = $css[$i];
                    } else {
                        $char = mb_substr($css, $i, 1, $charset);
                    }

                    if ($char === "{") {
                        $blockCount++;
                        $cssContent .= "\n_BLOCKSTART_" . $blockCount . "_\n";

                        if ($ruleCount > $ruleBlock) {
                            $ruleBlock++;
                        }
                    } else if ($char === "}") {
                        $cssContent .= "\n_BLOCKEND_" . $blockCount . "_\n";
                        $blockCount--;


                        if ($blockCount < $ruleCount) {
                            if ($ruleCount > 0) {
                                $cssContent .= "\n_RULEEND_" . $ruleCount . "_\n";
                                $ruleCount--;
                            }
                        }
                        if ($ruleCount > 0) {
                            $ruleBlock--;
                        }
                    } elseif ($char === ";") {
                        $cssContent .= $char;
                        if ($ruleCount > 0 && $ruleBlock === 0) {
                            $cssContent .= "\n_RULEEND_1_\n";
                            $ruleCount--;
                        }
                    } else {
                        // Start new at-rule, but only if we are not in brackets, which still can occur, although we
                        // replaced all strings, e.g. in this case: "background: url(/images/myimage-@1x.png)".
                        if ($char === "@" && $inBrackets === false) {
                            if ($ruleCount > 0 && $blockCount === 0) {
                                $errorCss = Placeholder::replaceCommentPlaceholders(
                                    Placeholder::replaceStringPlaceholders($css)
                                );
                                throw new \RuntimeException("Parse error near '$errorCss'.");
                            }
                            $ruleCount++;
                            $cssContent .= "\n_RULESTART_" . $ruleCount . "_\n";
                        // Replace all white-space characters within rule definitions by normal space to get
                        // one line only
                        } elseif ($ruleCount >= $blockCount && in_array($char, ["\r", "\n", "\t", "\f"])) {
                            $char = " ";
                        } elseif ($char === "(") {
                            $inBrackets = true;
                        } elseif ($char === ")") {
                            $inBrackets = false;
                        }
                        $cssContent .= $char;
                    }
                }
            }

            // Auto-correction as required by CSS specs
            while ($blockCount > 0) {
                $cssContent .= "\n_BLOCKEND_" . $blockCount . "_\n";
                $blockCount--;
            }
            while ($ruleCount > 0) {
                $cssContent .= "\n_RULEEND_" . $ruleCount . "_\n";
                $ruleCount--;
            }
        }

        // Prettify...
        $cssContent = preg_replace('/;/', ";\n", $cssContent);
        $cssContent = preg_replace('/[\t\f]+/', "", $cssContent);
        $cssContent = preg_replace('/[ ]+/', " ", $cssContent);
        $cssContent = preg_replace('/(\n)[ ]|[ ](\n)/', "\\1\\2", $cssContent);
        $cssContent = preg_replace('/(?<!_)[ \t\n\r\f]*(:)[ \t\n\r\f]*/', "\\1", $cssContent);
        $cssContent = preg_replace('/([\r\n])+/', "\\1", $cssContent);
        $cssContent = preg_replace('/^\n|\n$/', "", $cssContent);
        $cssContent = preg_replace('/^(_COMMENT_[a-f0-9]{32}_)([^\r\n]+)/m', "\\1\n\\2", $cssContent);

        // Parse
        $lines = explode("\n", $cssContent);

        $ruleCount = 0;
        $blockCount = 0;
        $lastRuleContainers = [$this->styleSheet];
        $lastRuleSet = null;

        // Prepare vendor prefix regular expression
        $vendorPrefixRegExp = RuleAbstract::getVendorPrefixRegExp("/");

        $comment = null;
        $atRuleCharsetAllowed = true;
        $atRuleImportAllowed = true;
        $atRuleNamespaceAllowed = true;
        foreach ($lines as $line) {
            if (preg_match(
                '/^(?J)(?:_(?P<type>RULESTART|RULEEND|BLOCKSTART|BLOCKEND)_\d+_|_(?P<type>COMMENT)_[a-f0-9]{32}_)/',
                $line,
                $matches
            )) {
                if ($matches['type'] === 'RULESTART') {
                    $ruleCount++;
                } elseif ($matches['type'] === 'RULEEND') {
                    $ruleCount--;
                    if ($ruleCount === $blockCount) {
                        // Current rule finished
                    }
                } elseif ($matches['type'] === 'BLOCKSTART') {
                    $blockCount++;
                } elseif ($matches['type'] === 'BLOCKEND') {
                    $blockCount--;
                    if ($blockCount === $ruleCount) {
                        if ($comment !== null) {
                            /** @var AtRuleAbstract $lastRuleSet */
                            $lastRuleSet->addComment($comment);
                            $comment = null;
                        }

                        // Current rule set finished
                        $lastRuleSet = null;
                    } else {
                        if ($comment !== null) {
                            /** @var AtRuleAbstract[] $lastRuleContainers */
                            $lastRuleContainers[$ruleCount]->addComment($comment);
                            $comment = null;
                        }
                    }
                } elseif ($matches['type'] === 'COMMENT') {
                    $comment = rtrim($line);
                }
            } else {
                if ($blockCount < $ruleCount) {
                    // New rule opened
                    if (preg_match(
                        '/^@(' . $vendorPrefixRegExp . ')?([a-zA-Z_]{1}(?:[-a-zA-Z0-9_]*|[^[:ascii:]*]))/i',
                        trim($line),
                        $matches
                    )) {
                        $identifier   = mb_strtolower($matches[2], $this->getCharset());
                        switch($identifier) {
                            case "charset":
                                $atRule = new CharsetRule($line, $this->styleSheet);
                                break;
                            case "import":
                                $atRule = new ImportRule($line, $this->styleSheet);
                                break;
                            case "namespace":
                                $atRule = new NamespaceRule($line, $this->styleSheet);
                                break;
                            case "media":
                                $atRule = new MediaRule($line, $this->styleSheet);
                                break;
                            case "supports":
                                $atRule = new SupportsRule($line, $this->styleSheet);
                                break;
                            case "document":
                                $atRule = new DocumentRule($line, $this->styleSheet);
                                break;
                            case "font-face":
                                $atRule = new FontFaceRule($line, $this->styleSheet);
                                break;
                            case "page":
                                $atRule = new PageRule($line, $this->styleSheet);
                                break;
                            case "keyframes":
                                $atRule = new KeyframesRule($line, $this->styleSheet);
                                break;
                            default:
                                throw new \InvalidArgumentException("Unknown at rule identifier '$identifier'.");
                        }

                        // Add vendor prefix
                        if ($matches[1] !== "") {
                            $vendorPrefix = mb_strtolower($matches[1], $this->getCharset());
                            $atRule->setVendorPrefix($vendorPrefix);
                        }
                    } else {
                        throw new \InvalidArgumentException("Invalid rule format in '$line'.");
                    }

                    // IMPORTANT:
                    // - The @charset rule must be the first element in the style sheet and not be preceded by any
                    //   character.
                    // - Any @import rules must precede all other types of rules, except @charset rules (and other
                    //   @import rules).
                    // - Any @namespace rules must follow all @charset and @import rules (and other @namespace rules)
                    //   and precede all other non-ignored at-rules and style rules in a style-sheet.
                    if ($atRule instanceof CharsetRule) {
                        if ($atRuleCharsetAllowed === false) {
                            // As defined by CSS specs, the rule has been ignored, du to an invalid position in the
                            // style sheet. E.g. @charset must be the first content of the file, @import must be first
                            // or follow @charset or @import, and @namespace can only follow to @charset, @import or
                            // @namespace.
                            $atRule->setIsValid(false);
                            $atRule->addValidationError(
                                "Ignored @charset rule, because at wrong position in style sheet."
                            );
                        } elseif ($charsetIgnored === true) {
                            // As defined by CSS specs, the charset rule has been ignored, due to charset information
                            // from other sources (e.g. BOMs in the file or defined protocol encoding).
                            $atRule->setIsValid(false);
                            $atRule->addValidationError(
                                "Ignored @charset rule, because charset got from other source with higher priority."
                            );
                            $atRuleCharsetAllowed = false;
                        } elseif ($charsetReplaced === true) {
                            // As defined by CSS specs, the charset defined by the charset rule has been replaced with
                            // "UTF-8", because an UTF-16* charset has been used.
                            $atRule->setIsValid(false);
                            $atRule->addValidationError(
                                "Replaced charset in @charset rule with 'UTF-8', because defined charset is invalid."
                            );
                            $atRuleCharsetAllowed = false;
                        } else {
                            $atRuleCharsetAllowed = false;
                        }
                    } elseif ($atRule instanceof ImportRule) {
                        // As defined by CSS specs, the rule has been ignored, du to an invalid position in the style
                        // sheet. E.g. @charset must be the first content of the file, @import must be first or follow
                        // @charset or @import, and @namespace can only follow to @charset, @import or @namespace.
                        if ($atRuleImportAllowed === false) {
                            $atRule->setIsValid(false);
                            $atRule->addValidationError(
                                "Ignored @import rule, because at wrong position in style sheet."
                            );
                        }
                        $atRuleCharsetAllowed = false;
                    } elseif ($atRule instanceof NamespaceRule) {
                        // As defined by CSS specs, the rule has been ignored, du to an invalid position in the style
                        // sheet. E.g. @charset must be the first content of the file, @import must be first or follow
                        // @charset or @import, and @namespace can only follow to @charset, @import or @namespace.
                        if ($atRuleNamespaceAllowed === false) {
                            $atRule->setIsValid(false);
                            $atRule->addValidationError(
                                "Ignored @namespace rule, because at wrong position in style sheet."
                            );
                        }
                        $atRuleCharsetAllowed = false;
                        $atRuleImportAllowed = false;
                    } else {
                        $atRuleCharsetAllowed = false;
                        $atRuleImportAllowed = false;
                        $atRuleNamespaceAllowed = false;
                    }

                    $lastRuleContainers[$ruleCount-1]->addRule($atRule);
                    if ($atRule instanceof AtRuleConditionalAbstract) {
                        $lastRuleContainers[$ruleCount] = $atRule;
                    } elseif ($atRule instanceof KeyframesRule) {
                        $lastRuleContainers[$ruleCount] = $atRule;
                    } elseif ($atRule instanceof FontFaceRule) {
                        $lastRuleContainers[$ruleCount] = $atRule;
                        $lastRuleSet = $atRule;
                    } elseif ($atRule instanceof PageRule) {
                        $lastRuleContainers[$ruleCount] = $atRule;
                        $lastRuleSet = $atRule;
                    }
                // Not all at-rules contain other rule, e.g. in @page rules the rules are mixed with the
                // at-rule, so they directly contain declarations - this is filtered by checking for the
                // HasRulesInterface here.
                } elseif ($blockCount === $ruleCount && $lastRuleContainers[$ruleCount] instanceof HasRulesInterface) {
                    // New rule set opened
                    if ($lastRuleContainers[$ruleCount] instanceof KeyframesRule) {
                        $ruleSet = new KeyframesRuleSet($line, $this->styleSheet);
                    } else {
                        $ruleSet = new StyleRuleSet($line, $this->styleSheet);
                    }
                    if ($comment !== null) {
                        $ruleSet->addComment($comment);
                        $comment = null;
                    }
                    $lastRuleContainers[$ruleCount]->addRule($ruleSet);
                    $lastRuleSet = $ruleSet;
                    $atRuleCharsetAllowed = false;
                } elseif ($blockCount >= $ruleCount) {
                    // New declaration
                    if ($lastRuleSet !== null) {
                        $line = preg_replace('/[\s;]+$/', '', $line);

                        $invalidDeclaration = false;
                        if (strpos($line, ":") === false) {
                            $property = $line;
                            $value = "";
                            $invalidDeclaration = true;
                        } else {
                            list($property, $value) = explode(":", $line, 2);
                        }

                        $declaration = null;
                        if ($lastRuleContainers[$ruleCount] instanceof StyleSheet) {
                            $declaration = new StyleDeclaration($property, $value, $this->styleSheet);
                        } elseif ($lastRuleContainers[$ruleCount] instanceof AtRuleConditionalAbstract) {
                            $declaration = new StyleDeclaration($property, $value, $this->styleSheet);
                        } elseif ($lastRuleContainers[$ruleCount] instanceof KeyframesRule) {
                            $declaration = new KeyframesDeclaration($property, $value, $this->styleSheet);
                        } elseif ($lastRuleContainers[$ruleCount] instanceof FontFaceRule) {
                            $declaration = new FontFaceDeclaration($property, $value, $this->styleSheet);
                        } elseif ($lastRuleContainers[$ruleCount] instanceof PageRule) {
                            $declaration = new PageDeclaration($property, $value, $this->styleSheet);
                        }

                        if ($declaration !== null) {
                            if ($comment !== null) {
                                $declaration->addComment($comment);
                                $comment = null;
                            }
                            if ($invalidDeclaration === true) {
                                $declaration->setIsValid(false);
                                $declaration->addValidationError("Parse error. Invalid declaration at '$line'.");
                            }
                            $lastRuleSet->addDeclaration($declaration);
                        }
                    }
                    $atRuleCharsetAllowed = false;
                }
            }
        }
    }
568320
public function html()
    {
        return $this->setName('Rules List')
                        ->addColumn(['data' => 'id', 'name' => 'id', 'title' => trans('antares/ban_management::datagrid.header.id')])
                        ->addColumn(['data' => 'value', 'name' => 'value', 'title' => trans('antares/ban_management::datagrid.header.value'), 'className' => 'bolded'])
                        ->addColumn(['data' => 'user_id', 'name' => 'user_id', 'title' => trans('antares/ban_management::datagrid.header.author')])
                        ->addColumn(['data' => 'status', 'name' => 'status', 'title' => trans('antares/ban_management::datagrid.header.status')])
                        ->addColumn(['data' => 'internal_reason', 'name' => 'internal_reason', 'title' => trans('antares/ban_management::datagrid.header.note')])
                        ->addColumn(['data' => 'trusted', 'name' => 'trusted', 'title' => trans('antares/ban_management::datagrid.header.trusted')])
                        ->addColumn(['data' => 'enabled', 'name' => 'enabled', 'title' => trans('antares/ban_management::datagrid.header.enabled')])
                        ->addColumn(['data' => 'created_at', 'name' => 'created_at', 'title' => trans('antares/ban_management::datagrid.header.created_at')])
                        ->addColumn(['data' => 'expired_at', 'name' => 'expired_at', 'title' => trans('antares/ban_management::datagrid.header.expired_at')])
                        ->addAction(['name' => 'edit', 'title' => '', 'class' => 'mass-actions dt-actions'])
                        ->setDeferedData()
                        ->addGroupSelect($this->statuses(), 3, 'active', [
                            'data-prefix'            => '',
                            'data-selectAR--mdl-big' => "true",
                            'data-column'            => 3,
                            'class'                  => 'ban_management-select-status mr24 select2--prefix',
        ]);
    }
61817
public String htmlHeader(CmsHtmlList list) {

        String listId = list.getId();
        String sortedCol = list.getSortedColumn();
        CmsListOrderEnum order = list.getCurrentSortOrder();

        StringBuffer html = new StringBuffer(512);
        Locale locale = getWp().getLocale();
        CmsMessages messages = Messages.get().getBundle(locale);
        html.append("<th");
        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(getWidth())) {
            html.append(" width='");
            html.append(getWidth());
            html.append("'");
        }
        if (!isTextWrapping()) {
            html.append(" style='white-space: nowrap;'");
        }
        html.append(">\n");

        boolean isSorted = getId().equals(sortedCol);
        CmsListOrderEnum nextOrder = CmsListOrderEnum.ORDER_ASCENDING;
        if (isSorted && (order == CmsListOrderEnum.ORDER_ASCENDING)) {
            nextOrder = CmsListOrderEnum.ORDER_DESCENDING;
        }
        // button
        String id = listId + getId() + "Sort";
        String onClic = "listSort('" + listId + "', '" + getId() + "');";
        String helpText = null;
        if (m_helpText != null) {
            helpText = new MessageFormat(m_helpText.key(locale), locale).format(new Object[] {getName().key(locale)});
        } else {
            if (isSorteable()) {
                if (nextOrder.equals(CmsListOrderEnum.ORDER_ASCENDING)) {
                    helpText = messages.key(Messages.GUI_LIST_COLUMN_ASC_SORT_1, new Object[] {getName().key(locale)});
                } else {
                    helpText = messages.key(Messages.GUI_LIST_COLUMN_DESC_SORT_1, new Object[] {getName().key(locale)});
                }
            } else {
                helpText = messages.key(Messages.GUI_LIST_COLUMN_NO_SORT_1, new Object[] {getName().key(locale)});
            }
        }
        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(getWidth()) && (getWidth().indexOf('%') < 0)) {
            html.append("\t<div style='display:block; width: ");
            html.append(getWidth());
            html.append("px;'>\n");
        }
        String sortArrow = "";
        // sort order marker
        if (isSorted) {
            if (nextOrder == CmsListOrderEnum.ORDER_ASCENDING) {
                sortArrow = "<img src='" + CmsWorkplace.getSkinUri() + ICON_DOWN + "' alt=''>&nbsp;";
            } else {
                sortArrow = "<img src='" + CmsWorkplace.getSkinUri() + ICON_UP + "' alt=''>&nbsp;";
            }
        }
        html.append(
            A_CmsHtmlIconButton.defaultButtonHtml(
                CmsHtmlIconButtonStyleEnum.SMALL_ICON_TEXT,
                id,
                id,
                getName().key(locale),
                helpText,
                list.isPrintable() ? false : isSorteable(),
                null,
                null,
                onClic,
                false,
                sortArrow));
        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(getWidth()) && (getWidth().indexOf('%') < 0)) {
            html.append("\t</div>\n");
        }
        html.append("</th>\n");
        return html.toString();
    }
902547
protected function _styleElement()
    {
        $styleElementConfig = $this->gridConfig['styleElement'] ?? NULL;

        if( ! empty($styleElementConfig) )
        {
            $attributes = NULL;

            $sheet = Singleton::class('ZN\Hypertext\Sheet');
            $style = Singleton::class('ZN\Hypertext\Style');

            foreach( $styleElementConfig as $selector => $attr )
            {
                $attributes .= $sheet->selector($selector)->attr($attr)->create();
            }

            return $style->open().$attributes.$style->close();
        }

        return NULL;
    }
515873
public function render()
    {
        $changes = parent::render();
        $html = '';
        if (empty($changes)) {
            return $html;
        }

        $html .= '<table class="Differences DifferencesInline">';
        $html .= '<thead>';
        $html .= '<tr>';
        $html .= '<th>Old</th>';
        $html .= '<th>New</th>';
        $html .= '<th>Differences</th>';
        $html .= '</tr>';
        $html .= '</thead>';
        foreach ($changes as $i => $blocks) {
            // If this is a separate block, we're condensing code so output ...,
            // indicating a significant portion of the code has been collapsed as
            // it is the same
            if ($i > 0) {
                $html .= '<tbody class="Skipped">';
                $html .= '<th>&hellip;</th>';
                $html .= '<th>&hellip;</th>';
                $html .= '<td>&nbsp;</td>';
                $html .= '</tbody>';
            }

            foreach ($blocks as $change) {
                $html .= '<tbody class="Change' . ucfirst($change['tag']) . '">';
                // Equal changes should be shown on both sides of the diff
                if ($change['tag'] == 'equal') {
                    foreach ($change['base']['lines'] as $no => $line) {
                        $fromLine = $change['base']['offset'] + $no + 1;
                        $toLine = $change['changed']['offset'] + $no + 1;
                        $html .= '<tr>';
                        $html .= '<th>' . $fromLine . '</th>';
                        $html .= '<th>' . $toLine . '</th>';
                        $html .= '<td class="Left">' . $line . '</td>';
                        $html .= '</tr>';
                    }
                } // Added lines only on the right side
                else {
                    if ($change['tag'] == 'insert') {
                        foreach ($change['changed']['lines'] as $no => $line) {
                            $toLine = $change['changed']['offset'] + $no + 1;
                            $html .= '<tr>';
                            $html .= '<th>&nbsp;</th>';
                            $html .= '<th>' . $toLine . '</th>';
                            $html .= '<td class="Right"><ins>' . $line . '</ins>&nbsp;</td>';
                            $html .= '</tr>';
                        }
                    } // Show deleted lines only on the left side
                    else {
                        if ($change['tag'] == 'delete') {
                            foreach ($change['base']['lines'] as $no => $line) {
                                $fromLine = $change['base']['offset'] + $no + 1;
                                $html .= '<tr>';
                                $html .= '<th>' . $fromLine . '</th>';
                                $html .= '<th>&nbsp;</th>';
                                $html .= '<td class="Left"><del>' . $line . '</del>&nbsp;</td>';
                                $html .= '</tr>';
                            }
                        } // Show modified lines on both sides
                        else {
                            if ($change['tag'] == 'replace') {
                                foreach ($change['base']['lines'] as $no => $line) {
                                    $fromLine = $change['base']['offset'] + $no + 1;
                                    $html .= '<tr>';
                                    $html .= '<th>' . $fromLine . '</th>';
                                    $html .= '<th>&nbsp;</th>';
                                    $html .= '<td class="Left"><span>' . $line . '</span></td>';
                                    $html .= '</tr>';
                                }

                                foreach ($change['changed']['lines'] as $no => $line) {
                                    $toLine = $change['changed']['offset'] + $no + 1;
                                    $html .= '<tr>';
                                    $html .= '<th>' . $toLine . '</th>';
                                    $html .= '<th>&nbsp;</th>';
                                    $html .= '<td class="Right"><span>' . $line . '</span></td>';
                                    $html .= '</tr>';
                                }
                            }
                        }
                    }
                }
                $html .= '</tbody>';
            }
        }
        $html .= '</table>';
        return $html;
    }
312906
public final Set<String> getAsHTMLClassSet() {
		Set<String> htmlClasses = new HashSet<>();
		final String htmlClassPrefix = "wc-margin-";
		final String topClassModifier = "n-";
		final String rightClassModifier = "e-";
		final String bottomClassModifier = "s-";
		final String leftClassModifier = "w-";

		Size current = getTop();
		if (current != null) {
			htmlClasses.add(htmlClassPrefix.concat(topClassModifier).concat(current.toString()));
		}
		current = getRight();
		if (current != null) {
			htmlClasses.add(htmlClassPrefix.concat(rightClassModifier).concat(current.toString()));
		}
		current = getBottom();
		if (current != null) {
			htmlClasses.add(htmlClassPrefix.concat(bottomClassModifier).concat(current.toString()));
		}
		current = getLeft();
		if (current != null) {
			htmlClasses.add(htmlClassPrefix.concat(leftClassModifier).concat(current.toString()));
		}

		if (htmlClasses.isEmpty()) {
			return null;
		}
		return htmlClasses;
	}