⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 login.php

📁 zend的加强包 zend的加强包
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php/** * Zend Framework * * LICENSE * * This source file is subject to the new BSD license that is bundled * with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://framework.zend.com/license/new-bsd * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@zend.com so we can send you a copy immediately. * * @category   Zend * @package    Zend_Gdata * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) * @license    http://framework.zend.com/license/new-bsd     New BSD License *//** * @see Zend_Gdata_Extension */require_once 'Zend/Gdata/Extension.php';/** * @see Zend_Gdata_Gapps */require_once 'Zend/Gdata/Gapps.php';/** * Represents the apps:login element used by the Apps data API. This  * class is used to describe properties of a user, and is usually contained  * within instances of Zene_Gdata_Gapps_UserEntry or any other class  * which is linked to a particular username. * * @category   Zend * @package    Zend_Gdata * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) * @license    http://framework.zend.com/license/new-bsd     New BSD License */class Zend_Gdata_Gapps_Extension_Login extends Zend_Gdata_Extension{    protected $_rootNamespace = 'apps';    protected $_rootElement = 'login';        /**     * The username for this user. This is used as the user's email address      * and when logging in to Google Apps-hosted services.     *      * @var string     */    protected $_username = null;        /**     * The password for the user. May be in cleartext or as an SHA-1      * digest, depending on the value of _hashFunctionName.     *      * @var string     */    protected $_password = null;        /**     * Specifies whether the password stored in _password is in cleartext      * or is an SHA-1 digest of a password. If the password is cleartext,      * then this should be null. If the password is an SHA-1 digest, then      * this should be set to 'SHA-1'.     *      * At the time of writing, no other hash functions are supported     *      * @var string     */    protected $_hashFunctionName = null;        /**     * True if the user has administrative rights for this domain, false      * otherwise.     *      * @var boolean     */    protected $_admin = null;        /**     * True if the user has agreed to the terms of service for Google Apps,     * false otherwise.     *      * @var boolean.     */    protected $_agreedToTerms = null;        /**     * True if this user has been suspended, false otherwise.     *      * @var boolean     */    protected $_suspended = null;        /**     * True if the user will be required to change their password at      * their next login, false otherwise.     *      * @var boolean     */    protected $_changePasswordAtNextLogin = null;    /**     * Constructs a new Zend_Gdata_Gapps_Extension_Login object.     *      * @param string $username (optional) The username to be used for this      *          login.     * @param string $password (optional) The password to be used for this      *          login.     * @param string $hashFunctionName (optional) The name of the hash      *          function used to protect the password, or null if no      *          has function has been applied. As of this writing,      *          the only valid values are 'SHA-1' or null.     * @param boolean $admin (optional) Whether the user is an administrator      *          or not.     * @param boolean $suspended (optional) Whether this login is suspended or not.     * @param boolean $changePasswordAtNextLogin (optional) Whether      *          the user is required to change their password at their      *          next login.     * @param boolean $agreedToTerms (optional) Whether the user has      *          agreed to the terms of service.     */    public function __construct($username = null, $password = null,         $hashFunctionName = null, $admin = null, $suspended = null,         $changePasswordAtNextLogin = null, $agreedToTerms = null)     {        foreach (Zend_Gdata_Gapps::$namespaces as $nsPrefix => $nsUri) {            $this->registerNamespace($nsPrefix, $nsUri);        }        parent::__construct();                $this->_username = $username;        $this->_password = $password;        $this->_hashFunctionName = $hashFunctionName;        $this->_admin = $admin;        $this->_agreedToTerms = $agreedToTerms;        $this->_suspended = $suspended;        $this->_changePasswordAtNextLogin = $changePasswordAtNextLogin;    }    /**     * Retrieves a DOMElement which corresponds to this element and all      * child properties.  This is used to build an entry back into a DOM     * and eventually XML text for sending to the server upon updates, or     * for application storage/persistence.       *     * @param DOMDocument $doc The DOMDocument used to construct DOMElements     * @return DOMElement The DOMElement representing this element and all      * child properties.     */    public function getDOM($doc = null)    {        $element = parent::getDOM($doc);        if ($this->_username !== null) {            $element->setAttribute('userName', $this->_username);        }        if ($this->_password !== null) {            $element->setAttribute('password', $this->_password);        }        if ($this->_hashFunctionName !== null) {            $element->setAttribute('hashFunctionName', $this->_hashFunctionName);        }        if ($this->_admin !== null) {            $element->setAttribute('admin', ($this->_admin ? "true" : "false"));        }        if ($this->_agreedToTerms !== null) {            $element->setAttribute('agreedToTerms', ($this->_agreedToTerms ? "true" : "false"));        }        if ($this->_suspended !== null) {            $element->setAttribute('suspended', ($this->_suspended ? "true" : "false"));        }        if ($this->_changePasswordAtNextLogin !== null) {            $element->setAttribute('changePasswordAtNextLogin', ($this->_changePasswordAtNextLogin ? "true" : "false"));        }                return $element;    }    /**     * Given a DOMNode representing an attribute, tries to map the data into     * instance members.  If no mapping is defined, the name and value are      * stored in an array.     *     * @param DOMNode $attribute The DOMNode attribute needed to be handled     * @throws Zend_Gdata_App_InvalidArgumentException     */    protected function takeAttributeFromDOM($attribute)    {        switch ($attribute->localName) {        case 'userName':            $this->_username = $attribute->nodeValue;            break;        case 'password':            $this->_password = $attribute->nodeValue;            break;        case 'hashFunctionName':            $this->_hashFunctionName = $attribute->nodeValue;            break;        case 'admin':            if ($attribute->nodeValue == "true") {                $this->_admin = true;            }            else if ($attribute->nodeValue == "false") {                $this->_admin = false;            }            else {                require_once('Zend/Gdata/App/InvalidArgumentException.php');                throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for apps:login#admin.");            }            break;        case 'agreedToTerms':            if ($attribute->nodeValue == "true") {                $this->_agreedToTerms = true;            }            else if ($attribute->nodeValue == "false") {                $this->_agreedToTerms = false;            }            else {                require_once('Zend/Gdata/App/InvalidArgumentException.php');                throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for apps:login#agreedToTerms.");            }            break;        case 'suspended':            if ($attribute->nodeValue == "true") {                $this->_suspended = true;            }            else if ($attribute->nodeValue == "false") {                $this->_suspended = false;            }            else {                require_once('Zend/Gdata/App/InvalidArgumentException.php');                throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for apps:login#suspended.");            }            break;        case 'changePasswordAtNextLogin':            if ($attribute->nodeValue == "true") {                $this->_changePasswordAtNextLogin = true;            }            else if ($attribute->nodeValue == "false") {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -