From: <dj...@us...> - 2012-01-23 17:02:35
|
Revision: 8794 http://xoops.svn.sourceforge.net/xoops/?rev=8794&view=rev Author: djculex Date: 2012-01-23 17:02:29 +0000 (Mon, 23 Jan 2012) Log Message: ----------- Function set to transform image urls to <img> in wall posting Modified Paths: -------------- XoopsModules/smallworld/trunk/smallworld/css/smallworld.css XoopsModules/smallworld/trunk/smallworld/include/functions.php XoopsModules/smallworld/trunk/smallworld/language/danish/main.php XoopsModules/smallworld/trunk/smallworld/language/english/main.php Modified: XoopsModules/smallworld/trunk/smallworld/css/smallworld.css =================================================================== --- XoopsModules/smallworld/trunk/smallworld/css/smallworld.css 2012-01-23 14:25:50 UTC (rev 8793) +++ XoopsModules/smallworld/trunk/smallworld/css/smallworld.css 2012-01-23 17:02:29 UTC (rev 8794) @@ -742,6 +742,12 @@ width:75%; } +.smallworldAttImg{ + margin: 10px 125px 5px 10px; + max-height:200px; + position: relative; +} + .smallworld_sttext b{ color:#006699; } Modified: XoopsModules/smallworld/trunk/smallworld/include/functions.php =================================================================== --- XoopsModules/smallworld/trunk/smallworld/include/functions.php 2012-01-23 14:25:50 UTC (rev 8793) +++ XoopsModules/smallworld/trunk/smallworld/include/functions.php 2012-01-23 17:02:29 UTC (rev 8794) @@ -195,19 +195,32 @@ return $t; } +// Return only url/link +// If url is image link return <img> function smallworld_tolink($text){ - $text = html_entity_decode($text); - $text = " ".$text; - $text = preg_replace('/(((f|ht){1}tp:\/\/)[-a-zA-Z0-9@:%_\+.~#?&\/\/=]+)/i', - '<a href="\\1">\\1</a>', $text); - $text = preg_replace('/(((f|ht){1}tps:\/\/)[-a-zA-Z0-9@:%_\+.~#?&\/\/=]+)/i', - '<a href="\\1">\\1</a>', $text); - $text = preg_replace('/([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&\/\/=]+)/i', - '\\1<a href="http://\\2">\\2</a>', $text); - $text = preg_replace('/([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})/i', - '<a href="mailto:\\1">\\1</a>', $text); - $myts = MyTextSanitizer::getInstance(); - $text = $myts->displayTarea($text,1,1,1,1); + $ext = substr($text,-4,4); + $ext2 = substr($text,-5,5); + if (in_array($ext,array('.jpg','.bmp','.gif','.png')) || in_array($ext2,array('.jpeg'))){ + $text = preg_replace('/(((f|ht){1}tp:\/\/)[-a-zA-Z0-9@:%_\+.~#?&\/\/=]+)/i', + '<a href="\\1">'._SMALLWORLD_CLICKIMAGETHUMB.' </a><img class="smallworldAttImg" src="\\1">', $text); + $text = preg_replace('/(((f|ht){1}tps:\/\/)[-a-zA-Z0-9@:%_\+.~#?&\/\/=]+)/i', + '<a href="\\1">lala</a>', $text); + $text = preg_replace('/([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&\/\/=]+)/i', + '\\1<a href="//\\2">'._SMALLWORLD_CLICKIMAGETHUMB.'</a><img class="smallworldAttImg" src="//\\2">', $text); + } else { + $text = html_entity_decode($text); + $text = " ".$text; + $text = preg_replace('/(((f|ht){1}tp:\/\/)[-a-zA-Z0-9@:%_\+.~#?&\/\/=]+)/i', + '<a href="\\1">\\1</a>', $text); + $text = preg_replace('/(((f|ht){1}tps:\/\/)[-a-zA-Z0-9@:%_\+.~#?&\/\/=]+)/i', + '<a href="\\1">\\1</a>', $text); + $text = preg_replace('/([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&\/\/=]+)/i', + '\\1<a href="http://\\2">\\2</a>', $text); + $text = preg_replace('/([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})/i', + '<a href="mailto:\\1">\\1</a>', $text); + $myts = MyTextSanitizer::getInstance(); + $text = $myts->displayTarea($text,1,1,1,1); + } return $text; } Modified: XoopsModules/smallworld/trunk/smallworld/language/danish/main.php =================================================================== --- XoopsModules/smallworld/trunk/smallworld/language/danish/main.php 2012-01-23 14:25:50 UTC (rev 8793) +++ XoopsModules/smallworld/trunk/smallworld/language/danish/main.php 2012-01-23 17:02:29 UTC (rev 8794) @@ -319,6 +319,7 @@ define("_SMALLWORLD_MONTHSAGO"," months ago"); define("_SMALLWORLD_ONEYEARAGO","one year ago"); define("_SMALLWORLD_YEARSAGO"," years ago"); +define("_SMALLWORLD_CLICKIMAGETHUMB","Click here to see original size image"); /*-------------------- Friends page ---------------*/ define("_SMALLWORLD_FRIENDPAGE","Friends"); Modified: XoopsModules/smallworld/trunk/smallworld/language/english/main.php =================================================================== --- XoopsModules/smallworld/trunk/smallworld/language/english/main.php 2012-01-23 14:25:50 UTC (rev 8793) +++ XoopsModules/smallworld/trunk/smallworld/language/english/main.php 2012-01-23 17:02:29 UTC (rev 8794) @@ -319,6 +319,7 @@ define("_SMALLWORLD_MONTHSAGO"," months ago"); define("_SMALLWORLD_ONEYEARAGO","one year ago"); define("_SMALLWORLD_YEARSAGO"," years ago"); +define("_SMALLWORLD_CLICKIMAGETHUMB","Click here to see original size image"); /*-------------------- Friends page ---------------*/ define("_SMALLWORLD_FRIENDPAGE","Friends"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |