本文整理汇总了PHP中html::chars方法的典型用法代码示例。如果您正苦于以下问题:PHP html::chars方法的具体用法?PHP html::chars怎么用?PHP html::chars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类html
的用法示例。
在下文中一共展示了html::chars方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: content
public function content($text, $type = "html")
{
$content = $this->dom->createElement("content", html::chars($text));
$content->setAttribute("type", $type);
$this->element->appendChild($content);
return $this;
}
示例2: __construct
function __construct()
{
parent::__construct("entry");
/* Set feed ID and self link. */
$this->id(html::chars(url::abs_current()));
$this->link()->rel("self")->href(url::abs_current());
}
示例3: action_index
public function action_index()
{
if ($_POST) {
$message = html::chars((string) arr::get($_POST, 'message', ''));
if ($message) {
// Append user information
if ($user = $this->auth->get_user()) {
$message .= '<h2>Användarinfo</h2>';
$message .= '<dl>';
foreach (array('id', 'username', 'email') as $field) {
$message .= sprintf('<dt>%s</dt><dd>%s</dd>', $field, html::chars($user->{$field}));
}
$message .= '</dl>';
}
$from = arr::extract($_POST, array('e-mail', 'name'));
if (!Validate::email($from['e-mail'])) {
$from['name'] .= " ({$from['e-mail']})";
$from['e-mail'] = 'svara-inte@anglarna.se';
}
$sent = Email::send('stockholm@anglarna.se', array($from['e-mail'], $from['name']), '[Änglarna Stockholm] Meddelande från kontaktsidan', $message, TRUE);
if ($sent >= 1) {
$this->message_add('Ditt meddelande har skickats till ' . html::mailto('stockholm@anglarna.se') . '!');
} else {
$this->message_add('Något blev fel. Försök igen eller skicka ett vanligt mail till ' . html::mailto('stockholm@anglarna.se') . ' istället.', 'error');
}
} else {
$this->message_add('Du måste ange ett meddelande.', 'error');
}
$this->request->reload();
}
$this->template->title = 'Kontakta Änglarna Stockholm';
$this->template->content = View::factory('kontakt/index');
}
示例4: action_login
function action_login()
{
$this->template->title = 'My Index Title';
$this->template->subHeading = "Login Page";
if ($this->auth->is_logged_in()) {
$this->addMessage(__('You are already logged in!'));
$this->_redirect('');
return;
}
// Load the user
$data = array();
$user = ORM::factory('account')->where('email', '=', $this->request->post('email'))->find();
if ($this->auth->login($user, $this->request->post('password'))) {
$this->addMessage(__('Welcome, ') . ' ' . html::chars($user->gname) . ' ' . html::chars($user->sname) . '!');
$this->_redirect('');
return;
} else {
$data['email'] = $this->request->post('email');
}
foreach ($this->auth->errors() as $err) {
$this->addError($err);
}
$this->auth->clearErrors();
return $this->action_loginOrRegister($data);
}
示例5: action_view
public function action_view($hash = NULL)
{
$commit = $this->repo->getObject(sha1_bin($hash));
require Kohana::find_file('vendor', 'htmlpurifier/library/htmlpurifier.auto');
require Kohana::find_file('vendor', 'markdown/markdown');
$this->template->title = html::chars($commit->summary);
$this->template->content = View::factory('changelog/view')->set('commit', $commit)->set('htmlpurifier', new HTMLPurifier());
}
示例6: action_index
public function action_index()
{
$errors = array();
$auth = Auth::instance();
if ($auth->logged_in()) {
$session = Session::instance();
$user = $session->get('auth_user');
if ($user->nivel == 5) {
$this->request->redirect('admin');
} else {
$this->request->redirect('dashboard');
}
} else {
if (isset($_POST['submit'])) {
$validate = Validation::factory($this->request->post());
$validate->rule('username', 'not_empty')->rule('password', 'not_empty');
if ($validate->check()) {
$user = $auth->login(html::chars($_POST['username']), html::chars($_POST['password']));
if ($user) {
$usuario = ORM::factory('users', $auth->get_user());
$session = Session::instance();
$session->set('username', $usuario->nombre);
$session->set('username', $usuario->username);
$session->set('cargo', $usuario->cargo);
//vitacora
$this->save($usuario->id_entidad, $usuario->id, $usuario->nombre . ' <b>' . $usuario->cargo . '</b> ingresó al sistema');
if ($usuario->nivel == 5) {
$this->request->redirect('admin');
} else {
if (isset($_GET['url'])) {
$this->request->redirect($_GET['url']);
} else {
$this->request->redirect('dashboard');
}
}
} else {
$this->template->errors['login'] = 'Acceso no autorizado.';
//$_POST=array();
}
}
}
}
$this->template->title .= ' / Ingreso';
$this->template->content = View::factory('templates/login');
}
示例7: 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::chars($password, false);
$guess = strlen($valid) == 32 ? md5($sanitizedPassword) : $salt . md5($salt . $sanitizedPassword);
if (!strcmp($guess, $valid)) {
return true;
}
return false;
}
示例8: foreach
<div class="box">
<h2><?php
echo html::chars($title);
?>
</h2>
<?php
if (!empty($images)) {
?>
<ol class="gallery images">
<?php
foreach ($images as $image) {
?>
<li>
<a href="<?php
echo $image->path;
?>
" rel="shadowbox[galleri]"><img src="<?php
echo $image->thumb;
?>
" height="80" alt="<?php
echo $image->alt;
?>
"></a>
</li>
<?php
}
?>
</ol>
示例9: nl2br
<tr>
<td class="align-right">Forma płatności</td>
<td colspan="4">
<?php
echo $order->meta()->fields('payment')->choices[$order->payment];
?>
</td>
</tr>
<?php
if ($order->sendform->name != "Odbiór osobisty") {
?>
<tr>
<td class="align-right">Adres dostawy</td>
<td colspan="4">
<?php
echo nl2br(html::chars($order->address));
?>
</td>
</tr>
<?php
}
?>
<tr>
<td class="align-right">Do zapłaty</td>
<td colspan="4">
Netto: <b><?php
echo number_format($sum_netto_plus, 2);
?>
zł</b><br />
Brutto: <b><?php
echo number_format($sum_brutto_plus, 2);
示例10:
<div class="yui-gd">
<div id="botinfo" class="yui-gd first">
<div class="yui-u first leftinfo">
Bot Name:<br />
Author:<br />
Challenge:<br />
Coding Lanuage:<br />
Created on:<br />
Last online:<br/>
Author's Notes:<br />
</div>
<div class="yui-u rightinfo" >
<?php
echo html::chars($bot->name);
?>
<br />
<?php
echo html::anchor($bot->user->uri(), $bot->user->name());
?>
<br />
$challenge<br />
$language<br />
$created_date<br />
$last_login<br />
$author_notes<br />
</div>
</div>
<div id="chart" class="yui-u">
示例11: printf
<h1>Inbjudan hos Änglarna Stockholm</h1>
<p>
Du har blivit erbjuden att registrera en användare på Änglarna Stockholms hemsida av <?php
echo html::chars($inviter);
?>
.
</p>
<?php
if (!empty($message)) {
printf('<p>%s meddelar också:</p><pre>%s</pre>', html::chars($inviter), html::chars($message));
}
?>
<p>
Registrering sker på följande adress: <?php
echo html::anchor($url, html::chars($url));
?>
.
</p>
<p>
Mvh, Änglarna Stockholm
</p>
示例12: View
<?php
View::set_global('field_lang_prefix', 'auth.changeEmail_field_');
echo '<div id="form">';
echo form::open();
echo '<h3>' . html::chars(__('convention.registration_form_header')) . '</h3>';
echo '<p>' . __('ecmproject.form_required') . '</p>';
echo "<fieldset>";
foreach (array('email') as $field) {
echo new View('global/_form_field', array('field' => $field, 'fieldData' => $fields[$field], 'value' => $form[$field], 'hasError' => isset($errors[$field]) && $errors[$field]));
}
echo '</fieldset>';
echo "<fieldset class='left'>";
echo form::submit(null, __('auth.changeEmail_field_submit'));
echo '</fieldset>';
echo form::close();
echo '</div>';
示例13: action_register
/**
* Registration procedure (from a given invitation)
*/
public function action_register()
{
$token = arr::get($_GET, 'token', NULL);
if (!Model_Invite::valid($token)) {
$this->message_add('Din inbjudan är ogiltig.', 'error');
// TODO: better message
$this->request->redirect_back();
} else {
$invite = Model_Invite::factory($token)->load();
}
// Registrera användare
if (!empty($_POST)) {
$_POST['email'] = $invite->email;
$_POST['logins'] = 0;
$user = Sprig::factory('user', $_POST);
/**
* The following is executed as a transaction, and rolls
* back if something goes wrong
*/
try {
// Start transaction
DB::query(NULL, 'BEGIN')->execute();
$user->create();
$user->add('roles', array(Sprig::factory('role', array('name' => 'login'))->load(), Sprig::factory('role', array('name' => 'ängel'))->load()))->update();
// Make invite invalid
$invite->values(array('invitee' => $user->id))->update();
// Commit transaction
DB::query(NULL, 'COMMIT')->execute();
// Log in!
$this->auth->login($_POST['username'], $_POST['password']);
// Welcome message and redirect to control panel
$this->message_add(sprintf('Välkommen, %s! Du är nu registrerad och inloggad.
Jag tog mig också friheten att dirigera dig till forumet.', html::chars($user->username)));
// TODO: Make message
$this->request->redirect('forum', 303);
} catch (Exception $e) {
// Rollback transaction (innodb ftw)
DB::query(NULL, 'ROLLBACK')->execute();
// Non-validation errors are re-thrown and logged
if (!$e instanceof Validate_Exception) {
throw $e;
}
// Show validation errors
foreach ($e->array->errors('user/register') as $error) {
$this->message_add($error, 'error');
}
}
$this->request->reload();
}
$this->template->content = View::factory('user/register')->set('invite', $invite);
}
示例14: foreach
<tr>
<th>Defaults</th>
<td><?php
if (count($array['_defaults']) == 0) {
echo "none";
}
foreach ($array['_defaults'] as $param => $default) {
echo "<code>\"{$param}\" = \"{$default}\"</code><br/>";
}
?>
</td>
</tr>
<tr>
<th>Compiled Regex</th>
<td><code><?php
echo html::chars($array['_route_regex']);
?>
</code></td>
</tr>
</table>
<?php
}
?>
<?php
} else {
?>
<p>No routes</p>
<?php
}
示例15: foreach
* @author Antti Qvickström
* @copyright (c) 2010 Antti Qvickström
* @license http://www.opensource.org/licenses/mit-license.php MIT license
*/
?>
<ul>
<?php
foreach ($gallery->find_images() as $image) {
?>
<li class="unit size1of4">
<div class="thumb">
<?php
echo html::anchor(url::model($gallery) . '/' . $image->id, html::image('http://' . Kohana::config('site.image_server') . '/kuvat/' . $gallery->dir . '/thumb_' . $image->legacy_filename), array('title' => html::chars($image->description)));
?>
</div>
<?php
echo html::icon_value(array(':comments' => $image->comments), ':comments comment', ':comments comments', 'posts');
?>
<?php
echo html::icon_value(array(':views' => $image->views), ':views view', ':views views', 'views');
?>
</li>
<?php
}
?>
</ul>