类加载-检测token值

@return bool
765300
public static function checkToken()
    {
        $token = Input::postString('CML_TOKEN');
        if (empty($token)) return false;
        if ($token !== self::getToken()) return false;
        unset($_COOKIE['CML_TOKEN']);
        return true;
    }
1103058
public function generateToken()
    {
        $token = Mage::helper('core')->getRandomString(16);
        $this->addCookie(self::COOKIE_TOKEN, $token);
        $this->addCookie(self::COOKIE_TOKEN_CHECKSUM, $this->getChecksum(array('token' => $token)));
        return $this;
    }
1126555
protected function next_token(){
		$this->tok = next( $this->input );
		$this->t = self::token_to_symbol( $this->tok );
		return $this->tok;
	}
640591
private function _parse_token()
    {
        if (!$this->_controller || !$this->_action) {
            if (!$this->_action && isset($this->_vars['action']))
                $this->_action = $this->_vars['action']['value'];
            
            if (!$this->_to) {
                if (!isset($this->_vars['controller']) || !isset($this->_vars['action']))
                    return false;
                $this->_controller = $this->_vars['controller']['value'];
                $this->_action     = $this->_vars['action']['value'];
            } else {
                $to = $this->_has_variable_to() ? $this->_replace_variable_to($this->_controller, $this->_action) : $this->_to;
                try {
                    $token = new UrlToken($to);
                    list($this->_controller, $this->_action) = $token->parts();
                } catch (Exception $e) {
                    return false;
                }
            }
        }
        return true;
    }
579981
protected function requestAccessToken()
    {
        $result = $this->httpGet(self::WECHAT_ACCESS_TOKEN_PREFIX, [
            'corpid' => $this->corpId,
            'corpsecret' => $this->secret
        ]);
        return isset($result['access_token']) ? $result : false;
    }
312627
private function add()
    {
        // skip if it's a key
        if ((null !== ($check = $this->tokens->getToken($this->tokens->key() + 1)))
            && ((DocLexer::T_COLON === $check[0])
                || (DocLexer::T_EQUALS === $check[0]))) {
            return;
        }

        $token = $this->tokens->current();
        $value = $this->result->createElement('value');

        if (null !== ($key = $this->key())) {
            $value->setAttribute('key', $key);
        }

        $this->current->appendChild($value);

        $text = null;
        $type = null;

        switch ($token[0]) {
            case DocLexer::T_FALSE:
                $text = '0';
                $type = 'boolean';

                break;
            case DocLexer::T_FLOAT:
                $text = $token[1];
                $type = 'float';

                break;
            case DocLexer::T_IDENTIFIER:
                $text = $token[1];
                $type = 'constant';

                break;
            case DocLexer::T_INTEGER:
                $text = $token[1];
                $type = 'integer';

                break;
            case DocLexer::T_NULL:
                $type = 'null';

                break;
            case DocLexer::T_STRING:
                $text = $token[1];
                $type = 'string';

                break;
            case DocLexer::T_TRUE:
                $text = '1';
                $type = 'boolean';

                break;
        }

        $value->setAttribute('type', $type);

        if (null !== $text) {
            $value->appendChild(new DOMText($text));
        }
    }
237106
public function generateToken() {
		if( !isset($_SESSION[self::SESSION_KEY][$this->name]) ) {
			$_SESSION[self::SESSION_KEY][$this->name]	= array();
		}
		$TOKEN_SESSION = &$_SESSION[self::SESSION_KEY][$this->name];
		do {
			$token = generatePassword(static::$TOKEN_LENGTH);
		} while( isset($TOKEN_SESSION[$token]) );
		if( count($TOKEN_SESSION) >= $this->maxToken ) {
			array_shift($TOKEN_SESSION);
		}
		$TOKEN_SESSION[$token]	= 0;
		return $token;
	}
1034792
public function createToken()
    {
        $hashProvider = HashProvider::getProvider();
        $token = $hashProvider->createHash($this->getSavedPasswordTokenData(), sha1($this->Password));

        $this->Token = $token;
        $this->TokenExpiry = date("Y-m-d H:i:s", strtotime("+2 weeks"));
        $this->save();

        return $token;
    }
1115580
private function isEndToken()
    {
        return $this->tokenIs(';')
        || $this->tokenIs(',')
        || $this->tokenIs(')')
        || $this->tokenIs(']')
        || $this->tokenIs(T_DOUBLE_ARROW);
    }
329200
protected function generateToken()
    {
        if ($this->token === null) {
            $secret = array(
                'install' => __DIR__,
                'name' => $this->name,
            );

            if (isset($_SESSION)) {
                $key = sha1(__DIR__ . '/' . 'formidable_secret');

                if (isset($_SESSION[$key])) {
                    $secret['csrf'] = $_SESSION[$key];
                } else {
                    $csrf = sha1(uniqid(mt_rand(), true).'|'.gettimeofday(true));
                    $_SESSION[$key] = $csrf;
                    $secret['csrf'] = $csrf;
                }
            }

            $this->token = sha1(serialize($secret));
        }
    }
31208
public function generateToken()
    {
        if (isset($this->token)) return;

        $this->token = base_convert(md5(uniqid(rand(), true)), 16, 36);
        setcookie($this->getCookieName(), $this->token, time() + $this->cookie_lifetime, '/');
    }
806892
protected function getTokenInstance()
    {
        if (!$this->tokenInstance) {
            $this->tokenInstance = Token::instance('captcha')->setOptions(['title' => '图形码']);
        }
        
        return $this->tokenInstance;
    }
379382
public static function token()
    {
        $name = config('security.key1');

        $token = '';

        if (static::exists($name)) {
            $token = static::get($name);
        } else {
            $token = Hash::token();
            //
            static::put($name, $token);
        }

        return $token;
    }
273302
public function add_csrf()
	{
		$this->add(\Config::get('security.csrf_token_key', 'fuel_csrf_token'), 'CSRF Token')
			->set_type('hidden')
			->set_value(\Security::fetch_token())
			->add_rule(array('Security', 'check_token'));

		return $this;
	}
354408
public function makeSign()
    {
        //签名步骤一：按字典序排序参数
        ksort($this->values);
        $string = $this->ToUrlParams();
        //签名步骤二：在string后加入KEY
        $string = $string . "&key=".Config::getKEY();
        //签名步骤三：MD5加密
        $string = md5($string);
        //签名步骤四：所有字符转为大写
        $result = strtoupper($string);
        return $result;
    }
16908
public function add()
    {
        $group = $this->UsersGroups->newEntity();

        if ($this->request->is('post')) {
            $group = $this->UsersGroups->patchEntity($group, $this->request->getData());

            if ($this->UsersGroups->save($group)) {
                $this->Flash->success(I18N_OPERATION_OK);

                return $this->redirect(['action' => 'index']);
            }

            $this->Flash->error(I18N_OPERATION_NOT_OK);
        }

        $this->set(compact('group'));
    }
1208976
public function getToken()
    {
        if (isset($_SESSION[$this->session_name])) {
            return $_SESSION[$this->session_name];
        } else {
            $token = uniqid($this->randomString());
            $_SESSION[$this->session_name] = $token;
            return $token;
        }
    }