示例#1
0
 /**
  * コンテナを追加
  *
  * @param Object $container コンテナオブジェクト
  * @return void
  */
 private function setContainer($container)
 {
     $container['db.get'] = function ($c) {
         $obj = new Get($this->pdo);
         $obj->setDebug(true);
         return $obj;
     };
     $container['db.post'] = function ($c) {
         $obj = new Post($this->pdo);
         $obj->setDebug(true);
         return $obj;
     };
     $container['db.put'] = function ($c) {
         $obj = new Put($this->pdo);
         $obj->setDebug(true);
         return $obj;
     };
     $container['db.delete'] = function ($c) {
         $obj = new Delete($this->pdo);
         $obj->setDebug(true);
         return $obj;
     };
     $container['mailer'] = function ($c) {
         $transport = new Init($GLOBALS['MAIL_HOST'], $GLOBALS['MAIL_PORT'], $GLOBALS['MAIL_USER'], $GLOBALS['MAIL_PASS']);
         $mailer = new Mailer($transport);
         $mailer->setFrom($GLOBALS['MAIL_FROM']);
         $mailer->setName($GLOBALS['MAIL_NAME']);
         return $mailer;
     };
     $container['image.original'] = function ($c) {
         $original = new Original();
         $original->setDestination = './';
         $original->setFilename = 'test';
         $original->setCompress = 0;
         $original->setImageType = 'png';
         return $original;
     };
     $container['image.thumbnail'] = function ($c) {
         $thumbnail = new Thumbnail();
         $thumbnail->setDestination = './';
         $thumbnail->setFilename = 'test';
         $thumbnail->setPostfix = '_s';
         $thumbnail->setCompress = 70;
         $thumbnail->setWidth = '200';
         $thumbnail->setHeight = '200';
         $thumbnail->setImageType = 'jpg';
         return $thumbnail;
     };
 }
示例#2
0
    $obj = new Post($pdo);
    $obj->setDebug($c->get('settings')['debug_mode']);
    return $obj;
};
// PUT
$container['db.put'] = function ($c) {
    $pdo = $c->get('db.pdo');
    $obj = new Put($pdo);
    $obj->setDebug($c->get('settings')['debug_mode']);
    return $obj;
};
// DELETE
$container['db.delete'] = function ($c) {
    $pdo = $c->get('db.pdo');
    $obj = new Delete($pdo);
    $obj->setDebug($c->get('settings')['debug_mode']);
    return $obj;
};
/**
 * Swift Mailer
 *
 * [ e.g. ]
 * $mailer = $this->get('mailer.text');
 * $twig = $this->get('mailer.twig');
 *
 * // テンプレート内で変数を使う場合は第二引数に
 * // array('name' => 'taro)などを追加する
 * $body = $twig('users.twig');
 *
 * $mailer->setAttachment(
 *     '../upload/' . $filename . '_s.jpg',