本文整理汇总了PHP中valid::year方法的典型用法代码示例。如果您正苦于以下问题:PHP valid::year方法的具体用法?PHP valid::year怎么用?PHP valid::year使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类valid
的用法示例。
在下文中一共展示了valid::year方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: day
public function day($tool_id, $date)
{
if (empty($date)) {
Event::run('system.404');
}
$date = explode('-', $date);
# strictly need the formated date, else throw page not found.
if (3 != count($date)) {
Event::run('system.404');
}
list($year, $month, $day) = $date;
valid::year($year);
valid::month($month);
valid::day($day);
$events = ORM::factory('calendar_item')->where(array('fk_site' => $this->site_id, 'calendar_id' => $tool_id, 'year' => $year, 'month' => $month, 'day' => $day))->find_all();
$primary = new View('public_calendar/small/day');
$primary->events = $events;
$primary->date = "{$year} {$month} {$day}";
$primary->logged_in = $this->client->can_edit($this->site_id) ? TRUE : FALSE;
return $primary;
}
示例2: show_archive
private function show_archive($tool_id, $value, $value2)
{
$view = new View("public_blog/blogs/archive");
$date_search = false;
# year search
if (!empty($value) and empty($value2)) {
valid::year($value);
$start = $value;
(int) ($end = $value + 1);
$date_search = "AND created >= '{$start}' AND created < '{$end}'";
} elseif (!empty($value) and !empty($value2)) {
valid::year($value);
valid::month($value2);
$month = $value2 + 1;
if (10 > $month) {
$month = "0{$month}";
}
$start = "{$value}-{$value2}";
$end = "{$value}-{$month}";
$date_search = "AND created >= '{$start}' AND created < '{$end}'";
}
$blog_posts = $this->db->query("\n SELECT blog_posts.*, \n DATE_FORMAT(created, '%Y') as year,\n DATE_FORMAT(created, '%M') as month,\n DATE_FORMAT(created, '%e') as day\n FROM blog_posts \n WHERE blog_posts.blog_id = '{$tool_id}' \n AND blog_posts.fk_site = '{$this->site_id}'\n {$date_search}\n ORDER BY created\n LIMIT 0, 10\n ");
$view->blog_posts = $blog_posts;
return $view;
}
示例3: week
/**
* Week view
*
* @param int $year
* @param int $week
*/
public function week($year, $week)
{
$this->tab_id = 'browse';
if (valid::year($year) && valid::week($week)) {
$this->type = 'week';
$this->date->setISODate($year, $week);
// check for new years fix
if ($week == 1) {
$saturday = new DateTime();
$saturday->setISODate($year, $week, 6);
$this->date = $saturday;
}
$this->page_title = text::title(__('Week') . ' ' . $this->date->format('W/Y'));
$this->breadcrumb[] = html::anchor(Router::$routed_uri, html::specialchars($this->page_title));
$this->_build_calendar();
}
}