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