[Agora-commits] agora/ecrire inc_filtres.php3,1.29,1.30

maciek at adullact1.hosting.cri74.org maciek at adullact1.hosting.cri74.org
Sam 3 Sep 23:57:14 CEST 2005


Update of /cvsroot/agora/agora/ecrire
In directory adullact1:/tmp/cvs-serv12872/ecrire

Modified Files:
	inc_filtres.php3 
Log Message:
Moving functions from mes_fonctions to inc_filtres

Index: inc_filtres.php3
===================================================================
RCS file: /cvsroot/agora/agora/ecrire/inc_filtres.php3,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- inc_filtres.php3	26 Jul 2005 09:10:08 -0000	1.29
+++ inc_filtres.php3	3 Sep 2005 21:57:11 -0000	1.30
@@ -608,7 +608,7 @@
     // TBI : quid si le href n'est pas en premier ?     
     $URL_SITE_SPIP = lire_meta ('adresse_site');
     
-    // rajout d'un / éventuellement 
+    // rajout d'un / �entuellement 
     if (substr ($URL_SITE_SPIP, strlen($URL_SITE_SPIP)-1, 1) != '/') $URL_SITE_SPIP .= '/';
 
     $chaine = eregi_replace ('<a href="' , '<a href="'.$URL_SITE_SPIP, $chaine); 
@@ -714,11 +714,11 @@
    
     $out = str_replace("&nbsp;", " ", $out);
     $out = str_replace("&#8217;", "'", $out);
-    $out = str_replace("&#171;", "«", $out);
-    $out = str_replace("&#187;", "»", $out);
+    $out = str_replace("&#171;", "", $out);
+    $out = str_replace("&#187;", "", $out);
 		$out = str_replace("&#8220;", "\"", $out);
 		$out = str_replace("&#8221;", "\"", $out);
-		$out = str_replace("&#176;", "°", $out);
+		$out = str_replace("&#176;", "", $out);
 		$out = str_replace("&#8364;", "E", $out);
 		$out = str_replace("&#36;", "E", $out);
     $out = wordwrap($out, 70, "\n");
@@ -770,5 +770,33 @@
     return gmdate("D, d M Y H:i:s +0100", $time);
 }
 
+/**
+ * Break word after size letters.
+ * Simple version which works:)
+ *
+ * todo: zero inline when space occurs.
+ */
+
+function htmlwrap($str, $width, $break=' '){
+
+    return preg_replace_callback("/(<[^>]*>)?([^(<.*>)\s\n\r]*)(<\/[^>]*>)?/",
+        create_function('$matches, $width='.$width,
+               'static $inline;
+
+           $inline+=strlen($matches[2]);
+
+           if($inline>$width){
+                $inline=(integer)fmod($inline,$width);
+                if(strlen($matches[2])>=$width){
+                    $matches[2]=\' \'.wordwrap($matches[2],$width,\' \',true);
+                }else{
+                     $matches[2]=\' \'.$matches[2];
+                }
+                }
+
+           return $matches[1].$matches[2].$matches[3];'),
+            $str);
+}
+
 
 ?>




Plus d'informations sur la liste de diffusion Agora-commits