本文整理汇总了PHP中Cookie::has方法的典型用法代码示例。如果您正苦于以下问题:PHP Cookie::has方法的具体用法?PHP Cookie::has怎么用?PHP Cookie::has使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cookie
的用法示例。
在下文中一共展示了Cookie::has方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Check_User_Cart
function Check_User_Cart()
{
$Identifier = '';
if (!Sentry::check()) {
return false;
} else {
$Identifier = Sentry::user()->id;
if (Cookie::has('Anon_Cart_Extension')) {
$AnonIdentifier = Cookie::get('Anon_Cart_Extension');
$dataAnon = Cache::get('user_cart.' . $AnonIdentifier);
if (Cache::has('user_cart.' . $Identifier)) {
$dataUser = Cache::get('user_cart.' . $Identifier);
if ($dataAnon != null && $dataUser != null) {
foreach ($dataAnon as $key => $value) {
if (!isset($dataUser[$key])) {
$dataUser[$key] = $value;
}
}
Cache::forever('user_cart.' . $Identifier, $dataUser);
Cache::forget('user_cart.' . $AnonIdentifier);
}
} else {
if ($dataAnon != null) {
Cache::forever('user_cart.' . $Identifier, $dataAnon);
Cache::forget('user_cart.' . $AnonIdentifier);
}
}
}
}
}
示例2: showRefLink
/**
* [showRefLink description]
* Route::get('{link?}', ['as' => 'reflink', 'uses' => 'LinkController@showRefLink']);
*
* @param [text] $link [referral link]
*
* @return [json] [all info abou the link]
*/
public function showRefLink($link = null)
{
// // If it has a Sponsor Cookie
if (\Cookie::has('sponsor')) {
return Redirect::to('/');
// Load Referral Link View
}
if (is_null($link)) {
return Redirect::to('/');
// Redirect To HomePage
}
try {
// If has $Link then Look in Database if Exist
$link = Link::findByLink($link)->load('user.profile');
$link = $link->toArray();
// Note Cookie Wont Be Created if Exceeded More than 4kb
\Cookie::queue('sponsor', $link, 2628000);
// Return Referral View with Variable Link
return Redirect::to('/')->with('link', $link);
// If No Record Found Throw Exception!
} catch (ModelNotFoundException $e) {
// Return Back to Home
return Redirect::to('/');
// return view('nosponsor');
}
}
示例3: load_skin
private function load_skin()
{
global $globals;
//Force h4ck3s (reloaded)
/*
$gf = new GroupFilter((Group::isId('h4ck3s')) ? new GFC_Id('h4ck3s') : new GFC_Name('h4ck3s'));
$group = $gf->get(true);
if(!S::user()->hasRights($group, new Rights('member')) && !isSmartphone()){
S::set('skin', 'default.h4ck3s');
}
*/
if (!S::has('skin') || S::v('skin') == "") {
if (Cookie::has('skin')) {
$skin = Cookie::v('skin');
} else {
$skin = isSmartphone() ? $globals->smartphone_skin : $globals->skin;
}
S::set('skin', $skin);
} else {
$skin = S::v('skin');
if (S::v('auth') >= AUTH_COOKIE && Cookie::v('skin') != $skin) {
Cookie::set('skin', $skin, 300);
}
}
return $skin;
}
示例4: inPlaceEditing
public function inPlaceEditing($inPlaceEditing = null)
{
if ($inPlaceEditing !== null) {
$this->inPlaceEditing = $inPlaceEditing;
if ($this->useCookies) {
\Cookie::queue($this->cookiePrefix . 'lang_inplaceedit', $this->inPlaceEditing);
} else {
$session = $this->app->make('session');
if ($session->all()) {
// only put a value if session has already has some value set, meaning its been loaded
$session->put($this->cookiePrefix . 'lang_inplaceedit', $this->inPlaceEditing);
}
}
}
if ($this->inPlaceEditing === null) {
if ($this->useCookies) {
if (\Cookie::has($this->cookiePrefix . 'lang_inplaceedit')) {
$this->inPlaceEditing = \Cookie::get($this->cookiePrefix . 'lang_inplaceedit', 0);
$tmp = 0;
}
} else {
$session = $this->app->make('session');
$this->inPlaceEditing = $session->get($this->cookiePrefix . 'lang_inplaceedit', 0);
}
}
return $this->inPlaceEditing;
}
示例5: getCookie
/**
* Get data from the cookied.
*
* @param string $index
*
* @return bool|array
*/
public function getCookie($index)
{
if (\Cookie::has($index)) {
return unserialize(\Cookie::get($index));
}
return false;
}
示例6: errors
public static function errors($code = 404, $title = 'Oops! You\'re lost.', $message = '')
{
$ajax = Request::ajax();
if ($code == 404) {
$title = 'Oops! You\'re lost.';
$message = 'We can not find the page you\'re looking for.';
if (!$ajax) {
$message .= '<br/><a href="' . URL . '/admin">Return home </a>';
}
} else {
if ($code == 403) {
$title = 'Oops! You are not allowed to go to this page.';
$message = 'Please check your permission.';
if (!$ajax) {
$message .= '<a href="' . URL . '/admin">
Return home </a>';
}
} else {
if (!$code || $code == 500) {
$code = 500;
if (empty($title)) {
$title = 'Internal Server Error';
}
if (empty($message)) {
$message = 'We got problems over here. Please try again later!';
}
}
}
}
if ($ajax) {
return Response::json(['error' => ['title' => $title, 'message' => $message]], $code);
}
return View::make('admin.errors.error')->with(['title' => $title, 'code' => $code, 'message' => $message, 'admin' => Auth::admin()->get(), 'sideMenu' => Menu::getCache(['sidebar' => true]), 'currentTheme' => Cookie::has('theme') ? Cookie::get('theme') : 'default']);
}
示例7: getCookie
public function getCookie($cookie_name)
{
$value = "";
if (\Cookie::has($cookie_name) && \Cookie::get($cookie_name) != null) {
$value = \Cookie::get($cookie_name);
}
return $value;
}
示例8: on_start
public function on_start()
{
$this->token = Loader::helper('validation/token');
$this->error = Loader::helper('validation/error');
$this->set('interface', Loader::helper('concrete/ui'));
$this->set('dashboard', Loader::helper('concrete/dashboard'));
$hideDashboardPanel = false;
if (\Cookie::has('panels/dashboard/closed') && intval(\Cookie::get('panels/dashboard/closed')) == 1) {
$hideDashboardPanel = true;
}
$this->set('hideDashboardPanel', $hideDashboardPanel);
}
示例9: getIdentifier
private function getIdentifier()
{
$idt = '';
if (!Sentry::check()) {
if (!Cookie::has('Anon_Cart_Extension')) {
Cookie::forever('Anon_Cart_Extension', get_unique_id());
}
$idt = Cookie::get('Anon_Cart_Extension');
} else {
$idt = Sentry::user()->id;
}
return $idt;
}
示例10: __construct
public function __construct()
{
$this->package = \Vsch\TranslationManager\ManagerServiceProvider::PACKAGE;
$this->packagePrefix = $this->package . '::';
$this->manager = \App::make($this->package);
$this->connectionList = [];
$this->connectionList[''] = 'default';
$connections = $this->manager->config(Manager::DB_CONNECTIONS_KEY);
if ($connections && array_key_exists(\App::environment(), $connections)) {
foreach ($connections[\App::environment()] as $key => $value) {
if (array_key_exists('description', $value)) {
$this->connectionList[$key] = $value['description'];
} else {
$this->connectionList[$key] = $key;
}
}
}
$this->cookiePrefix = $this->manager->config('persistent_prefix', 'K9N6YPi9WHwKp6E3jGbx');
$connectionName = \Cookie::has($this->cookieName(self::COOKIE_CONNECTION_NAME)) ? \Cookie::get($this->cookieName(self::COOKIE_CONNECTION_NAME)) : '';
$this->setConnectionName($connectionName);
$locale = \Cookie::get($this->cookieName(self::COOKIE_LANG_LOCALE), \Lang::getLocale());
\App::setLocale($locale);
$this->primaryLocale = \Cookie::get($this->cookieName(self::COOKIE_PRIM_LOCALE), $this->manager->config('primary_locale', 'en'));
$this->locales = $this->loadLocales();
$this->translatingLocale = \Cookie::get($this->cookieName(self::COOKIE_TRANS_LOCALE));
$this->showUsageInfo = \Cookie::get($this->cookieName(self::COOKIE_SHOW_USAGE));
$this->transFilters = \Cookie::get($this->cookieName(self::COOKIE_TRANS_FILTERS), ['filter' => 'show-all', 'regex' => '']);
if (!$this->translatingLocale || $this->translatingLocale === $this->primaryLocale && count($this->locales) > 1) {
$this->translatingLocale = count($this->locales) > 1 ? $this->locales[1] : $this->locales[0];
\Cookie::queue($this->cookieName(self::COOKIE_TRANS_LOCALE), $this->translatingLocale, 60 * 24 * 365 * 1);
}
$this->displayLocales = \Cookie::has($this->cookieName(self::COOKIE_DISP_LOCALES)) ? \Cookie::get($this->cookieName(self::COOKIE_DISP_LOCALES)) : implode(',', array_slice($this->locales, 0, 5));
$this->displayLocales .= implode(',', array_flatten(array_unique(explode(',', ($this->displayLocales ? ',' : '') . $this->primaryLocale . ',' . $this->translatingLocale))));
//$this->sqltraces = [];
//$this->logSql = 0;
//
//$thisController = $this;
//\Event::listen('illuminate.query', function ($query, $bindings, $time, $name) use ($thisController)
//{
// if ($thisController->logSql)
// {
// $thisController->sqltraces[] = ['query' => $query, 'bindings' => $bindings, 'time' => $time];
// }
//});
}
示例11: tryCookie
/** Checks the cookie and set user_id according in cookie_uid variable
*/
private function tryCookie()
{
S::kill('cookie_uid');
//Remove previously stored id
if (!Cookie::has('uid') || !Cookie::has('hash')) {
return self::COOKIE_INCOMPLETE;
}
$res = XDB::query("SELECT uid, password\n FROM account\n WHERE uid = {?} AND state = 'active'", Cookie::i('uid'));
if ($res->numRows() == 1) {
list($uid, $password) = $res->fetchOneRow();
if (sha1($password) == Cookie::v('hash')) {
S::set('cookie_uid', $uid);
return self::COOKIE_SUCCESS;
} else {
return self::COOKIE_WRONG_HASH;
}
}
return self::COOKIE_WRONG_UID;
}
示例12: tryCookie
/** Check the cookie and set the associated uid in the auth_by_cookie session variable.
*/
private function tryCookie()
{
S::kill('auth_by_cookie');
if (Cookie::v('access') == '' || !Cookie::has('uid')) {
return self::NO_COOKIE;
}
$res = XDB::query('SELECT uid, password
FROM accounts
WHERE uid = {?} AND state = \'active\'', Cookie::i('uid'));
if ($res->numRows() != 0) {
list($uid, $password) = $res->fetchOneRow();
if (sha1($password) == Cookie::v('access')) {
S::set('auth_by_cookie', $uid);
return self::COOKIE_SUCCESS;
} else {
return self::INVALID_COOKIE;
}
}
return self::INVALID_USER;
}
示例13: on_start
public function on_start()
{
$this->token = Loader::helper('validation/token');
$this->error = Loader::helper('validation/error');
$this->set('interface', Loader::helper('concrete/ui'));
$this->set('dashboard', Loader::helper('concrete/dashboard'));
$this->entityManager = \Core::make('Doctrine\\ORM\\EntityManager');
$hideDashboardPanel = false;
if (\Cookie::has('dashboardPanelStatus') && \Cookie::get('dashboardPanelStatus') == 'closed') {
$hideDashboardPanel = true;
}
$this->set('hideDashboardPanel', $hideDashboardPanel);
\Core::make('helper/concrete/dashboard');
$dh = \Concrete\Core\Application\Service\DashboardMenu::getMine();
if ($dh->contains($this->getPageObject())) {
$this->set("_bookmarked", true);
} else {
$this->set('_bookmarked', false);
}
}
示例14: showRefLink
/**
* [showRefLink description]
* Route::get('{link?}', ['as' => 'reflink', 'uses' => 'LinkController@showRefLink']);
*
* @param [text] $link [referral link]
*
* @return [json] [all info about the link]
*/
public function showRefLink($link = null)
{
// // If it has a Sponsor Cookie
if (\Cookie::has('sponsor')) {
$cookie = \Cookie::get('sponsor');
$link = $cookie['link'];
$link = Link::findByLink($link)->load('user.profile');
$product = Product::find(1);
return view('pages.referralLink')->with(compact('link', 'product'));
}
// Check if the Provided Link is Valid Redirect to Home if Invalid Link!
try {
$link = Link::findByLink($link);
$sp_lid = $link->id;
// If Sponsor is Not Active LeapFrog to ActiveSponsor
if (!$link->active) {
$sp_lid = $link->activeSponsor($sp_lid);
}
// Load User Profile
$link = Link::find($sp_lid)->load('user.profile');
$splink = [];
$splink['id'] = $link->id;
$splink['user_id'] = $link->user_id;
$splink['link'] = $link->link;
// Load Product
$product = Product::find(1);
// Assign $splink to the cookie
// Note Cookie Wont Be Created if Exceeded More than 4kb
// Cookie set Forever / 5 Years or until Cache Clear
// No Needed To Return With Cookie if it is Queue
$cookie = \Cookie::queue('sponsor', $splink, 2628000);
// Return Referral View with Variable Link
return view('pages.referralLink')->with(compact('link', 'product'));
// LINK PROVIDED IS INVALID REDIRECT HOME
} catch (ModelNotFoundException $e) {
return Redirect::to('/');
}
}
示例15: index
public function index()
{
$controlName = 'admincp/controlDashboard';
if (Cookie::has('userid')) {
$valid = UserGroups::getPermission(Users::getCookieGroupId(), 'can_view_admincp');
if ($valid != 'yes') {
Alert::make('You not have permission to view this page');
}
$controlName = 'admincp/controlDashboard';
$default_adminpage_method = trim(System::getSetting('default_adminpage_method', 'none'));
if ($default_adminpage_method == 'url') {
$default_adminpage = trim(System::getSetting('default_adminpage_url', 'admincp/'));
if ($default_adminpage != 'admincp/' && System::getUri() == 'admincp/') {
$beginUri = 'admincp';
if ($default_adminpage[0] != '/') {
$beginUri .= '/';
}
System::setUri($beginUri . $default_adminpage);
}
}
if ($match = Uri::match('^admincp\\/(\\w+)')) {
$controlName = 'admincp/control' . ucfirst($match[1]);
}
} else {
$controlName = 'admincp/controlLogin';
if ($match = Uri::match('^admincp\\/forgotpass')) {
$controlName = 'admincp/controlForgotpass';
}
}
$codeHead = Plugins::load('admincp_header');
$codeHead = is_array($codeHead) ? '' : $codeHead;
$codeFooter = Plugins::load('admincp_footer');
$codeFooter = is_array($codeFooter) ? '' : $codeFooter;
// print_r($codeHead);die();
System::defineGlobalVar('admincp_header', $codeHead);
System::defineGlobalVar('admincp_footer', $codeFooter);
Controller::load($controlName);
}