<?php
/**
  * Ahead WebSoft Technologies Pvt Ltd.
  * @copyright  Copyright 2006-2026 Ahead WebSoft Technologies Pvt Ltd.
  * @license    https://www.socialengine.com/policies
*/
class Fields_View_Helper_Fieldlastfm extends Fields_View_Helper_FieldAbstract
{
  public function fieldLastfm($subject, $field, $value)
  {
   $regex = '/^((http(s|):\/\/|)(www\.|)|)last\.fm\/user\//i';
    
    $username = preg_replace($regex, '', trim($value->value));
    $lastfmUrl = 'https://www.last.fm/user/' .  $username;
    
    return $this->view->htmlLink($lastfmUrl, $value->value, array(
      'target' => '_blank',
      'ref' => 'nofollow',
    ));
    
  }
}
