display per session status clean up
parent
9cf0cbfbe4
commit
bc6fc33592
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class DocTools
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function write($task, $path, $fileLocation, $fileContents)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
if ($task == "create") {
|
||||||
|
if (!is_dir("../content/pages/" . $path)) {
|
||||||
|
//Directory does not exist, so lets create it.
|
||||||
|
mkdir("../content/pages/" . $path, 0755, true);
|
||||||
|
}
|
||||||
|
file_put_contents($fileLocation, $fileContents);
|
||||||
|
} else {
|
||||||
|
($new = fopen($fileLocation, "w")) or die("Unable to open file!");
|
||||||
|
fwrite($new, $fileContents);
|
||||||
|
fclose($new);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} catch (Error $error) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue