function auto_login_url_convert_text in Auto Login URL 7
Same name and namespace in other branches
- 8 auto_login_url.module \auto_login_url_convert_text()
- 2.x auto_login_url.module \auto_login_url_convert_text()
Convert a whole text(E.g. mail with autologin links).
Parameters
int $uid: User id.
string $text: Text to change links to.
Return value
string The text with changed links.
File
- ./
auto_login_url.module, line 438 - Main file for auto_login_url module.
Code
function auto_login_url_convert_text($uid, $text) {
global $base_root;
// A pattern to convert links, but not images.
// I am not very sure about that.
$pattern = '/' . str_replace('/', '\\/', $base_root) . '\\/[^\\s^"^\']*/';
// Create a new object and pass the uid.
$current_conversion = new AutoLoginUrlConvertTextClass($uid);
// Replace text with regex/callback.
$text = preg_replace_callback($pattern, array(
&$current_conversion,
'replace',
), $text);
return $text;
}