本文整理匯總了PHP中string::hstripslashes方法的典型用法代碼示例。如果您正苦於以下問題:PHP string::hstripslashes方法的具體用法?PHP string::hstripslashes怎麽用?PHP string::hstripslashes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類string
的用法示例。
在下文中一共展示了string::hstripslashes方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: doedit
function doedit()
{
$fname = string::hstripslashes(str_replace('*', '.', $this->get[2]));
$dir = str_replace('*', '.', $this->get[3]);
if ($this->post['fname'] != "") {
$fname = $this->post['fname'];
}
if ($this->post['dir'] != "") {
$dir = $this->post['dir'];
}
if (!is_writeable($fname)) {
$this->message($this->view->lang['file'] . ' ' . $fname . ' ' . $this->view->lang['cannot_write_edit_online']);
}
if ($this->post['dosubmit']) {
$content = $this->post['content'];
if ($content) {
$content = str_replace(array('\\n', '\\r'), array(chr(10), chr(13)), $content);
}
file_put_contents($fname, stripslashes($content));
$this->message($this->view->lang['operation_success'], "index.php?admin_filemanager-default-" . urlencode($dir));
} else {
$content = file_get_contents($fname);
$filemtime = date("Y-m-d H:i:s", filemtime($fname));
$this->view->assign("fname", $fname);
$this->view->assign("dir", $dir);
$this->view->assign("content", $content);
$this->view->display('admin_fileedit');
}
}
示例2: dosavetemp
function dosavetemp()
{
//將參數寫入臨時文件,等待模板“保存修改”時調用參數,存入到數據庫。
$iseidt = isset($this->post['bid']);
//編輯時
$bid = $iseidt ? $this->post['bid'] : uniqid('hd');
file_exists($this->tempfile) && (include $this->tempfile);
if (strtoupper(WIKI_CHARSET) == 'GBK' && isset($this->post['params'])) {
//ajax在gbk下傳過來的值是utf8的,所以gbk下需要轉碼。
//array_walk($this->post['params'],string::hiconv());
foreach ($this->post['params'] as $key => $val) {
$this->post['params'][$key] = string::hiconv($val);
}
}
$this->post = string::hstripslashes($this->post);
if ($this->post['tplcontent']) {
$tplc = $this->post['tplcontent'];
unset($this->post['tplcontent']);
}
if ($iseidt) {
if (is_numeric($bid)) {
//如果是數字,則有可能是第一次編輯,臨時表中,並沒有他的數據。那麽交給get_setting去處理。
$data = $_ENV['theme']->get_setting($bid);
$temp[$bid]['block'] = $data['block'];
$temp[$bid]['fun'] = $data['fun'];
}
$temp[$bid]['params'] = $this->post['params'];
$cls = $temp[$bid]['block'];
$fun = $temp[$bid]['fun'];
} else {
$cls = $this->post['block'];
$fun = $this->post['fun'];
$temp[$bid] = $this->post;
}
$contents = '<?php $temp=';
$contents .= var_export($temp, true) . ' ?>';
file::writetofile($this->tempfile, $contents);
$this->view->setlang($this->setting['lang_name'], 'front');
//得到數據
$blockfile = $_ENV['global']->block_file($GLOBALS['theme'], "/{$cls}/{$cls}.php");
if (is_file($blockfile)) {
include_once $blockfile;
$obj = new $cls($this);
if (method_exists($obj, $fun)) {
$blockdata = $obj->{$fun}($this->post['params']);
} else {
$blockdata = array();
}
}
//將數據賦值給模板。顯示替換上數據的html代碼。
$this->view->assign('bid', $bid);
$this->view->assign('data', $blockdata);
//2010-11-8模板代碼編輯將文件內容寫入臨時文件,目的是給下麵的預覽時模板調用使用。
$tplfile = HDWIKI_ROOT . "/data/tmp/" . $GLOBALS['theme'] . ".{$cls}.{$fun}.htm";
isset($tplc) && file::writetofile($tplfile, $tplc);
if (file_exists($tplfile)) {
$tplfile = "file://data/tmp/" . $GLOBALS['theme'] . ".{$cls}.{$fun}";
} else {
if (!file_exists(HDWIKI_ROOT . '/block/' . $GLOBALS['theme'] . "/{$cls}/{$fun}.htm")) {
$tplfile = "file://block/default/{$cls}/{$fun}";
} else {
$tplfile = 'file://block/' . $GLOBALS['theme'] . "/{$cls}/{$fun}";
}
}
$this->view->display($tplfile);
}
示例3: donoticemail
function donoticemail()
{
if (!isset($this->post['submit'])) {
if (isset($this->setting['noticemail']) && isset($this->setting['noticemailtpl'])) {
$config = unserialize($this->setting['noticemail']);
$this->view->assign('doc_create', explode(',', $config['doc-create']));
$this->view->assign('doc_edit', explode(',', $config['doc-edit']));
$this->view->assign('comment_add', explode(',', $config['comment_add']));
$configtpl = unserialize($this->setting['noticemailtpl']);
$this->view->assign('noticemailtpl', $configtpl);
} else {
$this->view->assign('doc_create', array());
$this->view->assign('doc_edit', array());
}
$this->load('usergroup');
$groups = $_ENV['usergroup']->get_all_list(-1, 'type asc');
$this->view->assign('groups', $groups);
$this->view->display("admin_noticemail");
} else {
$config['noticemail'] = serialize(array('doc-create' => empty($this->post['doc-create']) ? '' : implode(',', $this->post['doc-create']), 'doc-edit' => empty($this->post['doc-edit']) ? '' : implode(',', $this->post['doc-edit']), 'comment_add' => empty($this->post['comment_add']) ? '' : implode(',', $this->post['comment_add'])));
$this->post['noticemailtpl'] = string::hstripslashes($this->post['noticemailtpl']);
// foreach($this->post['noticemailtpl'] as $key => $val) { //由於已經在base裏執行了 addslashes,此處必須先去掉slashes
// $this->post['noticemailtpl'][$key] = stripslashes($val);
// }
$config['noticemailtpl'] = addslashes(serialize($this->post['noticemailtpl']));
$_ENV['setting']->update_setting($config);
$this->cache->removecache('setting');
$this->message($this->view->lang['commonSuccess'], 'BACK');
}
}
示例4: editsql
function editsql($datacall)
{
if (empty($datacall)) {
return false;
} else {
$datacall['desc'] = !trim($datacall['desc']) ? $this->base->view->lang['sqlcall'] : trim($datacall['desc']);
$datacall['desc'] = string::substring($datacall['desc'], 0, 80);
$datacall['param']['tplcode'] = !trim($datacall['param']['tplcode']) ? '' : trim($datacall['param']['tplcode']);
$datacall['param']['empty_tplcode'] = !trim($datacall['param']['empty_tplcode']) ? '' : trim($datacall['param']['empty_tplcode']);
$param_str = string::haddslashes(serialize(string::hstripslashes($datacall['param'])), 1);
$classname = 'sql';
$function = 'sql';
$type = 'sql';
if (isset($datacall['editflag'])) {
$sql = "UPDATE `" . DB_TABLEPRE . "datacall` SET ";
$sql .= "`name`='" . $datacall['name'] . "',`category`='" . $datacall['category'] . "', `classname`='" . $classname . "', `function`='" . $function . "', `desc`='" . $datacall['desc'] . "', `param`='" . $param_str . "', `cachetime`='" . $datacall['cachetime'] . "'";
$sql .= " WHERE `id`='" . $datacall['id'] . "'";
} else {
$sql = 'INSERT INTO ' . DB_TABLEPRE . 'datacall (`name`,`type`, `category`, `classname`, `function`, `desc`, `param`, `cachetime`) ';
$sql .= " SELECT '" . $datacall['name'] . "','" . $type . "','" . $datacall['category'] . "','" . $classname . "','" . $function . "', ";
$sql .= "'" . $datacall['desc'] . "', '" . $param_str . "', '" . $datacall['cachetime'] . "'";
$sql .= " FROM dual WHERE not exists (SELECT * FROM " . DB_TABLEPRE . "datacall WHERE name= '" . $datacall['name'] . "' )";
}
return $this->db->query($sql);
}
}