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 +295 -341 2.1.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.1.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 */
@@ -47,73 +47,15 @@
47 47
48 48 return $links;
49 49 }
50 50
51 -add_filter( 'query_vars', 'hal_query_vars' );
52 -function hal_query_vars( $query_vars ) {
53 - $query_vars[] = 'hal_page';
54 - return $query_vars;
55 -}
56 51
57 52 add_filter( 'plugin_action_links', 'hal_plugin_action_links',10,2);
58 -/**
59 - * @param $url
60 - * @return object
61 - */
62 -function do_common_curl_call($url) {
63 - $response = wp_remote_get($url, [
64 - 'timeout'=>20,
65 - 'user-agent'=>"HAL Plugin Wordpress " . version,
66 - 'headers' => ['Content-type'=> 'application/json']
67 - ]);
68 - // we could ve parsed the response but if in general if no results then we get empty content
69 - $body = wp_remote_retrieve_body($response);
70 - // Récupération du résultat JSON
71 - $json = json_decode($body);
72 - return $json;
73 -}
74 53
75 -function clear_transients()
76 -{
77 - global $wpdb;
78 - // delete all "hal namespace" transients
79 - $sql = "
80 - DELETE
81 - FROM {$wpdb->options}
82 - WHERE option_name like '\_transient\_hal\_%'
83 - OR option_name like '\_transient\_timeout\_hal\_%'
84 - ";
85 54
86 - $wpdb->query($sql);
87 -}
88 -
89 -/**
90 - * @param $url
91 - * @return object
92 - */
93 -function do_get_data($url) {
94 - $transient_id = 'hal_'.md5($url);
95 - if(!empty(get_option('option_erase_cache'))){
96 - // we reset cache transient for hal namespace
97 - clear_transients();
98 - update_option('option_erase_cache', '');
99 - }
100 - $cache_expiration = empty(get_option('option_cache_timeout')) ? 1 * DAY_IN_SECONDS : intval(get_option('option_cache_timeout')) * MINUTE_IN_SECONDS;
101 - if ( false === ( $value = get_transient( $transient_id ) ) ) {
102 - $json = do_common_curl_call($url);
103 - if($json)
104 - set_transient( $transient_id, $json, $cache_expiration);
105 - return $json;
106 - } else{
107 - return $value;
108 - }
109 -}
110 -
111 -/**
55 +/***********************************************************************************************************************
112 56 * PLUGIN SHORTCODE ND-DOC
113 - * @param $param
114 - * @return int
115 -*/
57 + **********************************************************************************************************************/
116 58 function nb_doc($param)
117 59 {
118 60 $idhal = verifSolr(get_option('option_idhal'));
119 61 extract(shortcode_atts(array(
@@ -121,59 +63,44 @@
121 63 'id' => $idhal
122 64 ),
123 65 $param
124 66 ));
125 - /**
126 - * @var $id : defined by extract
127 - * @var string $type : defined by extract
128 - */
129 67 $id = verifSolr($id);
130 68
131 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 + );
132 78
133 - $json =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 +
134 85 return $json->response->numFound;
135 86 }
136 -/**
87 +/***********************************************************************************************************************
137 88 * PLUGIN SHORTCODE CV-HAL
138 - * @param $param
139 - * @return string
140 - */
89 + **********************************************************************************************************************/
141 90 function cv_hal($param){
142 - $content = '';
143 91 if ( !function_exists('curl_init' ) ) {
144 - $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';
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';
145 93 } else {
146 - $possible_ids = ["authIdHal_s", "structId_i", "authStructId_i", "authId_i", "anrProjectId_i", "europeanProjectId_i", "collCode_s"];
147 - $option_choix = !empty(get_option('option_choix')) ? get_option('option_choix') : [];
148 - if(in_array('disciplines', $option_choix)){ //Lance les scripts pour le Graphique
149 - wp_enqueue_style('wp-hal-style2');
150 -
151 - wp_enqueue_script('wp-hal-script1');
152 - wp_enqueue_script('wp-hal-script2');
153 - wp_enqueue_script('wp-hal-script3');
154 - }
155 - $facetdomain = null;
156 -
157 - // those parameters are configured from plusing settings
158 - $default_id = verifSolr(get_option('option_idhal'));
159 - $default_type = get_option('option_type');
160 - $default_contact = get_option('option_infocontact');
161 -
162 - // here we merge with shortcode parameters
163 - extract(shortcode_atts(array(
164 - 'type' => $default_type,
165 - 'id' => $default_id,
166 - 'contact' => $default_contact
167 - ),
168 - $param
169 - ));
170 -
171 - /** @var $id : defined by extract
172 - * @var string $type : defined by extract
173 - * @var string $contact : defined by extract
174 - */
175 - if (!empty($id) && in_array($type, $possible_ids)) {
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 + ));
176 103 $id = verifSolr($id);
177 104
178 105 if (get_option('option_groupe') == 'grouper') {
179 106 //cURL sur l'API pour récupérer les données
@@ -181,60 +108,78 @@
181 108 } elseif (get_option('option_groupe') == 'paginer') {
182 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';
183 110 }
184 111
185 - $json = do_get_data($url);
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 + );
186 120
187 - $hal_page = (get_query_var('hal_page')) ? get_query_var('hal_page') : 1;
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);
188 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 +
189 136 $content = '<div id="wphal-content">
190 137 <ul id="wphal-menu">';
191 138 $content .= '<li><a href="#publications" onclick="displayElem(\'publications\'); return false;" style="font-size:18px; text-decoration: none;">' . __('Publications', 'wp-hal') . '</a></li>';
192 - if (is_array($option_choix)) {
139 + if ($choix != 0) {
193 140 $content .= '<li><a href="#filtres" onclick="return false;" style="font-size:18px; text-decoration: none; cursor:default;">' . __('Filtres', 'wp-hal') . '</a>';
194 141 $content .= '<ul id="wphal-filtres">';
195 - foreach ($option_choix as $option) {
196 - if ($option == 'contact') {
197 - $content .= '<li><a href="#contact" onclick="displayElem(\'wphal-contact\'); return false;" style="margin:1px; text-decoration: none;">' . __('Contact', 'wp-hal');
198 - $content .= '</a></li>';
199 - }
200 - if ($option == 'disciplines') {
201 - $content .= '<li><a href="#disciplines" onclick="displayElem(\'wphal-disciplines\'); return false;" style="margin:1px; text-decoration: none;">' . __('Disciplines', 'wp-hal');
202 - $content .= '</a></li>';
203 - }
204 - if ($option == 'mots-clefs') {
205 - $content .= '<li><a href="#keywords" onclick="displayElem(\'wphal-keywords\'); return false;" style="margin:1px; text-decoration: none;">' . __('Mots-clefs', 'wp-hal');
206 - $content .= '</a></li>';
207 - }
208 - if ($option == 'auteurs') {
209 - $content .= '<li><a href="#auteurs" onclick="displayElem(\'wphal-auteurs\'); return false;" style="margin:1px; text-decoration: none;">' . __('Auteurs', 'wp-hal');
210 - $content .= '</a></li>';
211 - }
212 - if ($option == 'revues') {
213 - $content .= '<li><a href="#revues" onclick="displayElem(\'wphal-revues\'); return false;" style="margin:1px; text-decoration: none;">' . __('Revues', 'wp-hal');
214 - $content .= '</a></li>';
215 - }
216 - if ($option == 'annee') {
217 - $content .= '<li><a href="#annees" onclick="displayElem(\'wphal-annees\'); return false;" style="margin:1px; text-decoration: none;">' . __('Année de production', 'wp-hal');
218 - $content .= '</a></li>';
219 - }
220 - if ($option == 'institution') {
221 - $content .= '<li><a href="#insts" onclick="displayElem(\'wphal-insts\'); return false;" style="margin:1px; text-decoration: none;">' . __('Institutions', 'wp-hal');
222 - $content .= '</a></li>';
223 - }
224 - if ($option == 'laboratoire') {
225 - $content .= '<li><a href="#labs" onclick="displayElem(\'wphal-labs\'); return false;" style="margin:1px; text-decoration: none;">' . __('Laboratoires', 'wp-hal');
226 - $content .= '</a></li>';
227 - }
228 - if ($option == 'departement') {
229 - $content .= '<li><a href="#depts" onclick="displayElem(\'wphal-depts\'); return false;" style="margin:1px; text-decoration: none;">' . __('Départements', 'wp-hal');
230 - $content .= '</a></li>';
231 - }
232 - if ($option == 'equipe') {
233 - $content .= '<li><a href="#equipes" onclick="displayElem(\'wphal-equipes\'); return false;" style="margin:1px; text-decoration: none;">' . __('Équipes de recherche', 'wp-hal');
234 - $content .= '</a></li>';
235 - }
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>';
236 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 + }
237 182 $content .= '</ul></li>';
238 183 }
239 184 $content .= '</ul><br/><hr>';
240 185
@@ -246,10 +191,23 @@
246 191 <ul id="wphal-cont" style="list-style-type: none;">';
247 192
248 193 if ($contact == 'yes' && $type == 'authIdHal_s') {
249 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);
250 - $jsonauthor = do_get_data($urlauthor);
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 + );
251 203
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 +
252 210 for ($i = 0; $jsonauthor->response->docs[$i] != ''; $i++) {
253 211 $content .= '<div class="wphal-infocontact" id="wphal-infocontact'.$i.'">';
254 212 if ($jsonauthor->response->docs[$i]->fullName_s != '') {
255 213 $content .= '<li class="wphal-fullname"><span>Nom : </span><span>'. $jsonauthor->response->docs[$i]->fullName_s .'</span></li>';
@@ -287,22 +245,18 @@
287 245 if (get_option('option_tel') != '') {
288 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>';
289 247 }
290 248 if (get_option('option_social0') != '') {
291 - $content .= '<li><a href="http://www.facebook.com/' . get_option('option_social0') . '" target="_blank"><img
292 - alt="Facebook" src=" ' . 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>';
293 250 }
294 251 if (get_option('option_social1') != '') {
295 - $content .= '<li><a href="http://www.twitter.com/' . get_option('option_social1') . '" target="_blank"><img
296 - alt="Twitter" src=" ' . 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>';
297 253 }
298 254 if (get_option('option_social2') != '') {
299 - $content .= '<li><a href="https://plus.google.com/u/0/+' . get_option('option_social2') . '" target="_blank"><img
300 - alt="Google+" src=" ' . 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>';
301 256 }
302 257 if (get_option('option_social3') != '') {
303 - $content .= '<li><a href="https://www.linkedin.com/in/' . get_option('option_social3') . '" target="_blank"><img
304 - alt="LinkedIn" src=" ' . 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>';
305 259 }
306 260 $content .= '</ul>
307 261 </div>
308 262 <div class="display" id="wphal-disciplines" style="display: none;">
@@ -316,12 +270,13 @@
316 270 $facetdomain = $json->facet_counts->facet_fields->en_domainAllCodeLabel_fs;
317 271 }
318 272
319 273 if (!is_null($facetdomain) && !empty($facetdomain)) {
274 +
320 275 $content .= '<div id="listdisci">';
321 276 $content .= '<span id="tridisciplines">';
322 - $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>';
323 - $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>';
324 279 $content .= '</span>';
325 280 $content .= '<ul id="wphal-discipline" class="wphal-discipline">';
326 281 foreach ($facetdomain as $res) {
327 282 $name = explode(delimiter, $res[0]);
@@ -332,15 +287,15 @@
332 287
333 288 $content .= '<div id="wphal-graph" style="display:none;">';
334 289 $content .= '<div id="wphal-piedisci"></div>';
335 290 $content .= '</div>';
336 - $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');
337 292 $content .= '</button>';
338 293 }
339 294 $content .= '</div>
340 295 <div class="display" id="wphal-keywords" style="display: none;">
341 296 <h3 class="wphal-titre">' . __('Mots-clefs', 'wp-hal') . '</h3>';
342 - if (!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)) {
343 298 $content .= '<div id="wphal-keys">';
344 299 $r = 0;
345 300 // CSS Nuage de mots
346 301 $maxsize = 25;
@@ -346,10 +301,8 @@
346 301 $maxsize = 25;
347 302 $minsize = 10;
348 303 $maxval = max(array_values($json->facet_counts->facet_fields->keyword_s[1]));
349 304 $minval = min(array_values($json->facet_counts->facet_fields->keyword_s[1]));
350 - if(!is_numeric($minval)) {$minval = 0;}
351 - if(!is_numeric($maxval)) {$maxval = 0;}
352 305 $spread = ($maxval - $minval);
353 306 $step = ($maxsize - $minsize) / $spread;
354 307 $tab = array();
355 308 foreach ($json->facet_counts->facet_fields->keyword_s as $res) {
@@ -366,10 +319,10 @@
366 319 }
367 320 $content .= '</div>';
368 321 $content .= '<div id="keysuite" style="display:none;">';
369 322 $content .= '<span id="trikeywords">';
370 - $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>';
371 - $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>';
372 325 $content .= '</span>';
373 326 $content .= '<ul class="wphal-keyword">';
374 327 $content .= '<div id="wphal-keyw">';
375 328 foreach ($json->facet_counts->facet_fields->keyword_s as $res) {
@@ -377,9 +330,9 @@
377 330 }
378 331 $content .= '</div>';
379 332 $content .= '</ul>';
380 333 $content .= '</div>';
381 - $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');
382 335 $content .= '</button>';
383 336 }
384 337 $content .= '</div>
385 338 <div class="display" id="wphal-auteurs" style="display: none;">
@@ -385,10 +338,10 @@
385 338 <div class="display" id="wphal-auteurs" style="display: none;">
386 339 <h3 class="wphal-titre">' . __('Auteurs', 'wp-hal') . '</h3>';
387 340 if (!is_null($json->facet_counts->facet_fields->authIdLastNameFirstName_fs) && !empty($json->facet_counts->facet_fields->authIdLastNameFirstName_fs)) {
388 341 $content .= '<span id="triauteurs">';
389 - $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>';
390 - $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>';
391 344 $content .= '</span>';
392 345 $content .= '<ul class="wphal-auteurs" style="list-style-type: none;">';
393 346 $content .= '<div id="wphal-aut">';
394 347 $r = 0;
@@ -416,9 +369,9 @@
416 369 $content .= '</div>';
417 370 $content .= '</div>';
418 371 $content .= '</ul>';
419 372 if ($r > 10) {
420 - $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');
421 374 $content .= '</button>';
422 375 }
423 376 }
424 377 $content .= '</div>
@@ -425,10 +378,10 @@
425 378 <div class="display" id="wphal-revues" style="display: none;">
426 379 <h3 class="wphal-titre">' . __('Revues', 'wp-hal') . '</h3>';
427 380 if (!is_null($json->facet_counts->facet_fields->journalIdTitle_fs) && !empty($json->facet_counts->facet_fields->journalIdTitle_fs)) {
428 381 $content .= '<span id="trirevues">';
429 - $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>';
430 - $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>';
431 384 $content .= '</span>';
432 385 $content .= '<ul class="wphal-revues">';
433 386 $content .= '<div id="wphal-rev">';
434 387 $r = 0;
@@ -456,9 +409,9 @@
456 409 $content .= '</div>';
457 410 $content .= '</div>';
458 411 $content .= '</ul>';
459 412 if ($r > 10) {
460 - $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');
461 414 $content .= '</button>';
462 415 }
463 416 }
464 417 $content .= '</div>
@@ -465,10 +418,10 @@
465 418 <div class="display" id="wphal-annees" style="display: none;">
466 419 <h3 class="wphal-titre">' . __('Année de production', 'wp-hal') . '</h3>';
467 420 if (!is_null($json->facet_counts->facet_fields->producedDateY_i) && !empty($json->facet_counts->facet_fields->producedDateY_i)) {
468 421 $content .= '<span id="triannees">';
469 - $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>';
470 - $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>';
471 424 $content .= '</span>';
472 425 $content .= '<ul class="wphal-annees">';
473 426 $content .= '<div id="wphal-an">';
474 427
@@ -496,9 +449,9 @@
496 449 $content .= '</div>';
497 450 $content .= '</div>';
498 451 $content .= '</ul>';
499 452 if ($r > 10) {
500 - $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');
501 454 $content .= '</button>';
502 455 }
503 456 }
504 457 $content .= '</div>
@@ -505,10 +458,10 @@
505 458 <div class="display" id="wphal-insts" style="display: none;">
506 459 <h3 class="wphal-titre">' . __('Institutions', 'wp-hal') . '</h3>';
507 460 if (!is_null($json->facet_counts->facet_fields->instStructIdName_fs) && !empty($json->facet_counts->facet_fields->instStructIdName_fs)) {
508 461 $content .= '<span id="triinsts">';
509 - $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>';
510 - $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>';
511 464 $content .= '</span>';
512 465 $content .= '<ul class="wphal-insts">';
513 466 $content .= '<div id="wphal-institu">';
514 467 $r = 0;
@@ -536,9 +489,9 @@
536 489 $content .= '</div>';
537 490 $content .= '</div>';
538 491 $content .= '</ul>';
539 492 if ($r > 10) {
540 - $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');
541 494 $content .= '</button>';
542 495 }
543 496 }
544 497 $content .= '</div>
@@ -545,10 +498,10 @@
545 498 <div class="display" id="wphal-labs" style="display: none;">
546 499 <h3 class="wphal-titre">' . __('Laboratoires', 'wp-hal') . '</h3>';
547 500 if (!is_null($json->facet_counts->facet_fields->labStructIdName_fs) && !empty($json->facet_counts->facet_fields->labStructIdName_fs)) {
548 501 $content .= '<span id="trilabs">';
549 - $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>';
550 - $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>';
551 504 $content .= '</span>';
552 505 $content .= '<ul class="wphal-labs">';
553 506 $content .= '<div id="wphal-labo">';
554 507
@@ -577,9 +530,9 @@
577 530 $content .= '</div>';
578 531 $content .= '</div>';
579 532 $content .= '</ul>';
580 533 if ($r > 10) {
581 - $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');
582 535 $content .= '</button>';
583 536 }
584 537 }
585 538 $content .= '</div>
@@ -586,10 +539,10 @@
586 539 <div class="display" id="wphal-depts" style="display: none;">
587 540 <h3 class="wphal-titre">' . __('Départements', 'wp-hal') . '</h3>';
588 541 if (!is_null($json->facet_counts->facet_fields->deptStructIdName_fs) && !empty($json->facet_counts->facet_fields->deptStructIdName_fs)) {
589 542 $content .= '<span id="tridept">';
590 - $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>';
591 - $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>';
592 545 $content .= '</span>';
593 546 $content .= '<ul class="wphal-depts">';
594 547 $content .= '<div id="wphal-dpt">';
595 548 $r = 0;
@@ -617,9 +570,9 @@
617 570 $content .= '</div>';
618 571 $content .= '</div>';
619 572 $content .= '</ul>';
620 573 if ($r > 10) {
621 - $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');
622 575 $content .= '</button>';
623 576 }
624 577 }
625 578 $content .= '</div>
@@ -626,16 +579,15 @@
626 579 <div class="display" id="wphal-equipes" style="display: none;">
627 580 <h3 class="wphal-titre">' . __('Équipes de recherche', 'wp-hal') . '</h3>';
628 581 if (!is_null($json->facet_counts->facet_fields->rteamStructIdName_fs) && !empty($json->facet_counts->facet_fields->rteamStructIdName_fs)) {
629 582 $content .= '<span id="triequipe">';
630 - $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>';
631 - $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>';
632 585 $content .= '</span>';
633 586 $content .= '<ul class="wphal-equipes">';
634 587 $content .= '<div id="wphal-rteam">';
635 588
636 589 $r = 0;
637 - $name=[];
638 590 foreach ($json->facet_counts->facet_fields->rteamStructIdName_fs as $res) {
639 591 $r = $r + 1;
640 592 if ($r > 10) {
641 593 break;
@@ -651,9 +603,8 @@
651 603 }
652 604 if ($i < $r) {
653 605 $i = $i + 1;
654 606 } else {
655 - $name = explode(delimiter, $res[0]);
656 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>';
657 608 }
658 609 }
659 610 $content .= '</div>';
@@ -659,9 +610,9 @@
659 610 $content .= '</div>';
660 611 $content .= '</div>';
661 612 $content .= '</ul>';
662 613 if ($r > 10) {
663 - $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');
664 615 $content .= '</button>';
665 616 }
666 617 }
667 618 $content .= '</div>
@@ -666,9 +617,9 @@
666 617 }
667 618 $content .= '</div>
668 619 <div class="display" id="publications">';
669 620 if (get_option('option_groupe') == 'grouper') {
670 - $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');
671 622 $jsontype = json_decode($doctype);
672 623
673 624 //LISTE DES DOCUMENTS PAR GROUPE
674 625
@@ -673,13 +624,14 @@
673 624 //LISTE DES DOCUMENTS PAR GROUPE
674 625
675 626 $content .= '<div class="counter-doc"><span class="wphal-nbtot">' . $json->grouped->docType_s->matches . ' </span>';
676 627 $content .= __('documents', 'wp-hal'). '</div><br>';
677 - for ($i = 0; !empty($jsontype->response->result->doc[$i]); $i++) {
678 - 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++) {
679 631 if ($json->grouped->docType_s->groups[$d]->groupValue == $jsontype->response->result->doc[$i]->str[0]){
680 632 $titre = $jsontype->response->result->doc[$i]->str[1];
681 - $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>';
682 634 $content .= '<div class="grp-content">';
683 635 $content .= '<ul>';
684 636 foreach ($json->grouped->docType_s->groups[$d]->doclist->docs as $result) {
685 637 $content .= '<li>' . $result->citationFull_s . '</li>';
@@ -684,13 +636,14 @@
684 636 foreach ($json->grouped->docType_s->groups[$d]->doclist->docs as $result) {
685 637 $content .= '<li>' . $result->citationFull_s . '</li>';
686 638 }
687 639 $content .= '</ul></div>';
688 - $content .= '</div><br>';
640 + $content .= '</div></li><br>';
689 641 break;
690 642 }
691 643 }
692 644 }
645 + $content .= '</ul>';
693 646 } elseif (get_option('option_groupe') == 'paginer') {
694 647
695 648 //LISTE DES DOCUMENTS AVEC PAGINATION
696 649 $content .= '<div class="counter-doc"><span class="wphal-nbtot">' . $json->response->numFound . ' </span>';
@@ -702,10 +655,10 @@
702 655 $total = $json->response->numFound;
703 656
704 657 $nombreDePages = ceil($total / $messagesParPage);
705 658
706 - if (isset($hal_page)) {
707 - $pageActuelle = intval($hal_page);
659 + if (isset($paged)) {
660 + $pageActuelle = intval($paged);
708 661
709 662 if ($pageActuelle > $nombreDePages) {
710 663 $pageActuelle = $nombreDePages;
711 664 }
@@ -714,92 +667,102 @@
714 667 }
715 668 $premiereEntree = ($pageActuelle - 1) * $messagesParPage;
716 669
717 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';
718 - $json = do_get_data($url);
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 + );
719 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 +
720 686 //--MODULE PAGINATION--//
721 - $count_results = count($json->response->docs);
722 - if($count_results>0) {
723 - $content .= '<ul>';
724 - for ( $i = 0; $i <= $count_results - 1; $i ++ ) {
725 - $content .= '<li>' . $json->response->docs[ $i ]->citationFull_s . '</li>';
726 - }
727 - $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>';
728 705 } else {
729 - $content = '<div> no results !</div>';
706 + $content .= '<li><a href="?paged=' . $precedent . '">&laquo;</a></li>';
730 707 }
731 - if($total> $messagesParPage) {
732 - //--AFFICHAGE PAGINATION--//
733 - $precedents = $pageActuelle - 2;
734 - $suivants = $pageActuelle + 2;
735 - $precedent = $pageActuelle - 1;
736 - $suivant = $pageActuelle + 1;
737 - $penultimate = $nombreDePages - 1;
738 -
739 - $content .= '<ul class="wphal-pagination">';
740 - //--BOUTON PRECEDENT--//
741 - if ( $pageActuelle != 1 ) {
742 - $content .= '<li><a href="?hal_page=' . $precedent . '">&laquo;</a></li>';
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> ';
714 + }
743 715 }
744 - if ( $nombreDePages <= 6 ) {// Cas 1 : 6 pages ou moins - Pas de troncature
745 - for ( $i = 1; $i <= $nombreDePages; $i ++ ) {
746 - if ( $i == $pageActuelle ) {
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) {
747 720 $content .= '<li class="active"><a href="#">' . $i . '</a></li>';
748 721 } else {
749 - $content .= ' <li><a href="?hal_page=' . $i . '">' . $i . '</a></li> ';
722 + $content .= '<li><a href="?paged=' . $i . '">' . $i . '</a></li>';
750 723 }
751 724 }
752 - } elseif ( $nombreDePages >= 7 ) {// Cas 2 : 7 pages ou plus - Troncature
753 - if ( $pageActuelle <= 3 ) {// Lorsque l'on est sur les trois premières pages
754 - for ( $i = 1; $i <= 4; $i ++ ) {
755 - if ( $i == $pageActuelle ) {
756 - $content .= '<li class="active"><a href="#">' . $i . '</a></li>';
757 - } else {
758 - $content .= '<li><a href="?hal_page=' . $i . '">' . $i . '</a></li>';
759 - }
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>';
728 + }
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>';
739 + }
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) {
746 + $content .= '<li class="active"><a href="#">' . $i . '</a></li>';
747 + } else {
748 + $content .= '<li><a href="?paged=' . $i . '">' . $i . '</a></li>';
760 749 }
761 - $content .= '<li class="disabled"><a href="#">&hellip;</a></li>';
762 - $content .= '<li><a href="?hal_page=' . $penultimate . '">' . $penultimate . '</a></li>';
763 - $content .= '<li><a href="?hal_page=' . $nombreDePages . '">' . $nombreDePages . '</a></li>';
764 750 }
765 - if ( $pageActuelle >= 4 && $pageActuelle <= $penultimate - 2 ) {//Lorsque l'on arrive sur la quatrième page
766 - $content .= '<li><a href="?hal_page=">1</a></li>';
767 - $content .= '<li class="disabled"><a href="#">&hellip;</a></li>';
768 - $content .= '<li><a href="?hal_page=' . $precedents . '">' . $precedents . '</a></li>';
769 - $content .= '<li><a href="?hal_page=' . $precedent . '">' . $precedent . '</a></li>';
770 - $content .= '<li class="active"><a href="#">' . $pageActuelle . '</a></li>';
771 - $content .= '<li><a href="?hal_page=' . $suivant . '">' . $suivant . '</a></li>';
772 - $content .= '<li><a href="?hal_page=' . $suivants . '">' . $suivants . '</a></li>';
773 - $content .= '<li class="disabled"><a href="#">&hellip;</a></li>';
774 - $content .= '<li><a href="?hal_page=' . $nombreDePages . '">' . $nombreDePages . '</a></li>';
775 - }
776 - if ( $pageActuelle >= $penultimate - 1 ) {
777 - $content .= '<li><a href="?hal_page=1">1</a></li>';
778 - $content .= '<li><a href="?hal_page=2">2</a></li>';
779 - $content .= '<li class="disabled"><a href="#">&hellip;</a></li>';
780 - for ( $i = $penultimate - 2; $i <= $nombreDePages; $i ++ ) {
781 - if ( $i == $pageActuelle ) {
782 - $content .= '<li class="active"><a href="#">' . $i . '</a></li>';
783 - } else {
784 - $content .= '<li><a href="?hal_page=' . $i . '">' . $i . '</a></li>';
785 - }
786 - }
787 - }
788 751 }
789 - //--BOUTON SUIVANT--//
790 - if ( $pageActuelle < $nombreDePages ) {
791 - $content .= '<li><a href="?hal_page=' . $suivant . '">&raquo;</a></li>';
792 - }
793 - $content .= '</ul>';
794 - //--AFFICHAGE PAGINATION--//
795 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--//
796 761 }
797 762 $content .= '</div>
798 763 </div>
799 764 </div>';
800 - }else{
801 - $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>';
802 765 }
803 766 $content .= '<div class="wphal-footer">';
804 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>';
805 768 $content .= '</div>';
@@ -811,9 +774,9 @@
811 774 $value = $res[1];
812 775 $array[] = array($name, $value);
813 776 }
814 777 }
815 - wp_localize_script('wp-hal-script4', 'WPWallSettings', $array);
778 + wp_localize_script('wp-hal-script4', 'WPWallSettings', json_encode($array));
816 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'));
817 780 wp_localize_script('wp-hal-script4', 'translate', $translation);
818 781 }
819 782 return $content;
@@ -844,8 +807,9 @@
844 807 wp_register_style('wp-hal-style1', plugins_url('/css/style.css', __FILE__));
845 808 wp_register_style('wp-hal-style2', plugins_url('/css/jquery.jqplot.css', __FILE__));
846 809
847 810 wp_enqueue_style('wp-hal-style1');
811 + wp_enqueue_style('wp-hal-style2');
848 812 }
849 813
850 814 function wp_adding_script() {
851 815 wp_register_script('wp-hal-script1',plugins_url('/js/jquery.jqplot.js', __FILE__));
@@ -854,8 +818,11 @@
854 818 wp_register_script('wp-hal-script4',plugins_url('/js/cv-hal.js', __FILE__));
855 819
856 820
857 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');
858 825 wp_enqueue_script('wp-hal-script4', false, array(), false, true);
859 826 }
860 827
861 828 /**
@@ -906,12 +873,14 @@
906 873 * Classe du widget wphal
907 874 */
908 875
909 876 class wphal_widget extends WP_widget{
877 +
878 +
910 879 /**
911 880 * Défini les propriétés du widget
912 881 */
913 - function __construct(){
882 + function wphal_widget(){
914 883 $options = array(
915 884 "classname" => "wphal-publications",
916 885 "description" => __("Afficher les dernières publications d'un auteur ou d'une structure.", 'wp-hal')
917 886 );
@@ -917,9 +886,9 @@
917 886 );
918 887
919 888 parent::__construct(
920 889 'hal-publications',
921 - __("Publications HAL", 'wp-hal'),
890 + __("Publications récentes", 'wp-hal'),
922 891 $options
923 892 );
924 893 }
925 894
@@ -928,41 +897,47 @@
928 897 * @param $args
929 898 * @param $instance
930 899 */
931 900 function widget($args, $instance){
932 - if(isset($instance['idhal']) && !empty($instance['idhal'])) {
933 - $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';
934 903 extract($args);
935 - /**
936 - * @var $before_widget : defined by extract
937 - * @var $before_title : defined by extract
938 - * @var $after_title : defined by extract
939 - * @var $after_widget : defined by extract
940 - */
941 - if (!function_exists('curl_init')) {
942 - $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']);
943 910
944 - } else {
945 - $instance['idhal'] = verifSolr($instance['idhal']);
911 + $url = api . '?q=*:*&fq=' . $instance['select'] . ':' . urlencode($instance['idhal']) . '&fl=uri_s,'. $instance['typetext'] .'&sort=' . producedDateY . '&rows=' . $instance['nbdoc'] . '&wt=json';
946 912
947 - $url = api . '?q=*:*&fq=' . $instance['select'] . ':' . urlencode($instance['idhal']) . '&fl=uri_s,' . $instance['typetext'] . '&sort=' . producedDateY . '&rows=' . $instance['nbdoc'] . '&wt=json';
948 - $json = do_get_data($url);
949 - $count_results = count($json->response->docs);
950 - if ($count_results > 0) {
951 - $content = '<ul class="widhal-ul">';
952 - for ($i = 0; $i < $count_results - 1; $i++) {
953 - if ($instance['typetext'] == 'citationRef_s') {
954 - $typetext = $json->response->docs[$i]->citationRef_s;
955 - } else {
956 - $typetext = $json->response->docs[$i]->title_s[0];
957 - }
958 - $content .= '<li class="widhal-li"><a href="' . $json->response->docs[$i]->uri_s . '" target="_blank">' . $typetext . '</a></li>';
959 - }
960 - $content .= '</ul>';
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 + );
921 +
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;
961 932 } else {
962 - $content = '<div> no results !</div>';
933 + $typetext = $json->response->docs[$i]->title_s[0];
963 934 }
935 + $content .= '<li class="widhal-li"><a href="' . $json->response->docs[$i]->uri_s . '" target="_blank">' . $typetext . '</a></li>';
964 936 }
937 + $content .= '</ul>';
938 +
939 + extract($args);
965 940 echo $before_widget;
966 941 echo $before_title . $instance['titre'] . $after_title;
967 942 echo $content;
968 943 echo $after_widget;
@@ -974,12 +949,9 @@
974 949 * @param $new
975 950 * @param $old
976 951 */
977 952 function update($new, $old){
978 - //the id must be provided
979 - if(isset($new['idhal']) && !empty($new['idhal']))
980 - return $new;
981 - return false;
953 + return $new;
982 954 }
983 955
984 956 /**
985 957 * Formulaire du widget
@@ -987,12 +959,11 @@
987 959 */
988 960 function form($instance){
989 961
990 962 $defaut = array(
991 - 'titre' => __("Publications Hal", 'wp-hal'),
963 + 'titre' => __("Publications récentes", 'wp-hal'),
992 964 'select' => "authIdHal_s",
993 965 'typetext' => "title_s",
994 - 'idhal' => "",
995 966 'nbdoc' => 5
996 967 );
997 968 $instance = wp_parse_args($instance,$defaut);
998 969 ?>
@@ -1014,11 +985,9 @@
1014 985 <p>
1015 986 <label for="<?php echo $this->get_field_id("select");?>"><?php echo __("Type d'Id",'wp-hal') .' :'?></label>
1016 987 <select id="<?php echo $this->get_field_id("select");?>" name="<?php echo $this->get_field_name("select");?>">
1017 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>
1018 - <option id="<?php echo $this->get_field_id("StructId");?>" value="structId_i" <?php echo ($instance["select"] == "structId_i")?'selected':''; ?>><label for="<?php echo $this->get_field_id("StructId");?>">Struct Id</label><span style="font-style: italic;"> <?php echo __('(Exemple : 413106)','wp-hal');?></span></option>
1019 - <option id="<?php echo $this->get_field_id("AuthorStructId");?>" value="authStructId_i" <?php echo ($instance["select"] == "authStructId_i")?'selected':''; ?>><label for="<?php echo $this->get_field_id("AuthorStructId");?>">AuthorStruct Id</label><span style="font-style: italic;"> <?php echo __('(Exemple : 413106)','wp-hal');?></span></option>
1020 - <option id="<?php echo $this->get_field_id("AuthorId");?>" value="authId_i" <?php echo ($instance["select"] == "authId_i")?'selected':''; ?>><label for="<?php echo $this->get_field_id("AuthorId");?>">Author Id</label><span style="font-style: italic;"> <?php echo __('(Exemple : 413106)','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>
1021 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>
1022 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>
1023 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>
1024 993 </select>
@@ -1030,8 +999,9 @@
1030 999 <?php
1031 1000 }
1032 1001 }
1033 1002
1003 +
1034 1004 function register_settings() {
1035 1005 register_setting( 'wphal_option', 'option_choix' );
1036 1006 register_setting( 'wphal_option', 'option_type' );
1037 1007 register_setting( 'wphal_option', 'option_groupe' );
@@ -1043,10 +1013,8 @@
1043 1013 register_setting( 'wphal_option', 'option_social0' );
1044 1014 register_setting( 'wphal_option', 'option_social1' );
1045 1015 register_setting( 'wphal_option', 'option_social2' );
1046 1016 register_setting( 'wphal_option', 'option_social3' );
1047 - register_setting( 'wphal_option', 'option_cache_timeout' );
1048 - register_setting( 'wphal_option', 'option_erase_cache' );
1049 1017 }
1050 1018
1051 1019 /**
1052 1020 * Crée le menu d'option du plugin
@@ -1068,18 +1036,16 @@
1068 1036 <div id="post-body-content">
1069 1037 <?php settings_fields( 'wphal_option' ); ?>
1070 1038 <?php do_settings_sections( 'wphal_option' ); ?>
1071 1039 <table class="form-table">
1072 - <tr style="vertical-align:top;">
1040 + <tr valign="top">
1073 1041 <th scope="row" style="font-size: 18px;"><?php echo __('Paramètre de la page :','wp-hal');?></th>
1074 1042 </tr>
1075 - <tr style="vertical-align:top;">
1076 - <th scope="row"><label for="option_type"><?php echo __('Type d\'Id','wp-hal');?></label></th>
1043 + <tr valign="top">
1044 + <th scope="row"><?php echo __('Type d\'Id','wp-hal');?></th>
1077 1045 <td><select name="option_type">
1078 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>
1079 - <option id="StructId" value="structId_i" <?php echo (get_option('option_type') == "structId_i")?'selected':''; ?>><label for="StructId">Struct Id</label><span style="font-style: italic;"> <?php echo __('(Exemple : 413106)','wp-hal');?></span></option>
1080 - <option id="AuthorStructId" value="authStructId_i" <?php echo (get_option('option_type') == "authStructId_i")?'selected':''; ?>><label for="AuthorStructId">AuthorStruct Id</label><span style="font-style: italic;"> <?php echo __('(Exemple : 413106)','wp-hal');?></span></option>
1081 - <option id="AuthorId" value="authId_i" <?php echo (get_option('option_type') == "authId_i")?'selected':''; ?>><label for="AuthorId">Author Id</label><span style="font-style: italic;"> <?php echo __('(Exemple : 413106)','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>
1082 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>
1083 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>
1084 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>
1085 1051 </select>
@@ -1085,30 +1051,29 @@
1085 1051 </select>
1086 1052 <input type="text" name="option_idhal" id="option_idhal" value="<?php echo get_option('option_idhal'); ?>"/>
1087 1053 </td>
1088 1054 </tr>
1089 - <tr style="vertical-align:top;">
1055 + <tr valign="top">
1090 1056 <th scope="row"><?php echo __('Affichage des documents','wp-hal');?></th>
1091 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>
1092 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>
1093 1059 </td>
1094 1060 </tr>
1095 - <tr style="vertical-align:top;">
1061 + <tr valign="top">
1096 1062 <th scope="row"><?php echo __('Choix des éléments menu','wp-hal');?></th>
1097 - <?php $option_choix = get_option('option_choix'); ?>
1098 - <td><input type="checkbox" name="option_choix[1]" id="Contact" value="contact" <?php echo (isset($option_choix[1]) && $option_choix[1] == "contact")?'checked':''; ?>><label for="Contact"><?php echo __('Contact','wp-hal');?></label><br/>
1099 - <input type="checkbox" name="option_choix[2]" id="Disciplines" value="disciplines" <?php echo (isset($option_choix[2]) && $option_choix[2] == "disciplines")?'checked':''; ?>><label for="Disciplines"><?php echo __('Disciplines','wp-hal');?></label><br/>
1100 - <input type="checkbox" name="option_choix[3]" id="Mots-clefs" value="mots-clefs" <?php echo (isset($option_choix[3]) && $option_choix[3] == "mots-clefs")?'checked':''; ?>><label for="Mots-clefs"><?php echo __('Mots-clefs','wp-hal');?></label><br/>
1101 - <input type="checkbox" name="option_choix[4]" id="Auteurs" value="auteurs" <?php echo (isset($option_choix[4]) && $option_choix[4] == "auteurs")?'checked':''; ?>><label for="Auteurs"><?php echo __('Auteurs','wp-hal');?></label><br/>
1102 - <input type="checkbox" name="option_choix[5]" id="Revues" value="revues" <?php echo (isset($option_choix[5]) && $option_choix[5] == "revues")?'checked':''; ?>><label for="Revues"><?php echo __('Revues','wp-hal');?></label><br/>
1103 - <input type="checkbox" name="option_choix[6]" id="Annee" value="annee" <?php echo (isset($option_choix[6]) && $option_choix[6] == "annee")?'checked':''; ?>><label for="Annee"><?php echo __('Année de production','wp-hal');?></label><br/>
1104 - <input type="checkbox" name="option_choix[7]" id="Institution" value="institution" <?php echo (isset($option_choix[7]) && $option_choix[7] == "institution")?'checked':''; ?>><label for="Institution"><?php echo __('Institutions','wp-hal');?></label><br/>
1105 - <input type="checkbox" name="option_choix[8]" id="Laboratoire" value="laboratoire" <?php echo (isset($option_choix[8]) && $option_choix[8] == "laboratoire")?'checked':''; ?>><label for="Laboratoire"><?php echo __('Laboratoires','wp-hal');?></label><br/>
1106 - <input type="checkbox" name="option_choix[9]" id="Departement" value="departement" <?php echo (isset($option_choix[9]) && $option_choix[9] == "departement")?'checked':''; ?>><label for="Departement"><?php echo __('Départements','wp-hal');?></label><br/>
1107 - <input type="checkbox" name="option_choix[10]" id="Equipe" value="equipe" <?php echo (isset($option_choix[10]) && $option_choix[10] == "equipe")?'checked':''; ?>><label for="Equipe"><?php echo __('Équipes de recherche','wp-hal');?></label>
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>
1108 1073 </td>
1109 1074 </tr>
1110 - <tr style="vertical-align:top;">
1075 + <tr valign="top">
1111 1076 <th scope="row" style="font-size: 18px;"><?php echo __('Contact :','wp-hal');?></th>
1112 1077 </tr>
1113 1078 <tr>
1114 1079 <th scope="row"><?php echo __("Afficher les informations d'un chercheur ayant un IdHal ?",'wp-hal');?></th>
@@ -1114,39 +1079,30 @@
1114 1079 <th scope="row"><?php echo __("Afficher les informations d'un chercheur ayant un IdHal ?",'wp-hal');?></th>
1115 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>
1116 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>
1117 1082 </td>
1118 - </tr>
1119 1083 <tr>
1120 - <th scope="row"><label for="option_cache_timeout"><?php echo __('Expiration cache (minutes)','wp-hal');?></label></th>
1121 - <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 get_option('option_cache_timeout'); ?>"/><img alt="cache" src="<?php echo plugin_dir_url( __FILE__ ) ?>img/clock.svg" style="vertical-align:middle; width:32px; margin-left:2px; margin-right:2px;"/></td>
1122 - </tr>
1123 - <tr>
1124 - <th scope="row"><label for="option_erase_cache"><?php echo __('Reinitialiser le cache','wp-hal');?></label></th>
1125 - <td><input type="checkbox" name="option_erase_cache" id="option_erase_cache" value="1"/><img alt="option_erase_cache" src="<?php echo plugin_dir_url( __FILE__ ) ?>img/groom.svg" style="vertical-align:middle; width:32px; margin-left:2px; margin-right:2px;"/></td>
1126 - </tr>
1127 - <tr>
1128 - <th scope="row"><label for="option_email"><?php echo __('Email','wp-hal');?></label></th>
1084 + <th scope="row"><?php echo __('Email','wp-hal');?></th>
1129 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>
1130 1086 </tr>
1131 1087 <tr>
1132 - <th scope="row"><label for="option_tel"><?php echo __('Téléphone','wp-hal');?></label></th>
1088 + <th scope="row"><?php echo __('Téléphone','wp-hal');?></th>
1133 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>
1134 1090 </tr>
1135 1091 <tr>
1136 - <th><label for="option_social0">Facebook (http://www.facebook.com/)</label></th>
1092 + <th>Facebook (http://www.facebook.com/)</th>
1137 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>
1138 1094 </tr>
1139 1095 <tr>
1140 - <th><label for="option_social1">Twitter (http://www.twitter.com/)</label></th>
1096 + <th>Twitter (http://www.twitter.com/)</th>
1141 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>
1142 1098 </tr>
1143 1099 <tr>
1144 - <th><label for="option_social2">Google + (https://plus.google.com/u/0/+)</label></th>
1100 + <th>Google + (https://plus.google.com/u/0/+)</th>
1145 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>
1146 1102 </tr>
1147 1103 <tr>
1148 - <th><label for="option_social3">LinkedIn (https://www.linkedin.com/in/)</label></th>
1104 + <th>LinkedIn (https://www.linkedin.com/in/)</th>
1149 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>
1150 1106 </tr>
1151 1107 </table>
1152 1108 <?php
@@ -1181,8 +1137,6 @@
1181 1137 delete_option('option_social0');
1182 1138 delete_option('option_social1');
1183 1139 delete_option('option_social2');
1184 1140 delete_option('option_social3');
1185 - delete_option('option_cache_timeout');
1186 - delete_option('option_erase_cache');
1187 1141 }
1188 -?>
1142 +?>