Version 4.5.0
This commit is contained in:
1 parent
1a0c7fd3c2
commit
f79dcf067a
3791 files changed
+248032
-76372
No files matched your search
@@ -8,6 +8,36 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
class convert_hook_LegacyParser extends _HOOK_CLASS_
|
||||
{
|
||||
/**
|
||||
* Parse
|
||||
*
|
||||
* @param string $value Text to parse
|
||||
* @return string
|
||||
*/
|
||||
public function parse( $value )
|
||||
{
|
||||
$result = parent::parse( $value );
|
||||
|
||||
/* Parse [mention=id]name[/URL] bbcode */
|
||||
preg_match_all( '#\[mention=(\d+)\](.+?)\[\/mention\]#is', $result, $matches );
|
||||
|
||||
foreach( $matches[0] as $idx => $m )
|
||||
{
|
||||
$member = \IPS\Member::load( $matches[1][ $idx ] );
|
||||
|
||||
if ( $member->member_id )
|
||||
{
|
||||
$result = str_ireplace( $m, "<a contenteditable=\"false\" rel=\"\" href=\"{$member->url()}\" data-mentionid=\"{$matches[1][ $idx ]}\" data-ipshover-target=\"{$member->url()->setQueryString( 'do', 'hovercard' )}\" data-ipshover=\"\">@{$matches[2][ $idx ]}</a>", $result );
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = str_ireplace( $m, "@{$matches[2][ $idx ]}", $result );
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse statically
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user