mb_substr() public static method

Calls mb_substr if available and falls back to substr if it's not.
public static mb_substr ( string $string, integer $start ) : string
$string string
$start integer
return string
Exemplo n.º 1
0
 /**
  * @param Request $request
  * @param Visitor $visitor
  * @param Action|null $action
  * @return mixed
  */
 public function onNewVisit(Request $request, Visitor $visitor, $action)
 {
     $information = $this->getReferrerInformationFromRequest($request);
     if (!empty($information['referer_keyword'])) {
         return Common::mb_substr($information['referer_keyword'], 0, 255);
     }
     return $information['referer_keyword'];
 }
Exemplo n.º 2
0
 /**
  * @param $word
  * @return string
  */
 private function truncateWordIfNeeded($word)
 {
     $word = Common::unsanitizeInputValue($word);
     if (Common::mb_strlen($word) > $this->truncatingLimit) {
         return Common::mb_substr($word, 0, $this->truncatingLimit - 3) . '...';
     }
     return $word;
 }
Exemplo n.º 3
0
 /**
  * @param $word
  * @return string
  */
 private function truncateWordIfNeeded($word)
 {
     if (Common::mb_strlen($word) > $this->truncatingLimit) {
         return Common::mb_substr($word, 0, $this->truncatingLimit - 3) . '...';
     }
     return $word;
 }