コード例 #1
0
ファイル: Index.php プロジェクト: cawaphp/sample-app
 /**
  * @param null $name
  *
  * @return string
  */
 public function method($name = null)
 {
     /*
     if (!$ip = Ip::sessionReload("IP")) {
         $ip = Ip::getById(12);
         $ip->sessionSave("IP");
     }
     */
     $list = Ip::getAll();
     $find = $list->find('getCountry', 'JP');
     $cache = Cache::create(["type" => "Apc", "prefix" => "bla", "config" => "redis://*****:*****@doe.com' => 'John Doe'))->setTo(array('*****@*****.**'))->setHtmlBody("sdfsdf");
     // $message->send();
     $http = new Client();
     $http->get("http://www.google.com");
     // $this->app->response->redirect("/");
     $container = new HtmlContainer('<div>');
     $html = new HtmlElement('<a>');
     $html->setContent('Click me')->addClass(array('btn', 'btn-primary'));
     $container->add($html);
     $html = new HtmlElement('<a>');
     $html->setContent('Click now')->addClass(array('btn', 'btn-default'));
     $container->add($html);
     $this->data['main'] = $container->render();
     $this->data['plural'] = DateTime::now()->diffForHumans(DateTime::parse('-1 day')) . '<br />' . DateTime::now()->formatLocalized('%A %d %B %Y') . '<br />' . App::translator()->transChoice('transChoice', 10, [10]) . '<br />' . App::translator()->transChoice('transChoice', 1, [1]);
     $page = new MasterPage();
     $page->setMain($this->render())->setAside('ASIDE FROM ' . get_class() . ' with name ' . $name)->addCss('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css');
     return $page->render();
 }
コード例 #2
0
ファイル: DateTime.php プロジェクト: cawaphp/cawa
 /**
  * @param string|array $type
  *
  * @return string
  */
 public function display($type = null) : string
 {
     if ($type == self::DISPLAY_DURATION) {
         return $this->diffForHumans(DateTime::now(), true);
     }
     if (is_null($type)) {
         $type = [self::DISPLAY_SHORT, self::DISPLAY_SHORT];
     } elseif (!is_array($type)) {
         $type = [$type, $type];
     } elseif (is_array($type)) {
         if (!isset($type[1])) {
             return Calendar::formatDate($this, $type[0]);
         } elseif (is_null($type[0])) {
             return Calendar::formatTime($this, $type[1]);
         }
     }
     return Calendar::formatDatetime($this, implode('|', $type));
 }