本文整理汇总了PHP中format_js函数的典型用法代码示例。如果您正苦于以下问题:PHP format_js函数的具体用法?PHP format_js怎么用?PHP format_js使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了format_js函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _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;
}
}
开发者ID:hubs,项目名称:yuncms,代码行数:26,代码来源:CallController.php
示例2: init
/**
* 显示心情代码
*/
public function init()
{
$mood_id =& $this->mood_id;
$setting =& $this->setting;
ob_start();
include template('mood', 'index');
$html = ob_get_contents();
ob_clean();
echo format_js($html);
}
开发者ID:hubs,项目名称:yuncms,代码行数:13,代码来源:IndexController.php
示例3: init
public function init() {
$mood_id =& $this->mood_id;
$setting =& $this->setting;
$mood_db = pc_base::load_model('mood_model');
$data = $mood_db->get_one(array('catid'=>$this->catid, 'siteid'=>$this->siteid, 'contentid'=>$this->contentid));
foreach ($setting as $k=>$v) {
$setting[$k]['fields'] = 'n'.$k;
if (!isset($data[$setting[$k]['fields']])) $data[$setting[$k]['fields']] = 0;
if (isset($data['total']) && !empty($data['total'])) {
$setting[$k]['per'] = ceil(($data[$setting[$k]['fields']]/$data['total']) * 60);
} else {
$setting[$k]['per'] = 0;
}
}
ob_start();
include template('mood', 'index');
$html = ob_get_contents();
ob_clean();
echo format_js($html);
}
开发者ID:hxzyzz,项目名称:ddc,代码行数:20,代码来源:index.php
示例4: cache_page
/**
* 写入缓存动态页面
*/
function cache_page($ttl = 360, $isjs = 0)
{
if ($ttl == 0 || !defined('CACHE_PAGE_ID')) {
return false;
}
$contents = ob_get_contents();
if ($isjs) {
$contents = format_js($contents);
}
$contents = "<!--expiretime:" . (SYS_TIME + $ttl) . "-->\n" . $contents;
setcache(CACHE_PAGE_ID, $contents, 'page_tmp/' . substr(CACHE_PAGE_ID, 0, 2));
}
开发者ID:hw18708118867,项目名称:htmlmoban,代码行数:15,代码来源:global.func.php
示例5: show
/**
* 投票显示页
*/
public function show()
{
$type = intval($_GET['type']);
//调用方式ID
$subjectid = abs(intval($_GET['subjectid']));
if (!$subjectid) {
showmessage(L('vote_novote'), 'blank');
}
//取出投票标题
$subject_arr = $this->vote->get_subject($subjectid);
$siteid = $subject_arr['siteid'];
//增加判断,防止模板调用不存在投票时js报错 wangtiecheng
if (!is_array($subject_arr)) {
if (isset($_GET['action']) && $_GET['action'] == 'js') {
exit;
} else {
showmessage(L('vote_novote'), 'blank');
}
}
extract($subject_arr);
//显示模版
$template = $template ? $template : 'vote_tp';
//获取投票选项
$options = $this->vote_option->get_options($subjectid);
//新建一数组用来存新组合数据
$total = 0;
$vote_data = array();
$vote_data['total'] = 0;
//所有投票选项总数
$vote_data['votes'] = 0;
//投票人数
//获取投票结果信息
$infos = $this->vote_data->select(array('subjectid' => $subjectid), 'data');
//循环每个会员的投票记录
foreach ($infos as $subjectid_arr) {
extract($subjectid_arr);
$arr = string2array($data);
foreach ($arr as $key => $values) {
$vote_data[$key] += 1;
}
$total += array_sum($arr);
$vote_data['votes']++;
}
$vote_data['total'] = $total;
//取出投票时间,如果当前时间不在投票时间范围内,则选项变灰不可选
if (date("Y-m-d", SYS_TIME) > $todate || date("Y-m-d", SYS_TIME) < $fromdate) {
$check_status = 'disabled';
$display = 'display:none;';
} else {
$check_status = '';
}
//JS调用
if ($_GET['action'] == 'js') {
if (!function_exists('ob_gzhandler')) {
ob_clean();
}
ob_start();
//$template = 'submit';
$template = $subject_arr['template'];
//根据TYPE值,判断调用模版
switch ($type) {
case 3:
//首页、栏目页调用
$true_template = 'vote_tp_3';
break;
case 2:
//内容页调用
$true_template = 'vote_tp_2';
break;
default:
$true_template = $template;
}
include template('vote', $true_template);
$data = ob_get_contents();
ob_clean();
exit(format_js($data));
}
//SEO设置
$SEO = seo(SITEID, '', $subject, $description, $subject);
//前台投票列表调用默认页面,以免页面样式错乱.
if ($_GET['show_type'] == 1) {
include template('vote', 'vote_tp');
} else {
include template('vote', $template);
}
}
开发者ID:jiangwuzhang,项目名称:phpcms,代码行数:89,代码来源:index.php
示例6: show
/**
* 表单展示
*/
public function show()
{
if (!isset($_GET['formid']) || empty($_GET['formid'])) {
$_GET['action'] ? exit : showmessage(L('form_no_exist'), HTTP_REFERER);
}
$siteid = $_GET['siteid'] ? intval($_GET['siteid']) : 1;
$formid = intval($_GET['formid']);
$r = $this->db->get_one(array('modelid' => $formid, 'siteid' => $siteid, 'disabled' => 0), 'tablename, setting');
if (!$r) {
$_GET['action'] ? exit : showmessage(L('form_no_exist'), HTTP_REFERER);
}
$setting = string2array($r['setting']);
if ($setting['enabletime']) {
if ($setting['starttime'] > SYS_TIME || $setting['endtime'] + 3600 * 24 < SYS_TIME) {
$_GET['action'] ? exit : showmessage(L('form_expired'), APP_PATH . 'index.php?m=formguide&c=index&a=index');
}
}
$userid = param::get_cookie('_userid');
if ($setting['allowunreg'] == 0 && !$userid && $_GET['action'] != 'js') {
showmessage(L('please_login_in'), APP_PATH . 'index.php?m=member&c=index&a=login&forward=' . urlencode(HTTP_REFERER));
}
if (isset($_POST['dosubmit'])) {
$tablename = 'form_' . $r['tablename'];
$this->m_db->change_table($tablename);
$data = array();
require CACHE_MODEL_PATH . 'formguide_input.class.php';
$formguide_input = new formguide_input($formid);
$data = new_addslashes($_POST['info']);
$data = new_html_special_chars($data);
$data = $formguide_input->get($data);
$data['userid'] = $userid;
$data['username'] = param::get_cookie('_username');
$data['datetime'] = SYS_TIME;
$data['ip'] = ip();
$dataid = $this->m_db->insert($data, true);
if ($dataid) {
if ($setting['sendmail']) {
pc_base::load_sys_func('mail');
$mails = explode(',', $setting['mails']);
if (is_array($mails)) {
foreach ($mails as $m) {
sendmail($m, L('tips'), $this->M['mailmessage']);
}
}
}
$this->db->update(array('items' => '+=1'), array('modelid' => $formid, 'siteid' => $this->siteid));
}
showmessage(L('thanks'), APP_PATH);
} else {
if ($setting['allowunreg'] == 0 && !$userid && $_GET['action'] == 'js') {
$no_allowed = 1;
}
pc_base::load_sys_class('form', '', '');
$f_info = $this->db->get_one(array('modelid' => $formid, 'siteid' => $this->siteid));
extract($f_info);
$tablename = 'form_' . $r['tablename'];
$this->m_db->change_table($tablename);
$ip = ip();
$where = array();
if ($userid) {
$where = array('userid' => $userid);
} else {
$where = array('ip' => $ip);
}
$re = $this->m_db->get_one($where, 'datetime');
$setting = string2array($setting);
if ($setting['allowmultisubmit'] == 0 && $re['datetime'] || SYS_TIME - $re['datetime'] < $this->M['interval'] * 60) {
$_GET['action'] ? exit : showmessage(L('had_participate'), APP_PATH . 'index.php?m=formguide&c=index&a=index');
}
require CACHE_MODEL_PATH . 'formguide_form.class.php';
$formguide_form = new formguide_form($formid, $no_allowed);
$forminfos_data = $formguide_form->get();
$SEO = seo($this->siteid, L('formguide'), $name);
if (isset($_GET['action']) && $_GET['action'] == 'js') {
if (!function_exists('ob_gzhandler')) {
ob_clean();
}
ob_start();
}
$template = $_GET['action'] == 'js' ? $js_template : $show_template;
include template('formguide', $template, $default_style);
if (isset($_GET['action']) && $_GET['action'] == 'js') {
$data = ob_get_contents();
ob_clean();
exit(format_js($data));
}
}
}
开发者ID:klj123wan,项目名称:czsz,代码行数:91,代码来源:index.php
示例7: synlogout
public function synlogout($get, $post)
{
$res = '';
foreach ($this->applist as $v) {
if ($v['appid'] != $this->appid) {
$f = strstr($v['url'] . $v['apifilename'], '?') ? '&' : '?';
$res .= '<script type="text/javascript" src="' . $v['url'] . $v['apifilename'] . $f . 'time=' . SYS_TIME . '&code=' . urlencode(sys_auth('action=synlogout&time=' . SYS_TIME, 'ENCODE', $v['authkey'])) . '" reload="1"></script>';
}
}
header("Content-type: text/javascript");
return format_js($res);
}
开发者ID:zhouzhouxs,项目名称:Progect,代码行数:12,代码来源:uc.php
示例8: main_switch
exit;
}
if (isset($_GET["main"])) {
main_switch();
exit;
}
if (isset($_GET["script"])) {
main_switch_scripts();
exit;
}
if (isset($_GET["popup"])) {
popup();
exit;
}
if (isset($_GET["format-index"])) {
format_js();
exit;
}
if (isset($_GET["format-index-popup"])) {
format_popup();
exit;
}
if (isset($_GET["format_type"])) {
format_operation();
exit;
}
if (isset($_GET["change-label-js"])) {
change_label_js();
exit;
}
if (isset($_GET["change-label-popup"])) {
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:31,代码来源:usb.index.php
示例9: mini
public function mini()
{
$_username = cookie('_username');
$_userid = cookie('_userid');
ob_start();
include template('member', 'mini');
$html = ob_get_contents();
ob_clean();
echo format_js($html);
}
开发者ID:hubs,项目名称:yuncms,代码行数:10,代码来源:PassportController.php
示例10: usersMenus
$user=new usersMenus();
if($user->blkid_installed==false){header('location:users.index.php');die();}
if(($user->AsSystemAdministrator==false) OR ($user->AsSambaAdministrator==false)) {die();}
if(isset($_GET["uuid-infos"])){uuid_js();exit;}
if(isset($_GET["uuid-popup"])){uuid_popup();exit;}
if(isset($_GET["js"])){js();exit;}
if(isset($_GET["usb_infos"])){main_usb_infos();exit;}
if(isset($_GET["main"])){main_switch();exit;}
if(isset($_GET["script"])){main_switch_scripts();exit;}
if(isset($_GET["popup"])){popup();exit;}
if(isset($_GET["format-index"])){format_js();exit;}
if(isset($_GET["format-index-popup"])){format_popup();exit;}
if(isset($_GET["format_type"])){format_operation();exit;}
if(isset($_GET["change-label-js"])){change_label_js();exit;}
if(isset($_GET["change-label-popup"])){change_label_popup();exit;}
if(isset($_GET["change-label-perform"])){change_label_perform();exit;}
//umount=yes&uuid=$UUID
if(isset($_GET["umount"])){umount_js();exit;}
if(isset($_GET["umount-index-popup"])){umount_popup();exit;}
if(isset($_GET["umount-mounted"])){umount_mounted();exit;}
//mount=yes&uuid=$UUID&mounted=$path&type=$TYPE
if(isset($_GET["mount"])){mount_js();exit;}
if(isset($_GET["mount-index-popup"])){mount_popup();exit;}
if(isset($_GET["mount-mounted"])){mount_mounted();exit;}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:30,代码来源:usb.index.php
示例11: show
/**
* 表单展示
*/
public function show()
{
if (!isset($_GET['formid']) || empty($_GET['formid'])) {
$_GET['do'] ? exit : showmessage(L('form_no_exist'), HTTP_REFERER);
}
$formid = intval($_GET['formid']);
$r = $this->db->where(array('modelid' => $formid, 'disabled' => 0))->field('tablename, setting')->find();
if (!$r) {
$_GET['do'] ? exit : showmessage(L('form_no_exist'), HTTP_REFERER);
}
$setting = string2array($r['setting']);
if ($setting['enabletime']) {
if ($setting['starttime'] > TIME || $setting['endtime'] + 3600 * 24 < TIME) {
$_GET['do'] ? exit : showmessage(L('form_expired'), U('formguide/index'));
}
}
$userid = cookie('_userid');
if ($setting['allowunreg'] == 0 && !$userid && $_GET['do'] != 'js') {
showmessage(L('please_login_in'), U('member/passport/login', array('forward' => urlencode(HTTP_REFERER))));
}
if (isset($_POST['dosubmit'])) {
$tablename = 'form_' . $r['tablename'];
$this->m_db->change_table($tablename);
$data = array();
require CACHE_MODEL_PATH . 'formguide_input.php';
$formguide_input = new formguide_input($formid);
$data = $formguide_input->get($_POST['info']);
$data['userid'] = !empty($userid) ? $userid : 0;
$data['username'] = cookie('_username');
$data['datetime'] = TIME;
$data['ip'] = IP;
$dataid = $this->m_db->insert($data, true);
if ($dataid) {
if ($setting['sendmail']) {
$mails = explode(',', $setting['mails']);
if (is_array($mails)) {
foreach ($mails as $m) {
sendmail($m, L('tips'), $this->M['mailmessage']);
}
}
}
$this->db->where(array('modelid' => $formid))->update(array('items' => '+=1'));
}
showmessage(L('thanks'), SITE_URL);
} else {
if ($setting['allowunreg'] == 0 && !$userid && $_GET['do'] == 'js') {
$no_allowed = 1;
}
$f_info = $this->db->getby_modelid($formid);
extract($f_info);
$tablename = 'form_' . $r['tablename'];
$this->m_db->change_table($tablename);
$ip = IP;
$where = array();
if ($userid) {
$where = array('userid' => $userid);
} else {
$where = array('ip' => $ip);
}
$re = $this->m_db->where($where)->field('datetime')->find();
$setting = string2array($setting);
if ($setting['allowmultisubmit'] == 0 && isset($re['datetime']) || TIME - $re['datetime'] < $this->M['interval'] * 60) {
$_GET['act'] ? exit : showmessage(L('had_participate'), U('formguide/index/init'));
}
require CACHE_MODEL_PATH . 'formguide_form.php';
$formguide_form = new formguide_form($formid, $no_allowed);
$forminfos_data = $formguide_form->get();
$SEO = seo(L('formguide'), $name);
if (isset($_GET['do']) && $_GET['do'] == 'js') {
if (!function_exists('ob_gzhandler')) {
ob_clean();
}
ob_start();
}
$template = $_GET['do'] == 'js' ? $js_template : $show_template;
include template('formguide', $template, $default_style);
if (isset($_GET['do']) && $_GET['do'] == 'js') {
$data = ob_get_contents();
ob_clean();
exit(format_js($data));
}
}
}
开发者ID:hubs,项目名称:yuncms,代码行数:86,代码来源:IndexController.php
注:本文中的format_js函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论