本文整理汇总了PHP中is_loaded函数的典型用法代码示例。如果您正苦于以下问题:PHP is_loaded函数的具体用法?PHP is_loaded怎么用?PHP is_loaded使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_loaded函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadLibraries
private function loadLibraries()
{
$loaded_libraries =& is_loaded();
return array_map(function ($item) {
return array('name' => $item);
}, $loaded_libraries);
}
示例2: reset_instance
/**
* 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();
}
示例3: array
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];
}
示例4: __construct
/**
* 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);
}
}
示例5: Controller
/**
* 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->{$var} =& 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->{$attribute})) {
$this->load->{$attribute} =& $this->{$attribute};
}
}
}
log_message('debug', "Controller Class Initialized");
}
示例6: array
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];
}
示例7: array
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];
}
示例8: load_plugin
/**
* 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` = '{$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';
}
示例9: load_class_inc
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);
}
示例10: __construct
/**
* 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->{$var} =& 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");
}
示例11: __construct
/**
* 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->{$var} =& load_class($class);
}
$this->load =& load_class('Loader', 'core');
$this->load->initialize();
log_message('debug', "Controller Class Initialized");
//add by Chaiphet S. Check Authorization
$authorize = $this->session->userdata('userSession');
if ($this->authorization->checkAuthorize(get_class($this))) {
if ($authorize == null) {
$msg = 'Status 501: You have no authentication or your session is time out to access ' . get_class($this);
$msg .= '<br>Please <a href="' . site_url('authentication') . '">log in</a>';
show_error($msg, 501);
} else {
if (!isset($authorize['controller']) || $authorize['controller'] == null || !in_array(get_class($this), $authorize['controller'])) {
show_error('Status 502: You have no authorize to access ' . get_class($this), 502);
}
}
}
}
示例12: __construct
/**
* FA_Controller constructor.
*/
public function __construct()
{
self::$instance =& $this;
foreach (is_loaded() as $var => $class) {
$this->{$var} =& 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');
}
示例13: initialize
/**
* 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;
}
示例14: __construct
public function __construct()
{
self::$instance =& $this;
foreach (is_loaded() as $var => $class) {
$this->{$var} =& load_class($class);
}
$this->load =& load_class('Loader', 'core');
$this->load->initialize();
log_message('debug', "Controller Class Initialized");
}
示例15: initialize
/**
* 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;
}