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


PHP Cookie::expiration方法代码示例

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


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

示例1: init

 /**
  * Application initialization
  *     - Loads the plugins
  *     - Sets the cookie configuration
  */
 public static function init()
 {
     // Set defaule cache configuration
     Cache::$default = Kohana::$config->load('site')->get('default_cache');
     try {
         $cache = Cache::instance()->get('dummy' . rand(0, 99));
     } catch (Exception $e) {
         // Use the dummy driver
         Cache::$default = 'dummy';
     }
     // Load the plugins
     Swiftriver_Plugins::load();
     // Add the current default theme to the list of modules
     $theme = Swiftriver::get_setting('site_theme');
     if (isset($theme) and $theme != "default") {
         Kohana::modules(array_merge(array('themes/' . $theme->value => THEMEPATH . $theme->value), Kohana::modules()));
     }
     // Clean up
     unset($active_plugins, $theme);
     // Load the cookie configuration
     $cookie_config = Kohana::$config->load('cookie');
     Cookie::$httponly = TRUE;
     Cookie::$salt = $cookie_config->get('salt', Swiftriver::DEFAULT_COOKIE_SALT);
     Cookie::$domain = $cookie_config->get('domain') or '';
     Cookie::$secure = $cookie_config->get('secure') or FALSE;
     Cookie::$expiration = $cookie_config->get('expiration') or 0;
     // Set the default site locale
     I18n::$lang = Swiftriver::get_setting('site_locale');
 }
开发者ID:aliyubash23,项目名称:SwiftRiver,代码行数:34,代码来源:Swiftriver.php

示例2:

 * - boolean  profile     enable or disable internal profiling               TRUE
 * - boolean  caching     enable or disable internal caching                 FALSE
 * - boolean  expose      set the X-Powered-By header                        FALSE
 */
Kohana::init(array('base_url' => '/kohana/'));
/**
 * Attach the file write to logging. Multiple writers are supported.
 */
Kohana::$log->attach(new Log_File(APPPATH . 'logs'));
/**
 * Attach a file reader to config. Multiple readers are supported.
 */
Kohana::$config->attach(new Config_File());
Cookie::$salt = 'vFkdZeP74127asfNT';
// Please don't change this option at the work site
Cookie::$expiration = 1209600;
// 1209600 - 2 weeks
/**
 * Enable modules. Modules are referenced by a relative or absolute path.
 */
Kohana::modules(array('parsers' => MODPATH . 'parsers'));
/**
 * Cookie Salt
 * @see  http://kohanaframework.org/3.3/guide/kohana/cookies
 * 
 * If you have not defined a cookie salt in your Cookie class then
 * uncomment the line below and define a preferrably long salt.
 */
// Cookie::$salt = NULL;
/**
 * Set the routes. Each route must have a minimum of a name, a URI and a set of
开发者ID:bruhanda,项目名称:parser,代码行数:31,代码来源:bootstrap.php

示例3:

 function action_add_comment($postid)
 {
     $this->allowcomment = $this->post->get_access($this->postid);
     $this->action_post_main();
     $this->action_main_categories();
     $this->username = Auth::instance()->get_user()->username;
     if (Captcha::valid($_POST['captcha']) and $this->allowcomment == 1 or !empty($this->username)) {
         $this->validate = $this->comment->validate_comment();
         if ($this->post->check_post($postid) == TRUE and $this->validate === TRUE) {
             $this->comment->add_comment($postid);
             Cookie::$expiration = Date::WEEK;
             Cookie::set('comment_username', $_POST['username']);
             Cookie::set('comment_url', $_POST['url']);
             $this->request->redirect($_SERVER['HTTP_REFERER']);
         } else {
             $this->template->content->errors = $this->validate;
         }
     }
     $this->action_comments_params();
 }
开发者ID:purplexcite,项目名称:Purpled-Blog-Engine,代码行数:20,代码来源:site.php

示例4: array

 */
Kohana::$log->attach(new Log_File(APPPATH . 'logs'));
/**
 * Attach a file reader to config. Multiple readers are supported.
 */
Kohana::$config->attach(new Config_File());
/**
 * Enable modules. Modules are referenced by a relative or absolute path.
 */
Kohana::modules(array('cache' => MODPATH . 'cache', 'database' => MODPATH . 'database', 'image' => MODPATH . 'image', 'orm' => MODPATH . 'orm', 'paypal' => MODPATH . 'paypal', 'kandler' => MODPATH . 'kandler', 'email' => MODPATH . 'email', 'pagination' => MODPATH . 'pagination', 'sitemap' => MODPATH . 'sitemap', 'amazon' => MODPATH . 'amazon'));
/**
 * Cache
 */
