From: <var...@us...> - 2012-11-15 13:34:01
|
Revision: 8474 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=8474&view=rev Author: vargenau Date: 2012-11-15 13:33:52 +0000 (Thu, 15 Nov 2012) Log Message: ----------- Extract URL Modified Paths: -------------- trunk/lib/stdlib.php Modified: trunk/lib/stdlib.php =================================================================== --- trunk/lib/stdlib.php 2012-11-15 13:32:14 UTC (rev 8473) +++ trunk/lib/stdlib.php 2012-11-15 13:33:52 UTC (rev 8474) @@ -425,6 +425,9 @@ if (empty($alt)) { $alt = ""; } + // Extract URL + $arr = explode(' ', $url); + if (!empty($arr)) $url = $arr[0]; if (!IsSafeURL($url)) { $link = HTML::span(array('class' => 'error'), _('Bad URL for image -- remove all of <, >, "')); return $link; @@ -432,13 +435,9 @@ // spaces in inline images must be %20 encoded! $link = HTML::img(array('src' => $url)); - // Extract attributes and shorten url - $arr = parse_attributes(strstr($url, " ")); + // Extract attributes + $arr = parse_attributes(strstr($ori_url, " ")); foreach ($arr as $attr => $value) { - // strip attr=... url suffix - $link->setAttr('src', $url); - $i = strpos($url, $attr); - $url = substr($url, 0, $i - 1); // These attributes take strings: lang, id, title, alt if (($attr == "lang") || ($attr == "id") @@ -489,7 +488,7 @@ } } // Correct silently the most common error - if (strstr($ori_url, " ") and !preg_match("/^http/", $url)) { + if ($url != $ori_url and empty($arr) and !preg_match("/^http/", $url)) { // space belongs to the path $file = NormalizeLocalFileName($ori_url); if (file_exists($file)) { @@ -1666,8 +1665,6 @@ } } - - // File globbing // expands a list containing regex's to its matching entries This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |