__getPermaLinksFromText($text); $res = array(); for ($i=0;$i__getRDFFromLink($uriArray[$i])) !== false) { if (($tburi = $this->__getPingURL($infoRDF)) !== false) { $res[] = $tburi; } } } return $res; } /* * Produit un tableau contenant la liste des permaliens contenus dans un texte. * * @param String $text texte le texte à parser. * @return String[] tableaux contenant la liste des URI contenues dans le texte. */ function __getPermaLinksFromText($text) { $linkArray = array(); # Attributs href des liens if (preg_match_all('/]+)>/ms', $text, $array, PREG_SET_ORDER)) { for ($i = 0; $i]+)>/ms', $text, $array, PREG_SET_ORDER)) { for ($i = 0; $i)/sm', $pageContents, $rdf_all, PREG_SET_ORDER); for ($i=0; $i__discoverCharset($pageContents); $rdf = ''."\n".$rdf_all[$i][1]; return array('rdf' => $rdf, 'encoding' => $encoding); } } return false; } function __discoverCharset($str) { # Recherche du prologue if (preg_match('/^\s*]*encoding="(.+)"/',$str,$matches)) { return $matches[1]; } elseif (preg_match('/]+content="[^"]*charset=([a-zA-Z0-9-]+)/m',$str,$matches)) { return $matches[1]; } else { return 'iso-8859-1'; } } function __getPingURL($xml) { $this->url = ''; $xp = xml_parser_create($xml['encoding']); xml_parser_set_option($xp,XML_OPTION_CASE_FOLDING,false); xml_set_object($xp,$this); xml_set_element_handler($xp,'__openTag','__closeTag'); xml_parse($xp,$xml['rdf']); xml_parser_free($xp); return ($this->url != '') ? $this->url : false; } function __openTag($p,$tag,$attr='') { if ($tag == 'rdf:Description' && !empty($attr['trackback:ping'])) { $this->url = $attr['trackback:ping']; } } function __closeTag($p,$tag) { } } ?>