/** * Carrega nos campos da classe os valores que estão armazenados no Banco de Dados * chamada pela getArticle para devolver o objeto artigo para a classe Article * @param integer $ID IDentificador do usuário * @returns integer $sucess 1 em caso de sucesso, 0 em caso de erro */ function loadArticle($p) { $article = new Article(); $article->setPID($p['PID']); $article->setTitle($p['title']); $article->setSerial($p['serial']); $article->setVolume($p['volume']); $article->setNumber($p['number']); $article->setSuppl($p['suppl']); $article->setYear($p['year']); $article->setUrl($p['url']); $article->setAuthorXML($p['authors_xml']); $article->setKeywordXML($p['keywords_xml']); $article->setAbstractXML($p['abstract_xml']); $article->setWpPostID($p['wp_post_id']); $article->setWpURL($p['wp_url']); return $article; }
$query = $prefixs . $sparql->getJournalAndAnnoByArticle($title); $response = $http->sparqlQuery($query); $json = json_decode($response, true); $temp = $json["results"]["bindings"]; foreach ($temp as $t) { $article->setJournal($t["journal"]["value"]); $article->setData($t["anno"]["value"]); } //estraggo autori $query = $prefixs . $sparql->getAuthorByArticle($title); $response = $http->sparqlQuery($query); $json = json_decode($response, true); $temp = $json["results"]["bindings"]; foreach ($temp as $t) { array_push($author, $t["author_name"]["value"]); } $article->setAuthor($author); //estraggo URL $query = $prefixs . $sparql->getUrlByTitle($title); $response = $http->sparqlQuery($query); $json = json_decode($response, true); $temp = $json["results"]["bindings"]; foreach ($temp as $t) { $article->setUrl($t["url_value"]["value"]); } $json_result = json_encode($article); echo $json_result; ?>
if (isset($_GET['url']) && $_GET['url'] != null && trim($_GET['url']) != "") { // get url link if (strlen(trim($_GET['url'])) > 2048) { echo "Error URL is too large !!"; } else { $url = trim($_GET['url']); if (!Utils::isValidMd5($url)) { // decode it $url = html_entity_decode($url); // if url use https protocol change it to http if (!preg_match('!^https?://!i', $url)) { $url = 'http://' . $url; } } $article = new Article(); $article->setUrl($url); if (!$article->isAlreadyExists()) { if ($article->retrieveContent()) { if ($article->readiIt(isset($_GET['debug']))) { $article->modifyContent(); $article->saveContent(); } } } else { $article = Article::getArticle($url); // only for debug if ($article->readiIt(isset($_GET['debug']))) { $article->modifyContent(); $article->saveContent(); } }