当前位置: 首页>>代码示例>>PHP>>正文


PHP valid::date方法代码示例

本文整理汇总了PHP中valid::date方法的典型用法代码示例。如果您正苦于以下问题:PHP valid::date方法的具体用法?PHP valid::date怎么用?PHP valid::date使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在valid的用法示例。


在下文中一共展示了valid::date方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: day

 /**
  * Day view
  *
  * @param  int  $year
  * @param  int  $month
  * @param  int  $day
  */
 public function day($year, $month, $day)
 {
     $this->tab_id = 'browse';
     if (valid::date($year . '-' . $month . '-' . $day)) {
         $this->type = 'day';
         $this->date->setDate($year, $month, $day);
         $this->page_title = text::title($this->date->format('j.n.Y'));
         $this->_build_calendar();
     }
 }
开发者ID:anqqa,项目名称:Anqh,代码行数:17,代码来源:events.php

示例2: date

 /**
  * Tests the valid::date() function.
  * @dataProvider date_provider
  * @group core.helpers.valid.date
  * @test
  */
 public function date($input_date, $expected_result)
 {
     $result = valid::date($input_date);
     $this->assertEquals($expected_result, $result);
 }
开发者ID:swk,项目名称:bluebox,代码行数:11,代码来源:Helper_Valid_Test.php

示例3: login

 /**
  * Attempt to log in a user by using an ORM object and plain-text password.
  *
  * @param   string   username to log in
  * @param   string   password to check against
  * @param   boolean  enable auto-login
  * @return  boolean
  */
 public function login($user, $password, $remember = FALSE)
 {
     //get password field name from config
     $password_field = $this->config['password'];
     //$user and $password must set, ane they must be string type
     if (empty($password) or !is_string($password) or !is_string($user)) {
         return FALSE;
     }
     $user = new Auth_Users_Model(array('username' => $user, 'password' => $password));
     //if there is no such user in database, quit
     if (!$user->check_id()) {
         return FALSE;
     }
     if (is_string($password)) {
         // Create a hashed password using the secrets from config
         $password = $this->hash($password);
     }
     // If user is active and the passwords match, perform a login
     if (intval($user->active) === 1 and $user->{$password_field} == $password) {
         //check if user has not expired
         if (valid::date($user->active_to)) {
             $now = date('Y-m-d H:i:s');
             if ($user->active_to < $now) {
                 return FALSE;
             }
         }
         if ($remember === TRUE) {
             // Create a new autologin token
             $token_model = new Auth_User_Tokens_Model();
             // delete old user tokens
             $token_model->delete_user_tokens($user->id);
             // Set token data
             $token_model->user_id = $user->id;
             $token_model->expires = date('Y-m-d H:i:s', mktime(date('H'), date('i'), date('s') + $this->config['lifetime'], date('m'), date('d'), date('Y')));
             //save token
             $token_model->save();
             // Set the autologin cookie
             cookie::set($this->config['cookie_key'], $token_model->token, $this->config['lifetime']);
         }
         // Finish the login
         $this->complete_login($user);
         return TRUE;
     }
     // Login failed
     return FALSE;
 }
开发者ID:bicho44,项目名称:imglistados,代码行数:54,代码来源:Simple_Auth.php


注:本文中的valid::date方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。