当前位置: 首页>>代码示例>>PHP>>正文


PHP s::set方法代码示例

本文整理汇总了PHP中s::set方法的典型用法代码示例。如果您正苦于以下问题:PHP s::set方法的具体用法?PHP s::set怎么用?PHP s::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在s的用法示例。


在下文中一共展示了s::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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

示例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);
         }
     }
 }
开发者ID:buditanrim,项目名称:kirby-comments,代码行数:29,代码来源: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: 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

示例5: login

 public static function login($redirect = '/')
 {
     if (self::user()) {
         go(url($redirect));
     }
     self::kill();
     $password = get('password');
     $username = get('username');
     if (empty($username) || empty($password)) {
         return false;
     }
     // try to find the user
     $account = self::load($username);
     if (!$account) {
         return array('status' => 'error', 'msg' => l::get('auth.error', 'Invalid username or password'));
     }
     // check for matching usernames
     if (str::lower($account->username()) != str::lower($username)) {
         return array('status' => 'error', 'msg' => l::get('auth.error', 'Invalid username or password'));
     }
     // check for a matching password
     if (!self::checkPassword($account, $password)) {
         return array('status' => 'error', 'msg' => l::get('auth.error', 'Invalid username or password'));
     }
     // generate a random token
     $token = str::random();
     // add the username.
     $account->token = $token;
     // store the token in the cookie
     // and the user data in the session
     cookie::set('authFrontend', $token, 60 * 60 * 24);
     s::set('authFrontend.' . $token, $account->username());
     go(url($redirect));
 }
开发者ID:scheibome,项目名称:kirbycms-extensions,代码行数:34,代码来源:auth.php

示例6: login

 function login()
 {
     s::restart();
     $password = get('password');
     $username = get('username');
     if (empty($username) || empty($password)) {
         return array('status' => 'error', 'msg' => l::get('login.error'));
     }
     $account = self::load($username);
     if (!$account) {
         return array('status' => 'error', 'msg' => l::get('login.error'));
     }
     // check for matching usernames
     if (str::lower($account['username']) != str::lower($username)) {
         return array('status' => 'error', 'msg' => l::get('login.error'));
     }
     // check for a matching password
     if (!self::checkPassword($account, $password)) {
         return array('status' => 'error', 'msg' => l::get('login.error'));
     }
     // generate a random token
     $token = str::random();
     // add the username.
     // It's only the key of the array so far.
     $account['token'] = $token;
     // store the token in the cookie
     // and the user data in the session
     cookie::set('auth', $token, 60 * 60 * 24);
     s::set($token, $account);
     // assign the user data to this obj
     $this->_ = $account;
     return array('status' => 'success', 'msg' => l::get('login.success'));
 }
开发者ID:codecuts,项目名称:lanningsmith-website,代码行数:33,代码来源:user.php

示例7: 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

示例8: 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

示例9: 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

示例10: delete

 public function delete($id)
 {
     if (!array_key_exists($id, $this->data)) {
         return;
     }
     unset($this->data[$id]);
     s::set('cart', $this->data);
 }
开发者ID:CelineDesign,项目名称:shopkit,代码行数:8,代码来源:Cart.php

示例11: set

 public static function set($name, $value, $type = 'plain')
 {
     $messages = s::get('messages') ? s::get('messages') : array();
     $message = new stdClass();
     $message->name = $name;
     $message->value = $value;
     $message->type = $type;
     $messages[$name] = $message;
     s::set('messages', $messages);
 }
开发者ID:aoimedia,项目名称:aurer-kirby,代码行数:10,代码来源:message.php

示例12: add_to_visited_links

function add_to_visited_links($url)
{
    $url = rtrim($url, '/');
    $visited_links = s::get('visited_links');
    if (!$visited_links) {
        $visited_links = array();
    }
    array_push($visited_links, $url);
    s::set('visited_links', array_unique($visited_links));
}
开发者ID:arnaudjuracek,项目名称:www-boite-noire,代码行数:10,代码来源:outils.php

