From: <var...@us...> - 2010-11-05 14:58:16
|
Revision: 7725 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7725&view=rev Author: vargenau Date: 2010-11-05 14:58:10 +0000 (Fri, 05 Nov 2010) Log Message: ----------- Allow "upload:", "image:" and "file:". Remove spaces before and after ":", if any. Modified Paths: -------------- trunk/lib/InlineParser.php Modified: trunk/lib/InlineParser.php =================================================================== --- trunk/lib/InlineParser.php 2010-11-04 19:40:50 UTC (rev 7724) +++ trunk/lib/InlineParser.php 2010-11-05 14:58:10 UTC (rev 7725) @@ -354,12 +354,21 @@ // Mediawiki compatibility: allow "Image:" and "File:" // as synonyms of "Upload:" - if (string_starts_with($rawlink, "Image:")) { - $rawlink = str_replace("Image:", "Upload:", $rawlink); + // Allow "upload:", "image:" and "file:" also + // Remove spaces before and after ":", if any + if (string_starts_with($rawlink, "Upload")) { + $rawlink = preg_replace("/^Upload\\s*:\\s*/", "Upload:", $rawlink); + } else if (string_starts_with($rawlink, "upload")) { + $rawlink = preg_replace("/^upload\\s*:\\s*/", "Upload:", $rawlink); + } else if (string_starts_with($rawlink, "Image")) { + $rawlink = preg_replace("/^Image\\s*:\\s*/", "Upload:", $rawlink); + } else if (string_starts_with($rawlink, "image")) { + $rawlink = preg_replace("/^image\\s*:\\s*/", "Upload:", $rawlink); + } else if (string_starts_with($rawlink, "File")) { + $rawlink = preg_replace("/^File\\s*:\\s*/", "Upload:", $rawlink); + } else if (string_starts_with($rawlink, "file")) { + $rawlink = preg_replace("/^file\\s*:\\s*/", "Upload:", $rawlink); } - if (string_starts_with($rawlink, "File:")) { - $rawlink = str_replace("File:", "Upload:", $rawlink); - } $label = UnWikiEscape($label); /* This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |