1 | <?php
|
---|
2 |
|
---|
3 | /**
|
---|
4 | * Zend Framework
|
---|
5 | *
|
---|
6 | * LICENSE
|
---|
7 | *
|
---|
8 | * This source file is subject to the new BSD license that is bundled
|
---|
9 | * with this package in the file LICENSE.txt.
|
---|
10 | * It is also available through the world-wide-web at this URL:
|
---|
11 | * http://framework.zend.com/license/new-bsd
|
---|
12 | * If you did not receive a copy of the license and are unable to
|
---|
13 | * obtain it through the world-wide-web, please send an email
|
---|
14 | * to license@zend.com so we can send you a copy immediately.
|
---|
15 | *
|
---|
16 | * @category Zend
|
---|
17 | * @package Zend_Gdata
|
---|
18 | * @subpackage App
|
---|
19 | * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
---|
20 | * @license http://framework.zend.com/license/new-bsd New BSD License
|
---|
21 | */
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * @see Zend_Gdata_App_CaptchaRequiredException
|
---|
25 | */
|
---|
26 | require_once 'Zend/Gdata/App/AuthException.php';
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * Gdata exceptions
|
---|
30 | *
|
---|
31 | * Class to represent an exception that occurs during the use of ClientLogin.
|
---|
32 | * This particular exception happens when a CAPTCHA challenge is issued. This
|
---|
33 | * challenge is a visual puzzle presented to the user to prove that they are
|
---|
34 | * not an automated system.
|
---|
35 | *
|
---|
36 | * @category Zend
|
---|
37 | * @package Zend_Gdata
|
---|
38 | * @subpackage App
|
---|
39 | * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
---|
40 | * @license http://framework.zend.com/license/new-bsd New BSD License
|
---|
41 | */
|
---|
42 | class Zend_Gdata_App_CaptchaRequiredException extends Zend_Gdata_App_AuthException
|
---|
43 | {
|
---|
44 | /**
|
---|
45 | * The Google Accounts URL prefix.
|
---|
46 | */
|
---|
47 | const ACCOUNTS_URL = 'https://www.google.com/accounts/';
|
---|
48 |
|
---|
49 | /**
|
---|
50 | * The token identifier from the server.
|
---|
51 | *
|
---|
52 | * @var string
|
---|
53 | */
|
---|
54 | private $captchaToken;
|
---|
55 |
|
---|
56 | /**
|
---|
57 | * The URL of the CAPTCHA image.
|
---|
58 | *
|
---|
59 | * @var string
|
---|
60 | */
|
---|
61 | private $captchaUrl;
|
---|
62 |
|
---|
63 | /**
|
---|
64 | * Constructs the exception to handle a CAPTCHA required response.
|
---|
65 | *
|
---|
66 | * @param string $captchaToken The CAPTCHA token ID provided by the server.
|
---|
67 | * @param string $captchaUrl The URL to the CAPTCHA challenge image.
|
---|
68 | */
|
---|
69 | public function __construct($captchaToken, $captchaUrl) {
|
---|
70 | $this->captchaToken = $captchaToken;
|
---|
71 | $this->captchaUrl = Zend_Gdata_App_CaptchaRequiredException::ACCOUNTS_URL . $captchaUrl;
|
---|
72 | parent::__construct('CAPTCHA challenge issued by server');
|
---|
73 | }
|
---|
74 |
|
---|
75 | /**
|
---|
76 | * Retrieves the token identifier as provided by the server.
|
---|
77 | *
|
---|
78 | * @return string
|
---|
79 | */
|
---|
80 | public function getCaptchaToken() {
|
---|
81 | return $this->captchaToken;
|
---|
82 | }
|
---|
83 |
|
---|
84 | /**
|
---|
85 | * Retrieves the URL CAPTCHA image as provided by the server.
|
---|
86 | *
|
---|
87 | * @return string
|
---|
88 | */
|
---|
89 | public function getCaptchaUrl() {
|
---|
90 | return $this->captchaUrl;
|
---|
91 | }
|
---|
92 |
|
---|
93 | }
|
---|