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


PHP Cookie::has方法代码示例

本文整理汇总了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);
                }
            }
        }
    }
}
开发者ID:TahsinGokalp,项目名称:L3-Eticaret,代码行数:30,代码来源:helpers.php

示例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');
     }
 }
开发者ID:xenxa,项目名称:royalflushnetwork,代码行数:34,代码来源:LinkController.php

示例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;
 }
开发者ID:netixx,项目名称:frankiz,代码行数:26,代码来源:frankizpage.php

示例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;
 }
开发者ID:vsch,项目名称:laravel-translation-manager,代码行数:27,代码来源:Translator.php

示例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;
 }
开发者ID:masikonis,项目名称:laravel-geography,代码行数:14,代码来源:CookieTrait.php

示例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']);
 }
开发者ID:nguyendaivu,项目名称:imagestock,代码行数:34,代码来源:AdminController.php

示例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;
 }
开发者ID:agriya,项目名称:webshoppack,代码行数:8,代码来源:ProductService.php

示例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);
 }
开发者ID:meixelsberger,项目名称:concrete5-5.7.0,代码行数:12,代码来源:DashboardPageController.php

示例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;
 }
开发者ID:CSFix,项目名称:L3-Eticaret,代码行数:13,代码来源:cart.php

示例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];
     //    }
     //});
 }
开发者ID:kduma-archive,项目名称:laravel-translation-manager-1,代码行数:45,代码来源:Controller.php

示例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;
 }
开发者ID:netixx,项目名称:frankiz,代码行数:21,代码来源:frankizsession.php

示例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;
 }
开发者ID:Ekleog,项目名称:platal,代码行数:22,代码来源:xorgsession.php

示例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);
     }
 }
开发者ID:seebaermichi,项目名称:concrete5,代码行数:20,代码来源:DashboardPageController.php

示例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('/');
     }
 }
开发者ID:xenxa,项目名称:essensanaturaleonline,代码行数:46,代码来源:LinkController.php

示例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);
 }
开发者ID:neworldwebsites,项目名称:noblessecms,代码行数:38,代码来源:controlAdmincp.php


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