From 6b72063fc169beb1ca259a3328a56725affbc90d Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Fri, 15 Nov 2013 14:36:34 +0100 Subject: Supprime le fichier lib_text MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Seule la fonction lazyimg était utilisée, je l'ai déplacée dans lib_rss --- lib/lib_rss.php | 13 ++++++++ lib/lib_text.php | 96 -------------------------------------------------------- 2 files changed, 13 insertions(+), 96 deletions(-) delete mode 100644 lib/lib_text.php (limited to 'lib') diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 2f694fc12..473531707 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -202,3 +202,16 @@ function dowload_favicon ($website, $id) { return $favicon_url; } + +/** + * Add support of image lazy loading + * Move content from src attribute to data-original + * @param content is the text we want to parse + */ +function lazyimg($content) { + return preg_replace( + '//i', + '', + $content + ); +} diff --git a/lib/lib_text.php b/lib/lib_text.php deleted file mode 100644 index 99bac0c36..000000000 --- a/lib/lib_text.php +++ /dev/null @@ -1,96 +0,0 @@ -\\1", - "\\1", - "\\1", - "\\1", - "
\\1
", - "\\1", - "\\1 a écrit
\\2
", - "\\2", - "
\\2
", - "\\1
", - "\\1", - "\\2", - "", - "", - "\"\"", - "\"\\1\"", - "\"\\1\"", - ); - - $string = makeLinks(preg_replace ($find, $replace, $string)); - $string = nl2brPlus ($string); - - return $string; -} - -// do nl2br except when in a
 tag
-function nl2brPlus($string) {
-	$string = str_replace("\n", "
", $string); - if(preg_match_all('/\(.*?)\<\/pre\>/', $string, $match)){ - foreach($match as $a){ - foreach($a as $b){ - $string = str_replace('
'.$b.'
', "
".str_replace("
", "", $b)."
", $string); - } - } - } - return $string; -} - -# Transform URL and e-mails into links -function makeLinks($string) { - $string = preg_replace_callback('/\s(http|https|ftp):(\/\/){0,1}([^\"\s]*)/i','splitUri',$string); - return $string; -} - -# Split links, require for makeLinks -function splitUri($matches) { - $uri = $matches[1].':'.$matches[2].$matches[3]; - $t = parse_url($uri); - $link = $matches[3]; - - if (!empty($t['scheme'])) { - return ' '.$link.''; - } else { - return $uri; - } -} - -// parse la description pour ajouter les liens sur les tags -function parse_tags ($desc) { - $desc_parse = preg_replace ('/#([\w\dÀÇÈÉÊËÎÏÔÙÚÛÜàáâçèéêëîïóùúûü]+)/i', '\\1', $desc); - - return $desc_parse; -} - -function lazyimg($content) { - return preg_replace( - '//i', - '', - $content - ); -} \ No newline at end of file -- cgit v1.2.3