Error : $errstr
in file '$errfile' (line '$errline').
ErrCode : $errno HTML; return true; }); class App { /** * plugins path in vendor * @var string */ public const PLUGINS_PATH = 'vendor/picocms/plugins/'; /** * themes path in vendor * @var string */ public const THEMES_PATH = 'vendor/picocms/themes/'; /** * 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 self::PLUGINS_PATH, // plugins dir self::THEMES_PATH // themes dir ); } public function runPico(): string { if (!empty($GLOBALS['PicoVendorsDirectoryRelativeLevels']) && intval($GLOBALS['PicoVendorsDirectoryRelativeLevels']) > 0){ $previous = implode('',array_fill(0,intval($GLOBALS['PicoVendorsDirectoryRelativeLevels']),'../')); $this->pico->setConfig([ 'themes_url' => $previous.self::THEMES_PATH, 'plugins_url' => $previous.self::PLUGINS_PATH ]); } 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; } } } }