hasAllowedCookies() публичный статический Метод

Has the visitor allowed cookies?
public static hasAllowedCookies ( ) : boolean
Результат boolean
Пример #1
0
 /**
  * Get the data
  */
 private function getData()
 {
     // get cookie
     $this->orderId = Cookie::get('order_id');
     // check if cookies are available
     $this->cookiesEnabled = Cookie::hasAllowedCookies();
     // check if cookies exists
     if ($this->orderId || $this->cookiesEnabled == true) {
         // get the products
         $this->products = FrontendCatalogModel::getProductsByOrder($this->orderId);
         // count amount of products in shopping cart
         $this->amountOfProducts = count($this->products);
         // total price
         $this->totalPrice = '0';
         // calculate total amount
         foreach ($this->products as &$product) {
             // calculate total
             $subtotal = (int) $product['subtotal_price'];
             $this->totalPrice = (int) $this->totalPrice;
             $this->totalPrice = $this->totalPrice + $subtotal;
         }
         $this->totalPriceArr['total'] = $this->totalPrice;
         // insert total price in db
         FrontendCatalogModel::updateOrder($this->totalPriceArr, $this->orderId);
     }
 }
Пример #2
0
 /**
  * Parse Google Analytics
  */
 private function parseCustomHeaderHTMLAndGoogleAnalytics()
 {
     // get the data
     $siteHTMLHeader = (string) $this->get('fork.settings')->get('Core', 'site_html_header', null);
     $siteHTMLFooter = (string) $this->get('fork.settings')->get('Core', 'site_html_footer', null);
     $webPropertyId = $this->get('fork.settings')->get('Analytics', 'web_property_id', null);
     // search for the webpropertyId in the header and footer, if not found we should build the GA-code
     if ($webPropertyId != '' && strpos($siteHTMLHeader, $webPropertyId) === false && strpos($siteHTMLFooter, $webPropertyId) === false) {
         $anonymize = $this->get('fork.settings')->get('Core', 'show_cookie_bar', false) && !CommonCookie::hasAllowedCookies();
         $request = $this->getContainer()->get('request');
         $trackingCode = '<script>
                           (function(i,s,o,g,r,a,m){i[\'GoogleAnalyticsObject\']=r;i[r]=i[r]||function(){
                           (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
                           m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
                           })(window,document,\'script\',\'//www.google-analytics.com/analytics.js\',\'ga\');
                           ga(\'create\', \'' . $webPropertyId . '\', \'' . $request->getHttpHost() . '\');
                         ';
         if ($anonymize) {
             $trackingCode .= 'ga(\'send\', \'pageview\', {\'anonymizeIp\': true});';
         } else {
             $trackingCode .= 'ga(\'send\', \'pageview\');';
         }
         $trackingCode .= '</script>';
         $siteHTMLHeader .= "\n" . $trackingCode;
     }
     // store language
     $this->jsData['FRONTEND_LANGUAGE'] = FRONTEND_LANGUAGE;
     // encode and add
     $jsData = json_encode($this->jsData);
     $siteHTMLHeader .= "\n" . '<script>var jsData = ' . $jsData . '</script>';
     // assign site wide html
     $this->tpl->assign('siteHTMLHeader', trim($siteHTMLHeader));
 }
Пример #3
0
 /**
  * Get the visitor's id (using a tracking cookie)
  *
  * @return string
  */
 public static function getVisitorId()
 {
     // check if tracking id is fetched already
     if (self::$visitorId !== null) {
         return self::$visitorId;
     }
     // get/init tracking identifier
     self::$visitorId = CommonCookie::exists('track') && !empty($_COOKIE['track']) ? (string) CommonCookie::get('track') : md5(uniqid() . \SpoonSession::getSessionId());
     if (!self::get('fork.settings')->get('Core', 'show_cookie_bar', false) || CommonCookie::hasAllowedCookies()) {
         CommonCookie::set('track', self::$visitorId, 86400 * 365);
     }
     return self::getVisitorId();
 }