buffer;
}
$this->load($data);
$elem = array();
foreach ($this->find('a') as $e) {
$elem[] = $e->href;
}
return $elem;
}
function parseform($data = "") {
if ($data == "") {
$data = $this->buffer;
}
$output = array();
preg_match("/action=\"(.*?)\"/", $data, $action);
if (is_array($action) && count($action) > 0) {
$output['form_action'] = $action[1];
}
$this->load($data);
$hidden = array();
foreach ($this->find('input[type=hidden]') as $e) {
$hidden[$e->name] = $e->value;
}
$output['hidden_values'] = $hidden;
$names = array();
foreach ($this->find('input') as $e) {
$names[$e->name] = $e->value;
}
$output['form_variables'] = $names;
return $output;
}
function extractdom($data, $element, $nostrip = false) {
if ($data == "") {
$data = $this->buffer;
}
$this->load($data);
$elem = "";
foreach ($this->find($element) as $e) {
if ($nostrip) {
$elem.=$e->outertext;
} else {
$elem.=$e->innertext;
}
}
return $elem;
}
function parsedom($data, $id, $element, $finaldelimiter = "", $striphtml = false) {
if ($data == "") {
$data = $this->buffer;
}
$this->load($data);
$elem = "";
foreach ($this->find($id) as $e) {
$elem.=$e->innertext;
}
$this->load($elem);
$cikti = array();
foreach ($this->find($element) as $e) {
$str = $e->innertext;
if ($finaldelimiter != "") {
$str = explode($finaldelimiter, $str);
if ($striphtml) {
$cikti[] = strip_tags($str[0]);
} else {
$cikti[] = $str[0];
}
} else {
if ($striphtml) {
$cikti[] = strip_tags($str);
} else {
$cikti[] = $str;
}
}
}
return $cikti;
}
function verify_link($string, $protocol, $ext) {
$tmp = explode(':', $string);
if ($tmp[0] == $protocol) {
if (get_file_ext($string) == $ext) {
return TRUE;
} else {
return FALSE;
}
} else {
return FALSE;
}
}
}
?>