<?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_FieldWebsite extends Fields_View_Helper_FieldAbstract
{
  public function fieldWebsite($subject, $field, $value, $params = array())
  {
    $str = $value->value;
    if(!preg_match('/^(http|https):/i',$str)) {
      $str = 'http://' . $str;
    }

    if (!isset($params['target'])) {
      $params['target'] = '_blank';
    }

    return $this->view->htmlLink($str, $str, $params);
  }
}
