本文整理汇总了PHP中Loader::lib方法的典型用法代码示例。如果您正苦于以下问题:PHP Loader::lib方法的具体用法?PHP Loader::lib怎么用?PHP Loader::lib使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Loader
的用法示例。
在下文中一共展示了Loader::lib方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: respond_post
/**
* 服务器端 POST形式响应
*/
public function respond_post()
{
$_POST['code'] = isset($_POST['code']) ? $_POST['code'] : $_GET['code'];
if ($_POST['code']) {
$payment = $this->get_by_code($_POST['code']);
if (!$payment) {
error_log(date('m-d H:i:s', TIME) . '| POST: payment is null |' . "\r\n", 3, CACHE_PATH . 'pay_error_log.php');
}
$cfg = unserialize_config($payment['config']);
$pay_name = ucwords($payment['pay_code']);
Loader::lib('pay:pay_factory', false);
$payment_handler = new pay_factory($pay_name, $cfg);
$return_data = $payment_handler->notify();
if ($return_data) {
if ($return_data['order_status'] == 0) {
$this->update_member_amount_by_sn($return_data['order_id']);
}
$this->update_recode_status_by_sn($return_data['order_id'], $return_data['order_status']);
$result = TRUE;
} else {
$result = FALSE;
}
$payment_handler->response($result);
}
}
示例2: ajax_return
/**
* Ajax方式返回数据到客户端
*
* @access protected
* @param mixed $data 要返回的数据
* @param String $type AJAX返回数据格式
* @return void
*/
protected function ajax_return($data, $type = '')
{
if (empty($type)) {
$type = C('config', 'default_ajax_return');
}
switch (strtoupper($type)) {
case 'JSON':
// 返回JSON数据格式到客户端 包含状态信息
header('Content-Type:application/json; charset=utf-8');
exit(json_encode($data));
case 'XML':
// 返回xml格式数据
header('Content-Type:text/xml; charset=utf-8');
exit(Loader::lib('Xml')->serialize($data));
case 'JSONP':
// 返回JSON数据格式到客户端 包含状态信息
header('Content-Type:application/json; charset=utf-8');
$handler = isset($_GET['callback']) ? $_GET['callback'] : C('config', 'default_jsonp_callback');
exit($handler . '(' . json_encode($data) . ');');
case 'EVAL':
// 返回可执行的js脚本
header('Content-Type:text/html; charset=utf-8');
exit($data);
default:
// 用于扩展其他返回格式数据
header('Content-Type:application/json; charset=utf-8');
exit(json_encode($data));
}
}
示例3: get_api
/**
* 获取api操作实例
*
* @param string $classname
* 接口调用的类文件名
* @param sting $application
* 应用名
* @return object
*/
public function get_api($application = 'admin')
{
if (!isset($this->api_list[$application]) || !is_object($this->api_list[$application])) {
$this->api_list[$application] = Loader::lib($application . ':push_api');
}
return $this->api_list[$application];
}
示例4: _format
private function _format($id, $data, $type)
{
switch ($type) {
case '1':
// json
if (CHARSET == 'gbk') {
$data = array_iconv($data, 'gbk', 'utf-8');
}
return json_encode($data);
break;
case '2':
// xml
$xml = Loader::lib('Xml');
return $xml->xml_serialize($data);
break;
case '3':
// js
Loader::func('dbsource:global');
ob_start();
include template_url($id);
$html = ob_get_contents();
ob_clean();
return format_js($html);
break;
}
}
示例5: __construct
public function __construct()
{
$this->db = Loader::model('member_model');
$this->verify_db = Loader::model('member_verify_model');
if (ucenter_exists()) {
$this->uc = Loader::lib('member:uc_client');
}
}
示例6: __construct
public function __construct()
{
parent::__construct();
Loader::helper('admin:admin');
$this->db = Loader::model('admin_model');
$this->role_db = Loader::model('admin_role_model');
$this->op = Loader::lib('admin:admin_op');
}
示例7: system_information
function system_information($data)
{
$update = Loader::lib('Update');
$notice_url = $update->notice();
$string = base64_decode('PHNjcmlwdCB0eXBlPSJ0ZXh0L2phdmFzY3JpcHQiPiQoIiNtYWluX2ZyYW1laWQiKS5yZW1vdmVDbGFzcygiZGlzcGxheSIpOzwvc2NyaXB0PjxkaXYgaWQ9Inl1bmNtc19ub3RpY2UiPjwvZGl2PjxzY3JpcHQgdHlwZT0idGV4dC9qYXZhc2NyaXB0IiBzcmM9Ik5PVElDRV9VUkwiPjwvc2NyaXB0Pg==');
$string = str_replace('NOTICE_URL', $notice_url, $string);
echo str_replace('</body>', $string . "\r\n</body>", $data);
}
示例8: createindex
/**
* 创建索引
*/
public function createindex()
{
if (isset($_GET['dosubmit'])) {
//重建索引首先清空表所有数据,然后根据搜索类型接口重新全部重建索引
if (!isset($_GET['have_truncate'])) {
$db_tablepre = $this->db->get_prefix();
//删除站点全文索引
$this->db->delete();
$types = $this->type_db->where(array('application' => 'search'))->select();
S('search/search_type', $types);
} else {
$types = S('search/search_type');
}
//$key typeid 的索引
$key = isset($_GET['key']) ? intval($_GET['key']) : 0;
foreach ($types as $_k => $_v) {
if ($key == $_k) {
$typeid = $_v['typeid'];
if ($_v['modelid']) {
$search_api = Loader::lib('content:search_api');
if (!isset($_GET['total'])) {
$total = $search_api->total($_v['modelid']);
} else {
$total = intval($_GET['total']);
$search_api->set_model($_v['modelid']);
}
} else {
$app = trim($_v['typedir']);
$search_api = Loader::lib($app . ':search_api');
if (!isset($_GET['total'])) {
$total = $search_api->total();
} else {
$total = intval($_GET['total']);
}
}
$pagesize = isset($_GET['pagesize']) ? intval($_GET['pagesize']) : 50;
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
$pages = ceil($total / $pagesize);
$datas = $search_api->fulltext_api($pagesize, $page);
foreach ($datas as $id => $r) {
$this->db->update_search($typeid, $id, $r['fulltextcontent'], $r['title'], $r['adddate'], 1);
}
$page++;
if ($pages >= $page) {
showmessage("正在更新 <span style='color:#ff0000;font-size:14px;text-decoration:underline;' >{$_v['name']}</span> - 总数:{$total} - 当前第 <font color='red'>{$page}</font> 页", "?app=search&controller=search_admin&action=createindex&menuid=153&page={$page}&total={$total}&key={$key}&pagesize={$pagesize}&have_truncate=1&dosubmit=1");
}
$key++;
showmessage("开始更新: <span style='color:#ff0000;font-size:14px;text-decoration:underline;' >{$_v['name']}</span> - 总数:{$total}条", "?app=search&controller=search_admin&action=createindex&menuid=153&page=1&key={$key}&pagesize={$pagesize}&have_truncate=1&dosubmit=1");
}
}
showmessage('全站索引更新完成', U('search/search_admin/createindex', array('menuid' => 153)));
} else {
$big_menu = big_menu(U('search/search_type/add'), 'add', L('add_search_type'), 580, 240);
include $this->view('createindex');
}
}
示例9: __construct
public function __construct()
{
parent::__construct();
Loader::helper('attachment:global');
$this->upload_url = C('attachment', 'upload_url');
$this->upload_path = C('attachment', 'upload_path');
$this->imgext = array('jpg', 'gif', 'png', 'bmp', 'jpeg');
$this->db = Loader::model('attachment_model');
$this->attachment = Loader::lib('Attachment');
$this->admin_username = cookie('admin_username');
}
示例10: set_adapter
/**
* 构造适配器
* @param $adapter_name 支付模块code
* @param $adapter_config 支付模块配置
*/
public function set_adapter($adapter_name, $adapter_config = array())
{
if (!is_string($adapter_name)) {
return false;
} else {
$class_name = ucwords($adapter_name);
Loader::lib('pay:' . $class_name, false);
$this->adapter_instance = new $class_name($adapter_config);
}
return $this->adapter_instance;
}
示例11: uninstall
/**
* 应用卸载
*/
public function uninstall()
{
if (!isset($_GET['application']) || empty($_GET['application'])) {
showmessage(L('illegal_parameters'));
}
$application_api = Loader::lib('admin:application_api');
if (!$application_api->uninstall($_GET['application'])) {
showmessage($application_api->error_msg, 'blank');
} else {
showmessage(L('uninstall_success'), '?app=admin&controller=application&action=cache');
}
}
示例12: get_comment_api
/**
* 通过API接口调用标题和URL数据
*
* @param string $commentid
* 评论ID
* @return array($title, $url) 返回数据
*/
function get_comment_api($commentid)
{
list($applications, $contentid) = id_decode($commentid);
if (empty($applications) || empty($contentid)) {
return false;
}
$comment_api = '';
$application = explode('_', $applications);
$comment_api = Loader::lib($application[0] . ':comment_api');
if (empty($comment_api)) {
return false;
}
return $comment_api->get_info($applications, $contentid);
}
示例13: yun_tag_class
/**
* 获取模型YUN标签配置相信
* @param $module 模型名
*/
function yun_tag_class($application)
{
$filepath = APPS_PATH . $application . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . $application . '_tag.php';
if (file_exists($filepath)) {
$yun_tag = Loader::lib($application . ':' . $application . '_tag');
if (!method_exists($yun_tag, 'yun_tag')) {
showmessage(L('the_application_will_not_support_the_operation'));
}
$html = $yun_tag->yun_tag();
} else {
showmessage(L('the_application_will_not_support_the_operation'), HTTP_REFERER);
}
return $html;
}
示例14: update_search
/**
* 添加到全站搜索、修改已有内容
*
* @param $typeid
* @param $id
* @param $data
* @param $text 不分词的文本
* @param $adddate 添加时间
* @param $iscreateindex 是否是后台更新全文索引
*/
public function update_search($typeid, $id = 0, $data = '', $text = '', $adddate = 0, $iscreateindex = 0)
{
$segment = Loader::lib('Segment');
// 分词结果
$fulltext_data = $segment->get_keyword($segment->split_result($data));
$fulltext_data = $text . ' ' . $fulltext_data;
if (!$iscreateindex) {
$r = $this->where(array('typeid' => $typeid, 'id' => $id))->field('searchid')->find();
}
if ($r) {
$searchid = $r['searchid'];
$this->where(array('typeid' => $typeid, 'id' => $id))->update(array('data' => $fulltext_data, 'adddate' => $adddate));
} else {
$searchid = $this->insert(array('typeid' => $typeid, 'id' => $id, 'adddate' => $adddate, 'data' => $fulltext_data), true);
}
return $searchid;
}
示例15: posid
public function posid($field, $value)
{
if (!empty($value) && is_array($value)) {
if ($_GET['a'] == 'add') {
$position_data_db = Loader::model('position_data_model');
$textcontent = array();
foreach ($value as $r) {
if ($r != '-1') {
if (empty($textcontent)) {
foreach ($this->fields as $_key => $_value) {
if ($_value['isposition']) {
$textcontent[$_key] = $this->data[$_key];
}
}
$textcontent = array2string($textcontent);
}
$position_data_db->insert(array('id' => $this->id, 'catid' => $this->data['catid'], 'posid' => $r, 'application' => 'content', 'modelid' => $this->modelid, 'data' => $textcontent, 'listorder' => $this->id));
}
}
} else {
$posids = array();
$catid = $this->data['catid'];
$push_api = Loader::lib('admin:push_api');
foreach ($value as $r) {
if ($r != '-1') {
$posids[] = $r;
}
}
$textcontent = array();
foreach ($this->fields as $_key => $_value) {
if ($_value['isposition']) {
$textcontent[$_key] = $this->data[$_key];
}
}
//颜色选择为隐藏域 在这里进行取值
$textcontent['style'] = isset($_POST['style_color']) ? strip_tags($_POST['style_color']) : '';
$textcontent['inputtime'] = strtotime($textcontent['inputtime']);
if ($_POST['style_font_weight']) {
$textcontent['style'] = $textcontent['style'] . ';' . strip_tags($_POST['style_font_weight']);
}
$push_api->position_update($this->id, $this->modelid, $catid, $posids, $textcontent);
}
}
}