示例13: show

 function show()
 {
     $event = web::getEvent();
     if ($event === false) {
         $year = date('Y');
     } else {
         $year = $event;
     }
     s::set('info_date_select', htmlspecialchars($year));
     $sql = "SELECT `section_year` as date FROM `info_sections` WHERE `section_view`='0'  GROUP BY `date` ORDER BY `date` DESC";
     $res = db::query($sql);
     $rows = mysql_num_rows($res);
     if ($rows > 1) {
         s::add('info_date_selector', '<ul class="years">');
         while ($row = mysql_fetch_assoc($res)) {
             if ($row['date'] == $year) {
                 $row['date'] = '<li><span>' . $row['date'] . '</span></li>';
             } else {
                 $row['date'] = '<li><a href="' . web::get('page_folder') . '' . $row['date'] . '/">' . $row['date'] . '</a></li>';
             }
             s::add('info_date_selector', $row['date']);
         }
         s::add('info_date_selector', '</ul>');
     }
     $files = array();
     db::table('info_files');
     $r = db::select();
     while ($a = mysql_fetch_assoc($r)) {
         $files[$a['section_id']][] = $a;
     }
     db::table('info_sections');
     db::order('section_order', 'DESC');
     db::where('section_year', $year);
     $r = db::select();
     if (db::rows() == 0) {
         web::error404();
     }
     while ($a = mysql_fetch_assoc($r)) {
         if ($a['section_view'] == '0') {
             s::roll('sections', $a);
         } else {
             s::roll('sections_view', $a);
         }
         if (isset($files[$a['section_id']])) {
             foreach ($files[$a['section_id']] as $v) {
                 $v['file_icon'] = files::getFileIco($v['file_type']);
                 $v['file_size'] = files::parseSizeSmart($v['file_size']);
                 s::roll('items' . $a['section_id'], $v);
             }
         }
     }
 }
开发者ID:rigidus,项目名称:ea,代码行数:52,代码来源:main.handler.php

示例14: configure

 public static function configure()
 {
     if (is_null(static::$site)) {
         static::$site = kirby::panelsetup();
     }
     // load all available routes
     static::$routes = array_merge(static::$routes, require root('panel.app.routes') . DS . 'api.php');
     static::$routes = array_merge(static::$routes, require root('panel.app.routes') . DS . 'views.php');
     // setup the blueprint root
     blueprint::$root = c::get('root.site') . DS . 'blueprints';
     // start the router
     static::$router = new Router();
     static::$router->register(static::$routes);
     // content language switcher variable
     if (static::$site->multilang()) {
         if ($language = server::get('http_language') or $language = s::get('lang')) {
             static::$site->visit('/', $language);
         }
         app::$language = static::$site->language()->code();
         s::set('lang', app::$language);
     }
     // load the interface language file
     if (static::$site->user()) {
         $languageCode = static::$site->user()->language();
     } else {
         $languageCode = c::get('panel.language', 'en');
     }
     // validate the language code
     if (!in_array($languageCode, static::languages()->keys())) {
         $languageCode = 'en';
     }
     // store the interface language
     app::$interfaceLanguage = $languageCode;
     $language = (require root('panel.app.languages') . DS . $languageCode . '.php');
     // set all language variables
     l::$data = $language['data'];
     // register router filters
     static::$router->filter('auth', function () {
         if (!app::$site->user()) {
             go('panel/login');
         }
     });
     // check for a completed installation
     static::$router->filter('isInstalled', function () {
         if (app::$site->users()->count() == 0) {
             go('panel/install');
         }
     });
     // only use the fragments of the path without params
     static::$path = implode('/', (array) url::fragments(detect::path()));
 }
开发者ID:kompuser,项目名称:panel,代码行数:51,代码来源:app.php

示例15: start

 function start()
 {
     db::connect();
     if (!router::get(1)) {
         return true;
     }
     self::$map = array('mode' => router::get(0), 'app' => router::get(1), 'module' => 'main', 'action' => router::get(2), 'id' => router::get(4));
     s::set('SYS_PATH', 'http://' . SERVER . SYS_DIR);
     define('APP', APPS . self::get('app') . '/');
     s::set('APP', APP);
     define('MODULE', APP . self::get('module') . '/');
     s::set('MODULE', MODULE);
     if (stristr(self::$map['mode'], 'admin')) {
         self::$map['mode'] = 'admin';
     } else {
         self::$map['mode'] = 'web';
     }
     if (self::$map['mode'] == 'admin') {
         if (defined('ADMIN_USER_SITE_ID')) {
             admin::observer();
             define('ADMIN_SITE_ID', ADMIN_USER_SITE_ID);
             s::set('ADMIN_SITE_ID', ADMIN_USER_SITE_ID);
             db::table('admin_sites');
             db::where('site_id', ADMIN_USER_SITE_ID);
             db::limit(1);
             $row = db::select();
             define('ADMIN_SITE', db::get('site_domain'));
             s::set('ADMIN_SITE', ADMIN_SITE);
         }
     } else {
         web::getSite();
         $lang = lang::gets(LANG_INDEX, SITE_ID);
         /*
         	Authentification webUser
         */
         web::observer();
     }
     /*
     	Set params
     */
     params::send();
     if (router::get(0) == 'feed' || router::get(0) == 'rss') {
         self::$map['module'] = 'feed';
     }
     if (self::$map['mode'] == 'admin') {
         load::module(self::get('app'), self::get('module'), self::get('action'));
     } else {
         load::handler(self::get('app'), self::get('module'), self::get('action'));
     }
 }
开发者ID:rigidus,项目名称:ea,代码行数:50,代码来源:loader.php


注:本文中的s::set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。