This repository has been archived by the owner on Sep 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added TelegramHelper file, removed 1 dependence.
- Loading branch information
Showing
3 changed files
with
31 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
/** Helper for Uploading file using CURL */ | ||
if (!function_exists('curl_file_create')) { | ||
function curl_file_create($filename, $mimetype = '', $postname = '') | ||
{ | ||
return "@$filename;filename=" . ($postname ?: basename($filename)) . ($mimetype ? ";type=$mimetype" : ''); | ||
} | ||
} | ||
|
||
/** Helper for Uploading file using CURL with auto mime | ||
* @param string $path Full path file | ||
* @param string $postname | ||
* @return string | ||
*/ | ||
function curl_file_create_auto_mime($path, $postname = '') | ||
{ | ||
return curl_file_create($path, '', $postname); | ||
} | ||
|
||
/** Check if a string is a json | ||
* @param string $string | ||
* @return bool | ||
*/ | ||
function is_json($string) | ||
{ | ||
return is_string($string) && is_array(json_decode($string, true)) && (json_last_error() == JSON_ERROR_NONE) ? true : false; | ||
} |