Page Menu
Home
Code
Search
Configure Global Search
Log In
Files
F15614605
modifier.text2html.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
902 B
Referenced Files
None
Subscribers
None
modifier.text2html.php
View Options
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty text to HTML modifier plugin
*
* Type: modifier<br>
* Name: text2html<br>
* Purpose: HTML representation for Azhàr profiles
* @author Wolfaeym
*/
function
smarty_modifier_text2html
(
string
$string
):
string
{
//HTML entities
$string
=
htmlspecialchars
(
$string
,
ENT_QUOTES
);
//E-mail -> mailto links
$string
=
preg_replace
(
"/([_a-z0-9-]+(
\.
_a-z0-9-]+)*@[a-z0-9-]+(
\.
[a-z0-9-]+)+)/i"
,
"<a href=
\"
mailto:
\\
1
\"
>
\\
1</A>"
,
$string
);
//Linkify URLs
//TODO handle www.
//TODO Relative links for current domain
$string
=
preg_replace
(
"@([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])@i"
,
"<a href=
\"\\
1://
\\
2
\\
3
\"
>
\\
1://
\\
2
\\
3</a>"
,
$string
);
//\n -> <br />
$string
=
nl2br
(
$string
);
return
$string
;
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Wed, Nov 25, 22:22 (1 d, 19 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24171
Default Alt Text
modifier.text2html.php (902 B)
Attached To
Mode
rZED Zed
Attached
Detach File
Event Timeline
Log In to Comment