示例#1
0
 /**
  * Open config file
  */
 protected function loadConfigFile()
 {
     $config = Spyc::YAMLLoad(__APP__ . '/config.yml');
     $this->merge($config['logics']);
     $this->events = $config['events'];
     $this->errors = $config['errors'];
 }
示例#2
0
<?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();
示例#3
0
文件: Album.php 项目: myeti/pictobox
 /**
  * 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;
 }