本文整理汇总了PHP中htmlspecialchars_decode函数的典型用法代码示例。如果您正苦于以下问题:PHP htmlspecialchars_decode函数的具体用法?PHP htmlspecialchars_decode怎么用?PHP htmlspecialchars_decode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了htmlspecialchars_decode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$this->page();
$flag = false;
if (isset($_GET['sid'])) {
$this->tpl->assign('oneNav', $this->model->findOne());
$this->tpl->assign('prev_url', PREV_URL);
$flag = true;
}
$this->tpl->assign('flag', $flag);
$allNav = $this->model->findAll();
if ($flag) {
$allBrands = $this->brand->getAll();
foreach ($allNav as $key => $value) {
if (!empty($value->brand)) {
$value->brand = unserialize(htmlspecialchars_decode($value->brand));
}
if (Validate::isArray($value->brand)) {
$temp = $value->brand;
$value->brand = '';
foreach ($temp as $val) {
foreach ($allBrands as $k => $v) {
if ($val == $v->id) {
$value->brand[$k] = $v->name;
}
}
}
}
$value->brand = Validate::isArray($value->brand) ? implode(',', $value->brand) : '其他品牌';
}
}
$this->tpl->assign('allNav', $allNav);
$this->tpl->display(ADMIN_STYLE . 'nav/show.tpl');
}
示例2: getCondition
public function getCondition()
{
$data = array();
if (isset($this->input['sort_id'])) {
$data['sort_id'] = trim($this->input['sort_id']);
}
if (isset($this->input['id'])) {
$data['id'] = trim($this->input['id']);
}
if (isset($this->input['subject'])) {
$data['subject'] = trim(htmlspecialchars_decode(urldecode($this->input['subject'])));
}
if (isset($this->input['content'])) {
$data['content'] = trim(htmlspecialchars_decode(urldecode($this->input['content'])));
}
/*
if(isset($this->input['source_url']))
{
$data['source_url'] = trim(htmlspecialchars_decode(urldecode($this->input['source_url'])));
}
if(isset($this->input['source_id']))
{
$data['source_id'] = trim($this->input['source_id']);
}
if(isset($this->input['comtent']))
{
$data['comtent'] = trim(htmlspecialchars_decode(urldecode($this->input['comtent'])));
}
*/
return $data;
}
示例3: shortcode
public function shortcode($atts, $content = null)
{
extract(shortcode_atts(array('fullwidth' => 'true', 'height' => '500', 'src' => '', 'margin_top' => '0', 'margin_bottom' => '0'), $atts));
$fullwidth = apply_filters('dt_sanitize_flag', $fullwidth);
$margin_top = intval($margin_top);
$margin_bottom = intval($margin_bottom);
$height = absint($height);
$height = $height ? $height : 500;
if (!$src && !$content) {
return '';
}
$classes = array('map-container');
if ($fullwidth) {
$classes[] = 'full';
}
$style = array('margin-top: ' . $margin_top . 'px', 'margin-bottom: ' . $margin_bottom . 'px');
$style = implode(';', $style);
$classes = implode(' ', $classes);
if (!$src && $content) {
if (preg_match('/iframe/', $content)) {
$content = str_replace(array('”', '″'), '"', $content);
preg_match('/src=(["\'])(.*?)\\1/', htmlspecialchars_decode($content), $match);
if (!empty($match[2])) {
$src = $match[2];
} else {
return '';
}
} else {
$src = $content;
}
}
$src = add_query_arg('output', 'embed', remove_query_arg('output', $src));
$output = '<div class="' . esc_attr($classes) . '" style="' . esc_attr($style) . '"><iframe src="' . esc_url($src) . '" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="500" height="' . $height . '"></iframe></div>';
return $output;
}
示例4: linkbackUrl
function linkbackUrl($url)
{
$orig = $url;
$url = htmlspecialchars_decode($orig);
$scheme = parse_url($url, PHP_URL_SCHEME);
if (!in_array($scheme, array('http', 'https'))) {
return $orig;
}
// XXX: Do a HEAD first to save some time/bandwidth
$fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
$result = $fetcher->get($url, array('User-Agent: ' . $this->userAgent(), 'Accept: application/html+xml,text/html'));
if (!in_array($result->status, array('200', '206'))) {
return $orig;
}
$pb = null;
$tb = null;
if (array_key_exists('X-Pingback', $result->headers)) {
$pb = $result->headers['X-Pingback'];
} else {
if (preg_match('/<link rel="pingback" href="([^"]+)" ?/?>/', $result->body, $match)) {
$pb = $match[1];
}
}
$tb = $this->getTrackback($result->body, $result->final_url);
if (!empty($tb)) {
$this->trackback($result->final_url, $tb);
} else {
if (!empty($pb)) {
$this->pingback($result->final_url, $pb);
}
}
return $orig;
}
示例5: option_tree_heading
/**
* Heading Option
*
* @access public
* @since 1.0.0
*
* @param array $value
* @param array $settings
* @param int $int
*
* @return string
*/
function option_tree_heading($value, $settings, $int)
{
echo $int > 1 ? '</div>' : false;
echo '<div id="option_' . $value->item_id . '" class="block">';
echo '<h2>' . htmlspecialchars_decode($value->item_title) . '</h2>';
echo '<input type="hidden" name="' . $value->item_id . '" value="' . htmlspecialchars_decode($value->item_title) . '" />';
}
示例6: replaceIdxByData
public static function replaceIdxByData($var)
{
$data = RTEData::get('data', intval($var[1]));
if (isset($data['type'])) {
if (isset($data['wikitextIdx'])) {
$data['wikitext'] = RTEData::get('wikitext', $data['wikitextIdx']);
// macbre: correctly handle and unmark entities inside links wikitext (RT #38844)
$data['wikitext'] = htmlspecialchars_decode($data['wikitext']);
$data['wikitext'] = RTEParser::unmarkEntities($data['wikitext']);
unset($data['wikitextIdx']);
if (strpos($data['wikitext'], '_rte_wikitextidx') !== false) {
RTE::$edgeCases[] = 'COMPLEX.01';
} else {
if (strpos($data['wikitext'], '_rte_dataidx') !== false) {
RTE::$edgeCases[] = 'COMPLEX.02';
} else {
if ($data['type'] == 'double-brackets') {
if (strrpos($data['wikitext'], '{{') !== 0 && strpos($data['wikitext'], '{{') !== strlen($data['wikitext']) - 2) {
RTE::$edgeCases[] = 'COMPLEX.03';
}
} else {
if (strpos($data['wikitext'], "") !== false) {
RTE::$edgeCases[] = 'COMPLEX.07';
}
}
}
}
}
}
return self::convertDataToAttributes($data);
}
示例7: wp_mail_bank_configure
function wp_mail_bank_configure($phpmailer)
{
global $wpdb;
$data = $wpdb->get_row("SELECT * FROM " . wp_mail_bank());
$mail_type = $data->mailer_type;
$phpmailer->Mailer = $data->mailer_type == 0 ? "smtp" : "mail";
$phpmailer->FromName = stripslashes(htmlspecialchars_decode($data->from_name, ENT_QUOTES));
$phpmailer->From = $data->from_email;
$phpmailer->Sender = $data->return_path == 0 ? $data->return_email : $data->from_email;
$phpmailer->WordWrap = $data->word_wrap;
$phpmailer->SMTPOptions = array('ssl' => array('verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true));
if ($data->mailer_type == 0) {
switch ($data->encryption) {
case 0:
$phpmailer->SMTPSecure = "";
break;
case 1:
$phpmailer->SMTPSecure = "ssl";
break;
case 2:
$phpmailer->SMTPSecure = "tls";
break;
}
$phpmailer->Host = $data->smtp_host;
$phpmailer->Port = $data->smtp_port;
if ($data->smtp_keep_alive == 1) {
$phpmailer->SMTPKeepAlive = TRUE;
}
if ($data->authentication == 1) {
$phpmailer->SMTPAuth = TRUE;
$phpmailer->Username = $data->smtp_username;
$phpmailer->Password = $data->smtp_password;
}
}
}
示例8: do_personal_index
/**
* 我的兑换 do_personal_index
*/
public function do_personal_index()
{
/* 初始化变量 */
$user_id = I('get.user_id');
$page_num = I('get.page_num');
$page_num = empty($page_num) || $page_num < 0 ? 1 : $page_num;
/* 查询条件 */
$field = 'pay_order.trade_no,pay_order.shop_coupon_info,pay_order.shop_id,pay_order.trade_state,shop.title as shop_title';
$where['pay_order.user_id'] = array('EQ', $user_id);
$where['pay_order.display'] = array('EQ', 1);
$order = 'pay_order.id desc';
/* 查询数据 */
$list = $this->alias('pay_order')->field($field)->where($where)->join('LEFT JOIN __SHOP__ shop on pay_order.shop_id = shop.id')->order($order)->limit(C('PAGE_NUM'))->page($page_num)->select();
foreach ($list as $k => $v) {
$shop_coupon_info = json_decode($v['shop_coupon_info'], true);
$list[$k]['coupon_id'] = $shop_coupon_info['id'];
$list[$k]['coupon_title'] = $shop_coupon_info['title'];
if ($shop_coupon_info['coupon_type'] == 1) {
$list[$k]['coupon_tag'] = strval(0);
} else {
$list[$k]['coupon_tag'] = $shop_coupon_info['coupon_worth'];
}
$list[$k]['coupon_content'] = $shop_coupon_info['content'];
unset($list[$k]['shop_coupon_info']);
/* 过滤数据 */
if (!empty($v['coupon_title'])) {
$list[$k]['coupon_title'] = htmlspecialchars_decode($v['coupon_title']);
}
}
/* 读取json */
$list = empty($list) ? array() : $list;
$jsonInfo['list'] = arr_content_replace($list);
return $jsonInfo;
}
示例9: fa_cache_avatar
function fa_cache_avatar($avatar, $id_or_email, $size, $default, $alt)
{
$avatar = str_replace(array("www.gravatar.com", "0.gravatar.com", "1.gravatar.com", "2.gravatar.com"), "cn.gravatar.com", $avatar);
$tmp = strpos($avatar, 'http');
$url = get_avatar_url($id_or_email, $size);
$url = str_replace(array("www.gravatar.com", "0.gravatar.com", "1.gravatar.com", "2.gravatar.com"), "cn.gravatar.com", $url);
$avatar2x = get_avatar_url($id_or_email, $size * 2);
$avatar2x = str_replace(array("www.gravatar.com", "0.gravatar.com", "1.gravatar.com", "2.gravatar.com"), "cn.gravatar.com", $avatar2x);
$g = substr($avatar, $tmp, strpos($avatar, "'", $tmp) - $tmp);
$tmp = strpos($g, 'avatar/') + 7;
$f = substr($g, $tmp, strpos($g, "?", $tmp) - $tmp);
$w = home_url();
$e = ABSPATH . 'avatar/' . $size . '*' . $f . '.jpg';
$e2x = ABSPATH . 'avatar/' . $size * 2 . '*' . $f . '.jpg';
$t = 1209600;
if ((!is_file($e) || time() - filemtime($e) > $t) && (!is_file($e2x) || time() - filemtime($e2x) > $t)) {
copy(htmlspecialchars_decode($g), $e);
copy(htmlspecialchars_decode($avatar2x), $e2x);
} else {
$avatar = $w . '/avatar/' . $size . '*' . $f . '.jpg';
$avatar2x = $w . '/avatar/' . $size * 2 . '*' . $f . '.jpg';
if (filesize($e) < 1000) {
copy($w . '/avatar/default.jpg', $e);
}
if (filesize($e2x) < 1000) {
copy($w . '/avatar/default.jpg', $e2x);
}
$avatar = "<img alt='{$alt}' src='{$avatar}' srcset='{$avatar2x}' class='avatar avatar-{$size} photo' height='{$size}' width='{$size}' />";
}
return $avatar;
}
示例10: load_field
public static function load_field()
{
check_ajax_referer('frm_ajax', 'nonce');
$fields = $_POST['field'];
if (empty($fields)) {
wp_die();
}
$_GET['page'] = 'formidable';
$fields = stripslashes_deep($fields);
$ajax = true;
$values = array('id' => FrmAppHelper::get_post_param('form_id', '', 'absint'));
$path = FrmAppHelper::plugin_path();
$field_html = array();
foreach ($fields as $field) {
$field = htmlspecialchars_decode(nl2br($field));
$field = json_decode($field, true);
if (!isset($field['id'])) {
// this field may have already been loaded
continue;
}
$field_id = absint($field['id']);
if (!isset($field['value'])) {
$field['value'] = '';
}
$field_name = 'item_meta[' . $field_id . ']';
$html_id = FrmFieldsHelper::get_html_id($field);
ob_start();
include $path . '/classes/views/frm-forms/add_field.php';
$field_html[$field_id] = ob_get_contents();
ob_end_clean();
}
unset($path);
echo json_encode($field_html);
wp_die();
}
示例11: check
/**
* Overloaded check function
*
* @return boolean
* @see JTable::check
* @since 1.5
*/
function check()
{
jimport('joomla.filter.output');
// Set name
$this->name = htmlspecialchars_decode($this->name, ENT_QUOTES);
// Set alias
$this->alias = JApplication::stringURLSafe($this->alias);
if (empty($this->alias)) {
$this->alias = JApplication::stringURLSafe($this->name);
}
// Check the publish down date is not earlier than publish up.
if (intval($this->publish_down) > 0 && $this->publish_down < $this->publish_up) {
// Swap the dates.
$temp = $this->publish_up;
$this->publish_up = $this->publish_down;
$this->publish_down = $temp;
}
// Set ordering
if ($this->state < 0) {
// Set ordering to 0 if state is archived or trashed
$this->ordering = 0;
} else {
if (empty($this->ordering)) {
// Set ordering to last if ordering was 0
$this->ordering = self::getNextOrder('`catid`=' . $this->_db->Quote($this->catid) . ' AND state>=0');
}
}
return true;
}
示例12: do_redirects
/**
* Do the PHP redirect
*/
public function do_redirects()
{
// Check if PHP redirects are enabled.
if (false == $this->is_php_redirects_enabled()) {
return;
}
// Load redirects.
$redirects = $this->get_redirects();
// Do the actual redirect.
if (!empty($redirects)) {
// Decode the URL.
$url = htmlspecialchars_decode(urldecode($_SERVER['REQUEST_URI']));
foreach ($redirects as $regex => $redirect) {
// Check if the URL matches the $regex.
if (1 === @preg_match("`{$regex}`", $url, $this->url_matches)) {
// Replace the $regex vars with URL matches.
$redirect_url = preg_replace_callback('/[\\$0-9]+/', array($this, 'format_redirect_url'), $redirect['url']);
if ('/' === substr($redirect_url, 0, 1)) {
$redirect_url = home_url($redirect_url);
}
// Do the redirect.
wp_redirect($redirect_url, $redirect['type']);
exit;
}
// Reset url_matches.
$this->url_matches = array();
}
}
}
示例13: update
public function update()
{
if (empty($this->input['id'])) {
$this->errorOutput('ID不能为空');
}
if (empty($this->input['name'])) {
$this->errorOutput('分类名称不能为空');
}
$info = array('title' => $this->input['name'], 'color' => $this->input['color'], 'log' => htmlspecialchars_decode(urldecode($this->input['log'])), 'status' => $this->input['status']);
$info['log'] = json_decode($info['log'], 1);
if ($info['log'][0]['id'] > 0) {
$info['log'] = array('id' => $info['log'][0]['id'], 'host' => $info['log'][0]['host'], 'dir' => $info['log'][0]['dir'], 'filepath' => $info['log'][0]['filepath'], 'filename' => $info['log'][0]['filename']);
} else {
$info['log'] = array('id' => $info['log']['id'], 'host' => $info['log']['host'], 'dir' => $info['log']['dir'], 'filepath' => $info['log']['filepath'], 'filename' => $info['log']['filename']);
}
$info['log'] = json_encode($info['log']);
$sql = "UPDATE " . DB_PREFIX . "group SET ";
$space = '';
foreach ($info as $k => $v) {
$sql .= $space . $k . "='" . $v . "'";
$space = ',';
}
$sql .= " WHERE id=" . intval($this->input['id']);
$this->db->query($sql);
$info['id'] = intval($this->input['id']);
$this->addLogs('修改路况分类', $info, '', $info['title']);
$this->addItem($info);
$this->output();
}
示例14: option_tree_color_scheme
/**
* Color Scheme
*
* @since Lambda 2.0
*
* @param array $value
* @param array $settings
* @param int $int
*
* @return string
*/
function option_tree_color_scheme($value, $settings, $int)
{
?>
<div class="option">
<div class="lambda-opttitle">
<div class="lambda-opttitle-pad">
<?php
echo htmlspecialchars_decode($value->item_title);
?>
<span class="infoButton right">
<img class="infoImage" src="<?php
echo OT_PLUGIN_URL;
?>
/assets/images/info.png" width="40px" height="20px" alt="Info" style="left: 0px;">
</span>
</div>
</div>
<div class="section">
<fieldset id="choosecolor">
<?php
global $theme_path;
$count = 1;
foreach (recognized_color_schemes() as $key => $singlecolor) {
$checked = '';
if ($settings[$value->item_id] == $singlecolor) {
$checked = ' checked="checked"';
}
if ($key == 'Custom' && $value->item_id . '_' . $count == 'color_scheme_1') {
$singlecolor = get_option_tree('themecolor');
$singlecolor = $singlecolor['hex'];
$checked = ' checked="checked"';
}
$datascheme = str_replace(' ', '', $key);
echo '<div class="color-scheme-box" data-scheme="' . trim(strtolower($datascheme)) . '">
<input class="check-with-label" name="' . $value->item_id . '" id="' . $value->item_id . '_' . $count . '" type="radio" value="' . $singlecolor . '"' . $checked . ' />
<label class="label-for-color" for="' . $value->item_id . '_' . $count . '"><div class="color color_scheme_' . $count . '" style="background-color: ' . $singlecolor . ';"><img src="' . $theme_path . '/lambda/assets/images/colorlayer.png"></div></label>
<span class="colorbadge">' . $key . '</span>
</div>';
$count++;
}
?>
</fieldset>
<?php
if ($value->item_desc) {
?>
<div class="desc alert alert-neutral"><?php
echo htmlspecialchars_decode($value->item_desc);
?>
</div>
<div class="clear"></div>
<?php
}
?>
</div>
</div>
<?php
}
示例15: build_meta_box
/**
* Meta box view
*
* @return string
*
* @access public
* @since 1.0
*/
function build_meta_box($post, $metabox)
{
echo '<div class="ot-metabox-wrapper">';
/* Use nonce for verification */
echo '<input type="hidden" name="' . $this->meta_box['id'] . '_nonce" value="' . wp_create_nonce($this->meta_box['id']) . '" />';
/* meta box description */
echo isset($this->meta_box['desc']) && !empty($this->meta_box['desc']) ? '<div class="description" style="padding-top:10px;">' . htmlspecialchars_decode($this->meta_box['desc']) . '</div>' : '';
/* loop through meta box fields */
foreach ($this->meta_box['fields'] as $field) {
/* get current post meta data */
$field_value = get_post_meta($post->ID, $field['id'], true);
/* set standard value */
if (isset($field['std'])) {
$field_value = ot_filter_std_value($field_value, $field['std']);
}
/* build the arguments array */
$_args = array('type' => $field['type'], 'field_id' => $field['id'], 'field_name' => $field['id'], 'field_value' => $field_value, 'field_desc' => isset($field['desc']) ? $field['desc'] : '', 'field_std' => isset($field['std']) ? $field['std'] : '', 'field_rows' => isset($field['rows']) && !empty($field['rows']) ? $field['rows'] : 10, 'field_post_type' => isset($field['post_type']) && !empty($field['post_type']) ? $field['post_type'] : 'post', 'field_taxonomy' => isset($field['taxonomy']) && !empty($field['taxonomy']) ? $field['taxonomy'] : 'category', 'field_min_max_step' => isset($field['min_max_step']) && !empty($field['min_max_step']) ? $field['min_max_step'] : '0,100,1', 'field_class' => isset($field['class']) ? $field['class'] : '', 'field_choices' => isset($field['choices']) ? $field['choices'] : array(), 'field_settings' => isset($field['settings']) && !empty($field['settings']) ? $field['settings'] : array(), 'post_id' => $post->ID, 'meta' => true);
/* only allow simple textarea due to DOM issues with wp_editor() */
if ($_args['type'] == 'textarea') {
$_args['type'] = 'textarea-simple';
}
/* option label */
echo '<div class="format-settings">';
/* don't show title with textblocks */
if ($_args['type'] != 'textblock' && !empty($field['label'])) {
echo '<div class="format-setting-label">';
echo '<label for="' . $_args['field_id'] . '" class="label">' . $field['label'] . '</label>';
echo '</div>';
}
/* get the option HTML */
echo ot_display_by_type($_args);
echo '</div>';
}
echo '</div>';
}