<commit_before><?php
/**
 * TastyIgniter
 *
 * An open source online ordering, reservation and management system for restaurants.
 *
 * @package   TastyIgniter
 * @author    SamPoyigi
 * @copyright TastyIgniter
 * @link      http://tastyigniter.com
 * @license   http://opensource.org/licenses/GPL-3.0 The GNU GENERAL PUBLIC LICENSE
 * @since     File available since Release 1.0
 */
defined('BASEPATH') or exit('No direct script access allowed');

/* load the HMVC_Loader class */
require IGNITEPATH . 'third_party/MX/Loader.php';

/**
 * TastyIgniter Loader Class
 *
 * @category       Libraries
 * @package        TastyIgniter\Core\TI_Loader.php
 * @link           http://docs.tastyigniter.com
 */
class TI_Loader extends MX_Loader {

    protected $_ci_view_paths =	array(VIEWPATH	=> TRUE, THEMEPATH => TRUE);

    protected $_ci_library_paths =	array(IGNITEPATH, BASEPATH, APPPATH);

    protected $_ci_model_paths =	array(IGNITEPATH, APPPATH);

    protected $_ci_helper_paths =	array(IGNITEPATH, BASEPATH);

    protected $_db_config_loaded =	FALSE;

	/**
     * Initializer
     *
     * @param null $controller
     */
    public function initialize($controller = NULL)
    {
        // Load system configuration from database
        $this->_load_db_config();

        parent::initialize($controller);
    }

    // --------------------------------------------------------------------

    /**
     * Remove later
     * @param $class
     * @param null $params
     * @param null $object_name
     */
    protected function _ci_load_class($class, $params = NULL, $object_name = NULL) {
        return $this->_ci_load_library($class, $params, $object_name);
    }

    // --------------------------------------------------------------------

    /**
     * CI Autoloader
     *
     * Loads component listed in the config/autoload.php file.
     *
     * @used-by CI_Loader::initialize()
     * @return  void
     */
    protected function _ci_autoloader()
    {
        if (file_exists(IGNITEPATH.'config/autoload.php'))
        {
            include(IGNITEPATH.'config/autoload.php');
        }

        if (file_exists(IGNITEPATH.'config/'.ENVIRONMENT.'/autoload.php'))
        {
            include(IGNITEPATH.'config/'.ENVIRONMENT.'/autoload.php');
        }

        if ( ! isset($autoload))
        {
            return;
        }

        // Autoload packages
        if (isset($autoload['packages']))
        {
            foreach ($autoload['packages'] as $package_path)
            {<commit_msg>Improved TI_Loader library view() method to search current theme folder for view file before modules<commit_after><?php
/**
 * TastyIgniter
 *
 * An open source online ordering, reservation and management system for restaurants.
 *
 * @package   TastyIgniter
 * @author    SamPoyigi
 * @copyright TastyIgniter
 * @link      http://tastyigniter.com
 * @license   http://opensource.org/licenses/GPL-3.0 The GNU GENERAL PUBLIC LICENSE
 * @since     File available since Release 1.0
 */
defined('BASEPATH') or exit('No direct script access allowed');

/* load the HMVC_Loader class */
require IGNITEPATH . 'third_party/MX/Loader.php';

/**
 * TastyIgniter Loader Class
 *
 * @category       Libraries
 * @package        TastyIgniter\Core\TI_Loader.php
 * @link           http://docs.tastyigniter.com
 */
class TI_Loader extends MX_Loader {

    protected $_ci_view_paths =	array(VIEWPATH	=> TRUE, THEMEPATH => TRUE);

    protected $_ci_library_paths =	array(IGNITEPATH, BASEPATH, APPPATH);

    protected $_ci_model_paths =	array(IGNITEPATH, APPPATH);

    protected $_ci_helper_paths =	array(IGNITEPATH, BASEPATH);

    protected $_db_config_loaded =	FALSE;

	/**
     * Initializer
     *
     * @param null $controller
     */
    public function initialize($controller = NULL)
    {
        // Load system configuration from database
        $this->_load_db_config();

        parent::initialize($controller);
    }

    // --------------------------------------------------------------------

    /**
     * Remove later
     * @param $class
     * @param null $params
     * @param null $object_name
     */
    protected function _ci_load_class($class, $params = NULL, $object_name = NULL) {
        return $this->_ci_load_library($class, $params, $object_name);
    }

    // --------------------------------------------------------------------

    /** Load a module view **/
    public function view($view, $vars = array(), $return = FALSE)
    {
        $theme_paths = array(
            $this->config->item(APPDIR, 'default_themes'), $this->config->item(APPDIR.'_parent', 'default_themes')
        );

        foreach (array_filter($theme_paths) as $theme_path) {
            $theme_path = rtrim($theme_path, '/');

            foreach (array('/', '/layouts/', '/partials/') as $folder) {
                $t_view = (pathinfo($view, PATHINFO_EXTENSION)) ? $view : $view.EXT;

                if (file_exists(THEMEPATH . $theme_path . $folder . $t_view)) {
                    $path = THEMEPATH . $theme_path . $folder;
                    $this->_ci_view_paths = array($path => TRUE) + $this->_ci_view_paths;
                    break;
                }
            }
        }

        if (empty($path)) {
            list($path, $_view) = Modules::find($view, $this->_module, 'views/');

            if ($path != FALSE) {
                $this->_ci_view_paths = array($path => TRUE) + $this->_ci_view_paths;
                $view = $_view;
            }
        }

        return $this->_ci_load(array('_ci_view' => $view, '_ci_vars' => $this->_ci_object_to_array($vars), '_ci_return' => $return));
    }

    // --------------------------------------------------------------------

    /**
     * CI Autoloader
     *
     * Loads component listed in the config/autoload.php file.
     *
     * @used-by CI_Loader::initialize()
     * @return  void
     */
    protected function _ci_autoloader()
    {
        if (file_exists(IGNITEPATH.'config/autoload.php'))
        {
            include(IGNITEPATH.'config/autoload.php');
        }

        if (file_exists(IGNITEPATH.'config/'.ENVIRONMENT.'/autoload.php'))
        {
            include(IGNITEPATH.'config/'.ENVIRONMENT.'/autoload.php');
        }

        if ( ! isset($autoload))
        {
            return;
        }

        // Autoload packages
        if (isset($autoload['packages']))
        {
            foreach ($autoload['packages'] as $package_path)
            {
{'fraction_non_alphanumeric': 0.17582417582417584, 'fraction_numerical': 0.001238198421297013, 'mean_word_length': 1.9372727272727273, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6068607', 'n_tokens_mistral': 1917, 'n_tokens_neox': 1853, 'n_words': 389}