From 65796d4a2349e71ca05f5f298d6f94ff792d88b2 Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Fri, 12 Oct 2018 11:36:05 +0200 Subject: 2.91 folder moves + auto summary --- fn/fn.php | 143 ----------------------------------------------- fn/fn.w.php | 180 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 180 insertions(+), 143 deletions(-) delete mode 100644 fn/fn.php create mode 100644 fn/fn.w.php (limited to 'fn') diff --git a/fn/fn.php b/fn/fn.php deleted file mode 100644 index 841b065..0000000 --- a/fn/fn.php +++ /dev/null @@ -1,143 +0,0 @@ -getMessage()); - } - return $bdd; -} - -function my_autoloader($class) -{ - require('../../class/class.w.' . strtolower($class) . '.php'); -} - -function secure() -{ - if (!isset($_SESSION['id'])) { - header("location: ./"); - } -} - -function head($title) -{ - ?> - - - - - <?= $title ?> - - y > 1) return $str . $diff->y . ' years'; - if ($diff->y == 1) return $str . ' 1 year and ' . $diff->m . ' months'; - if ($diff->m > 1) return $str . $diff->m . ' months'; - if ($diff->m == 1) return $str . ' 1 month and ' . $diff->d . ($diff->d > 1 ? ' days' : ' day'); - if ($diff->d > 1) return $str . $diff->d . ' days'; - if ($diff->d == 1) return $str . ' 1 day and ' . $diff->h . ($diff->h > 1 ? ' hours' : ' hour'); - if ($diff->h > 1) return $str . $diff->h . ' hours'; - if ($diff->h == 1) return $str . ' 1 hour and ' . $diff->i . ($diff->i > 1 ? ' minutes' : ' minute'); - if ($diff->i > 1) return $str . $diff->i . ' minutes'; - if ($diff->i == 1) return $str . ' 1 minute'; - return $str . ' a few secondes'; -} - - - -function arrayclean($input) -{ - $output = []; - foreach ($input as $key => $value) { - if (is_array($value)) { - $output[$key] = array_filter($value); - } else { - $output[$key] = $value; - } - } - return $output; -} - - - - -function array_update($base, $new) -{ - foreach ($base as $key => $value) { - if (array_key_exists($key, $new)) { - if (gettype($base[$key]) == gettype($new[$key])) { - $base[$key] = $new[$key]; - } - } - } - return $base; -} - -function contains($needle, $haystack) -{ - return strpos($haystack, $needle) !== false; -} - - -function str_clean(string $string) -{ - return str_replace(' ', '_', strtolower(strip_tags($string))); -} - - -?> \ No newline at end of file diff --git a/fn/fn.w.php b/fn/fn.w.php new file mode 100644 index 0000000..6f63a07 --- /dev/null +++ b/fn/fn.w.php @@ -0,0 +1,180 @@ +getMessage()); + } + return $bdd; +} + +function my_autoloader($class) +{ + require('../../class/class.w.' . strtolower($class) . '.php'); +} + +function secure() +{ + if (!isset($_SESSION['id'])) { + header("location: ./"); + } +} + +function head($title) +{ + ?> + + + + + <?= $title ?> + + y > 1) return $str . $diff->y . ' years'; + if ($diff->y == 1) return $str . ' 1 year and ' . $diff->m . ' months'; + if ($diff->m > 1) return $str . $diff->m . ' months'; + if ($diff->m == 1) return $str . ' 1 month and ' . $diff->d . ($diff->d > 1 ? ' days' : ' day'); + if ($diff->d > 1) return $str . $diff->d . ' days'; + if ($diff->d == 1) return $str . ' 1 day and ' . $diff->h . ($diff->h > 1 ? ' hours' : ' hour'); + if ($diff->h > 1) return $str . $diff->h . ' hours'; + if ($diff->h == 1) return $str . ' 1 hour and ' . $diff->i . ($diff->i > 1 ? ' minutes' : ' minute'); + if ($diff->i > 1) return $str . $diff->i . ' minutes'; + if ($diff->i == 1) return $str . ' 1 minute'; + return $str . ' a few secondes'; +} + + + +function arrayclean($input) +{ + $output = []; + foreach ($input as $key => $value) { + if (is_array($value)) { + $output[$key] = array_filter($value); + } else { + $output[$key] = $value; + } + } + return $output; +} + + + + +function array_update($base, $new) +{ + foreach ($base as $key => $value) { + if (array_key_exists($key, $new)) { + if (gettype($base[$key]) == gettype($new[$key])) { + $base[$key] = $new[$key]; + } + } + } + return $base; +} + +function contains($needle, $haystack) +{ + return strpos($haystack, $needle) !== false; +} + + +function str_clean(string $string) +{ + return str_replace(' ', '_', strtolower(strip_tags($string))); +} + +function sumparser($text) +{ + preg_match_all('#(.+)#iU', $text, $out); + + + $sum = []; + foreach ($out[2] as $key => $value) { + $sum[$value][$out[1][$key]] = $out[3][$key]; + } + + + $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; + } + } + for ($i = 1; $i <= ($last); $i++) { + $sumstring .= ''; + } + return $sumstring; +} + + +?> \ No newline at end of file -- cgit v1.2.3