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 +420 -624 2.22.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.2
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,76 +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 - * @param $url
101 - * @return object
102 - */
103 -function wphal_do_get_data($url) {
104 - $transient_id = 'hal_'.md5($url);
105 - if(!empty(get_option('option_erase_cache'))){
106 - // we reset cache transient for hal namespace
107 - wphal_clear_transients();
108 - update_option('option_erase_cache', '');
109 - }
110 - $cache_expiration = empty(get_option('option_cache_timeout')) ? 1 * DAY_IN_SECONDS : intval(get_option('option_cache_timeout')) * MINUTE_IN_SECONDS;
111 - if ( false === ( $value = get_transient( $transient_id ) ) ) {
112 - $json = wphal_do_common_curl_call($url);
113 - if($json)
114 - set_transient( $transient_id, $json, $cache_expiration);
115 - return $json;
116 - } else{
117 - return $value;
118 - }
119 -}
120 -
121 -/**
55 +/***********************************************************************************************************************
122 56 * PLUGIN SHORTCODE ND-DOC
123 - * @param $param
124 - * @return int
125 -*/
126 -function wphal_nb_doc($param)
57 + **********************************************************************************************************************/
58 +function nb_doc($param)
127 59 {
128 - $idhal = wphal_verifSolr(get_option('option_idhal'));
60 + $idhal = verifSolr(get_option('option_idhal'));
129 61 extract(shortcode_atts(array(
130 62 'type' => get_option('option_type'),
131 63 'id' => $idhal
132 64 ),
@@ -131,123 +63,126 @@
131 63 'id' => $idhal
132 64 ),
133 65 $param
134 66 ));
135 - /**
136 - * @var $id : defined by extract
137 - * @var string $type : defined by extract
138 - */
139 - $id = wphal_verifSolr($id);
67 + $id = verifSolr($id);
140 68
141 - $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 + );
142 78
143 - $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 +
144 85 return $json->response->numFound;
145 86 }
146 -/**
87 +/***********************************************************************************************************************
147 88 * PLUGIN SHORTCODE CV-HAL
148 - * @param $param
149 - * @return string
150 - */
151 -function wphal_cv_hal($param){
152 - $content = '';
153 - if ( !wphal_is_curl_installed() ) {
154 - $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';
155 93 } else {
156 - $possible_ids = ["authIdHal_s", "structId_i", "authStructId_i", "authId_i", "anrProjectId_i", "europeanProjectId_i", "collCode_s"];
157 - $option_choix = !empty(get_option('option_choix')) ? get_option('option_choix') : [];
158 - if(in_array('disciplines', $option_choix)){ //Lance les scripts pour le Graphique
159 - 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);
160 104
161 - wp_enqueue_script('wp-hal-script1');
162 - wp_enqueue_script('wp-hal-script2');
163 - wp_enqueue_script('wp-hal-script3');
164 - }
165 - $facetdomain = null;
166 -
167 - // those parameters are configured from plusing settings
168 - $default_id = wphal_verifSolr(get_option('option_idhal'));
169 - $default_type = get_option('option_type');
170 - $default_contact = get_option('option_infocontact');
171 - // here we merge with shortcode parameters
172 - extract(shortcode_atts(array(
173 - 'type' => $default_type,
174 - 'id' => $default_id,
175 - 'contact' => $default_contact
176 - ),
177 - $param
178 - ));
179 -
180 - /** @var $id : defined by extract
181 - * @var string $type : defined by extract
182 - * @var string $contact : defined by extract
183 - */
184 - if (!empty($id) && in_array($type, $possible_ids)) {
185 - $id = wphal_verifSolr($id);
186 -
187 105 if (get_option('option_groupe') == 'grouper') {
188 106 //cURL sur l'API pour récupérer les données
189 - $url = wphal_api . '?q=*:*&fq=' . $type . ':(' . urlencode($id) . ')&group=true&group.field=docType_s&group.limit=1000&fl=docid,citationFull_s&facet.field=' . wphal_lang . '_domainAllCodeLabel_fs&facet.field=keyword_s&facet.field=journalIdTitle_fs&facet.field=producedDateY_i&facet.field=authIdLastNameFirstName_fs&facet.field=instStructIdName_fs&facet.field=labStructIdName_fs&facet.field=deptStructIdName_fs&facet.field=rteamStructIdName_fs&facet.mincount=1&facet=true&sort=' . wphal_producedDateY . '&wt=json&json.nl=arrarr';
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';
190 108 } elseif (get_option('option_groupe') == 'paginer') {
191 - $url = wphal_api . '?q=*:*&fq=' . $type . ':(' . urlencode($id) . ')&fl=docid,citationFull_s&facet.field=' . wphal_lang . '_domainAllCodeLabel_fs&facet.field=keyword_s&facet.field=journalIdTitle_fs&facet.field=producedDateY_i&facet.field=authIdLastNameFirstName_fs&facet.field=instStructIdName_fs&facet.field=labStructIdName_fs&facet.field=deptStructIdName_fs&facet.field=rteamStructIdName_fs&facet.mincount=1&facet=true&sort=' . wphal_producedDateY . '&wt=json&json.nl=arrarr';
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';
192 110 }
193 111
194 - $json = wphal_do_get_data($url);
195 - $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 + );
196 120
197 - $content = '<div id="wphal-content">';
198 - if (is_array($option_choix) && !empty($option_choix)){
199 - $content .= '<ul id="wphal-menu">';
200 - $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);
201 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) {
202 140 $content .= '<li><a href="#filtres" onclick="return false;" style="font-size:18px; text-decoration: none; cursor:default;">' . __('Filtres', 'wp-hal') . '</a>';
203 141 $content .= '<ul id="wphal-filtres">';
204 - foreach ($option_choix as $option) {
205 - if ($option == 'contact') {
206 - $content .= '<li><a href="#contact" onclick="displayElem(\'wphal-contact\'); return false;" style="margin:1px; text-decoration: none;">' . __('Contact', 'wp-hal');
207 - $content .= '</a></li>';
208 - }
209 - if ($option == 'disciplines') {
210 - $content .= '<li><a href="#disciplines" onclick="displayElem(\'wphal-disciplines\'); return false;" style="margin:1px; text-decoration: none;">' . __('Disciplines', 'wp-hal');
211 - $content .= '</a></li>';
212 - }
213 - if ($option == 'mots-clefs') {
214 - $content .= '<li><a href="#keywords" onclick="displayElem(\'wphal-keywords\'); return false;" style="margin:1px; text-decoration: none;">' . __('Mots-clefs', 'wp-hal');
215 - $content .= '</a></li>';
216 - }
217 - if ($option == 'auteurs') {
218 - $content .= '<li><a href="#auteurs" onclick="displayElem(\'wphal-auteurs\'); return false;" style="margin:1px; text-decoration: none;">' . __('Auteurs', 'wp-hal');
219 - $content .= '</a></li>';
220 - }
221 - if ($option == 'revues') {
222 - $content .= '<li><a href="#revues" onclick="displayElem(\'wphal-revues\'); return false;" style="margin:1px; text-decoration: none;">' . __('Revues', 'wp-hal');
223 - $content .= '</a></li>';
224 - }
225 - if ($option == 'annee') {
226 - $content .= '<li><a href="#annees" onclick="displayElem(\'wphal-annees\'); return false;" style="margin:1px; text-decoration: none;">' . __('Année de production', 'wp-hal');
227 - $content .= '</a></li>';
228 - }
229 - if ($option == 'institution') {
230 - $content .= '<li><a href="#insts" onclick="displayElem(\'wphal-insts\'); return false;" style="margin:1px; text-decoration: none;">' . __('Institutions', 'wp-hal');
231 - $content .= '</a></li>';
232 - }
233 - if ($option == 'laboratoire') {
234 - $content .= '<li><a href="#labs" onclick="displayElem(\'wphal-labs\'); return false;" style="margin:1px; text-decoration: none;">' . __('Laboratoires', 'wp-hal');
235 - $content .= '</a></li>';
236 - }
237 - if ($option == 'departement') {
238 - $content .= '<li><a href="#depts" onclick="displayElem(\'wphal-depts\'); return false;" style="margin:1px; text-decoration: none;">' . __('Départements', 'wp-hal');
239 - $content .= '</a></li>';
240 - }
241 - if ($option == 'equipe') {
242 - $content .= '<li><a href="#equipes" onclick="displayElem(\'wphal-equipes\'); return false;" style="margin:1px; text-decoration: none;">' . __('Équipes de recherche', 'wp-hal');
243 - $content .= '</a></li>';
244 - }
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>';
245 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 + }
246 182 $content .= '</ul></li>';
247 -
248 - $content .= '</ul><br/><hr>';
249 183 }
184 + $content .= '</ul><br/><hr>';
250 185
251 186 $content .= '<div id="meta">
252 187 <div class="display" id="wphal-contact" style="display: none;">
253 188 <h3 class="wphal-titre">' . __('Contact', 'wp-hal');
@@ -255,11 +190,24 @@
255 190
256 191 <ul id="wphal-cont" style="list-style-type: none;">';
257 192
258 193 if ($contact == 'yes' && $type == 'authIdHal_s') {
259 - $urlauthor = wphal_urlauthor.'?indent=true&fq=valid_s:VALID&fl=idref_s,url_s,email_s,fullName_s,arxiv_s,idHal_s,viaf_s,isni_s,orcid_s,hasCV_bool&q=idHal_s:'.urlencode($id);
260 - $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 + );
261 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 +
262 210 for ($i = 0; $jsonauthor->response->docs[$i] != ''; $i++) {
263 211 $content .= '<div class="wphal-infocontact" id="wphal-infocontact'.$i.'">';
264 212 if ($jsonauthor->response->docs[$i]->fullName_s != '') {
265 213 $content .= '<li class="wphal-fullname"><span>Nom : </span><span>'. $jsonauthor->response->docs[$i]->fullName_s .'</span></li>';
@@ -264,55 +212,51 @@
264 212 if ($jsonauthor->response->docs[$i]->fullName_s != '') {
265 213 $content .= '<li class="wphal-fullname"><span>Nom : </span><span>'. $jsonauthor->response->docs[$i]->fullName_s .'</span></li>';
266 214 }
267 215 if ($jsonauthor->response->docs[$i]->email_s != '') {
268 - $content .= '<li class="wphal-email"><span>Email : </span><span><a href="'.esc_url('mailto:'. $jsonauthor->response->docs[$i]->email_s) .'">' . $jsonauthor->response->docs[$i]->email_s . '</a></span></li>';
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>';
269 217 }
270 218 if ($jsonauthor->response->docs[$i]->idHal_s != '') {
271 219 $content .= '<li class="wphal-idhal"><span>IdHAL : </span><span>' . $jsonauthor->response->docs[$i]->idHal_s . '</span></li>';
272 220 }
273 221 if ($jsonauthor->response->docs[$i]->hasCV_bool == true){
274 - $content .= '<li class="wphal-cvhal"><span>CV HAL : </span><a href="'.esc_url(cvhal. $jsonauthor->response->docs[$i]->idHal_s).'" target="_blank">CV de '.$jsonauthor->response->docs[$i]->fullName_s.'</a></li>';
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>';
275 223 }
276 224 if ($jsonauthor->response->docs[$i]->arxiv_s != '') {
277 - $content .= '<li class="wphal-"><span>arXiv : </span><span><a href="' . esc_url($jsonauthor->response->docs[$i]->arxiv_s) . '" target="_blank">' . substr(strrchr($jsonauthor->response->docs[$i]->arxiv_s, "/"), 1) . '</a></span></li>';
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>';
278 226 }
279 227 if ($jsonauthor->response->docs[$i]->idref_s != '') {
280 - $content .= '<li class="wphal-"><span>IdRef : </span><span><a href="' . esc_url($jsonauthor->response->docs[$i]->idref_s) . '" target="_blank">' . substr(strrchr($jsonauthor->response->docs[$i]->idref_s, "/"), 1) . '</a></span></li>';
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>';
281 229 }
282 230 if ($jsonauthor->response->docs[$i]->orcid_s != '') {
283 - $content .= '<li class="wphal-"><span>ORCID : </span><span><a href="' . esc_url($jsonauthor->response->docs[$i]->orcid_s) . '" target="_blank">' . substr(strrchr($jsonauthor->response->docs[$i]->orcid_s, "/"), 1) . '</a></span></li>';
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>';
284 232 }
285 233 if ($jsonauthor->response->docs[$i]->viaf_s != '') {
286 - $content .= '<li class="wphal-"><span>VIAF : </span><span><a href="' . esc_url($jsonauthor->response->docs[$i]->viaf_s) . '" target="_blank">' . substr(strrchr($jsonauthor->response->docs[$i]->viaf_s, "/"), 1) . '</a></span></li>';
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>';
287 235 }
288 236 if ($jsonauthor->response->docs[$i]->isni_s != '') {
289 - $content .= '<li class="wphal-"><span>ISNI : </span><span><a href="' . esc_url($jsonauthor->response->docs[$i]->isni_s) . '" target="_blank">' . substr(strrchr($jsonauthor->response->docs[$i]->isni_s, "/"), 1) . '</a></span></li>';
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>';
290 238 }
291 239 $content .= '</div>';
292 240 }
293 241 }
294 242 if (get_option('option_email') != '') {
295 - $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>';
296 244 }
297 245 if (get_option('option_tel') != '') {
298 - $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>';
299 247 }
300 248 if (get_option('option_social0') != '') {
301 - $content .= '<li><a href="'.esc_url('http://www.facebook.com/' . get_option('option_social0')) . '" target="_blank"><img
302 - 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>';
303 250 }
304 251 if (get_option('option_social1') != '') {
305 - $content .= '<li><a href="'.esc_url('http://www.twitter.com/' . get_option('option_social1')) . '" target="_blank"><img
306 - 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>';
307 253 }
308 254 if (get_option('option_social2') != '') {
309 - $content .= '<li><a href="'.esc_url('https://plus.google.com/u/0/+' . get_option('option_social2')) . '" target="_blank"><img
310 - 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>';
311 256 }
312 257 if (get_option('option_social3') != '') {
313 - $content .= '<li><a href="'.esc_url('https://www.linkedin.com/in/' . get_option('option_social3')) . '" target="_blank"><img
314 - 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>';
315 259 }
316 260 $content .= '</ul>
317 261 </div>
318 262 <div class="display" id="wphal-disciplines" style="display: none;">
@@ -317,11 +261,11 @@
317 261 </div>
318 262 <div class="display" id="wphal-disciplines" style="display: none;">
319 263 <h3 class="wphal-titre">' . __('Disciplines', 'wp-hal') . '</h3>';
320 264
321 - if (wphal_locale == 'fr_FR') {
265 + if (locale == 'fr_FR') {
322 266 $facetdomain = $json->facet_counts->facet_fields->fr_domainAllCodeLabel_fs;
323 - } elseif (wphal_locale == 'es_ES') {
267 + } elseif (locale == 'es_ES') {
324 268 $facetdomain = $json->facet_counts->facet_fields->es_domainAllCodeLabel_fs;
325 269 } else {
326 270 $facetdomain = $json->facet_counts->facet_fields->en_domainAllCodeLabel_fs;
327 271 }
@@ -326,17 +270,18 @@
326 270 $facetdomain = $json->facet_counts->facet_fields->en_domainAllCodeLabel_fs;
327 271 }
328 272
329 273 if (!is_null($facetdomain) && !empty($facetdomain)) {
274 +
330 275 $content .= '<div id="listdisci">';
331 276 $content .= '<span id="tridisciplines">';
332 - $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>';
333 - $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>';
334 279 $content .= '</span>';
335 280 $content .= '<ul id="wphal-discipline" class="wphal-discipline">';
336 281 foreach ($facetdomain as $res) {
337 - $name = explode(wphal_delimiter, $res[0]);
338 - $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>';
339 284 }
340 285 $content .= '</ul>';
341 286 $content .= '</div>';
342 287
@@ -342,15 +287,15 @@
342 287
343 288 $content .= '<div id="wphal-graph" style="display:none;">';
344 289 $content .= '<div id="wphal-piedisci"></div>';
345 290 $content .= '</div>';
346 - $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');
347 292 $content .= '</button>';
348 293 }
349 294 $content .= '</div>
350 295 <div class="display" id="wphal-keywords" style="display: none;">
351 296 <h3 class="wphal-titre">' . __('Mots-clefs', 'wp-hal') . '</h3>';
352 - 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)) {
353 298 $content .= '<div id="wphal-keys">';
354 299 $r = 0;
355 300 // CSS Nuage de mots
356 301 $maxsize = 25;
@@ -356,10 +301,8 @@
356 301 $maxsize = 25;
357 302 $minsize = 10;
358 303 $maxval = max(array_values($json->facet_counts->facet_fields->keyword_s[1]));
359 304 $minval = min(array_values($json->facet_counts->facet_fields->keyword_s[1]));
360 - if(!is_numeric($minval)) {$minval = 0;}
361 - if(!is_numeric($maxval)) {$maxval = 0;}
362 305 $spread = ($maxval - $minval);
363 306 $step = ($maxsize - $minsize) / $spread;
364 307 $tab = array();
365 308 foreach ($json->facet_counts->facet_fields->keyword_s as $res) {
@@ -371,25 +314,25 @@
371 314 }
372 315 asort($tab); // Tri du tableau par ordre alphabétique
373 316 foreach ($tab as $res) {
374 317 $size = round($minsize + (($res[1] - $minval) * $step));
375 - $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;';
376 319 }
377 320 $content .= '</div>';
378 321 $content .= '<div id="keysuite" style="display:none;">';
379 322 $content .= '<span id="trikeywords">';
380 - $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>';
381 - $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>';
382 325 $content .= '</span>';
383 326 $content .= '<ul class="wphal-keyword">';
384 327 $content .= '<div id="wphal-keyw">';
385 328 foreach ($json->facet_counts->facet_fields->keyword_s as $res) {
386 - $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>';
387 330 }
388 331 $content .= '</div>';
389 332 $content .= '</ul>';
390 333 $content .= '</div>';
391 - $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');
392 335 $content .= '</button>';
393 336 }
394 337 $content .= '</div>
395 338 <div class="display" id="wphal-auteurs" style="display: none;">
@@ -395,10 +338,10 @@
395 338 <div class="display" id="wphal-auteurs" style="display: none;">
396 339 <h3 class="wphal-titre">' . __('Auteurs', 'wp-hal') . '</h3>';
397 340 if (!is_null($json->facet_counts->facet_fields->authIdLastNameFirstName_fs) && !empty($json->facet_counts->facet_fields->authIdLastNameFirstName_fs)) {
398 341 $content .= '<span id="triauteurs">';
399 - $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>';
400 - $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>';
401 344 $content .= '</span>';
402 345 $content .= '<ul class="wphal-auteurs" style="list-style-type: none;">';
403 346 $content .= '<div id="wphal-aut">';
404 347 $r = 0;
@@ -406,10 +349,10 @@
406 349 $r = $r + 1;
407 350 if ($r > 10) {
408 351 break;
409 352 }
410 - $name = explode(wphal_delimiter, $res[0]);
411 - $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=authId_i:' . $name[0] . "+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>';
412 355 }
413 356 $i = 1;
414 357 $content .= '<div id="auteursuite" style="display:none;">';
415 358 foreach ($json->facet_counts->facet_fields->authIdLastNameFirstName_fs as $res) {
@@ -418,10 +361,10 @@
418 361 }
419 362 if ($i < $r) {
420 363 $i = $i + 1;
421 364 } else {
422 - $name = explode(wphal_delimiter, $res[0]);
423 - $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=authId_i:' . $name[0] . "+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>';
424 367 }
425 368 }
426 369 $content .= '</div>';
427 370 $content .= '</div>';
@@ -426,9 +369,9 @@
426 369 $content .= '</div>';
427 370 $content .= '</div>';
428 371 $content .= '</ul>';
429 372 if ($r > 10) {
430 - $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');
431 374 $content .= '</button>';
432 375 }
433 376 }
434 377 $content .= '</div>
@@ -435,10 +378,10 @@
435 378 <div class="display" id="wphal-revues" style="display: none;">
436 379 <h3 class="wphal-titre">' . __('Revues', 'wp-hal') . '</h3>';
437 380 if (!is_null($json->facet_counts->facet_fields->journalIdTitle_fs) && !empty($json->facet_counts->facet_fields->journalIdTitle_fs)) {
438 381 $content .= '<span id="trirevues">';
439 - $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>';
440 - $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>';
441 384 $content .= '</span>';
442 385 $content .= '<ul class="wphal-revues">';
443 386 $content .= '<div id="wphal-rev">';
444 387 $r = 0;
@@ -446,10 +389,10 @@
446 389 $r = $r + 1;
447 390 if ($r > 10) {
448 391 break;
449 392 }
450 - $name = explode(wphal_delimiter, $res[0]);
451 - $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>';
452 395 }
453 396 $i = 1;
454 397 $content .= '<div id="revuesuite" style="display:none;">';
455 398 foreach ($json->facet_counts->facet_fields->journalIdTitle_fs as $res) {
@@ -458,10 +401,10 @@
458 401 }
459 402 if ($i < $r) {
460 403 $i = $i + 1;
461 404 } else {
462 - $name = explode(wphal_delimiter, $res[0]);
463 - $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>';
464 407 }
465 408 }
466 409 $content .= '</div>';
467 410 $content .= '</div>';
@@ -466,9 +409,9 @@
466 409 $content .= '</div>';
467 410 $content .= '</div>';
468 411 $content .= '</ul>';
469 412 if ($r > 10) {
470 - $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');
471 414 $content .= '</button>';
472 415 }
473 416 }
474 417 $content .= '</div>
@@ -475,10 +418,10 @@
475 418 <div class="display" id="wphal-annees" style="display: none;">
476 419 <h3 class="wphal-titre">' . __('Année de production', 'wp-hal') . '</h3>';
477 420 if (!is_null($json->facet_counts->facet_fields->producedDateY_i) && !empty($json->facet_counts->facet_fields->producedDateY_i)) {
478 421 $content .= '<span id="triannees">';
479 - $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>';
480 - $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>';
481 424 $content .= '</span>';
482 425 $content .= '<ul class="wphal-annees">';
483 426 $content .= '<div id="wphal-an">';
484 427
@@ -488,9 +431,9 @@
488 431 $r = $r + 1;
489 432 if ($r > 10) {
490 433 break;
491 434 }
492 - $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>';
493 436 }
494 437 $i = 1;
495 438 $content .= '<div id="anneesuite" style="display:none;">';
496 439 foreach ($json->facet_counts->facet_fields->producedDateY_i as $res) {
@@ -499,9 +442,9 @@
499 442 }
500 443 if ($i < $r) {
501 444 $i = $i + 1;
502 445 } else {
503 - $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>';
504 447 }
505 448 }
506 449 $content .= '</div>';
507 450 $content .= '</div>';
@@ -506,9 +449,9 @@
506 449 $content .= '</div>';
507 450 $content .= '</div>';
508 451 $content .= '</ul>';
509 452 if ($r > 10) {
510 - $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');
511 454 $content .= '</button>';
512 455 }
513 456 }
514 457 $content .= '</div>
@@ -515,10 +458,10 @@
515 458 <div class="display" id="wphal-insts" style="display: none;">
516 459 <h3 class="wphal-titre">' . __('Institutions', 'wp-hal') . '</h3>';
517 460 if (!is_null($json->facet_counts->facet_fields->instStructIdName_fs) && !empty($json->facet_counts->facet_fields->instStructIdName_fs)) {
518 461 $content .= '<span id="triinsts">';
519 - $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>';
520 - $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>';
521 464 $content .= '</span>';
522 465 $content .= '<ul class="wphal-insts">';
523 466 $content .= '<div id="wphal-institu">';
524 467 $r = 0;
@@ -526,10 +469,10 @@
526 469 $r = $r + 1;
527 470 if ($r > 10) {
528 471 break;
529 472 }
530 - $name = explode(wphal_delimiter, $res[0]);
531 - $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>';
532 475 }
533 476 $i = 1;
534 477 $content .= '<div id="instsuite" style="display:none;">';
535 478 foreach ($json->facet_counts->facet_fields->instStructIdName_fs as $res) {
@@ -538,10 +481,10 @@
538 481 }
539 482 if ($i < $r) {
540 483 $i = $i + 1;
541 484 } else {
542 - $name = explode(wphal_delimiter, $res[0]);
543 - $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>';
544 487 }
545 488 }
546 489 $content .= '</div>';
547 490 $content .= '</div>';
@@ -546,9 +489,9 @@
546 489 $content .= '</div>';
547 490 $content .= '</div>';
548 491 $content .= '</ul>';
549 492 if ($r > 10) {
550 - $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');
551 494 $content .= '</button>';
552 495 }
553 496 }
554 497 $content .= '</div>
@@ -555,10 +498,10 @@
555 498 <div class="display" id="wphal-labs" style="display: none;">
556 499 <h3 class="wphal-titre">' . __('Laboratoires', 'wp-hal') . '</h3>';
557 500 if (!is_null($json->facet_counts->facet_fields->labStructIdName_fs) && !empty($json->facet_counts->facet_fields->labStructIdName_fs)) {
558 501 $content .= '<span id="trilabs">';
559 - $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>';
560 - $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>';
561 504 $content .= '</span>';
562 505 $content .= '<ul class="wphal-labs">';
563 506 $content .= '<div id="wphal-labo">';
564 507
@@ -567,10 +510,10 @@
567 510 $r = $r + 1;
568 511 if ($r > 10) {
569 512 break;
570 513 }
571 - $name = explode(wphal_delimiter, $res[0]);
572 - $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>';
573 516 }
574 517 $i = 1;
575 518 $content .= '<div id="labsuite" style="display:none;">';
576 519 foreach ($json->facet_counts->facet_fields->labStructIdName_fs as $res) {
@@ -579,10 +522,10 @@
579 522 }
580 523 if ($i < $r) {
581 524 $i = $i + 1;
582 525 } else {
583 - $name = explode(wphal_delimiter, $res[0]);
584 - $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>';
585 528 }
586 529 }
587 530 $content .= '</div>';
588 531 $content .= '</div>';
@@ -587,9 +530,9 @@
587 530 $content .= '</div>';
588 531 $content .= '</div>';
589 532 $content .= '</ul>';
590 533 if ($r > 10) {
591 - $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');
592 535 $content .= '</button>';
593 536 }
594 537 }
595 538 $content .= '</div>
@@ -596,10 +539,10 @@
596 539 <div class="display" id="wphal-depts" style="display: none;">
597 540 <h3 class="wphal-titre">' . __('Départements', 'wp-hal') . '</h3>';
598 541 if (!is_null($json->facet_counts->facet_fields->deptStructIdName_fs) && !empty($json->facet_counts->facet_fields->deptStructIdName_fs)) {
599 542 $content .= '<span id="tridept">';
600 - $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>';
601 - $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>';
602 545 $content .= '</span>';
603 546 $content .= '<ul class="wphal-depts">';
604 547 $content .= '<div id="wphal-dpt">';
605 548 $r = 0;
@@ -607,10 +550,10 @@
607 550 $r = $r + 1;
608 551 if ($r > 10) {
609 552 break;
610 553 }
611 - $name = explode(wphal_delimiter, $res[0]);
612 - $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>';
613 556 }
614 557 $i = 1;
615 558 $content .= '<div id="deptsuite" style="display:none;">';
616 559 foreach ($json->facet_counts->facet_fields->deptStructIdName_fs as $res) {
@@ -619,10 +562,10 @@
619 562 }
620 563 if ($i < $r) {
621 564 $i = $i + 1;
622 565 } else {
623 - $name = explode(wphal_delimiter, $res[0]);
624 - $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>';
625 568 }
626 569 }
627 570 $content .= '</div>';
628 571 $content .= '</div>';
@@ -627,9 +570,9 @@
627 570 $content .= '</div>';
628 571 $content .= '</div>';
629 572 $content .= '</ul>';
630 573 if ($r > 10) {
631 - $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');
632 575 $content .= '</button>';
633 576 }
634 577 }
635 578 $content .= '</div>
@@ -636,23 +579,22 @@
636 579 <div class="display" id="wphal-equipes" style="display: none;">
637 580 <h3 class="wphal-titre">' . __('Équipes de recherche', 'wp-hal') . '</h3>';
638 581 if (!is_null($json->facet_counts->facet_fields->rteamStructIdName_fs) && !empty($json->facet_counts->facet_fields->rteamStructIdName_fs)) {
639 582 $content .= '<span id="triequipe">';
640 - $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>';
641 - $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>';
642 585 $content .= '</span>';
643 586 $content .= '<ul class="wphal-equipes">';
644 587 $content .= '<div id="wphal-rteam">';
645 588
646 589 $r = 0;
647 - $name=[];
648 590 foreach ($json->facet_counts->facet_fields->rteamStructIdName_fs as $res) {
649 591 $r = $r + 1;
650 592 if ($r > 10) {
651 593 break;
652 594 }
653 - $name = explode(wphal_delimiter, $res[0]);
654 - $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>';
655 597 }
656 598 $i = 1;
657 599 $content .= '<div id="equipesuite" style="display:none;">';
658 600 foreach ($json->facet_counts->facet_fields->rteamStructIdName_fs as $res) {
@@ -661,10 +603,9 @@
661 603 }
662 604 if ($i < $r) {
663 605 $i = $i + 1;
664 606 } else {
665 - $name = explode(wphal_delimiter, $res[0]);
666 - $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>';
667 608 }
668 609 }
669 610 $content .= '</div>';
670 611 $content .= '</div>';
@@ -669,9 +610,9 @@
669 610 $content .= '</div>';
670 611 $content .= '</div>';
671 612 $content .= '</ul>';
672 613 if ($r > 10) {
673 - $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');
674 615 $content .= '</button>';
675 616 }
676 617 }
677 618 $content .= '</div>
@@ -676,9 +617,9 @@
676 617 }
677 618 $content .= '</div>
678 619 <div class="display" id="publications">';
679 620 if (get_option('option_groupe') == 'grouper') {
680 - $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');
681 622 $jsontype = json_decode($doctype);
682 623
683 624 //LISTE DES DOCUMENTS PAR GROUPE
684 625
@@ -683,13 +624,14 @@
683 624 //LISTE DES DOCUMENTS PAR GROUPE
684 625
685 626 $content .= '<div class="counter-doc"><span class="wphal-nbtot">' . $json->grouped->docType_s->matches . ' </span>';
686 627 $content .= __('documents', 'wp-hal'). '</div><br>';
687 - for ($i = 0; !empty($jsontype->response->result->doc[$i]); $i++) {
688 - 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++) {
689 631 if ($json->grouped->docType_s->groups[$d]->groupValue == $jsontype->response->result->doc[$i]->str[0]){
690 632 $titre = $jsontype->response->result->doc[$i]->str[1];
691 - $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>';
692 634 $content .= '<div class="grp-content">';
693 635 $content .= '<ul>';
694 636 foreach ($json->grouped->docType_s->groups[$d]->doclist->docs as $result) {
695 637 $content .= '<li>' . $result->citationFull_s . '</li>';
@@ -694,13 +636,14 @@
694 636 foreach ($json->grouped->docType_s->groups[$d]->doclist->docs as $result) {
695 637 $content .= '<li>' . $result->citationFull_s . '</li>';
696 638 }
697 639 $content .= '</ul></div>';
698 - $content .= '</div><br>';
640 + $content .= '</div></li><br>';
699 641 break;
700 642 }
701 643 }
702 644 }
645 + $content .= '</ul>';
703 646 } elseif (get_option('option_groupe') == 'paginer') {
704 647
705 648 //LISTE DES DOCUMENTS AVEC PAGINATION
706 649 $content .= '<div class="counter-doc"><span class="wphal-nbtot">' . $json->response->numFound . ' </span>';
@@ -712,10 +655,10 @@
712 655 $total = $json->response->numFound;
713 656
714 657 $nombreDePages = ceil($total / $messagesParPage);
715 658
716 - if (isset($hal_page)) {
717 - $pageActuelle = intval($hal_page);
659 + if (isset($paged)) {
660 + $pageActuelle = intval($paged);
718 661
719 662 if ($pageActuelle > $nombreDePages) {
720 663 $pageActuelle = $nombreDePages;
721 664 }
@@ -723,175 +666,124 @@
723 666 $pageActuelle = 1;
724 667 }
725 668 $premiereEntree = ($pageActuelle - 1) * $messagesParPage;
726 669
727 - $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';
728 - $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 + );
729 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 +
730 686 //--MODULE PAGINATION--//
731 - $count_results = count($json->response->docs);
732 - if($count_results>0) {
733 - $content .= '<ul>';
734 - for ( $i = 0; $i <= $count_results - 1; $i ++ ) {
735 - $content .= '<li>' . $json->response->docs[ $i ]->citationFull_s . '</li>';
736 - }
737 - $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>';
738 705 } else {
739 - $content = '<div> no results !</div>';
706 + $content .= '<li><a href="?paged=' . $precedent . '">&laquo;</a></li>';
740 707 }
741 - if($total> $messagesParPage) {
742 - //--AFFICHAGE PAGINATION--//
743 - $precedents = $pageActuelle - 2;
744 - $suivants = $pageActuelle + 2;
745 - $precedent = $pageActuelle - 1;
746 - $suivant = $pageActuelle + 1;
747 - $penultimate = $nombreDePages - 1;
748 -
749 - $content .= '<ul class="wphal-pagination">';
750 - //--BOUTON PRECEDENT--//
751 - if ( $pageActuelle != 1 ) {
752 - $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 + }
753 715 }
754 - if ( $nombreDePages <= 6 ) {// Cas 1 : 6 pages ou moins - Pas de troncature
755 - for ( $i = 1; $i <= $nombreDePages; $i ++ ) {
756 - 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) {
757 720 $content .= '<li class="active"><a href="#">' . $i . '</a></li>';
758 721 } else {
759 - $content .= ' <li><a href="?hal_page=' . $i . '">' . $i . '</a></li> ';
722 + $content .= '<li><a href="?paged=' . $i . '">' . $i . '</a></li>';
760 723 }
761 724 }
762 - } elseif ( $nombreDePages >= 7 ) {// Cas 2 : 7 pages ou plus - Troncature
763 - if ( $pageActuelle <= 3 ) {// Lorsque l'on est sur les trois premières pages
764 - for ( $i = 1; $i <= 4; $i ++ ) {
765 - if ( $i == $pageActuelle ) {
766 - $content .= '<li class="active"><a href="#">' . $i . '</a></li>';
767 - } else {
768 - $content .= '<li><a href="?hal_page=' . $i . '">' . $i . '</a></li>';
769 - }
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>';
770 749 }
771 - $content .= '<li class="disabled"><a href="#">&hellip;</a></li>';
772 - $content .= '<li><a href="?hal_page=' . $penultimate . '">' . $penultimate . '</a></li>';
773 - $content .= '<li><a href="?hal_page=' . $nombreDePages . '">' . $nombreDePages . '</a></li>';
774 750 }
775 - if ( $pageActuelle >= 4 && $pageActuelle <= $penultimate - 2 ) {//Lorsque l'on arrive sur la quatrième page
776 - $content .= '<li><a href="?hal_page=">1</a></li>';
777 - $content .= '<li class="disabled"><a href="#">&hellip;</a></li>';
778 - $content .= '<li><a href="?hal_page=' . $precedents . '">' . $precedents . '</a></li>';
779 - $content .= '<li><a href="?hal_page=' . $precedent . '">' . $precedent . '</a></li>';
780 - $content .= '<li class="active"><a href="#">' . $pageActuelle . '</a></li>';
781 - $content .= '<li><a href="?hal_page=' . $suivant . '">' . $suivant . '</a></li>';
782 - $content .= '<li><a href="?hal_page=' . $suivants . '">' . $suivants . '</a></li>';
783 - $content .= '<li class="disabled"><a href="#">&hellip;</a></li>';
784 - $content .= '<li><a href="?hal_page=' . $nombreDePages . '">' . $nombreDePages . '</a></li>';
785 - }
786 - if ( $pageActuelle >= $penultimate - 1 ) {
787 - $content .= '<li><a href="?hal_page=1">1</a></li>';
788 - $content .= '<li><a href="?hal_page=2">2</a></li>';
789 - $content .= '<li class="disabled"><a href="#">&hellip;</a></li>';
790 - for ( $i = $penultimate - 2; $i <= $nombreDePages; $i ++ ) {
791 - if ( $i == $pageActuelle ) {
792 - $content .= '<li class="active"><a href="#">' . $i . '</a></li>';
793 - } else {
794 - $content .= '<li><a href="?hal_page=' . $i . '">' . $i . '</a></li>';
795 - }
796 - }
797 - }
798 751 }
799 - //--BOUTON SUIVANT--//
800 - if ( $pageActuelle < $nombreDePages ) {
801 - $content .= '<li><a href="?hal_page=' . $suivant . '">&raquo;</a></li>';
802 - }
803 - $content .= '</ul>';
804 - //--AFFICHAGE PAGINATION--//
805 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--//
806 761 }
807 762 $content .= '</div>
808 763 </div>
809 764 </div>';
810 - }else{
811 - $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>';
812 765 }
813 766 $content .= '<div class="wphal-footer">';
814 - $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.svg').'" style="width:32px;"></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>';
815 768 $content .= '</div>';
816 769
817 770 //--AFFICHAGE GRAPHIQUE DOMAINE--//
818 771 if (!is_null($facetdomain)) {
819 772 foreach ($facetdomain as $res) {
820 - $name = explode(wphal_delimiter, $res[0])[1];
773 + $name = explode(delimiter, $res[0])[1];
821 774 $value = $res[1];
822 775 $array[] = array($name, $value);
823 776 }
824 - wp_localize_script('wp-hal-script4', 'WPWallSettings', $array);
825 777 }
778 + wp_localize_script('wp-hal-script4', 'WPWallSettings', json_encode($array));
826 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'));
827 780 wp_localize_script('wp-hal-script4', 'translate', $translation);
828 781 }
829 - // tags other that those will be stripped
830 - $allowed_html_tags = array(
831 - 'div' => array(
832 - 'class' => array(),
833 - 'id' => array(),
834 - 'style' => array(),
835 - ),
836 - "span"=> array(
837 - 'class' => array(),
838 - 'id' => array(),
839 - 'style' => array(),
840 - ),
841 - "img"=> array(
842 - 'alt' => array(),
843 - 'src' => array(),
844 - 'style' => array(),
845 -
846 - ),
847 - 'p' => array(
848 - 'style' => array(),
849 - 'id' => array(),
850 - ),
851 - 'h3' => array(
852 - 'id' => array(),
853 - 'class' => array(),
854 - 'style' => array()
855 - ),
856 - 'a' => array(
857 - 'href' => array(),
858 - 'target' => array(),
859 - 'title' => array(),
860 - 'id' => array(),
861 - 'class' => array(),
862 - 'style' => array(),
863 - 'onclick' => array(),
864 - ),
865 - 'ul' => array(
866 - 'class' => array(),
867 - 'id' => array(),
868 - 'style' => array(),
869 - ),
870 - 'li' => array(
871 - 'class' => array(),
872 - 'id' => array(),
873 - 'data-percentage' => array()
874 - ),
875 - 'button' => array(
876 - 'class' => array(),
877 - 'id' => array(),
878 - 'type' => array(),
879 - 'style' => array(),
880 - 'onclick' => array()
881 - )
882 - ,'br' => array()
883 - ,'hr' => array()
884 - ,'i' => array(),
885 - );
886 - add_filter( 'safe_style_css', function( $styles ) {
887 - $styles[] = 'display';
888 - return $styles;
889 - } );
890 - return wp_kses($content, $allowed_html_tags);
782 + return $content;
891 783 }
892 784
893 -function wphal_verifSolr($values){
785 +function verifSolr($values){
894 786 $verifsolr = explode(',',$values);
895 787 $numverif = count($verifsolr);
896 788 $solrsql = '';
897 789 if ($numverif<1024){
@@ -910,16 +802,17 @@
910 802
911 803 return $solrsql;
912 804 }
913 805
914 -function wphal_adding_style() {
806 +function wp_adding_style() {
915 807 wp_register_style('wp-hal-style1', plugins_url('/css/style.css', __FILE__));
916 808 wp_register_style('wp-hal-style2', plugins_url('/css/jquery.jqplot.css', __FILE__));
917 809
918 810 wp_enqueue_style('wp-hal-style1');
811 + wp_enqueue_style('wp-hal-style2');
919 812 }
920 813
921 -function wphal_adding_script() {
814 +function wp_adding_script() {
922 815 wp_register_script('wp-hal-script1',plugins_url('/js/jquery.jqplot.js', __FILE__));
923 816 wp_register_script('wp-hal-script2',plugins_url('/js/jqplot.highlighter.js', __FILE__));
924 817 wp_register_script('wp-hal-script3',plugins_url('/js/jqplot.pieRenderer.js', __FILE__));
925 818 wp_register_script('wp-hal-script4',plugins_url('/js/cv-hal.js', __FILE__));
@@ -925,8 +818,11 @@
925 818 wp_register_script('wp-hal-script4',plugins_url('/js/cv-hal.js', __FILE__));
926 819
927 820
928 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');
929 825 wp_enqueue_script('wp-hal-script4', false, array(), false, true);
930 826 }
931 827
932 828 /**
@@ -931,17 +827,17 @@
931 827
932 828 /**
933 829 * Récupère les fichiers css et js
934 830 */
935 -if ( wphal_is_curl_installed() ) {
936 - add_action('wp_enqueue_scripts', 'wphal_adding_style');
937 - 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');
938 834 }
939 835
940 836 /**
941 837 * Charge lorsque le plugin est désactivé
942 838 */
943 -register_deactivation_hook( __FILE__, 'wphal_reset_option' );
839 +register_deactivation_hook( __FILE__, 'reset_option' );
944 840
945 841 /**
946 842 * Ajoute le widget wphal à l'initialisation des widgets
947 843 */
@@ -957,9 +853,9 @@
957 853 */
958 854 function wphal_menu() {
959 855 add_menu_page( 'Options', 'Hal', 'manage_options', 'wp-hal.php', 'wphal_option' , '', 21);
960 856
961 - add_action( 'admin_init', 'wphal_register_settings' );
857 + add_action( 'admin_init', 'register_settings' );
962 858 }
963 859
964 860
965 861 /**
@@ -977,12 +873,14 @@
977 873 * Classe du widget wphal
978 874 */
979 875
980 876 class wphal_widget extends WP_widget{
877 +
878 +
981 879 /**
982 880 * Défini les propriétés du widget
983 881 */
984 - function __construct(){
882 + function wphal_widget(){
985 883 $options = array(
986 884 "classname" => "wphal-publications",
987 885 "description" => __("Afficher les dernières publications d'un auteur ou d'une structure.", 'wp-hal')
988 886 );
@@ -988,9 +886,9 @@
988 886 );
989 887
990 888 parent::__construct(
991 889 'hal-publications',
992 - __("Publications HAL", 'wp-hal'),
890 + __("Publications récentes", 'wp-hal'),
993 891 $options
994 892 );
995 893 }
996 894
@@ -999,71 +897,51 @@
999 897 * @param $args
1000 898 * @param $instance
1001 899 */
1002 900 function widget($args, $instance){
1003 - if(isset($instance['idhal']) && !empty($instance['idhal'])) {
1004 - $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';
1005 903 extract($args);
1006 - /**
1007 - * @var $before_widget : defined by extract
1008 - * @var $before_title : defined by extract
1009 - * @var $after_title : defined by extract
1010 - * @var $after_widget : defined by extract
1011 - */
1012 - if (!wphal_is_curl_installed()) {
1013 - $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']);
1014 910
1015 - } else {
1016 - $instance['idhal'] = wphal_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';
1017 912
1018 - $url = wphal_api . '?q=*:*&fq=' . $instance['select'] . ':' . urlencode($instance['idhal']) . '&fl=uri_s,' . $instance['typetext'] . '&sort=' . wphal_producedDateY . '&rows=' . $instance['nbdoc'] . '&wt=json';
1019 - $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 + );
1020 921
1021 - $count_results = count($json->response->docs);
1022 - if ($count_results > 0) {
1023 - $content = '<ul class="widhal-ul">';
1024 - for ($i = 0; $i < $count_results - 1; $i++) {
1025 - if ($instance['typetext'] == 'citationRef_s') {
1026 - $typetext = $json->response->docs[$i]->citationRef_s;
1027 - } else {
1028 - $typetext = $json->response->docs[$i]->title_s[0];
1029 - }
1030 - $content .= '<li class="widhal-li"><a href="' . esc_url($json->response->docs[$i]->uri_s) . '" target="_blank">' . $typetext . '</a></li>';
1031 - }
1032 - $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;
1033 932 } else {
1034 - $content = '<div> no results !</div>';
933 + $typetext = $json->response->docs[$i]->title_s[0];
1035 934 }
935 + $content .= '<li class="widhal-li"><a href="' . $json->response->docs[$i]->uri_s . '" target="_blank">' . $typetext . '</a></li>';
1036 936 }
1037 - // tags other that those will be stripped
1038 - $allowed_html_tags = array(
1039 - 'div' => array(
1040 - 'class' => array(),
1041 - 'id' => array(),
1042 - ),
1043 - 'h2' => array(),
1044 - 'section' => array(),
1045 - 'a' => array(
1046 - 'href' => array(),
1047 - 'target' => array(),
1048 - 'title' => array(),
1049 - 'id' => array(),
1050 - 'class' => array(),
1051 - ),
1052 - 'ul' => array(
1053 - 'class' => array(),
1054 - 'id' => array(),
1055 - ),
1056 - 'li' => array(
1057 - 'class' => array(),
1058 - 'id' => array(),
1059 - )
1060 - );
1061 - $widget_block = $before_widget;
1062 - $widget_block .= $before_title . $instance['titre'] . $after_title;
1063 - $widget_block .= $content;
1064 - $widget_block .= $after_widget;
1065 - 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;
1066 944 }
1067 945 }
1068 946
1069 947 /**
@@ -1071,15 +949,9 @@
1071 949 * @param $new
1072 950 * @param $old
1073 951 */
1074 952 function update($new, $old){
1075 - //the id must be provided
1076 - if(isset($new['idhal']) && !empty($new['idhal'])) {
1077 - $new['idhal'] = wphal_sanitize_username($new['idhal']);
1078 - $new['nbdoc'] = wphal_sanitize_id($new['nbdoc']);
1079 - return $new;
1080 - }else
1081 - return false;
953 + return $new;
1082 954 }
1083 955
1084 956 /**
1085 957 * Formulaire du widget
@@ -1087,46 +959,43 @@
1087 959 */
1088 960 function form($instance){
1089 961
1090 962 $defaut = array(
1091 - 'titre' => __("Publications Hal", 'wp-hal'),
963 + 'titre' => __("Publications récentes", 'wp-hal'),
1092 964 'select' => "authIdHal_s",
1093 965 'typetext' => "title_s",
1094 - 'idhal' => "",
1095 966 'nbdoc' => 5
1096 967 );
1097 968 $instance = wp_parse_args($instance,$defaut);
1098 969 ?>
1099 970 <p>
1100 - <label for="<?php echo esc_attr($this->get_field_id("titre"));?>"><?php echo esc_html(__('Titre','wp-hal')) .' :'?></label>
1101 - <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"/>
1102 973 </p>
1103 974 <p>
1104 - <label for="<?php echo esc_attr($this->get_field_id("nbdoc"));?>"><?php echo esc_html(__("Nombre de documents affichés",'wp-hal')) .' :'?></label>
1105 - <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">
1106 977 </p>
1107 978 <p>
1108 - <label for="<?php echo esc_attr($this->get_field_id("typetext"));?>"><?php echo esc_html(__("Type d'affichage",'wp-hal')) .' :'?></label>
1109 - <select id="<?php echo esc_attr($this->get_field_id("typetext"));?>" name="<?php echo esc_attr($this->get_field_name("typetext"));?>">
1110 - <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>
1111 - <option id="<?php echo esc_attr($this->get_field_id("Citation"));?>" value="citationRef_s" <?php echo esc_attr(($instance["typetext"] == "citationRef_s")?'selected':''); ?>><label for="<?php echo esc_attr($this->get_field_id("Citation"));?>"><?php echo esc_html(__("Citation", 'wp-hal'), [])?></label></option>
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>
1112 983 </select>
1113 984 </p>
1114 985 <p>
1115 - <label for="<?php echo esc_attr($this->get_field_id("select"));?>"><?php echo esc_html(__("Type d'Id",'wp-hal') .' :')?></label>
1116 - <select id="<?php echo esc_attr($this->get_field_id("select"));?>" name="<?php echo esc_attr($this->get_field_name("select"));?>">
1117 - <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>
1118 - <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>
1119 - <option id="<?php echo esc_attr($this->get_field_id("AuthorStructId"));?>" value="authStructId_i" <?php echo esc_attr(($instance["select"] == "authStructId_i")?'selected':''); ?>><label for="<?php echo esc_attr($this->get_field_id("AuthorStructId"));?>">AuthorStruct Id</label><span style="font-style: italic;"> <?php echo esc_html(__('(Exemple : 413106)','wp-hal'));?></span></option>
1120 - <option id="<?php echo esc_attr($this->get_field_id("AuthorId"));?>" value="authId_i" <?php echo esc_attr(($instance["select"] == "authId_i")?'selected':''); ?>><label for="<?php echo esc_attr($this->get_field_id("AuthorId"));?>">Author Id</label><span style="font-style: italic;"> <?php echo esc_html(__('(Exemple : 413106)','wp-hal'));?></span></option>
1121 - <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>
1122 - <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>
1123 - <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>
1124 993 </select>
1125 994 </p>
1126 995 <p>
1127 - <label for="<?php echo esc_attr($this->get_field_id("idhal"));?>"><?php echo esc_html(__("Id",'wp-hal')) .' :'?></label>
1128 - <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"/>
1129 998 </p>
1130 999 <?php
1131 1000 }
1132 1001 }
@@ -1131,79 +1000,21 @@
1131 1000 }
1132 1001 }
1133 1002
1134 1003
1135 -function wphal_sanitize_id( $input ){
1136 - if(is_numeric($input)){
1137 - return $input;
1138 - }
1139 -}
1140 -
1141 -function wphal_sanitize_username($input)
1142 -{
1143 - $allowed = array(".", "-", "_"); // you can add here more value, you want to allow.
1144 - if(ctype_alnum(str_replace($allowed, '', $input ))) {
1145 - return $input;
1146 - }
1147 -}
1148 -
1149 -function wphal_sanitize_phone( $input ){
1150 - $phone_num = $input;
1151 - $phone_num = preg_replace('/[^0-9]/', '', $phone_num);
1152 - if(strlen($phone_num) === 10) {
1153 - //Phone is 10 characters in length
1154 - return $input;
1155 - }
1156 -}
1157 -
1158 -
1159 -function wphal_register_settings() {
1004 +function register_settings() {
1160 1005 register_setting( 'wphal_option', 'option_choix' );
1161 1006 register_setting( 'wphal_option', 'option_type' );
1162 1007 register_setting( 'wphal_option', 'option_groupe' );
1163 - register_setting( 'wphal_option', 'option_idhal' , array(
1164 - 'type' => 'string',
1165 - 'sanitize_callback' => 'wphal_sanitize_username',
1166 - 'default' => NULL,
1167 - ));
1008 + register_setting( 'wphal_option', 'option_idhal' );
1168 1009 register_setting( 'wphal_option', 'option_lang' );
1169 1010 register_setting( 'wphal_option', 'option_infocontact' );
1170 - register_setting( 'wphal_option', 'option_email' , array(
1171 - 'type' => 'string',
1172 - 'sanitize_callback' => 'sanitize_email',
1173 - 'default' => NULL,
1174 - ));
1175 - register_setting( 'wphal_option', 'option_tel' , array(
1176 - 'type' => 'string',
1177 - 'sanitize_callback' => 'wphal_sanitize_phone',
1178 - 'default' => NULL,
1179 - ));
1180 - register_setting( 'wphal_option', 'option_social0' , array(
1181 - 'type' => 'string',
1182 - 'sanitize_callback' => 'wphal_sanitize_username',
1183 - 'default' => NULL,
1184 - ));
1185 - register_setting( 'wphal_option', 'option_social1' , array(
1186 - 'type' => 'string',
1187 - 'sanitize_callback' => 'wphal_sanitize_username',
1188 - 'default' => NULL,
1189 - ));
1190 - register_setting( 'wphal_option', 'option_social2' , array(
1191 - 'type' => 'string',
1192 - 'sanitize_callback' => 'wphal_sanitize_username',
1193 - 'default' => NULL,
1194 - ));
1195 - register_setting( 'wphal_option', 'option_social3' , array(
1196 - 'type' => 'string',
1197 - 'sanitize_callback' => 'wphal_sanitize_username',
1198 - 'default' => NULL,
1199 - ));
1200 - register_setting( 'wphal_option', 'option_cache_timeout' , array(
1201 - 'type' => 'string',
1202 - 'sanitize_callback' => 'wphal_sanitize_id',
1203 - 'default' => NULL,
1204 - ));
1205 - 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' );
1206 1017 }
1207 1018
1208 1019 /**
1209 1020 * Crée le menu d'option du plugin
@@ -1217,9 +1028,9 @@
1217 1028 update_option('option_groupe', 'paginer');
1218 1029 }
1219 1030 ?>
1220 1031 <div class="wrap">
1221 - <h2><?php echo esc_html(__('Plugin HAL','wp-hal'));?></h2>
1032 + <h2><?php echo __('Plugin HAL','wp-hal');?></h2>
1222 1033 <form method="post" enctype="multipart/form-data" action="options.php">
1223 1034 <div id="poststuff">
1224 1035 <div id="post-body" class="metabox-holder columns-2">
1225 1036 <div id="post-body-content">
@@ -1225,87 +1036,75 @@
1225 1036 <div id="post-body-content">
1226 1037 <?php settings_fields( 'wphal_option' ); ?>
1227 1038 <?php do_settings_sections( 'wphal_option' ); ?>
1228 1039 <table class="form-table">
1229 - <tr style="vertical-align:top;">
1230 - <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>
1231 1042 </tr>
1232 - <tr style="vertical-align:top;">
1233 - <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>
1234 1045 <td><select name="option_type">
1235 - <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>
1236 - <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>
1237 - <option id="AuthorStructId" value="authStructId_i" <?php echo esc_attr(((get_option('option_type') == "authStructId_i")?'selected':'')); ?>><label for="AuthorStructId">AuthorStruct Id</label><span style="font-style: italic;"> <?php echo esc_html(__('(Exemple : 413106)','wp-hal'));?></span></option>
1238 - <option id="AuthorId" value="authId_i" <?php echo esc_attr(((get_option('option_type') == "authId_i")?'selected':'')); ?>><label for="AuthorId">Author Id</label><span style="font-style: italic;"> <?php echo esc_html(__('(Exemple : 413106)','wp-hal'));?></span></option>
1239 - <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>
1240 - <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>
1241 - <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>
1242 1051 </select>
1243 - <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'); ?>"/>
1244 1053 </td>
1245 1054 </tr>
1246 - <tr style="vertical-align:top;">
1247 - <th scope="row"><?php echo esc_html(__('Affichage des documents','wp-hal'));?></th>
1248 - <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>
1249 - <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>
1250 1059 </td>
1251 1060 </tr>
1252 - <tr style="vertical-align:top;">
1253 - <th scope="row"><?php echo esc_html(__('Choix des éléments menu','wp-hal'));?></th>
1254 - <?php $option_choix = get_option('option_choix'); ?>
1255 - <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/>
1256 - <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/>
1257 - <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/>
1258 - <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/>
1259 - <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/>
1260 - <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/>
1261 - <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/>
1262 - <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/>
1263 - <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/>
1264 - <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>
1265 1073 </td>
1266 1074 </tr>
1267 - <tr style="vertical-align:top;">
1268 - <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>
1269 1077 </tr>
1270 1078 <tr>
1271 - <th scope="row"><?php echo esc_html(__("Afficher les informations d'un chercheur ayant un IdHal ?",'wp-hal'));?></th>
1272 - <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>
1273 - <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>
1274 1082 </td>
1275 - </tr>
1276 1083 <tr>
1277 - <th scope="row"><label for="option_cache_timeout"><?php echo esc_html(__('Expiration cache (minutes)','wp-hal'));?></label></th>
1278 - <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>
1279 1086 </tr>
1280 1087 <tr>
1281 - <th scope="row"><label for="option_erase_cache"><?php echo esc_html(__('Reinitialiser le cache','wp-hal'));?></label></th>
1282 - <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>
1283 1090 </tr>
1284 1091 <tr>
1285 - <th scope="row"><label for="option_email"><?php echo esc_html(__('Email','wp-hal'));?></label></th>
1286 - <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>
1287 1094 </tr>
1288 1095 <tr>
1289 - <th scope="row"><label for="option_tel"><?php echo esc_html(__('Téléphone','wp-hal'));?></label></th>
1290 - <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>
1291 1098 </tr>
1292 1099 <tr>
1293 - <th><label for="option_social0">Facebook (http://www.facebook.com/)</label></th>
1294 - <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>
1295 1102 </tr>
1296 1103 <tr>
1297 - <th><label for="option_social1">Twitter (http://www.twitter.com/)</label></th>
1298 - <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>
1299 1106 </tr>
1300 - <tr>
1301 - <th><label for="option_social2">Google + (https://plus.google.com/u/0/+)</label></th>
1302 - <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>
1303 - </tr>
1304 - <tr>
1305 - <th><label for="option_social3">LinkedIn (https://www.linkedin.com/in/)</label></th>
1306 - <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>
1307 - </tr>
1308 1107 </table>
1309 1108 <?php
1310 1109 submit_button(__('Enregistrer','wp-hal'), 'primary large', 'submit', true); ?>
1311 1110 </div>
@@ -1325,9 +1124,9 @@
1325 1124
1326 1125 /**
1327 1126 * Reset les données Hal
1328 1127 */
1329 -function wphal_reset_option() {
1128 +function reset_option() {
1330 1129 delete_option('option_choix');
1331 1130 delete_option('option_type');
1332 1131 delete_option('option_groupe');
1333 1132 delete_option('option_idhal');
@@ -1338,9 +1137,6 @@
1338 1137 delete_option('option_social0');
1339 1138 delete_option('option_social1');
1340 1139 delete_option('option_social2');
1341 1140 delete_option('option_social3');
1342 - delete_option('option_cache_timeout');
1343 - delete_option('option_erase_cache');
1344 1141 }
1345 -
1346 -?>
1142 +?>