本文整理汇总了PHP中Guardian::token方法的典型用法代码示例。如果您正苦于以下问题:PHP Guardian::token方法的具体用法?PHP Guardian::token怎么用?PHP Guardian::token使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Guardian
的用法示例。
在下文中一共展示了Guardian::token方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: do_private_post
function do_private_post($content, $results)
{
global $config, $speak;
$results = Mecha::O($results);
$results = $config->is->post ? Get::postHeader($results->path, POST . DS . $config->page_type, '/', $config->page_type . ':') : false;
if ($results === false) {
return $speak->plugin_private_post->description;
}
$s = isset($results->fields->pass) ? $results->fields->pass : "";
if (strpos($s, ':') !== false) {
$s = explode(':', $s, 2);
if (isset($s[1])) {
$speak->plugin_private_post->hint = ltrim($s[1]);
}
// override password hint
$s = $s[0];
}
$hash = md5($s . PRIVATE_POST_SALT);
$html = Notify::read(false) . '<div class="overlay--' . File::B(__DIR__) . '"></div><form class="form--' . File::B(__DIR__) . '" action="' . $config->url . '/' . File::B(__DIR__) . '/do:access" method="post">' . NL;
$html .= TAB . Form::hidden('token', Guardian::token()) . NL;
$html .= TAB . Form::hidden('_', $hash) . NL;
$html .= TAB . Form::hidden('kick', $config->url_current) . NL;
$html .= TAB . '<p>' . $speak->plugin_private_post->hint . '</p>' . NL;
$html .= TAB . '<p>' . Form::text('access', "", $speak->password . '…', array('autocomplete' => 'off')) . ' ' . Form::button($speak->submit, null, 'submit') . '</p>' . NL;
$html .= '</form>' . O_END;
if ($results && isset($results->fields->pass) && trim($results->fields->pass) !== "") {
if (!Guardian::happy() && Session::get('is_allow_post_access') !== $hash) {
return $html;
}
}
return $content;
}
示例2: cargo
/**
* Default Shortcut Variable(s)
* ----------------------------
*/
public static function cargo()
{
$config = Config::get();
$token = Guardian::token();
$results = array('config' => $config, 'speak' => $config->speak, 'articles' => $config->articles, 'article' => $config->article, 'pages' => $config->pages, 'page' => $config->page, 'pager' => $config->pagination, 'manager' => Guardian::happy(), 'token' => $token, 'messages' => Notify::read(false), 'message' => Notify::read(false));
Session::set(Guardian::$token, $token);
unset($config, $token);
self::$lot = array_merge(self::$lot, $results);
return self::$lot;
}
示例3: cargo
/**
* Default Shortcut Variable(s)
* ----------------------------
*/
public static function cargo()
{
$config = Config::get();
$token = Guardian::token();
$message = Notify::read();
$results = array('config' => $config, 'speak' => $config->speak, 'articles' => $config->articles, 'article' => $config->article, 'pages' => $config->pages, 'page' => $config->page, 'responses' => $config->responses, 'response' => $config->response, 'files' => $config->files, 'file' => $config->file, 'pager' => $config->pagination, 'manager' => Guardian::happy(), 'token' => $token, 'messages' => $message);
Session::set(Guardian::$token, $token);
Session::set(Notify::$message, $message);
unset($config, $token, $message);
return array_merge($results, self::$lot);
}
示例4: function
});
}
// `<a class="text-error">`
Jot::add('a', function ($kind = 'default', $href = null, $text = "", $attr = array(), $indent = 0) {
$attr['href'] = Converter::url($href);
if (!isset($attr['class'])) {
$attr['class'] = array();
}
$attr['class'] = array_merge(array('text-' . $kind), (array) $attr['class']);
return Cell::unit('a', $text, $attr, $indent);
});
// File uploader
Jot::add('uploader', function ($action, $accept = null, $fields = array()) {
$speak = Config::speak();
$html = Cell::begin('form', array('class' => array('form-ignite', 'form-upload'), 'action' => Converter::url($action), 'method' => 'post', 'enctype' => 'multipart/form-data')) . NL;
$html .= Form::hidden('token', Guardian::token(), array(), 1) . NL;
foreach ($fields as $name => $value) {
$html .= Form::hidden($name, $value, array(), 1) . NL;
}
$html .= Cell::begin('span', array('class' => array('input-outer', 'btn', 'btn-default')), 1) . NL;
$html .= Cell::unit('span', Jot::icon('folder-open') . ' ' . $speak->manager->placeholder_file, array(), 2) . NL;
$html .= Form::file('file', array('title' => $speak->manager->placeholder_file, 'data' => array('icon-ready' => 'fa fa-check', 'icon-error' => 'fa fa-times', 'accepted-extensions' => $accept)), 2) . NL;
$html .= Cell::end() . ' ' . Jot::button('action:cloud-upload', $speak->upload) . NL;
$html .= Cell::end();
return $html;
});
// File finder
Jot::add('finder', function ($action, $name = 'q', $fields = array()) {
$html = Cell::begin('form', array('class' => 'form-ignite form-find', 'action' => Converter::url($action), 'method' => 'get')) . NL;
foreach ($fields as $key => $value) {
$html .= Form::hidden($key, $value) . NL;