예제 #1
0
function devfmt_recoverContent(&$AContent, $AFormatedAreas)
{
    for ($i = 2; $i < Count($AFormatedAreas); $i++) {
        while (preg_match("#" . $AFormatedAreas[0] . ($i - 1) . "_#", $AContent, $matches)) {
            $formated = $AFormatedAreas[1];
            foreach ($AFormatedAreas[$i] as $tmp) {
                $formated = devfmt_PregReplace("#\\(.*?\\)#", $tmp, $formated, 1);
            }
            $AContent = devfmt_PregReplace("#" . $AFormatedAreas[0] . ($i - 1) . "_#", $formated, $AContent, 1);
        }
    }
}
예제 #2
0
function devfmt_Formatter_ajax_devfmt_parseCode()
{
    global $_POST, $DevFmt_CodeIndex;
    $post = get_post($_POST["dfPostId"]);
    $parseCodId = $_POST["dfId"];
    $GrabCode = devfmt_ContentGrabCode($post->post_content);
    $Content = $GrabCode[0];
    $MatchCodes = $GrabCode[1];
    $iCode = 0;
    foreach ($MatchCodes as $MatchCode) {
        $codes = $MatchCode[1];
        $unid = $MatchCode[0];
        $i = 0;
        while (preg_match("!" . $unid . "([0-9]+)_!is", $Content, $matches)) {
            $i++;
            $iCode++;
            if ($iCode == $parseCodId) {
                $parsedCode = devfmt_ParseContentCode($codes[$i], $DevFmt_Config['usedevformat'], true);
                $code = $parsedCode[0];
                $opts = $parsedCode[1];
                echo json_encode(array("dfPostId" => $_POST["dfPostId"], "dfId" => $parseCodId, "code" => $code));
                die;
                exit;
            }
            $Content = devfmt_PregReplace("!" . $unid . "([0-9]+)_!is", '', $Content, 1);
        }
    }
    echo "not found";
    die;
    exit;
}