From a91c916248f967da2d4218b575e665242b7c975b Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Thu, 25 Oct 2018 20:25:05 +0200 Subject: phoenixreborn\'NWY --- public/test.php | 185 +++----------------------------------------------------- 1 file changed, 9 insertions(+), 176 deletions(-) (limited to 'public/test.php') diff --git a/public/test.php b/public/test.php index aee0004..0544502 100644 --- a/public/test.php +++ b/public/test.php @@ -1,186 +1,19 @@ 'cool', 'redirect' => 'edit']; -require('../w/class/class.w.quickcss.php'); +require('../w/class/route.php'); -$quick = new Quickcss; +$route = new Route($data); +var_dump($route); +var_dump($route->toarray()); +var_dump($route->tostring()); -var_dump($quick); +$array = []; +var_dump(implode(' ', $array)); - -$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($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; - } - } -} - - -$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. - -If a value has several occurrences, the latest key will be used as its value, and all others will be lost. -

- - -
\ No newline at end of file +?> \ No newline at end of file -- cgit v1.2.3