From b39f26a3f7c27e73a26375464d34b00d18222e14 Mon Sep 17 00:00:00 2001 From: Joshua Ramon Enslin Date: Sat, 22 Aug 2020 23:57:37 +0200 Subject: [PATCH] Specify global namespace for more calls to build-in functions --- MD_STD.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/MD_STD.php b/MD_STD.php index f49055c..5335ec9 100644 --- a/MD_STD.php +++ b/MD_STD.php @@ -91,7 +91,7 @@ class MD_STD { */ public static function startsWith(string $haystack, string $needle):bool { - if (substr($haystack, 0, strlen($needle)) == $needle) return true; + if (substr($haystack, 0, \strlen($needle)) == $needle) return true; else return false; } @@ -179,19 +179,19 @@ class MD_STD { */ public static function runCurl(string $url, int $timeout = 1200):string { - $curl = curl_init(); + $curl = \curl_init(); - curl_setopt($curl, CURLOPT_URL, $url); - curl_setopt($curl, CURLOPT_HEADER, false); - curl_setopt($curl, CURLOPT_CONNECTTIMEOUT_MS, $timeout); //timeout in seconds - curl_setopt($curl, CURLOPT_TIMEOUT_MS, $timeout); //timeout in seconds - curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); - curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); - curl_setopt($curl, CURLOPT_USERAGENT, 'md-bot/1.0'); - $result = curl_exec($curl); + \curl_setopt($curl, CURLOPT_URL, $url); + \curl_setopt($curl, CURLOPT_HEADER, false); + \curl_setopt($curl, CURLOPT_CONNECTTIMEOUT_MS, $timeout); //timeout in seconds + \curl_setopt($curl, CURLOPT_TIMEOUT_MS, $timeout); //timeout in seconds + \curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); + \curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); + \curl_setopt($curl, CURLOPT_USERAGENT, 'md-bot/1.0'); + $result = \curl_exec($curl); - curl_close($curl); - if (is_bool($result)) return ""; + \curl_close($curl); + if (\is_bool($result)) return ""; return $result; } @@ -293,7 +293,7 @@ class MD_STD { */ public static function filesize(string $filename):int { - $output = filesize($filename); + $output = \filesize($filename); if ($output === false) { throw new Exception("Cannot get filesize of file {$filename}");