Error : $errstr
in file '$errfile' (line '$errline').
ErrCode : $errno HTML; return true; }); class App { /** * Pico instance. * @var Pico */ protected $pico; public function __construct(string $contentFolderFromRoot) { // sanitize content folder $cwd = getcwd(); if (empty($contentFolderFromRoot)){ $contentFolderFromRoot = 'content'; } else { $contentFolderFromRoot = str_replace('\\','/',$contentFolderFromRoot); } if (!is_dir($cwd)){ throw new Exception("getcwd returned a path that is not a directory !"); } if (!is_dir("$cwd/$contentFolderFromRoot")){ $contentFolderFromRoot = 'vendor/picocms/pico/content-sample'; } if (substr($contentFolderFromRoot,-1) !== '/'){ $contentFolderFromRoot .= '/'; } // instance Pico $this->pico = new Pico( $cwd, // root dir $contentFolderFromRoot, // config dir 'vendor/picocms/plugins/', // plugins dir 'vendor/picocms/themes/' // themes dir ); } public function runPico(): string { return $this->pico->run(); } /** * instanciate Pico and run it then echo output * @param string $contentFolderFromRoot where is the root folder */ public static function run(string $contentFolderFromRoot) { try { $app = new App($contentFolderFromRoot); $output = $app->runPico(); self::appendErrorMessagesIfNeeded($output); } catch (Throwable $th) { $output = << Exception : {$th->__toString()} HTML; } finally { echo $output; } } /** * append error messages from $GLOBALS['errorMessages'] * only if $_GET['debug'] === 'yes' * @param string &$output */ protected static function appendErrorMessagesIfNeeded(string &$output) { if (!empty($_GET['debug']) && $_GET['debug'] === 'yes' && !empty($GLOBALS['errorMessages'])){ $formattedMessages = implode("\n", $GLOBALS['errorMessages']); $formattedMessages = << $formattedMessages HTML; if (preg_match('/<\/body>/i', $output, $match)) { $output = str_replace($match[0], $formattedMessages.$match[0], $output); } else { $output = $output.$formattedMessages; } } } }