Php if class is loaded

PHP is_loaded Examples

PHP is_loaded — 30 examples found. These are the top rated real world PHP examples of is_loaded extracted from open source projects. You can rate examples to help us improve the quality of examples.

private function loadLibraries() < $loaded_libraries =& is_loaded(); return array_map(function ($item) < return array('name' =>$item); >, $loaded_libraries); >
/** * Reset CodeIgniter instance */ function reset_instance() < // Reset loaded classes load_class('', '', NULL, TRUE); is_loaded('', TRUE); // Close db connection $CI =& get_instance(); if (isset($CI->db)) < if ($CI->db->dsn !== 'sqlite::memory:' && $CI->db->database !== ':memory:') < $CI->db->close(); $CI->db = null; > else < // Don't close if SQLite in-memory database // If we close it, all tables and stored data will be gone load_class_instance('db', $CI->db); > > // Load core classes load_class('Benchmark', 'core'); load_class('Hooks', 'core'); load_class('Config', 'core'); // load_class('Utf8', 'core'); load_class('URI', 'core'); load_class('Router', 'core'); load_class('Output', 'core'); load_class('Security', 'core'); load_class('Input', 'core'); load_class('Lang', 'core'); CIPHPUnitTest::loadLoader(); // Remove CodeIgniter instance $CI = new CIPHPUnitTestNullCodeIgniter(); >
function &load_class($class, $directory = 'libraries', $prefix = 'CI_') < static $_classes = array(); if (isset($_classes[$class])) < return $_classes[$class]; >$name = FALSE; foreach (array(APPPATH, BASEPATH) as $path) < if (file_exists($path . $directory . '/' . $class . '.php')) < $name = $prefix . $class; if (class_exists($name) === FALSE) < require $path . $directory . '/' . $class . '.php'; >break; > > if (file_exists(APPPATH . $directory . '/' . config_item('subclass_prefix') . $class . '.php')) < $name = config_item('subclass_prefix') . $class; if (class_exists($name) === FALSE) < require APPPATH . $directory . '/' . config_item('subclass_prefix') . $class . '.php'; >> if ($name === FALSE) < exit('Unable to locate the specified class: ' . $class . '.php'); >is_loaded($class); $_classes[$class] = new $name(); return $_classes[$class]; >
/** * 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) < $this->$var =& load_class($class); > $this->load =& load_class('Loader', 'core'); $this->load->initialize(); log_message('info', 'Controller Class Initialized'); user_logged_in(); //echo $user_type = $this->session->userdata['department']; $valid_method = get_restricted_department(); $user_type = strtolower($this->session->userdata['department']); if(in_array($user_type, $valid_method)) < user_authentication($user_type); >>
/** * Constructor * * Calls the initialize() function */ function Controller() < parent::CI_Base(); // 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) < $this-> =& load_class($class); > // In PHP 5 the Loader class is run as a discreet // class. In PHP 4 it extends the Controller @PHP4 if (is_php('5.0.0') == TRUE) < $this->load =& load_class('Loader', 'core'); $this->load->_base_classes =& is_loaded(); $this->load->_ci_autoloader(); > else < $this->_ci_autoloader(); // sync up the objects since PHP4 was working from a copy foreach (array_keys(get_object_vars($this)) as $attribute) < if (is_object($this->)) < $this->load-> =& $this->; > > > log_message('debug', "Controller Class Initialized"); >
function &load_class($class, $directory = 'libraries', $prefix = 'CI_') < static $_classes = array(); // Does the class exist? If so, we're done. if (isset($_classes[$class])) < return $_classes[$class]; >$name = false; // Look for the class first in the local application/libraries folder // then in the native system/libraries folder foreach (array(APPPATH, STACKCIEXTPATH, BASEPATH) as $path) < if (file_exists($path . $directory . '/' . $class . '.php')) < $name = $prefix . $class; if (class_exists($name) === false) < require $path . $directory . '/' . $class . '.php'; >break; > > // Is the request a class extension? If so we load it too if (file_exists(APPPATH . $directory . '/' . config_item('subclass_prefix') . $class . '.php')) < $name = config_item('subclass_prefix') . $class; if (class_exists($name) === false) < require APPPATH . $directory . '/' . config_item('subclass_prefix') . $class . '.php'; >> // Did we find the class? if ($name === false) < throw new Exception(sprintf('Unable to locate the specified class: %s.php', $class)); >// Keep track of what we just loaded is_loaded($class); $_classes[$class] = new $name(); return $_classes[$class]; >
function &__load($class, $directory = 'core', $prefix = TF_PREFIX, $from_child = FALSE) < static $_classes = array(); $class = strtoupper($class); $class_name = ''; $the_path = $from_child === TRUE ? TFUSE_CHILD : TFUSE; #check to see if class is already loaded. if true, return class instance from memory if (isset($_classes[$class])) < return $_classes[$class]; >#look in the classes directory and attempt to load $class_name = $prefix . $class; if (file_exists($the_path . '/' . $directory . '/' . $class . '.php')) < if (class_exists($class_name, FALSE) === FALSE) < require_once $the_path . '/' . $directory . '/' . $class . '.php'; >> #check if the class has been found, else die if (class_exists($class_name, FALSE) === FALSE) < exit('Class not found: ' . $class_name); >#load the class is_loaded($class); #load the class in the memory array $_classes[$class] = new $class_name(); #finally return the object instance return $_classes[$class]; >
/** * Turns a plugin on and creates the row to show loading * @global resource * @param string $name name of plugin * @return boolean|string */ function load_plugin($name) < global $database; if ($name == "") < return 'error_plugin_no_name'; >else < if (!alpha($name, 'alpha-underscore')) < return 'error_plugin_name'; >else < if (!is_loaded($name)) < // Insert plugin $database->query("INSERT INTO `plugins` SET `name` = ''"); // That plugin has been loaded. plugin_loaded($name); // Include include BASEPATH . '../plugins/' . $name . '.php'; // Install plugin if (function_exists('install_' . $name)) < // set it up $function = 'install_' . $name; // initiate it $function(); >// Return true return true; > > > return 'error_already_loaded'; >
function load_class_inc($class, $directory = 'libraries') < static $_classes = array(); // Does the class exist? If so, we're done. if (isset($_classes[$class])) < return $_classes[$class]; >$name = FALSE; // Look for the class first in the local application/libraries folder // then in the native system/libraries folder foreach (array(APPPATH, LIBS_PATH, BASEPATH) as $path) < if (file_exists($path . $directory . '/' . $class . '.php')) < $name = $prefix . $class; if (class_exists($name) === FALSE) < require $path . $directory . '/' . $class . '.php'; >break; > > // Did we find the class? if ($name === FALSE) < exit('Unable to locate the specified class: ' . $class . '.php'); >// Keep track of what we just loaded is_loaded($class); >
/** * Constructor */ 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) < $this-> =& load_class($class); > $this->load =& load_class('Loader', 'core'); $this->load->initialize(); if ($this->input->get('lang')) < $lang = $this->input->get('lang'); if ($lang == 'en') < $this->session->set_userdata('lang', 'en'); > else < $this->session->set_userdata('lang', 'fr'); > > $this->language = 'french'; if ($this->session->userdata('lang') == 'en') < $this->language = 'english'; > else < $this->language = 'french'; > $this->lang->load('site', $this->language); log_message('debug', "Controller Class Initialized"); >
/** * FA_Controller constructor. */ public function __construct() < self::$instance =& $this; foreach (is_loaded() as $var =>$class) < $this-> =& load_class($class); > /** * ************************************** * Hook "pre_init_controller" * ************************************** */ $this->hook->action(FA, 'pre_init_controller'); $this->module = $this->router->module(); $this->controller = $this->router->controller(); $this->action = $this->router->action(); /** * Loader class */ $this->load =& load_class('Loader', 'core'); $this->load->initialize(); /** * Declare model object */ $this->model = new \stdClass(); /** * Declare lib object */ $this->lib = new \stdClass(); /** * Log info */ log_message(MSG_INFO, 'Controller Class Initialized'); >
/** * Initialize the Loader * * This method is called once in CI_Controller. * * @param array * @return object */ public function initialize() < $this->_ci_classes = array(); $this->_ci_loaded_files = array(); $this->_ci_models = array(); $this->_base_classes =& is_loaded(); $this->_ci_autoloader(); return $this; >
public function __construct() < self::$instance =& $this; foreach (is_loaded() as $var =>$class) < $this-> =& load_class($class); > $this->load =& load_class('Loader', 'core'); $this->load->initialize(); log_message('debug', "Controller Class Initialized"); >
/** * Initialize the Loader * * This method is called once in CI_Controller. * * @param array * @return object */ public function initialize() < // 必须在子类中做如下初始化,不可直接 parent::initialize() $this->_ci_classes = array(); $this->_ci_loaded_files = array(); $this->_ci_models = array(); $this->_base_classes =& is_loaded(); $this->_ci_autoloader(); return $this; >
/** * Class registry * * @staticvar array $_classes * * @param string $class * @param string $directory * @param array $param * @param bool $reset * @param object $obj * * @return object */ function &load_class($class, $directory = 'libraries', $param = NULL, $reset = FALSE, $obj = NULL) < static $_classes = array(); if ($reset) < // If Utf8 is instantiated twice, // error "Constant UTF8_ENABLED already defined" occurs $UTF8 = $_classes['Utf8']; $_classes = array('Utf8' =>$UTF8); $obj = new stdClass(); return $obj; > // Register object directly if ($obj) < is_loaded($class); $_classes[$class] = $obj; return $_classes[$class]; >// Does the class exist? If so, we're done. if (isset($_classes[$class])) < return $_classes[$class]; >$name = FALSE; // Look for the class first in the local application/libraries folder // then in the native system/libraries folder foreach (array(APPPATH, BASEPATH) as $path) < if (file_exists($path . $directory . '/' . $class . '.php')) < $name = 'CI_' . $class; if (class_exists($name, FALSE) === FALSE) < require_once $path . $directory . '/' . $class . '.php'; >break; > > // Is the request a class extension? If so we load it too if (file_exists(APPPATH . $directory . '/' . config_item('subclass_prefix') . $class . '.php')) < $name = config_item('subclass_prefix') . $class; if (class_exists($name, FALSE) === FALSE) < require_once APPPATH . $directory . '/' . $name . '.php'; >> // Did we find the class? if ($name === FALSE) < // Note: We use exit() rather then show_error() in order to avoid a // self-referencing loop with the Exceptions class set_status_header(503); // changed by ci-phpunit-test $msg = 'Unable to locate the specified class: ' . $class . '.php'; // exit(5); // EXIT_UNK_CLASS throw new CIPHPUnitTestExitException($msg); >// Keep track of what we just loaded is_loaded($class); $_classes[$class] = isset($param) ? new $name($param) : new $name(); return $_classes[$class]; >
/** * Constructor */ 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) < $this-> =& load_class($class); > $this->load =& load_class('Loader', 'core'); $this->load->set_base_classes()->ci_autoloader(); $this->load->model('login_model', '', TRUE); //////CODE EDITED BY JIJI---FROM HERE---///////for language selector $lang_arr = $this->session->userdata('lang_arr'); if (strlen($this->uri->segment(1)) == 2) < for ($i = 0; $i < count($lang_arr); $i++) < if ($this->uri->segment(1) == $lang_arr[$i]['lang_code']) < $this->login_model->setDefaultLang($lang_arr[$i]['lang_id']); $this->lang->load($lang_arr[$i]['lang_name_in_english'], $lang_arr[$i]['lang_name_in_english']); $this->session->set_userdata('tran_language', $lang_arr[$i]['lang_name_in_english']); > > > else < if ($this->session->userdata('tran_language')) < if ($this->checkSession()) < $controler_class = $this->router->class; if ($controler_class != 'login') < $user_type = $this->session->userdata['logged_in']['user_type']; if ($user_type == "employee") < $id = $this->login_model->getAdminid(); $lang_id = $this->login_model->getDefaultLang($id); $language = $this->login_model->getLanguageName($lang_id); $this->lang->load($language, $language); $this->session->set_userdata('tran_language', $language); > else < $user_id = $this->session->userdata['logged_in']['user_id']; $lang_id = $this->login_model->getDefaultLang($user_id); $language = $this->login_model->getLanguageName($lang_id); $this->lang->load($language, $language); $this->session->set_userdata('tran_language', $language); > > > else < $this->lang->load($this->session->userdata('tran_language'), $this->session->userdata('tran_language')); $this->session->set_userdata('tran_language', $this->session->userdata('tran_language')); > > else < $this->lang->load('french', 'french'); $this->session->set_userdata('tran_language', 'french'); > > //////CODE EDITED BY JIJI---UPTO HERE---/////// log_message('debug', "Controller Class Initialized"); >
/** * Constructor */ 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) < $this-> =& load_class($class); > $this->load =& load_class('Loader', 'core'); $this->load->initialize(); >

Источник

Читайте также:  Php list wp plugin
Оцените статью