本文整理汇总了PHP中html::specialchars方法的典型用法代码示例。如果您正苦于以下问题:PHP html::specialchars方法的具体用法?PHP html::specialchars怎么用?PHP html::specialchars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类html
的用法示例。
在下文中一共展示了html::specialchars方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct()
{
parent::__construct("feed");
/* Set feed ID and self link. */
$this->id(html::specialchars(url::abs_current()));
$this->link()->rel("self")->href(url::abs_current());
}
示例2: content
public function content($text, $type = "html")
{
$content = $this->dom->createElement("content", html::specialchars($text));
$content->setAttribute("type", $type);
$this->element->appendChild($content);
return $this;
}
示例3: anchor
/**
* Create HTML link anchors.
*
* @param string URL or URI string
* @param string link text
* @param array HTML anchor attributes
* @return string
*/
public static function anchor($uri, $title = NULL, $attributes = NULL)
{
if ($uri === '') {
$siteUrl = url::base();
} else {
$siteUrl = $uri;
}
return '<a href="' . html::specialchars($siteUrl, false) . '"' . (is_array($attributes) ? html::attributes($attributes) : '') . '>' . ($title === NULL ? $siteUrl : $title) . '</a>';
}
示例4: anchor_lang
public static function anchor_lang($lang, $uri, $title = NULL, $attributes = NULL, $protocol = NULL)
{
if ($uri === '') {
$site_url = url::base(FALSE);
} elseif (strpos($uri, '://') === FALSE and strpos($uri, '#') !== 0) {
$site_url = url::site_lang($lang, $uri, $protocol);
} else {
if (html::$windowed_urls === TRUE and empty($attributes['target'])) {
$attributes['target'] = '_blank';
}
$site_url = $uri;
}
return '<a href="' . html::specialchars($site_url, FALSE) . '"' . (is_array($attributes) ? html::attributes($attributes) : '') . '>' . ($title === NULL ? $site_url : $title) . '</a>';
}
示例5: comments
public function comments()
{
header('Content-Type: text/xml; charset=UTF-8', TRUE);
if ($cache = $this->cache->get('s7n_blog_feed_comments')) {
echo $cache;
return;
}
$comments = ORM::factory('blog_comment')->orderby('id', 'desc')->find_all(20);
$info = array('title' => config::get('s7n.site_title') . ' (Latest Comments)', 'link' => url::current_site(), 'generator' => 'S7Ncms - http://www.s7n.de/');
$items = array();
foreach ($comments as $comment) {
$items[] = array('author' => html::specialchars($comment->author), 'pubDate' => date('r', strtotime($comment->date)), 'title' => 'New comment for "' . $comment->blog_post->title . '"', 'description' => html::specialchars($comment->content), 'link' => $comment->blog_post->url(), 'guid' => $comment->blog_post->url());
}
$feed = feed::create($info, $items);
$this->cache->set('s7n_blog_feed_comments', $feed);
echo $feed;
}
示例6: role
/**
* Single role view
*
* @param string $role_id
* @param string $action
*/
public function role($role_id, $action = null)
{
if ($action) {
switch ($action) {
// Delete role
case 'delete':
$this->_role_delete($role_id);
return;
}
}
$this->history = false;
$role = new Role_Model((int) $role_id);
$form_values = $role->as_array();
$form_errors = $errors = array();
// Check post
if ($post = $this->input->post()) {
$role->name = $post['name'];
$role->description = $post['description'];
try {
$role->save();
url::redirect('/roles');
} catch (ORM_Validation_Exception $e) {
$form_errors = $e->validation->errors();
}
$form_values = arr::overwrite($form_values, $post);
}
// show form
if ($role->id) {
$this->breadcrumb[] = html::anchor('role/' . url::title($role->id, $role->name), html::specialchars($role->name));
$this->page_title = text::title($role->name);
$this->page_actions[] = array('link' => 'role/' . url::title($role->id, $role->name) . '/delete', 'text' => __('Delete role'), 'class' => 'role-delete');
} else {
$this->page_title = __('Role');
}
if (empty($errors)) {
widget::add('main', View_Mod::factory('roles/role_edit', array('values' => $form_values, 'errors' => $form_errors)));
} else {
$this->_error(Kohana::lang('generic.error'), $errors);
}
}
示例7: index
/**
* 取得反馈
*/
public function index()
{
if ($this->get_method() != 'POST') {
$this->send_response(405, NULL, '请求的方法不存在');
}
$data = $this->get_data();
$text = isset($data['text']) ? trim($data['text']) : '';
$contact = isset($data['contact']) ? trim($data['contact']) : '';
$kind = isset($data['kind']) ? trim($data['kind']) : '';
$source = $this->get_source();
if (empty($text)) {
$this->send_response(400, NULL, '400901:反馈内容不能为空');
}
if (empty($source)) {
$this->send_response(400, NULL, '400902:客户端类型id不能为空');
}
$this->user_id = $this->getUid();
$name = sns::getrealname($this->user_id);
$text = html::specialchars($text);
$array = array('uid' => $this->user_id, 'name' => $name, 'content' => $text, 'contact' => $contact, 'kind' => $kind, 'client_id' => $source, 'addtime' => time());
$return = $this->model->saveData($array);
$this->send_response(200);
}
示例8: is_correct_password
/**
* Is the password provided correct?
*
* @param user User Model
* @param string $password a plaintext password
* @return boolean true if the password is correct
*/
static function is_correct_password($user, $password)
{
$valid = $user->password;
// Try phpass first, since that's what we generate.
if (strlen($valid) == 34) {
require_once MODPATH . "user/lib/PasswordHash.php";
$hashGenerator = new PasswordHash(10, true);
return $hashGenerator->CheckPassword($password, $valid);
}
$salt = substr($valid, 0, 4);
// Support both old (G1 thru 1.4.0; G2 thru alpha-4) and new password schemes:
$guess = strlen($valid) == 32 ? md5($password) : $salt . md5($salt . $password);
if (!strcmp($guess, $valid)) {
return true;
}
// Passwords with <&"> created by G2 prior to 2.1 were hashed with entities
$sanitizedPassword = html::specialchars($password, false);
$guess = strlen($valid) == 32 ? md5($sanitizedPassword) : $salt . md5($salt . $sanitizedPassword);
if (!strcmp($guess, $valid)) {
return true;
}
return false;
}
示例9:
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="refresh" content="<?php
echo $this->config->conf['refresh'];
?>
"; URL="<?php
echo $_SERVER['REQUEST_URI'];
?>
">
<title><?php
if (isset($this->title)) {
echo html::specialchars($this->title);
}
?>
</title>
<?php
echo html::stylesheet('media/css/common.css');
echo html::stylesheet('media/css/imgareaselect-default.css');
echo html::stylesheet('media/css/ui-' . $this->theme . '/jquery-ui.css');
echo html::link('media/images/favicon.ico', 'icon', 'image/ico');
echo html::script('media/js/jquery-min.js');
echo html::script('media/js/jquery.imgareaselect.min.js');
echo html::script('media/js/jquery-ui.min.js');
?>
<script type="text/javascript">
jQuery.noConflict();
jQuery(window).load(
示例10: _view
/**
* User profile
*/
public function _view()
{
$this->tab_id = 'profile';
$owner = $this->user && $this->member->id == $this->user->id;
if ($owner && $this->user->newcomments) {
$this->user->newcomments = 0;
$this->user->save();
}
// Actions
if ($this->member->has_access(User_Model::ACCESS_EDIT)) {
$this->page_actions[] = array('link' => url::user($this->member) . '/edit', 'text' => __('Settings'), 'class' => 'settings');
}
// Picture
widget::add('side', View_Mod::factory('member/member', array('mod_class' => 'member member-' . $this->member->id, 'user' => $this->member)));
// Comments
if ($this->member->has_access(User_Model::ACCESS_COMMENT)) {
$comment = new User_Comment_Model();
$form_values = $comment->as_array();
$form_errors = array();
// check post
if (csrf::valid() && ($post = $this->input->post())) {
$comment->user_id = $this->member->id;
$comment->author_id = $this->user->id;
$comment->comment = $post['comment'];
if (isset($post['private'])) {
$comment->private = 1;
}
try {
$comment->save();
if (!$owner) {
$this->member->newcomments += 1;
$this->member->save();
}
$this->user->commentsleft += 1;
$this->user->save();
if (!request::is_ajax()) {
url::redirect(url::current());
}
} catch (ORM_Validation_Exception $e) {
$form_errors = $e->validation->errors();
$form_values = arr::overwrite($form_values, $post);
}
}
// Handle pagination
$per_page = 25;
$page_num = $this->uri->segment('page') ? $this->uri->segment('page') : 1;
$page_offset = ($page_num - 1) * $per_page;
$total_comments = $this->member->get_comment_count();
$comments = $this->member->find_comments($page_num, $per_page, $this->user);
$pagination = new Pagination(array('items_per_page' => $per_page, 'total_items' => $total_comments));
$view = View::factory('generic/comments', array('delete' => '/member/comment/%d/delete/?token=' . csrf::token(), 'private' => '/member/comment/%d/private/?token=' . csrf::token(), 'comments' => $comments, 'errors' => $form_errors, 'values' => $form_values, 'pagination' => $pagination, 'user' => $this->user));
if (request::is_ajax()) {
echo $view;
return;
}
widget::add('main', $view);
}
// Basic info
$basic_info = array();
if (!empty($this->member->name)) {
$basic_info[__('Name')] = html::specialchars($this->member->name);
}
if (!empty($this->member->city_name)) {
$basic_info[__('City')] = html::specialchars($this->member->city_name);
}
if (!empty($this->member->dob) && $this->member->dob != '0000-00-00') {
$basic_info[__('Date of Birth')] = __(':dob (:years years)', array(':dob' => date::format('DMYYYY', $this->member->dob), ':years' => date::timespan(strtotime($this->member->dob), null, 'years')));
}
if (!empty($this->member->gender)) {
$basic_info[__('Gender')] = $this->member->gender == 'm' ? __('Male') : __('Female');
}
if (!empty($this->member->latitude) && !empty($this->member->longitude)) {
$basic_info[__('Location')] = $this->member->latitude . ', ' . $this->member->longitude;
$basic_info[__('Location')] = html::anchor('#map', __('Toggle map'), array('class' => 'expander', 'title' => __('Show/hide'))) . '<div id="map" style="display: none">' . __('Map loading') . '</div>';
$map = new Gmap('map', array('ScrollWheelZoom' => true));
$map->center($this->member->latitude, $this->member->longitude, 15)->controls('small')->types();
$map->add_marker($this->member->latitude, $this->member->longitude, html::avatar($this->member->avatar, $this->member->username) . html::user($this->member));
widget::add('foot', html::script_source($map->render('gmaps/jquery_event')));
widget::add('foot', html::script_source("\$('a[href*=\"#map\"]:first').click(function() { \$('#map').toggle('normal', gmap_open); return false; });"));
}
// Site info
$site_info = array(__('Registered') => date::format('DMYYYY_HM', $this->member->created) . ' [#' . $this->member->id . ']', __('Logins') => __(':logins (:ago ago)', array(':logins' => number_format($this->member->logins, 0), ':ago' => '<abbr title="' . date::format('DMYYYY_HM', $this->member->last_login) . '">' . date::timespan_short($this->member->last_login) . '</abbr>')), __('Posts') => number_format($this->member->posts, 0), __('Comments') => number_format($this->member->commentsleft, 0));
// Initialize tabs
$tabs = array('basic-info' => array('href' => '#basic-info', 'title' => __('Basic info'), 'tab' => new View('generic/list_info', array('id' => 'basic-info', 'title' => __('Basic info'), 'list' => $basic_info))), 'site-info' => array('href' => '#site-info', 'title' => __('Site info'), 'tab' => new View('generic/list_info', array('id' => 'site-info', 'title' => __('Site info'), 'list' => $site_info))));
widget::add('side', View::factory('generic/tabs', array('id' => 'info-tab', 'tabs' => $tabs)));
$this->_side_views();
}
示例11:
?>
<?php
} else {
?>
<?php
echo html::specialchars($user['email']);
?>
<?php
}
?>
</td>
</tr>
<tr>
<th>评论内容: </th>
<td style="word-wrap:break-word;word-break:break-all;overflow:hidden;"><?php
echo html::specialchars($inquiry['content']);
?>
</td>
</tr>
<tr>
<th>评论时间: </th>
<td><?php
echo $inquiry['create_timestamp'];
?>
</td>
</tr>
<tr>
<th>回复内容: </th>
<td><textarea id="reply_content" name="reply_content" cols="120" rows="6" class="text" type="textarea" value="" maxlength="1024"><?php
!empty($inquiry['reply_content']) && (print $inquiry['reply_content']);
?>
示例12: elseif
echo "</table></div>";
continue;
}
echo "<tr class='custom_field custom_field_{$field_property['field_id']}'>";
// Get the value for the form field
$value = $field_property['field_response'];
// Check if a value was fetched
if ($value == "" and empty($show_empty)) {
continue;
}
if ($field_property['field_type'] == 1 or $field_property['field_type'] > 3) {
// Text Field
// Is this a date field?
echo "<td><strong>" . html::specialchars($field_property['field_name']) . ": </strong></td>";
echo "<td class=\"answer\">{$value}</td>";
} elseif ($field_property['field_type'] == 2) {
// TextArea Field
echo "<td><strong>" . html::specialchars($field_property['field_name']) . ": </strong></td>";
echo "<td class=\"answer\">{$value}</tr>";
} elseif ($field_property['field_type'] == 3) {
echo "<td><strong>" . html::specialchars($field_property['field_name']) . ": </strong></td>";
echo "<td class=\"answer\">" . date('M d Y', strtotime($value)) . "</td>";
}
//echo "</div>";
echo "</tr>";
}
?>
</table>
</div>
<?php
}
示例13:
<td><textarea id="metaDescription" class="formText" name="metaDescription"><?php
echo $category->categories_description->meta_description;
?>
</textarea></td>
</tr>
<tr>
<td><label for="metaKeywords">Keywords</label></td>
<td><textarea id="metaKeywords" class="formText" name="metaKeywords"><?php
echo $category->categories_description->meta_keywords;
?>
</textarea></td>
</tr>
<tr>
<td><label for="metaUrl">URL</label></td>
<td><input id="metaUrl" type="text" class="formText" name="metaUrl" value="<?php
echo html::specialchars($category->categories_description->title_url, FALSE);
?>
" /></td>
</tr>
</table>
</div> <!-- div id="tab_meta_infromation" -->
<!--
<div id="tab_category_products">
<div class="headline">Category Products</div>
<table class="list">
<col width="35" />
<col width="20" />
<col width="20"/>
<col width="20" />
<col width="100" />
<tr>
示例14: foreach
<ul class="contentlist favorites events">
<?php
foreach ($favorites as $favorite) {
?>
<li class="event-<?php
echo $favorite->id;
?>
">
<?php
echo date::format('DDMMYYYY', $favorite->start_time);
?>
<?php
echo html::anchor(url::model($favorite), text::title($favorite->name), array('title' => html::specialchars($favorite->name)));
?>
</li>
<?php
}
?>
</ul>
示例15: render_without_children
public function render_without_children()
{
$class = $this->active === TRUE ? 'active' : '';
return '<li class="' . $class . '">' . html::anchor($this->uri, html::specialchars($this->title), array('class' => $class)) . '</li>';
}