PluginProbe
RabbitLoader / 3.0.3
RabbitLoader v3.0.3
4.0.2 4.0.1 4.0 3.2.0 3.1.1 3.1.0 3.0.5 3.0.3 3.0.4 2.17.1 2.17.2 2.17.3 2.17.4 2.17.5 2.17.6 2.17.7 2.18.0 2.18.1 2.18.2 2.18.3 2.18.4 2.18.5 2.18.6 2.18.7 2.18.8 All 129 releases
rabbit-loader / inc / RabbitLoader / SDK / Util.php

Util.php in RabbitLoader 3.0.3, at inc/RabbitLoader/SDK/Util.php

36 lines 978 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace RabbitLoader\SDK;
4
5 class Util
6 {
7 //count of headers sent so far by RabbitLoader
8 private static $sentCount = 0;
9
10 public static function getRequestMethod()
11 {
12 return empty($_SERVER['REQUEST_METHOD']) ? '' : strtolower($_SERVER['REQUEST_METHOD']);
13 }
14
15 public static function sendHeader($header, $replace)
16 {
17 if (!empty($header) && (self::$sentCount < 50) && !headers_sent()) {
18 header(substr($header, 0, 150), $replace);
19 self::$sentCount++;
20 }
21 }
22
23 public static function append(&$body, $element)
24 {
25 $replaced = 0;
26 $body = str_ireplace('</head>', $element . '</head>', $body, $replaced);
27 if (!$replaced) {
28 $body = str_ireplace('</body>', $element . '</body>', $body, $replaced);
29 }
30 if (!$replaced) {
31 $body = str_ireplace('</html>', $element . '</html>', $body, $replaced);
32 }
33 return $replaced > 0;
34 }
35 }
36