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


PHP Ak::getDate方法代码示例

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


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

示例1: authenticate

 /**
  * Main authentication method
  *
  * @param string $login
  * @param string $password
  * @return False if not found or not enabled, User instance if succedes
  */
 function authenticate($login, $password)
 {
     $UserInstance =& new User();
     if (($User =& $UserInstance->find('first', array('conditions' => array('login = ? AND __owner.is_enabled = ? AND _roles.is_enabled = ?', $login, true, true), 'include' => 'role'))) && $User->isValidPassword($password)) {
         $User->set('last_login_at', Ak::getDate());
         $User->save();
         return $User;
     }
     return false;
 }
开发者ID:joeymetal,项目名称:v1,代码行数:17,代码来源:user.php

示例2: Test_for_getTimestamp

 public function Test_for_getTimestamp()
 {
     $this->assertEqual(Ak::getTimestamp(), Ak::time());
     $this->assertEqual('17:52:03', Ak::getDate(Ak::getTimestamp('17:52:03'), 'H:i:s'));
     $this->assertEqual(date('Y-m-d') . ' 17:52:03', Ak::getDate(Ak::getTimestamp('17:52:03')));
     $this->assertEqual('2005-12-25 00:00:00', Ak::getDate(Ak::getTimestamp('2005-12-25')));
     $this->assertEqual('1592-10-09 00:00:00', Ak::getDate(Ak::getTimestamp('1592-10-09')));
     $this->assertEqual('2192-10-09 00:00:00', Ak::getDate(Ak::getTimestamp('2192-10-09')));
     $this->assertEqual('2192-10-09 01:02:03', Ak::getDate(Ak::getTimestamp('2192-10-9 01:02:03')));
 }
开发者ID:bermi,项目名称:akelos,代码行数:10,代码来源:support_functions.php

示例3: test_should_record_timestamps

 public function test_should_record_timestamps()
 {
     $this->WebPage->body = 'Akelos PHP framework...';
     $this->WebPage->save();
     $created_at = Ak::getDate();
     $this->assertEqual($this->WebPage->created_at, $created_at);
     sleep(1);
     $this->WebPage->save();
     $this->assertEqual($this->WebPage->created_at, $created_at);
     $this->assertEqual($this->WebPage->updated_at, Ak::getDate());
 }
开发者ID:bermi,项目名称:akelos,代码行数:11,代码来源:crud.php

示例4: authenticate

 /**
  * Main authentication method
  * 
  * @param string $login user name or password
  * @param string $password
  * @return False if not found or not enabled, User instance if succedes
  */
 function authenticate($login, $password)
 {
     $UserInstance =& new User();
     $login_or_email = preg_match(AK_EMAIL_REGULAR_EXPRESSION, $login) ? 'email' : 'login';
     if (($User =& $UserInstance->find('first', array('conditions' => array($login_or_email . ' = ? AND __owner.is_enabled = ? AND _roles.is_enabled = ?', $login, true, true), 'include' => 'role'))) && $User->isValidPassword($password)) {
         $User->set('last_login_at', Ak::getDate());
         $User->save();
         return $User;
     }
     return false;
 }
开发者ID:joeymetal,项目名称:v1,代码行数:18,代码来源:user.php

示例5: authenticateWithToken

 function authenticateWithToken($token)
 {
     $options = User::_decodeToken($token);
     if (!empty($options) && !empty($options['hash']) && !empty($options['id'])) {
         $User = new User();
         $User = $User->find($options['id']);
         if (!empty($options['expires']) && $options['expires'] < Ak::getTimestamp()) {
             return false;
         }
         if ($options['hash'] == $User->_getTokenHash($options)) {
             $User->updateAttribute('last_login_at', Ak::getDate());
             return $User;
         }
     }
     return false;
 }
开发者ID:joeymetal,项目名称:v1,代码行数:16,代码来源:sentinel.php

示例6: authenticateWithToken

 public function authenticateWithToken($token, $update_last_login = true)
 {
     $options = User::decodeToken($token);
     if (!empty($options) && !empty($options['hash']) && !empty($options['id'])) {
         $User = new User();
         $User = $User->find($options['id']);
         if (!empty($options['expires']) && $options['expires'] < Ak::getTimestamp()) {
             return false;
         }
         if ($options['hash'] == $User->getTokenHash($options)) {
             if ($update_last_login) {
                 $User->updateAttribute('last_login_at', Ak::getDate());
             }
             $this->setCurrentUser($User);
             return $User;
         }
     }
     return false;
 }
开发者ID:bermi,项目名称:admin,代码行数:19,代码来源:sentinel.php

