本文整理汇总了PHP中s类的典型用法代码示例。如果您正苦于以下问题:PHP s类的具体用法?PHP s怎么用?PHP s使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了s类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: edit
function edit()
{
events::observe('save', 'templates', 'apps', '_save');
events::observer();
$tmpl_file = events::get('tmpl_file');
$app = events::get('app');
if (events::detect('restore')) {
self::restoreVersion($app, $tmpl_file, events::get('restore'));
}
admin::components('tabs', 'validator');
f::set('app', $app);
f::set('tmpl_file', $tmpl_file);
s::set('app', $app);
s::set('tmpl_file', $tmpl_file);
$file = SYS_ROOT . 'tmpls/' . ADMIN_SITE . '/' . $app . '/' . $tmpl_file;
$code = files::get($file);
f::set('tmpl_code', $code);
self::getApps();
/*
Load versions
*/
db::table('templates_versions');
db::where('app', $app);
db::where('tmpl_file', $tmpl_file);
db::order('version_date', 'DESC');
$res = db::select();
while ($row = mysql_fetch_assoc($res)) {
$row['version_date'] = dt::date2print('%H:%i %d.%m.%Y', $row['version_date']);
$row['version_code'] = '{non}' . htmlspecialchars($row['version_code']) . '{/non}';
s::roll('versions', $row);
}
}
开发者ID:rigidus,项目名称:ea,代码行数:32,代码来源:apps.module.php
示例2: __construct
/**
* Make sure the session is started within the constructor
*/
public function __construct()
{
s::start();
if (!isset($_SESSION['_cache'])) {
$_SESSION['_cache'] = array();
}
}
开发者ID:LucasFyl,项目名称:korakia,代码行数:10,代码来源:session.php
示例3: set
/**
* Set flash data
*
* @param string $key
* @param mixed $value
* @return void
*/
public static function set($key, $value)
{
if (!isset($data[$key])) {
static::$data[$key] = $value;
}
Session::set(self::sessionKey(), static::$data);
}
开发者ID:jevets,项目名称:kirby-flash,代码行数:14,代码来源:Flash.php
示例4: show
function show($name)
{
foreach (self::$errors as $k => $v) {
$show .= '<li>' . $v . '</li>';
}
s::set($name, '<ul>' . $show . '</ul>');
}
开发者ID:rigidus,项目名称:ea,代码行数:7,代码来源:errors.php
示例5: login
public function login($welcome = null)
{
if ($user = panel()->site()->user()) {
go(panel()->urls()->index());
}
$message = l('login.error');
$error = false;
$form = panel()->form('login');
$form->cancel = false;
$form->save = l('login.button');
$form->centered = true;
if (r::is('post') and get('_csfr') and csfr(get('_csfr'))) {
$data = $form->serialize();
$user = site()->user(str::lower($data['username']));
if (!$user) {
$error = true;
} else {
if (!$user->hasPanelAccess()) {
$error = true;
} else {
if (!$user->login(get('password'))) {
$error = true;
} else {
go(panel()->urls()->index());
}
}
}
}
if ($username = s::get('username')) {
$form->fields->username->value = html($username, false);
}
return layout('login', array('meta' => new Snippet('meta'), 'welcome' => $welcome ? l('login.welcome') : '', 'form' => $form, 'error' => $error ? $message : false));
}
开发者ID:madebypost,项目名称:Gulp-Neat-KirbyCMS,代码行数:33,代码来源:auth.php
示例6: 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);
}
}
}
开发者ID:buditanrim,项目名称:kirby-comments,代码行数:29,代码来源:session.php
示例7: get
function get($app, $tpl, $data, $section = false, $sys = false)
{
if ($tpl) {
$tmpl = false;
if ($sys) {
$file = APPS . $app . '/' . self::$module . '/' . RULE . '/' . $tpl;
} else {
$file = SYS_ROOT . 'tmpls/' . parent::$site . '/' . $app . '/' . $tpl;
}
$file_id = md5($file);
if (isset(self::$file_data[$file_id])) {
return self::$file_data[$file_id];
}
if (file_exists($file)) {
ob_start();
include $file;
$data = ob_get_contents();
ob_end_clean();
//$data = file_get_contents($file);
if ($section) {
s::section($section);
}
self::$file_data[$file_id] = $data;
}
}
return $data;
}
开发者ID:rigidus,项目名称:ea,代码行数:27,代码来源:buffer.php
示例8: index
public function index()
{
if (site()->users()->count() > 0) {
go(panel()->urls()->login());
}
if ($problems = installation::check()) {
$content = view('installation/check', array('problems' => $problems));
} else {
$form = panel()->form('installation', array('language' => kirby()->option('panel.language', 'en')));
$form->cancel = false;
$form->save = l('installation.signup.button');
$form->centered = true;
foreach (panel()->languages() as $lang) {
$form->fields()->get('language')->options[$lang->code()] = $lang->title();
}
$form->on('submit', function ($form) {
try {
// fetch all the form data
$data = $form->serialize();
// make sure that the first user is an admin
$data['role'] = 'admin';
// try to create the new user
$user = panel()->site()->users()->create($data);
// store the new username for the login screen
s::set('username', $user->username());
// redirect to the login
go(panel()->urls()->login() . '/welcome');
} catch (Exception $e) {
$form->alert($e->getMessage());
}
});
$content = view('installation/signup', array('form' => $form));
}
return layout('installation', array('meta' => new Snippet('meta'), 'content' => $content));
}
开发者ID:aoimedia,项目名称:kosmonautensofa,代码行数:35,代码来源:installation.php
示例9: get
function get($res, $name = 'clouds')
{
$nums_clouds = array();
if (db::rows() > 0) {
while ($row = mysql_fetch_array($res)) {
$nums_clouds[$row['tag_name']] = $row['num'];
}
ksort($nums_clouds);
$max_size = 200;
// max font size in %
$min_size = 100;
// min font size in %
$max_qty = max(array_values($nums_clouds));
$min_qty = min(array_values($nums_clouds));
$spread = $max_qty - $min_qty;
if (0 == $spread) {
$spread = 1;
}
$step = ($max_size - $min_size) / $spread;
foreach ($nums_clouds as $k => $v) {
$size = $min_size + ($v - $min_qty) * $step;
s::roll($name, array('name' => $k, 'size' => $size, 'value' => $v));
}
}
}
开发者ID:rigidus,项目名称:ea,代码行数:25,代码来源:clouds.php
示例10: __construct
function __construct()
{
s::start();
c::set('home.keepurl', true);
// auto-detect the url if it is not set
if (!c::get('url')) {
c::set('url', c::get('scheme') . server::get('http_host'));
}
// setup the thumb plugin
c::set('thumb.cache.root', c::get('root') . '/thumbs');
c::set('thumb.cache.url', c::get('url') . '/thumbs');
c::set('url', c::get('url') . '/' . c::get('panel.folder'));
// remove the panel folder name from the uri
c::set('subfolder', ltrim(c::get('subfolder') . '/' . c::get('panel.folder'), '/'));
// attach the uri after caching
$this->uri = new paneluri();
if (c::get('lang.support')) {
$path = $this->uri->path->toArray();
$first = array_shift($path);
if (!in_array($first, c::get('lang.available', array()))) {
$first = c::get('lang.default');
}
// set the current language
c::set('lang.current', $first);
$this->uri->path = new uriPath($path);
}
// get the first set of pages
$this->rootPages();
// get the additional site info from content/site.txt
$this->siteInfo();
}
开发者ID:04x10,项目名称:04x10.com,代码行数:31,代码来源:panel.php
示例11: paginated
public function paginated($mode = 'sidebar')
{
if ($limit = $this->page->blueprint()->pages()->limit()) {
$hash = sha1($this->page->id());
switch ($mode) {
case 'sidebar':
$id = 'pages.' . $hash;
$var = 'page';
break;
case 'subpages/visible':
$id = 'subpages.visible.' . $hash;
$var = 'visible';
break;
case 'subpages/invisible':
$id = 'subpages.invisible.' . $hash;
$var = 'invisible';
break;
}
$children = $this->paginate($limit, array('page' => get($var, s::get($id)), 'omitFirstPage' => false, 'variable' => $var, 'method' => 'query'));
// store the last page
s::set($id, $children->pagination()->page());
return $children;
} else {
return $this;
}
}
开发者ID:irenehilber,项目名称:kirby-base,代码行数:26,代码来源:children.php
示例12: 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;
}
}
开发者ID:irenehilber,项目名称:kirby-base,代码行数:29,代码来源:topbar.php
示例13: signup
protected function signup()
{
$self = $this;
$form = $this->form('installation/signup', array(), function ($form) use($self) {
$form->validate();
if (!$form->isValid()) {
return false;
}
try {
// fetch all the form data
$data = $form->serialize();
// make sure that the first user is an admin
$data['role'] = 'admin';
// try to create the new user
$user = site()->users()->create($data);
// store the new username for the login screen
s::set('username', $user->username());
// try to login the user automatically
if ($user->hasPanelAccess()) {
$user->login($data['password']);
}
// redirect to the login
$self->redirect('login');
} catch (Exception $e) {
$form->alert($e->getMessage());
}
});
return $this->modal('index', compact('form'));
}
开发者ID:irenehilber,项目名称:kirby-base,代码行数:29,代码来源:installation.php
示例14: logout
public function logout()
{
s::restart();
if ($user = panel()->site()->user()) {
$user->logout();
}
go(panel()->urls()->login());
}
开发者ID:LucasFyl,项目名称:korakia,代码行数:8,代码来源:auth.php
示例15: tearDown
protected function tearDown()
{
s::restart();
// clean all triggers
kirby::$triggered = array();
kirby::$hooks = array();
$this->removeContent();
$this->removeAccounts();
}
开发者ID:nsteiner,项目名称:kdoc,代码行数:9,代码来源:testcase.php
示例16: 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');
}
开发者ID:aoimedia,项目名称:aurer-kirby,代码行数:10,代码来源:message.php
示例17: rollApps
function rollApps()
{
$tmp = $apps = array();
$file = SYS_ROOT . 'conf/global/apps.ini';
$tmp = ini::parse($file);
foreach ($tmp as $k => $v) {
$v['app'] = $k;
s::roll('apps', $v);
}
}
开发者ID:rigidus,项目名称:ea,代码行数:10,代码来源:manage.app.php
示例18: kill
protected static function kill()
{
self::$user = null;
// overwrite the token
$token = str::random();
// the cookie is valid for 24 hours
cookie::set('authFrontend', $token, 60 * 60 * 24);
// restart the session
s::restart();
}
开发者ID:scheibome,项目名称:kirbycms-extensions,代码行数:10,代码来源:auth.php
示例19: getBlocks
function getBlocks($site_id = 1)
{
db::table('blocks');
db::where('site_id', $site_id);
db::where('block_pub', '1');
db::order('block_name');
$res = db::select();
while ($row = mysql_fetch_assoc($res)) {
s::roll('blocks', $row);
}
}
开发者ID:rigidus,项目名称:ea,代码行数:11,代码来源:blocks.app.php
示例20: getMenus
function getMenus($site_id)
{
db::table('menus');
db::where('site_id', $site_id);
db::where('menu_pub', '1');
db::order('menu_title');
$res = db::select();
while ($row = mysql_fetch_assoc($res)) {
s::roll('menus', $row);
}
}
开发者ID:rigidus,项目名称:ea,代码行数:11,代码来源:menus.app.php
注:本文中的s类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论