1 | <?php |
||
22 | class Nexcessnet_Turpentine_Helper_Varnish extends Mage_Core_Helper_Abstract { |
||
23 | |||
24 | const MAGE_CACHE_NAME = 'turpentine_pages'; |
||
25 | |||
26 | /** |
||
27 | * Get whether Varnish caching is enabled or not |
||
28 | * |
||
29 | * @return bool |
||
30 | */ |
||
31 | public function getVarnishEnabled() { |
||
34 | |||
35 | /** |
||
36 | * Get whether Varnish debugging is enabled or not |
||
37 | * |
||
38 | * @return bool |
||
39 | */ |
||
40 | public function getVarnishDebugEnabled() { |
||
44 | |||
45 | /** |
||
46 | * Check if the request passed through Varnish (has the correct secret |
||
47 | * handshake header) |
||
48 | * |
||
49 | * @return boolean |
||
50 | */ |
||
51 | public function isRequestFromVarnish() { |
||
55 | |||
56 | /** |
||
57 | * Check if Varnish should be used for this request |
||
58 | * |
||
59 | * @return bool |
||
60 | */ |
||
61 | public function shouldResponseUseVarnish() { |
||
64 | |||
65 | /** |
||
66 | * Get the secret handshake value |
||
67 | * |
||
68 | * @return string |
||
69 | */ |
||
70 | public function getSecretHandshake() { |
||
86 | |||
87 | /** |
||
88 | * Get a Varnish management socket |
||
89 | * |
||
90 | * @param string $host [description] |
||
91 | * @param string|int $port [description] |
||
92 | * @param string $secretKey [description] |
||
93 | * @param string $version [description] |
||
94 | * @return Nexcessnet_Turpentine_Model_Varnish_Admin_Socket |
||
95 | */ |
||
96 | public function getSocket($host, $port, $secretKey = null, $version = null) { |
||
107 | |||
108 | /** |
||
109 | * Get management sockets for all the configured Varnish servers |
||
110 | * |
||
111 | * @return array |
||
112 | */ |
||
113 | public function getSockets() { |
||
129 | |||
130 | /** |
||
131 | * Get the cache type Magento uses |
||
132 | * |
||
133 | * @return string |
||
134 | */ |
||
135 | public function getMageCacheName() { |
||
138 | |||
139 | /** |
||
140 | * Get the configured default object TTL |
||
141 | * |
||
142 | * @return string |
||
143 | */ |
||
144 | public function getDefaultTtl() { |
||
147 | |||
148 | /** |
||
149 | * Check if the product list toolbar fix is enabled and we're not in the |
||
150 | * admin section |
||
151 | * |
||
152 | * @return bool |
||
153 | */ |
||
154 | public function shouldFixProductListToolbar() { |
||
158 | |||
159 | /** |
||
160 | * Check if the Varnish bypass is enabled |
||
161 | * |
||
162 | * @return boolean |
||
163 | */ |
||
164 | public function isBypassEnabled() { |
||
170 | |||
171 | /** |
||
172 | * Check if the notification about the Varnish bypass must be displayed |
||
173 | * |
||
174 | * @return boolean |
||
175 | */ |
||
176 | public function shouldDisplayNotice() { |
||
179 | |||
180 | public function getFormKeyFixupActionsList() { |
||
186 | |||
187 | /** |
||
188 | * Check if this is a version of Magento that needs the form_key fix. |
||
189 | * Relevant versions are: |
||
190 | * |
||
191 | * CE 1.8+ |
||
192 | * EE 1.13+ |
||
193 | * |
||
194 | * @return bool |
||
195 | */ |
||
196 | public function csrfFixupNeeded() { |
||
219 | } |
||
220 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: