helper() public method

Load a module helper *
public helper ( $helper = [] )
Esempio n. 1
0
 /**
  * Customized loader methods, which will use define_module
  * to load the module definition file if necessary.
  */
 function helper($helper)
 {
     if (!is_array($helper)) {
         self::define_module($helper);
     }
     return parent::helper($helper);
 }
Esempio n. 2
0
 /**
  * Load a helper contained within a module.
  *
  * Copied from MX_Loader, modified to check the /bonfire/helpers directory for
  * a 'BF_' prefixed helper.
  *
  * @param string $helper The helper to load.
  *
  * @return $this
  **/
 public function helper($helper = array())
 {
     if (is_array($helper)) {
         return $this->helpers($helper);
     }
     if (isset($this->_ci_helpers[$helper])) {
         return;
     }
     list($path, $_helper) = Modules::find("{$helper}_helper", $this->_module, 'helpers/');
     if ($path === false) {
         // If the helper was not found in a module, check the traditional locations.
         parent::helper($helper);
         return $this;
     }
     Modules::load_file($_helper, $path);
     $this->_ci_helpers[$_helper] = true;
     return $this;
 }
Esempio n. 3
0
 /**
  * Load a helper contained within a module.
  *
  * Copied from MX_Loader, modified to check the /bonfire/helpers directory for
  * a 'BF_' prefixed helper.
  *
  * @param string $helper The helper to load.
  *
  * @return void;
  **/
 public function helper($helper = array())
 {
     if (is_array($helper)) {
         return $this->helpers($helper);
     }
     if (isset($this->_ci_helpers[$helper])) {
         return;
     }
     list($path, $_helper) = Modules::find($helper . '_helper', $this->_module, 'helpers/');
     if ($path === false) {
         if (file_exists(BFPATH . "helpers/BF_{$helper}_helper.php")) {
             include_once BFPATH . "helpers/BF_{$helper}_helper.php";
         }
         return parent::helper($helper);
     }
     Modules::load_file($_helper, $path);
     $this->_ci_helpers[$_helper] = TRUE;
 }
Esempio n. 4
0
 /**
  * Load a helper contained within a module.
  *
  * Copied from MX_Loader, modified to check the /bonfire/helpers directory for
  * a 'BF_' prefixed helper.
  *
  * @param string $helper The helper to load.
  *
  * @return $this
  **/
 public function helper($helper = array())
 {
     if (is_array($helper)) {
         return $this->helpers($helper);
     }
     if (isset($this->_ci_helpers[$helper])) {
         return;
     }
     list($path, $_helper) = Modules::find("{$helper}_helper", $this->_module, 'helpers/');
     if ($path === false) {
         // If the helper was not found in a module, check for a BF_ prefixed
         // helper in the Bonfire helpers directory.
         if (file_exists(BFPATH . "helpers/BF_{$helper}_helper.php")) {
             include_once BFPATH . "helpers/BF_{$helper}_helper.php";
         }
         parent::helper($helper);
         return $this;
     }
     Modules::load_file($_helper, $path);
     $this->_ci_helpers[$_helper] = true;
     return $this;
 }
Esempio n. 5
0
 /**
  * Load helper, check TrafficTower core helpers.
  *
  * @param array $helper Helper name (or list of helpers)
  */
 public function helper($helper = array())
 {
     if (is_array($helper)) {
         return $this->helpers($helper);
     }
     $tt_helpers = $this->_tt_helpers();
     // Check if is TT helper
     $helper = trim($helper, '/');
     if (in_array(strtolower($helper), $tt_helpers)) {
         // Check for app helper
         if (strpos('/', $helper) === FALSE && $this->_app_helper_exists($helper)) {
             // Manual add (due to lowerize capitals in CI core)
             $app_helper = strpos($helper, '.php') === FALSE ? $helper . '_helper.php' : $helper;
             include_once APPPATH . 'helpers/' . $this->app_prefix . $app_helper;
         }
         $helper = '../../traffictower/helpers/' . $helper;
     }
     parent::helper($helper);
 }
Esempio n. 6
0
 /** Load a module helper **/
 public function helper($helper, $module = NULL)
 {
     if (!isset($module)) {
         $module = $this->_module;
     }
     // FUEL
     if (is_array($helper)) {
         return $this->helpers($helper);
     }
     if (isset($this->_ci_helpers[$helper])) {
         return;
     }
     list($path, $_helper) = Modules::find($helper . '_helper', $module, 'helpers/');
     if ($path === FALSE) {
         return parent::helper($helper);
     }
     Modules::load_file($_helper, $path);
     $this->_ci_helpers[$_helper] = TRUE;
 }