AutoLoginUrlConvertTextClass.php in Auto Login URL 8
File
src/AutoLoginUrlConvertTextClass.php
View source
<?php
namespace Drupal\auto_login_url;
class AutoLoginUrlConvertTextClass {
public function __construct($uid) {
$this->uid = $uid;
}
public function replace(array $matches) {
$pattern = '/(\\.jpg|\\.gif|\\.png)/';
preg_match($pattern, $matches[0], $new_matches);
if (count($new_matches) > 0) {
return $matches[0];
}
else {
return \Drupal::service('auto_login_url.create')
->create($this->uid, $matches[0], TRUE);
}
}
}