示例7: test_setup

 public function test_setup()
 {
     $this->controller = new AkActionController();
     $this->controller->Request = new MockAkRequest($this);
     $this->controller->controller_name = 'test';
     $this->controller->instantiateHelpers();
     $this->active_record_helper =& $this->controller->active_record_helper;
     $this->installAndIncludeModels(array('ProtectedPerson', 'Property'));
     $this->controller->ProtectedPerson = new ProtectedPerson();
     $this->LuckyLuke =& $this->controller->ProtectedPerson;
     $this->controller->ProtectedPerson->name = "Lucky Luke";
     $this->controller->ProtectedPerson->created_by = "1";
     $this->controller->ProtectedPerson->birthday = Ak::getDate(mktime(8, 42, 36, 3, 27, 1982));
     $this->controller->ProtectedPerson->save();
     $this->controller->ProtectedPerson->created_at = Ak::getDate(mktime(8, 42, 36, 3, 27, 1982));
     $this->controller->ProtectedPerson->updated_at = Ak::getDate(mktime(8, 42, 36, 3, 27, 1982));
     $this->controller->Property = new Property('description->', '阿尔罕布拉宫', 'details->', '阿尔罕布拉宫 <> & (阿拉伯语: الحمراء‎‎ = Al Ħamrā\'; 即"红色城堡")');
     $this->alhambra =& $this->controller->Property;
     $this->alhambra->save();
 }
开发者ID:joeymetal,项目名称:v1,代码行数:20,代码来源:active_record_helper.php

示例8: test_setup

 public function test_setup()
 {
     //echo NumberHelper::human_size(memory_get_peak_usage()).' '.__LINE__."\n";
     $Request = new MockAkRequest();
     $Request->setReturnValue('getController', 'test');
     $Request->setReturnValue('getRelativeUrlRoot', '');
     $Request->setReturnValue('getParametersFromRequestedUrl', array('controller' => 'test'));
     $this->controller = new AkActionController();
     $this->controller->Request = $Request;
     $this->active_record_helper = $this->controller->active_record_helper;
     $this->installAndIncludeModels(array('DummyProtectedPerson', 'DummyProperty'));
     $this->controller->DummyProtectedPerson = new DummyProtectedPerson();
     $this->LuckyLuke = $this->controller->DummyProtectedPerson;
     $this->controller->DummyProtectedPerson->name = "Lucky Luke";
     $this->controller->DummyProtectedPerson->created_by = "1";
     $this->controller->DummyProtectedPerson->birthday = Ak::getDate(mktime(8, 42, 36, 3, 27, 1982));
     $this->controller->DummyProtectedPerson->save();
     $this->controller->DummyProtectedPerson->created_at = Ak::getDate(mktime(8, 42, 36, 3, 27, 1982));
     $this->controller->DummyProtectedPerson->updated_at = Ak::getDate(mktime(8, 42, 36, 3, 27, 1982));
     $this->controller->DummyProperty = new DummyProperty(array('description' => '阿尔罕布拉宫', 'details' => '阿尔罕布拉宫 <> & (阿拉伯语: الحمراء‎‎ = Al Ħamrā\'; 即"红色城堡")'));
     $this->alhambra = $this->controller->DummyProperty;
     $this->alhambra->save();
     //echo NumberHelper::human_size(memory_get_peak_usage()).' '.__LINE__."\n";
 }
开发者ID:bermi,项目名称:akelos,代码行数:24,代码来源:active_record_helper.php

示例9: to_date_tag

 public function to_date_tag()
 {
     $defaults = $this->default_date_options;
     $date = $this->getValue();
     $date = !empty($date) ? $date : Ak::getDate();
     return AkDateHelper::select_day($date, array_merge($defaults, array('prefix' => "{$this->object_name}[{$this->_column_name}(3)]"))) . AkDateHelper::select_month($date, array_merge($defaults, array('prefix' => "{$this->object_name}[{$this->_column_name}(2)]"))) . AkDateHelper::select_year($date, array_merge($defaults, array('prefix' => "{$this->object_name}[{$this->_column_name}(1)]")));
 }
开发者ID:bermi,项目名称:akelos,代码行数:7,代码来源:ak_form_helper.php

示例10: Test_of_populate_todo_list

 public function Test_of_populate_todo_list()
 {
     for ($i = 0; $i <= 30; $i++) {
         $attributes = array('task' => 'Task number ' . ($i + 3), 'due_time' => Ak::getDate(Ak::time() + 60 * 60 * 24 * $i));
         $TodoTask = new TodoItem($attributes);
         $this->assertTrue($TodoTask->save());
         $this->assertTrue($TodoTask->task == $attributes['task'] && $TodoTask->due_time == $attributes['due_time']);
     }
 }
开发者ID:joeymetal,项目名称:v1,代码行数:9,代码来源:AkActsAsList.php

示例11: multipart_with_mime_version

 public function multipart_with_mime_version($recipient)
 {
     $this->set(array('recipients' => $recipient, 'subject' => "multipart with mime_version", 'from' => "test@example.com", 'sent_on' => Ak::getDate(strtotime('2004-12-12')), 'mime_version' => "1.1", 'content_type' => "multipart/alternative", 'parts' => array(array('content_type' => 'text/plain', 'body' => 'blah'), array('content_type' => 'text/html', 'body' => '<b>blah</b>'))));
 }
开发者ID:bermi,项目名称:akelos,代码行数:4,代码来源:test_mailer.php

示例12: _getRequestOrigin

 function _getRequestOrigin()
 {
     return $this->Request->remote_ip . ' at ' . Ak::getDate();
 }
