mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-04-20 16:37:48 +02:00
Add link shortening for http links in sms, using YOURLS
This commit is contained in:
parent
fb3f9425d1
commit
241d079ffb
6 changed files with 140 additions and 1 deletions
|
@ -85,6 +85,22 @@ use BenMorel\GsmCharsetConverter\Converter;
|
|||
return '<a href="' . self::s($url, false, true, false) . '">' . self::s($number_format, false, true, false) . '</a>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for http link in a text
|
||||
*
|
||||
* @param string $text : Text to search a link in
|
||||
*
|
||||
* @return bool|array : False if no link in the text, or an array of all http links
|
||||
*/
|
||||
public static function search_http_links($text)
|
||||
{
|
||||
$regex = "#http(s?)://\S+#i";
|
||||
$matches = [];
|
||||
$nb_matches = preg_match_all($regex, $text, $matches);
|
||||
|
||||
return $nb_matches > 0 ? $matches[0] : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cette fonction fait la correspondance entre un type d'evenement et une icone font awesome.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue