PluginProbe
RabbitLoader / 3.0.5
RabbitLoader v3.0.5
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 / core / util.php

util.php in RabbitLoader 3.0.5, at inc/core/util.php

62 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 class RabbitLoader_21_Util_Core
4 {
5 public static function get_param($name, $allowCase = false)
6 {
7 $val = '';
8 if (isset($_GET[$name])) {
9 $val = $_GET[$name];
10 } else if (isset($_POST[$name])) {
11 $val = $_POST[$name];
12 }
13
14 if (!empty($val)) {
15 if ($allowCase) {
16 $val = preg_replace('/[^A-Za-z0-9_\-.]/', '', $val);
17 } else {
18 $val = sanitize_key($val);
19 }
20 }
21
22 return $val;
23 }
24
25 /**
26 * Same as file_put_contents with debug mode wrapper
27 */
28 public static function fpc($fp, &$data, $debug)
29 {
30 $cache_dir = RL21UtilWP::get_cache_dir('');
31 if (!file_exists($cache_dir)) {
32 @mkdir($cache_dir, 0755, true);
33 }
34 if ($debug) {
35 $file_updated = file_put_contents($fp, $data, LOCK_EX);
36 } else {
37 $file_updated = @file_put_contents($fp, $data, LOCK_EX);
38 }
39 return $file_updated;
40 }
41
42 public static function get_request_type()
43 {
44 return empty($_SERVER['REQUEST_METHOD']) ? '' : strtolower($_SERVER['REQUEST_METHOD']);
45 }
46
47 public static function isDev()
48 {
49 return ((defined('RABBITLOADER_PLUG_ENV') && RABBITLOADER_PLUG_ENV == 'DEV') || (defined('RABBITLOADER_AC_PLUG_ENV') && RABBITLOADER_AC_PLUG_ENV == 'DEV'));
50 }
51
52 public static function serverURINoGet()
53 {
54 return strtok($_SERVER["REQUEST_URI"], '?');
55 }
56
57 public static function isRLPage()
58 {
59 return self::get_param('page') === 'rabbitloader';
60 }
61 }
62