Skip to content

Instantly share code, notes, and snippets.

@croxton
Created June 13, 2012 16:38
Show Gist options
  • Save croxton/2925181 to your computer and use it in GitHub Desktop.
Save croxton/2925181 to your computer and use it in GitHub Desktop.
Rewrite and extend the Loader class on the fly, to make some useful properties public again
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Rewrite and extend the Loader class on the fly, to make some useful properties public again
*
* @package CodeIgniter
* @author Mark Croxton ([email protected])
* @copyright Copyright (c) 2012 Hallmark Design
* @link http://hallmark-design.co.uk
*/
if ( ! class_exists('CI_Loader2'))
{
$loader2 = file_get_contents(BASEPATH.'core/Loader.php');
$loader2 = str_replace('protected $_ci_cached_vars', 'public $_ci_cached_vars', $loader2);
$loader2 = str_replace('protected $_ci_classes', 'public $_ci_classes', $loader2);
$loader2 = str_replace('class CI_Loader', 'class CI_Loader2', $loader2);
$loader2 = str_replace('<?php', '', $loader2);
eval($loader2); // can you hear those kittens screaming?
}
// extend our rewritten and renamed class
class CI_Loader extends CI_Loader2 {
/**
* Constructor
*/
function __construct()
{
parent::__construct();
}
}
/* End of file Loader.php */
/* Location: ./application/core/Loader.php */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment