Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Data.php
Go to the documentation of this file.
1 <?php
8 
18 {
19  const XML_PATH_ENABLED = 'sendfriend/email/enabled';
20 
21  const XML_PATH_ALLOW_FOR_GUEST = 'sendfriend/email/allow_guest';
22 
23  const XML_PATH_MAX_RECIPIENTS = 'sendfriend/email/max_recipients';
24 
25  const XML_PATH_MAX_PER_HOUR = 'sendfriend/email/max_per_hour';
26 
27  const XML_PATH_LIMIT_BY = 'sendfriend/email/check_by';
28 
29  const XML_PATH_EMAIL_TEMPLATE = 'sendfriend/email/template';
30 
31  const COOKIE_NAME = 'stf';
32 
33  const CHECK_IP = 1;
34 
35  const CHECK_COOKIE = 0;
36 
43  public function isEnabled($store = null)
44  {
45  return $this->scopeConfig->isSetFlag(
46  self::XML_PATH_ENABLED,
47  \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
48  $store
49  );
50  }
51 
58  public function isAllowForGuest($store = null)
59  {
60  return $this->scopeConfig->isSetFlag(
61  self::XML_PATH_ALLOW_FOR_GUEST,
62  \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
63  $store
64  );
65  }
66 
73  public function getMaxRecipients($store = null)
74  {
75  return (int)$this->scopeConfig->getValue(
76  self::XML_PATH_MAX_RECIPIENTS,
77  \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
78  $store
79  );
80  }
81 
88  public function getMaxEmailPerPeriod($store = null)
89  {
90  return (int)$this->scopeConfig->getValue(
91  self::XML_PATH_MAX_PER_HOUR,
92  \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
93  $store
94  );
95  }
96 
102  public function getPeriod()
103  {
104  return 3600;
105  }
106 
113  public function getLimitBy($store = null)
114  {
115  return (int)$this->scopeConfig->getValue(
116  self::XML_PATH_LIMIT_BY,
117  \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
118  $store
119  );
120  }
121 
128  public function getEmailTemplate($store = null)
129  {
130  return $this->scopeConfig->getValue(
131  self::XML_PATH_EMAIL_TEMPLATE,
132  \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
133  $store
134  );
135  }
136 
143  public function getCookieName()
144  {
145  return self::COOKIE_NAME;
146  }
147 }
getMaxEmailPerPeriod($store=null)
Definition: Data.php:88
isAllowForGuest($store=null)
Definition: Data.php:58
isEnabled($store=null)
Definition: Data.php:43
getEmailTemplate($store=null)
Definition: Data.php:128
getMaxRecipients($store=null)
Definition: Data.php:73