Kohana::$caching = TRUE;
Cache::$default = 'apc';
/**
 * Set the routes. Each route must have a minimum of a name, a URI and a set of
 * defaults for the URI.
 */
// Default route
Route::set('default', '(<controller>(/<action>(/<id>)))')->defaults(array('controller' => 'ads', 'action' => 'home'));
// Error route
Route::set('error', 'error/<action>(/<message>)', array('action' => '[0-9]++', 'message' => '.+'))->defaults(array('controller' => 'error_handler'));
/**
 * Cookie configuration settings
 */
Cookie::$salt = 'ASJ12094X:F?!*!*AD';
Cookie::$expiration = Date::MONTH;
Cookie::$httponly = TRUE;
Cookie::$secure = isset($_SERVER["HTTPS"]);
Cookie::$domain = '.gowork.at';
开发者ID:hbarroso,项目名称:Goworkat,代码行数:31,代码来源:bootstrap.php

示例5:

 * Initialize Kohana, setting the default options.
 *
 * The following options are available:
 *
 * - string   base_url    path, and optionally domain, of your application   NULL
 * - string   index_file  name of your index file, usually "index.php"       index.php
 * - string   charset     internal character set used for input and output   utf-8
 * - string   cache_dir   set the internal cache directory                   APPPATH/cache
 * - integer  cache_life  lifetime, in seconds, of items cached              60
 * - boolean  errors      enable or disable error handling                   TRUE
 * - boolean  profile     enable or disable internal profiling               TRUE
 * - boolean  caching     enable or disable internal caching                 FALSE
 * - boolean  expose      set the X-Powered-By header                        FALSE
 */
Kohana::init(array('errors' => true, 'base_url' => '/', 'index_file' => false));
Cookie::$salt = 'asdahsdfzfcsEERfAf';
Cookie::$httponly = TRUE;
Cookie::$expiration = Date::WEEK;
/**
 * Attach the file write to logging. Multiple writers are supported.
 */
Kohana::$log->attach(new Log_File(APPPATH . 'logs'));
/**
 * Attach a file reader to config. Multiple readers are supported.
 */
Kohana::$config->attach(new Config_File());
/**
 * Enable modules. Modules are referenced by a relative or absolute path.
 */
Kohana::modules(array('oauth' => MODPATH . 'oauth', 'cache' => MODPATH . 'cache', 'database' => MODPATH . 'database', 'image' => MODPATH . 'image', 'minion' => MODPATH . 'minion', 'orm' => MODPATH . 'orm', 'unittest' => MODPATH . 'unittest'));
require APPPATH . 'routes' . EXT;
开发者ID:Kapitonova,项目名称:codex,代码行数:31,代码来源:bootstrap.php

示例6: array

# copy config/init.php.default to config/init.php
Kohana::init(include APPPATH . 'config/init.php');
/**
 * Attach the file write to logging. Multiple writers are supported.
 */
Kohana::$log->attach(new Log_File(APPPATH . 'logs'));
/**
 * Attach a file reader to config. Multiple readers are supported.
 */
Kohana::$config->attach(new Config_File());
/**
 * Cookie config.
 */
$cookie = Kohana::$config->load('cookie');
Cookie::$salt = $cookie->salt;
Cookie::$expiration = $cookie->expiration;
Cookie::$domain = $cookie->domain;
Cookie::$path = $cookie->path;
Cookie::$secure = $cookie->secure;
Cookie::$httponly = $cookie->httponly;
/**
 * Enable modules. Modules are referenced by a relative or absolute path.
 */
Kohana::modules(array());
/**
 * Set the routes. Each route must have a minimum of a name, a URI and a set of
 * defaults for the URI.
 */
Route::set('api', '<directory>(/<controller>(/<action>(/<params>)))', array('params' => '.*', 'directory' => '(v1|v2)'))->defaults(array('controller' => 'defaults', 'action' => 'index', 'directory' => 'v1'));
Route::set('join', 'join')->defaults(array('controller' => 'auth', 'action' => 'join'));
Route::set('default', '(<controller>(/<action>(/<id>)))')->defaults(array('controller' => 'welcome', 'action' => 'index'));
开发者ID:rhrn,项目名称:apirn,代码行数:31,代码来源:bootstrap.php

示例7:

Kohana::init(array('base_url' => '/', 'caching' => TRUE, 'profile' => FALSE, 'index_file' => FALSE));
/**
 * Attach the file write to logging. Multiple writers are supported.
 */
Kohana::$log->attach(new Log_File(APPPATH . 'logs'));
/**
 * Attach a file reader to config. Multiple readers are supported.
 */
