pupupu

simple static CMS for crappy servers
git clone https://git.ce9e.org/pupupu.git

commit
0499ac65085605c1c78529e4e5535316d396d3de
parent
83037a49ff3425cf5c46baf1a256750eb0303f5b
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2018-10-19 07:07
enforce unix line endings

Diffstat

M index.php 10 ++++++++--

1 files changed, 8 insertions, 2 deletions


diff --git a/index.php b/index.php

@@ -30,6 +30,12 @@ function mkdirp($path)
   30    30     }
   31    31 }
   32    32 
   -1    33 function _file_put_contents($path, $content)
   -1    34 {
   -1    35     $normalized = preg_replace("/\r\n/", "\n", $content);
   -1    36     file_put_contents($path, $normalized);
   -1    37 }
   -1    38 
   33    39 function shiftHeadings($html, $offset)
   34    40 {
   35    41     return preg_replace_callback('|(</?h)([1-6])([ >])|', function ($match) use ($offset) {
@@ -117,7 +123,7 @@ class Pupupu
  117   123     {
  118   124         $p = $this->getSrc($path, $ext);
  119   125         mkdirp(dirname($p));
  120    -1         file_put_contents($p, $content);
   -1   126         _file_put_contents($p, $content);
  121   127     }
  122   128 
  123   129     public function rm($path)
@@ -209,7 +215,7 @@ class Pupupu
  209   215 
  210   216         $target = $this->getTarget($path);
  211   217         mkdirp(dirname($target));
  212    -1         file_put_contents($target, $html);
   -1   218         _file_put_contents($target, $html);
  213   219     }
  214   220 
  215   221     public function renderAll($verbose=false, $path='')