本文整理汇总了PHP中String::htmlspecialchars方法的典型用法代码示例。如果您正苦于以下问题:PHP String::htmlspecialchars方法的具体用法?PHP String::htmlspecialchars怎么用?PHP String::htmlspecialchars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类String
的用法示例。
在下文中一共展示了String::htmlspecialchars方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
parent::__construct();
$this->s_db = Loader::model('poster_space_model');
$this->db = Loader::model('poster_model');
$this->M = String::htmlspecialchars(S('common/poster'));
}
示例2: register
/**
* 申请友情链接
*/
public function register()
{
if (isset($_POST['dosubmit'])) {
if ($_POST['name'] == "") {
showmessage(L('sitename_noempty'), U('link/index/register'));
}
if ($_POST['url'] == "") {
showmessage(L('siteurl_not_empty'), U('link/index/register'));
}
if (!in_array($_POST['linktype'], array('0', '1'))) {
$_POST['linktype'] = '0';
}
$link_db = Loader::model('link_model');
$_POST['logo'] = String::htmlspecialchars($_POST['logo']);
if ($_POST['linktype'] == '0') {
$sql = array('typeid' => $_POST['typeid'], 'linktype' => $_POST['linktype'], 'name' => $_POST['name'], 'url' => $_POST['url']);
} else {
$sql = array('typeid' => $_POST['typeid'], 'linktype' => $_POST['linktype'], 'name' => $_POST['name'], 'url' => $_POST['url'], 'logo' => $_POST['logo']);
}
$link_db->insert($sql);
showmessage(L('add_success'), U('link/index'));
} else {
$setting = S('common/link');
if (isset($setting['is_post']) && $setting['is_post'] == '0') {
showmessage(L('suspend_application'), HTTP_REFERER);
}
$this->type = Loader::model('type_model');
$types = $this->type->get_types();
// 获取站点下所有友情链接分类
$SEO = seo('', L('application_links'), '', '');
include template('link', 'register');
}
}
示例3: encode
public function encode($text, $textType = "")
{
if (is_object($text)) {
return $text;
}
return String::htmlspecialchars($text);
}
示例4: type_lists
/**
* 首页 友情链接分类 循环 .
*
* @param
* $data
*/
public function type_lists($data)
{
if (!in_array($data['listorder'], array('desc', 'asc'))) {
$data['listorder'] = 'desc';
}
$sql = array('application' => APP);
$r = $this->type_db->where($sql)->order('listorder ' . $data['listorder'])->limit($data['limit'])->select();
return String::htmlspecialchars($r);
}
示例5: encode
public function encode($text, $textType = "")
{
if (is_object($text)) {
return $text;
}
$textType = Converter::initTextType($textType);
if ($textType == Converter::HTML) {
return $text;
}
return String::htmlspecialchars($text);
}
示例6: init
public function init()
{
if (isset($_GET['typeid'])) {
$where = array('typeid' => intval($_GET['typeid']));
} else {
$where = array();
}
$page = isset($_GET['page']) && intval($_GET['page']) ? intval($_GET['page']) : 1;
$infos = $this->db->where($where)->order('listorder DESC,linkid DESC')->listinfo($page, 15);
$pages = $this->db->pages;
$types = $this->db2->where(array('application' => APP))->order('typeid DESC')->listinfo();
$types = String::htmlspecialchars($types);
$type_arr = array();
foreach ($types as $typeid => $type) {
$type_arr[$type['typeid']] = $type['name'];
}
$big_menu = big_menu('?app=link&controller=link&action=add', 'add', L('link_add'), 700, 450);
include $this->view('link_list');
}
示例7: read_group
/**
* 查看系统短消息
*/
public function read_group()
{
if ((!isset($_GET['group_id']) || empty($_GET['group_id'])) && (!isset($_POST['group_id']) || empty($_POST['group_id']))) {
return false;
}
// 查询消息详情
$infos = $this->message_group_db->getby_id($_GET['group_id']);
$infos = String::htmlspecialchars($infos);
if (!is_array($infos)) {
showmessage(L('message_not_exist'), 'blank');
}
// 检查查看表是否有记录,无则向message_data 插入浏览记录
$check = $this->message_data_db->where(array('userid' => $this->_userid, 'group_message_id' => $_GET['group_id']))->select();
if (!$check) {
$this->message_data_db->insert(array('userid' => $this->_userid, 'group_message_id' => $_GET['group_id']));
}
include template('message', 'read_group');
}
示例8: show_stat
/**
* 统计广告展示次数
*
* @param intval $spaceid 广告版位ID
* @param intval $id 广告ID
* @return boolen
*/
protected function show_stat($spaceid = 0, $id = 0)
{
$M = String::htmlspecialchars(S('common/poster'));
if ($M['enablehits'] == 0) {
return true;
}
$spaceid = intval($spaceid);
$id = intval($id);
if (!$id) {
return false;
}
if (!$spaceid) {
$r = $this->db->where(array('id' => $id))->field('spaceid')->find();
$spaceid = $r['spaceid'];
}
$ip = IP;
$ip_area = Loader::lib('lib/lib_ip');
$area = $ip_area->get($ip);
$username = cookie('username') ? cookie('username') : '';
$this->db->where(array('id' => $id))->update(array('hits' => '+1'));
$this->s_db->insert(array('pid' => $id, 'spaceid' => $spaceid, 'username' => $username, 'area' => $area, 'ip' => $ip, 'referer' => HTTP_REFERER, 'clicktime' => TIME, 'type' => 0));
return true;
}