/**
  * Replace FAX numbers in a text string with HTML links <a href="(faxNum)" target="{target}">[faxNum]</a>
  *
  * @param 	STRING 	$string 			:: The text string to be processed
  * @param 	STRING 	$yaction			:: Action to append the fax-num link to ; Default is: 'efax:' but can be for example: 'script.php?action=fax&number='
  * @param 	STRING	$ytarget			:: URL target ; default is '_blank' ; can be: '_self' or a specific window name: 'myWindow' ...
  *
  * @return 	STRING						:: The HTML processed text with FAX numbers replaced with real tags as links
  */
 public static function text_faxnums($string, $yaction = 'efax:', $ytarget = '_blank')
 {
     $string = (string) $string;
     $expr = SmartValidator::regex_stringvalidation_expression('fax', 'partial');
     $regex = $expr . 'iu';
     //insensitive, with /u modifier for unicode strings
     $string = preg_replace_callback($regex, function ($matches) use($yaction, $ytarget) {
         return '<a title="@eFax@" id="url_recognition" href="' . Smart::escape_html($yaction . rawurlencode(trim($matches[2]))) . '" target="' . $ytarget . '">' . Smart::escape_html(SmartParser::text_endpoints($matches[2], 75)) . '</a>';
     }, $string);
     return (string) $string;
 }
 /**
  * Check eMail Address
  * [PUBLIC]
  *
  * @param STRING $email					:: eMail Address
  * @param ENUM $ycheckdomain			:: 'no' = only validate if email address is in the form of text@texte.xt | 'yes' = check email with MX + SMTP validation
  * @param STRING $helo					:: SMTP HELO (if check MX + Domain will be used, cannot be empty)
  * @param NUMBER $y_smtp_port			:: SMTP Port (normal is '25')
  * @return STRING
  */
 public static function check_email_address($email, $ycheckdomain = 'no', $helo = '', $y_smtp_port = '25')
 {
     //--
     $out = 'notok';
     $msg = '';
     //--
     //--
     $email = (string) trim((string) $email);
     //--
     //--
     $regex = SmartValidator::regex_stringvalidation_expression('email') . 'i';
     // insensitive, without /u modifier as it does not decodes to punnycode and must contain only ISO-8859-1 charset
     //--
     if ((string) $email != '') {
         if (!preg_match((string) $regex, (string) $email)) {
             // check if address is valid (match pattern '*****@*****.**')
             $msg .= 'The e-mail address does NOT match the pattern \'email@domain.tld\'' . "\n";
         } else {
             $out = 'ok';
         }
         //end if else
     } else {
         $msg .= 'The e-mail address is empty !' . "\n";
     }
     //end if else
     //--
     //--
     if ((string) $out == 'ok') {
         //--
         if ((string) $ycheckdomain == 'yes') {
             //--
             $out = 'notok';
             // reset
             //--
             if (strlen($helo) <= 0) {
                 $helo = '127.0.0.1';
             }
             //end if else
             //--
             $msg .= "\n" . 'Now we CHECK if this is a real email address ...' . "\n\n";
             $chk = self::validate_mx_email_address($helo, $email, $y_smtp_port);
             //--
             if ((string) $chk['status'] == 'ok') {
                 $out = 'ok';
             }
             //end if
             //--
             $msg .= $chk['message'] . "\n";
             //--
             if ((string) SMART_FRAMEWORK_DEBUG_MODE != 'yes') {
                 $msg = '';
                 // hide the message if no debug
             }
             //end if
             //--
         }
         //end if
         //--
     }
     //end if
     //--
     //--
     return array('status' => $out, 'message' => $msg);
     //--
 }