class AutoLoginUrlConvertTextClass in Auto Login URL 7
Class to use for callback of link replacement.
@author Thanos
Hierarchy
- class \AutoLoginUrlConvertTextClass
Expanded class hierarchy of AutoLoginUrlConvertTextClass
File
- ./
auto_login_url.module, line 462 - Main file for auto_login_url module.
View source
class AutoLoginUrlConvertTextClass {
/**
* Constructor.
*
* @param int $uid
* User ID.
*/
public function __construct($uid) {
$this->uid = $uid;
}
/**
* Replace each link in the text.
*
* @param array $matches
* Matches array.
*
* @return string
* Converted URL.
*/
public function replace(array $matches) {
// Make a new search to check that the link is not image.
// I know, not very clean.
$pattern = '/(\\.jpg|\\.gif|\\.png)/';
preg_match($pattern, $matches[0], $new_matches);
if (count($new_matches) > 0) {
return $matches[0];
}
else {
return auto_login_url_create($this->uid, $matches[0], TRUE);
}
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AutoLoginUrlConvertTextClass:: |
public | function | Replace each link in the text. | |
AutoLoginUrlConvertTextClass:: |
public | function | Constructor. |