开发者ID:joeymetal,项目名称:v1,代码行数:4,代码来源:AkActionController.php

示例13: setInstalledVersion

    function setInstalledVersion($version, $options = array())
    {
        //if(!$this->tableExists('akelos_migrations')) {
            $this->_createMigrationsTable();
        //}
        /**
         * this will produce an error if the unique index on name is violated, then we update
         */
        $this->log('Setting version of '.$this->getInstallerName().' to '.$version);
        $old_version=$this->db->selectValue(array('SELECT version from akelos_migrations WHERE name = ?', $this->getInstallerName()));
        if($old_version !== null || !@$this->db->execute(array('INSERT INTO akelos_migrations (version,created_at,name) VALUES (?,?,?)',$version,Ak::getDate(),$this->getInstallerName()))) {
            return @$this->db->execute(array('UPDATE akelos_migrations SET version=?, updated_at=? WHERE name=?',$version,Ak::getDate(),$this->getInstallerName()));
        }

        return true;

    }
开发者ID:joeymetal,项目名称:v1,代码行数:17,代码来源:AkInstaller.php

示例14: _create

 /**
  * Creates a new record with values matching those of the instance attributes.
  * Must be called as a result of a call to createOrUpdate.
  */
 function _create()
 {
     if ($this->isFrozen()) {
         $this->transactionFail();
         return false;
     }
     if ($this->beforeCreate()) {
         $this->notifyObservers('beforeCreate');
         if ($this->_recordTimestamps) {
             if ($this->hasColumn('created_at')) {
                 $this->setAttribute('created_at', Ak::getDate());
             }
             if ($this->hasColumn('created_on')) {
                 $this->setAttribute('created_on', Ak::getDate(null, 'Y-m-d'));
             }
             if (isset($this->expires_on)) {
                 if (isset($this->expires_at) && $this->hasColumn('expires_at')) {
                     $this->setAttribute('expires_at', Ak::getDate(strtotime($this->expires_at) + (defined('AK_TIME_DIFFERENCE') ? AK_TIME_DIFFERENCE * 60 : 0)));
                 } elseif (isset($this->expires_on) && $this->hasColumn('expires_on')) {
                     $this->setAttribute('expires_on', Ak::getDate(strtotime($this->expires_on) + (defined('AK_TIME_DIFFERENCE') ? AK_TIME_DIFFERENCE * 60 : 0), 'Y-m-d'));
                 }
             }
         }
         $attributes = $this->removeUnavailableColumns($this->getAttributes());
         if ($this->isLockingEnabled()) {
             $attributes['lock_version'] = 1;
             $this->setAttribute('lock_version', 1);
         }
         $pk = $this->getPrimaryKey();
         $table = $this->getTableName();
         foreach ($attributes as $column => $value) {
             $attributes[$column] = $this->castAttributeForDatabase($column, $value);
         }
         /**
          * @todo sanitize attributes
          * 'beforeValidationOnCreate', 'afterValidationOnCreate'
          */
         if (!isset($this->_generateSequence) || isset($this->_generateSequence) && $this->_generateSequence !== false) {
             if (empty($attributes[$pk]) || !empty($attributes[$pk]) && (int) $attributes[$pk] > 0) {
                 if ($this->_getDatabaseType() != 'mysql') {
                     $table_details = $this->_databaseTableInternals('seq_' . $table);
                     if (!isset($table_details['ID'])) {
                         $this->_db->CreateSequence('seq_' . $table);
                     }
                     $attributes[$pk] = $this->_db->GenID('seq_' . $table);
                 }
             }
         }
         $__attributes = $attributes;
         $attributes = array_diff($attributes, array('', "''"));
         $sql = 'INSERT INTO ' . $table . ' ' . '(' . join(', ', array_keys($attributes)) . ') ' . 'VALUES (' . join(',', array_values($attributes)) . ')';
         if (!$this->_db->Execute($sql)) {
             AK_DEBUG ? trigger_error($this->_db->ErrorMsg(), E_USER_NOTICE) : null;
         }
         $id = !empty($attributes[$pk]) ? $attributes[$pk] : $this->_db->Insert_ID($table, $pk);
         $this->setId($id);
         if (!$this->transactionHasFailed()) {
             $this->_newRecord = false;
             if (!$this->afterCreate()) {
                 $this->transactionFail();
             } else {
                 $this->notifyObservers('afterCreate');
             }
         }
     } else {
         $this->transactionFail();
     }
     return $this;
 }
开发者ID:joeymetal,项目名称:v1,代码行数:73,代码来源:AkActiveRecord.php

示例15: test_should_be_able_to_authenticate

 function test_should_be_able_to_authenticate()
 {
     $this->assertFalse(User::authenticate('aliciasadurni', 'badpass'));
     $this->assertTrue($Alicia = User::authenticate('aliciasadurni', 'goodpass'));
     $this->assertNotNull($Alicia->get('last_login_at'), 'Should update last_login_at');
     $this->assertEqual(substr($Alicia->get('last_login_at'), 0, -2), substr(Ak::getDate(), 0, -2));
 }
开发者ID:joeymetal,项目名称:v1,代码行数:7,代码来源:user.php


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