Fatal Error: Call to undefined function is_loaded() in… em Codeigniter (Objetivo: PayPal Payouts)

Estou com o seguinte erro:

Fatal error: Uncaught Error: Call to undefined function is_loaded() in C:\xampp\htdocs\englishup\paypal\codeigniter\system\core\Controller.php:73 Stack trace: #0 C:\xampp\htdocs\englishup\paypal_test.php(7): CI_Controller->__construct() #1 {main} thrown in C:\xampp\htdocs\englishup\paypal\codeigniter\system\core\Controller.php on line 73

Sou novato em php e estou usando a framework do Codeigniter e meu objetivo é “printar” os dados (HTTP_HEADERS) em forma de URI, ou qualquer outra coisa que eu consiga visualizar para ver se o teste em Payouts (forma de pagamento em massa do PayPal) foi executado com sucesso e está funcionando. Seguem abaixo os códigos completos, mas a pasta completa vocês podem encontrar em: https://github.com/angelleye/paypal-codeigniter ou vocês podem estar baixando por aqui, que é o código mais completo ainda: https://www.codeigniter.com/download

paypal_test.php (está na pasta raiz /www)

<?php $  system_path =  "paypal/codeigniter/system"; define('BASEPATH', str_replace("\", "/", $  system_path));      //SE EU DESABILITAR ESTA LINHA APARECE A MENSAGEM DE ERRO "No direct script access allowed" include "paypal/codeigniter/system/core/Controller.php";      //SE EU DESABILITAR ESTA LINHA APARECE O ERRO "Fatal error: Class 'CI_Controller' not found in C:\xampp\htdocs\englishup\paypal\codeigniter\application\controllers\paypal\templates\Payouts.php on line 13" include "paypal/codeigniter/application/controllers/paypal/templates/Payouts.php"; $  bd = new Payouts(); $  print =  $  bd->paypal_payout(); var_dump($  print); ?> 

Payouts.php (Este é o arquivo principal onde quero que apareçam os dados do teste. Está em /www/paypal/codeigniter/application/controllers/paypal/templates/)

<?php  /** * paypal payouts example for php * if it makes things easier for you can buy me a coffee @ paypal > mohandez@hotmail.com * * @package            PHP * @subpackage        Libraries * @category        Libraries * @author            AbdAllah Khashaba * @link            https://khashabawy.com */ //include "../../../../system/core/Controller.php";    //This is the CI_Controller class class Payouts extends CI_Controller {     public function paypal_payout(){         /// PayPal Data         $  mode = "sandbox";  // change to "live" or "sandbox"         $  paypal_app = array(             "mode" => "sandbox",             "sandbox"=> array(                 "client_id"=>"AQZynIyzCG4ypt_0WXAptzkpDrKAJJ2QxqnGdvatCLV0tdy0ZfkX9RQzBUhVAMJnSVfcWTHxeuwuujGx", // change                 "secret"=>"EKaeJASyyiC67xm6D-iPk06-J0HxfzgrU1BvFGUunP4hFRdzSd72PgqiWQhDyCHJulxqZxk-26A9L_iQ",  // change                 "endpoints"=>array(                     "oauth2" => "https://api.sandbox.paypal.com/v1/oauth2/token",                     "payout" => "https://api.sandbox.paypal.com/v1/payments/payouts",                 )             ),             "live"=> array(                 "client_id"=>"xx",  // change                 "secret"=>"yy",  // change                 "endpoints"=>array(                     "oauth2" => "https://api.paypal.com/v1/oauth2/token",                     "payout" => "https://api.paypal.com/v1/payments/payouts",                 )             )                     );         $  client_id = $  paypal_app[$  mode]["client_id"];         $  secret = $  paypal_app[$  mode]["secret"];         $  endpoints = $  paypal_app[$  mode]["endpoints"];         ////// PayOut data                         $  PO_id = mt_rand(100000000000000,999999999999999);  //time();  change         $  PO_amount = 8.00; // change         $  batch = array(             "sender_batch_header" => array(                 "sender_batch_id" => $  PO_id,                 "email_subject" => "You have a payout!",                 "email_message" => "You have received a payout! Thanks for using our service!",             ),             "items" => array(                 0 => array(                     "recipient_type" => "EMAIL",                     "amount" => array(                         "value" => $  PO_amount,                         "currency" => "BRL",                     ),                     "note"=> "Thanks for your patronage!",                     "sender_item_id"=> "201403140001",                     "receiver"=> "rogeriobsoares5-buyer@gmail.com",                 )             )         );         $  batch_data = json_encode($  batch);                 /// Starting OAuth          $  this->load->library("curl");                 $  endpoint = $  endpoints["oauth2"];         $  this->curl->create($  endpoint);         $  this->curl->ssl(FALSE);                 $  this->curl->post("grant_type=client_credentials");         $  this->curl->http_header("Accept","application/json");         $  this->curl->http_header("Accept-Language","en_US");         $  this->curl->http_login($  client_id,$  secret,"client_credentials");         $  returned = $  this->curl->execute();                 //$  this->curl->debug();                 unset($  this->curl);         $  result = json_decode($  returned);          ///// getting Access Token                       $  nonce = $  result->nonce;         $  access_token = $  result->access_token;         $  token_type = $  result->token_type;         $  app_id = $  result->app_id;         $  expires_in = $  result->expires_in;         ///// PayOut Processing         $  this->load->library("curl");                 $  endpoint = $  endpoints["payout"];                 $  this->curl->create($  endpoint);         $  this->curl->ssl(FALSE);                 $  this->curl->http_header("Content-Type","application/json");         $  this->curl->http_header("Authorization","Bearer $  access_token");                 $  this->curl->post($  batch_data);         $  this->curl->http_login($  client_id,$  secret,"client_credentials");         $  returned = $  this->curl->execute();                 //$  this->curl->debug();                 unset($  this->curl);         $  result = json_decode($  returned);         if($  result && $  result->batch_header->batch_status == "PENDING" ){             $  links = $  result->links;             $  link = $  links[0];             $  endpoint = $  link->href;             $  this->load->library("curl");                     $  this->curl->create($  endpoint);             $  this->curl->ssl(FALSE);                     $  this->curl->http_header("Content-Type","application/json");             $  this->curl->http_header("Authorization","Bearer $  access_token");                                 $  returned = $  this->curl->execute();                                 $  result = json_decode($  returned);         }         echo "<pre>";                 print_r($  result);         echo "</pre>";         $  index1 = $  this->index();             } } ?> 

Controller.php (está em /www/paypal/codeigniter/system/core/)

<?php /**  * CodeIgniter  *  * An open source application development framework for PHP  *  * This content is released under the MIT License (MIT)  *  * Copyright (c) 2014 - 2019, British Columbia Institute of Technology  *  * Permission is hereby granted, free of charge, to any person obtaining a copy  * of this software and associated documentation files (the "Software"), to deal  * in the Software without restriction, including without limitation the rights  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell  * copies of the Software, and to permit persons to whom the Software is  * furnished to do so, subject to the following conditions:  *  * The above copyright notice and this permission notice shall be included in  * all copies or substantial portions of the Software.  *  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN  * THE SOFTWARE.  *  * @package CodeIgniter  * @author  EllisLab Dev Team  * @copyright   Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)  * @copyright   Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)  * @license https://opensource.org/licenses/MIT MIT License  * @link    https://codeigniter.com  * @since   Version 1.0.0  * @filesource  */ defined('BASEPATH') OR exit('No direct script access allowed');  /**  * Application Controller Class  *  * This class object is the super class that every library in  * CodeIgniter will be assigned to.  *  * @package     CodeIgniter  * @subpackage  Libraries  * @category    Libraries  * @author      EllisLab Dev Team  * @link        https://codeigniter.com/user_guide/general/controllers.html  */ class CI_Controller {      /**      * Reference to the CI singleton      *      * @var object      */     private static $  instance;      /**      * Class constructor      *      * @return  void      */     public function __construct()     {         self::$  instance =& $  this;          // Assign all the class objects that were instantiated by the         // bootstrap file (CodeIgniter.php) to local class variables         // so that CI can run as one big super object.         foreach (is_loaded() as $  var => $  class)    //O ERRO TÁ AQUI MEUS CAROS, LINHA 73 (is_loaded() não está definida realmente)         {             $  this->$  var =& load_class($  class);         }          $  this->load =& load_class('Loader', 'core');         $  this->load->initialize();         log_message('info', 'Controller Class Initialized');     }      // --------------------------------------------------------------------      /**      * Get the CI singleton      *      * @static      * @return  object      */     public static function &get_instance()     {         return self::$  instance;     }  } ?> 

Fiz uma busca extensiva de cabo a rabo no Google e pelo que vejo, tem muita gente se queixando dos mesmos erros por mim aqui apresentados. Bom, não sei se é pelo fato de eu ser “newbie” em PHP orientado a objetos… Mas como eliminar o erro inicialmente supracitado e fazer a coisa funcionar? Ou será porque o arquivo principal (paypal_test.php) está fora da pasta (/www/paypal/codeigniter/…)? O que vocês acham? Bom já vos disponibilizei todas as ferramentas…