| @@ -2,10 +2,10 @@ | ||
| 2 | 2 | /** |
| 3 | 3 | * Plugin Name: HAL |
| 4 | 4 | * Plugin URI: http://www.ccsd.cnrs.fr |
| 5 | 5 | * Description: Crée une page qui remonte les publications d'un auteur ou d'une structure en relation avec HAL et un widget des dernières publications d'un auteur ou d'une structure. |
| 6 | - * Version: 2.1.0 | |
| 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,83 +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 => 30, | |
| 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 | -function 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 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 | - 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 = 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 | -*/ | |
| 57 | + **********************************************************************************************************************/ | |
| 126 | 58 | function nb_doc($param) |
| 127 | 59 | { |
| 128 | 60 | $idhal = verifSolr(get_option('option_idhal')); |
| 129 | 61 | extract(shortcode_atts(array( |
| @@ -131,59 +63,44 @@ | ||
| 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 | 67 | $id = verifSolr($id); |
| 140 | 68 | |
| 141 | 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 =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 | - */ | |
| 89 | + **********************************************************************************************************************/ | |
| 151 | 90 | function cv_hal($param){ |
| 152 | - $content = ''; | |
| 153 | 91 | if ( !function_exists('curl_init' ) ) { |
| 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'; | |
| 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'); | |
| 160 | - | |
| 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 = verifSolr(get_option('option_idhal')); | |
| 169 | - $default_type = get_option('option_type'); | |
| 170 | - $default_contact = get_option('option_infocontact'); | |
| 171 | - | |
| 172 | - // here we merge with shortcode parameters | |
| 173 | - extract(shortcode_atts(array( | |
| 174 | - 'type' => $default_type, | |
| 175 | - 'id' => $default_id, | |
| 176 | - 'contact' => $default_contact | |
| 177 | - ), | |
| 178 | - $param | |
| 179 | - )); | |
| 180 | - | |
| 181 | - /** @var $id : defined by extract | |
| 182 | - * @var string $type : defined by extract | |
| 183 | - * @var string $contact : defined by extract | |
| 184 | - */ | |
| 185 | - if (!empty($id) && in_array($type, $possible_ids)) { | |
| 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 | + )); | |
| 186 | 103 | $id = verifSolr($id); |
| 187 | 104 | |
| 188 | 105 | if (get_option('option_groupe') == 'grouper') { |
| 189 | 106 | //cURL sur l'API pour récupérer les données |
| @@ -191,60 +108,78 @@ | ||
| 191 | 108 | } elseif (get_option('option_groupe') == 'paginer') { |
| 192 | 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'; |
| 193 | 110 | } |
| 194 | 111 | |
| 195 | - $json = do_get_data($url); | |
| 112 | + $ch = curl_init($url); | |
| 113 | + // Options | |
| 114 | + $options = array( | |
| 115 | + CURLOPT_RETURNTRANSFER => true, | |
| 116 | + CURLOPT_HTTPHEADER => array('Content-type: application/json'), | |
| 117 | + CURLOPT_TIMEOUT => 10, | |
| 118 | + CURLOPT_USERAGENT => "HAL Plugin Wordpress " . version | |
| 119 | + ); | |
| 196 | 120 | |
| 197 | - $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); | |
| 198 | 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 | + | |
| 199 | 136 | $content = '<div id="wphal-content"> |
| 200 | 137 | <ul id="wphal-menu">'; |
| 201 | 138 | $content .= '<li><a href="#publications" onclick="displayElem(\'publications\'); return false;" style="font-size:18px; text-decoration: none;">' . __('Publications', 'wp-hal') . '</a></li>'; |
| 202 | - if (is_array($option_choix)) { | |
| 139 | + if ($choix != 0) { | |
| 203 | 140 | $content .= '<li><a href="#filtres" onclick="return false;" style="font-size:18px; text-decoration: none; cursor:default;">' . __('Filtres', 'wp-hal') . '</a>'; |
| 204 | 141 | $content .= '<ul id="wphal-filtres">'; |
| 205 | - foreach ($option_choix as $option) { | |
| 206 | - if ($option == 'contact') { | |
| 207 | - $content .= '<li><a href="#contact" onclick="displayElem(\'wphal-contact\'); return false;" style="margin:1px; text-decoration: none;">' . __('Contact', 'wp-hal'); | |
| 208 | - $content .= '</a></li>'; | |
| 209 | - } | |
| 210 | - if ($option == 'disciplines') { | |
| 211 | - $content .= '<li><a href="#disciplines" onclick="displayElem(\'wphal-disciplines\'); return false;" style="margin:1px; text-decoration: none;">' . __('Disciplines', 'wp-hal'); | |
| 212 | - $content .= '</a></li>'; | |
| 213 | - } | |
| 214 | - if ($option == 'mots-clefs') { | |
| 215 | - $content .= '<li><a href="#keywords" onclick="displayElem(\'wphal-keywords\'); return false;" style="margin:1px; text-decoration: none;">' . __('Mots-clefs', 'wp-hal'); | |
| 216 | - $content .= '</a></li>'; | |
| 217 | - } | |
| 218 | - if ($option == 'auteurs') { | |
| 219 | - $content .= '<li><a href="#auteurs" onclick="displayElem(\'wphal-auteurs\'); return false;" style="margin:1px; text-decoration: none;">' . __('Auteurs', 'wp-hal'); | |
| 220 | - $content .= '</a></li>'; | |
| 221 | - } | |
| 222 | - if ($option == 'revues') { | |
| 223 | - $content .= '<li><a href="#revues" onclick="displayElem(\'wphal-revues\'); return false;" style="margin:1px; text-decoration: none;">' . __('Revues', 'wp-hal'); | |
| 224 | - $content .= '</a></li>'; | |
| 225 | - } | |
| 226 | - if ($option == 'annee') { | |
| 227 | - $content .= '<li><a href="#annees" onclick="displayElem(\'wphal-annees\'); return false;" style="margin:1px; text-decoration: none;">' . __('Année de production', 'wp-hal'); | |
| 228 | - $content .= '</a></li>'; | |
| 229 | - } | |
| 230 | - if ($option == 'institution') { | |
| 231 | - $content .= '<li><a href="#insts" onclick="displayElem(\'wphal-insts\'); return false;" style="margin:1px; text-decoration: none;">' . __('Institutions', 'wp-hal'); | |
| 232 | - $content .= '</a></li>'; | |
| 233 | - } | |
| 234 | - if ($option == 'laboratoire') { | |
| 235 | - $content .= '<li><a href="#labs" onclick="displayElem(\'wphal-labs\'); return false;" style="margin:1px; text-decoration: none;">' . __('Laboratoires', 'wp-hal'); | |
| 236 | - $content .= '</a></li>'; | |
| 237 | - } | |
| 238 | - if ($option == 'departement') { | |
| 239 | - $content .= '<li><a href="#depts" onclick="displayElem(\'wphal-depts\'); return false;" style="margin:1px; text-decoration: none;">' . __('Départements', 'wp-hal'); | |
| 240 | - $content .= '</a></li>'; | |
| 241 | - } | |
| 242 | - if ($option == 'equipe') { | |
| 243 | - $content .= '<li><a href="#equipes" onclick="displayElem(\'wphal-equipes\'); return false;" style="margin:1px; text-decoration: none;">' . __('Équipes de recherche', 'wp-hal'); | |
| 244 | - $content .= '</a></li>'; | |
| 245 | - } | |
| 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>'; | |
| 246 | 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 | + } | |
| 247 | 182 | $content .= '</ul></li>'; |
| 248 | 183 | } |
| 249 | 184 | $content .= '</ul><br/><hr>'; |
| 250 | 185 | |
| @@ -256,10 +191,23 @@ | ||
| 256 | 191 | <ul id="wphal-cont" style="list-style-type: none;">'; |
| 257 | 192 | |
| 258 | 193 | if ($contact == 'yes' && $type == 'authIdHal_s') { |
| 259 | 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); |
| 260 | - $jsonauthor = do_get_data($urlauthor); | |
| 195 | + $ch = curl_init($urlauthor); | |
| 196 | + // Options | |
| 197 | + $options = array( | |
| 198 | + CURLOPT_RETURNTRANSFER => true, | |
| 199 | + CURLOPT_HTTPHEADER => array('Content-type: application/json'), | |
| 200 | + CURLOPT_TIMEOUT => 10, | |
| 201 | + CURLOPT_USERAGENT => "HAL Plugin Wordpress " . version | |
| 202 | + ); | |
| 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>'; |
| @@ -297,22 +245,18 @@ | ||
| 297 | 245 | if (get_option('option_tel') != '') { |
| 298 | 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="http://www.facebook.com/' . get_option('option_social0') . '" target="_blank"><img | |
| 302 | - 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>'; | |
| 303 | 250 | } |
| 304 | 251 | if (get_option('option_social1') != '') { |
| 305 | - $content .= '<li><a href="http://www.twitter.com/' . get_option('option_social1') . '" target="_blank"><img | |
| 306 | - 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>'; | |
| 307 | 253 | } |
| 308 | 254 | if (get_option('option_social2') != '') { |
| 309 | - $content .= '<li><a href="https://plus.google.com/u/0/+' . get_option('option_social2') . '" target="_blank"><img | |
| 310 | - 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>'; | |
| 311 | 256 | } |
| 312 | 257 | if (get_option('option_social3') != '') { |
| 313 | - $content .= '<li><a href="https://www.linkedin.com/in/' . get_option('option_social3') . '" target="_blank"><img | |
| 314 | - 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>'; | |
| 315 | 259 | } |
| 316 | 260 | $content .= '</ul> |
| 317 | 261 | </div> |
| 318 | 262 | <div class="display" id="wphal-disciplines" style="display: none;"> |
| @@ -326,12 +270,13 @@ | ||
| 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 | 282 | $name = explode(delimiter, $res[0]); |
| @@ -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) { |
| @@ -376,10 +319,10 @@ | ||
| 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) { |
| @@ -387,9 +330,9 @@ | ||
| 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; |
| @@ -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; |
| @@ -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 | |
| @@ -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; |
| @@ -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 | |
| @@ -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; |
| @@ -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,16 +579,15 @@ | ||
| 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; |
| @@ -668,9 +610,9 @@ | ||
| 668 | 610 | $content .= '</div>'; |
| 669 | 611 | $content .= '</div>'; |
| 670 | 612 | $content .= '</ul>'; |
| 671 | 613 | if ($r > 10) { |
| 672 | - $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'); | |
| 673 | 615 | $content .= '</button>'; |
| 674 | 616 | } |
| 675 | 617 | } |
| 676 | 618 | $content .= '</div> |
| @@ -682,13 +624,14 @@ | ||
| 682 | 624 | //LISTE DES DOCUMENTS PAR GROUPE |
| 683 | 625 | |
| 684 | 626 | $content .= '<div class="counter-doc"><span class="wphal-nbtot">' . $json->grouped->docType_s->matches . ' </span>'; |
| 685 | 627 | $content .= __('documents', 'wp-hal'). '</div><br>'; |
| 628 | + $content .= '<ul style="list-style-type: none;">'; | |
| 686 | 629 | for ($i = 0; $jsontype->response->result->doc[$i] != null; $i++) { |
| 687 | 630 | for ($d = 0; $json->grouped->docType_s->groups[$d] != null; $d++) { |
| 688 | 631 | if ($json->grouped->docType_s->groups[$d]->groupValue == $jsontype->response->result->doc[$i]->str[0]){ |
| 689 | 632 | $titre = $jsontype->response->result->doc[$i]->str[1]; |
| 690 | - $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>'; | |
| 691 | 634 | $content .= '<div class="grp-content">'; |
| 692 | 635 | $content .= '<ul>'; |
| 693 | 636 | foreach ($json->grouped->docType_s->groups[$d]->doclist->docs as $result) { |
| 694 | 637 | $content .= '<li>' . $result->citationFull_s . '</li>'; |
| @@ -693,13 +636,14 @@ | ||
| 693 | 636 | foreach ($json->grouped->docType_s->groups[$d]->doclist->docs as $result) { |
| 694 | 637 | $content .= '<li>' . $result->citationFull_s . '</li>'; |
| 695 | 638 | } |
| 696 | 639 | $content .= '</ul></div>'; |
| 697 | - $content .= '</div><br>'; | |
| 640 | + $content .= '</div></li><br>'; | |
| 698 | 641 | break; |
| 699 | 642 | } |
| 700 | 643 | } |
| 701 | 644 | } |
| 645 | + $content .= '</ul>'; | |
| 702 | 646 | } elseif (get_option('option_groupe') == 'paginer') { |
| 703 | 647 | |
| 704 | 648 | //LISTE DES DOCUMENTS AVEC PAGINATION |
| 705 | 649 | $content .= '<div class="counter-doc"><span class="wphal-nbtot">' . $json->response->numFound . ' </span>'; |
| @@ -711,10 +655,10 @@ | ||
| 711 | 655 | $total = $json->response->numFound; |
| 712 | 656 | |
| 713 | 657 | $nombreDePages = ceil($total / $messagesParPage); |
| 714 | 658 | |
| 715 | - if (isset($hal_page)) { | |
| 716 | - $pageActuelle = intval($hal_page); | |
| 659 | + if (isset($paged)) { | |
| 660 | + $pageActuelle = intval($paged); | |
| 717 | 661 | |
| 718 | 662 | if ($pageActuelle > $nombreDePages) { |
| 719 | 663 | $pageActuelle = $nombreDePages; |
| 720 | 664 | } |
| @@ -723,21 +667,30 @@ | ||
| 723 | 667 | } |
| 724 | 668 | $premiereEntree = ($pageActuelle - 1) * $messagesParPage; |
| 725 | 669 | |
| 726 | 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'; |
| 727 | - $json = do_get_data($url); | |
| 671 | + $ch = curl_init($url); | |
| 672 | +// Options | |
| 673 | + $options = array( | |
| 674 | + CURLOPT_RETURNTRANSFER => true, | |
| 675 | + CURLOPT_HTTPHEADER => array('Content-type: application/json'), | |
| 676 | + CURLOPT_TIMEOUT => 10, | |
| 677 | + CURLOPT_USERAGENT => "HAL Plugin Wordpress " . version | |
| 678 | + ); | |
| 728 | 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 | + | |
| 729 | 686 | //--MODULE PAGINATION--// |
| 730 | - $count_results = count($json->response->docs); | |
| 731 | - if($count_results>0) { | |
| 732 | - $content .= '<ul>'; | |
| 733 | - for ( $i = 0; $i < $count_results - 1; $i ++ ) { | |
| 734 | - $content .= '<li>' . $json->response->docs[ $i ]->citationFull_s . '</li>'; | |
| 735 | - } | |
| 736 | - $content .= '</ul>'; | |
| 737 | - } else { | |
| 738 | - $content = '<div> no results !</div>'; | |
| 687 | + | |
| 688 | + $content .= '<ul>'; | |
| 689 | + for ($i = 0; $json->response->docs[$i] != ''; $i++) { | |
| 690 | + $content .= '<li>' . $json->response->docs[$i]->citationFull_s . '</li>'; | |
| 739 | 691 | } |
| 692 | + $content .= '</ul>'; | |
| 740 | 693 | |
| 741 | 694 | //--AFFICHAGE PAGINATION--// |
| 742 | 695 | $precedents = $pageActuelle - 2; |
| 743 | 696 | $suivants = $pageActuelle + 2; |
| @@ -749,9 +702,9 @@ | ||
| 749 | 702 | //--BOUTON PRECEDENT--// |
| 750 | 703 | if ($pageActuelle == 1) { |
| 751 | 704 | $content .= '<li class="disabled"><a href="#">«</a></li>'; |
| 752 | 705 | } else { |
| 753 | - $content .= '<li><a href="?hal_page=' . $precedent . '">«</a></li>'; | |
| 706 | + $content .= '<li><a href="?paged=' . $precedent . '">«</a></li>'; | |
| 754 | 707 | } |
| 755 | 708 | if ($nombreDePages <= 6) {// Cas 1 : 6 pages ou moins - Pas de troncature |
| 756 | 709 | for ($i = 1; $i <= $nombreDePages; $i++) { |
| 757 | 710 | if ($i == $pageActuelle) { |
| @@ -756,9 +709,9 @@ | ||
| 756 | 709 | for ($i = 1; $i <= $nombreDePages; $i++) { |
| 757 | 710 | if ($i == $pageActuelle) { |
| 758 | 711 | $content .= '<li class="active"><a href="#">' . $i . '</a></li>'; |
| 759 | 712 | } else { |
| 760 | - $content .= ' <li><a href="?hal_page=' . $i . '">' . $i . '</a></li> '; | |
| 713 | + $content .= ' <li><a href="?paged=' . $i . '">' . $i . '</a></li> '; | |
| 761 | 714 | } |
| 762 | 715 | } |
| 763 | 716 | } elseif ($nombreDePages >= 7) {// Cas 2 : 7 pages ou plus - Troncature |
| 764 | 717 | if ($pageActuelle <= 3) {// Lorsque l'on est sur les trois premières pages |
| @@ -765,35 +718,35 @@ | ||
| 765 | 718 | for ($i = 1; $i <= 4; $i++) { |
| 766 | 719 | if ($i == $pageActuelle) { |
| 767 | 720 | $content .= '<li class="active"><a href="#">' . $i . '</a></li>'; |
| 768 | 721 | } else { |
| 769 | - $content .= '<li><a href="?hal_page=' . $i . '">' . $i . '</a></li>'; | |
| 722 | + $content .= '<li><a href="?paged=' . $i . '">' . $i . '</a></li>'; | |
| 770 | 723 | } |
| 771 | 724 | } |
| 772 | 725 | $content .= '<li class="disabled"><a href="#">…</a></li>'; |
| 773 | - $content .= '<li><a href="?hal_page=' . $penultimate . '">' . $penultimate . '</a></li>'; | |
| 774 | - $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>'; | |
| 775 | 728 | } |
| 776 | 729 | if ($pageActuelle >= 4 && $pageActuelle <= $penultimate - 2) {//Lorsque l'on arrive sur la quatrième page |
| 777 | - $content .= '<li><a href="?hal_page=">1</a></li>'; | |
| 730 | + $content .= '<li><a href="?paged=">1</a></li>'; | |
| 778 | 731 | $content .= '<li class="disabled"><a href="#">…</a></li>'; |
| 779 | - $content .= '<li><a href="?hal_page=' . $precedents . '">' . $precedents . '</a></li>'; | |
| 780 | - $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>'; | |
| 781 | 734 | $content .= '<li class="active"><a href="#">' . $pageActuelle . '</a></li>'; |
| 782 | - $content .= '<li><a href="?hal_page=' . $suivant . '">' . $suivant . '</a></li>'; | |
| 783 | - $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>'; | |
| 784 | 737 | $content .= '<li class="disabled"><a href="#">…</a></li>'; |
| 785 | - $content .= '<li><a href="?hal_page=' . $nombreDePages . '">' . $nombreDePages . '</a></li>'; | |
| 738 | + $content .= '<li><a href="?paged=' . $nombreDePages . '">' . $nombreDePages . '</a></li>'; | |
| 786 | 739 | } |
| 787 | 740 | if ($pageActuelle >= $penultimate - 1) { |
| 788 | - $content .= '<li><a href="?hal_page=1">1</a></li>'; | |
| 789 | - $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>'; | |
| 790 | 743 | $content .= '<li class="disabled"><a href="#">…</a></li>'; |
| 791 | 744 | for ($i = $penultimate - 2; $i <= $nombreDePages; $i++) { |
| 792 | 745 | if ($i == $pageActuelle) { |
| 793 | 746 | $content .= '<li class="active"><a href="#">' . $i . '</a></li>'; |
| 794 | 747 | } else { |
| 795 | - $content .= '<li><a href="?hal_page=' . $i . '">' . $i . '</a></li>'; | |
| 748 | + $content .= '<li><a href="?paged=' . $i . '">' . $i . '</a></li>'; | |
| 796 | 749 | } |
| 797 | 750 | } |
| 798 | 751 | } |
| 799 | 752 | } |
| @@ -798,9 +751,9 @@ | ||
| 798 | 751 | } |
| 799 | 752 | } |
| 800 | 753 | //--BOUTON SUIVANT--// |
| 801 | 754 | if ($pageActuelle < $nombreDePages) { |
| 802 | - $content .= '<li><a href="?hal_page=' . $suivant . '">»</a></li>'; | |
| 755 | + $content .= '<li><a href="?paged=' . $suivant . '">»</a></li>'; | |
| 803 | 756 | } else { |
| 804 | 757 | $content .= '<li class="disabled"><a href="#">»</a></li>'; |
| 805 | 758 | } |
| 806 | 759 | $content .= '</ul>'; |
| @@ -808,10 +761,8 @@ | ||
| 808 | 761 | } |
| 809 | 762 | $content .= '</div> |
| 810 | 763 | </div> |
| 811 | 764 | </div>'; |
| 812 | - }else{ | |
| 813 | - $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>'; | |
| 814 | 765 | } |
| 815 | 766 | $content .= '<div class="wphal-footer">'; |
| 816 | 767 | $content .= '<p style="color:#B3B2B0">' . __("Documents récupérés de l'archive ouverte HAL", 'wp-hal') . ' <a href="' . site . '" target="_blank"><img alt="logo" src=" ' . plugin_dir_url(__FILE__) . 'img/logo-hal.svg" style="width:32px;"></a></p>'; |
| 817 | 768 | $content .= '</div>'; |
| @@ -823,9 +774,9 @@ | ||
| 823 | 774 | $value = $res[1]; |
| 824 | 775 | $array[] = array($name, $value); |
| 825 | 776 | } |
| 826 | 777 | } |
| 827 | - wp_localize_script('wp-hal-script4', 'WPWallSettings', $array); | |
| 778 | + wp_localize_script('wp-hal-script4', 'WPWallSettings', json_encode($array)); | |
| 828 | 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')); |
| 829 | 780 | wp_localize_script('wp-hal-script4', 'translate', $translation); |
| 830 | 781 | } |
| 831 | 782 | return $content; |
| @@ -856,8 +807,9 @@ | ||
| 856 | 807 | wp_register_style('wp-hal-style1', plugins_url('/css/style.css', __FILE__)); |
| 857 | 808 | wp_register_style('wp-hal-style2', plugins_url('/css/jquery.jqplot.css', __FILE__)); |
| 858 | 809 | |
| 859 | 810 | wp_enqueue_style('wp-hal-style1'); |
| 811 | + wp_enqueue_style('wp-hal-style2'); | |
| 860 | 812 | } |
| 861 | 813 | |
| 862 | 814 | function wp_adding_script() { |
| 863 | 815 | wp_register_script('wp-hal-script1',plugins_url('/js/jquery.jqplot.js', __FILE__)); |
| @@ -866,8 +818,11 @@ | ||
| 866 | 818 | wp_register_script('wp-hal-script4',plugins_url('/js/cv-hal.js', __FILE__)); |
| 867 | 819 | |
| 868 | 820 | |
| 869 | 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'); | |
| 870 | 825 | wp_enqueue_script('wp-hal-script4', false, array(), false, true); |
| 871 | 826 | } |
| 872 | 827 | |
| 873 | 828 | /** |
| @@ -918,12 +873,14 @@ | ||
| 918 | 873 | * Classe du widget wphal |
| 919 | 874 | */ |
| 920 | 875 | |
| 921 | 876 | class wphal_widget extends WP_widget{ |
| 877 | + | |
| 878 | + | |
| 922 | 879 | /** |
| 923 | 880 | * Défini les propriétés du widget |
| 924 | 881 | */ |
| 925 | - function __construct(){ | |
| 882 | + function wphal_widget(){ | |
| 926 | 883 | $options = array( |
| 927 | 884 | "classname" => "wphal-publications", |
| 928 | 885 | "description" => __("Afficher les dernières publications d'un auteur ou d'une structure.", 'wp-hal') |
| 929 | 886 | ); |
| @@ -929,9 +886,9 @@ | ||
| 929 | 886 | ); |
| 930 | 887 | |
| 931 | 888 | parent::__construct( |
| 932 | 889 | 'hal-publications', |
| 933 | - __("Publications HAL", 'wp-hal'), | |
| 890 | + __("Publications récentes", 'wp-hal'), | |
| 934 | 891 | $options |
| 935 | 892 | ); |
| 936 | 893 | } |
| 937 | 894 | |
| @@ -940,44 +897,52 @@ | ||
| 940 | 897 | * @param $args |
| 941 | 898 | * @param $instance |
| 942 | 899 | */ |
| 943 | 900 | function widget($args, $instance){ |
| 944 | - $content = ''; | |
| 945 | - extract($args); | |
| 946 | - /** | |
| 947 | - * @var $before_widget : defined by extract | |
| 948 | - * @var $before_title : defined by extract | |
| 949 | - * @var $after_title : defined by extract | |
| 950 | - * @var $after_widget : defined by extract | |
| 951 | - */ | |
| 952 | 901 | if ( !function_exists('curl_init' ) ) { |
| 953 | 902 | $content = 'Please check the <a href="https://wordpress.org/plugins/hal/faq/" target="_blank" id="FAQ">FAQ</a> with the code : CURL'; |
| 954 | - | |
| 903 | + extract($args); | |
| 904 | + echo $before_widget; | |
| 905 | + echo $before_title . $instance['titre'] . $after_title; | |
| 906 | + echo $content; | |
| 907 | + echo $after_widget; | |
| 955 | 908 | } else { |
| 956 | 909 | $instance['idhal'] = verifSolr($instance['idhal']); |
| 957 | 910 | |
| 958 | 911 | $url = api . '?q=*:*&fq=' . $instance['select'] . ':' . urlencode($instance['idhal']) . '&fl=uri_s,'. $instance['typetext'] .'&sort=' . producedDateY . '&rows=' . $instance['nbdoc'] . '&wt=json'; |
| 959 | - $json = do_get_data($url); | |
| 960 | - $count_results = count($json->response->docs); | |
| 961 | - if($count_results>0) { | |
| 962 | - $content = '<ul class="widhal-ul">'; | |
| 963 | - for ($i = 0; $i < $count_results - 1; $i++) { | |
| 964 | - if ($instance['typetext']=='citationRef_s') { | |
| 965 | - $typetext = $json->response->docs[$i]->citationRef_s; | |
| 966 | - } else { | |
| 967 | - $typetext = $json->response->docs[$i]->title_s[0]; | |
| 968 | - } | |
| 969 | - $content .= '<li class="widhal-li"><a href="' . $json->response->docs[$i]->uri_s . '" target="_blank">' . $typetext . '</a></li>'; | |
| 970 | - } | |
| 971 | - $content .= '</ul>'; | |
| 972 | - } else { | |
| 973 | - $content = '<div> no results !</div>'; | |
| 974 | - } | |
| 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 | + | |
| 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; | |
| 932 | + } else { | |
| 933 | + $typetext = $json->response->docs[$i]->title_s[0]; | |
| 934 | + } | |
| 935 | + $content .= '<li class="widhal-li"><a href="' . $json->response->docs[$i]->uri_s . '" target="_blank">' . $typetext . '</a></li>'; | |
| 936 | + } | |
| 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; | |
| 975 | 944 | } |
| 976 | - echo $before_widget; | |
| 977 | - echo $before_title . $instance['titre'] . $after_title; | |
| 978 | - echo $content; | |
| 979 | - echo $after_widget; | |
| 980 | 945 | } |
| 981 | 946 | |
| 982 | 947 | /** |
| 983 | 948 | * Sauvegarde des données |
| @@ -994,9 +959,9 @@ | ||
| 994 | 959 | */ |
| 995 | 960 | function form($instance){ |
| 996 | 961 | |
| 997 | 962 | $defaut = array( |
| 998 | - 'titre' => __("Publications Hal", 'wp-hal'), | |
| 963 | + 'titre' => __("Publications récentes", 'wp-hal'), | |
| 999 | 964 | 'select' => "authIdHal_s", |
| 1000 | 965 | 'typetext' => "title_s", |
| 1001 | 966 | 'nbdoc' => 5 |
| 1002 | 967 | ); |
| @@ -1020,11 +985,9 @@ | ||
| 1020 | 985 | <p> |
| 1021 | 986 | <label for="<?php echo $this->get_field_id("select");?>"><?php echo __("Type d'Id",'wp-hal') .' :'?></label> |
| 1022 | 987 | <select id="<?php echo $this->get_field_id("select");?>" name="<?php echo $this->get_field_name("select");?>"> |
| 1023 | 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> |
| 1024 | - <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> | |
| 1025 | - <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> | |
| 1026 | - <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> | |
| 1027 | 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> |
| 1028 | 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> |
| 1029 | 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> |
| 1030 | 993 | </select> |
| @@ -1036,8 +999,9 @@ | ||
| 1036 | 999 | <?php |
| 1037 | 1000 | } |
| 1038 | 1001 | } |
| 1039 | 1002 | |
| 1003 | + | |
| 1040 | 1004 | function register_settings() { |
| 1041 | 1005 | register_setting( 'wphal_option', 'option_choix' ); |
| 1042 | 1006 | register_setting( 'wphal_option', 'option_type' ); |
| 1043 | 1007 | register_setting( 'wphal_option', 'option_groupe' ); |
| @@ -1049,10 +1013,8 @@ | ||
| 1049 | 1013 | register_setting( 'wphal_option', 'option_social0' ); |
| 1050 | 1014 | register_setting( 'wphal_option', 'option_social1' ); |
| 1051 | 1015 | register_setting( 'wphal_option', 'option_social2' ); |
| 1052 | 1016 | register_setting( 'wphal_option', 'option_social3' ); |
| 1053 | - register_setting( 'wphal_option', 'option_cache_timeout' ); | |
| 1054 | - register_setting( 'wphal_option', 'option_erase_cache' ); | |
| 1055 | 1017 | } |
| 1056 | 1018 | |
| 1057 | 1019 | /** |
| 1058 | 1020 | * Crée le menu d'option du plugin |
| @@ -1074,18 +1036,16 @@ | ||
| 1074 | 1036 | <div id="post-body-content"> |
| 1075 | 1037 | <?php settings_fields( 'wphal_option' ); ?> |
| 1076 | 1038 | <?php do_settings_sections( 'wphal_option' ); ?> |
| 1077 | 1039 | <table class="form-table"> |
| 1078 | - <tr style="vertical-align:top;"> | |
| 1040 | + <tr valign="top"> | |
| 1079 | 1041 | <th scope="row" style="font-size: 18px;"><?php echo __('Paramètre de la page :','wp-hal');?></th> |
| 1080 | 1042 | </tr> |
| 1081 | - <tr style="vertical-align:top;"> | |
| 1082 | - <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> | |
| 1083 | 1045 | <td><select name="option_type"> |
| 1084 | 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> |
| 1085 | - <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> | |
| 1086 | - <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> | |
| 1087 | - <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> | |
| 1088 | 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> |
| 1089 | 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> |
| 1090 | 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> |
| 1091 | 1051 | </select> |
| @@ -1091,15 +1051,15 @@ | ||
| 1091 | 1051 | </select> |
| 1092 | 1052 | <input type="text" name="option_idhal" id="option_idhal" value="<?php echo get_option('option_idhal'); ?>"/> |
| 1093 | 1053 | </td> |
| 1094 | 1054 | </tr> |
| 1095 | - <tr style="vertical-align:top;"> | |
| 1055 | + <tr valign="top"> | |
| 1096 | 1056 | <th scope="row"><?php echo __('Affichage des documents','wp-hal');?></th> |
| 1097 | 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> |
| 1098 | 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> |
| 1099 | 1059 | </td> |
| 1100 | 1060 | </tr> |
| 1101 | - <tr style="vertical-align:top;"> | |
| 1061 | + <tr valign="top"> | |
| 1102 | 1062 | <th scope="row"><?php echo __('Choix des éléments menu','wp-hal');?></th> |
| 1103 | 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/> |
| 1104 | 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/> |
| 1105 | 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/> |
| @@ -1111,9 +1071,9 @@ | ||
| 1111 | 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/> |
| 1112 | 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> |
| 1113 | 1073 | </td> |
| 1114 | 1074 | </tr> |
| 1115 | - <tr style="vertical-align:top;"> | |
| 1075 | + <tr valign="top"> | |
| 1116 | 1076 | <th scope="row" style="font-size: 18px;"><?php echo __('Contact :','wp-hal');?></th> |
| 1117 | 1077 | </tr> |
| 1118 | 1078 | <tr> |
| 1119 | 1079 | <th scope="row"><?php echo __("Afficher les informations d'un chercheur ayant un IdHal ?",'wp-hal');?></th> |
| @@ -1119,39 +1079,30 @@ | ||
| 1119 | 1079 | <th scope="row"><?php echo __("Afficher les informations d'un chercheur ayant un IdHal ?",'wp-hal');?></th> |
| 1120 | 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> |
| 1121 | 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> |
| 1122 | 1082 | </td> |
| 1123 | - </tr> | |
| 1124 | 1083 | <tr> |
| 1125 | - <th scope="row"><label for="option_cache_timeout"><?php echo __('Expiration cache (minutes)','wp-hal');?></label></th> | |
| 1126 | - <td><input type="number" min="1440" style="width:300px;" placeholder="Default(1 day) : 1440" name="option_cache_timeout" id="option_cache_timeout" value="<?php echo get_option('option_cache_timeout'); ?>"/><img alt="cache" src="<?php echo plugin_dir_url( __FILE__ ) ?>img/clock.svg" style="vertical-align:middle; width:32px; margin-left:2px; margin-right:2px;"/></td> | |
| 1127 | - </tr> | |
| 1128 | - <tr> | |
| 1129 | - <th scope="row"><label for="option_erase_cache"><?php echo __('Reinitialiser le cache','wp-hal');?></label></th> | |
| 1130 | - <td><input type="checkbox" name="option_erase_cache" id="option_erase_cache" value="1"/><img alt="option_erase_cache" src="<?php echo plugin_dir_url( __FILE__ ) ?>img/groom.svg" style="vertical-align:middle; width:32px; margin-left:2px; margin-right:2px;"/></td> | |
| 1131 | - </tr> | |
| 1132 | - <tr> | |
| 1133 | - <th scope="row"><label for="option_email"><?php echo __('Email','wp-hal');?></label></th> | |
| 1084 | + <th scope="row"><?php echo __('Email','wp-hal');?></th> | |
| 1134 | 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> |
| 1135 | 1086 | </tr> |
| 1136 | 1087 | <tr> |
| 1137 | - <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> | |
| 1138 | 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> |
| 1139 | 1090 | </tr> |
| 1140 | 1091 | <tr> |
| 1141 | - <th><label for="option_social0">Facebook (http://www.facebook.com/)</label></th> | |
| 1092 | + <th>Facebook (http://www.facebook.com/)</th> | |
| 1142 | 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> |
| 1143 | 1094 | </tr> |
| 1144 | 1095 | <tr> |
| 1145 | - <th><label for="option_social1">Twitter (http://www.twitter.com/)</label></th> | |
| 1096 | + <th>Twitter (http://www.twitter.com/)</th> | |
| 1146 | 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> |
| 1147 | 1098 | </tr> |
| 1148 | 1099 | <tr> |
| 1149 | - <th><label for="option_social2">Google + (https://plus.google.com/u/0/+)</label></th> | |
| 1100 | + <th>Google + (https://plus.google.com/u/0/+)</th> | |
| 1150 | 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> |
| 1151 | 1102 | </tr> |
| 1152 | 1103 | <tr> |
| 1153 | - <th><label for="option_social3">LinkedIn (https://www.linkedin.com/in/)</label></th> | |
| 1104 | + <th>LinkedIn (https://www.linkedin.com/in/)</th> | |
| 1154 | 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> |
| 1155 | 1106 | </tr> |
| 1156 | 1107 | </table> |
| 1157 | 1108 | <?php |
| @@ -1186,8 +1137,6 @@ | ||
| 1186 | 1137 | delete_option('option_social0'); |
| 1187 | 1138 | delete_option('option_social1'); |
| 1188 | 1139 | delete_option('option_social2'); |
| 1189 | 1140 | delete_option('option_social3'); |
| 1190 | - delete_option('option_cache_timeout'); | |
| 1191 | - delete_option('option_erase_cache'); | |
| 1192 | 1141 | } |
| 1193 | -?> | |
| 1142 | +?> | |