function pregReplaceStr($filter_content_arr, $content)
 {
     $start_str = $filter_content_arr['start_str'];
     $end_str = $filter_content_arr['end_str'];
     $preg = buildPregByStr($start_str, $end_str);
     $filter_content_arr['preg'] = $preg;
     preg_match($preg, $content, $arr);
     $content = $arr[1];
     return $content;
 }
Esempio n. 2
0
function getReplaceResult($filter_content_arr, $content)
{
    $start_str = $filter_content_arr['start_str'];
    $end_str = $filter_content_arr['end_str'];
    preg_match(buildPregByStr($start_str, $end_str), $content, $arr);
    $content = $arr[1];
    if (!empty($filter_content_arr['delete_str'])) {
        foreach ($filter_content_arr['delete_str'] as $key => $val) {
            if (is_array($val)) {
                $delete_start_str = $val['start_str'];
                $delete_end_str = $val['end_str'];
                $content = preg_replace(buildPregByStr($delete_start_str, $delete_end_str), '', $content);
            } else {
                $content = preg_replace("/" . escape_preg_chars($val) . "/", '', $content);
            }
        }
    }
    return $content;
}