Exemplo n.º 1
0
<?php

$html2css = new html2css();
$generated_css = '';
$html_posted = '';
$options = array();
if (!empty($_POST) && isset($_POST['html'])) {
    if (isset($_POST['options']) && is_array($_POST['options'])) {
        $options = $_POST['options'];
    }
    $html2css->setOptions($options);
    $html_posted = trim($_POST['html']);
    if (!empty($html_posted)) {
        $html2css->parse_html($html_posted);
        $generated_css = $html2css->generateCSS();
        if (isset($_POST['api'])) {
            exit($generated_css);
        }
    }
}
Exemplo n.º 2
0
 function testExpandedLayout()
 {
     $html2css = new html2css(false);
     $html2css->setOptions(array('css_format' => 'expanded'));
     $html2css->parse_html('<p class="test">az</p>');
     $this->assertEquals(".test {\n\n}", $html2css->generateCSS());
 }