本文整理汇总了PHP中loader::lib方法的典型用法代码示例。如果您正苦于以下问题:PHP loader::lib方法的具体用法?PHP loader::lib怎么用?PHP loader::lib使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类loader
的用法示例。
在下文中一共展示了loader::lib方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: page_init
function page_init($title = '', $keywords = '', $description = '', $album_id = null, $photo_id = null)
{
$plugin =& loader::lib('plugin');
$head_str = "<title>{$title}</title>\n";
$head_str .= "<meta name=\"keywords\" content=\"{$keywords}\" />\n";
$head_str .= "<meta name=\"description\" content=\"{$description}\" />\n";
$meu_head = $plugin->filter('meu_head', $head_str, $album_id, $photo_id);
$meu_head .= "\n" . '<meta name="generator" content="Mei' . 'u' . 'Pic ' . MPIC_VERSION . '" />' . "\n";
$feed_url = $album_id ? site_link('feed', 'index', array('aid' => $album_id)) : site_link('feed');
$feed_title = $this->setting->get_conf('site.title');
$meu_head .= "<link rel=\"alternate\" title=\"{$feed_title}\" href=\"" . $feed_url . "\" type=\"application/rss+xml\" />\n";
$this->output->set('meu_head', $meu_head);
if ($this->user->loggedin()) {
//更新提示
$this->output->set('update_info', $this->setting->get_conf('update'));
}
$user_status = loader::view('block/user_status', false);
$this->output->set('user_status', $plugin->filter('user_status', $user_status));
$page_head = $plugin->filter('page_head', '', $album_id, $photo_id);
$page_foot = $plugin->filter('page_foot', '', $album_id, $photo_id);
$this->output->set('page_head', $page_head);
$this->output->set('page_foot', $page_foot);
$this->output->set('trash_status', has_trash());
$mdl_nav =& Loader::model('nav');
$nav_menu = $mdl_nav->get_enabled_navs();
$this->output->set('nav_menu', $nav_menu);
//$plugin->filter('main_menu',$nav_menu,$album_id,$photo_id);
}
示例2: fetch
function fetch($file, $templateid = null, $tpldir = null)
{
global $base_path;
$output =& loader::lib('output');
$params = $output->getAll();
extract($params);
if (!$templateid) {
$templateid = TEMPLATEID;
}
$style_path = $base_path . TPLDIR . '/';
$setting =& loader::model('setting');
$theme_config = $setting->get_conf('theme_' . $templateid, array());
if (isset($_config)) {
if ($theme_config) {
$_config = array_merge($_config, $theme_config);
}
} else {
$_config = $theme_config;
}
$footer = '<script src="' . $statics_path . 'js/common.js" type="text/javascript"></script>';
if (isset($loggedin) && $loggedin) {
$footer .= '<script src="' . $statics_path . 'js/admin.js" type="text/javascript"></script>';
}
$footer .= 'Pow' . 'ered by <a href="http://mei' . 'upic.m' . 'eiu.cn/" target="_blank">Mei' . 'uPic ' . MPIC_VERSION . '</a> ';
$footer .= safe_invert($setting->get_conf('site.footer'), true);
$show_process_info = $setting->get_conf('system.show_process_info');
ob_start();
include $this->template($file, $templateid, $tpldir);
$content = ob_get_clean();
return $content;
}
示例3: __construct
public function __construct()
{
if ($this->auth) {
$this->auth();
}
loader::lib("view");
}
示例4: plugin
function plugin($config = null)
{
if (!is_null($config)) {
$this->config = array_merge($this->config, $config);
}
$this->db =& loader::database();
$this->plugin_mgr =& loader::lib('plugin');
}
示例5: parse_uri
/**
* Parse uri
*
* @return array
* @author Lingter
*/
function parse_uri()
{
$arg['ctl'] = isset($_GET['ctl']) ? $_GET['ctl'] : 'default';
$arg['act'] = isset($_GET['act']) ? $_GET['act'] : 'index';
//过滤私有的方法
$arg['act'] = ltrim($arg['act'], '_');
unset($_GET['ctl']);
unset($_GET['act']);
$arg['pars'] = $_GET;
$plugin =& loader::lib('plugin');
$plugin_uri = $plugin->filter('parse_url', $arg);
return $plugin_uri;
}
示例6:
/**
* 装载数据库
*/
function &database($dbstr = 'default', $config = '')
{
if (!isset($GLOBALS[SP_LOADER]['DATABASES'][$dbstr])) {
if (is_array($config)) {
$DB_config = $config;
} else {
$Config =& loader::config();
$DB_config = $Config['database'][$dbstr];
}
$db_class =& loader::lib('db');
$db_class->init($DB_config);
$GLOBALS[SP_LOADER]['DATABASES'][$dbstr] =& $db_class;
}
return $GLOBALS[SP_LOADER]['DATABASES'][$dbstr];
}
示例7:
/**
* 装载数据库
*/
static function &database($dbstr = 'default', $config = '')
{
if (!isset(self::$_databases[$dbstr])) {
if (is_array($config)) {
$DB_config = $config;
} else {
$Config =& loader::config();
$DB_config = $Config['database'][$dbstr];
}
$db_class =& loader::lib('db');
$db_class->init($DB_config);
self::$_databases[$dbstr] = $db_class;
}
return self::$_databases[$dbstr];
}
示例8: index
function index()
{
need_login('page');
$type = intval($this->getGet('type', '1'));
$page = intval($this->getGet('page', 1));
$deleted_albums = $this->mdl_album->get_trash_count();
$deleted_photos = $this->mdl_photo->get_trash_count();
if ($deleted_albums <= 0 && $deleted_photos <= 0) {
trash_status(2);
$this->output->set('isempty', true);
} else {
if ($type == 1) {
$data = $this->mdl_album->get_trash($page);
if (is_array($data['ls'])) {
foreach ($data['ls'] as $k => $v) {
if ($v['cover_id']) {
$cover_info = $this->mdl_photo->get_info($v['cover_id'], 'thumb');
if ($cover_info) {
$data['ls'][$k]['cover_path'] = $cover_info['thumb'];
} else {
$data['ls'][$k]['cover_id'] = 0;
}
}
}
}
} elseif ($type == 2) {
$data = $this->mdl_photo->get_trash($page);
}
$pageurl = site_link('trash', 'index', array('type' => $type, 'page' => '[#page#]'));
$page_obj =& loader::lib('page');
$pagestr = $page_obj->fetch($data['total'], $data['current'], $pageurl);
$this->output->set('isempty', false);
$this->output->set('pagestr', $pagestr);
$this->output->set('data', $data['ls']);
$this->output->set('deleted_albums', $deleted_albums);
$this->output->set('deleted_photos', $deleted_photos);
$this->output->set('type', $type);
}
//面包屑
$crumb_nav = array();
$crumb_nav[] = array('name' => lang('recycle'));
$this->page_crumb($crumb_nav);
$page_title = lang('recycle') . ' - ' . $this->setting->get_conf('site.title');
$page_keywords = $this->setting->get_conf('site.keywords');
$page_description = $this->setting->get_conf('site.description');
$this->page_init($page_title, $page_keywords, $page_description);
$this->render();
}
示例9: _save
function _save()
{
$cache =& loader::lib('cache');
foreach ($this->setting_pool as $k => $values) {
$this->db->select('#@setting', 'value', 'name="' . $k . '"');
$data = $this->db->getOne();
if ($data) {
$keyvalue = unserialize($data);
if (is_array($keyvalue)) {
$keyvalue = array_merge($keyvalue, $values);
} else {
$keyvalue = $values;
}
$this->db->update('#@setting', 'name="' . $k . '"', array('value' => addslashes(serialize($keyvalue))));
$this->db->query();
} else {
$this->db->insert('#@setting', array('name' => $k, 'value' => addslashes(serialize($values))));
$this->db->query();
}
$cache->remove('setting_' . $k);
}
}
示例10: index
function index()
{
global $base_path;
$album_id = intval($this->getGet('aid'));
$search = array();
$siteurl = $this->setting->get_conf('site.url');
$sitename = $this->setting->get_conf('site.title');
$description = $this->setting->get_conf('site.description');
$sitedomain = substr($siteurl, 0, -1 * strlen($base_path));
$feed =& loader::lib('rss');
if ($album_id) {
$search['album_id'] = $album_id;
$album_info = $this->mdl_album->get_info($album_id);
$feed->title = $album_info['name'] . ' - ' . $sitename;
} else {
$feed->title = $sitename;
}
$feed->link = $siteurl;
$feed->description = $description;
$this->mdl_photo->set_pageset(50);
$data = $this->mdl_photo->get_all(1, $search, 'tu_desc');
if ($data['ls']) {
foreach ($data['ls'] as $v) {
$item = new RSSItem();
$item->title = "<![CDATA[ " . $v['name'] . " ]]>";
$item->link = $sitedomain . site_link('photos', 'view', array('id' => $v['id']));
$item->set_pubdate($v['create_time']);
if (!$this->mdl_album->check_album_priv($album_id, isset($album_info) ? $album_info : null)) {
$img = lang('photo_has_priv') . '<br />';
} else {
$img = '<img src="' . $siteurl . $v['path'] . '" /><br />';
}
$item->description = "<![CDATA[ " . $img . $v['desc'] . " ]]>";
$feed->add_item($item);
}
}
$feed->serve();
}
示例11: index
function index()
{
$page = intval($this->getGet('page', 1));
$type = $this->getGet('type');
$this->mdl_tag->set_pageset(40);
$par = array();
if (in_array($type, array(1, 2))) {
$par['type'] = $type;
}
$tags = $this->mdl_tag->get_all($page, $par);
$par['page'] = '[#page#]';
if ($tags['ls']) {
foreach ($tags['ls'] as $k => $v) {
$tags['ls'][$k]['fontsize'] = $this->mdl_tag->get_fontsize($v['count']);
}
}
$page_obj =& loader::lib('page');
$pageurl = site_link('tags', 'index', $par);
$pagestr = $page_obj->fetch($tags['total'], $tags['current'], $pageurl);
$this->output->set('pagestr', $pagestr);
$this->output->set('tag_list', $tags['ls']);
$this->output->set('tag_type', $type);
//面包屑
$crumb_nav = array();
$crumb_nav[] = array('name' => lang('tag_list'), 'link' => site_link('tags'));
if ($type == 1) {
$crumb_nav[] = array('name' => lang('album'));
} elseif ($type == 2) {
$crumb_nav[] = array('name' => lang('photo'));
}
$this->page_crumb($crumb_nav);
$page_title = lang('tag_list') . ' - ' . $this->setting->get_conf('site.title');
$page_keywords = $this->setting->get_conf('site.keywords');
$page_description = $this->setting->get_conf('site.description');
$this->page_init($page_title, $page_keywords, $page_description);
$this->render();
}
示例12: check_login
function check_login()
{
$login_name = safe_convert($this->getPost('login_name'));
$login_pass = $this->getPost('login_pass');
$remember_pass = $this->getPost('remember_pass');
$normal = $this->getPost('normal');
if ($this->setting->get_conf('system.enable_login_captcha')) {
$captcha =& loader::lib('captcha');
if (!$captcha->check($this->getPost('captcha'))) {
form_ajax_failed('text', lang('invalid_captcha_code'));
}
}
if (!$login_name) {
form_ajax_failed('text', lang('username_empty'));
}
if (!$login_pass) {
form_ajax_failed('text', lang('userpass_empty'));
}
if ($remember_pass) {
$expire_time = time() + 86400 * 30;
//记住密码30天
} else {
$expire_time = 0;
}
$go_url = $normal ? site_link('default') : $_SERVER['HTTP_REFERER'];
if ($this->user->set_login($login_name, md5($login_pass), $expire_time)) {
$this->plugin->trigger('user_loged_in', $login_name);
//登录时检查更新
if ($this->setting->get_conf('system.enable_auto_update')) {
check_update();
}
form_ajax_success('box', lang('login_success'), null, 0.5, $go_url);
} else {
form_ajax_failed('text', lang('username_pass_error'));
}
}
示例13: template_url
/**
* 生成模板返回路径
*
* @param integer $id 碎片ID号
* @param string $template 风格
*/
public function template_url($id, $template = '')
{
$filepath = CACHE_PATH . 'template' . DIRECTORY_SEPARATOR . 'block' . DIRECTORY_SEPARATOR . $id . '.php';
$dir = dirname($filepath);
if ($template) {
if (!is_dir($dir)) {
mkdir($dir, 0777, true);
}
$tpl = loader::lib('Template');
$str = $tpl->template_parse(new_stripslashes($template));
@file_put_contents($filepath, $str);
} else {
if (!file_exists($filepath)) {
if (!is_dir($dir)) {
mkdir($dir, 0777, true);
}
$tpl = loader::lib('Template');
$str = $this->db->get_one(array('id' => $id), 'template');
$str = $tpl->template_parse($str['template']);
@file_put_contents($filepath, $str);
}
}
return $filepath;
}
示例14: processImage
function processImage()
{
$this->imgHandler =& loader::lib('image');
if (!$this->imgHandler->load($this->realpath)) {
return false;
}
if ($this->param['zoom']) {
$this->imgHandler->resizeScale($this->param['w'], $this->param['h']);
} elseif ($this->param['w'] && $this->param['h']) {
$this->imgHandler->resizeCut($this->param['w'], $this->param['h']);
} elseif ($this->param['w'] || $this->param['h']) {
$this->imgHandler->resizeTo($this->param['w'], $this->param['h']);
} else {
return false;
}
return true;
}
示例15: ajaxlist
function ajaxlist()
{
$albums = $this->mdl_album->get_kv();
if ($albums) {
$ret = array('ret' => true, 'list' => $albums);
} else {
$ret = array('ret' => false, 'msg' => lang('no_records'));
}
$json =& loader::lib('json');
echo $json->encode($ret);
}