PluginProbe
HAL / 2.0
HAL v2.0
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 +442 -737 2.4.12.0 View file →
@@ -2,10 +2,10 @@
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.1
7 - * Author: CCSD
6 + * Version: 2.0
7 + * Author: Baptiste Blondelle
8 8 * Author URI: http://www.ccsd.cnrs.fr
9 9 * Text Domain: wp-hal
10 10 * Domain Path: /lang/
11 11 */
@@ -17,38 +17,28 @@
17 17 //Récupère les constantes
18 18 require_once("constantes.php");
19 19
20 20
21 -if (wphal_locale == 'fr_FR') {
22 - define('wphal_lang', 'fr');
23 -} elseif (wphal_locale == 'es_ES') {
24 - define('wphal_lang', 'es');
21 +if (locale == 'fr_FR') {
22 + define('lang', 'fr');
23 +} elseif (locale == 'es_ES') {
24 + define('lang', 'es');
25 25 } else {
26 - define('wphal_lang', 'en');
26 + define('lang', 'en');
27 27 }
28 28
29 -function wphal_is_curl_installed() {
30 - $loaded_extentions = get_loaded_extensions();
31 - if (in_array ('curl', $loaded_extentions)) {
32 - return true;
33 - }
34 - else {
35 - return false;
36 - }
37 -}
38 -
39 29 // Création du shortcode ('nom du shortcode', 'fonction appelée')
40 -add_shortcode( 'cv-hal', 'wphal_cv_hal' );
41 -add_shortcode( 'nb-doc', 'wphal_nb_doc' );
30 +add_shortcode( 'cv-hal', 'cv_hal' );
31 +add_shortcode( 'nb-doc', 'nb_doc' );
42 32
43 33
44 -function wphal_charger_languages() {
34 +function charger_languages() {
45 35 load_plugin_textdomain('wp-hal', false, dirname(plugin_basename(__FILE__)) . '/lang/');
46 36 }
47 37
48 -add_action('plugins_loaded', 'wphal_charger_languages');
38 +add_action('plugins_loaded', 'charger_languages');
49 39
50 -function wphal_action_links( $links, $file ) {
40 +function hal_plugin_action_links( $links, $file ) {
51 41 if ( $file != plugin_basename( __FILE__ ))
52 42 return $links;
53 43
54 44 $settings_link = '<a href="admin.php?page=wp-hal.php">' . __( 'Paramètres', 'wp-hal' ) . '</a>';
@@ -57,77 +47,18 @@
57 47
58 48 return $links;
59 49 }
60 50
61 -add_filter( 'query_vars', 'wphal_query_vars' );
62 -function wphal_query_vars( $query_vars ) {
63 - $query_vars[] = 'hal_page';
64 - return $query_vars;
65 -}
66 51
67 -add_filter( 'plugin_action_links', 'wphal_action_links',10,2);
68 -/**
69 - * @param $url
70 - * @return object
71 - */
72 -function wphal_do_common_curl_call($url) {
73 - $response = wp_remote_get($url, [
74 - 'timeout'=>20,
75 - 'user-agent'=>"HAL Plugin Wordpress " . wphal_version,
76 - 'headers' => ['Content-type'=> 'application/json']
77 - ]);
78 - // we could ve parsed the response but if in general if no results then we get empty content
79 - $body = wp_remote_retrieve_body($response);
80 - // Récupération du résultat JSON
81 - $json = json_decode($body);
82 - return $json;
83 -}
52 +add_filter( 'plugin_action_links', 'hal_plugin_action_links',10,2);
84 53
85 -function wphal_clear_transients()
86 -{
87 - global $wpdb;
88 - // delete all "hal namespace" transients
89 - $sql = "
90 - DELETE
91 - FROM {$wpdb->options}
92 - WHERE option_name like '\_transient\_hal\_%'
93 - OR option_name like '\_transient\_timeout\_hal\_%'
94 - ";
95 54
96 - $wpdb->query($sql);
97 -}
98 -
99 -/**
100 - * fetches data from cache or download data from HAL API
101 - * @param $url
102 - * @return object
103 - */
104 -function wphal_do_get_data($url) {
105 - $transient_id = 'hal_'.md5($url);
106 - if(!empty(get_option('option_erase_cache'))){
107 - // we reset cache transient for hal namespace
108 - wphal_clear_transients();
109 - update_option('option_erase_cache', '');
110 - }
111 - $cache_expiration = empty(get_option('option_cache_timeout')) ? 1 * DAY_IN_SECONDS : intval(get_option('option_cache_timeout')) * MINUTE_IN_SECONDS;
112 - if ( false === ( $value = get_transient( $transient_id ) ) ) {
113 - $json = wphal_do_common_curl_call($url);
114 - if($json)
115 - set_transient( $transient_id, $json, $cache_expiration);
116 - return $json;
117 - } else{
118 - return $value;
119 - }
120 -}
121 -
122 -/**
55 +/***********************************************************************************************************************
123 56 * PLUGIN SHORTCODE ND-DOC
124 - * @param $param
125 - * @return int
126 -*/
127 -function wphal_nb_doc($param)
57 + **********************************************************************************************************************/
58 +function nb_doc($param)
128 59 {
129 - $idhal = wphal_verifSolr(get_option('option_idhal'));
60 + $idhal = verifSolr(get_option('option_idhal'));
130 61 extract(shortcode_atts(array(
131 62 'type' => get_option('option_type'),
132 63 'id' => $idhal
133 64 ),
@@ -132,126 +63,126 @@
132 63 'id' => $idhal
133 64 ),
134 65 $param
135 66 ));
136 - /**
137 - * @var $id : defined by extract
138 - * @var string $type : defined by extract
139 - */
140 - $id = wphal_verifSolr($id);
67 + $id = verifSolr($id);
141 68
142 - $url = wphal_api . '?q=*:*&fq=' . $type . ':(' . urlencode($id) . ')&rows=0&wt=json';
69 + $url = api . '?q=*:*&fq=' . $type . ':(' . urlencode($id) . ')&rows=0&wt=json';
70 + $ch = curl_init($url);
71 + // Options
72 + $options = array(
73 + CURLOPT_RETURNTRANSFER => true,
74 + CURLOPT_HTTPHEADER => array('Content-type: application/json'),
75 + CURLOPT_TIMEOUT => 10,
76 + CURLOPT_USERAGENT => "HAL Plugin Wordpress " . version
77 + );
143 78
144 - $json =wphal_do_get_data($url);
79 + // Bind des options et de l'objet cURL que l'on va utiliser
80 + curl_setopt_array($ch, $options);
81 + // Récupération du résultat JSON
82 + $json = json_decode(curl_exec($ch));
83 + curl_close($ch);
84 +
145 85 return $json->response->numFound;
146 86 }
147 -/**
87 +/***********************************************************************************************************************
148 88 * PLUGIN SHORTCODE CV-HAL
149 - * @param $param
150 - * @return string
151 - */
152 -function wphal_cv_hal($param){
153 - $content = '';
154 - if ( !wphal_is_curl_installed() ) {
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';
89 + **********************************************************************************************************************/
90 +function cv_hal($param){
91 + if ( !function_exists('curl_init' ) ) {
92 + echo 'Please check the';?> <a href="https://wordpress.org/plugins/hal/faq/" target="_blank" id="curl">FAQ</a><?php echo ' with the code : CURL';
156 93 } else {
157 - $possible_ids = ["authIdHal_s", "structId_i", "anrProjectId_i", "europeanProjectId_i", "collCode_s"];
158 - $option_choix = !empty(get_option('option_choix')) ? get_option('option_choix') : [];
159 - if(in_array('disciplines', $option_choix)){ //Lance les scripts pour le Graphique
160 - wp_enqueue_style('wp-hal-style2');
94 + if (get_option('option_idhal') != '') {
95 + $idhal = verifSolr(get_option('option_idhal'));
96 + extract(shortcode_atts(array(
97 + 'type' => get_option('option_type'),
98 + 'id' => $idhal,
99 + 'contact' => get_option('option_infocontact')
100 + ),
101 + $param
102 + ));
103 + $id = verifSolr($id);
161 104
162 - wp_enqueue_script('wp-hal-script1');
163 - wp_enqueue_script('wp-hal-script2');
164 - wp_enqueue_script('wp-hal-script3');
165 - }
166 - $facetdomain = null;
167 -
168 - // those parameters are configured from plusing settings
169 - $default_id = wphal_verifSolr(get_option('option_idhal'));
170 - $default_type = get_option('option_type');
171 - $default_contact = get_option('option_infocontact');
172 - // here we merge with shortcode parameters
173 - extract(shortcode_atts(array(
174 - 'type' => $default_type,
175 - 'id' => $default_id,
176 - 'contact' => $default_contact
177 - ),
178 - $param
179 - ));
180 -
181 - /** @var $id : defined by extract
182 - * @var string $type : defined by extract
183 - * @var string $contact : defined by extract
184 - */
185 - if (!empty($id) && in_array($type, $possible_ids)) {
186 - $id = wphal_verifSolr($id);
187 -
188 - $facets = wphal_buildfacet($option_choix);
189 - $facetQuery = !empty($facets) ? 'facet.field='.implode("&facet.field=", $facets).'&facet.mincount=1&facet=true':'';
190 -
191 105 if (get_option('option_groupe') == 'grouper') {
192 106 //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';
107 + $url = api . '?q=*:*&fq=' . $type . ':(' . urlencode($id) . ')&group=true&group.field=docType_s&group.limit=1000&fl=docid,citationFull_s&facet.field=' . 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=' . producedDateY . '&wt=json&json.nl=arrarr';
194 108 } 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';
109 + $url = api . '?q=*:*&fq=' . $type . ':(' . urlencode($id) . ')&fl=docid,citationFull_s&facet.field=' . 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=' . producedDateY . '&wt=json&json.nl=arrarr';
196 110 }
197 111
198 - $json = wphal_do_get_data($url);
199 - $hal_page = (get_query_var('hal_page')) ? get_query_var('hal_page') : 1;
112 + $ch = curl_init($url);
113 + // Options
114 + $options = array(
115 + CURLOPT_RETURNTRANSFER => true,
116 + CURLOPT_HTTPHEADER => array('Content-type: application/json'),
117 + CURLOPT_TIMEOUT => 10,
118 + CURLOPT_USERAGENT => "HAL Plugin Wordpress " . version
119 + );
200 120
201 - $content = '<div id="wphal-content">';
202 - if (is_array($option_choix) && !empty($option_choix)){
203 - $content .= '<ul id="wphal-menu">';
204 - $content .= '<li><a href="#publications" onclick="displayElem(\'publications\'); return false;" style="font-size:18px; text-decoration: none;">' . __('Publications', 'wp-hal') . '</a></li>';
121 + // Bind des options et de l'objet cURL que l'on va utiliser
122 + curl_setopt_array($ch, $options);
123 + // Récupération du résultat JSON
124 + $json = json_decode(curl_exec($ch));
125 + curl_close($ch);
205 126
127 + $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
128 +
129 + $choix = 0;
130 + for ($i = 1; $i < 10; $i++) {
131 + if (get_option('option_choix')[$i] != null) {
132 + $choix = $choix + 1;
133 + }
134 + }
135 +
136 + $content = '<div id="wphal-content">
137 + <ul id="wphal-menu">';
138 + $content .= '<li><a href="#publications" onclick="displayElem(\'publications\'); return false;" style="font-size:18px; text-decoration: none;">' . __('Publications', 'wp-hal') . '</a></li>';
139 + if ($choix != 0) {
206 140 $content .= '<li><a href="#filtres" onclick="return false;" style="font-size:18px; text-decoration: none; cursor:default;">' . __('Filtres', 'wp-hal') . '</a>';
207 141 $content .= '<ul id="wphal-filtres">';
208 - foreach ($option_choix as $option) {
209 - if ($option == 'contact') {
210 - $content .= '<li><a href="#contact" onclick="displayElem(\'wphal-contact\'); return false;" style="margin:1px; text-decoration: none;">' . __('Contact', 'wp-hal');
211 - $content .= '</a></li>';
212 - }
213 - if ($option == 'disciplines') {
214 - $content .= '<li><a href="#disciplines" onclick="displayElem(\'wphal-disciplines\'); return false;" style="margin:1px; text-decoration: none;">' . __('Disciplines', 'wp-hal');
215 - $content .= '</a></li>';
216 - }
217 - if ($option == 'mots-clefs') {
218 - $content .= '<li><a href="#keywords" onclick="displayElem(\'wphal-keywords\'); return false;" style="margin:1px; text-decoration: none;">' . __('Mots-clefs', 'wp-hal');
219 - $content .= '</a></li>';
220 - }
221 - if ($option == 'auteurs') {
222 - $content .= '<li><a href="#auteurs" onclick="displayElem(\'wphal-auteurs\'); return false;" style="margin:1px; text-decoration: none;">' . __('Auteurs', 'wp-hal');
223 - $content .= '</a></li>';
224 - }
225 - if ($option == 'revues') {
226 - $content .= '<li><a href="#revues" onclick="displayElem(\'wphal-revues\'); return false;" style="margin:1px; text-decoration: none;">' . __('Revues', 'wp-hal');
227 - $content .= '</a></li>';
228 - }
229 - if ($option == 'annee') {
230 - $content .= '<li><a href="#annees" onclick="displayElem(\'wphal-annees\'); return false;" style="margin:1px; text-decoration: none;">' . __('Année de production', 'wp-hal');
231 - $content .= '</a></li>';
232 - }
233 - if ($option == 'institution') {
234 - $content .= '<li><a href="#insts" onclick="displayElem(\'wphal-insts\'); return false;" style="margin:1px; text-decoration: none;">' . __('Institutions', 'wp-hal');
235 - $content .= '</a></li>';
236 - }
237 - if ($option == 'laboratoire') {
238 - $content .= '<li><a href="#labs" onclick="displayElem(\'wphal-labs\'); return false;" style="margin:1px; text-decoration: none;">' . __('Laboratoires', 'wp-hal');
239 - $content .= '</a></li>';
240 - }
241 - if ($option == 'departement') {
242 - $content .= '<li><a href="#depts" onclick="displayElem(\'wphal-depts\'); return false;" style="margin:1px; text-decoration: none;">' . __('Départements', 'wp-hal');
243 - $content .= '</a></li>';
244 - }
245 - if ($option == 'equipe') {
246 - $content .= '<li><a href="#equipes" onclick="displayElem(\'wphal-equipes\'); return false;" style="margin:1px; text-decoration: none;">' . __('Équipes de recherche', 'wp-hal');
247 - $content .= '</a></li>';
248 - }
142 + if (get_option('option_choix')[1] == 'contact') {
143 + $content .= '<li><a href="#contact" onclick="displayElem(\'wphal-contact\'); return false;" style="margin:1px; text-decoration: none;">' . __('Contact', 'wp-hal');
144 + $content .= '</a></li>';
249 145 }
146 + if (get_option('option_choix')[2] == 'disciplines') {
147 + $content .= '<li><a href="#disciplines" onclick="displayElem(\'wphal-disciplines\'); return false;" style="margin:1px; text-decoration: none;">' . __('Disciplines', 'wp-hal');
148 + $content .= '</a></li>';
149 + }
150 + if (get_option('option_choix')[3] == 'mots-clefs') {
151 + $content .= '<li><a href="#keywords" onclick="displayElem(\'wphal-keywords\'); return false;" style="margin:1px; text-decoration: none;">' . __('Mots-clefs', 'wp-hal');
152 + $content .= '</a></li>';
153 + }
154 + if (get_option('option_choix')[4] == 'auteurs') {
155 + $content .= '<li><a href="#auteurs" onclick="displayElem(\'wphal-auteurs\'); return false;" style="margin:1px; text-decoration: none;">' . __('Auteurs', 'wp-hal');
156 + $content .= '</a></li>';
157 + }
158 + if (get_option('option_choix')[5] == 'revues') {
159 + $content .= '<li><a href="#revues" onclick="displayElem(\'wphal-revues\'); return false;" style="margin:1px; text-decoration: none;">' . __('Revues', 'wp-hal');
160 + $content .= '</a></li>';
161 + }
162 + if (get_option('option_choix')[6] == 'annee') {
163 + $content .= '<li><a href="#annees" onclick="displayElem(\'wphal-annees\'); return false;" style="margin:1px; text-decoration: none;">' . __('Année de production', 'wp-hal');
164 + $content .= '</a></li>';
165 + }
166 + if (get_option('option_choix')[7] == 'institution') {
167 + $content .= '<li><a href="#insts" onclick="displayElem(\'wphal-insts\'); return false;" style="margin:1px; text-decoration: none;">' . __('Institutions', 'wp-hal');
168 + $content .= '</a></li>';
169 + }
170 + if (get_option('option_choix')[8] == 'laboratoire') {
171 + $content .= '<li><a href="#labs" onclick="displayElem(\'wphal-labs\'); return false;" style="margin:1px; text-decoration: none;">' . __('Laboratoires', 'wp-hal');
172 + $content .= '</a></li>';
173 + }
174 + if (get_option('option_choix')[9] == 'departement') {
175 + $content .= '<li><a href="#depts" onclick="displayElem(\'wphal-depts\'); return false;" style="margin:1px; text-decoration: none;">' . __('Départements', 'wp-hal');
176 + $content .= '</a></li>';
177 + }
178 + if (get_option('option_choix')[10] == 'equipe') {
179 + $content .= '<li><a href="#equipes" onclick="displayElem(\'wphal-equipes\'); return false;" style="margin:1px; text-decoration: none;">' . __('Équipes de recherche', 'wp-hal');
180 + $content .= '</a></li>';
181 + }
250 182 $content .= '</ul></li>';
251 -
252 - $content .= '</ul><br/><hr>';
253 183 }
184 + $content .= '</ul><br/><hr>';
254 185
255 186 $content .= '<div id="meta">
256 187 <div class="display" id="wphal-contact" style="display: none;">
257 188 <h3 class="wphal-titre">' . __('Contact', 'wp-hal');
@@ -259,81 +190,73 @@
259 190
260 191 <ul id="wphal-cont" style="list-style-type: none;">';
261 192
262 193 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);
264 - $jsonauthor = wphal_do_get_data($urlauthor);
194 + $urlauthor = 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);
195 + $ch = curl_init($urlauthor);
196 + // Options
197 + $options = array(
198 + CURLOPT_RETURNTRANSFER => true,
199 + CURLOPT_HTTPHEADER => array('Content-type: application/json'),
200 + CURLOPT_TIMEOUT => 10,
201 + CURLOPT_USERAGENT => "HAL Plugin Wordpress " . version
202 + );
265 203
266 - foreach ($jsonauthor->response->docs as $i=>$doc) {
204 + // Bind des options et de l'objet cURL que l'on va utiliser
205 + curl_setopt_array($ch, $options);
206 + // Récupération du résultat JSON
207 + $jsonauthor = json_decode(curl_exec($ch));
208 + curl_close($ch);
209 +
210 + for ($i = 0; $jsonauthor->response->docs[$i] != ''; $i++) {
267 211 $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>';
212 + if ($jsonauthor->response->docs[$i]->fullName_s != '') {
213 + $content .= '<li class="wphal-fullname"><span>Nom : </span><span>'. $jsonauthor->response->docs[$i]->fullName_s .'</span></li>';
270 214 }
271 - if ($doc->idHal_s != '') {
272 - $content .= '<li class="wphal-idhal"><span>IdHAL : </span><span>' . $doc->idHal_s . '</span></li>';
215 + if ($jsonauthor->response->docs[$i]->email_s != '') {
216 + $content .= '<li class="wphal-email"><span>Email : </span><span><a href="mailto:'. $jsonauthor->response->docs[$i]->email_s .'">' . $jsonauthor->response->docs[$i]->email_s . '</a></span></li>';
273 217 }
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>';
218 + if ($jsonauthor->response->docs[$i]->idHal_s != '') {
219 + $content .= '<li class="wphal-idhal"><span>IdHAL : </span><span>' . $jsonauthor->response->docs[$i]->idHal_s . '</span></li>';
276 220 }
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>';
221 + if ($jsonauthor->response->docs[$i]->hasCV_bool == true){
222 + $content .= '<li class="wphal-cvhal"><span>CV HAL : </span><a href="'.cvhal. $jsonauthor->response->docs[$i]->idHal_s.'" target="_blank">CV de '.$jsonauthor->response->docs[$i]->fullName_s.'</a></li>';
283 223 }
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>';
224 + if ($jsonauthor->response->docs[$i]->arxiv_s != '') {
225 + $content .= '<li class="wphal-"><span>arXiv : </span><span><a href="' . $jsonauthor->response->docs[$i]->arxiv_s . '" target="_blank">' . substr(strrchr($jsonauthor->response->docs[$i]->arxiv_s, "/"), 1) . '</a></span></li>';
290 226 }
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>';
227 + if ($jsonauthor->response->docs[$i]->idref_s != '') {
228 + $content .= '<li class="wphal-"><span>IdRef : </span><span><a href="' . $jsonauthor->response->docs[$i]->idref_s . '" target="_blank">' . substr(strrchr($jsonauthor->response->docs[$i]->idref_s, "/"), 1) . '</a></span></li>';
297 229 }
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>';
230 + if ($jsonauthor->response->docs[$i]->orcid_s != '') {
231 + $content .= '<li class="wphal-"><span>ORCID : </span><span><a href="' . $jsonauthor->response->docs[$i]->orcid_s . '" target="_blank">' . substr(strrchr($jsonauthor->response->docs[$i]->orcid_s, "/"), 1) . '</a></span></li>';
304 232 }
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>';
233 + if ($jsonauthor->response->docs[$i]->viaf_s != '') {
234 + $content .= '<li class="wphal-"><span>VIAF : </span><span><a href="' . $jsonauthor->response->docs[$i]->viaf_s . '" target="_blank">' . substr(strrchr($jsonauthor->response->docs[$i]->viaf_s, "/"), 1) . '</a></span></li>';
311 235 }
236 + if ($jsonauthor->response->docs[$i]->isni_s != '') {
237 + $content .= '<li class="wphal-"><span>ISNI : </span><span><a href="' . $jsonauthor->response->docs[$i]->isni_s . '" target="_blank">' . substr(strrchr($jsonauthor->response->docs[$i]->isni_s, "/"), 1) . '</a></span></li>';
238 + }
312 239 $content .= '</div>';
313 240 }
314 241 }
315 242 if (get_option('option_email') != '') {
316 - $content .= '<li><img alt="mail" src=" ' . esc_url(plugin_dir_url(__FILE__) . 'img/mail.svg').' " style=" width:16px; margin-left:2px; margin-right:2px;"/><a href="'.esc_url('mailto:' . get_option('option_email')) . '" target="_blank">' . get_option('option_email') . '</a></li>';
243 + $content .= '<li><img alt="mail" src=" ' . plugin_dir_url(__FILE__) . 'img/mail.svg" style=" width:16px; margin-left:2px; margin-right:2px;"/><a href="mailto:' . get_option('option_email') . '" target="_blank">' . get_option('option_email') . '</a></li>';
317 244 }
318 245 if (get_option('option_tel') != '') {
319 - $content .= '<li><img alt="phone" src=" ' . esc_url(plugin_dir_url(__FILE__) . 'img/phone.svg'). '" style="width:16px; margin-left:2px; margin-right:2px;"/>' . get_option('option_tel') . '</li>';
246 + $content .= '<li><img alt="phone" src=" ' . plugin_dir_url(__FILE__) . 'img/phone.svg" style="width:16px; margin-left:2px; margin-right:2px;"/>' . get_option('option_tel') . '</li>';
320 247 }
321 248 if (get_option('option_social0') != '') {
322 - $content .= '<li><a href="'.esc_url('http://www.facebook.com/' . get_option('option_social0')) . '" target="_blank"><img
323 - alt="Facebook" src=" ' . esc_url(plugin_dir_url(__FILE__) . 'img/facebook.svg').'" style="width:32px; margin:4px;"/></a></li>';
249 + $content .= '<li><a href="http://www.facebook.com/' . get_option('option_social0') . '" target="_blank"><img src=" ' . plugin_dir_url(__FILE__) . 'img/facebook.svg" style="width:32px; margin:4px;"/></a></li>';
324 250 }
325 251 if (get_option('option_social1') != '') {
326 - $content .= '<li><a href="'.esc_url('http://www.twitter.com/' . get_option('option_social1')) . '" target="_blank"><img
327 - alt="Twitter" src=" ' . esc_url(plugin_dir_url(__FILE__) . 'img/twitter.svg').'" style="width:32px; margin:4px;"/></a></li>';
252 + $content .= '<li><a href="http://www.twitter.com/' . get_option('option_social1') . '" target="_blank"><img src=" ' . plugin_dir_url(__FILE__) . 'img/twitter.svg" style="width:32px; margin:4px;"/></a></li>';
328 253 }
329 254 if (get_option('option_social2') != '') {
330 - $content .= '<li><a href="'.esc_url('https://plus.google.com/u/0/+' . get_option('option_social2')) . '" target="_blank"><img
331 - alt="Google+" src=" ' . esc_url(plugin_dir_url(__FILE__) . 'img/google-plus.svg').'" style="width:32px; margin:4px;"/></a></li>';
255 + $content .= '<li><a href="https://plus.google.com/u/0/+' . get_option('option_social2') . '" target="_blank"><img src=" ' . plugin_dir_url(__FILE__) . 'img/google-plus.svg" style="width:32px; margin:4px;"/></a></li>';
332 256 }
333 257 if (get_option('option_social3') != '') {
334 - $content .= '<li><a href="'.esc_url('https://www.linkedin.com/in/' . get_option('option_social3')) . '" target="_blank"><img
335 - alt="LinkedIn" src=" ' . esc_url(plugin_dir_url(__FILE__) . 'img/linkedin.svg').'" style="width:32px; margin:4px;"/></a></li>';
258 + $content .= '<li><a href="https://www.linkedin.com/in/' . get_option('option_social3') . '" target="_blank"><img src=" ' . plugin_dir_url(__FILE__) . 'img/linkedin.svg" style="width:32px; margin:4px;"/></a></li>';
336 259 }
337 260 $content .= '</ul>
338 261 </div>
339 262 <div class="display" id="wphal-disciplines" style="display: none;">
@@ -338,26 +261,27 @@
338 261 </div>
339 262 <div class="display" id="wphal-disciplines" style="display: none;">
340 263 <h3 class="wphal-titre">' . __('Disciplines', 'wp-hal') . '</h3>';
341 264
342 - 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;
344 - } 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;
265 + if (locale == 'fr_FR') {
266 + $facetdomain = $json->facet_counts->facet_fields->fr_domainAllCodeLabel_fs;
267 + } elseif (locale == 'es_ES') {
268 + $facetdomain = $json->facet_counts->facet_fields->es_domainAllCodeLabel_fs;
346 269 } else {
347 - $facetdomain = isset($json->facet_counts->facet_fields->en_domainAllCodeLabel_fs) ? $json->facet_counts->facet_fields->en_domainAllCodeLabel_fs:null;
270 + $facetdomain = $json->facet_counts->facet_fields->en_domainAllCodeLabel_fs;
348 271 }
349 272
350 273 if (!is_null($facetdomain) && !empty($facetdomain)) {
274 +
351 275 $content .= '<div id="listdisci">';
352 276 $content .= '<span id="tridisciplines">';
353 - $content .= '<button type="button" class="trial" id="tridisci" onclick="toggleSort(this, true, \'wphal-discipline\', \'wphal-discipline\', \'tridisci\'); return false;" style="font-size:16px; text-decoration: none;" >Tri Alphabétique</button>';
354 - $content .= '<button type="button" class="trioc" id="trinbdisci" onclick="toggleSort(this, false, \'wphal-discipline\', \'wphal-discipline\', \'trinbdisci\'); return false;" style="font-size:16px; text-decoration: none;">Tri Occurrence</button>';
277 + $content .= '<button type="button" class="trial" href="" id="tridisci" onclick="toggleSort(this, true, \'wphal-discipline\', \'wphal-discipline\', \'tridisci\'); return false;" style="font-size:16px; text-decoration: none;" >Tri Alphabétique</button>';
278 + $content .= '<button type="button" class="trioc" href="" id="trinbdisci" onclick="toggleSort(this, false, \'wphal-discipline\', \'wphal-discipline\', \'trinbdisci\'); return false;" style="font-size:16px; text-decoration: none;">Tri Occurrence</button>';
355 279 $content .= '</span>';
356 280 $content .= '<ul id="wphal-discipline" class="wphal-discipline">';
357 281 foreach ($facetdomain as $res) {
358 - $name = explode(wphal_delimiter, $res[0]);
359 - $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . esc_url(halv3 . '?q=domainAllCode_s:' . urlencode($name[0]) . "+AND+" . $type . ':(' . $id . ')').'" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';
282 + $name = explode(delimiter, $res[0]);
283 + $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . halv3 . '?q=domainAllCode_s:' . urlencode($name[0]) . "+AND+" . $type . ':(' . $id . ')" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';
360 284 }
361 285 $content .= '</ul>';
362 286 $content .= '</div>';
363 287
@@ -363,15 +287,15 @@
363 287
364 288 $content .= '<div id="wphal-graph" style="display:none;">';
365 289 $content .= '<div id="wphal-piedisci"></div>';
366 290 $content .= '</div>';
367 - $content .= '<button type="button" style="text-decoration: none;" id="wphal-disci" onclick="visibilitedisci(\'listdisci\',\'wphal-graph\',\'tridisciplines\'); return false;" >' . __('Graphique', 'wp-hal');
291 + $content .= '<button type="button" href="" style="text-decoration: none;" id="wphal-disci" onclick="visibilitedisci(\'listdisci\',\'wphal-graph\',\'tridisciplines\'); return false;" >' . __('Graphique', 'wp-hal');
368 292 $content .= '</button>';
369 293 }
370 294 $content .= '</div>
371 295 <div class="display" id="wphal-keywords" style="display: none;">
372 296 <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)) {
297 + if (!is_null($json->facet_counts->facet_fields->keyword_s) && !empty($json->facet_counts->facet_fields->keyword_s)) {
374 298 $content .= '<div id="wphal-keys">';
375 299 $r = 0;
376 300 // CSS Nuage de mots
377 301 $maxsize = 25;
@@ -377,10 +301,8 @@
377 301 $maxsize = 25;
378 302 $minsize = 10;
379 303 $maxval = max(array_values($json->facet_counts->facet_fields->keyword_s[1]));
380 304 $minval = min(array_values($json->facet_counts->facet_fields->keyword_s[1]));
381 - if(!is_numeric($minval)) {$minval = 0;}
382 - if(!is_numeric($maxval)) {$maxval = 0;}
383 305 $spread = ($maxval - $minval);
384 306 $step = ($maxsize - $minsize) / $spread;
385 307 $tab = array();
386 308 foreach ($json->facet_counts->facet_fields->keyword_s as $res) {
@@ -392,34 +314,34 @@
392 314 }
393 315 asort($tab); // Tri du tableau par ordre alphabétique
394 316 foreach ($tab as $res) {
395 317 $size = round($minsize + (($res[1] - $minval) * $step));
396 - $content .= '<a style="display: inline-block; font-size:' . $size . 'px" href="' . esc_url(halv3 . '?q=keyword_s:' . urlencode('"' . $res[0] . '"') . "+AND+" . $type . ':(' . $id . ')').'" target="_blank">' . $res[0] . '</a>&nbsp;';
318 + $content .= '<a style="display: inline-block; font-size:' . $size . 'px" href="' . halv3 . '?q=keyword_s:' . urlencode('"' . $res[0] . '"') . "+AND+" . $type . ':(' . $id . ')" target="_blank">' . $res[0] . '</a>&nbsp;';
397 319 }
398 320 $content .= '</div>';
399 321 $content .= '<div id="keysuite" style="display:none;">';
400 322 $content .= '<span id="trikeywords">';
401 - $content .= '<button type="button" class="trial" id="trikey" onclick="toggleSort(this, true, \'wphal-keyw\', \'wphal-keyword\', \'trikey\'); return false;" style="font-size:16px; text-decoration: none;" >Tri Alphabétique</button>';
402 - $content .= '<button type="button" class="trioc" id="trinbkey" onclick="toggleSort(this, false, \'wphal-keyw\', \'wphal-keyword\', \'trinbkey\'); return false;" style="font-size:16px; text-decoration: none;">Tri Occurrence</button>';
323 + $content .= '<button type="button" class="trial" href="" id="trikey" onclick="toggleSort(this, true, \'wphal-keyw\', \'wphal-keyword\', \'trikey\'); return false;" style="font-size:16px; text-decoration: none;" >Tri Alphabétique</button>';
324 + $content .= '<button type="button" class="trioc" href="" id="trinbkey" onclick="toggleSort(this, false, \'wphal-keyw\', \'wphal-keyword\', \'trinbkey\'); return false;" style="font-size:16px; text-decoration: none;">Tri Occurrence</button>';
403 325 $content .= '</span>';
404 326 $content .= '<ul class="wphal-keyword">';
405 327 $content .= '<div id="wphal-keyw">';
406 328 foreach ($json->facet_counts->facet_fields->keyword_s as $res) {
407 - $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . esc_url(halv3 . '?q=keyword_s:' . urlencode('"' . $res[0] . '"') . "+AND+" . $type . ':(' . $id . ')').'" target="_blank">' . $res[0] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';
329 + $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . halv3 . '?q=keyword_s:' . urlencode('"' . $res[0] . '"') . "+AND+" . $type . ':(' . $id . ')" target="_blank">' . $res[0] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';
408 330 }
409 331 $content .= '</div>';
410 332 $content .= '</ul>';
411 333 $content .= '</div>';
412 - $content .= '<button type="button" style="text-decoration: none;" id="wphal-key" onclick="visibilitekey(\'wphal-keys\',\'keysuite\', \'trikeywords\'); return false;" >' . __('Liste complète', 'wp-hal');
334 + $content .= '<button type="button" href="" style="text-decoration: none;" id="wphal-key" onclick="visibilitekey(\'wphal-keys\',\'keysuite\', \'trikeywords\'); return false;" >' . __('Liste complète', 'wp-hal');
413 335 $content .= '</button>';
414 336 }
415 337 $content .= '</div>
416 338 <div class="display" id="wphal-auteurs" style="display: none;">
417 339 <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)) {
340 + if (!is_null($json->facet_counts->facet_fields->authIdLastNameFirstName_fs) && !empty($json->facet_counts->facet_fields->authIdLastNameFirstName_fs)) {
419 341 $content .= '<span id="triauteurs">';
420 - $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 - $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>';
342 + $content .= '<button type="button" class="trial" href="" id="triaut" onclick="toggleSort(this, true, \'wphal-aut\', \'auteursuite\', \'triaut\'); return false;" style="font-size:16px; text-decoration: none;" >Tri Alphabétique</button>';
343 + $content .= '<button type="button" class="trioc" href="" id="trinbaut" onclick="toggleSort(this, false, \'wphal-aut\', \'auteursuite\', \'trinbaut\'); return false;" style="font-size:16px; text-decoration: none;">Tri Occurrence</button>';
422 344 $content .= '</span>';
423 345 $content .= '<ul class="wphal-auteurs" style="list-style-type: none;">';
424 346 $content .= '<div id="wphal-aut">';
425 347 $r = 0;
@@ -427,15 +349,10 @@
427 349 $r = $r + 1;
428 350 if ($r > 10) {
429 351 break;
430 352 }
431 - $name = explode(wphal_delimiter, $res[0]);
432 - if($name[0] == 0){
433 - $q = 'authLastNameFirstName_s:'.urlencode("\"".$name[1]."\"");
434 - }else{
435 - $q = "authIdPerson_i:$name[0]";
436 - }
437 - $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><img alt="user" src=" ' . esc_url(plugin_dir_url(__FILE__) . '/img/user.svg').'" style="width:16px; margin-left:2px; margin-right:2px;"/><a href="' . esc_url(halv3 . '?q='. $q . "+AND+" . $type . ':(' . $id . ')').'" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';
353 + $name = explode(delimiter, $res[0]);
354 + $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><img alt="user" src=" ' . plugin_dir_url(__FILE__) . '/img/user.svg" style="width:16px; margin-left:2px; margin-right:2px;"/><a href="' . halv3 . '?q=authId_i:' . $name[0] . "+AND+" . $type . ':(' . $id . ')" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';
438 355 }
439 356 $i = 1;
440 357 $content .= '<div id="auteursuite" style="display:none;">';
441 358 foreach ($json->facet_counts->facet_fields->authIdLastNameFirstName_fs as $res) {
@@ -444,15 +361,10 @@
444 361 }
445 362 if ($i < $r) {
446 363 $i = $i + 1;
447 364 } else {
448 - $name = explode(wphal_delimiter, $res[0]);
449 - if($name[0] == 0){
450 - $q = 'authLastNameFirstName_s:'.urlencode("\"".$name[1]."\"");
451 - }else{
452 - $q = "authIdPerson_i:$name[0]";
453 - }
454 - $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><img alt="user" src=" ' . esc_url(plugin_dir_url(__FILE__) . '/img/user.svg').'" style="width:16px; margin-left:2px; margin-right:2px;"/><a href="' . esc_url(halv3 . '?q='. $q . "+AND+" . $type . ':(' . $id . ')').'" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';
365 + $name = explode(delimiter, $res[0]);
366 + $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><img alt="user" src=" ' . plugin_dir_url(__FILE__) . '/img/user.svg" style="width:16px; margin-left:2px; margin-right:2px;"/><a href="' . halv3 . '?q=authId_i:' . $name[0] . "+AND+" . $type . ':(' . $id . ')" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';
455 367 }
456 368 }
457 369 $content .= '</div>';
458 370 $content .= '</div>';
@@ -457,9 +369,9 @@
457 369 $content .= '</div>';
458 370 $content .= '</div>';
459 371 $content .= '</ul>';
460 372 if ($r > 10) {
461 - $content .= '<button type="button" style="text-decoration: none;" id="wphal-auteur" onclick="visibilite(\'auteursuite\'); return false;" >' . __('Liste complète', 'wp-hal');
373 + $content .= '<button type="button" href="" style="text-decoration: none;" id="wphal-auteur" onclick="visibilite(\'auteursuite\'); return false;" >' . __('Liste complète', 'wp-hal');
462 374 $content .= '</button>';
463 375 }
464 376 }
465 377 $content .= '</div>
@@ -464,12 +376,12 @@
464 376 }
465 377 $content .= '</div>
466 378 <div class="display" id="wphal-revues" style="display: none;">
467 379 <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)) {
380 + if (!is_null($json->facet_counts->facet_fields->journalIdTitle_fs) && !empty($json->facet_counts->facet_fields->journalIdTitle_fs)) {
469 381 $content .= '<span id="trirevues">';
470 - $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 - $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>';
382 + $content .= '<button type="button" class="trial" href="" id="trirev" onclick="toggleSort(this, true, \'wphal-rev\', \'revuesuite\', \'trirev\'); return false;" style="font-size:16px; text-decoration: none;" >Tri Alphabétique</button>';
383 + $content .= '<button type="button" class="trioc" href="" id="trinbrev" onclick="toggleSort(this, false, \'wphal-rev\', \'revuesuite\', \'trinbrev\'); return false;" style="font-size:16px; text-decoration: none;">Tri Occurrence</button>';
472 384 $content .= '</span>';
473 385 $content .= '<ul class="wphal-revues">';
474 386 $content .= '<div id="wphal-rev">';
475 387 $r = 0;
@@ -477,10 +389,10 @@
477 389 $r = $r + 1;
478 390 if ($r > 10) {
479 391 break;
480 392 }
481 - $name = explode(wphal_delimiter, $res[0]);
482 - $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . esc_url(halv3 . '?q=journalId_i:' . urlencode($name[0]) . "+AND+" . $type . ':(' . $id . ')').'" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';
393 + $name = explode(delimiter, $res[0]);
394 + $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . halv3 . '?q=journalId_i:' . urlencode($name[0]) . "+AND+" . $type . ':(' . $id . ')" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';
483 395 }
484 396 $i = 1;
485 397 $content .= '<div id="revuesuite" style="display:none;">';
486 398 foreach ($json->facet_counts->facet_fields->journalIdTitle_fs as $res) {
@@ -489,10 +401,10 @@
489 401 }
490 402 if ($i < $r) {
491 403 $i = $i + 1;
492 404 } else {
493 - $name = explode(wphal_delimiter, $res[0]);
494 - $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . esc_url(halv3 . '?q=journalId_i:' . urlencode($name[0]) . "+AND+" . $type . ':(' . $id . ')').'" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';
405 + $name = explode(delimiter, $res[0]);
406 + $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . halv3 . '?q=journalId_i:' . urlencode($name[0]) . "+AND+" . $type . ':(' . $id . ')" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';
495 407 }
496 408 }
497 409 $content .= '</div>';
498 410 $content .= '</div>';
@@ -497,9 +409,9 @@
497 409 $content .= '</div>';
498 410 $content .= '</div>';
499 411 $content .= '</ul>';
500 412 if ($r > 10) {
501 - $content .= '<button type="button" style="text-decoration: none;" id="wphal-revue" onclick="visibiliterevues(\'revuesuite\'); return false;" >' . __('Liste complète', 'wp-hal');
413 + $content .= '<button type="button" href="" style="text-decoration: none;" id="wphal-revue" onclick="visibiliterevues(\'revuesuite\'); return false;" >' . __('Liste complète', 'wp-hal');
502 414 $content .= '</button>';
503 415 }
504 416 }
505 417 $content .= '</div>
@@ -504,12 +416,12 @@
504 416 }
505 417 $content .= '</div>
506 418 <div class="display" id="wphal-annees" style="display: none;">
507 419 <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)) {
420 + if (!is_null($json->facet_counts->facet_fields->producedDateY_i) && !empty($json->facet_counts->facet_fields->producedDateY_i)) {
509 421 $content .= '<span id="triannees">';
510 - $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 - $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>';
422 + $content .= '<button type="button" class="trial" href="" id="trian" onclick="toggleSort(this, true, \'wphal-an\', \'anneesuite\', \'trian\'); return false;" style="font-size:16px; text-decoration: none;" >Tri Alphabétique</button>';
423 + $content .= '<button type="button" class="trioc" href="" id="trinban" onclick="toggleSort(this, false, \'wphal-an\', \'anneesuite\', \'trinban\'); return false;" style="font-size:16px; text-decoration: none;">Tri Occurrence</button>';
512 424 $content .= '</span>';
513 425 $content .= '<ul class="wphal-annees">';
514 426 $content .= '<div id="wphal-an">';
515 427
@@ -519,9 +431,9 @@
519 431 $r = $r + 1;
520 432 if ($r > 10) {
521 433 break;
522 434 }
523 - $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . esc_url(halv3 . '?q=producedDateY_i:' . urlencode($res[0]) . "+AND+" . $type . ':(' . $id . ')').'" target="_blank">' . $res[0] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';
435 + $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . halv3 . '?q=producedDateY_i:' . urlencode($res[0]) . "+AND+" . $type . ':(' . $id . ')" target="_blank">' . $res[0] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';
524 436 }
525 437 $i = 1;
526 438 $content .= '<div id="anneesuite" style="display:none;">';
527 439 foreach ($json->facet_counts->facet_fields->producedDateY_i as $res) {
@@ -530,9 +442,9 @@
530 442 }
531 443 if ($i < $r) {
532 444 $i = $i + 1;
533 445 } else {
534 - $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . esc_url(halv3 . '?q=producedDateY_i:' . urlencode($res[0]) . "+AND+" . $type . ':(' . $id . ')').'" target="_blank">' . $res[0] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';
446 + $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . halv3 . '?q=producedDateY_i:' . urlencode($res[0]) . "+AND+" . $type . ':(' . $id . ')" target="_blank">' . $res[0] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';
535 447 }
536 448 }
537 449 $content .= '</div>';
538 450 $content .= '</div>';
@@ -537,9 +449,9 @@
537 449 $content .= '</div>';
538 450 $content .= '</div>';
539 451 $content .= '</ul>';
540 452 if ($r > 10) {
541 - $content .= '<button type="button" style="text-decoration: none;" id="wphal-annee" onclick="visibiliteannee(\'anneesuite\'); return false;" >' . __('Liste complète', 'wp-hal');
453 + $content .= '<button type="button" href="" style="text-decoration: none;" id="wphal-annee" onclick="visibiliteannee(\'anneesuite\'); return false;" >' . __('Liste complète', 'wp-hal');
542 454 $content .= '</button>';
543 455 }
544 456 }
545 457 $content .= '</div>
@@ -544,12 +456,12 @@
544 456 }
545 457 $content .= '</div>
546 458 <div class="display" id="wphal-insts" style="display: none;">
547 459 <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)) {
460 + if (!is_null($json->facet_counts->facet_fields->instStructIdName_fs) && !empty($json->facet_counts->facet_fields->instStructIdName_fs)) {
549 461 $content .= '<span id="triinsts">';
550 - $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 - $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>';
462 + $content .= '<button type="button" class="trial" href="" id="triinst" onclick="toggleSort(this, true, \'wphal-institu\', \'instsuite\', \'triinst\'); return false;" style="font-size:16px; text-decoration: none;" >Tri Alphabétique</button>';
463 + $content .= '<button type="button" class="trioc" href="" id="trinbinst" onclick="toggleSort(this, false, \'wphal-institu\', \'instsuite\', \'trinbinst\'); return false;" style="font-size:16px; text-decoration: none;">Tri Occurrence</button>';
552 464 $content .= '</span>';
553 465 $content .= '<ul class="wphal-insts">';
554 466 $content .= '<div id="wphal-institu">';
555 467 $r = 0;
@@ -557,10 +469,10 @@
557 469 $r = $r + 1;
558 470 if ($r > 10) {
559 471 break;
560 472 }
561 - $name = explode(wphal_delimiter, $res[0]);
562 - $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . esc_url(halv3 . '?q=instStructId_i:' . urlencode($name[0]) . "+AND+" . $type . ':(' . $id . ')').'" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';
473 + $name = explode(delimiter, $res[0]);
474 + $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . halv3 . '?q=instStructId_i:' . urlencode($name[0]) . "+AND+" . $type . ':(' . $id . ')" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';
563 475 }
564 476 $i = 1;
565 477 $content .= '<div id="instsuite" style="display:none;">';
566 478 foreach ($json->facet_counts->facet_fields->instStructIdName_fs as $res) {
@@ -569,10 +481,10 @@
569 481 }
570 482 if ($i < $r) {
571 483 $i = $i + 1;
572 484 } else {
573 - $name = explode(wphal_delimiter, $res[0]);
574 - $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . esc_url(halv3 . '?q=instStructId_i:' . urlencode($name[0]) . "+AND+" . $type . ':(' . $id . ')').'" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';
485 + $name = explode(delimiter, $res[0]);
486 + $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . halv3 . '?q=instStructId_i:' . urlencode($name[0]) . "+AND+" . $type . ':(' . $id . ')" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';
575 487 }
576 488 }
577 489 $content .= '</div>';
578 490 $content .= '</div>';
@@ -577,9 +489,9 @@
577 489 $content .= '</div>';
578 490 $content .= '</div>';
579 491 $content .= '</ul>';
580 492 if ($r > 10) {
581 - $content .= '<button type="button" style="text-decoration: none;" id="wphal-inst" onclick="visibiliteinst(\'instsuite\'); return false;" >' . __('Liste complète', 'wp-hal');
493 + $content .= '<button type="button" href="" style="text-decoration: none;" id="wphal-inst" onclick="visibiliteinst(\'instsuite\'); return false;" >' . __('Liste complète', 'wp-hal');
582 494 $content .= '</button>';
583 495 }
584 496 }
585 497 $content .= '</div>
@@ -584,12 +496,12 @@
584 496 }
585 497 $content .= '</div>
586 498 <div class="display" id="wphal-labs" style="display: none;">
587 499 <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)) {
500 + if (!is_null($json->facet_counts->facet_fields->labStructIdName_fs) && !empty($json->facet_counts->facet_fields->labStructIdName_fs)) {
589 501 $content .= '<span id="trilabs">';
590 - $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 - $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>';
502 + $content .= '<button type="button" class="trial" href="" id="trilab" onclick="toggleSort(this, true, \'wphal-labo\', \'labsuite\', \'trilab\'); return false;" style="font-size:16px; text-decoration: none;" >Tri Alphabétique</button>';
503 + $content .= '<button type="button" class="trioc" href="" id="trinblab" onclick="toggleSort(this, false, \'wphal-labo\', \'labsuite\', \'trinblab\'); return false;" style="font-size:16px; text-decoration: none;">Tri Occurrence</button>';
592 504 $content .= '</span>';
593 505 $content .= '<ul class="wphal-labs">';
594 506 $content .= '<div id="wphal-labo">';
595 507
@@ -598,10 +510,10 @@
598 510 $r = $r + 1;
599 511 if ($r > 10) {
600 512 break;
601 513 }
602 - $name = explode(wphal_delimiter, $res[0]);
603 - $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . esc_url(halv3 . '?q=labStructId_i:' . urlencode($name[0]) . "+AND+" . $type . ':(' . $id . ')').'" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';
514 + $name = explode(delimiter, $res[0]);
515 + $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . halv3 . '?q=labStructId_i:' . urlencode($name[0]) . "+AND+" . $type . ':(' . $id . ')" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';
604 516 }
605 517 $i = 1;
606 518 $content .= '<div id="labsuite" style="display:none;">';
607 519 foreach ($json->facet_counts->facet_fields->labStructIdName_fs as $res) {
@@ -610,10 +522,10 @@
610 522 }
611 523 if ($i < $r) {
612 524 $i = $i + 1;
613 525 } else {
614 - $name = explode(wphal_delimiter, $res[0]);
615 - $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . esc_url(halv3 . '?q=labStructId_i:' . urlencode($name[0]) . "+AND+" . $type . ':(' . $id . ')').'" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';
526 + $name = explode(delimiter, $res[0]);
527 + $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . halv3 . '?q=labStructId_i:' . urlencode($name[0]) . "+AND+" . $type . ':(' . $id . ')" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';
616 528 }
617 529 }
618 530 $content .= '</div>';
619 531 $content .= '</div>';
@@ -618,9 +530,9 @@
618 530 $content .= '</div>';
619 531 $content .= '</div>';
620 532 $content .= '</ul>';
621 533 if ($r > 10) {
622 - $content .= '<button type="button" style="text-decoration: none;" id="wphal-lab" onclick="visibilitelab(\'labsuite\'); return false;" >' . __('Liste complète', 'wp-hal');
534 + $content .= '<button type="button" href="" style="text-decoration: none;" id="wphal-lab" onclick="visibilitelab(\'labsuite\'); return false;" >' . __('Liste complète', 'wp-hal');
623 535 $content .= '</button>';
624 536 }
625 537 }
626 538 $content .= '</div>
@@ -625,12 +537,12 @@
625 537 }
626 538 $content .= '</div>
627 539 <div class="display" id="wphal-depts" style="display: none;">
628 540 <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)) {
541 + if (!is_null($json->facet_counts->facet_fields->deptStructIdName_fs) && !empty($json->facet_counts->facet_fields->deptStructIdName_fs)) {
630 542 $content .= '<span id="tridept">';
631 - $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 - $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>';
543 + $content .= '<button type="button" class="trial" href="" id="tridept" onclick="toggleSort(this, true, \'wphal-dpt\', \'deptsuite\', \'tridept\'); return false;" style="font-size:16px; text-decoration: none;" >Tri Alphabétique</button>';
544 + $content .= '<button type="button" class="trioc" href="" id="trinbdept" onclick="toggleSort(this, false, \'wphal-dpt\', \'deptsuite\', \'trinbdept\'); return false;" style="font-size:16px; text-decoration: none;">Tri Occurrence</button>';
633 545 $content .= '</span>';
634 546 $content .= '<ul class="wphal-depts">';
635 547 $content .= '<div id="wphal-dpt">';
636 548 $r = 0;
@@ -638,10 +550,10 @@
638 550 $r = $r + 1;
639 551 if ($r > 10) {
640 552 break;
641 553 }
642 - $name = explode(wphal_delimiter, $res[0]);
643 - $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . esc_url(halv3 . '?q=deptStructId_i:' . urlencode($name[0]) . "+AND+" . $type . ':(' . $id . ')').'" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';
554 + $name = explode(delimiter, $res[0]);
555 + $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . halv3 . '?q=deptStructId_i:' . urlencode($name[0]) . "+AND+" . $type . ':(' . $id . ')" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';
644 556 }
645 557 $i = 1;
646 558 $content .= '<div id="deptsuite" style="display:none;">';
647 559 foreach ($json->facet_counts->facet_fields->deptStructIdName_fs as $res) {
@@ -650,10 +562,10 @@
650 562 }
651 563 if ($i < $r) {
652 564 $i = $i + 1;
653 565 } else {
654 - $name = explode(wphal_delimiter, $res[0]);
655 - $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . esc_url(halv3 . '?q=deptStructId_i:' . urlencode($name[0]) . "+AND+" . $type . ':(' . $id . ')').'" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';
566 + $name = explode(delimiter, $res[0]);
567 + $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . halv3 . '?q=deptStructId_i:' . urlencode($name[0]) . "+AND+" . $type . ':(' . $id . ')" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';
656 568 }
657 569 }
658 570 $content .= '</div>';
659 571 $content .= '</div>';
@@ -658,9 +570,9 @@
658 570 $content .= '</div>';
659 571 $content .= '</div>';
660 572 $content .= '</ul>';
661 573 if ($r > 10) {
662 - $content .= '<button type="button" style="text-decoration: none;" id="wphal-dept" onclick="visibilitedept(\'deptsuite\'); return false;" >' . __('Liste complète', 'wp-hal');
574 + $content .= '<button type="button" href="" style="text-decoration: none;" id="wphal-dept" onclick="visibilitedept(\'deptsuite\'); return false;" >' . __('Liste complète', 'wp-hal');
663 575 $content .= '</button>';
664 576 }
665 577 }
666 578 $content .= '</div>
@@ -665,25 +577,24 @@
665 577 }
666 578 $content .= '</div>
667 579 <div class="display" id="wphal-equipes" style="display: none;">
668 580 <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)) {
581 + if (!is_null($json->facet_counts->facet_fields->rteamStructIdName_fs) && !empty($json->facet_counts->facet_fields->rteamStructIdName_fs)) {
670 582 $content .= '<span id="triequipe">';
671 - $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 - $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>';
583 + $content .= '<button type="button" class="trial" href="" id="triequipe" onclick="toggleSort(this, true, \'wphal-rteam\', \'equipesuite\', \'triequipe\'); return false;" style="font-size:16px;text-decoration: none;" >Tri Alphabétique</button>';
584 + $content .= '<button type="button" class="trioc" href="" id="trinbequipe" onclick="toggleSort(this, false, \'wphal-rteam\', \'equipesuite\', \'trinbequipe\'); return false;" style="font-size:16px; text-decoration: none;">Tri Occurrence</button>';
673 585 $content .= '</span>';
674 586 $content .= '<ul class="wphal-equipes">';
675 587 $content .= '<div id="wphal-rteam">';
676 588
677 589 $r = 0;
678 - $name=[];
679 590 foreach ($json->facet_counts->facet_fields->rteamStructIdName_fs as $res) {
680 591 $r = $r + 1;
681 592 if ($r > 10) {
682 593 break;
683 594 }
684 - $name = explode(wphal_delimiter, $res[0]);
685 - $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . esc_url(halv3 . '?q=rteamStructId_i:' . urlencode($name[0]) . "+AND+" . $type . ':(' . $id . ')').'" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';
595 + $name = explode(delimiter, $res[0]);
596 + $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . halv3 . '?q=rteamStructId_i:' . urlencode($name[0]) . "+AND+" . $type . ':(' . $id . ')" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';
686 597 }
687 598 $i = 1;
688 599 $content .= '<div id="equipesuite" style="display:none;">';
689 600 foreach ($json->facet_counts->facet_fields->rteamStructIdName_fs as $res) {
@@ -692,10 +603,9 @@
692 603 }
693 604 if ($i < $r) {
694 605 $i = $i + 1;
695 606 } else {
696 - $name = explode(wphal_delimiter, $res[0]);
697 - $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . esc_url(halv3 . '?q=rteamStructId_i:' . urlencode($name[0]) . "+AND+" . $type . ':(' . $id . ')').'" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';
607 + $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . halv3 . '?q=rteamStructId_i:' . urlencode($name[0]) . "+AND+" . $type . ':(' . $id . ')" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';
698 608 }
699 609 }
700 610 $content .= '</div>';
701 611 $content .= '</div>';
@@ -700,9 +610,9 @@
700 610 $content .= '</div>';
701 611 $content .= '</div>';
702 612 $content .= '</ul>';
703 613 if ($r > 10) {
704 - $content .= '<button type="button" style="text-decoration: none;" id="wphal-equipe" onclick="visibiliteequipe(\'equipesuite\'); return false;" >' . __('Liste complète', 'wp-hal');
614 + $content .= '<button type="button" href="" style="text-decoration: none;" id="wphal-equipe" onclick="visibiliteequipe(\'equipesuite\'); return false;" >' . __('Liste complète', 'wp-hal');
705 615 $content .= '</button>';
706 616 }
707 617 }
708 618 $content .= '</div>
@@ -707,9 +617,9 @@
707 617 }
708 618 $content .= '</div>
709 619 <div class="display" id="publications">';
710 620 if (get_option('option_groupe') == 'grouper') {
711 - $doctype = file_get_contents(plugin_dir_path( __FILE__ ).'json'. DIRECTORY_SEPARATOR .'doctype_fr.json');
621 + $doctype = file_get_contents(plugin_dir_path( __FILE__ ).'json'. DIRECTORY_SEPARATOR .'doctype_'.lang.'.json');
712 622 $jsontype = json_decode($doctype);
713 623
714 624 //LISTE DES DOCUMENTS PAR GROUPE
715 625
@@ -714,13 +624,14 @@
714 624 //LISTE DES DOCUMENTS PAR GROUPE
715 625
716 626 $content .= '<div class="counter-doc"><span class="wphal-nbtot">' . $json->grouped->docType_s->matches . ' </span>';
717 627 $content .= __('documents', 'wp-hal'). '</div><br>';
718 - for ($i = 0; !empty($jsontype->response->result->doc[$i]); $i++) {
719 - for ($d = 0; !empty($json->grouped->docType_s->groups[$d]); $d++) {
628 + $content .= '<ul style="list-style-type: none;">';
629 + for ($i = 0; $jsontype->response->result->doc[$i] != null; $i++) {
630 + for ($d = 0; $json->grouped->docType_s->groups[$d] != null; $d++) {
720 631 if ($json->grouped->docType_s->groups[$d]->groupValue == $jsontype->response->result->doc[$i]->str[0]){
721 632 $titre = $jsontype->response->result->doc[$i]->str[1];
722 - $content .= '<div class="grp-div"><h3 class="wphal-titre-groupe">' . __($titre, 'wp-hal') . '<span class="wphal-nbmetadata" style="margin-left:10px;">' . $json->grouped->docType_s->groups[$d]->doclist->numFound . ' ' . _n('document', 'documents', $json->grouped->docType_s->groups[$d]->doclist->numFound, 'wp-hal') . '</span></h3>';
633 + $content .= '<li><div class="grp-div-'. $jsontype->response->result->doc[$i]->str[0] .'"><h3 class="wphal-titre-groupe">' . $titre . '<span class="wphal-nbmetadata" style="margin-left:10px;">' . $json->grouped->docType_s->groups[$d]->doclist->numFound . ' ' . _n('document', 'documents', $json->grouped->docType_s->groups[$d]->doclist->numFound, 'wp-hal') . '</span></h3>';
723 634 $content .= '<div class="grp-content">';
724 635 $content .= '<ul>';
725 636 foreach ($json->grouped->docType_s->groups[$d]->doclist->docs as $result) {
726 637 $content .= '<li>' . $result->citationFull_s . '</li>';
@@ -725,13 +636,14 @@
725 636 foreach ($json->grouped->docType_s->groups[$d]->doclist->docs as $result) {
726 637 $content .= '<li>' . $result->citationFull_s . '</li>';
727 638 }
728 639 $content .= '</ul></div>';
729 - $content .= '</div><br>';
640 + $content .= '</div></li><br>';
730 641 break;
731 642 }
732 643 }
733 644 }
645 + $content .= '</ul>';
734 646 } elseif (get_option('option_groupe') == 'paginer') {
735 647
736 648 //LISTE DES DOCUMENTS AVEC PAGINATION
737 649 $content .= '<div class="counter-doc"><span class="wphal-nbtot">' . $json->response->numFound . ' </span>';
@@ -743,10 +655,10 @@
743 655 $total = $json->response->numFound;
744 656
745 657 $nombreDePages = ceil($total / $messagesParPage);
746 658
747 - if (isset($hal_page)) {
748 - $pageActuelle = intval($hal_page);
659 + if (isset($paged)) {
660 + $pageActuelle = intval($paged);
749 661
750 662 if ($pageActuelle > $nombreDePages) {
751 663 $pageActuelle = $nombreDePages;
752 664 }
@@ -754,238 +666,124 @@
754 666 $pageActuelle = 1;
755 667 }
756 668 $premiereEntree = ($pageActuelle - 1) * $messagesParPage;
757 669
758 - $url = wphal_api . '?q=*:*&fq=' . $type . ':(' . urlencode($id) . ')&fl=docid,citationFull_s,keyword_s,bookTitle_s,producedDate_s,authFullName_s&start=' . $premiereEntree . '&rows=' . $messagesParPage . '&sort=' . wphal_producedDateY . '&wt=json';
759 - $json = wphal_do_get_data($url);
670 + $url = api . '?q=*:*&fq=' . $type . ':(' . urlencode($id) . ')&fl=docid,citationFull_s,keyword_s,bookTitle_s,producedDate_s,authFullName_s&start=' . $premiereEntree . '&rows=' . $messagesParPage . '&sort=' . producedDateY . '&wt=json';
671 + $ch = curl_init($url);
672 +// Options
673 + $options = array(
674 + CURLOPT_RETURNTRANSFER => true,
675 + CURLOPT_HTTPHEADER => array('Content-type: application/json'),
676 + CURLOPT_TIMEOUT => 10,
677 + CURLOPT_USERAGENT => "HAL Plugin Wordpress " . version
678 + );
760 679
680 +// Bind des options et de l'objet cURL que l'on va utiliser
681 + curl_setopt_array($ch, $options);
682 +// Récupération du résultat JSON
683 + $json = json_decode(curl_exec($ch));
684 + curl_close($ch);
685 +
761 686 //--MODULE PAGINATION--//
762 - $count_results = count($json->response->docs);
763 - if($count_results>0) {
764 - $content .= '<ul>';
765 - for ( $i = 0; $i <= $count_results - 1; $i ++ ) {
766 - $content .= '<li>' . $json->response->docs[ $i ]->citationFull_s . '</li>';
767 - }
768 - $content .= '</ul>';
687 +
688 + $content .= '<ul>';
689 + for ($i = 0; $json->response->docs[$i] != ''; $i++) {
690 + $content .= '<li>' . $json->response->docs[$i]->citationFull_s . '</li>';
691 + }
692 + $content .= '</ul>';
693 +
694 +//--AFFICHAGE PAGINATION--//
695 + $precedents = $pageActuelle - 2;
696 + $suivants = $pageActuelle + 2;
697 + $precedent = $pageActuelle - 1;
698 + $suivant = $pageActuelle + 1;
699 + $penultimate = $nombreDePages - 1;
700 +
701 + $content .= '<ul class="wphal-pagination">';
702 +//--BOUTON PRECEDENT--//
703 + if ($pageActuelle == 1) {
704 + $content .= '<li class="disabled"><a href="#">&laquo;</a></li>';
769 705 } else {
770 - $content = '<div> no results !</div>';
706 + $content .= '<li><a href="?paged=' . $precedent . '">&laquo;</a></li>';
771 707 }
772 - if($total> $messagesParPage) {
773 - $base_url = ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on' ? 'https' : 'http' ) . '://' . $_SERVER['HTTP_HOST'];
774 - $url = $base_url . $_SERVER["REQUEST_URI"];
775 - $explodedURL= explode('?', $url);
776 - $queryString = isset($explodedURL[1])?$explodedURL[1]:"";
777 - $pagedHref = $explodedURL[0];
778 - if(!empty($queryString)){
779 - $parsedQueryString = [];
780 - parse_str($queryString, $parsedQueryString);
781 - if(isset($parsedQueryString["hal_page"])){
782 - unset($parsedQueryString["hal_page"]);
708 + if ($nombreDePages <= 6) {// Cas 1 : 6 pages ou moins - Pas de troncature
709 + for ($i = 1; $i <= $nombreDePages; $i++) {
710 + if ($i == $pageActuelle) {
711 + $content .= '<li class="active"><a href="#">' . $i . '</a></li>';
712 + } else {
713 + $content .= ' <li><a href="?paged=' . $i . '">' . $i . '</a></li> ';
783 714 }
784 - $pagedHref .= '?';
785 - foreach($parsedQueryString as $name => $value){
786 - $pagedHref .= $name.'='.$value.'&';
715 + }
716 + } elseif ($nombreDePages >= 7) {// Cas 2 : 7 pages ou plus - Troncature
717 + if ($pageActuelle <= 3) {// Lorsque l'on est sur les trois premières pages
718 + for ($i = 1; $i <= 4; $i++) {
719 + if ($i == $pageActuelle) {
720 + $content .= '<li class="active"><a href="#">' . $i . '</a></li>';
721 + } else {
722 + $content .= '<li><a href="?paged=' . $i . '">' . $i . '</a></li>';
723 + }
787 724 }
788 - // we add it back..
789 - $pagedHref .= 'hal_page=';
790 - }else {
791 - $pagedHref .= '?hal_page=';
725 + $content .= '<li class="disabled"><a href="#">&hellip;</a></li>';
726 + $content .= '<li><a href="?paged=' . $penultimate . '">' . $penultimate . '</a></li>';
727 + $content .= '<li><a href="?paged=' . $nombreDePages . '">' . $nombreDePages . '</a></li>';
792 728 }
793 -
794 - //--AFFICHAGE PAGINATION--//
795 - $precedents = $pageActuelle - 2;
796 - $suivants = $pageActuelle + 2;
797 - $precedent = $pageActuelle - 1;
798 - $suivant = $pageActuelle + 1;
799 - $penultimate = $nombreDePages - 1;
800 -
801 - $content .= '<ul class="wphal-pagination">';
802 - //--BOUTON PRECEDENT--//
803 - if ( $pageActuelle != 1 ) {
804 - $content .= '<li><a href="'. $pagedHref . $precedent . '">&laquo;</a></li>';
729 + if ($pageActuelle >= 4 && $pageActuelle <= $penultimate - 2) {//Lorsque l'on arrive sur la quatrième page
730 + $content .= '<li><a href="?paged=">1</a></li>';
731 + $content .= '<li class="disabled"><a href="#">&hellip;</a></li>';
732 + $content .= '<li><a href="?paged=' . $precedents . '">' . $precedents . '</a></li>';
733 + $content .= '<li><a href="?paged=' . $precedent . '">' . $precedent . '</a></li>';
734 + $content .= '<li class="active"><a href="#">' . $pageActuelle . '</a></li>';
735 + $content .= '<li><a href="?paged=' . $suivant . '">' . $suivant . '</a></li>';
736 + $content .= '<li><a href="?paged=' . $suivants . '">' . $suivants . '</a></li>';
737 + $content .= '<li class="disabled"><a href="#">&hellip;</a></li>';
738 + $content .= '<li><a href="?paged=' . $nombreDePages . '">' . $nombreDePages . '</a></li>';
805 739 }
806 - if ( $nombreDePages <= 6 ) {// Cas 1 : 6 pages ou moins - Pas de troncature
807 - for ( $i = 1; $i <= $nombreDePages; $i ++ ) {
808 - if ( $i == $pageActuelle ) {
740 + if ($pageActuelle >= $penultimate - 1) {
741 + $content .= '<li><a href="?paged=1">1</a></li>';
742 + $content .= '<li><a href="?paged=2">2</a></li>';
743 + $content .= '<li class="disabled"><a href="#">&hellip;</a></li>';
744 + for ($i = $penultimate - 2; $i <= $nombreDePages; $i++) {
745 + if ($i == $pageActuelle) {
809 746 $content .= '<li class="active"><a href="#">' . $i . '</a></li>';
810 747 } else {
811 - $content .= ' <li><a href="'. $pagedHref . $i . '">' . $i . '</a></li> ';
748 + $content .= '<li><a href="?paged=' . $i . '">' . $i . '</a></li>';
812 749 }
813 750 }
814 - } elseif ( $nombreDePages >= 7 ) {// Cas 2 : 7 pages ou plus - Troncature
815 - if ( $pageActuelle <= 3 ) {// Lorsque l'on est sur les trois premières pages
816 - for ( $i = 1; $i <= 4; $i ++ ) {
817 - if ( $i == $pageActuelle ) {
818 - $content .= '<li class="active"><a href="#">' . $i . '</a></li>';
819 - } else {
820 - $content .= '<li><a href="'. $pagedHref . $i . '">' . $i . '</a></li>';
821 - }
822 - }
823 - $content .= '<li class="disabled"><a href="#">&hellip;</a></li>';
824 - $content .= '<li><a href="'. $pagedHref . $penultimate . '">' . $penultimate . '</a></li>';
825 - $content .= '<li><a href="'. $pagedHref . $nombreDePages . '">' . $nombreDePages . '</a></li>';
826 - }
827 - if ( $pageActuelle >= 4 && $pageActuelle <= $penultimate - 2 ) {//Lorsque l'on arrive sur la quatrième page
828 - $content .= '<li><a href="'.$pagedHref.'1">1</a></li>';
829 - $content .= '<li class="disabled"><a href="#">&hellip;</a></li>';
830 - $content .= '<li><a href="'. $pagedHref . $precedents . '">' . $precedents . '</a></li>';
831 - $content .= '<li><a href="'. $pagedHref . $precedent . '">' . $precedent . '</a></li>';
832 - $content .= '<li class="active"><a href="#">' . $pageActuelle . '</a></li>';
833 - $content .= '<li><a href="'. $pagedHref . $suivant . '">' . $suivant . '</a></li>';
834 - $content .= '<li><a href="'. $pagedHref . $suivants . '">' . $suivants . '</a></li>';
835 - $content .= '<li class="disabled"><a href="#">&hellip;</a></li>';
836 - $content .= '<li><a href="'. $pagedHref . $nombreDePages . '">' . $nombreDePages . '</a></li>';
837 - }
838 - if ( $pageActuelle >= $penultimate - 1 ) {
839 - $content .= '<li><a href="'.$pagedHref.'1">1</a></li>';
840 - $content .= '<li><a href="'.$pagedHref.'2">2</a></li>';
841 - $content .= '<li class="disabled"><a href="#">&hellip;</a></li>';
842 - for ( $i = $penultimate - 2; $i <= $nombreDePages; $i ++ ) {
843 - if ( $i == $pageActuelle ) {
844 - $content .= '<li class="active"><a href="#">' . $i . '</a></li>';
845 - } else {
846 - $content .= '<li><a href="'. $pagedHref . $i . '">' . $i . '</a></li>';
847 - }
848 - }
849 - }
850 751 }
851 - //--BOUTON SUIVANT--//
852 - if ( $pageActuelle < $nombreDePages ) {
853 - $content .= '<li><a href="'. $pagedHref . $suivant . '">&raquo;</a></li>';
854 - }
855 - $content .= '</ul>';
856 - //--AFFICHAGE PAGINATION--//
857 752 }
753 +//--BOUTON SUIVANT--//
754 + if ($pageActuelle < $nombreDePages) {
755 + $content .= '<li><a href="?paged=' . $suivant . '">&raquo;</a></li>';
756 + } else {
757 + $content .= '<li class="disabled"><a href="#">&raquo;</a></li>';
758 + }
759 + $content .= '</ul>';
760 +//--AFFICHAGE PAGINATION--//
858 761 }
859 762 $content .= '</div>
860 763 </div>
861 764 </div>';
862 - }else{
863 - $content = 'Plugin is not configured correctly or shortcode parameters are not valid, please check the <a href="https://doc.archives-ouvertes.fr/afficher-une-liste-de-publications-dans-wordpress/" target="_blank" id="wrong_params">documentation</a>';
864 765 }
865 766 $content .= '<div class="wphal-footer">';
866 - $content .= '<p style="color:#B3B2B0">' . __("Documents récupérés de l'archive ouverte HAL", 'wp-hal') . '&nbsp;<a href="' . wphal_site . '" target="_blank"><img alt="logo" src=" ' . esc_url(plugin_dir_url(__FILE__) . 'img/logo-hal.png').'" style="width:90px;"></a></p>';
767 + $content .= '<p style="color:#B3B2B0">' . __("Documents récupérés de l'archive ouverte HAL", 'wp-hal') . '&nbsp;<a href="' . site . '" target="_blank"><img alt="logo" src=" ' . plugin_dir_url(__FILE__) . 'img/logo-hal.svg" style="width:32px;"></a></p>';
867 768 $content .= '</div>';
868 769
869 770 //--AFFICHAGE GRAPHIQUE DOMAINE--//
870 771 if (!is_null($facetdomain)) {
871 772 foreach ($facetdomain as $res) {
872 - $name = explode(wphal_delimiter, $res[0])[1];
773 + $name = explode(delimiter, $res[0])[1];
873 774 $value = $res[1];
874 775 $array[] = array($name, $value);
875 776 }
876 - wp_localize_script('wp-hal-script4', 'WPWallSettings', $array);
877 777 }
778 + wp_localize_script('wp-hal-script4', 'WPWallSettings', json_encode($array));
878 779 $translation = array('liste' => __('Liste', 'wp-hal'), 'compl' => __('Liste complète', 'wp-hal'), 'princ' => __('Liste principale', 'wp-hal'), 'graph' => __('Graphique', 'wp-hal'), 'nuage' => __('Nuage de mots', 'wp-hal'));
879 780 wp_localize_script('wp-hal-script4', 'translate', $translation);
880 781 }
881 - // tags other that those will be stripped
882 - $allowed_html_tags = array(
883 - 'div' => array(
884 - 'class' => array(),
885 - 'id' => array(),
886 - 'style' => array(),
887 - ),
888 - "span"=> array(
889 - 'class' => array(),
890 - 'id' => array(),
891 - 'style' => array(),
892 - ),
893 - "img"=> array(
894 - 'alt' => array(),
895 - 'src' => array(),
896 - 'style' => array(),
897 -
898 - ),
899 - 'p' => array(
900 - 'style' => array(),
901 - 'id' => array(),
902 - ),
903 - 'h3' => array(
904 - 'id' => array(),
905 - 'class' => array(),
906 - 'style' => array()
907 - ),
908 - 'a' => array(
909 - 'href' => array(),
910 - 'target' => array(),
911 - 'title' => array(),
912 - 'id' => array(),
913 - 'class' => array(),
914 - 'style' => array(),
915 - 'onclick' => array(),
916 - ),
917 - 'ul' => array(
918 - 'class' => array(),
919 - 'id' => array(),
920 - 'style' => array(),
921 - ),
922 - 'li' => array(
923 - 'class' => array(),
924 - 'id' => array(),
925 - 'data-percentage' => array()
926 - ),
927 - 'button' => array(
928 - 'class' => array(),
929 - 'id' => array(),
930 - 'type' => array(),
931 - 'style' => array(),
932 - 'onclick' => array()
933 - )
934 - ,'br' => array()
935 - ,'hr' => array()
936 - ,'i' => array(),
937 - );
938 - add_filter( 'safe_style_css', function( $styles ) {
939 - $styles[] = 'display';
940 - return $styles;
941 - } );
942 - return wp_kses($content, $allowed_html_tags);
782 + return $content;
943 783 }
944 784
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 -function wphal_verifSolr($values){
785 +function verifSolr($values){
988 786 $verifsolr = explode(',',$values);
989 787 $numverif = count($verifsolr);
990 788 $solrsql = '';
991 789 if ($numverif<1024){
@@ -1004,16 +802,17 @@
1004 802
1005 803 return $solrsql;
1006 804 }
1007 805
1008 -function wphal_adding_style() {
806 +function wp_adding_style() {
1009 807 wp_register_style('wp-hal-style1', plugins_url('/css/style.css', __FILE__));
1010 808 wp_register_style('wp-hal-style2', plugins_url('/css/jquery.jqplot.css', __FILE__));
1011 809
1012 810 wp_enqueue_style('wp-hal-style1');
811 + wp_enqueue_style('wp-hal-style2');
1013 812 }
1014 813
1015 -function wphal_adding_script() {
814 +function wp_adding_script() {
1016 815 wp_register_script('wp-hal-script1',plugins_url('/js/jquery.jqplot.js', __FILE__));
1017 816 wp_register_script('wp-hal-script2',plugins_url('/js/jqplot.highlighter.js', __FILE__));
1018 817 wp_register_script('wp-hal-script3',plugins_url('/js/jqplot.pieRenderer.js', __FILE__));
1019 818 wp_register_script('wp-hal-script4',plugins_url('/js/cv-hal.js', __FILE__));
@@ -1019,8 +818,11 @@
1019 818 wp_register_script('wp-hal-script4',plugins_url('/js/cv-hal.js', __FILE__));
1020 819
1021 820
1022 821 wp_enqueue_script("jquery");
822 + wp_enqueue_script('wp-hal-script1');
823 + wp_enqueue_script('wp-hal-script2');
824 + wp_enqueue_script('wp-hal-script3');
1023 825 wp_enqueue_script('wp-hal-script4', false, array(), false, true);
1024 826 }
1025 827
1026 828 /**
@@ -1025,17 +827,17 @@
1025 827
1026 828 /**
1027 829 * Récupère les fichiers css et js
1028 830 */
1029 -if ( wphal_is_curl_installed() ) {
1030 - add_action('wp_enqueue_scripts', 'wphal_adding_style');
1031 - add_action('wp_enqueue_scripts', 'wphal_adding_script');
831 +if ( function_exists('curl_init' ) ) {
832 + add_action('wp_enqueue_scripts', 'wp_adding_style');
833 + add_action('wp_enqueue_scripts', 'wp_adding_script');
1032 834 }
1033 835
1034 836 /**
1035 837 * Charge lorsque le plugin est désactivé
1036 838 */
1037 -register_deactivation_hook( __FILE__, 'wphal_reset_option' );
839 +register_deactivation_hook( __FILE__, 'reset_option' );
1038 840
1039 841 /**
1040 842 * Ajoute le widget wphal à l'initialisation des widgets
1041 843 */
@@ -1051,9 +853,9 @@
1051 853 */
1052 854 function wphal_menu() {
1053 855 add_menu_page( 'Options', 'Hal', 'manage_options', 'wp-hal.php', 'wphal_option' , '', 21);
1054 856
1055 - add_action( 'admin_init', 'wphal_register_settings' );
857 + add_action( 'admin_init', 'register_settings' );
1056 858 }
1057 859
1058 860
1059 861 /**
@@ -1071,12 +873,14 @@
1071 873 * Classe du widget wphal
1072 874 */
1073 875
1074 876 class wphal_widget extends WP_widget{
877 +
878 +
1075 879 /**
1076 880 * Défini les propriétés du widget
1077 881 */
1078 - function __construct(){
882 + function wphal_widget(){
1079 883 $options = array(
1080 884 "classname" => "wphal-publications",
1081 885 "description" => __("Afficher les dernières publications d'un auteur ou d'une structure.", 'wp-hal')
1082 886 );
@@ -1082,9 +886,9 @@
1082 886 );
1083 887
1084 888 parent::__construct(
1085 889 'hal-publications',
1086 - __("Publications HAL", 'wp-hal'),
890 + __("Publications récentes", 'wp-hal'),
1087 891 $options
1088 892 );
1089 893 }
1090 894
@@ -1093,72 +897,51 @@
1093 897 * @param $args
1094 898 * @param $instance
1095 899 */
1096 900 function widget($args, $instance){
1097 - if(isset($instance['idhal']) && !empty($instance['idhal'])) {
1098 - $content = '';
901 + if ( !function_exists('curl_init' ) ) {
902 + $content = 'Please check the <a href="https://wordpress.org/plugins/hal/faq/" target="_blank" id="FAQ">FAQ</a> with the code : CURL';
1099 903 extract($args);
1100 - /**
1101 - * @var $before_widget : defined by extract
1102 - * @var $before_title : defined by extract
1103 - * @var $after_title : defined by extract
1104 - * @var $after_widget : defined by extract
1105 - */
1106 - if (!wphal_is_curl_installed()) {
1107 - $content = 'Please check the <a href="https://wordpress.org/plugins/hal/faq/" target="_blank" id="FAQ">FAQ</a> with the code : CURL';
904 + echo $before_widget;
905 + echo $before_title . $instance['titre'] . $after_title;
906 + echo $content;
907 + echo $after_widget;
908 + } else {
909 + $instance['idhal'] = verifSolr($instance['idhal']);
1108 910
1109 - } else {
1110 - $instance['idhal'] = wphal_verifSolr($instance['idhal']);
1111 - $fieldName = $instance['typetext'] == 'title_s' ? 'title_s':'citationFull_s';
911 + $url = api . '?q=*:*&fq=' . $instance['select'] . ':' . urlencode($instance['idhal']) . '&fl=uri_s,'. $instance['typetext'] .'&sort=' . producedDateY . '&rows=' . $instance['nbdoc'] . '&wt=json';
1112 912
1113 - $url = wphal_api . '?q=*:*&fq=' . $instance['select'] . ':' . urlencode($instance['idhal']) . '&fl=uri_s,' . $fieldName . '&sort=' . wphal_producedDateY . '&rows=' . $instance['nbdoc'] . '&wt=json';
1114 - $json = wphal_do_get_data($url);
913 + $ch = curl_init($url);
914 + // Options
915 + $options = array(
916 + CURLOPT_RETURNTRANSFER => true,
917 + CURLOPT_HTTPHEADER => array('Content-type: application/json'),
918 + CURLOPT_TIMEOUT => 10,
919 + CURLOPT_USERAGENT => "HAL Plugin Wordpress " . version
920 + );
1115 921
1116 - $count_results = count($json->response->docs);
1117 - if ($count_results > 0) {
1118 - $content = '<ul class="widhal-ul">';
1119 - for ($i = 0; $i < $count_results - 1; $i++) {
1120 - if ($fieldName == 'title_s') {
1121 - $typetext = $json->response->docs[$i]->title_s[0];
1122 - } else {
1123 - $typetext = $json->response->docs[$i]->citationFull_s;
1124 - }
1125 - $content .= '<li class="widhal-li"><a href="' . esc_url($json->response->docs[$i]->uri_s) . '" target="_blank">' . $typetext . '</a></li>';
1126 - }
1127 - $content .= '</ul>';
922 + // Bind des options et de l'objet cURL que l'on va utiliser
923 + curl_setopt_array($ch, $options);
924 + // Récupération du résultat JSON
925 + $json = json_decode(curl_exec($ch));
926 + curl_close($ch);
927 +
928 + $content = '<ul class="widhal-ul">';
929 + for ($i = 0; $i < $instance['nbdoc']; $i++) {
930 + if ($instance['typetext']=='citationRef_s') {
931 + $typetext = $json->response->docs[$i]->citationRef_s;
1128 932 } else {
1129 - $content = '<div> no results !</div>';
933 + $typetext = $json->response->docs[$i]->title_s[0];
1130 934 }
935 + $content .= '<li class="widhal-li"><a href="' . $json->response->docs[$i]->uri_s . '" target="_blank">' . $typetext . '</a></li>';
1131 936 }
1132 - // tags other that those will be stripped
1133 - $allowed_html_tags = array(
1134 - 'div' => array(
1135 - 'class' => array(),
1136 - 'id' => array(),
1137 - ),
1138 - 'h2' => array(),
1139 - 'section' => array(),
1140 - 'a' => array(
1141 - 'href' => array(),
1142 - 'target' => array(),
1143 - 'title' => array(),
1144 - 'id' => array(),
1145 - 'class' => array(),
1146 - ),
1147 - 'ul' => array(
1148 - 'class' => array(),
1149 - 'id' => array(),
1150 - ),
1151 - 'li' => array(
1152 - 'class' => array(),
1153 - 'id' => array(),
1154 - )
1155 - );
1156 - $widget_block = $before_widget;
1157 - $widget_block .= $before_title . $instance['titre'] . $after_title;
1158 - $widget_block .= $content;
1159 - $widget_block .= $after_widget;
1160 - echo wp_kses($widget_block, $allowed_html_tags);
937 + $content .= '</ul>';
938 +
939 + extract($args);
940 + echo $before_widget;
941 + echo $before_title . $instance['titre'] . $after_title;
942 + echo $content;
943 + echo $after_widget;
1161 944 }
1162 945 }
1163 946
1164 947 /**
@@ -1166,15 +949,9 @@
1166 949 * @param $new
1167 950 * @param $old
1168 951 */
1169 952 function update($new, $old){
1170 - //the id must be provided
1171 - if(isset($new['idhal']) && !empty($new['idhal'])) {
1172 - $new['idhal'] = wphal_sanitize_username($new['idhal']);
1173 - $new['nbdoc'] = wphal_sanitize_id($new['nbdoc']);
1174 - return $new;
1175 - }else
1176 - return false;
953 + return $new;
1177 954 }
1178 955
1179 956 /**
1180 957 * Formulaire du widget
@@ -1182,44 +959,43 @@
1182 959 */
1183 960 function form($instance){
1184 961
1185 962 $defaut = array(
1186 - 'titre' => __("Publications Hal", 'wp-hal'),
963 + 'titre' => __("Publications récentes", 'wp-hal'),
1187 964 'select' => "authIdHal_s",
1188 965 'typetext' => "title_s",
1189 - 'idhal' => "",
1190 966 'nbdoc' => 5
1191 967 );
1192 968 $instance = wp_parse_args($instance,$defaut);
1193 969 ?>
1194 970 <p>
1195 - <label for="<?php echo esc_attr($this->get_field_id("titre"));?>"><?php echo esc_html(__('Titre','wp-hal')) .' :'?></label>
1196 - <input value="<?php echo esc_js($instance['titre']);?>" name="<?php echo esc_attr($this->get_field_name("titre"));?>" id="<?php echo esc_attr($this->get_field_id("titre"));?>" class="widefat" type="text"/>
971 + <label for="<?php echo $this->get_field_id("titre");?>"><?php echo __('Titre','wp-hal') .' :'?></label>
972 + <input value="<?php echo $instance['titre'];?>" name="<?php echo $this->get_field_name("titre");?>" id="<?php echo $this->get_field_id("titre");?>" class="widefat" type="text"/>
1197 973 </p>
1198 974 <p>
1199 - <label for="<?php echo esc_attr($this->get_field_id("nbdoc"));?>"><?php echo esc_html(__("Nombre de documents affichés",'wp-hal')) .' :'?></label>
1200 - <input class="tiny-text" id="<?php echo esc_attr($this->get_field_id("nbdoc"));?>" name="<?php echo esc_attr($this->get_field_name("nbdoc"));?>" type="number" step="1" min="1" max="10" value="<?php echo esc_js($instance['nbdoc']);?>" size="3">
975 + <label for="<?php echo $this->get_field_id("nbdoc");?>"><?php echo __("Nombre de documents affichés",'wp-hal') .' :'?></label>
976 + <input class="tiny-text" id="<?php echo $this->get_field_id("nbdoc");?>" name="<?php echo $this->get_field_name("nbdoc");?>" type="number" step="1" min="1" max="10" value="<?php echo $instance['nbdoc'];?>" size="3">
1201 977 </p>
1202 978 <p>
1203 - <label for="<?php echo esc_attr($this->get_field_id("typetext"));?>"><?php echo esc_html(__("Type d'affichage",'wp-hal')) .' :'?></label>
1204 - <select id="<?php echo esc_attr($this->get_field_id("typetext"));?>" name="<?php echo esc_attr($this->get_field_name("typetext"));?>">
1205 - <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>
979 + <label for="<?php echo $this->get_field_id("typetext");?>"><?php echo __("Type d'affichage",'wp-hal') .' :'?></label>
980 + <select id="<?php echo $this->get_field_id("typetext");?>" name="<?php echo $this->get_field_name("typetext");?>">
981 + <option id="<?php echo $this->get_field_id("Title");?>" value="title_s" <?php echo ($instance["typetext"] == "title_s")?'selected':''; ?>><label for="<?php echo $this->get_field_id("Title");?>"><?php echo __("Titre", 'wp-hal')?></label></option>
982 + <option id="<?php echo $this->get_field_id("Citation");?>" value="citationRef_s" <?php echo ($instance["typetext"] == "citationRef_s")?'selected':''; ?>><label for="<?php echo $this->get_field_id("Citation");?>"><?php echo __("Citation", 'wp-hal')?></label></option>
1207 983 </select>
1208 984 </p>
1209 985 <p>
1210 - <label for="<?php echo esc_attr($this->get_field_id("select"));?>"><?php echo esc_html(__("Type d'Id",'wp-hal') .' :')?></label>
1211 - <select id="<?php echo esc_attr($this->get_field_id("select"));?>" name="<?php echo esc_attr($this->get_field_name("select"));?>">
1212 - <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 - <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>
1214 - <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 - <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 - <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>
986 + <label for="<?php echo $this->get_field_id("select");?>"><?php echo __("Type d'Id",'wp-hal') .' :'?></label>
987 + <select id="<?php echo $this->get_field_id("select");?>" name="<?php echo $this->get_field_name("select");?>">
988 + <option id="<?php echo $this->get_field_id("Idhal");?>" value="authIdHal_s" <?php echo ($instance["select"] == "authIdHal_s")?'selected':''; ?>><label for="<?php echo $this->get_field_id("Idhal");?>">Id Hal</label><span style="font-style: italic;"> <?php echo __('(Exemple : laurent-capelli)','wp-hal');?></span></option>
989 + <option id="<?php echo $this->get_field_id("Structid");?>" value="authStructId_i" <?php echo ($instance["select"] == "authStructId_i")?'selected':''; ?>><label for="<?php echo $this->get_field_id("Structid");?>">Struct Id</label><span style="font-style: italic;"> <?php echo __('(Exemple : 129)','wp-hal');?></span></option>
990 + <option id="<?php echo $this->get_field_id("Anrproject");?>" value="anrProjectId_i" <?php echo ($instance["select"] == "anrProjectId_i")?'selected':''; ?>><label for="<?php echo $this->get_field_id("Anrproject");?>">anrProject Id</label><span style="font-style: italic;"> <?php echo __('(Exemple : 1646)','wp-hal');?></span></option>
991 + <option id="<?php echo $this->get_field_id("Europeanproject");?>" value="europeanProjectId_i" <?php echo ($instance["select"] == "europeanProjectId_i")?'selected':''; ?>><label for="<?php echo $this->get_field_id("Europeanproject");?>">europeanProject Id</label><span style="font-style: italic;"> <?php echo __('(Exemple : 17877)','wp-hal');?></span></option>
992 + <option id="<?php echo $this->get_field_id("Collection");?>" value="collCode_s" <?php echo ($instance["select"] == "collCode_s")?'selected':''; ?>><label for="<?php echo $this->get_field_id("Collection");?>">Collection</label><span style="font-style: italic;"> <?php echo __('(Exemple : TICE2014)','wp-hal');?></span></option>
1217 993 </select>
1218 994 </p>
1219 995 <p>
1220 - <label for="<?php echo esc_attr($this->get_field_id("idhal"));?>"><?php echo esc_html(__("Id",'wp-hal')) .' :'?></label>
1221 - <input value="<?php echo esc_js($instance['idhal']);?>" name="<?php echo esc_attr($this->get_field_name("idhal"));?>" id="<?php echo esc_attr($this->get_field_id("idhal"));?>" type="text"/>
996 + <label for="<?php echo $this->get_field_id("idhal");?>"><?php echo __("Id",'wp-hal') .' :'?></label>
997 + <input value="<?php echo $instance['idhal'];?>" name="<?php echo $this->get_field_name("idhal");?>" id="<?php echo $this->get_field_id("idhal");?>" type="text"/>
1222 998 </p>
1223 999 <?php
1224 1000 }
1225 1001 }
@@ -1224,79 +1000,21 @@
1224 1000 }
1225 1001 }
1226 1002
1227 1003
1228 -function wphal_sanitize_id( $input ){
1229 - if(is_numeric($input)){
1230 - return $input;
1231 - }
1232 -}
1233 -
1234 -function wphal_sanitize_username($input)
1235 -{
1236 - $allowed = array(".", "-", "_"); // you can add here more value, you want to allow.
1237 - if(ctype_alnum(str_replace($allowed, '', $input ))) {
1238 - return $input;
1239 - }
1240 -}
1241 -
1242 -function wphal_sanitize_phone( $input ){
1243 - $phone_num = $input;
1244 - $phone_num = preg_replace('/[^0-9]/', '', $phone_num);
1245 - if(strlen($phone_num) === 10) {
1246 - //Phone is 10 characters in length
1247 - return $input;
1248 - }
1249 -}
1250 -
1251 -
1252 -function wphal_register_settings() {
1004 +function register_settings() {
1253 1005 register_setting( 'wphal_option', 'option_choix' );
1254 1006 register_setting( 'wphal_option', 'option_type' );
1255 1007 register_setting( 'wphal_option', 'option_groupe' );
1256 - register_setting( 'wphal_option', 'option_idhal' , array(
1257 - 'type' => 'string',
1258 - 'sanitize_callback' => 'wphal_sanitize_username',
1259 - 'default' => NULL,
1260 - ));
1008 + register_setting( 'wphal_option', 'option_idhal' );
1261 1009 register_setting( 'wphal_option', 'option_lang' );
1262 1010 register_setting( 'wphal_option', 'option_infocontact' );
1263 - register_setting( 'wphal_option', 'option_email' , array(
1264 - 'type' => 'string',
1265 - 'sanitize_callback' => 'sanitize_email',
1266 - 'default' => NULL,
1267 - ));
1268 - register_setting( 'wphal_option', 'option_tel' , array(
1269 - 'type' => 'string',
1270 - 'sanitize_callback' => 'wphal_sanitize_phone',
1271 - 'default' => NULL,
1272 - ));
1273 - register_setting( 'wphal_option', 'option_social0' , array(
1274 - 'type' => 'string',
1275 - 'sanitize_callback' => 'wphal_sanitize_username',
1276 - 'default' => NULL,
1277 - ));
1278 - register_setting( 'wphal_option', 'option_social1' , array(
1279 - 'type' => 'string',
1280 - 'sanitize_callback' => 'wphal_sanitize_username',
1281 - 'default' => NULL,
1282 - ));
1283 - register_setting( 'wphal_option', 'option_social2' , array(
1284 - 'type' => 'string',
1285 - 'sanitize_callback' => 'wphal_sanitize_username',
1286 - 'default' => NULL,
1287 - ));
1288 - register_setting( 'wphal_option', 'option_social3' , array(
1289 - 'type' => 'string',
1290 - 'sanitize_callback' => 'wphal_sanitize_username',
1291 - 'default' => NULL,
1292 - ));
1293 - register_setting( 'wphal_option', 'option_cache_timeout' , array(
1294 - 'type' => 'string',
1295 - 'sanitize_callback' => 'wphal_sanitize_id',
1296 - 'default' => NULL,
1297 - ));
1298 - register_setting( 'wphal_option', 'option_erase_cache' );
1011 + register_setting( 'wphal_option', 'option_email' );
1012 + register_setting( 'wphal_option', 'option_tel' );
1013 + register_setting( 'wphal_option', 'option_social0' );
1014 + register_setting( 'wphal_option', 'option_social1' );
1015 + register_setting( 'wphal_option', 'option_social2' );
1016 + register_setting( 'wphal_option', 'option_social3' );
1299 1017 }
1300 1018
1301 1019 /**
1302 1020 * Crée le menu d'option du plugin
@@ -1310,9 +1028,9 @@
1310 1028 update_option('option_groupe', 'paginer');
1311 1029 }
1312 1030 ?>
1313 1031 <div class="wrap">
1314 - <h2><?php echo esc_html(__('Plugin HAL','wp-hal'));?></h2>
1032 + <h2><?php echo __('Plugin HAL','wp-hal');?></h2>
1315 1033 <form method="post" enctype="multipart/form-data" action="options.php">
1316 1034 <div id="poststuff">
1317 1035 <div id="post-body" class="metabox-holder columns-2">
1318 1036 <div id="post-body-content">
@@ -1318,85 +1036,75 @@
1318 1036 <div id="post-body-content">
1319 1037 <?php settings_fields( 'wphal_option' ); ?>
1320 1038 <?php do_settings_sections( 'wphal_option' ); ?>
1321 1039 <table class="form-table">
1322 - <tr style="vertical-align:top;">
1323 - <th scope="row" style="font-size: 18px;"><?php echo esc_html(__('Paramètre de la page :','wp-hal'));?></th>
1040 + <tr valign="top">
1041 + <th scope="row" style="font-size: 18px;"><?php echo __('Paramètre de la page :','wp-hal');?></th>
1324 1042 </tr>
1325 - <tr style="vertical-align:top;">
1326 - <th scope="row"><label for="option_type"><?php echo esc_html(__('Type d\'Id','wp-hal'));?></label></th>
1043 + <tr valign="top">
1044 + <th scope="row"><?php echo __('Type d\'Id','wp-hal');?></th>
1327 1045 <td><select name="option_type">
1328 - <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 - <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>
1330 - <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 - <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 - <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>
1046 + <option id="Idhal" value="authIdHal_s" <?php echo (get_option('option_type') == "authIdHal_s")?'selected':''; ?>><label for="Idhal">Id Hal</label><span style="font-style: italic;"> <?php echo __('(Exemple : laurent-capelli)','wp-hal');?></span></option>
1047 + <option id="Structid" value="authStructId_i" <?php echo (get_option('option_type') == "authStructId_i")?'selected':''; ?>><label for="Structid">Struct Id</label><span style="font-style: italic;"> <?php echo __('(Exemple : 129)','wp-hal');?></span></option>
1048 + <option id="Anrproject" value="anrProjectId_i" <?php echo (get_option('option_type') == "anrProjectId_i")?'selected':''; ?>><label for="Anrproject">anrProject Id</label><span style="font-style: italic;"> <?php echo __('(Exemple : 1646)','wp-hal');?></span></option>
1049 + <option id="Europeanproject" value="europeanProjectId_i" <?php echo (get_option('option_type') == "europeanProjectId_i")?'selected':''; ?>><label for="Europeanproject">europeanProject Id</label><span style="font-style: italic;"> <?php echo __('(Exemple : 17877)','wp-hal');?></span></option>
1050 + <option id="Collection" value="collCode_s" <?php echo (get_option('option_type') == "collCode_s")?'selected':''; ?>><label for="Collection">Collection</label><span style="font-style: italic;"> <?php echo __('(Exemple : TICE2014)','wp-hal');?></span></option>
1333 1051 </select>
1334 - <input type="text" name="option_idhal" id="option_idhal" value="<?php echo esc_js(get_option('option_idhal')); ?>"/>
1052 + <input type="text" name="option_idhal" id="option_idhal" value="<?php echo get_option('option_idhal'); ?>"/>
1335 1053 </td>
1336 1054 </tr>
1337 - <tr style="vertical-align:top;">
1338 - <th scope="row"><?php echo esc_html(__('Affichage des documents','wp-hal'));?></th>
1339 - <td><input type="radio" name="option_groupe" id="paginer" value="paginer" <?php echo esc_attr((get_option('option_groupe') == "paginer")?'checked':''); ?>><label for="paginer"><?php echo esc_html(__('Documents avec pagination','wp-hal'));?></label><br>
1340 - <input type="radio" name="option_groupe" id="grouper" value="grouper" <?php echo esc_js((get_option('option_groupe') == "grouper")?'checked':''); ?>><label for="grouper"><?php echo esc_html(__('Documents groupés par type','wp-hal'));?></label><br>
1055 + <tr valign="top">
1056 + <th scope="row"><?php echo __('Affichage des documents','wp-hal');?></th>
1057 + <td><input type="radio" name="option_groupe" id="paginer" value="paginer" <?php echo (get_option('option_groupe') == "paginer")?'checked':''; ?>><label for="paginer"><?php echo __('Documents avec pagination','wp-hal');?></label><br>
1058 + <input type="radio" name="option_groupe" id="grouper" value="grouper" <?php echo (get_option('option_groupe') == "grouper")?'checked':''; ?>><label for="grouper"><?php echo __('Documents groupés par type','wp-hal');?></label><br>
1341 1059 </td>
1342 1060 </tr>
1343 - <tr style="vertical-align:top;">
1344 - <th scope="row"><?php echo esc_html(__('Choix des éléments menu','wp-hal'));?></th>
1345 - <?php $option_choix = get_option('option_choix'); ?>
1346 - <td><input type="checkbox" name="option_choix[1]" id="Contact" value="contact" <?php echo esc_attr((isset($option_choix[1]) && $option_choix[1] == "contact")?'checked':''); ?>><label for="Contact"><?php echo esc_html(__('Contact','wp-hal'));?></label><br/>
1347 - <input type="checkbox" name="option_choix[2]" id="Disciplines" value="disciplines" <?php echo esc_attr((isset($option_choix[2]) && $option_choix[2] == "disciplines")?'checked':''); ?>><label for="Disciplines"><?php echo esc_html(__('Disciplines','wp-hal'));?></label><br/>
1348 - <input type="checkbox" name="option_choix[3]" id="Mots-clefs" value="mots-clefs" <?php echo esc_attr((isset($option_choix[3]) && $option_choix[3] == "mots-clefs")?'checked':''); ?>><label for="Mots-clefs"><?php echo esc_html(__('Mots-clefs','wp-hal'));?></label><br/>
1349 - <input type="checkbox" name="option_choix[4]" id="Auteurs" value="auteurs" <?php echo esc_attr((isset($option_choix[4]) && $option_choix[4] == "auteurs")?'checked':''); ?>><label for="Auteurs"><?php echo esc_html(__('Auteurs','wp-hal'));?></label><br/>
1350 - <input type="checkbox" name="option_choix[5]" id="Revues" value="revues" <?php echo esc_attr((isset($option_choix[5]) && $option_choix[5] == "revues")?'checked':''); ?>><label for="Revues"><?php echo esc_html(__('Revues','wp-hal'));?></label><br/>
1351 - <input type="checkbox" name="option_choix[6]" id="Annee" value="annee" <?php echo esc_attr((isset($option_choix[6]) && $option_choix[6] == "annee")?'checked':''); ?>><label for="Annee"><?php echo esc_html(__('Année de production','wp-hal'));?></label><br/>
1352 - <input type="checkbox" name="option_choix[7]" id="Institution" value="institution" <?php echo esc_attr((isset($option_choix[7]) && $option_choix[7] == "institution")?'checked':''); ?>><label for="Institution"><?php echo esc_html(__('Institutions','wp-hal'));?></label><br/>
1353 - <input type="checkbox" name="option_choix[8]" id="Laboratoire" value="laboratoire" <?php echo esc_attr((isset($option_choix[8]) && $option_choix[8] == "laboratoire")?'checked':''); ?>><label for="Laboratoire"><?php echo esc_html(__('Laboratoires','wp-hal'));?></label><br/>
1354 - <input type="checkbox" name="option_choix[9]" id="Departement" value="departement" <?php echo esc_attr((isset($option_choix[9]) && $option_choix[9] == "departement")?'checked':''); ?>><label for="Departement"><?php echo esc_html(__('Départements','wp-hal'));?></label><br/>
1355 - <input type="checkbox" name="option_choix[10]" id="Equipe" value="equipe" <?php echo esc_attr((isset($option_choix[10]) && $option_choix[10] == "equipe")?'checked':''); ?>><label for="Equipe"><?php echo esc_html(__('Équipes de recherche','wp-hal'));?></label>
1061 + <tr valign="top">
1062 + <th scope="row"><?php echo __('Choix des éléments menu','wp-hal');?></th>
1063 + <td><input type="checkbox" name="option_choix[1]" id="Contact" value="contact" <?php echo (get_option('option_choix')[1] == "contact")?'checked':''; ?>><label for="Contact"><?php echo __('Contact','wp-hal');?></label><br/>
1064 + <input type="checkbox" name="option_choix[2]" id="Disciplines" value="disciplines" <?php echo (get_option('option_choix')[2] == "disciplines")?'checked':''; ?>><label for="Disciplines"><?php echo __('Disciplines','wp-hal');?></label><br/>
1065 + <input type="checkbox" name="option_choix[3]" id="Mots-clefs" value="mots-clefs" <?php echo (get_option('option_choix')[3] == "mots-clefs")?'checked':''; ?>><label for="Mots-clefs"><?php echo __('Mots-clefs','wp-hal');?></label><br/>
1066 + <input type="checkbox" name="option_choix[4]" id="Auteurs" value="auteurs" <?php echo (get_option('option_choix')[4] == "auteurs")?'checked':''; ?>><label for="Auteurs"><?php echo __('Auteurs','wp-hal');?></label><br/>
1067 + <input type="checkbox" name="option_choix[5]" id="Revues" value="revues" <?php echo (get_option('option_choix')[5] == "revues")?'checked':''; ?>><label for="Revues"><?php echo __('Revues','wp-hal');?></label><br/>
1068 + <input type="checkbox" name="option_choix[6]" id="Annee" value="annee" <?php echo (get_option('option_choix')[6] == "annee")?'checked':''; ?>><label for="Annee"><?php echo __('Année de production','wp-hal');?></label><br/>
1069 + <input type="checkbox" name="option_choix[7]" id="Institution" value="institution" <?php echo (get_option('option_choix')[7] == "institution")?'checked':''; ?>><label for="Institution"><?php echo __('Institutions','wp-hal');?></label><br/>
1070 + <input type="checkbox" name="option_choix[8]" id="Laboratoire" value="laboratoire" <?php echo (get_option('option_choix')[8] == "laboratoire")?'checked':''; ?>><label for="Laboratoire"><?php echo __('Laboratoires','wp-hal');?></label><br/>
1071 + <input type="checkbox" name="option_choix[9]" id="Departement" value="departement" <?php echo (get_option('option_choix')[9] == "departement")?'checked':''; ?>><label for="Departement"><?php echo __('Départements','wp-hal');?></label><br/>
1072 + <input type="checkbox" name="option_choix[10]" id="Equipe" value="equipe" <?php echo (get_option('option_choix')[10] == "equipe")?'checked':''; ?>><label for="Equipe"><?php echo __('Équipes de recherche','wp-hal');?></label>
1356 1073 </td>
1357 1074 </tr>
1358 - <tr style="vertical-align:top;">
1359 - <th scope="row" style="font-size: 18px;"><?php echo esc_html(__('Contact :','wp-hal'));?></th>
1075 + <tr valign="top">
1076 + <th scope="row" style="font-size: 18px;"><?php echo __('Contact :','wp-hal');?></th>
1360 1077 </tr>
1361 1078 <tr>
1362 - <th scope="row"><?php echo esc_html(__("Afficher les informations d'un chercheur ayant un IdHal ?",'wp-hal'));?></th>
1363 - <td><input type="radio" name="option_infocontact" id="wphal-yes" value="yes" <?php echo esc_attr((get_option('option_infocontact') == "yes")?'checked':''); ?>><label for="wphal-yes"><?php echo esc_html(__("Oui",'wp-hal'))?></label><br>
1364 - <input type="radio" name="option_infocontact" id="wphal-no" value="no" <?php echo esc_attr((get_option('option_infocontact') == "no")?'checked':''); ?>><label for="wphal-no"><?php echo esc_html(__("Non",'wp-hal'))?></label><br>
1079 + <th scope="row"><?php echo __("Afficher les informations d'un chercheur ayant un IdHal ?",'wp-hal');?></th>
1080 + <td><input type="radio" name="option_infocontact" id="wphal-yes" value="yes" <?php echo (get_option('option_infocontact') == "yes")?'checked':''; ?>><label for="wphal-yes"><?php echo __("Oui",'wp-hal')?></label><br>
1081 + <input type="radio" name="option_infocontact" id="wphal-no" value="no" <?php echo (get_option('option_infocontact') == "no")?'checked':''; ?>><label for="wphal-no"><?php echo __("Non",'wp-hal')?></label><br>
1365 1082 </td>
1366 - </tr>
1367 1083 <tr>
1368 - <th scope="row"><label for="option_cache_timeout"><?php echo esc_html(__('Expiration cache (minutes)','wp-hal'));?></label></th>
1369 - <td><input type="number" min="1440" style="width:300px;" placeholder="Default(1 day) : 1440" name="option_cache_timeout" id="option_cache_timeout" value="<?php echo esc_js(get_option('option_cache_timeout')); ?>"/><img alt="cache" src="<?php echo esc_url(plugin_dir_url( __FILE__ ).'img/clock.svg'); ?>" style="vertical-align:middle; width:32px; margin-left:2px; margin-right:2px;"/></td>
1084 + <th scope="row"><?php echo __('Email','wp-hal');?></th>
1085 + <td><input type="text" style="width:300px;" placeholder="Exemple : hi@mail.com" name="option_email" id="option_email" value="<?php echo get_option('option_email'); ?>"/><img alt="email" src="<?php echo plugin_dir_url( __FILE__ ) ?>img/mail.svg" style="vertical-align:middle; width:32px; margin-left:2px; margin-right:2px;"/></td>
1370 1086 </tr>
1371 1087 <tr>
1372 - <th scope="row"><label for="option_erase_cache"><?php echo esc_html(__('Reinitialiser le cache','wp-hal'));?></label></th>
1373 - <td><input type="checkbox" name="option_erase_cache" id="option_erase_cache" value="1"/><img alt="option_erase_cache" src="<?php echo esc_url(plugin_dir_url( __FILE__ )."img/groom.svg"); ?>" style="vertical-align:middle; width:32px; margin-left:2px; margin-right:2px;"/></td>
1088 + <th scope="row"><?php echo __('Téléphone','wp-hal');?></th>
1089 + <td><input type="text" style="width:300px;" placeholder="Exemple : 06-01-02-03-04" name="option_tel" id="option_tel" value="<?php echo get_option('option_tel');?>"/><img alt="phone" src="<?php echo plugin_dir_url( __FILE__ ) ?>img/phone.svg" style="vertical-align:middle; width:32px; margin-left:2px; margin-right:2px;"/></td>
1374 1090 </tr>
1375 1091 <tr>
1376 - <th scope="row"><label for="option_email"><?php echo esc_html(__('Email','wp-hal'));?></label></th>
1377 - <td><input type="text" style="width:300px;" placeholder="Exemple : hi@mail.com" name="option_email" id="option_email" value="<?php echo esc_js(get_option('option_email')); ?>"/><img alt="email" src="<?php echo esc_url(plugin_dir_url( __FILE__ )."img/mail.svg"); ?>" style="vertical-align:middle; width:32px; margin-left:2px; margin-right:2px;"/></td>
1092 + <th>Facebook (http://www.facebook.com/)</th>
1093 + <td><input type="text" style="width:300px;" placeholder="Exemple : fa.book" name="option_social0" id="option_social0" value="<?php echo get_option('option_social0'); ?>"/><img alt="facebook" src="<?php echo plugin_dir_url( __FILE__ ) ?>img/facebook.svg" style="vertical-align:middle; width:32px; margin-left:2px; margin-right:2px;"/></td>
1378 1094 </tr>
1379 1095 <tr>
1380 - <th scope="row"><label for="option_tel"><?php echo esc_html(__('Téléphone','wp-hal'));?></label></th>
1381 - <td><input type="text" style="width:300px;" placeholder="Exemple : 06-01-02-03-04" name="option_tel" id="option_tel" value="<?php echo esc_js(get_option('option_tel'));?>"/><img alt="phone" src="<?php echo esc_url(plugin_dir_url( __FILE__ )."img/phone.svg"); ?>" style="vertical-align:middle; width:32px; margin-left:2px; margin-right:2px;"/></td>
1096 + <th>Twitter (http://www.twitter.com/)</th>
1097 + <td><input type="text" style="width:300px;" placeholder="Exemple : tweet_heure" name="option_social1" id="option_social1" value="<?php echo get_option('option_social1'); ?>"/><img alt="twitter" src="<?php echo plugin_dir_url( __FILE__ ) ?>img/twitter.svg" style="vertical-align:middle; width:32px; margin-left:2px; margin-right:2px;"/></td>
1382 1098 </tr>
1383 1099 <tr>
1384 - <th><label for="option_social0">Facebook (http://www.facebook.com/)</label></th>
1385 - <td><input type="text" style="width:300px;" placeholder="Exemple : fa.book" name="option_social0" id="option_social0" value="<?php echo esc_js(get_option('option_social0')); ?>"/><img alt="facebook" src="<?php echo esc_url(plugin_dir_url( __FILE__ )."img/facebook.svg"); ?>" style="vertical-align:middle; width:32px; margin-left:2px; margin-right:2px;"/></td>
1100 + <th>Google + (https://plus.google.com/u/0/+)</th>
1101 + <td><input type="text" style="width:300px;" placeholder="Exemple : goo.plus" name="option_social2" id="option_social2" value="<?php echo get_option('option_social2'); ?>"/><img alt="google" src="<?php echo plugin_dir_url( __FILE__ ) ?>img/google-plus.svg" style="vertical-align:middle; width:32px; margin-left:2px; margin-right:2px;"/></td>
1386 1102 </tr>
1387 1103 <tr>
1388 - <th><label for="option_social1">Twitter (http://www.twitter.com/)</label></th>
1389 - <td><input type="text" style="width:300px;" placeholder="Exemple : tweet_heure" name="option_social1" id="option_social1" value="<?php echo esc_js(get_option('option_social1')); ?>"/><img alt="twitter" src="<?php echo esc_url(plugin_dir_url( __FILE__ )."img/twitter.svg"); ?>" style="vertical-align:middle; width:32px; margin-left:2px; margin-right:2px;"/></td>
1104 + <th>LinkedIn (https://www.linkedin.com/in/)</th>
1105 + <td><input type="text" style="width:300px;" placeholder="Exemple : link.dine" name="option_social3" id="option_social3" value="<?php echo get_option('option_social3'); ?>"/><img alt="linkedin" src="<?php echo plugin_dir_url( __FILE__ ) ?>img/linkedin.svg" style="vertical-align:middle; width:32px; margin-left:2px; margin-right:2px;"/></td>
1390 1106 </tr>
1391 - <tr>
1392 - <th><label for="option_social2">Google + (https://plus.google.com/u/0/+)</label></th>
1393 - <td><input type="text" style="width:300px;" placeholder="Exemple : goo.plus" name="option_social2" id="option_social2" value="<?php echo esc_js(get_option('option_social2')); ?>"/><img alt="google" src="<?php echo esc_url(plugin_dir_url( __FILE__ )."img/google-plus.svg"); ?>" style="vertical-align:middle; width:32px; margin-left:2px; margin-right:2px;"/></td>
1394 - </tr>
1395 - <tr>
1396 - <th><label for="option_social3">LinkedIn (https://www.linkedin.com/in/)</label></th>
1397 - <td><input type="text" style="width:300px;" placeholder="Exemple : link.dine" name="option_social3" id="option_social3" value="<?php echo esc_js(get_option('option_social3')); ?>"/><img alt="linkedin" src="<?php echo esc_url(plugin_dir_url( __FILE__ )."img/linkedin.svg"); ?>" style="vertical-align:middle; width:32px; margin-left:2px; margin-right:2px;"/></td>
1398 - </tr>
1399 1107 </table>
1400 1108 <?php
1401 1109 submit_button(__('Enregistrer','wp-hal'), 'primary large', 'submit', true); ?>
1402 1110 </div>
@@ -1416,9 +1124,9 @@
1416 1124
1417 1125 /**
1418 1126 * Reset les données Hal
1419 1127 */
1420 -function wphal_reset_option() {
1128 +function reset_option() {
1421 1129 delete_option('option_choix');
1422 1130 delete_option('option_type');
1423 1131 delete_option('option_groupe');
1424 1132 delete_option('option_idhal');
@@ -1429,9 +1137,6 @@
1429 1137 delete_option('option_social0');
1430 1138 delete_option('option_social1');
1431 1139 delete_option('option_social2');
1432 1140 delete_option('option_social3');
1433 - delete_option('option_cache_timeout');
1434 - delete_option('option_erase_cache');
1435 1141 }
1436 -
1437 -?>
1142 +?>