function execute($data, $max_entries = '')
 {
     if (is_array($data)) {
         return array_map(array($this, 'execute'), $data);
     } else {
         return mbereg_replace($this->pattern, $this->replacement, $data);
     }
 }
Ejemplo n.º 2
0
 /**
  * truncates the string to the last punctuation mark
  * @param $text
  * @param int $length
  * @param string $encoding
  * @return string
  */
 public static function substToDot($text, $length = 300, $encoding = 'UTF-8')
 {
     $text = mbereg_replace('<pre>.*</pre>', '', $text);
     // обрезаем код
     $text = mb_substr($text, 0, $length, $encoding);
     $data = self::substToSymbol($text, '.', $encoding);
     if ($data) {
         return $data . "..";
     }
     $data = self::substToSymbol($text, '!', $encoding);
     if ($data) {
         return $data;
     }
     $data = self::substToSymbol($text, '?', $encoding);
     if ($data) {
         return $data;
     }
     $data = self::substToSymbol($text, ';', $encoding);
     if ($data) {
         return $data;
     }
     return $text;
 }
Ejemplo n.º 3
0
function gnavi_addinfo_reg($str)
{
    $str = trim($str);
    if (XOOPS_USE_MULTIBYTES) {
        $str = mbereg_replace(_MD_GNAV_MB_GT, ">", $str);
        $str = mbereg_replace(_MD_GNAV_MB_LT, "<", $str);
    }
    $strarray = explode("<", $str);
    $ret = "";
    foreach ($strarray as $item) {
        $itemarray = explode(">", $item);
        if (count($itemarray) > 1) {
            //			$ret.="< ".trim($itemarray[0])." > ".trim($itemarray[1]).PHP_EOL ;
            $ret .= "< " . trim($itemarray[0]) . " > " . trim($itemarray[1]) . "\r\n";
        }
    }
    return $ret;
}