Created
February 2, 2015 10:18
-
-
Save phplaw/d041c91c92d42e4de2b4 to your computer and use it in GitHub Desktop.
CI Loader Helper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function helper($helpers = array()) | |
{ | |
foreach ($this->_ci_prep_filename($helpers, '_helper') as $helper) | |
{ | |
if (isset($this->_ci_helpers[$helper])) | |
{ | |
continue; | |
} | |
$ext_helper = APPPATH.'helpers/'.config_item('subclass_prefix').$helper.'.php'; | |
// Is this a helper extension request? | |
if (file_exists($ext_helper)) | |
{ | |
$base_helper = BASEPATH.'helpers/'.$helper.'.php'; | |
if ( ! file_exists($base_helper)) | |
{ | |
show_error('Unable to load the requested file: helpers/'.$helper.'.php'); | |
} | |
include_once($ext_helper); | |
include_once($base_helper); | |
$this->_ci_helpers[$helper] = TRUE; | |
log_message('debug', 'Helper loaded: '.$helper); | |
continue; | |
} | |
// Try to load the helper | |
foreach ($this->_ci_helper_paths as $path) | |
{ | |
if (file_exists($path.'helpers/'.$helper.'.php')) | |
{ | |
include_once($path.'helpers/'.$helper.'.php'); | |
$this->_ci_helpers[$helper] = TRUE; | |
log_message('debug', 'Helper loaded: '.$helper); | |
break; | |
} | |
} | |
// unable to load the helper | |
if ( ! isset($this->_ci_helpers[$helper])) | |
{ | |
show_error('Unable to load the requested file: helpers/'.$helper.'.php'); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment