[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/google/recaptcha/src/ -> autoload.php (source)

   1  <?php
   2  
   3  /* An autoloader for ReCaptcha\Foo classes. This should be required()
   4   * by the user before attempting to instantiate any of the ReCaptcha
   5   * classes.
   6   *
   7   * BSD 3-Clause License
   8   * @copyright (c) 2019, Google Inc.
   9   * @link https://www.google.com/recaptcha
  10   * All rights reserved.
  11   *
  12   * Redistribution and use in source and binary forms, with or without
  13   * modification, are permitted provided that the following conditions are met:
  14   * 1. Redistributions of source code must retain the above copyright notice, this
  15   *    list of conditions and the following disclaimer.
  16   *
  17   * 2. Redistributions in binary form must reproduce the above copyright notice,
  18   *    this list of conditions and the following disclaimer in the documentation
  19   *    and/or other materials provided with the distribution.
  20   *
  21   * 3. Neither the name of the copyright holder nor the names of its
  22   *    contributors may be used to endorse or promote products derived from
  23   *    this software without specific prior written permission.
  24   *
  25   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  26   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  27   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  28   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  29   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  30   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  31   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  32   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  33   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  34   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  35   */
  36  
  37  spl_autoload_register(function ($class) {
  38      if (substr($class, 0, 10) !== 'ReCaptcha\\') {
  39          /* If the class does not lie under the "ReCaptcha" namespace,
  40           * then we can exit immediately.
  41           */
  42          return;
  43      }
  44  
  45      /* All of the classes have names like "ReCaptcha\Foo", so we need
  46       * to replace the backslashes with frontslashes if we want the
  47       * name to map directly to a location in the filesystem.
  48       */
  49      $class = str_replace('\\', '/', $class);
  50  
  51      /* First, check under the current directory. It is important that
  52       * we look here first, so that we don't waste time searching for
  53       * test classes in the common case.
  54       */
  55      $path = dirname(__FILE__).'/'.$class.'.php';
  56      if (is_readable($path)) {
  57          require_once $path;
  58  
  59          return;
  60      }
  61  
  62      /* If we didn't find what we're looking for already, maybe it's
  63       * a test class?
  64       */
  65      $path = dirname(__FILE__).'/../tests/'.$class.'.php';
  66      if (is_readable($path)) {
  67          require_once $path;
  68      }
  69  });


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer