Specify global namespace for more calls to build-in functions
This commit is contained in:
1 parent
25b3138a26
commit
b39f26a3f7
1 file changed
+13
-13
+13
-13
@@ -91,7 +91,7 @@ public static function ob_get_clean():string {
|
|||||||
*/
|
*/
|
||||||
public static function startsWith(string $haystack, string $needle):bool {
|
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;
|
else return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -179,19 +179,19 @@ public static function strtotime(string $datetime):int {
|
|||||||
*/
|
*/
|
||||||
public static function runCurl(string $url, int $timeout = 1200):string {
|
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_URL, $url);
|
||||||
curl_setopt($curl, CURLOPT_HEADER, false);
|
\curl_setopt($curl, CURLOPT_HEADER, false);
|
||||||
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT_MS, $timeout); //timeout in seconds
|
\curl_setopt($curl, CURLOPT_CONNECTTIMEOUT_MS, $timeout); //timeout in seconds
|
||||||
curl_setopt($curl, CURLOPT_TIMEOUT_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_RETURNTRANSFER, true);
|
||||||
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
|
\curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
|
||||||
curl_setopt($curl, CURLOPT_USERAGENT, 'md-bot/1.0');
|
\curl_setopt($curl, CURLOPT_USERAGENT, 'md-bot/1.0');
|
||||||
$result = curl_exec($curl);
|
$result = \curl_exec($curl);
|
||||||
|
|
||||||
curl_close($curl);
|
\curl_close($curl);
|
||||||
if (is_bool($result)) return "";
|
if (\is_bool($result)) return "";
|
||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -293,7 +293,7 @@ public static function lang_getfrombrowser(array $allowed_languages, string $def
|
|||||||
*/
|
*/
|
||||||
public static function filesize(string $filename):int {
|
public static function filesize(string $filename):int {
|
||||||
|
|
||||||
$output = filesize($filename);
|
$output = \filesize($filename);
|
||||||
|
|
||||||
if ($output === false) {
|
if ($output === false) {
|
||||||
throw new Exception("Cannot get filesize of file {$filename}");
|
throw new Exception("Cannot get filesize of file {$filename}");
|
||||||
|
|||||||
Reference in new issue
Block a user