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 +216 -200 2.0.102.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.0.10
7 - * Author: CCSD
6 + * Version: 2.0
7 + * Author: Baptiste Blondelle
8 8 * Author URI: http://www.ccsd.cnrs.fr
9 9 * Text Domain: wp-hal
10 10 * Domain Path: /lang/
11 11 */
@@ -47,47 +47,15 @@
47 47
48 48 return $links;
49 49 }
50 50
51 -add_filter( 'query_vars', 'hal_query_vars' );
52 -function hal_query_vars( $query_vars ) {
53 - $query_vars[] = 'hal_page';
54 - return $query_vars;
55 -}
56 51
57 52 add_filter( 'plugin_action_links', 'hal_plugin_action_links',10,2);
58 -/**
59 - * @param $url
60 - * @return object
61 - */
62 -function do_common_curl_call($url) {
63 - $ch = curl_init($url);
64 - // Options
65 - $options = array(
66 - CURLOPT_RETURNTRANSFER => true,
67 - CURLOPT_HTTPHEADER => array('Content-type: application/json'),
68 - CURLOPT_TIMEOUT => 10,
69 - CURLOPT_USERAGENT => "HAL Plugin Wordpress " . version
70 - );
71 - if(defined('WP_PROXY_HOST') && defined('WP_PROXY_PORT') && defined('WP_PROXY_USERNAME') && defined('WP_PROXY_PASSWORD')){
72 - curl_setopt($ch, CURLOPT_PROXY, WP_PROXY_HOST);
73 - curl_setopt($ch, CURLOPT_PROXYPORT, WP_PROXY_PORT);
74 - curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
75 - curl_setopt($ch, CURLOPT_PROXYUSERPWD, WP_PROXY_USERNAME.':'.WP_PROXY_PASSWORD);
76 - }
77 - // Bind des options et de l'objet cURL que l'on va utiliser
78 - curl_setopt_array($ch, $options);
79 - // Récupération du résultat JSON
80 - $json = json_decode(curl_exec($ch));
81 - curl_close($ch);
82 - return $json;
83 -}
84 53
85 -/**
54 +
55 +/***********************************************************************************************************************
86 56 * PLUGIN SHORTCODE ND-DOC
87 - * @param $param
88 - * @return int
89 -*/
57 + **********************************************************************************************************************/
90 58 function nb_doc($param)
91 59 {
92 60 $idhal = verifSolr(get_option('option_idhal'));
93 61 extract(shortcode_atts(array(
@@ -95,39 +63,35 @@
95 63 'id' => $idhal
96 64 ),
97 65 $param
98 66 ));
99 - /**
100 - * @var $id : defined by extract
101 - * @var string $type : defined by extract
102 - */
103 67 $id = verifSolr($id);
104 68
105 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 + );
106 78
107 - $json =do_common_curl_call($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 +
108 85 return $json->response->numFound;
109 86 }
110 -/**
87 +/***********************************************************************************************************************
111 88 * PLUGIN SHORTCODE CV-HAL
112 - * @param $param
113 - * @return string
114 - */
89 + **********************************************************************************************************************/
115 90 function cv_hal($param){
116 91 if ( !function_exists('curl_init' ) ) {
117 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';
118 93 } else {
119 -
120 - if(in_array('disciplines', get_option('option_choix'))){ //Lance les scripts pour le Graphique
121 - wp_enqueue_style('wp-hal-style2');
122 -
123 - wp_enqueue_script('wp-hal-script1');
124 - wp_enqueue_script('wp-hal-script2');
125 - wp_enqueue_script('wp-hal-script3');
126 - }
127 - $content = '';
128 - $facetdomain = null;
129 -
130 94 if (get_option('option_idhal') != '') {
131 95 $idhal = verifSolr(get_option('option_idhal'));
132 96 extract(shortcode_atts(array(
133 97 'type' => get_option('option_type'),
@@ -135,12 +99,8 @@
135 99 'contact' => get_option('option_infocontact')
136 100 ),
137 101 $param
138 102 ));
139 - /** @var $id : defined by extract
140 - * @var string $type : defined by extract
141 - * @var string $contact : defined by extract
142 - */
143 103 $id = verifSolr($id);
144 104
145 105 if (get_option('option_groupe') == 'grouper') {
146 106 //cURL sur l'API pour récupérer les données
@@ -148,60 +108,78 @@
148 108 } elseif (get_option('option_groupe') == 'paginer') {
149 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';
150 110 }
151 111
152 - $json = do_common_curl_call($url);
112 + $ch = curl_init($url);
113 + // Options
114 + $options = array(
115 + CURLOPT_RETURNTRANSFER => true,
116 + CURLOPT_HTTPHEADER => array('Content-type: application/json'),
117 + CURLOPT_TIMEOUT => 10,
118 + CURLOPT_USERAGENT => "HAL Plugin Wordpress " . version
119 + );
153 120
154 - $hal_page = (get_query_var('hal_page')) ? get_query_var('hal_page') : 1;
121 + // Bind des options et de l'objet cURL que l'on va utiliser
122 + curl_setopt_array($ch, $options);
123 + // Récupération du résultat JSON
124 + $json = json_decode(curl_exec($ch));
125 + curl_close($ch);
155 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 +
156 136 $content = '<div id="wphal-content">
157 137 <ul id="wphal-menu">';
158 138 $content .= '<li><a href="#publications" onclick="displayElem(\'publications\'); return false;" style="font-size:18px; text-decoration: none;">' . __('Publications', 'wp-hal') . '</a></li>';
159 - if (is_array(get_option('option_choix'))) {
139 + if ($choix != 0) {
160 140 $content .= '<li><a href="#filtres" onclick="return false;" style="font-size:18px; text-decoration: none; cursor:default;">' . __('Filtres', 'wp-hal') . '</a>';
161 141 $content .= '<ul id="wphal-filtres">';
162 - foreach (get_option('option_choix') as $option) {
163 - if ($option == 'contact') {
164 - $content .= '<li><a href="#contact" onclick="displayElem(\'wphal-contact\'); return false;" style="margin:1px; text-decoration: none;">' . __('Contact', 'wp-hal');
165 - $content .= '</a></li>';
166 - }
167 - if ($option == 'disciplines') {
168 - $content .= '<li><a href="#disciplines" onclick="displayElem(\'wphal-disciplines\'); return false;" style="margin:1px; text-decoration: none;">' . __('Disciplines', 'wp-hal');
169 - $content .= '</a></li>';
170 - }
171 - if ($option == 'mots-clefs') {
172 - $content .= '<li><a href="#keywords" onclick="displayElem(\'wphal-keywords\'); return false;" style="margin:1px; text-decoration: none;">' . __('Mots-clefs', 'wp-hal');
173 - $content .= '</a></li>';
174 - }
175 - if ($option == 'auteurs') {
176 - $content .= '<li><a href="#auteurs" onclick="displayElem(\'wphal-auteurs\'); return false;" style="margin:1px; text-decoration: none;">' . __('Auteurs', 'wp-hal');
177 - $content .= '</a></li>';
178 - }
179 - if ($option == 'revues') {
180 - $content .= '<li><a href="#revues" onclick="displayElem(\'wphal-revues\'); return false;" style="margin:1px; text-decoration: none;">' . __('Revues', 'wp-hal');
181 - $content .= '</a></li>';
182 - }
183 - if ($option == 'annee') {
184 - $content .= '<li><a href="#annees" onclick="displayElem(\'wphal-annees\'); return false;" style="margin:1px; text-decoration: none;">' . __('Année de production', 'wp-hal');
185 - $content .= '</a></li>';
186 - }
187 - if ($option == 'institution') {
188 - $content .= '<li><a href="#insts" onclick="displayElem(\'wphal-insts\'); return false;" style="margin:1px; text-decoration: none;">' . __('Institutions', 'wp-hal');
189 - $content .= '</a></li>';
190 - }
191 - if ($option == 'laboratoire') {
192 - $content .= '<li><a href="#labs" onclick="displayElem(\'wphal-labs\'); return false;" style="margin:1px; text-decoration: none;">' . __('Laboratoires', 'wp-hal');
193 - $content .= '</a></li>';
194 - }
195 - if ($option == 'departement') {
196 - $content .= '<li><a href="#depts" onclick="displayElem(\'wphal-depts\'); return false;" style="margin:1px; text-decoration: none;">' . __('Départements', 'wp-hal');
197 - $content .= '</a></li>';
198 - }
199 - if ($option == 'equipe') {
200 - $content .= '<li><a href="#equipes" onclick="displayElem(\'wphal-equipes\'); return false;" style="margin:1px; text-decoration: none;">' . __('Équipes de recherche', 'wp-hal');
201 - $content .= '</a></li>';
202 - }
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>';
203 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 + }
204 182 $content .= '</ul></li>';
205 183 }
206 184 $content .= '</ul><br/><hr>';
207 185
@@ -213,10 +191,23 @@
213 191 <ul id="wphal-cont" style="list-style-type: none;">';
214 192
215 193 if ($contact == 'yes' && $type == 'authIdHal_s') {
216 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);
217 - $jsonauthor = do_common_curl_call($urlauthor);
195 + $ch = curl_init($urlauthor);
196 + // Options
197 + $options = array(
198 + CURLOPT_RETURNTRANSFER => true,
199 + CURLOPT_HTTPHEADER => array('Content-type: application/json'),
200 + CURLOPT_TIMEOUT => 10,
201 + CURLOPT_USERAGENT => "HAL Plugin Wordpress " . version
202 + );
218 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 +
219 210 for ($i = 0; $jsonauthor->response->docs[$i] != ''; $i++) {
220 211 $content .= '<div class="wphal-infocontact" id="wphal-infocontact'.$i.'">';
221 212 if ($jsonauthor->response->docs[$i]->fullName_s != '') {
222 213 $content .= '<li class="wphal-fullname"><span>Nom : </span><span>'. $jsonauthor->response->docs[$i]->fullName_s .'</span></li>';
@@ -254,22 +245,18 @@
254 245 if (get_option('option_tel') != '') {
255 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>';
256 247 }
257 248 if (get_option('option_social0') != '') {
258 - $content .= '<li><a href="http://www.facebook.com/' . get_option('option_social0') . '" target="_blank"><img
259 - alt="Facebook" src=" ' . plugin_dir_url(__FILE__) . 'img/facebook.svg" style="width:32px; margin:4px;"/></a></li>';
249 + $content .= '<li><a href="http://www.facebook.com/' . get_option('option_social0') . '" target="_blank"><img src=" ' . plugin_dir_url(__FILE__) . 'img/facebook.svg" style="width:32px; margin:4px;"/></a></li>';
260 250 }
261 251 if (get_option('option_social1') != '') {
262 - $content .= '<li><a href="http://www.twitter.com/' . get_option('option_social1') . '" target="_blank"><img
263 - alt="Twitter" src=" ' . plugin_dir_url(__FILE__) . 'img/twitter.svg" style="width:32px; margin:4px;"/></a></li>';
252 + $content .= '<li><a href="http://www.twitter.com/' . get_option('option_social1') . '" target="_blank"><img src=" ' . plugin_dir_url(__FILE__) . 'img/twitter.svg" style="width:32px; margin:4px;"/></a></li>';
264 253 }
265 254 if (get_option('option_social2') != '') {
266 - $content .= '<li><a href="https://plus.google.com/u/0/+' . get_option('option_social2') . '" target="_blank"><img
267 - alt="Google+" src=" ' . plugin_dir_url(__FILE__) . 'img/google-plus.svg" style="width:32px; margin:4px;"/></a></li>';
255 + $content .= '<li><a href="https://plus.google.com/u/0/+' . get_option('option_social2') . '" target="_blank"><img src=" ' . plugin_dir_url(__FILE__) . 'img/google-plus.svg" style="width:32px; margin:4px;"/></a></li>';
268 256 }
269 257 if (get_option('option_social3') != '') {
270 - $content .= '<li><a href="https://www.linkedin.com/in/' . get_option('option_social3') . '" target="_blank"><img
271 - alt="LinkedIn" src=" ' . plugin_dir_url(__FILE__) . 'img/linkedin.svg" style="width:32px; margin:4px;"/></a></li>';
258 + $content .= '<li><a href="https://www.linkedin.com/in/' . get_option('option_social3') . '" target="_blank"><img src=" ' . plugin_dir_url(__FILE__) . 'img/linkedin.svg" style="width:32px; margin:4px;"/></a></li>';
272 259 }
273 260 $content .= '</ul>
274 261 </div>
275 262 <div class="display" id="wphal-disciplines" style="display: none;">
@@ -283,12 +270,13 @@
283 270 $facetdomain = $json->facet_counts->facet_fields->en_domainAllCodeLabel_fs;
284 271 }
285 272
286 273 if (!is_null($facetdomain) && !empty($facetdomain)) {
274 +
287 275 $content .= '<div id="listdisci">';
288 276 $content .= '<span id="tridisciplines">';
289 - $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>';
290 - $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>';
291 279 $content .= '</span>';
292 280 $content .= '<ul id="wphal-discipline" class="wphal-discipline">';
293 281 foreach ($facetdomain as $res) {
294 282 $name = explode(delimiter, $res[0]);
@@ -299,15 +287,15 @@
299 287
300 288 $content .= '<div id="wphal-graph" style="display:none;">';
301 289 $content .= '<div id="wphal-piedisci"></div>';
302 290 $content .= '</div>';
303 - $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');
304 292 $content .= '</button>';
305 293 }
306 294 $content .= '</div>
307 295 <div class="display" id="wphal-keywords" style="display: none;">
308 296 <h3 class="wphal-titre">' . __('Mots-clefs', 'wp-hal') . '</h3>';
309 - 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)) {
310 298 $content .= '<div id="wphal-keys">';
311 299 $r = 0;
312 300 // CSS Nuage de mots
313 301 $maxsize = 25;
@@ -313,10 +301,8 @@
313 301 $maxsize = 25;
314 302 $minsize = 10;
315 303 $maxval = max(array_values($json->facet_counts->facet_fields->keyword_s[1]));
316 304 $minval = min(array_values($json->facet_counts->facet_fields->keyword_s[1]));
317 - if(!is_numeric($minval)) {$minval = 0;}
318 - if(!is_numeric($maxval)) {$maxval = 0;}
319 305 $spread = ($maxval - $minval);
320 306 $step = ($maxsize - $minsize) / $spread;
321 307 $tab = array();
322 308 foreach ($json->facet_counts->facet_fields->keyword_s as $res) {
@@ -333,10 +319,10 @@
333 319 }
334 320 $content .= '</div>';
335 321 $content .= '<div id="keysuite" style="display:none;">';
336 322 $content .= '<span id="trikeywords">';
337 - $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>';
338 - $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>';
339 325 $content .= '</span>';
340 326 $content .= '<ul class="wphal-keyword">';
341 327 $content .= '<div id="wphal-keyw">';
342 328 foreach ($json->facet_counts->facet_fields->keyword_s as $res) {
@@ -344,9 +330,9 @@
344 330 }
345 331 $content .= '</div>';
346 332 $content .= '</ul>';
347 333 $content .= '</div>';
348 - $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');
349 335 $content .= '</button>';
350 336 }
351 337 $content .= '</div>
352 338 <div class="display" id="wphal-auteurs" style="display: none;">
@@ -352,10 +338,10 @@
352 338 <div class="display" id="wphal-auteurs" style="display: none;">
353 339 <h3 class="wphal-titre">' . __('Auteurs', 'wp-hal') . '</h3>';
354 340 if (!is_null($json->facet_counts->facet_fields->authIdLastNameFirstName_fs) && !empty($json->facet_counts->facet_fields->authIdLastNameFirstName_fs)) {
355 341 $content .= '<span id="triauteurs">';
356 - $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>';
357 - $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>';
358 344 $content .= '</span>';
359 345 $content .= '<ul class="wphal-auteurs" style="list-style-type: none;">';
360 346 $content .= '<div id="wphal-aut">';
361 347 $r = 0;
@@ -383,9 +369,9 @@
383 369 $content .= '</div>';
384 370 $content .= '</div>';
385 371 $content .= '</ul>';
386 372 if ($r > 10) {
387 - $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');
388 374 $content .= '</button>';
389 375 }
390 376 }
391 377 $content .= '</div>
@@ -392,10 +378,10 @@
392 378 <div class="display" id="wphal-revues" style="display: none;">
393 379 <h3 class="wphal-titre">' . __('Revues', 'wp-hal') . '</h3>';
394 380 if (!is_null($json->facet_counts->facet_fields->journalIdTitle_fs) && !empty($json->facet_counts->facet_fields->journalIdTitle_fs)) {
395 381 $content .= '<span id="trirevues">';
396 - $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>';
397 - $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>';
398 384 $content .= '</span>';
399 385 $content .= '<ul class="wphal-revues">';
400 386 $content .= '<div id="wphal-rev">';
401 387 $r = 0;
@@ -423,9 +409,9 @@
423 409 $content .= '</div>';
424 410 $content .= '</div>';
425 411 $content .= '</ul>';
426 412 if ($r > 10) {
427 - $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');
428 414 $content .= '</button>';
429 415 }
430 416 }
431 417 $content .= '</div>
@@ -432,10 +418,10 @@
432 418 <div class="display" id="wphal-annees" style="display: none;">
433 419 <h3 class="wphal-titre">' . __('Année de production', 'wp-hal') . '</h3>';
434 420 if (!is_null($json->facet_counts->facet_fields->producedDateY_i) && !empty($json->facet_counts->facet_fields->producedDateY_i)) {
435 421 $content .= '<span id="triannees">';
436 - $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>';
437 - $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>';
438 424 $content .= '</span>';
439 425 $content .= '<ul class="wphal-annees">';
440 426 $content .= '<div id="wphal-an">';
441 427
@@ -463,9 +449,9 @@
463 449 $content .= '</div>';
464 450 $content .= '</div>';
465 451 $content .= '</ul>';
466 452 if ($r > 10) {
467 - $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');
468 454 $content .= '</button>';
469 455 }
470 456 }
471 457 $content .= '</div>
@@ -472,10 +458,10 @@
472 458 <div class="display" id="wphal-insts" style="display: none;">
473 459 <h3 class="wphal-titre">' . __('Institutions', 'wp-hal') . '</h3>';
474 460 if (!is_null($json->facet_counts->facet_fields->instStructIdName_fs) && !empty($json->facet_counts->facet_fields->instStructIdName_fs)) {
475 461 $content .= '<span id="triinsts">';
476 - $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>';
477 - $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>';
478 464 $content .= '</span>';
479 465 $content .= '<ul class="wphal-insts">';
480 466 $content .= '<div id="wphal-institu">';
481 467 $r = 0;
@@ -503,9 +489,9 @@
503 489 $content .= '</div>';
504 490 $content .= '</div>';
505 491 $content .= '</ul>';
506 492 if ($r > 10) {
507 - $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');
508 494 $content .= '</button>';
509 495 }
510 496 }
511 497 $content .= '</div>
@@ -512,10 +498,10 @@
512 498 <div class="display" id="wphal-labs" style="display: none;">
513 499 <h3 class="wphal-titre">' . __('Laboratoires', 'wp-hal') . '</h3>';
514 500 if (!is_null($json->facet_counts->facet_fields->labStructIdName_fs) && !empty($json->facet_counts->facet_fields->labStructIdName_fs)) {
515 501 $content .= '<span id="trilabs">';
516 - $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>';
517 - $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>';
518 504 $content .= '</span>';
519 505 $content .= '<ul class="wphal-labs">';
520 506 $content .= '<div id="wphal-labo">';
521 507
@@ -544,9 +530,9 @@
544 530 $content .= '</div>';
545 531 $content .= '</div>';
546 532 $content .= '</ul>';
547 533 if ($r > 10) {
548 - $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');
549 535 $content .= '</button>';
550 536 }
551 537 }
552 538 $content .= '</div>
@@ -553,10 +539,10 @@
553 539 <div class="display" id="wphal-depts" style="display: none;">
554 540 <h3 class="wphal-titre">' . __('Départements', 'wp-hal') . '</h3>';
555 541 if (!is_null($json->facet_counts->facet_fields->deptStructIdName_fs) && !empty($json->facet_counts->facet_fields->deptStructIdName_fs)) {
556 542 $content .= '<span id="tridept">';
557 - $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>';
558 - $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>';
559 545 $content .= '</span>';
560 546 $content .= '<ul class="wphal-depts">';
561 547 $content .= '<div id="wphal-dpt">';
562 548 $r = 0;
@@ -584,9 +570,9 @@
584 570 $content .= '</div>';
585 571 $content .= '</div>';
586 572 $content .= '</ul>';
587 573 if ($r > 10) {
588 - $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');
589 575 $content .= '</button>';
590 576 }
591 577 }
592 578 $content .= '</div>
@@ -593,16 +579,15 @@
593 579 <div class="display" id="wphal-equipes" style="display: none;">
594 580 <h3 class="wphal-titre">' . __('Équipes de recherche', 'wp-hal') . '</h3>';
595 581 if (!is_null($json->facet_counts->facet_fields->rteamStructIdName_fs) && !empty($json->facet_counts->facet_fields->rteamStructIdName_fs)) {
596 582 $content .= '<span id="triequipe">';
597 - $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>';
598 - $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>';
599 585 $content .= '</span>';
600 586 $content .= '<ul class="wphal-equipes">';
601 587 $content .= '<div id="wphal-rteam">';
602 588
603 589 $r = 0;
604 - $name=[];
605 590 foreach ($json->facet_counts->facet_fields->rteamStructIdName_fs as $res) {
606 591 $r = $r + 1;
607 592 if ($r > 10) {
608 593 break;
@@ -625,9 +610,9 @@
625 610 $content .= '</div>';
626 611 $content .= '</div>';
627 612 $content .= '</ul>';
628 613 if ($r > 10) {
629 - $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');
630 615 $content .= '</button>';
631 616 }
632 617 }
633 618 $content .= '</div>
@@ -639,13 +624,14 @@
639 624 //LISTE DES DOCUMENTS PAR GROUPE
640 625
641 626 $content .= '<div class="counter-doc"><span class="wphal-nbtot">' . $json->grouped->docType_s->matches . ' </span>';
642 627 $content .= __('documents', 'wp-hal'). '</div><br>';
628 + $content .= '<ul style="list-style-type: none;">';
643 629 for ($i = 0; $jsontype->response->result->doc[$i] != null; $i++) {
644 630 for ($d = 0; $json->grouped->docType_s->groups[$d] != null; $d++) {
645 631 if ($json->grouped->docType_s->groups[$d]->groupValue == $jsontype->response->result->doc[$i]->str[0]){
646 632 $titre = $jsontype->response->result->doc[$i]->str[1];
647 - $content .= '<div class="grp-div"><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>';
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>';
648 634 $content .= '<div class="grp-content">';
649 635 $content .= '<ul>';
650 636 foreach ($json->grouped->docType_s->groups[$d]->doclist->docs as $result) {
651 637 $content .= '<li>' . $result->citationFull_s . '</li>';
@@ -650,13 +636,14 @@
650 636 foreach ($json->grouped->docType_s->groups[$d]->doclist->docs as $result) {
651 637 $content .= '<li>' . $result->citationFull_s . '</li>';
652 638 }
653 639 $content .= '</ul></div>';
654 - $content .= '</div><br>';
640 + $content .= '</div></li><br>';
655 641 break;
656 642 }
657 643 }
658 644 }
645 + $content .= '</ul>';
659 646 } elseif (get_option('option_groupe') == 'paginer') {
660 647
661 648 //LISTE DES DOCUMENTS AVEC PAGINATION
662 649 $content .= '<div class="counter-doc"><span class="wphal-nbtot">' . $json->response->numFound . ' </span>';
@@ -668,10 +655,10 @@
668 655 $total = $json->response->numFound;
669 656
670 657 $nombreDePages = ceil($total / $messagesParPage);
671 658
672 - if (isset($hal_page)) {
673 - $pageActuelle = intval($hal_page);
659 + if (isset($paged)) {
660 + $pageActuelle = intval($paged);
674 661
675 662 if ($pageActuelle > $nombreDePages) {
676 663 $pageActuelle = $nombreDePages;
677 664 }
@@ -680,10 +667,23 @@
680 667 }
681 668 $premiereEntree = ($pageActuelle - 1) * $messagesParPage;
682 669
683 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';
684 - $json = do_common_curl_call($url);
671 + $ch = curl_init($url);
672 +// Options
673 + $options = array(
674 + CURLOPT_RETURNTRANSFER => true,
675 + CURLOPT_HTTPHEADER => array('Content-type: application/json'),
676 + CURLOPT_TIMEOUT => 10,
677 + CURLOPT_USERAGENT => "HAL Plugin Wordpress " . version
678 + );
685 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 +
686 686 //--MODULE PAGINATION--//
687 687
688 688 $content .= '<ul>';
689 689 for ($i = 0; $json->response->docs[$i] != ''; $i++) {
@@ -702,9 +702,9 @@
702 702 //--BOUTON PRECEDENT--//
703 703 if ($pageActuelle == 1) {
704 704 $content .= '<li class="disabled"><a href="#">&laquo;</a></li>';
705 705 } else {
706 - $content .= '<li><a href="?hal_page=' . $precedent . '">&laquo;</a></li>';
706 + $content .= '<li><a href="?paged=' . $precedent . '">&laquo;</a></li>';
707 707 }
708 708 if ($nombreDePages <= 6) {// Cas 1 : 6 pages ou moins - Pas de troncature
709 709 for ($i = 1; $i <= $nombreDePages; $i++) {
710 710 if ($i == $pageActuelle) {
@@ -709,9 +709,9 @@
709 709 for ($i = 1; $i <= $nombreDePages; $i++) {
710 710 if ($i == $pageActuelle) {
711 711 $content .= '<li class="active"><a href="#">' . $i . '</a></li>';
712 712 } else {
713 - $content .= ' <li><a href="?hal_page=' . $i . '">' . $i . '</a></li> ';
713 + $content .= ' <li><a href="?paged=' . $i . '">' . $i . '</a></li> ';
714 714 }
715 715 }
716 716 } elseif ($nombreDePages >= 7) {// Cas 2 : 7 pages ou plus - Troncature
717 717 if ($pageActuelle <= 3) {// Lorsque l'on est sur les trois premières pages
@@ -718,35 +718,35 @@
718 718 for ($i = 1; $i <= 4; $i++) {
719 719 if ($i == $pageActuelle) {
720 720 $content .= '<li class="active"><a href="#">' . $i . '</a></li>';
721 721 } else {
722 - $content .= '<li><a href="?hal_page=' . $i . '">' . $i . '</a></li>';
722 + $content .= '<li><a href="?paged=' . $i . '">' . $i . '</a></li>';
723 723 }
724 724 }
725 725 $content .= '<li class="disabled"><a href="#">&hellip;</a></li>';
726 - $content .= '<li><a href="?hal_page=' . $penultimate . '">' . $penultimate . '</a></li>';
727 - $content .= '<li><a href="?hal_page=' . $nombreDePages . '">' . $nombreDePages . '</a></li>';
726 + $content .= '<li><a href="?paged=' . $penultimate . '">' . $penultimate . '</a></li>';
727 + $content .= '<li><a href="?paged=' . $nombreDePages . '">' . $nombreDePages . '</a></li>';
728 728 }
729 729 if ($pageActuelle >= 4 && $pageActuelle <= $penultimate - 2) {//Lorsque l'on arrive sur la quatrième page
730 - $content .= '<li><a href="?hal_page=">1</a></li>';
730 + $content .= '<li><a href="?paged=">1</a></li>';
731 731 $content .= '<li class="disabled"><a href="#">&hellip;</a></li>';
732 - $content .= '<li><a href="?hal_page=' . $precedents . '">' . $precedents . '</a></li>';
733 - $content .= '<li><a href="?hal_page=' . $precedent . '">' . $precedent . '</a></li>';
732 + $content .= '<li><a href="?paged=' . $precedents . '">' . $precedents . '</a></li>';
733 + $content .= '<li><a href="?paged=' . $precedent . '">' . $precedent . '</a></li>';
734 734 $content .= '<li class="active"><a href="#">' . $pageActuelle . '</a></li>';
735 - $content .= '<li><a href="?hal_page=' . $suivant . '">' . $suivant . '</a></li>';
736 - $content .= '<li><a href="?hal_page=' . $suivants . '">' . $suivants . '</a></li>';
735 + $content .= '<li><a href="?paged=' . $suivant . '">' . $suivant . '</a></li>';
736 + $content .= '<li><a href="?paged=' . $suivants . '">' . $suivants . '</a></li>';
737 737 $content .= '<li class="disabled"><a href="#">&hellip;</a></li>';
738 - $content .= '<li><a href="?hal_page=' . $nombreDePages . '">' . $nombreDePages . '</a></li>';
738 + $content .= '<li><a href="?paged=' . $nombreDePages . '">' . $nombreDePages . '</a></li>';
739 739 }
740 740 if ($pageActuelle >= $penultimate - 1) {
741 - $content .= '<li><a href="?hal_page=1">1</a></li>';
742 - $content .= '<li><a href="?hal_page=2">2</a></li>';
741 + $content .= '<li><a href="?paged=1">1</a></li>';
742 + $content .= '<li><a href="?paged=2">2</a></li>';
743 743 $content .= '<li class="disabled"><a href="#">&hellip;</a></li>';
744 744 for ($i = $penultimate - 2; $i <= $nombreDePages; $i++) {
745 745 if ($i == $pageActuelle) {
746 746 $content .= '<li class="active"><a href="#">' . $i . '</a></li>';
747 747 } else {
748 - $content .= '<li><a href="?hal_page=' . $i . '">' . $i . '</a></li>';
748 + $content .= '<li><a href="?paged=' . $i . '">' . $i . '</a></li>';
749 749 }
750 750 }
751 751 }
752 752 }
@@ -751,9 +751,9 @@
751 751 }
752 752 }
753 753 //--BOUTON SUIVANT--//
754 754 if ($pageActuelle < $nombreDePages) {
755 - $content .= '<li><a href="?hal_page=' . $suivant . '">&raquo;</a></li>';
755 + $content .= '<li><a href="?paged=' . $suivant . '">&raquo;</a></li>';
756 756 } else {
757 757 $content .= '<li class="disabled"><a href="#">&raquo;</a></li>';
758 758 }
759 759 $content .= '</ul>';
@@ -807,8 +807,9 @@
807 807 wp_register_style('wp-hal-style1', plugins_url('/css/style.css', __FILE__));
808 808 wp_register_style('wp-hal-style2', plugins_url('/css/jquery.jqplot.css', __FILE__));
809 809
810 810 wp_enqueue_style('wp-hal-style1');
811 + wp_enqueue_style('wp-hal-style2');
811 812 }
812 813
813 814 function wp_adding_script() {
814 815 wp_register_script('wp-hal-script1',plugins_url('/js/jquery.jqplot.js', __FILE__));
@@ -817,8 +818,11 @@
817 818 wp_register_script('wp-hal-script4',plugins_url('/js/cv-hal.js', __FILE__));
818 819
819 820
820 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');
821 825 wp_enqueue_script('wp-hal-script4', false, array(), false, true);
822 826 }
823 827
824 828 /**
@@ -869,12 +873,14 @@
869 873 * Classe du widget wphal
870 874 */
871 875
872 876 class wphal_widget extends WP_widget{
877 +
878 +
873 879 /**
874 880 * Défini les propriétés du widget
875 881 */
876 - function __construct(){
882 + function wphal_widget(){
877 883 $options = array(
878 884 "classname" => "wphal-publications",
879 885 "description" => __("Afficher les dernières publications d'un auteur ou d'une structure.", 'wp-hal')
880 886 );
@@ -880,9 +886,9 @@
880 886 );
881 887
882 888 parent::__construct(
883 889 'hal-publications',
884 - __("Publications HAL", 'wp-hal'),
890 + __("Publications récentes", 'wp-hal'),
885 891 $options
886 892 );
887 893 }
888 894
@@ -891,24 +897,35 @@
891 897 * @param $args
892 898 * @param $instance
893 899 */
894 900 function widget($args, $instance){
895 - extract($args);
896 - /**
897 - * @var $before_widget : defined by extract
898 - * @var $before_title : defined by extract
899 - * @var $after_title : defined by extract
900 - * @var $after_widget : defined by extract
901 - */
902 901 if ( !function_exists('curl_init' ) ) {
903 902 $content = 'Please check the <a href="https://wordpress.org/plugins/hal/faq/" target="_blank" id="FAQ">FAQ</a> with the code : CURL';
904 -
903 + extract($args);
904 + echo $before_widget;
905 + echo $before_title . $instance['titre'] . $after_title;
906 + echo $content;
907 + echo $after_widget;
905 908 } else {
906 909 $instance['idhal'] = verifSolr($instance['idhal']);
907 910
908 911 $url = api . '?q=*:*&fq=' . $instance['select'] . ':' . urlencode($instance['idhal']) . '&fl=uri_s,'. $instance['typetext'] .'&sort=' . producedDateY . '&rows=' . $instance['nbdoc'] . '&wt=json';
909 - $json = do_common_curl_call($url);
910 912
913 + $ch = curl_init($url);
914 + // Options
915 + $options = array(
916 + CURLOPT_RETURNTRANSFER => true,
917 + CURLOPT_HTTPHEADER => array('Content-type: application/json'),
918 + CURLOPT_TIMEOUT => 10,
919 + CURLOPT_USERAGENT => "HAL Plugin Wordpress " . version
920 + );
921 +
922 + // Bind des options et de l'objet cURL que l'on va utiliser
923 + curl_setopt_array($ch, $options);
924 + // Récupération du résultat JSON
925 + $json = json_decode(curl_exec($ch));
926 + curl_close($ch);
927 +
911 928 $content = '<ul class="widhal-ul">';
912 929 for ($i = 0; $i < $instance['nbdoc']; $i++) {
913 930 if ($instance['typetext']=='citationRef_s') {
914 931 $typetext = $json->response->docs[$i]->citationRef_s;
@@ -917,13 +934,15 @@
917 934 }
918 935 $content .= '<li class="widhal-li"><a href="' . $json->response->docs[$i]->uri_s . '" target="_blank">' . $typetext . '</a></li>';
919 936 }
920 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;
921 944 }
922 - echo $before_widget;
923 - echo $before_title . $instance['titre'] . $after_title;
924 - echo $content;
925 - echo $after_widget;
926 945 }
927 946
928 947 /**
929 948 * Sauvegarde des données
@@ -940,9 +959,9 @@
940 959 */
941 960 function form($instance){
942 961
943 962 $defaut = array(
944 - 'titre' => __("Publications Hal", 'wp-hal'),
963 + 'titre' => __("Publications récentes", 'wp-hal'),
945 964 'select' => "authIdHal_s",
946 965 'typetext' => "title_s",
947 966 'nbdoc' => 5
948 967 );
@@ -966,11 +985,9 @@
966 985 <p>
967 986 <label for="<?php echo $this->get_field_id("select");?>"><?php echo __("Type d'Id",'wp-hal') .' :'?></label>
968 987 <select id="<?php echo $this->get_field_id("select");?>" name="<?php echo $this->get_field_name("select");?>">
969 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>
970 - <option id="<?php echo $this->get_field_id("StructId");?>" value="structId_i" <?php echo ($instance["select"] == "structId_i")?'selected':''; ?>><label for="<?php echo $this->get_field_id("StructId");?>">Struct Id</label><span style="font-style: italic;"> <?php echo __('(Exemple : 413106)','wp-hal');?></span></option>
971 - <option id="<?php echo $this->get_field_id("AuthorStructId");?>" value="authStructId_i" <?php echo ($instance["select"] == "authStructId_i")?'selected':''; ?>><label for="<?php echo $this->get_field_id("AuthorStructId");?>">AuthorStruct Id</label><span style="font-style: italic;"> <?php echo __('(Exemple : 413106)','wp-hal');?></span></option>
972 - <option id="<?php echo $this->get_field_id("AuthorId");?>" value="authId_i" <?php echo ($instance["select"] == "authId_i")?'selected':''; ?>><label for="<?php echo $this->get_field_id("AuthorId");?>">Author Id</label><span style="font-style: italic;"> <?php echo __('(Exemple : 413106)','wp-hal');?></span></option>
989 + <option id="<?php echo $this->get_field_id("Structid");?>" value="authStructId_i" <?php echo ($instance["select"] == "authStructId_i")?'selected':''; ?>><label for="<?php echo $this->get_field_id("Structid");?>">Struct Id</label><span style="font-style: italic;"> <?php echo __('(Exemple : 129)','wp-hal');?></span></option>
973 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>
974 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>
975 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>
976 993 </select>
@@ -982,8 +999,9 @@
982 999 <?php
983 1000 }
984 1001 }
985 1002
1003 +
986 1004 function register_settings() {
987 1005 register_setting( 'wphal_option', 'option_choix' );
988 1006 register_setting( 'wphal_option', 'option_type' );
989 1007 register_setting( 'wphal_option', 'option_groupe' );
@@ -1018,18 +1036,16 @@
1018 1036 <div id="post-body-content">
1019 1037 <?php settings_fields( 'wphal_option' ); ?>
1020 1038 <?php do_settings_sections( 'wphal_option' ); ?>
1021 1039 <table class="form-table">
1022 - <tr style="vertical-align:top;">
1040 + <tr valign="top">
1023 1041 <th scope="row" style="font-size: 18px;"><?php echo __('Paramètre de la page :','wp-hal');?></th>
1024 1042 </tr>
1025 - <tr style="vertical-align:top;">
1026 - <th scope="row"><label for="option_type"><?php echo __('Type d\'Id','wp-hal');?></label></th>
1043 + <tr valign="top">
1044 + <th scope="row"><?php echo __('Type d\'Id','wp-hal');?></th>
1027 1045 <td><select name="option_type">
1028 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>
1029 - <option id="StructId" value="structId_i" <?php echo (get_option('option_type') == "structId_i")?'selected':''; ?>><label for="StructId">Struct Id</label><span style="font-style: italic;"> <?php echo __('(Exemple : 413106)','wp-hal');?></span></option>
1030 - <option id="AuthorStructId" value="authStructId_i" <?php echo (get_option('option_type') == "authStructId_i")?'selected':''; ?>><label for="AuthorStructId">AuthorStruct Id</label><span style="font-style: italic;"> <?php echo __('(Exemple : 413106)','wp-hal');?></span></option>
1031 - <option id="AuthorId" value="authId_i" <?php echo (get_option('option_type') == "authId_i")?'selected':''; ?>><label for="AuthorId">Author Id</label><span style="font-style: italic;"> <?php echo __('(Exemple : 413106)','wp-hal');?></span></option>
1047 + <option id="Structid" value="authStructId_i" <?php echo (get_option('option_type') == "authStructId_i")?'selected':''; ?>><label for="Structid">Struct Id</label><span style="font-style: italic;"> <?php echo __('(Exemple : 129)','wp-hal');?></span></option>
1032 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>
1033 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>
1034 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>
1035 1051 </select>
@@ -1035,15 +1051,15 @@
1035 1051 </select>
1036 1052 <input type="text" name="option_idhal" id="option_idhal" value="<?php echo get_option('option_idhal'); ?>"/>
1037 1053 </td>
1038 1054 </tr>
1039 - <tr style="vertical-align:top;">
1055 + <tr valign="top">
1040 1056 <th scope="row"><?php echo __('Affichage des documents','wp-hal');?></th>
1041 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>
1042 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>
1043 1059 </td>
1044 1060 </tr>
1045 - <tr style="vertical-align:top;">
1061 + <tr valign="top">
1046 1062 <th scope="row"><?php echo __('Choix des éléments menu','wp-hal');?></th>
1047 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/>
1048 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/>
1049 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/>
@@ -1055,9 +1071,9 @@
1055 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/>
1056 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>
1057 1073 </td>
1058 1074 </tr>
1059 - <tr style="vertical-align:top;">
1075 + <tr valign="top">
1060 1076 <th scope="row" style="font-size: 18px;"><?php echo __('Contact :','wp-hal');?></th>
1061 1077 </tr>
1062 1078 <tr>
1063 1079 <th scope="row"><?php echo __("Afficher les informations d'un chercheur ayant un IdHal ?",'wp-hal');?></th>
@@ -1064,29 +1080,29 @@
1064 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>
1065 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>
1066 1082 </td>
1067 1083 <tr>
1068 - <th scope="row"><label for="option_email"><?php echo __('Email','wp-hal');?></label></th>
1084 + <th scope="row"><?php echo __('Email','wp-hal');?></th>
1069 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>
1070 1086 </tr>
1071 1087 <tr>
1072 - <th scope="row"><label for="option_tel"><?php echo __('Téléphone','wp-hal');?></label></th>
1088 + <th scope="row"><?php echo __('Téléphone','wp-hal');?></th>
1073 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>
1074 1090 </tr>
1075 1091 <tr>
1076 - <th><label for="option_social0">Facebook (http://www.facebook.com/)</label></th>
1092 + <th>Facebook (http://www.facebook.com/)</th>
1077 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>
1078 1094 </tr>
1079 1095 <tr>
1080 - <th><label for="option_social1">Twitter (http://www.twitter.com/)</label></th>
1096 + <th>Twitter (http://www.twitter.com/)</th>
1081 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>
1082 1098 </tr>
1083 1099 <tr>
1084 - <th><label for="option_social2">Google + (https://plus.google.com/u/0/+)</label></th>
1100 + <th>Google + (https://plus.google.com/u/0/+)</th>
1085 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>
1086 1102 </tr>
1087 1103 <tr>
1088 - <th><label for="option_social3">LinkedIn (https://www.linkedin.com/in/)</label></th>
1104 + <th>LinkedIn (https://www.linkedin.com/in/)</th>
1089 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>
1090 1106 </tr>
1091 1107 </table>
1092 1108 <?php
@@ -1122,5 +1138,5 @@
1122 1138 delete_option('option_social1');
1123 1139 delete_option('option_social2');
1124 1140 delete_option('option_social3');
1125 1141 }
1126 -?>
1142 +?>