Kohana::$config->attach(new Config_File());
/**
 * Enable modules. Modules are referenced by a relative or absolute path.
 */
Kohana::modules(array('auth' => MODPATH . 'auth', 'cache' => MODPATH . 'cache', 'codebench' => MODPATH . 'codebench', 'database' => MODPATH . 'database', 'image' => MODPATH . 'image', 'minion' => MODPATH . 'minion', 'unittest' => MODPATH . 'unittest', 'userguide' => MODPATH . 'userguide', 'cms' => MODPATH . 'cms', 'tbl' => MODPATH . 'tbl', 'tpl' => MODPATH . 'tpl', 'pgn' => MODPATH . 'pgn', 'notice' => MODPATH . 'notice', 'email' => MODPATH . 'email', 'mysqli' => MODPATH . 'mysqli'));
/**
 * Get settings
 */
// Kohx
$settings = (object) Tbl::factory('settings')->read()->as_array('key', 'value');
// Set timezoon
date_default_timezone_set($settings->timezoon);
Cookie::$salt = $settings->cooki_salt;
Cookie::$expiration = Cms_Helper::sec($settings->cooki_expiration);
Session::$default = 'database';
/**
 * Set the routes. Each route must have a minimum of a name, a URI and a set of
 * defaults for the URI.
 */
// Kohx
Cms_Route::write();
// Default
Route::set('default', '(<controller>(/<action>(/<id>)))')->defaults(array('controller' => 'home', 'action' => 'index'));
开发者ID:deraemons,项目名称:deraemon-cms,代码行数:31,代码来源:bootstrap.php

示例8: constant

 */
spl_autoload_register(array('Kohana', 'auto_load'));
/**
 * Enable the Kohana auto-loader for unserialization.
 *
 * @link http://www.php.net/manual/function.spl-autoload-call
 * @link http://www.php.net/manual/var.configuration#unserialize-callback-func
 */
ini_set('unserialize_callback_func', 'spl_autoload_call');
// -- Configuration and initialization -----------------------------------------
/**
 * Set the default language
 */
I18n::lang('en-us');
Cookie::$salt = 'generatedsalt';
Cookie::$expiration = 6400;
/**
 * Set Kohana::$environment if a 'KOHANA_ENV' environment variable has been supplied.
 *
 * Note: If you supply an invalid environment name, a PHP warning will be thrown
 * saying "Couldn't find constant Kohana::<INVALID_ENV_NAME>"
 */
if (isset($_SERVER['KOHANA_ENV'])) {
    Kohana::$environment = constant('Kohana::' . strtoupper($_SERVER['KOHANA_ENV']));
}
/**
 * Initialize Kohana, setting the default options.
 *
 * The following options are available:
 *
 * - string   base_url    path, and optionally domain, of your application   NULL
开发者ID:reGative,项目名称:Phorumph,代码行数:31,代码来源:bootstrap.php

示例9: constant

 */
spl_autoload_register(array('Kohana', 'auto_load'));
/**
 * Enable the Kohana auto-loader for unserialization.
 *
 * @see  http://php.net/spl_autoload_call
 * @see  http://php.net/manual/var.configuration.php#unserialize-callback-func
 */
ini_set('unserialize_callback_func', 'spl_autoload_call');
// -- Configuration and initialization -----------------------------------------
/**
 * Set the default language
 */
I18n::lang('lv');
Cookie::$salt = 'user cookie';
Cookie::$expiration = 604800;
/**
 * Set Kohana::$environment if a 'KOHANA_ENV' environment variable has been supplied.
 *
 * Note: If you supply an invalid environment name, a PHP warning will be thrown
 * saying "Couldn't find constant Kohana::<INVALID_ENV_NAME>"
 */
if (isset($_SERVER['KOHANA_ENV'])) {
    Kohana::$environment = constant('Kohana::' . strtoupper($_SERVER['KOHANA_ENV']));
}
/**
 * Initialize Kohana, setting the default options.
 *
 * The following options are available:
 *
 * - string   base_url    path, and optionally domain, of your application   NULL
开发者ID:reGative,项目名称:NewsLV,代码行数:31,代码来源:bootstrap.php

示例10: _set_cookie

 /**
  * Set default cookie [salt](gleez/cookie/config#salt)
  * and [lifetime](gleez/cookie/config#expiration)
  *
  * Also you can define a salt for the `Cookie` class in bootstrap.php:
  * ~~~
  * Cookie::$salt = [really-long-cookie-salt-here]
  * ~~~
  */
 protected static function _set_cookie()
 {
     /** @var Cookie::$salt string */
     Cookie::$salt = Config::get('cookie.salt');
     /** @var Cookie::$expiration string */
     Cookie::$expiration = Config::get('cookie.lifetime');
 }
