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


PHP Users::applyFilter方法代码示例

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


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

示例1: function

<?php

use app\models\Users;
use lithium\security\Password;
Users::applyFilter('save', function ($self, $params, $chain) {
    if ($params['data']) {
        $params['entity']->set($params['data']);
        $params['data'] = array();
    }
    if (!$params['entity']->exists()) {
        $params['entity']->password = Password::hash($params['entity']->password);
    }
    return $chain->next($self, $params, $chain);
});
开发者ID:redthor,项目名称:framework,代码行数:14,代码来源:user_hash_password.php

示例2: function

        return false;
    }
});
Validator::add('uniqueUsername', function ($value, $rule, $options) {
    $conflicts = Users::count(array('username' => $value));
    if ($conflicts) {
        return false;
    }
    return true;
});
Validator::add('uniqueEmail', function ($value, $rule, $options) {
    $conflicts = Users::count(array('email' => $value));
    if ($conflicts) {
        return false;
    }
    return true;
});
Users::applyFilter('save', function ($self, $params, $chain) {
    if ($params['data']) {
        $params['entity']->set($params['data']);
        $params['data'] = array();
    }
    if (!$params['entity']->exists()) {
        $params['entity']->password = String::hash($params['entity']->password);
        $params['entity']->password2 = String::hash($params['entity']->password2);
        $params['entity']->created = new \MongoDate();
        $params['entity']->updated = new \MongoDate();
        $params['entity']->ip = $_SERVER['REMOTE_ADDR'];
    }
    return $chain->next($self, $params, $chain);
});
开发者ID:nilamdoc,项目名称:OxOPDF,代码行数:31,代码来源:Users.php

示例3: function

Validator::add('uniqueWalletID', function ($value, $rule, $options) {
    $conflicts = Users::count(array('walletid' => $value));
    if ($conflicts) {
        return false;
    }
    return true;
});
Validator::add('uniqueEmail', function ($value, $rule, $options) {
    $conflicts = Users::count(array('email' => $value));
    if ($conflicts) {
        return false;
    }
    return true;
});
Validator::add('uniqueUsername', function ($value, $rule, $options) {
    $conflicts = Users::count(array('username' => $value));
    if ($conflicts) {
        return false;
    }
    return true;
});
Users::applyFilter('save', function ($self, $params, $chain) {
    if ($params['data']) {
        $params['entity']->set($params['data']);
        $params['data'] = array();
    }
    if (!$params['entity']->exists()) {
        $params['entity']->created = new \MongoDate();
    }
    return $chain->next($self, $params, $chain);
});
开发者ID:nilamdoc,项目名称:msx,代码行数:31,代码来源:Users.php

示例4: function

<?php

use app\models\Users;
use lithium\security\Password;
Users::applyFilter('save', function ($self, $params, $chain) {
    if ($params['data']) {
        $params['entity']->set($params['data']);
        $params['data'] = array();
    }
    $record = $params['entity'];
    //password is provided, we need to hash it
    if (!empty($record->password)) {
        $record->password = lithium\util\String::hash($record->password);
    }
    return $chain->next($self, $params, $chain);
});
开发者ID:beeckmpi,项目名称:permanentielijsten,代码行数:16,代码来源:passwordHash.php

示例5: function

}
Validator::add('passwordVerification', function ($value, $rule, $options) {
    if (!isset($options['values']['password2']) || $value == $options['values']['password2']) {
        return true;
    }
    return false;
});
Validator::add('uniqueUsername', function ($value, $rule, $options) {
    $conflicts = Users::count(array('username' => $value));
    if ($conflicts) {
        return false;
    }
    return true;
});
Users::applyFilter('save', function ($self, $params, $chain) {
    $entity = $params['entity'];
    $data = $params['data'];
    if ($data) {
        $entity->set($data);
        if (isset($data['password']) && $data['password'] && isset($data['password2']) && $data['password2']) {
            $entity->password = \lithium\util\String::hash($data['password']);
            $entity->password2 = \lithium\util\String::hash($data['password2']);
        }
    }
    if (!$entity->id) {
        $entity->created = new \MongoDate();
    }
    $entity->updated = new \MongoDate();
    $params['entity'] = $entity;
    return $chain->next($self, $params, $chain);
});
开发者ID:nilamdoc,项目名称:TimeRig,代码行数:31,代码来源:Users.php


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