From 7b2e48276b2a3ceff83c906d38077f8d0479c3df Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Thu, 18 Oct 2018 01:08:46 +0200 Subject: 2.92 new architecture + quickcss class --- public/test.php | 277 +++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 172 insertions(+), 105 deletions(-) (limited to 'public/test.php') diff --git a/public/test.php b/public/test.php index 6e5e835..aee0004 100644 --- a/public/test.php +++ b/public/test.php @@ -1,119 +1,186 @@ tiTre2:laguerre dqs fdddddddfdfdsfs fdsfdksdfjnsdjkhsf lkfljkfhjldshsf fsdf -fdgfgdfgdfgdsggggggggggggg -dfgdsfgdh -dh - -gh -g -hg -fhhhhhhhhhhhhhhhhhhgfghfghfgh -

-fhfgfgdfgdfgdsggggggggggggg -dfgdsfgdh

-dh
dh
dh
dh
dh
dh
dh
dh
dh
- -gh

-g -hg

-fhhhhhhhhhhhhhhhhhhgfghfghfgh -gh -g -hg -fhhhhhhhhhhhhhhhhhhgfghfghfgh -

-fhfgfgdfgdfgdsggggggggggggg -dfgdsfgdh

-dh
dh
dh
dh
dh
dh
dh
dh
dh
- -gh

-g -hg

-fhhhhhhhhhhhhhhhhhhgfghfghfgh -gh -

YOLO

-

PROUT

-

LOLDELAMORT

-hg -fhhhhhhhhhhhhhhhhhhgfghfghfgh - -

-fhfgfgdfgdfgdsggggggggggggg -dfgdsfgdh

-dh
dh
dh
dh
dh
dh
dh
dh
dh
- -gh

-g -hg

-fhhhhhhhhhhhhhhhhhhgfghfghfgh - -fhf -g -hffffgggggggggggggggggggggggggggggggggggggdsf

titre 3- les hommes

la fin'; - - -function sumparser($text) -{ - preg_match_all('#(.+)#iU', $text, $out); - - var_dump($out); - - $sum = []; - foreach ($out[2] as $key => $value) { - $sum[$value][$out[1][$key]] = $out[3][$key]; + + +require('../w/class/class.w.quickcss.php'); + +$quick = new Quickcss; + + + +var_dump($quick); + + + + +$color = ['color', 'background-color', 'border-color']; +$size = ['width', 'height', 'margin', 'padding', 'border-width']; +$font = ['font-size']; +$unique = ['background-image', 'opacity', 'border-style', 'text-align']; +$params = array_merge($color, $size, $font, $unique); + + + + + + +// $presets = ['body' => ['font-size' => 'px']]; +// $quickcss = ['section' => ['color' => '#a74545', 'font-size' => '32px'], 'p' => ['background-color' => '#458da7', 'width' => '7px']]; + +$presets = []; +$quickcss = []; + +if (isset($_POST['quickcss'])) { + $quickcss = $_POST['quickcss']; +} + +if (isset($_POST['presets'])) { + $presets = $_POST['presets']; +} + + +if (isset($_POST['active'])) { + $active = $_POST['active']; + echo '

active

'; + var_dump($active); + $intersect = array_intersect_key($quickcss, $active); + + foreach ($intersect as $element => $css) { + $intersect[$element] = array_intersect_key($quickcss[$element], $active[$element]); } + + echo '

intersect

'; + var_dump($intersect); + + $quickcss = $intersect; + + +} + + +if (!empty($_POST['new']['element']) && !empty($_POST['new']['param']) && in_array($_POST['new']['param'], $params)) { + $new = array($_POST['new']['element'] => array($_POST['new']['param'] => '')); + var_dump($new); + + $quickcss = array_merge_recursive($quickcss, $new); +} + + + + +echo '

quickcss

'; + +var_dump($quickcss); + +echo '

presets

'; - var_dump($sum); - - $sumstring = ''; - $last = 0; - foreach ($sum as $title => $list) { - foreach ($list as $h => $link) { - if($h > $last) { - for ($i = 1; $i <= ($h - $last); $i++) { - $sumstring .= ''; - } - $sumstring .= '
  • '.$link.'
  • ' ; - } elseif ($h = $last) { - $sumstring .= '
  • '.$link.'
  • ' ; - } - $last = $h; +var_dump($presets); + +foreach ($presets as $element => $preset) { + foreach ($preset as $param => $unit) { + if (array_key_exists($element, $quickcss) && array_key_exists($param, $quickcss[$element])) { + $quickcss[$element][$param] .= $unit; } } - for ($i = 1; $i <= ($last); $i++) { - $sumstring .= ''; +} + + +$jsonquickcss = json_encode($quickcss); + +var_dump($jsonquickcss); + +$string = ''; +foreach ($quickcss as $key => $css) { + $string .= PHP_EOL . $key . ' {'; + foreach ($css as $param => $value) { + + $string .= PHP_EOL . ' ' . $param . ': ' . $value . ';'; + + } + $string .= PHP_EOL . '}' . PHP_EOL; +} + +var_dump($string); + + + + +echo '
    '; + +foreach ($quickcss as $element => $css) { + echo '

    ' . $element . '

    '; + foreach ($css as $param => $value) { + + echo ''; + + if (in_array($param, $color)) { + echo ''; + echo ''; + } + + if (in_array($param, $size)) { + echo ''; + echo ''; + + $unit = preg_replace('/\d/', '', $quickcss[$element][$param]); + ?> + + ' . $param . ''; + echo ''; + + $unit = preg_replace('/\d/', '', $quickcss[$element][$param]); + ?> + + Add element'; + +echo ''; +echo ''; + +echo '
    '; + +echo '
    '; + +?> + + + + + +
    +

    Yolo babyzesssssss

    +

    + Note that the values of array need to be valid keys, i.e. they need to be either integer or string. A warning will be emitted if a value has the wrong type, and the key/value pair in question will not be included in the result. -echo $sumstring; +If a value has several occurrences, the latest key will be used as its value, and all others will be lost. +

    -echo $text.'
    '; \ No newline at end of file +
    \ No newline at end of file -- cgit v1.2.3