-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Willian Keller
committed
Jul 26, 2018
1 parent
7992fa0
commit 0dcb942
Showing
10 changed files
with
126 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
/** | ||
* A Magento 2 module named Magestat/CookieLawBanner | ||
* Copyright (C) 2018 Magestat (http://magestat.com) | ||
* | ||
* This file included in Magestat/CookieLawBanner is licensed under OSL 3.0 | ||
* | ||
* http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* Please see LICENSE.txt for the full text of the OSL 3.0 license | ||
*/ | ||
|
||
namespace Magestat\CookieLawBanner\Api; | ||
|
||
interface CookieHandlerInterface | ||
{ | ||
/** | ||
* @var string Cookie name. | ||
*/ | ||
const COOKIE_NAME = 'm_cookie-law-banner'; | ||
|
||
/** | ||
* Check if cookie exists. | ||
* | ||
* @return boolean | ||
*/ | ||
public function exists(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
/** | ||
* A Magento 2 module named Magestat/CookieLawBanner | ||
* Copyright (C) 2018 Magestat (http://magestat.com) | ||
* | ||
* This file included in Magestat/CookieLawBanner is licensed under OSL 3.0 | ||
* | ||
* http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* Please see LICENSE.txt for the full text of the OSL 3.0 license | ||
*/ | ||
|
||
namespace Magestat\CookieLawBanner\Model; | ||
|
||
use Magento\Framework\Stdlib\CookieManagerInterface; | ||
use Magestat\CookieLawBanner\Api\CookieHandlerInterface; | ||
|
||
class CookieHandler implements CookieHandlerInterface | ||
{ | ||
/** | ||
* @var \Magento\Framework\Stdlib\CookieManagerInterface | ||
*/ | ||
protected $cookieManager; | ||
|
||
/** | ||
* @param CookieManagerInterface $cookieManager | ||
*/ | ||
public function __construct( | ||
CookieManagerInterface $cookieManager | ||
) { | ||
$this->cookieManager = $cookieManager; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function exists() | ||
{ | ||
if (empty($this->cookieManager->getCookie(self::COOKIE_NAME))) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
/** | ||
* A Magento 2 module named Magestat/CookieLawBanner | ||
* Copyright (C) 2018 Magestat (http://magestat.com) | ||
* | ||
* This file included in Magestat/CookieLawBanner is licensed under OSL 3.0 | ||
* | ||
* http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* Please see LICENSE.txt for the full text of the OSL 3.0 license | ||
*/ | ||
--> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> | ||
<!-- API Preferences --> | ||
<preference for="Magestat\CookieLawBanner\Api\CookieHandlerInterface" type="Magestat\CookieLawBanner\Model\CookieHandler"/> | ||
</config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters