PluginProbe
HAL / 2.3
HAL v2.3
trunk 1.0 1.1 1.2 1.3 1.4 1.4.2 1.4.3 1.4.4 2.0 2.0.1 2.0.10 2.0.2 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.1.1 2.2 2.3 2.4 2.4.1 2.4.2 2.5 All 30 releases
← All changes | wp-hal.php +44 -105 2.42.3 View file →
@@ -2,9 +2,9 @@
2 2 /**
3 3 * Plugin Name: HAL
4 4 * Plugin URI: http://www.ccsd.cnrs.fr
5 5 * Description: Crée une page qui remonte les publications d'un auteur ou d'une structure en relation avec HAL et un widget des dernières publications d'un auteur ou d'une structure.
6 - * Version: 2.4
6 + * Version: 2.3
7 7 * Author: CCSD
8 8 * Author URI: http://www.ccsd.cnrs.fr
9 9 * Text Domain: wp-hal
10 10 * Domain Path: /lang/
@@ -153,9 +153,9 @@
153 153 $content = '';
154 154 if ( !wphal_is_curl_installed() ) {
155 155 $content = 'CURL not installed, please check the <a href="https://wordpress.org/plugins/hal/faq/" target="_blank" id="curl">FAQ</a> with the code : CURL';
156 156 } else {
157 - $possible_ids = ["authIdHal_s", "structId_i", "anrProjectId_i", "europeanProjectId_i", "collCode_s"];
157 + $possible_ids = ["authIdHal_s", "structId_i", "authStructId_i", "anrProjectId_i", "europeanProjectId_i", "collCode_s"];
158 158 $option_choix = !empty(get_option('option_choix')) ? get_option('option_choix') : [];
159 159 if(in_array('disciplines', $option_choix)){ //Lance les scripts pour le Graphique
160 160 wp_enqueue_style('wp-hal-style2');
161 161
@@ -184,16 +184,13 @@
184 184 */
185 185 if (!empty($id) && in_array($type, $possible_ids)) {
186 186 $id = wphal_verifSolr($id);
187 187
188 - $facets = wphal_buildfacet($option_choix);
189 - $facetQuery = !empty($facets) ? 'facet.field='.implode("&facet.field=", $facets).'&facet.mincount=1&facet=true':'';
190 -
191 188 if (get_option('option_groupe') == 'grouper') {
192 189 //cURL sur l'API pour récupérer les données
193 - $url = wphal_api . '?q=*:*&fq=' . $type . ':(' . urlencode($id) . ')&group=true&group.field=docType_s&group.limit=1000&fl=docid,citationFull_s&'.$facetQuery.'&sort=' . wphal_producedDateY . '&wt=json&json.nl=arrarr';
190 + $url = wphal_api . '?q=*:*&fq=' . $type . ':(' . urlencode($id) . ')&group=true&group.field=docType_s&group.limit=1000&fl=docid,citationFull_s&facet.field=' . wphal_lang . '_domainAllCodeLabel_fs&facet.field=keyword_s&facet.field=journalIdTitle_fs&facet.field=producedDateY_i&facet.field=authIdLastNameFirstName_fs&facet.field=instStructIdName_fs&facet.field=labStructIdName_fs&facet.field=deptStructIdName_fs&facet.field=rteamStructIdName_fs&facet.mincount=1&facet=true&sort=' . wphal_producedDateY . '&wt=json&json.nl=arrarr';
194 191 } elseif (get_option('option_groupe') == 'paginer') {
195 - $url = wphal_api . '?q=*:*&fq=' . $type . ':(' . urlencode($id) . ')&fl=docid,citationFull_s&'.$facetQuery.'&sort=' . wphal_producedDateY . '&wt=json&json.nl=arrarr';
192 + $url = wphal_api . '?q=*:*&fq=' . $type . ':(' . urlencode($id) . ')&fl=docid,citationFull_s&facet.field=' . wphal_lang . '_domainAllCodeLabel_fs&facet.field=keyword_s&facet.field=journalIdTitle_fs&facet.field=producedDateY_i&facet.field=authIdLastNameFirstName_fs&facet.field=instStructIdName_fs&facet.field=labStructIdName_fs&facet.field=deptStructIdName_fs&facet.field=rteamStructIdName_fs&facet.mincount=1&facet=true&sort=' . wphal_producedDateY . '&wt=json&json.nl=arrarr';
196 193 }
197 194
198 195 $json = wphal_do_get_data($url);
199 196 $hal_page = (get_query_var('hal_page')) ? get_query_var('hal_page') : 1;
@@ -259,57 +256,40 @@
259 256
260 257 <ul id="wphal-cont" style="list-style-type: none;">';
261 258
262 259 if ($contact == 'yes' && $type == 'authIdHal_s') {
263 - $urlauthor = wphal_urlauthor . '?indent=true&fq=valid_s:PREFERRED&fl=fullName_s,idHal_s,hasCV_bool,arxivId_s,idrefId_s,isniId_s,orcidId_s,viafId_s&q=idHal_s:' . urlencode($id);
260 + $urlauthor = wphal_urlauthor.'?indent=true&fq=valid_s:VALID&fl=idref_s,url_s,email_s,fullName_s,arxiv_s,idHal_s,viaf_s,isni_s,orcid_s,hasCV_bool&q=idHal_s:'.urlencode($id);
264 261 $jsonauthor = wphal_do_get_data($urlauthor);
265 262
266 - foreach ($jsonauthor->response->docs as $i=>$doc) {
263 + for ($i = 0; $jsonauthor->response->docs[$i] != ''; $i++) {
267 264 $content .= '<div class="wphal-infocontact" id="wphal-infocontact'.$i.'">';
268 - if ($doc->fullName_s != '') {
269 - $content .= '<li class="wphal-fullname"><span>Nom : </span><span>'. $doc->fullName_s .'</span></li>';
265 + if ($jsonauthor->response->docs[$i]->fullName_s != '') {
266 + $content .= '<li class="wphal-fullname"><span>Nom : </span><span>'. $jsonauthor->response->docs[$i]->fullName_s .'</span></li>';
270 267 }
271 - if ($doc->idHal_s != '') {
272 - $content .= '<li class="wphal-idhal"><span>IdHAL : </span><span>' . $doc->idHal_s . '</span></li>';
268 + if ($jsonauthor->response->docs[$i]->email_s != '') {
269 + $content .= '<li class="wphal-email"><span>Email : </span><span><a href="'.esc_url('mailto:'. $jsonauthor->response->docs[$i]->email_s) .'">' . $jsonauthor->response->docs[$i]->email_s . '</a></span></li>';
273 270 }
274 - if ($doc->hasCV_bool == true){
275 - $content .= '<li class="wphal-cvhal"><span>CV HAL : </span><a href="'.esc_url(cvhal. $doc->idHal_s).'" target="_blank">CV de '.$doc->fullName_s.'</a></li>';
271 + if ($jsonauthor->response->docs[$i]->idHal_s != '') {
272 + $content .= '<li class="wphal-idhal"><span>IdHAL : </span><span>' . $jsonauthor->response->docs[$i]->idHal_s . '</span></li>';
276 273 }
277 - if (isset($doc->arxivId_s ) && is_array($doc->arxivId_s)) {
278 - $content .= '<li class="wphal-"><span>arXiv : </span><span>';
279 - foreach($doc->arxivId_s as $arxivId_s){
280 - $content .= '<a href="' . esc_url($arxivId_s) . '" target="_blank">' . substr(strrchr($arxivId_s, "/"), 1) . '</a> ,';
281 - }
282 - $content .= '</span></li>';
274 + if ($jsonauthor->response->docs[$i]->hasCV_bool == true){
275 + $content .= '<li class="wphal-cvhal"><span>CV HAL : </span><a href="'.esc_url(cvhal. $jsonauthor->response->docs[$i]->idHal_s).'" target="_blank">CV de '.$jsonauthor->response->docs[$i]->fullName_s.'</a></li>';
283 276 }
284 - if (isset($doc->idrefId_s ) && is_array($doc->idrefId_s)) {
285 - $content .= '<li class="wphal-"><span>IdRef : </span><span>';
286 - foreach($doc->idrefId_s as $idref){
287 - $content .= '<a href="' . esc_url($idref) . '" target="_blank">' . substr(strrchr($idref, "/"), 1) . '</a> ,';
288 - }
289 - $content .= '</span></li>';
277 + if ($jsonauthor->response->docs[$i]->arxiv_s != '') {
278 + $content .= '<li class="wphal-"><span>arXiv : </span><span><a href="' . esc_url($jsonauthor->response->docs[$i]->arxiv_s) . '" target="_blank">' . substr(strrchr($jsonauthor->response->docs[$i]->arxiv_s, "/"), 1) . '</a></span></li>';
290 279 }
291 - if (isset($doc->orcidId_s ) && $doc->orcidId_s != '') {
292 - $content .= '<li class="wphal-"><span>ORCID : </span><span>';
293 - foreach($doc->orcidId_s as $orcidId_s){
294 - $content .= '<a href="' . esc_url($orcidId_s) . '" target="_blank">' . substr(strrchr($orcidId_s, "/"), 1) . '</a> ,';
295 - }
296 - $content .= '</span></li>';
280 + if ($jsonauthor->response->docs[$i]->idref_s != '') {
281 + $content .= '<li class="wphal-"><span>IdRef : </span><span><a href="' . esc_url($jsonauthor->response->docs[$i]->idref_s) . '" target="_blank">' . substr(strrchr($jsonauthor->response->docs[$i]->idref_s, "/"), 1) . '</a></span></li>';
297 282 }
298 - if (isset($doc->viafId_s ) && $doc->viafId_s != '') {
299 - $content .= '<li class="wphal-"><span>VIAF : </span><span>';
300 - foreach($doc->viafId_s as $viafId_s){
301 - $content .= '<a href="' . esc_url($viafId_s) . '" target="_blank">' . substr(strrchr($viafId_s, "/"), 1) . '</a> ,';
302 - }
303 - $content .= '</span></li>';
283 + if ($jsonauthor->response->docs[$i]->orcid_s != '') {
284 + $content .= '<li class="wphal-"><span>ORCID : </span><span><a href="' . esc_url($jsonauthor->response->docs[$i]->orcid_s) . '" target="_blank">' . substr(strrchr($jsonauthor->response->docs[$i]->orcid_s, "/"), 1) . '</a></span></li>';
304 285 }
305 - if (isset($doc->isniId_s ) && $doc->isniId_s != '') {
306 - $content .= '<li class="wphal-"><span>ISNI : </span><span>';
307 - foreach($doc->isniId_s as $isniId_s){
308 - $content .= '<a href="' . esc_url($isniId_s) . '" target="_blank">' . substr(strrchr($isniId_s, "/"), 1) . '</a> ,';
309 - }
310 - $content .= '</span></li>';
286 + if ($jsonauthor->response->docs[$i]->viaf_s != '') {
287 + $content .= '<li class="wphal-"><span>VIAF : </span><span><a href="' . esc_url($jsonauthor->response->docs[$i]->viaf_s) . '" target="_blank">' . substr(strrchr($jsonauthor->response->docs[$i]->viaf_s, "/"), 1) . '</a></span></li>';
311 288 }
289 + if ($jsonauthor->response->docs[$i]->isni_s != '') {
290 + $content .= '<li class="wphal-"><span>ISNI : </span><span><a href="' . esc_url($jsonauthor->response->docs[$i]->isni_s) . '" target="_blank">' . substr(strrchr($jsonauthor->response->docs[$i]->isni_s, "/"), 1) . '</a></span></li>';
291 + }
312 292 $content .= '</div>';
313 293 }
314 294 }
315 295 if (get_option('option_email') != '') {
@@ -339,13 +319,13 @@
339 319 <div class="display" id="wphal-disciplines" style="display: none;">
340 320 <h3 class="wphal-titre">' . __('Disciplines', 'wp-hal') . '</h3>';
341 321
342 322 if (wphal_locale == 'fr_FR') {
343 - $facetdomain = isset($json->facet_counts->facet_fields->fr_domainAllCodeLabel_fs) ? $json->facet_counts->facet_fields->fr_domainAllCodeLabel_fs:null;
323 + $facetdomain = $json->facet_counts->facet_fields->fr_domainAllCodeLabel_fs;
344 324 } elseif (wphal_locale == 'es_ES') {
345 - $facetdomain = isset($json->facet_counts->facet_fields->es_domainAllCodeLabel_fs) ? $json->facet_counts->facet_fields->es_domainAllCodeLabel_fs:null;
325 + $facetdomain = $json->facet_counts->facet_fields->es_domainAllCodeLabel_fs;
346 326 } else {
347 - $facetdomain = isset($json->facet_counts->facet_fields->en_domainAllCodeLabel_fs) ? $json->facet_counts->facet_fields->en_domainAllCodeLabel_fs:null;
327 + $facetdomain = $json->facet_counts->facet_fields->en_domainAllCodeLabel_fs;
348 328 }
349 329
350 330 if (!is_null($facetdomain) && !empty($facetdomain)) {
351 331 $content .= '<div id="listdisci">';
@@ -369,9 +349,9 @@
369 349 }
370 350 $content .= '</div>
371 351 <div class="display" id="wphal-keywords" style="display: none;">
372 352 <h3 class="wphal-titre">' . __('Mots-clefs', 'wp-hal') . '</h3>';
373 - if (isset($json->facet_counts->facet_fields->keyword_s) && !is_null($json->facet_counts->facet_fields->keyword_s) && !empty($json->facet_counts->facet_fields->keyword_s)) {
353 + if (!is_null($json->facet_counts->facet_fields->keyword_s) && !empty($json->facet_counts->facet_fields->keyword_s)) {
374 354 $content .= '<div id="wphal-keys">';
375 355 $r = 0;
376 356 // CSS Nuage de mots
377 357 $maxsize = 25;
@@ -414,9 +394,9 @@
414 394 }
415 395 $content .= '</div>
416 396 <div class="display" id="wphal-auteurs" style="display: none;">
417 397 <h3 class="wphal-titre">' . __('Auteurs', 'wp-hal') . '</h3>';
418 - if (isset($json->facet_counts->facet_fields->authIdLastNameFirstName_fs) && !is_null($json->facet_counts->facet_fields->authIdLastNameFirstName_fs) && !empty($json->facet_counts->facet_fields->authIdLastNameFirstName_fs)) {
398 + if (!is_null($json->facet_counts->facet_fields->authIdLastNameFirstName_fs) && !empty($json->facet_counts->facet_fields->authIdLastNameFirstName_fs)) {
419 399 $content .= '<span id="triauteurs">';
420 400 $content .= '<button type="button" class="trial" id="triaut" onclick="toggleSort(this, true, \'wphal-aut\', \'auteursuite\', \'triaut\'); return false;" style="font-size:16px; text-decoration: none;" >Tri Alphabétique</button>';
421 401 $content .= '<button type="button" class="trioc" id="trinbaut" onclick="toggleSort(this, false, \'wphal-aut\', \'auteursuite\', \'trinbaut\'); return false;" style="font-size:16px; text-decoration: none;">Tri Occurrence</button>';
422 402 $content .= '</span>';
@@ -464,9 +444,9 @@
464 444 }
465 445 $content .= '</div>
466 446 <div class="display" id="wphal-revues" style="display: none;">
467 447 <h3 class="wphal-titre">' . __('Revues', 'wp-hal') . '</h3>';
468 - if (isset($json->facet_counts->facet_fields->journalIdTitle_fs) && !is_null($json->facet_counts->facet_fields->journalIdTitle_fs) && !empty($json->facet_counts->facet_fields->journalIdTitle_fs)) {
448 + if (!is_null($json->facet_counts->facet_fields->journalIdTitle_fs) && !empty($json->facet_counts->facet_fields->journalIdTitle_fs)) {
469 449 $content .= '<span id="trirevues">';
470 450 $content .= '<button type="button" class="trial" id="trirev" onclick="toggleSort(this, true, \'wphal-rev\', \'revuesuite\', \'trirev\'); return false;" style="font-size:16px; text-decoration: none;" >Tri Alphabétique</button>';
471 451 $content .= '<button type="button" class="trioc" id="trinbrev" onclick="toggleSort(this, false, \'wphal-rev\', \'revuesuite\', \'trinbrev\'); return false;" style="font-size:16px; text-decoration: none;">Tri Occurrence</button>';
472 452 $content .= '</span>';
@@ -504,9 +484,9 @@
504 484 }
505 485 $content .= '</div>
506 486 <div class="display" id="wphal-annees" style="display: none;">
507 487 <h3 class="wphal-titre">' . __('Année de production', 'wp-hal') . '</h3>';
508 - if (isset($json->facet_counts->facet_fields->producedDateY_i) && !is_null($json->facet_counts->facet_fields->producedDateY_i) && !empty($json->facet_counts->facet_fields->producedDateY_i)) {
488 + if (!is_null($json->facet_counts->facet_fields->producedDateY_i) && !empty($json->facet_counts->facet_fields->producedDateY_i)) {
509 489 $content .= '<span id="triannees">';
510 490 $content .= '<button type="button" class="trial" id="trian" onclick="toggleSort(this, true, \'wphal-an\', \'anneesuite\', \'trian\'); return false;" style="font-size:16px; text-decoration: none;" >Tri Alphabétique</button>';
511 491 $content .= '<button type="button" class="trioc" id="trinban" onclick="toggleSort(this, false, \'wphal-an\', \'anneesuite\', \'trinban\'); return false;" style="font-size:16px; text-decoration: none;">Tri Occurrence</button>';
512 492 $content .= '</span>';
@@ -544,9 +524,9 @@
544 524 }
545 525 $content .= '</div>
546 526 <div class="display" id="wphal-insts" style="display: none;">
547 527 <h3 class="wphal-titre">' . __('Institutions', 'wp-hal') . '</h3>';
548 - if (isset($json->facet_counts->facet_fields->instStructIdName_fs) && !is_null($json->facet_counts->facet_fields->instStructIdName_fs) && !empty($json->facet_counts->facet_fields->instStructIdName_fs)) {
528 + if (!is_null($json->facet_counts->facet_fields->instStructIdName_fs) && !empty($json->facet_counts->facet_fields->instStructIdName_fs)) {
549 529 $content .= '<span id="triinsts">';
550 530 $content .= '<button type="button" class="trial" id="triinst" onclick="toggleSort(this, true, \'wphal-institu\', \'instsuite\', \'triinst\'); return false;" style="font-size:16px; text-decoration: none;" >Tri Alphabétique</button>';
551 531 $content .= '<button type="button" class="trioc" id="trinbinst" onclick="toggleSort(this, false, \'wphal-institu\', \'instsuite\', \'trinbinst\'); return false;" style="font-size:16px; text-decoration: none;">Tri Occurrence</button>';
552 532 $content .= '</span>';
@@ -584,9 +564,9 @@
584 564 }
585 565 $content .= '</div>
586 566 <div class="display" id="wphal-labs" style="display: none;">
587 567 <h3 class="wphal-titre">' . __('Laboratoires', 'wp-hal') . '</h3>';
588 - if (isset($json->facet_counts->facet_fields->labStructIdName_fs) && !is_null($json->facet_counts->facet_fields->labStructIdName_fs) && !empty($json->facet_counts->facet_fields->labStructIdName_fs)) {
568 + if (!is_null($json->facet_counts->facet_fields->labStructIdName_fs) && !empty($json->facet_counts->facet_fields->labStructIdName_fs)) {
589 569 $content .= '<span id="trilabs">';
590 570 $content .= '<button type="button" class="trial" id="trilab" onclick="toggleSort(this, true, \'wphal-labo\', \'labsuite\', \'trilab\'); return false;" style="font-size:16px; text-decoration: none;" >Tri Alphabétique</button>';
591 571 $content .= '<button type="button" class="trioc" id="trinblab" onclick="toggleSort(this, false, \'wphal-labo\', \'labsuite\', \'trinblab\'); return false;" style="font-size:16px; text-decoration: none;">Tri Occurrence</button>';
592 572 $content .= '</span>';
@@ -625,9 +605,9 @@
625 605 }
626 606 $content .= '</div>
627 607 <div class="display" id="wphal-depts" style="display: none;">
628 608 <h3 class="wphal-titre">' . __('Départements', 'wp-hal') . '</h3>';
629 - if (isset($json->facet_counts->facet_fields->deptStructIdName_fs) && !is_null($json->facet_counts->facet_fields->deptStructIdName_fs) && !empty($json->facet_counts->facet_fields->deptStructIdName_fs)) {
609 + if (!is_null($json->facet_counts->facet_fields->deptStructIdName_fs) && !empty($json->facet_counts->facet_fields->deptStructIdName_fs)) {
630 610 $content .= '<span id="tridept">';
631 611 $content .= '<button type="button" class="trial" id="tridept" onclick="toggleSort(this, true, \'wphal-dpt\', \'deptsuite\', \'tridept\'); return false;" style="font-size:16px; text-decoration: none;" >Tri Alphabétique</button>';
632 612 $content .= '<button type="button" class="trioc" id="trinbdept" onclick="toggleSort(this, false, \'wphal-dpt\', \'deptsuite\', \'trinbdept\'); return false;" style="font-size:16px; text-decoration: none;">Tri Occurrence</button>';
633 613 $content .= '</span>';
@@ -665,9 +645,9 @@
665 645 }
666 646 $content .= '</div>
667 647 <div class="display" id="wphal-equipes" style="display: none;">
668 648 <h3 class="wphal-titre">' . __('Équipes de recherche', 'wp-hal') . '</h3>';
669 - if (isset($json->facet_counts->facet_fields->rteamStructIdName_fs) && !is_null($json->facet_counts->facet_fields->rteamStructIdName_fs) && !empty($json->facet_counts->facet_fields->rteamStructIdName_fs)) {
649 + if (!is_null($json->facet_counts->facet_fields->rteamStructIdName_fs) && !empty($json->facet_counts->facet_fields->rteamStructIdName_fs)) {
670 650 $content .= '<span id="triequipe">';
671 651 $content .= '<button type="button" class="trial" id="triequipe" onclick="toggleSort(this, true, \'wphal-rteam\', \'equipesuite\', \'triequipe\'); return false;" style="font-size:16px;text-decoration: none;" >Tri Alphabétique</button>';
672 652 $content .= '<button type="button" class="trioc" id="trinbequipe" onclick="toggleSort(this, false, \'wphal-rteam\', \'equipesuite\', \'trinbequipe\'); return false;" style="font-size:16px; text-decoration: none;">Tri Occurrence</button>';
673 653 $content .= '</span>';
@@ -772,9 +752,9 @@
772 752 if($total> $messagesParPage) {
773 753 $base_url = ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on' ? 'https' : 'http' ) . '://' . $_SERVER['HTTP_HOST'];
774 754 $url = $base_url . $_SERVER["REQUEST_URI"];
775 755 $explodedURL= explode('?', $url);
776 - $queryString = isset($explodedURL[1])?$explodedURL[1]:"";
756 + $queryString = $explodedURL[1];
777 757 $pagedHref = $explodedURL[0];
778 758 if(!empty($queryString)){
779 759 $parsedQueryString = [];
780 760 parse_str($queryString, $parsedQueryString);
@@ -941,50 +921,8 @@
941 921 } );
942 922 return wp_kses($content, $allowed_html_tags);
943 923 }
944 924
945 -/**
946 - * build facet query based on the option choice
947 - *
948 - * @param array $option_choix
949 - * @return array
950 - */
951 -function wphal_buildfacet($option_choix)
952 -{
953 - $facetQuery = [];
954 - if (is_array($option_choix) && !empty($option_choix)) {
955 - foreach ($option_choix as $option) {
956 - if ($option == 'disciplines') {
957 - $facetQuery[] = wphal_lang . '_domainAllCodeLabel_fs';
958 - }
959 - if ($option == 'mots-clefs') {
960 - $facetQuery[] = 'keyword_s';
961 - }
962 - if ($option == 'auteurs') {
963 - $facetQuery[] = 'authIdLastNameFirstName_fs';
964 - }
965 - if ($option == 'revues') {
966 - $facetQuery[] = 'journalIdTitle_fs';
967 - }
968 - if ($option == 'annee') {
969 - $facetQuery[] = 'producedDateY_i';
970 - }
971 - if ($option == 'institution') {
972 - $facetQuery[] = 'instStructIdName_fs';
973 - }
974 - if ($option == 'laboratoire') {
975 - $facetQuery[] = 'labStructIdName_fs';
976 - }
977 - if ($option == 'departement') {
978 - $facetQuery[] = 'deptStructIdName_fs';
979 - }
980 - if ($option == 'equipe') {
981 - $facetQuery[] = 'rteamStructIdName_fs';
982 - }
983 - }
984 - }
985 - return $facetQuery;
986 -}
987 925 function wphal_verifSolr($values){
988 926 $verifsolr = explode(',',$values);
989 927 $numverif = count($verifsolr);
990 928 $solrsql = '';
@@ -1107,11 +1045,10 @@
1107 1045 $content = 'Please check the <a href="https://wordpress.org/plugins/hal/faq/" target="_blank" id="FAQ">FAQ</a> with the code : CURL';
1108 1046
1109 1047 } else {
1110 1048 $instance['idhal'] = wphal_verifSolr($instance['idhal']);
1111 - $fieldName = $instance['typetext'] == 'title_s' ? 'title_s':'citationFull_s';
1112 1049
1113 - $url = wphal_api . '?q=*:*&fq=' . $instance['select'] . ':' . urlencode($instance['idhal']) . '&fl=uri_s,' . $fieldName . '&sort=' . wphal_producedDateY . '&rows=' . $instance['nbdoc'] . '&wt=json';
1050 + $url = wphal_api . '?q=*:*&fq=' . $instance['select'] . ':' . urlencode($instance['idhal']) . '&fl=uri_s,' . $instance['typetext'] . '&sort=' . wphal_producedDateY . '&rows=' . $instance['nbdoc'] . '&wt=json';
1114 1051 $json = wphal_do_get_data($url);
1115 1052
1116 1053 $count_results = count($json->response->docs);
1117 1054 if ($count_results > 0) {
@@ -1116,12 +1053,12 @@
1116 1053 $count_results = count($json->response->docs);
1117 1054 if ($count_results > 0) {
1118 1055 $content = '<ul class="widhal-ul">';
1119 1056 for ($i = 0; $i < $count_results - 1; $i++) {
1120 - if ($fieldName == 'title_s') {
1057 + if ($instance['typetext'] == 'citationRef_s') {
1058 + $typetext = $json->response->docs[$i]->citationRef_s;
1059 + } else {
1121 1060 $typetext = $json->response->docs[$i]->title_s[0];
1122 - } else {
1123 - $typetext = $json->response->docs[$i]->citationFull_s;
1124 1061 }
1125 1062 $content .= '<li class="widhal-li"><a href="' . esc_url($json->response->docs[$i]->uri_s) . '" target="_blank">' . $typetext . '</a></li>';
1126 1063 }
1127 1064 $content .= '</ul>';
@@ -1202,9 +1139,9 @@
1202 1139 <p>
1203 1140 <label for="<?php echo esc_attr($this->get_field_id("typetext"));?>"><?php echo esc_html(__("Type d'affichage",'wp-hal')) .' :'?></label>
1204 1141 <select id="<?php echo esc_attr($this->get_field_id("typetext"));?>" name="<?php echo esc_attr($this->get_field_name("typetext"));?>">
1205 1142 <option id="<?php echo esc_attr($this->get_field_id("Title"));?>" value="title_s" <?php echo esc_attr(($instance["typetext"] == "title_s")?'selected':''); ?>><label for="<?php echo wp_kses($this->get_field_id("Title"), []);?>"><?php echo esc_html(__("Titre", 'wp-hal'))?></label></option>
1206 - <option id="<?php echo esc_attr($this->get_field_id("Citation"));?>" value="citationFull_s" <?php echo esc_attr(($instance["typetext"] == "citationFull_s")?'selected':''); ?>><label for="<?php echo esc_attr($this->get_field_id("Citation"));?>"><?php echo esc_html(__("Citation", 'wp-hal'), [])?></label></option>
1143 + <option id="<?php echo esc_attr($this->get_field_id("Citation"));?>" value="citationRef_s" <?php echo esc_attr(($instance["typetext"] == "citationRef_s")?'selected':''); ?>><label for="<?php echo esc_attr($this->get_field_id("Citation"));?>"><?php echo esc_html(__("Citation", 'wp-hal'), [])?></label></option>
1207 1144 </select>
1208 1145 </p>
1209 1146 <p>
1210 1147 <label for="<?php echo esc_attr($this->get_field_id("select"));?>"><?php echo esc_html(__("Type d'Id",'wp-hal') .' :')?></label>
@@ -1210,8 +1147,9 @@
1210 1147 <label for="<?php echo esc_attr($this->get_field_id("select"));?>"><?php echo esc_html(__("Type d'Id",'wp-hal') .' :')?></label>
1211 1148 <select id="<?php echo esc_attr($this->get_field_id("select"));?>" name="<?php echo esc_attr($this->get_field_name("select"));?>">
1212 1149 <option id="<?php echo esc_attr($this->get_field_id("Idhal"));?>" value="authIdHal_s" <?php echo esc_attr(($instance["select"] == "authIdHal_s")?'selected':''); ?>><label for="<?php echo esc_attr($this->get_field_id("Idhal"));?>">Id Hal</label><span style="font-style: italic;"> <?php echo esc_html(__('(Exemple : laurent-capelli)','wp-hal'));?></span></option>
1213 1150 <option id="<?php echo esc_attr($this->get_field_id("StructId"));?>" value="structId_i" <?php echo esc_attr(($instance["select"] == "structId_i")?'selected':''); ?>><label for="<?php echo esc_attr($this->get_field_id("StructId"));?>">Struct Id</label><span style="font-style: italic;"> <?php echo esc_html(__('(Exemple : 413106)','wp-hal'));?></span></option>
1151 + <option id="<?php echo esc_attr($this->get_field_id("AuthorStructId"));?>" value="authStructId_i" <?php echo esc_attr(($instance["select"] == "authStructId_i")?'selected':''); ?>><label for="<?php echo esc_attr($this->get_field_id("AuthorStructId"));?>">AuthorStruct Id</label><span style="font-style: italic;"> <?php echo esc_html(__('(Exemple : 413106)','wp-hal'));?></span></option>
1214 1152 <option id="<?php echo esc_attr($this->get_field_id("Anrproject"));?>" value="anrProjectId_i" <?php echo esc_attr(($instance["select"] == "anrProjectId_i")?'selected':''); ?>><label for="<?php echo esc_attr($this->get_field_id("Anrproject"));?>">anrProject Id</label><span style="font-style: italic;"> <?php echo esc_html(__('(Exemple : 1646)','wp-hal'));?></span></option>
1215 1153 <option id="<?php echo esc_attr($this->get_field_id("Europeanproject"));?>" value="europeanProjectId_i" <?php echo esc_attr(($instance["select"] == "europeanProjectId_i")?'selected':''); ?>><label for="<?php echo esc_attr($this->get_field_id("Europeanproject"));?>">europeanProject Id</label><span style="font-style: italic;"> <?php echo esc_html(__('(Exemple : 17877)','wp-hal'));?></span></option>
1216 1154 <option id="<?php echo esc_attr($this->get_field_id("Collection"));?>" value="collCode_s" <?php echo esc_attr(($instance["select"] == "collCode_s")?'selected':''); ?>><label for="<?php echo esc_attr($this->get_field_id("Collection"));?>">Collection</label><span style="font-style: italic;"> <?php echo esc_html(__('(Exemple : TICE2014)','wp-hal'));?></span></option>
1217 1155 </select>
@@ -1326,8 +1264,9 @@
1326 1264 <th scope="row"><label for="option_type"><?php echo esc_html(__('Type d\'Id','wp-hal'));?></label></th>
1327 1265 <td><select name="option_type">
1328 1266 <option id="Idhal" value="authIdHal_s" <?php echo esc_attr(((get_option('option_type') == "authIdHal_s")?'selected':'')); ?>><label for="Idhal">Id Hal</label><span style="font-style: italic;"> <?php echo esc_html(__('(Exemple : laurent-capelli)','wp-hal'));?></span></option>
1329 1267 <option id="StructId" value="structId_i" <?php echo esc_attr(((get_option('option_type') == "structId_i")?'selected':'')); ?>><label for="StructId">Struct Id</label><span style="font-style: italic;"> <?php echo esc_html(__('(Exemple : 413106)','wp-hal'));?></span></option>
1268 + <option id="AuthorStructId" value="authStructId_i" <?php echo esc_attr(((get_option('option_type') == "authStructId_i")?'selected':'')); ?>><label for="AuthorStructId">AuthorStruct Id</label><span style="font-style: italic;"> <?php echo esc_html(__('(Exemple : 413106)','wp-hal'));?></span></option>
1330 1269 <option id="Anrproject" value="anrProjectId_i" <?php echo esc_attr(((get_option('option_type') == "anrProjectId_i")?'selected':'')); ?>><label for="Anrproject">anrProject Id</label><span style="font-style: italic;"> <?php echo esc_html(__('(Exemple : 1646)','wp-hal'));?></span></option>
1331 1270 <option id="Europeanproject" value="europeanProjectId_i" <?php echo esc_attr(((get_option('option_type') == "europeanProjectId_i")?'selected':'')); ?>><label for="Europeanproject">europeanProject Id</label><span style="font-style: italic;"> <?php echo esc_html(__('(Exemple : 17877)','wp-hal'));?></span></option>
1332 1271 <option id="Collection" value="collCode_s" <?php echo esc_attr(((get_option('option_type') == "collCode_s")?'selected':'')); ?>><label for="Collection">Collection</label><span style="font-style: italic;"> <?php echo esc_html(__('(Exemple : TICE2014)','wp-hal'));?></span></option>
1333 1272 </select>