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.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

Socket.php

Zuletzt modifiziert: 09.10.2024, 12:58 - Dateigröße: 2.87 KiB


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\RequestMethod;
028   
029  /**
030   * Convenience wrapper around native socket and file functions to allow for
031   * mocking.
032   */
033  class Socket
034  {
035      private $handle = null;
036   
037      /**
038       * fsockopen
039       * 
040       * @see http://php.net/fsockopen
041       * @param string $hostname
042       * @param int $port
043       * @param int $errno
044       * @param string $errstr
045       * @param float $timeout
046       * @return resource
047       */
048      public function fsockopen($hostname, $port = -1, &$errno = 0, &$errstr = '', $timeout = null)
049      {
050          $this->handle = fsockopen($hostname, $port, $errno, $errstr, (is_null($timeout) ? ini_get("default_socket_timeout") : $timeout));
051   
052          if ($this->handle != false && $errno === 0 && $errstr === '') {
053              return $this->handle;
054          } else {
055              return false;
056          }
057      }
058   
059      /**
060       * fwrite
061       * 
062       * @see http://php.net/fwrite
063       * @param string $string
064       * @param int $length
065       * @return int | bool
066       */
067      public function fwrite($string, $length = null)
068      {
069          return fwrite($this->handle, $string, (is_null($length) ? strlen($string) : $length));
070      }
071   
072      /**
073       * fgets
074       * 
075       * @see http://php.net/fgets
076       * @param int $length
077       * @return string
078       */
079      public function fgets($length = null)
080      {
081          return fgets($this->handle, $length);
082      }
083   
084      /**
085       * feof
086       * 
087       * @see http://php.net/feof
088       * @return bool
089       */
090      public function feof()
091      {
092          return feof($this->handle);
093      }
094   
095      /**
096       * fclose
097       * 
098       * @see http://php.net/fclose
099       * @return bool
100       */
101      public function fclose()
102      {
103          return fclose($this->handle);
104      }
105  }
106