本文整理汇总了PHP中s::remove方法的典型用法代码示例。如果您正苦于以下问题:PHP s::remove方法的具体用法?PHP s::remove怎么用?PHP s::remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类s
的用法示例。
在下文中一共展示了s::remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: message
public function message()
{
if ($message = s::get('message') and is_array($message)) {
$text = a::get($message, 'text');
$type = a::get($message, 'type', 'notification');
$element = new Brick('div');
$element->addClass('message');
if ($type == 'error') {
$element->addClass('message-is-alert');
} else {
$element->addClass('message-is-notice');
}
$element->append(function () use($text) {
$content = new Brick('span');
$content->addClass('message-content');
$content->text($text);
return $content;
});
$element->append(function () {
$toggle = new Brick('a');
$toggle->attr('href', url::current());
$toggle->addClass('message-toggle');
$toggle->html('<i>×</i>');
return $toggle;
});
s::remove('message');
return $element;
}
}
示例2: flush
/**
* Remove old values from the Session’s flash data.
*/
public static function flush()
{
// Make sure the session is started
s::start();
// Retrieve the flash data
$registry = s::get(self::$namespace);
// Clean up registry
if (!empty($registry)) {
foreach ($registry as $key => $expiry) {
$expiry++;
// Remove all old values from the session
if ($expiry > 1) {
s::remove($key);
unset($registry[$key]);
} else {
$registry[$key] = $expiry;
}
}
// Write registry back to session
if (!empty($registry)) {
s::set(self::$namespace, $registry);
} else {
s::remove(self::$namespace);
}
}
}
示例3: get
public static function get($name)
{
$messages = s::get('messages');
foreach ($messages as $key => $message) {
if ($message->name == $name) {
return $message->value;
}
}
s::remove('messages');
}
示例4: deconstruct
/**
* Deconstruct the order object
*
* @return void
*/
public function deconstruct()
{
$this->emptyGuests();
s::remove('order.comments');
s::remove('order.couponCode');
}
示例5: testSessionRemove
function testSessionRemove()
{
s::remove('key');
$this->assertNull(s::get('key'));
}
示例6: snippet
</textarea>
<?php
echo $validator->field_error('message');
?>
</div>
</div>
<div class="field field-submit">
<input type="submit" name="submit" class="btn" value="Send" />
</div>
</form>
<?php
} else {
?>
<div class="sent">
<h2>Thanks for getting in touch.</h2>
<p>I will try to get back you you as soon as possible.</p>
</div>
<?php
}
?>
</div>
</div>
<?php
echo snippet('content-types/social');
?>
<?php
echo snippet('footer');
s::remove('email_sent');
示例7: __construct
/**
* Instantiate the singleton
*
* @return void
*/
protected function __construct()
{
static::$data = s::get('flash', []);
s::remove('flash');
}
示例8: reset
public function reset()
{
return s::remove($this->id);
}
示例9: header
if (count($_POST) > 0) {
//store specific sanitized $_POST variables into resetData session variable
s::set('resetData', r::postData(array('password', 'password2')));
//store URI param variables into session variables
s::set('username', $paramUsername);
s::set('hash', $paramResetHash);
//redirect to same page (POST/GET/REDIRECT PATTERN-like)
header('HTTP/1.1 303 See Other');
header('Location: ' . $page->url());
} elseif (s::get('resetData')) {
//store resetData session variable into $data
$data = s::get('resetData');
//remove session variables
s::remove('resetData');
s::remove('username');
s::remove('hash');
//define validation rules for $data
$rules = array('password' => array('required', 'match' => c::get('password.length.regex')), 'password2' => array('required', 'same' => $data['password']));
//define validation messages for $data
$messages = array('password' => l('field.password.validaton.message'), 'password2' => l('field.password2.validaton.message'));
//if validation is passed
if (!($invalid = invalid(array_filter($data), $rules, $messages))) {
//try to update user's account password
$userUpdatedData = $user->update(array('password' => $data['password']));
//if updating user's password was successful
if ($userUpdatedData) {
//set success message
$success['Account'] = l('reset.success.update');
} else {
//add error: password update failed
$invalid['Account'] = l('reset.fail.update');
示例10: logout
public static function logout()
{
session_regenerate_id();
s::remove('auth.created');
s::remove('auth.updated');
s::remove('auth.key');
s::remove('auth.secret');
s::remove('auth.username');
s::remove('auth.ip');
s::remove('auth.ua');
cookie::remove('key');
}
示例11: reset
public function reset()
{
if ($this->field) {
return $this->store()->reset();
} else {
foreach (s::get() as $key => $value) {
if (str::startsWith($key, $this->id)) {
s::remove($key);
}
}
}
}
示例12: url
<?php
s::remove('cart');
snippet('header');
?>
<main id="paid" class="main black" role="main">
<div class="text">
<h1><?php
echo $page->subtitle()->or($page->title());
?>
</h1>
<a class="btn-white" href="<?php
echo url('products');
?>
">Acheter à nouveau ?</a>
</div>
</main>
<?php
snippet('footer');
示例13: strtoupper
}
s::set('country', $country);
// Set discount code from query string or user profile
if ($code = get('dc') or $user = site()->user() and $code = $user->discountcode()) {
s::set('discountCode', strtoupper($code));
} else {
if (get('dc') === '') {
s::remove('discountCode');
}
}
// Set gift certificate code from query string
if ($code = get('gc')) {
s::set('giftCertificateCode', strtoupper($code));
} else {
if (get('gc') === '') {
s::remove('giftCertificateCode');
}
}
/**
* Helper function to format price
*/
function formatPrice($number)
{
$symbol = page('shop')->currency_symbol();
$currencyCode = page('shop')->currency_code();
if (page('shop')->currency_position() == 'before') {
return '<span property="priceCurrency" content="' . $currencyCode . '">' . $symbol . '</span> <span property="price" content="' . number_format((double) $number, 2, '.', '') . '">' . number_format((double) $number, 2, '.', '') . '</span>';
} else {
return number_format($number, 2, '.', '') . ' ' . $symbol;
}
}
示例14: header
$user = null;
$data = null;
$invalid = null;
$success = null;
//if $_POST data is present
if (count($_POST) > 0) {
//store specific sanitized $_POST variables into registerData session variable
s::set('registerData', r::postData(array('email', 'password', 'password2', 'session')));
//redirect to same page (POST/GET/REDIRECT PATTERN-like)
header('HTTP/1.1 303 See Other');
header('Location: ' . $page->url());
} elseif (s::get('registerData')) {
//store registerData session variable into $data varaiable
$data = s::get('registerData');
//unset $registerData session variable
s::remove('registerData');
//define validation rules for $data
$rules = array('email' => array('required', 'email'), 'password' => array('required', 'match' => c::get('password.length.regex')), 'password2' => array('required', 'same' => $data['password']), 'session' => array('required'));
//define validation messages for $data
$messages = array('email' => l('field.email.validation.message'), 'password' => l('field.password.validaton.message'), 'password2' => l('field.password2.validaton.message'), 'session' => l('field.session.validaton.message'));
//if validation is passed
if (!($invalid = invalid(array_filter($data), $rules, $messages))) {
//compute user's username (based upon user's email)
$computedUsername = Auth::computeUsername($data['email']);
//**** USER DATA****************************************************************************
//user's computed name
$paramUsername = $computedUsername;
//user's password (will be encrypted by KIRBY)
$paramPassword = $data['password'];
//user's email
$paramEmail = $data['email'];
示例15: site
<?php
// Check if user is coming from the cart page or from PayPal
s::start();
if (s::get('sendBack')) {
// If coming from PayPal, kick them back to the cart
s::remove('sendBack');
go('shop/cart');
} else {
s::set('sendBack', true);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title><?php
echo site()->title()->html();
?>
| <?php
echo page('shop/cart')->title();
?>
</title>
<style>
body { font-family: sans-serif; font-size: 2rem; text-align: center; }
button { font-size: 1rem; padding: 1rem; }
</style>
</head>
<body>
<p><?php