/** * Open config file */ protected function loadConfigFile() { $config = Spyc::YAMLLoad(__APP__ . '/config.yml'); $this->merge($config['logics']); $this->events = $config['events']; $this->errors = $config['errors']; }
<?php ini_set('memory_limit', '512M'); define('__ROOT__', dirname(__DIR__)); define('__APP__', __DIR__); require __ROOT__ . '/vendor/autoload.php'; require __ROOT__ . '/files/config.php'; /** * App constants */ define('CACHE_URL', '/img/cache/'); define('CACHE_DIR', __ROOT__ . '/public/img/cache/'); /** * Load lang */ use Colorium\Text; use Pictobox\Service\Spyc; Text\Lang::load(['fr' => Spyc::YAMLLoad(__DIR__ . '/langs/french.yml')]); /** * Database setup */ use Colorium\Orm; use Pictobox\Model\User; $sqlite = new Orm\SQLite(DB_FILE, ['user' => User::class]); Orm\Hub::source($sqlite); /** * Pictobox instance */ $app = new Pictobox\Instance();
/** * Edit meta data * * @param array $meta * @param bool $replace * @return bool */ public function edit(array $meta, $replace = false) { // delete file $metafile = $this->path . DIRECTORY_SEPARATOR . 'meta.yml'; if (!$meta and $replace and file_exists($metafile)) { return unlink($metafile); } elseif ($meta) { if (!$replace) { $meta += $this->meta(); } foreach ($meta as $key => $value) { $meta[$key] = strip_tags($value); } $yaml = Spyc::YAMLDump($meta); return (bool) file_put_contents($metafile, $yaml); } return true; }