<?php
//------------------------------------------------------------------------------
// Smarty Intergrate version 1.1
//
// Smarty Integrate
//
// Copyright(c) All rights reserved.
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation; either version 2.1 of the License, or (at
// your option) any later version.
//
// This library is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
// License for more details.
//------------------------------------------------------------------------------
function smarty_modifier_intergrate($comment, $sitepath = TRUE) {
$comment = preg_replace("#(^|[\n ])([\w]+?://)(www\.youtube|youtube|jp\.youtube|de\.youtube)(\.[\w\.]+?/watch\?v=)([\w-]+)([&][\w=+&;%]*)*(^[\t <\n\r\]\[])*#is",'\\1
<div><a href="\\2\\3\\4\\5\\6" target="_blank" class="postlink">'.'\\2\\3\\4\\5\\6'.'</a></div><div>
<object><param name="movie" value="http://www.youtube.com/v/\\5"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed id="video" src="http://www.youtube.com/v/\\5" type="application/x-shockwave-flash" wmode="transparent" allowfullscreen="true"></embed></object></div>',
$comment);
$comment = preg_replace("#(^|[\n ])([\w]+?://[^ \"\n\r\t<]*)#is","$1<a href=\"$2\" target=\"_blank\">$2</a>",
$comment);
$comment = preg_replace("/\s@([A-Za-z0-9_]+)/"," <a id='mention' href='$sitepath/$1'>$0</a> "," ".$comment).'';
$comment = preg_replace("/\s#([A-Za-z0-9_]+)/"," <a id='mention' href='$sitepath/tags.php?q=$1'>$0</a> "," ".$comment).'';
return $comment;
}
?>