//if we've found the right class $flattento = '<' . strtolower($el['tag']); foreach ($el['attributes'] as $att => $val) { $flattento .= ' ' . htmlspecialchars(strtolower($att)) . '="' . htmlspecialchars($val) . '"'; } $flattento .= '>' . htmlspecialchars($el['value']); $flattentag = $el['tag']; $subflatten = 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_class if (isset($_REQUEST['_microsummary'])) { header('Content-type: text/plain;'); require_once 'xn-app://singpolymaplay/getTidy.php'; $tmp = extract_by_class(getTidy($_REQUEST['url']), $_REQUEST['class']); echo str_replace(' ', ' ', trim(str_replace("\n", ' ', str_replace("\r", '', strip_tags($tmp[0]))))); } //end if _microsummary
<?php if (!$_REQUEST['url']) { die('<h1>No URL Given!</h1>'); } header('Content-type: text/javascript;charset=utf8'); require_once 'xn-app://singpolymaplay/getTidy.php'; require_once 'xn-app://xoxotools/extract_by_class.php'; $page = getTidy($_REQUEST['url']); $result = extract_by_class($page, 'entry-summary'); if ($_REQUEST['callback']) { echo $_REQUEST['callback'] . '('; } echo '{"summary":"' . str_replace("\n", '\\n', str_replace("\r", '\\n', addslashes($result[0]))) . '", "url":"' . str_replace("\n", '\\n', str_replace("\r", '\\n', addslashes($_REQUEST['url']))) . '"}'; if ($_REQUEST['callback']) { echo ')'; }