[SPIP] ~maj 3.0.10 --> 3.0.14
[lhc/web/www.git] / www / plugins-dist / textwheel / inc / ressource.php
index 8c1fa94..d56dc5f 100644 (file)
@@ -6,29 +6,32 @@
  *
  */
 
-define('_EXTRAIRE_RESSOURCES', ',' . '<"?(https?://|[\w -]+\.[\w -]+)[^<]*>'.',UimsS');
+define('_EXTRAIRE_RESSOURCES', ',' . '<"?(https?://|[^\s][\w -]+\.[\w -]+)[^<]*>'.',UimsS');
 
 
 function traiter_ressources($r) {
+       $html = null;
        if ($ressource = charger_fonction('ressource', 'inc', true)) {
                $html = $ressource($r[0]);
-       } else {
+       }
+
+       if (is_null($html)) {
                include_spip('inc/lien');
                $url = explode(' ', trim($r[0], '<>'));
                $url = $url[0];
                # <http://url/absolue>
                if (preg_match(',^https?://,i', $url))
-                       $html = propre("<span class='ressource spip_out'>&lt;[->".$url."]&gt;</span>");
+                       $html = PtoBR(propre("<span class='ressource spip_out'>&lt;[->".$url."]&gt;</span>"));
                # <url/relative>
                else if (false !== strpos($url, '/'))
-                       $html = propre("<span class='ressource spip_in'>&lt;[->".$url."]&gt;</span>");
+                       $html = PtoBR(propre("<span class='ressource spip_in'>&lt;[->".$url."]&gt;</span>"));
                # <fichier.rtf>
                else {
                        preg_match(',\.([^.]+)$,', $url, $regs);
                        if (file_exists($f = _DIR_IMG.$regs[1].'/'.$url)) {
-                               $html = propre("<span class='ressource spip_in'>&lt;[".$url."->".$f."]&gt;</span>");
+                               $html = PtoBR(propre("<span class='ressource spip_in'>&lt;[".$url."->".$f."]&gt;</span>"));
                        } else {
-                               $html = propre("<span class='ressource'>&lt;".$url."&gt;</span>");
+                               $html = PtoBR(propre("<span class='ressource'>&lt;".$url."&gt;</span>"));
                        }
                }
        }