本文整理汇总了PHP中load_class函数的典型用法代码示例。如果您正苦于以下问题:PHP load_class函数的具体用法?PHP load_class怎么用?PHP load_class使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了load_class函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filter_regions
/**
* Callback to add filters on top of the result set
*
* @param Form
*/
function filter_regions(&$Form)
{
load_class('regional/model/_country.class.php', 'Country');
$CountryCache =& get_CountryCache(NT_('All'));
$Form->select_country('c', get_param('c'), $CountryCache, T_('Country'), array('allow_none' => true));
$Form->text('s', get_param('s'), 30, T_('Search'), '', 255);
}
示例2: __construct
/**
* Check & Set URI resource to determine the side of application
*
*/
public function __construct()
{
parent::__construct();
$uri =& load_class('URI', 'core');
$admin = $uri->segment(1);
$this->is_admin = $admin == 'administrator' || $admin == 'admin' ? true : false;
}
示例3: login
/**
* 做一个login
*/
public function login()
{
if (IS_AJAX && 'submit' == I('post.submit')) {
//login 操作
$username = I('post.username');
$userpass = I('post.userpass');
//表单令牌
if (token_check() == false) {
printJson(array('tk' => form_token()), 1, '请求超时,请重试');
}
$mod = Factory::getModel('bt_user');
$where = sprintf("username='%s' AND deleted=0", $username);
$row = $mod->field('id,userpass,salt')->where($where)->find();
if (empty($row)) {
printJson(array('tk' => form_token()), 1, '账号不存在');
}
if ($row['userpass'] != md5($userpass . $row['salt'])) {
printJson(array('tk' => form_token()), 1, '账号或者密码不正确');
}
$row['username'] = $username;
session_regenerate_id();
$user_cls = load_class('UserModel');
$user_cls->setSessionUser($row);
printJson(1);
}
$turl = urldecode(I('get.url', url('DiskTop', 'index')));
$this->assign('turl', $turl);
$this->display();
}
示例4: cache_select
public function cache_select()
{
$uid = $_SESSION['uid'];
if (isset($GLOBALS['setcache'])) {
$ids = get_cache('cache_all-' . $uid);
} else {
if (!isset($GLOBALS['ids']) || empty($GLOBALS['ids'])) {
$where = array('keyid' => 'cache_all');
$result = $this->db->get_list('setting', $where, '*', 0, 100);
$ids = array();
foreach ($result as $r) {
$ids[] = $r['id'];
}
} else {
$ids = array_map('intval', $GLOBALS['ids']);
}
set_cache('cache_all-' . $uid, $ids);
}
if (empty($ids)) {
MSG('缓存更新完成', '?m=core&f=cache_all&v=index' . $this->su(), 2000);
}
$id = array_shift($ids);
$r = $this->db->get_one('setting', array('id' => $id));
$caches = load_class($r['f'], $r['m']);
if ($caches->{$r}['v']()) {
set_cache('cache_all-' . $uid, $ids);
MSG($r['data'] . L('update success'), '?m=core&f=cache_all&v=cache_select&setcache=1&' . $this->su(), 200);
} else {
MSG(L('operation failure'));
}
}
示例5: load_class
/**
* Base loader method, uses a directive, unlike the global loader function
* @param string Class directive as `[class].[type]`
* @return class object
**/
protected function load_class($class)
{
$class = strtolower($class);
$type = null;
$_pieces = explode(self::DIRECTIVE_DELIMITER, $class);
switch (count($_pieces)) {
case 1:
$class = $_pieces[0];
$type = $class;
break;
case 2:
$class = $_pieces[1];
$type = $_pieces[0];
break;
case 0:
throw new RuntimeException('class to load not specified');
break;
default:
throw new RuntimeException('class directive not supported');
break;
}
if (!isset($this->{$class})) {
$this->{$class} =& load_class($class, true, $type);
}
$this->is_loaded[] = $class;
return $this->{$class};
}
示例6: _initialize
function _initialize()
{
$CFG =& load_class('Config', 'core');
// If hooks are not enabled in the config file
// there is nothing else to do
if ($CFG->item('enable_hooks') == FALSE) {
return;
}
// Grab the "hooks" definition file.
// If there are no hooks, we're done.
if (defined('ENVIRONMENT') and is_file(ARCHPATH . 'config/' . ENVIRONMENT . '/hooks.php')) {
include ARCHPATH . 'config/' . ENVIRONMENT . '/hooks.php';
} elseif (is_file(ARCHPATH . 'config/hooks.php')) {
include ARCHPATH . 'config/hooks.php';
}
if (defined('ENVIRONMENT') and is_file(APPPATH . 'config/' . ENVIRONMENT . '/hooks.php')) {
include APPPATH . 'config/' . ENVIRONMENT . '/hooks.php';
} elseif (is_file(APPPATH . 'config/hooks.php')) {
include APPPATH . 'config/hooks.php';
}
if (!isset($hook) or !is_array($hook)) {
return;
}
$this->hooks =& $hook;
$this->enabled = TRUE;
}
示例7: parse_bbcode
public static function parse_bbcode($text)
{
if (!$text) {
return false;
}
return self::parse_links(load_class('Services_BBCode')->parse($text));
}
示例8: _initialize
/**
* Initialize the Hooks Preferences
*
* @access private
* @return void
*/
function _initialize()
{
$CFG =& load_class('Config', 'core');
// If hooks are not enabled in the config file
// there is nothing else to do
if ($CFG->item('enable_hooks') == FALSE) {
return;
}
$look_in_dirs = $CFG->look_in_dirs();
// Grab the "hooks" definition file.
// If there are no hooks, we're done.
if (defined('ENVIRONMENT') and is_file(APPPATH . 'config/' . ENVIRONMENT . '/hooks.php')) {
include APPPATH . 'config/' . ENVIRONMENT . '/hooks.php';
} else {
$hook_files = array(NTS_SYSTEM_APPPATH . 'config/hooks.php', APPPATH . 'config/hooks.php');
reset($look_in_dirs);
foreach ($look_in_dirs as $dir) {
$hf = $dir . '/config/hooks.php';
if (file_exists($hf)) {
require $hf;
}
}
}
if (!isset($hook) or !is_array($hook)) {
return;
}
$this->hooks =& $hook;
$this->enabled = TRUE;
}
示例9: __construct
/**
* Class constructor
* @return void
*/
public function __construct()
{
$CFG =& load_class('Config', 'core');
log_message('info', 'Hooks Class Initialized');
if ($CFG->item('enable_hooks') === FALSE) {
return;
}
if (file_exists(COMMONPATH . 'config/hooks.php')) {
include COMMONPATH . 'config/hooks.php';
}
if (file_exists(COMMONPATH . 'config/' . ENVIRONMENT . '/hooks.php')) {
include COMMONPATH . 'config/' . ENVIRONMENT . '/hooks.php';
}
if (file_exists(APPPATH . 'config/hooks.php')) {
include APPPATH . 'config/hooks.php';
}
if (file_exists(APPPATH . 'config/' . ENVIRONMENT . '/hooks.php')) {
include APPPATH . 'config/' . ENVIRONMENT . '/hooks.php';
}
if (!isset($hook) || !is_array($hook)) {
return;
}
$this->hooks =& $hook;
$this->enabled = TRUE;
}
示例10: __construct
public function __construct()
{
self::$obj =& $this;
foreach (is_load() as $key => $value) {
$this->{$key} =& load_class($value);
}
}
示例11: index
function index()
{
$form = load_class('form');
echo '<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" dir="ltr"><head><meta http-equiv="content-type" content="text/html; charset=utf-8"/><title>Plupload - Events example</title>';
echo $form->upload('insert_file_callback');
//include T('attachment','upload','default');
}
示例12: getRoute
/**
* Get Route including 404 check
*
* @see core/CodeIgniter.php
*
* @return array [class, method, pararms]
*/
public function getRoute()
{
$RTR =& load_class('Router', 'core');
$URI =& load_class('URI', 'core');
$e404 = FALSE;
$class = ucfirst($RTR->class);
$method = $RTR->method;
if (empty($class) or !file_exists(APPPATH . 'controllers/' . $RTR->directory . $class . '.php')) {
$e404 = TRUE;
} else {
require_once APPPATH . 'controllers/' . $RTR->directory . $class . '.php';
if (!class_exists($class, FALSE) or $method[0] === '_' or method_exists('CI_Controller', $method)) {
$e404 = TRUE;
} elseif (method_exists($class, '_remap')) {
$params = array($method, array_slice($URI->rsegments, 2));
$method = '_remap';
} elseif (!in_array(strtolower($method), array_map('strtolower', get_class_methods($class)), TRUE)) {
$e404 = TRUE;
}
}
if ($e404) {
// If 404, CodeIgniter instance is not created yet. So create it here.
// Because we need CI->output->_status
$CI =& get_instance();
if ($CI instanceof CIPHPUnitTestNullCodeIgniter) {
CIPHPUnitTest::createCodeIgniterInstance();
}
show_404($RTR->directory . $class . '/' . $method . ' is not found');
}
if ($method !== '_remap') {
$params = array_slice($URI->rsegments, 2);
}
return [$class, $method, $params];
}
示例13: 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");
}
示例14: __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);
}
}
示例15: __construct
public function __construct()
{
$this->config =& load_class('Config', 'core');
$this->config->load('triggers', TRUE);
$this->uri =& load_class('URI', 'core');
log_message('debug', "Router Class Initialized");
}