Ejemplo n.º 1
0
function jieqi_collectstoe($str)
{
    if (is_array($str)) {
        $pregstr = '/' . jieqi_pregconvert($str['left']) . jieqi_collectmtop($str['middle']) . jieqi_pregconvert($str['right']) . '/is';
    } else {
        $pregstr = trim($str);
        if (strlen($pregstr) > 0 && substr($pregstr, 0, 1) != '/') {
            $pregstr = '/' . str_replace(array(' ', '/'), array('\\s', '\\/'), preg_quote($pregstr)) . '/is';
        }
    }
    return $pregstr;
}
Ejemplo n.º 2
0
                     $chaptercontent = $matches[2];
                 }
             }
         }
     }
     //过滤章节内容
     if (!empty($jieqiCollect['contentfilter'])) {
         $filterary = explode("\n", $jieqiCollect['contentfilter']);
         $repfrom = array();
         foreach ($filterary as $filterstr) {
             $filterstr = trim($filterstr);
             if (!empty($filterstr)) {
                 if (preg_match('/^\\/[^\\/\\\\]*(?:\\\\.[^\\/\\\\]*)*\\/[imsu]*$/is', $filterstr)) {
                     $repfrom[] = $filterstr;
                 } else {
                     $repfrom[] = '/' . jieqi_pregconvert($filterstr) . '/is';
                 }
             }
         }
         $repto = '';
         if (!empty($jieqiCollect['contentreplace'])) {
             $repto = explode("\n", str_replace("\r\n", "\n", $jieqiCollect['contentreplace']));
         }
         if (count($repfrom) > 0) {
             $chaptercontent = preg_replace($repfrom, $repto, $chaptercontent);
         }
     }
 } else {
     $chaptercontent = '';
 }
 if ($fromrows[$k]['type'] == 0 && strlen(trim($chaptercontent)) == 0) {
Ejemplo n.º 3
0
function xml_getvaluebytag($source = '', $tag = '')
{
    $ret = '';
    if (!empty($tag)) {
        $pregstr = '/' . jieqi_pregconvert('<' . $tag . '>') . '([^\\<\\>]*)' . jieqi_pregconvert('</' . $tag . '>') . '/is';
        $matches = array();
        preg_match($pregstr, $source, $matches);
        if (is_array($matches) && count($matches) > 0) {
            $ret = $matches[count($matches) - 1];
        }
    }
    return $ret;
}