User Guide and Documentation

body() - Identify SMS ContentRelease Date: 2019/08/01

It specifies the message to be sent.

Parameters;

  • $text --- The text of the message to be sent
  • $template --- Specifies that the message to be sent is the template, as shown in the code example, when the $ template value is full, it changes the value of the $text variable.
  • $variables --- If the message to be sent is a template, $variables contain variables for the template.
  • $lang --- If the message to be sent is a template, the variable $lang specifies the language of the template.
  • $user --- If the message to be sent is a template, it contains the customer ID number.
public function body($text='',$template=false,$variables=[],$lang='',$user=0){
    $this->numbers_reset();
    if($template) {
        $look = View::notifications("sms",$template,$text,$variables,$lang,$user);
        if($look!==false && isset($look["content"])){
            if(isset($look["title"]))
                $this->title($look["title"]);
            $text = $look["content"];
        }
    }

    if(!class_exists("Money")) Helper::Load("Money");
    $currencies = Money::getCurrencies();

    foreach($currencies AS $row){
        if(($row["prefix"] && substr($row["prefix"],-1,1) == ' ') || ($row["suffix"] && substr($row["suffix"],0,1) == ' '))
            $code = $row["code"];
        else
            $code = $row["prefix"] ? $row["code"].' ' : ' '.$row["code"];

        $row["prefix"] = Utility::text_replace($row["prefix"],[' ' => '']);
        $row["suffix"] = Utility::text_replace($row["suffix"],[' ' => '']);
        if(!Validation::isEmpty($row["prefix"]) && $row["prefix"])
            $text = Utility::text_replace($text,[$row["prefix"] => $code]);
        elseif(!Validation::isEmpty($row["suffix"]) && $row["suffix"])
            $text = Utility::text_replace($text,[$row["suffix"] => $row["code"]]);
    }
    $text       = Filter::transliterate($text);

    $this->body = $text;
    return $this;
}

Copyright © 2019. All rights reserved.
Top