开发者ID:ultimateprogramer,项目名称:cms,代码行数:16,代码来源:gleez.php

示例11:

Kohana::init(array('base_url' => '/ko32example/site', 'index_file' => FALSE, 'profile' => Kohana::$environment !== Kohana::PRODUCTION, 'caching' => Kohana::$environment === Kohana::PRODUCTION, 'errors' => FALSE));
/**
 * Attach the file write to logging. Multiple writers are supported.
 */
Kohana::$log->attach(new Log_File(APPPATH . 'logs'));
/**
 * Attach a file reader to config. Multiple readers are supported.
 */
Kohana::$config->attach(new Config_File());
/**
* Cookie
*/
// Set the magic salt to add to a cookie
Cookie::$salt = Kohana::$config->load('ko32example.cookie_salt');
// Set the number of seconds before a cookie expires
Cookie::$expiration = Kohana::$config->load('ko32example.cookie_lifetime');
// Restrict the path that the cookie is available to
//Cookie::$path = '/';
// Restrict the domain that the cookie is available to
//Cookie::$domain = 'www.kerkness.ca';
// Only transmit cookies over secure connections
//Cookie::$secure = TRUE;
// Only transmit cookies over HTTP, disabling Javascript access
//Cookie::$httponly = TRUE;
/**
 * Session
 */
Session::$default = 'database';
/**
 * Set the default language
 */
开发者ID:Oaks,项目名称:kohana-3.2-example,代码行数:31,代码来源:bootstrap.php

示例12: get_new_id

 private function get_new_id()
 {
     $sql = "insert into guest_id values (null, :md5sum , UNIX_TIMESTAMP(),UNIX_TIMESTAMP())";
     $md5sum = md5(date('dmY') . '-mega-' . rand(0, 1000));
     $query = DB::query(Database::INSERT, $sql);
     $query->param(':md5sum', $md5sum);
     $query->execute();
     $sql = "select LAST_INSERT_ID() as guest_id from dual";
     $query = DB::query(Database::SELECT, $sql);
     $res = $query->execute();
     $res = $res->as_array();
     $guest_id = $res[0]['guest_id'];
     $session = Session::instance();
     $session->set('guest_id', $guest_id);
     $session->set('guest_md5sum', $md5sum);
     if ($this->config["expiration"]) {
         Cookie::$expiration = $this->config["expiration"];
     } else {
         Cookie::$expiration = 2419200;
     }
     Cookie::set('guest_id', $guest_id);
     Cookie::set('guest_md5sum', $md5sum);
     return $guest_id;
 }
开发者ID:desc0n,项目名称:ideal-city,代码行数:24,代码来源:Guestid.php

示例13:

 * Initialize Kohana, setting the default options.
 *
 * The following options are available:
 *
 * - string   base_url    path, and optionally domain, of your application   NULL
 * - string   index_file  name of your index file, usually "index.php"       index.php
 * - string   charset     internal character set used for input and output   utf-8
 * - string   cache_dir   set the internal cache directory                   APPPATH/cache
 * - integer  cache_life  lifetime, in seconds, of items cached              60
 * - boolean  errors      enable or disable error handling                   TRUE
 * - boolean  profile     enable or disable internal profiling               TRUE
 * - boolean  caching     enable or disable internal caching                 FALSE
 * - boolean  expose      set the X-Powered-By header                        FALSE
 */
Kohana::init(array('base_url' => HTTPPRO . $_SERVER['HTTP_HOST']));
Cookie::$expiration = 86400 * 7;
//Cookie::$secure = TRUE;
Cookie::$httponly = TRUE;
Cookie::$salt = 'Hppi-ECi0Cv23GUi99vB58gh5TLcEfds4i098';
/**
 * Attach the file write to logging. Multiple writers are supported.
 */
Kohana::$log->attach(new Log_File(APPPATH . 'logs'));
/**
 * Attach a file reader to config. Multiple readers are supported.
 */
Kohana::$config->attach(new Config_File());
/**
 * Enable modules. Modules are referenced by a relative or absolute path.
 */
Kohana::modules(array('cache' => MODPATH . 'cache', 'kohana-mssql' => MODPATH . 'kohana-mssql', 'database' => MODPATH . 'database', 'captcha' => MODPATH . 'captcha', 'koredis' => MODPATH . 'koredis'));
开发者ID:rucky2013,项目名称:kohana-php-admin,代码行数:31,代码来源:bootstrap.php


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