<?php

if (!$_REQUEST['url']) {
    die('<h2>No URL Specified!</h2>');
}
require_once 'getTidy.php';
require_once 'xn-app://xoxotools/extract_by_id.php';
require_once 'xn-app://xoxotools/OutlineClasses/OutlineFromXOXO.php';
$page = getTidy($_REQUEST['url']);
$data = extract_by_id($page, 'bodyContent');
$xoxo = new OutlineFromXOXO($data[0], array('classes' => array()));
header('Content-type: text/javascript;charset=utf-8');
if ($_REQUEST['callback']) {
    echo $_REQUEST['callback'] . '(';
}
echo '[';
foreach ($xoxo->getNodes() as $id => $item) {
    if ($id > 0) {
        echo ', ';
    }
    echo '{"d":"' . addslashes(str_replace("\n", ' ', trim(str_replace("\r", '', $item->getField('text'))))) . '", "u":"' . addslashes(trim(str_replace("\n", ' ', str_replace("\r", '', $item->getField('href'))))) . '"}';
}
//end foreach
echo ']';
if ($_REQUEST['callback']) {
    echo ')';
}
Beispiel #2
0
            if ($isclose) {
                $flattento .= '</' . strtolower($flattentag) . '>';
                $rtrn[] = $flattento;
                $flattentag = '';
                unset($flattento);
                $flattento = false;
                $subflatten = 0;
            }
            //end if isclose
        }
        //end if theclass
    }
    //end foreach vals as el
    return $rtrn;
}
//end function extract_by_id
if (isset($_REQUEST['_json'])) {
    header('Content-type: text/javascript');
    require_once 'OutlineClasses/Outline.php';
    require_once 'xn-app://singpolymaplay/getTidy.php';
    if ($_REQUEST['callback']) {
        echo $_REQUEST['callback'] . '(';
    }
    $tmp = extract_by_id(getTidy($_REQUEST['url']), $_REQUEST['id']);
    $tmp = new Outline($tmp[0]);
    echo $tmp->toJSON();
    if ($_REQUEST['callback']) {
        echo ')';
    }
}
//end if _json