本文整理汇总了PHP中L函数的典型用法代码示例。如果您正苦于以下问题:PHP L函数的具体用法?PHP L怎么用?PHP L使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了L函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
public function update()
{
//$data = M(MODULE_NAME)->create ();
$data = array();
$data['id'] = intval($_REQUEST['id']);
$data['name'] = strim($_REQUEST['name']);
//$data['content'] = $_REQUEST['content'];
$data['content'] = stripslashes($_REQUEST['content']);
$data['is_html'] = intval($_REQUEST['is_html']);
$return = array('info' => '', 'status' => '0');
if ($data['name'] == '' || $data['id'] == 0) {
$info = l("SELECT_MSG_TPL");
header("Content-Type:text/html; charset=utf-8");
echo $info;
}
$log_info = $data['name'];
// 更新数据
$list = M(MODULE_NAME)->save($data);
if (false !== $list) {
//成功提示
save_log($log_info . L("UPDATE_SUCCESS"), 1);
$info = '"' . L("LANG_" . $data['name']) . '"模板' . L("UPDATE_SUCCESS");
$return['status'] = 1;
header("Content-Type:text/html; charset=utf-8");
echo $info;
} else {
//错误提示
save_log($log_info . L("UPDATE_FAILED"), 0);
$info = L("LANG_" . $data['name']) . "模板" . L("UPDATE_FAILED");
$return['status'] = 0;
header("Content-Type:text/html; charset=utf-8");
echo $info;
}
}
示例2: export_csv
public function export_csv($page = 1)
{
set_time_limit(0);
$limit = ($page - 1) * intval(app_conf("BATCH_PAGE_SIZE")) . "," . intval(app_conf("BATCH_PAGE_SIZE"));
$map['ecv_type_id'] = intval($_REQUEST['ecv_type_id']);
$list = M(MODULE_NAME)->where($map)->limit($limit)->findAll();
if ($list) {
register_shutdown_function(array(&$this, 'export_csv'), $page + 1);
$ecv_value = array('sn' => '""', 'password' => '""', 'money' => '""', 'use_limit' => '""', 'begin_time' => '""', 'end_time' => '""');
if ($page == 1) {
$content = iconv("utf-8", "gbk", "序列号,密码,面额,使用数量,生效时间,过期时间");
$content = $content . "\n";
}
foreach ($list as $k => $v) {
$ecv_value['sn'] = '"' . iconv('utf-8', 'gbk', $v['sn']) . '"';
$ecv_value['password'] = '"' . iconv('utf-8', 'gbk', $v['password']) . '"';
$ecv_value['money'] = '"' . iconv('utf-8', 'gbk', format_price($v['money'])) . '"';
$ecv_value['use_limit'] = '"' . iconv('utf-8', 'gbk', $v['use_limit']) . '"';
$ecv_value['begin_time'] = '"' . iconv('utf-8', 'gbk', to_date($v['begin_time'])) . '"';
$ecv_value['end_time'] = '"' . iconv('utf-8', 'gbk', to_date($v['end_time'])) . '"';
$content .= implode(",", $ecv_value) . "\n";
}
header("Content-Disposition: attachment; filename=voucher_list.csv");
echo $content;
} else {
if ($page == 1) {
$this->error(L("NO_RESULT"));
}
}
}
示例3: show
function show()
{
global $page, $db, $user, $fs, $proj;
$page->setTitle($fs->prefs['page_title'] . L('reports'));
$events = array(1 => L('taskopened'), 13 => L('taskreopened'), 2 => L('taskclosed'), 3 => L('taskedited'), 14 => L('assignmentchanged'), 29 => L('events.useraddedtoassignees'), 4 => L('commentadded'), 5 => L('commentedited'), 6 => L('commentdeleted'), 7 => L('attachmentadded'), 8 => L('attachmentdeleted'), 11 => L('relatedadded'), 12 => L('relateddeleted'), 9 => L('notificationadded'), 10 => L('notificationdeleted'), 17 => L('reminderadded'), 18 => L('reminderdeleted'));
$user_events = array(30 => L('created'), 31 => L('deleted'));
$page->assign('events', $events);
$page->assign('user_events', $user_events);
$sort = strtoupper(Get::enum('sort', array('desc', 'asc')));
$where = array();
$params = array();
$orderby = '';
switch (Get::val('order')) {
case 'type':
$orderby = "h.event_type {$sort}, h.event_date {$sort}";
break;
case 'user':
$orderby = "user_id {$sort}, h.event_date {$sort}";
break;
case 'date':
default:
$orderby = "h.event_date {$sort}, h.event_type {$sort}";
}
foreach (Get::val('events', array()) as $eventtype) {
$where[] = 'h.event_type = ?';
$params[] = $eventtype;
}
$where = '(' . implode(' OR ', $where) . ')';
if ($proj->id) {
$where = $where . 'AND (t.project_id = ? OR h.event_type > 29) ';
$params[] = $proj->id;
}
if (($fromdate = Req::val('fromdate')) || Req::val('todate')) {
$where .= ' AND ';
$todate = Req::val('todate');
if ($fromdate) {
$where .= ' h.event_date > ?';
$params[] = Flyspray::strtotime($fromdate) + 0;
}
if ($todate && $fromdate) {
$where .= ' AND h.event_date < ?';
$params[] = Flyspray::strtotime($todate) + 86400;
} else {
if ($todate) {
$where .= ' h.event_date < ?';
$params[] = Flyspray::strtotime($todate) + 86400;
}
}
}
$histories = array();
if (count(Get::val('events'))) {
if (Get::num('event_number') > 0) {
$db->setLimit(Get::num('event_number'));
}
$histories = $db->x->getAll("SELECT h.*, t.*, p.project_prefix\n FROM {history} h\n LEFT JOIN {tasks} t ON h.task_id = t.task_id\n LEFT JOIN {projects} p ON t.project_id = p.project_id\n WHERE {$where}\n ORDER BY {$orderby}", null, $params);
}
$page->assign('histories', $histories);
$page->assign('sort', $sort);
$page->pushTpl('reports.tpl');
}
示例4: send_reminders
function send_reminders()
{
global $db, $fs;
//we touch the file on every single iteration to avoid
//the possible restart done by Startremiderdaemon method
//in class.flyspray.conf
$notify =& new Notifications();
$user =& new User(0);
$now = time();
$get_reminders = $db->Query("SELECT r.*, t.*, p.*\n FROM {reminders} r\n INNER JOIN {users} u ON u.user_id = r.to_user_id\n INNER JOIN {tasks} t ON r.task_id = t.task_id\n INNER JOIN {projects} p ON t.project_id = p.project_id\n WHERE t.is_closed = '0' AND r.start_time < ?\n AND r.last_sent + r.how_often < ?\n ORDER BY r.reminder_id", array(time(), time()));
while ($row = $db->FetchRow($get_reminders)) {
$jabber_users = array();
$email_users = array();
// Get the user's notification type and address
$get_details = $db->Query("SELECT notify_type, jabber_id, email_address\n FROM {users}\n WHERE user_id = ?", array($row['to_user_id']));
while ($subrow = $db->FetchRow($get_details)) {
if ($fs->prefs['user_notify'] == '1' && $subrow['notify_type'] == '1' or $fs->prefs['user_notify'] == '2') {
$email_users[] = $subrow['email_address'];
} elseif ($fs->prefs['user_notify'] == '1' && $subrow['notify_type'] == '2' or $fs->prefs['user_notify'] == '3') {
$jabber_users[] = $subrow['jabber_id'];
}
}
$subject = L('notifyfromfs');
$message = $row['reminder_message'];
// Pass the recipients and message onto the notification function
$notify->SendEmail($email_users, $subject, $message);
$notify->StoreJabber($jabber_users, $subject, $message);
// Update the database with the time sent
$update_db = $db->Query("UPDATE {reminders}\n SET last_sent = ?\n WHERE reminder_id = ?", array(time(), $row['reminder_id']));
}
// send those stored notifications
$notify->SendJabber();
unset($notify, $user);
}
示例5: run
public function run(&$_data)
{
$engine = strtolower(C('TMPL_ENGINE_TYPE'));
$_content = empty($_data['content']) ? $_data['file'] : $_data['content'];
$_data['prefix'] = !empty($_data['prefix']) ? $_data['prefix'] : C('TMPL_CACHE_PREFIX');
if ('think' == $engine) {
// 采用Think模板引擎
if (!empty($_data['content']) && $this->checkContentCache($_data['content'], $_data['prefix']) || $this->checkCache($_data['file'], $_data['prefix'])) {
// 缓存有效
//载入模版缓存文件
Storage::load(C('CACHE_PATH') . $_data['prefix'] . md5($_content) . C('TMPL_CACHFILE_SUFFIX'), $_data['var'], 'tpl');
} else {
$tpl = Think::instance('Think\\Template');
// 编译并加载模板文件
$tpl->fetch($_content, $_data['var'], $_data['prefix']);
}
} else {
// 调用第三方模板引擎解析和输出
if (strpos($engine, '\\')) {
$class = $engine;
} else {
$class = 'Think\\Template\\Driver\\' . ucwords($engine);
}
if (class_exists($class)) {
$tpl = new $class();
$tpl->fetch($_content, $_data['var']);
} else {
// 类没有定义
E(L('_NOT_SUPPORT_') . ': ' . $class);
}
}
}
示例6: index
/**
* 显示菜单
*/
public function index()
{
if (empty($_REQUEST['cid'])) {
$navcat = $this->navcat_model->find();
$cid = $navcat['navcid'];
} else {
$cid = $_REQUEST['cid'];
}
$result = $this->nav_model->where("cid={$cid}")->order(array("listorder" => "ASC"))->select();
import("Tree");
$tree = new \Tree();
$tree->icon = array(' │ ', ' ├─ ', ' └─ ');
$tree->nbsp = ' ';
foreach ($result as $r) {
$r['str_manage'] = '<a href="' . U("nav/add", array("parentid" => $r['id'], "cid" => $r['cid'])) . '">' . L('ADD_SUB_NAV') . '</a> | <a href="' . U("nav/edit", array("id" => $r['id'], "parentid" => $r['parentid'], "cid" => $r['cid'])) . '">' . L('EDIT') . '</a> | <a class="js-ajax-delete" href="' . U("nav/delete", array("id" => $r['id'])) . '">' . L('DELETE') . '</a> ';
$r['status'] = $r['status'] ? L('DISPLAY') : L('HIDDEN');
$array[] = $r;
}
$tree->init($array);
$str = "<tr>\r\n\t\t\t\t<td><input name='listorders[\$id]' type='text' size='3' value='\$listorder' class='input input-order'></td>\r\n\t\t\t\t<td>\$id</td>\r\n\t\t\t\t<td >\$spacer\$label</td>\r\n\t\t\t <td>\$status</td>\r\n\t\t\t\t<td>\$str_manage</td>\r\n\t\t\t</tr>";
$categorys = $tree->get_tree(0, $str);
$this->assign("categorys", $categorys);
$cats = $this->navcat_model->select();
$this->assign("navcats", $cats);
$this->assign("navcid", $cid);
$this->display();
}
示例7: loginoutOp
public function loginoutOp()
{
session_unset();
session_destroy();
setNcCookie('goodsnum', '', -3600);
showDialog(L('login_logout_success'), '', 'succ', '', 2);
}
示例8: B
function B($a)
{
if (C($a)) {
$this->D($a);
} elseif ($a instanceof E) {
$a->F($this);
} elseif (G($a)) {
} elseif (H($a)) {
I($a);
foreach ($a as $b => $c) {
if (J($b)) {
if (!H($c) || !L('M', $c) || !L('O', $c)) {
throw new P('Q');
}
$d = isset($c['R']) ? $c['R'] : [];
$b = $c['M'];
$c = $c['O'];
} elseif (H($c) && L('O', $c)) {
$d = isset($c['R']) ? $c['R'] : [];
$c = $c['O'];
} else {
$d = [];
}
$this->AB($b);
$this->AC($d);
$this->B($c);
$this->AE();
}
} elseif (AF($a)) {
throw new P('AH' . AI($a));
}
}
示例9: search_log
/**
* 日志搜索
*/
public function search_log()
{
$where = '';
extract($_GET['search'], EXTR_SKIP);
if ($username) {
$where .= $where ? " AND username='{$username}'" : " username='{$username}'";
}
if ($module) {
$where .= $where ? " AND module='{$module}'" : " module='{$module}'";
}
if ($start_time && $end_time) {
$start = $start_time;
$end = $end_time;
$where .= "AND `time` >= '{$start}' AND `time` <= '{$end}' ";
}
$page = isset($_GET['page']) && intval($_GET['page']) ? intval($_GET['page']) : 1;
$infos = $this->db->listinfo($where, $order = 'logid DESC', $page, $pages = '12');
$pages = $this->db->pages;
//模块数组
$module_arr = array();
$modules = getcache('modules', 'commons');
$default = $module ? $module : L('open_module');
//未设定则显示 不限模块 ,设定则显示指定的
foreach ($modules as $module => $m) {
$module_arr[$m['module']] = $m['module'];
}
include $this->admin_tpl('log_search_list');
}
示例10: update
public function update()
{
$conf_res = M("Conf")->where("is_effect = 1 and is_conf = 1")->findAll();
foreach ($conf_res as $k => $v) {
conf($v['name'], $_REQUEST[$v['name']]);
if ($v['name'] == 'URL_MODEL' && $v['value'] != $_REQUEST[$v['name']]) {
clear_dir_file(get_real_path() . "public/runtime/app/data_caches/");
clear_dir_file(get_real_path() . "public/runtime/app/tpl_caches/");
clear_dir_file(get_real_path() . "public/runtime/app/tpl_compiled/");
clear_dir_file(get_real_path() . "public/runtime/app/data_caches/");
clear_dir_file(get_real_path() . "public/runtime/data/page_static_cache/");
clear_dir_file(get_real_path() . "public/runtime/data/dynamic_avatar_cache/");
}
}
//开始写入配置文件
$sys_configs = M("Conf")->findAll();
$config_str = "<?php\n";
$config_str .= "return array(\n";
foreach ($sys_configs as $k => $v) {
$config_str .= "'" . $v['name'] . "'=>'" . addslashes($v['value']) . "',\n";
}
$config_str .= ");\n ?>";
$filename = get_real_path() . "public/sys_config.php";
if (!($handle = fopen($filename, 'w'))) {
$this->error(l("OPEN_FILE_ERROR") . $filename);
}
if (fwrite($handle, $config_str) === FALSE) {
$this->error(l("WRITE_FILE_ERROR") . $filename);
}
fclose($handle);
save_log(l("CONF_UPDATED"), 1);
//clear_cache();
write_timezone();
$this->success(L("UPDATE_SUCCESS"));
}
示例11: getType
public function getType()
{
//$map = "uid = 0 or uid = ".$this->mid;
//$friendType = D("FriendGroup")->where($map)->field("id,name")->findAll();
$typeId = array(array('id' => 1, 'name' => L('follow_each_other')), array('id' => 2, 'name' => L('following')), array('id' => 3, 'name' => L('follower')));
echo json_encode($typeId);
}
示例12: __construct
public function __construct()
{
$this->contentid = isset($_GET['contentid']) && trim(urldecode($_GET['contentid'])) ? trim(urldecode($_GET['contentid'])) : $this->_show_msg(L('illegal_parameters'));
$this->contentid = safe_replace($this->contentid);
$this->db = Loader::model('digg_model');
$this->db_log = Loader::model('digg_log_model');
}
示例13: index
/**
* 我的收藏页面
*/
public function index()
{
$map['uid'] = $GLOBALS['ts']['uid'];
$weiboSet = model('Xdata')->get('admin_Config:feed');
$this->assign($weiboSet);
// TODO:后续可能由表中获取语言KEY
$d['tabHash'] = array('feed' => L('PUBLIC_WEIBO'));
$d['tab'] = model('Collection')->getCollTab($map);
$this->assign($d);
// 安全过滤
$t = t($_GET['t']);
!empty($t) && ($map['source_table_name'] = $t);
$key = t($_POST['collection_key']);
if ($key === '') {
$list = model('Collection')->getCollectionList($map, 20);
} else {
$list = model('Collection')->searchCollections($key, 20);
$this->assign('collection_key', $key);
$this->assign('jsonKey', json_encode($key));
}
$this->assign($list);
$this->setTitle(L('PUBLIC_COLLECTION_INDEX'));
// 我的收藏
// 是否有返回按钮
$this->assign('isReturn', 1);
// 获取用户统计信息
$userData = model('UserData')->getUserData($GLOBALS['ts']['mid']);
$this->assign('favoriteCount', $userData['favorite_count']);
$userInfo = model('User')->getUserInfo($this->mid);
$this->setTitle('我的收藏');
$this->setKeywords($userInfo['uname'] . '的收藏');
$this->display();
}
示例14: init
public function init()
{
$page = isset($_GET['page']) && intval($_GET['page']) ? intval($_GET['page']) : 1;
$userid = param::get_cookie('_userid');
$sql = " `userid` = '{$userid}'";
if (isset($_GET['dosubmit'])) {
$type = isset($_GET['type']) && intval($_GET['type']) ? intval($_GET['type']) : '';
$endtime = isset($_GET['endtime']) && trim($_GET['endtime']) ? strtotime(trim($_GET['endtime'])) : '';
$starttime = isset($_GET['starttime']) && trim($_GET['starttime']) ? strtotime(trim($_GET['starttime'])) : '';
if (!empty($starttime) && empty($endtime)) {
$endtime = SYS_TIME;
}
if (!empty($starttime) && !empty($endtime) && $endtime < $starttime) {
showmessage(L('wrong_time_over_time_to_time_less_than'));
}
if (!empty($starttime)) {
$sql .= $sql ? " AND `creat_at` BETWEEN '{$starttime}' AND '{$endtime}' " : " `creat_at` BETWEEN '{$starttime}' AND '{$endtime}' ";
}
if (!empty($type)) {
$sql .= $sql ? " AND `type` = '{$type}' " : " `type` = '{$type}'";
}
}
$list = $this->spend_db->listinfo($sql, '`id` desc', $page);
$pages = $this->spend_db->pages;
include template('pay', 'spend_list');
}
示例15: respond_get
/**
* return_url get形式响应
*/
public function respond_get()
{
if ($_GET['code']) {
$payment = $this->get_by_code($_GET['code']);
if (!$payment) {
showmessage(L('payment_failed'));
}
$cfg = unserialize_config($payment['config']);
$pay_name = ucwords($payment['pay_code']);
pc_base::load_app_class('pay_factory', '', 0);
$payment_handler = new pay_factory($pay_name, $cfg);
$return_data = $payment_handler->receive();
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']);
showmessage(L('pay_success'), APP_PATH . 'index.php?m=pay&c=deposit');
} else {
showmessage(L('pay_failed'), APP_PATH . 'index.php?m=pay&c=deposit');
}
} else {
showmessage(L('pay_success'));
}
}