Verzeichnisstruktur phpBB-3.2.0
- Veröffentlicht
- 06.01.2017
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
RequestParameters.php
001 <?php
002 /**
003 * This is a PHP library that handles calling reCAPTCHA.
004 *
005 * @copyright Copyright (c) 2015, Google Inc.
006 * @link http://www.google.com/recaptcha
007 *
008 * Permission is hereby granted, free of charge, to any person obtaining a copy
009 * of this software and associated documentation files (the "Software"), to deal
010 * in the Software without restriction, including without limitation the rights
011 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
012 * copies of the Software, and to permit persons to whom the Software is
013 * furnished to do so, subject to the following conditions:
014 *
015 * The above copyright notice and this permission notice shall be included in
016 * all copies or substantial portions of the Software.
017 *
018 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
019 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
020 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
021 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
022 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
023 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
024 * THE SOFTWARE.
025 */
026
027 namespace ReCaptcha;
028
029 /**
030 * Stores and formats the parameters for the request to the reCAPTCHA service.
031 */
032 class RequestParameters
033 {
034 /**
035 * Site secret.
036 * @var string
037 */
038 private $secret;
039
040 /**
041 * Form response.
042 * @var string
043 */
044 private $response;
045
046 /**
047 * Remote user's IP address.
048 * @var string
049 */
050 private $remoteIp;
051
052 /**
053 * Client version.
054 * @var string
055 */
056 private $version;
057
058 /**
059 * Initialise parameters.
060 *
061 * @param string $secret Site secret.
062 * @param string $response Value from g-captcha-response form field.
063 * @param string $remoteIp User's IP address.
064 * @param string $version Version of this client library.
065 */
066 public function __construct($secret, $response, $remoteIp = null, $version = null)
067 {
068 $this->secret = $secret;
069 $this->response = $response;
070 $this->remoteIp = $remoteIp;
071 $this->version = $version;
072 }
073
074 /**
075 * Array representation.
076 *
077 * @return array Array formatted parameters.
078 */
079 public function toArray()
080 {
081 $params = array('secret' => $this->secret, 'response' => $this->response);
082
083 if (!is_null($this->remoteIp)) {
084 $params['remoteip'] = $this->remoteIp;
085 }
086
087 if (!is_null($this->version)) {
088 $params['version'] = $this->version;
089 }
090
091 return $params;
092 }
093
094 /**
095 * Query string representation for HTTP request.
096 *
097 * @return string Query string formatted parameters.
098 */
099 public function toQueryString()
100 {
101 return http_build_query($this->toArray(), '', '&');
102 }
103 }
104