Forum Moderators: coopster
then
function addTags( & $content, $Tags, $Before, $After, $Link, $LinkAttributes )
{
$IsFirst = true;
$ContentTags = '';
foreach( $Tags as $Tag )
{
if( strlen( $Tag ) > 1 )
{
if( $IsFirst === true )
$IsFirst = false;
else
$ContentTags .= ' • ';
$TagToDisplay = str_replace( '+', ' ', $Tag );
$ContentTags .= '<a '.$LinkAttributes.' href="'.$Link.$Tag.'">'.$TagToDisplay.'</a>';
}
}
if( strlen( $ContentTags ) > 1 )
{
// Tags added
$content .= $Before.$ContentTags.$After;
return true;
}
else
{
// No tags added
return false;
}
} // addTags function render( & $content, $format )
{
$AddedAtLeastOneTag = false;
if( preg_match( '/<!--tags?[\s]+([^>]*)[\s]*--\>/si', $content, $Matches ) )
{
if( preg_match_all( '/([^\s]*)[\s]*/si', $Matches[ 1 ], $Matches ) )
{
// Sort using human-like alphabetic order
natcasesort( $Matches[ 1 ] );
// Add miscellaneous tagging systems
$AddedAtLeastOneTag ¦= $this->addTags( $content, $Matches[ 1 ], '<div class="Tags"><strong>Technorati tags:</strong> ', '</div>', 'http://technorati.com/tag/', 'target="_blank" rel="tag"' );
}
}
// No tags found?
global $current_User, $preview;
if( isset( $preview ) && $preview!= false && is_logged_in() &&!$AddedAtLeastOneTag )
{
// Display a warning message
$content .= '<div style="margin:0;padding:16px;color:black;border:solid 4px red;"><p>Tags are missing. To insert a tag, write the following (X)HTML code in your post:</p><blockquote><p><code><!--tags keyword1 keyword2 keywords3+keywords4 keyword5--></code></p></blockquote></div>';
}
return true;
}
then data is inserted in DB.
-----------
What we want to happen is to make the $post_tagging be parsed by the two functions addTags and render before it gets written in the DB.
Is it possible?
Thank you very much!