Changeset 3458796
- Timestamp:
- 02/11/2026 09:04:22 AM (11 days ago)
- Location:
- hal/trunk
- Files:
-
- 3 edited
-
constantes.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
-
wp-hal.php (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
hal/trunk/constantes.php
r3412060 r3458796 1 1 <?php 2 2 /** 3 * Created on: 2 6/05/144 * Updated on: 15/11/223 * Created on: 2024-05-26 4 * Updated on: 2022-02-10 5 5 */ 6 6 … … 31 31 32 32 // Constante de version du plugin 33 define('wphal_version', '2. 6.1');33 define('wphal_version', '2.7,1'); -
hal/trunk/readme.txt
r3412068 r3458796 5 5 Tested up to: 6.9 6 6 PHP Version: 7.0 or higher 7 Stable tag: 2. 67 Stable tag: 2.7.1 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 81 81 82 82 == Changelog == 83 84 2.7.1 85 *Release Date - Feb 2026 86 87 * add possibility to display only one docment type. (thx to R.Trouville) 83 88 84 89 = 2.7 = -
hal/trunk/wp-hal.php
r3412068 r3458796 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. 6.16 * Version: 2.7.1 7 7 * Author: CCSD 8 8 * Author URI: http://www.ccsd.cnrs.fr … … 18 18 require_once("constantes.php"); 19 19 20 21 if (wphal_locale == 'fr_FR') { 22 define('wphal_lang', 'fr'); 23 } elseif (wphal_locale == 'es_ES') { 24 define('wphal_lang', 'es'); 25 } else { 20 $generalLang = preg_replace('/_.*/', '', wphal_locale); 21 switch ($generalLang) { 22 case 'fr': 23 case 'es': 24 case 'en': 25 // Known languages... 26 define('wphal_lang', $generalLang); 27 break; 28 default: 26 29 define('wphal_lang', 'en'); 27 30 } … … 29 32 function wphal_is_curl_installed() { 30 33 $loaded_extentions = get_loaded_extensions(); 31 if (in_array ('curl', $loaded_extentions)) { 32 return true; 33 } 34 else { 35 return false; 36 } 34 return (bool) (in_array('curl', $loaded_extentions)); 37 35 } 38 36 … … 41 39 add_shortcode( 'nb-doc', 'wphal_nb_doc' ); 42 40 43 44 41 function wphal_charger_languages() { 45 42 load_plugin_textdomain('wp-hal', false, dirname(plugin_basename(__FILE__)) . '/lang/'); … … 53 50 54 51 $settings_link = '<a href="admin.php?page=wp-hal.php">' . __( 'Paramètres', 'wp-hal' ) . '</a>'; 55 56 52 array_unshift( $links, $settings_link ); 57 58 53 return $links; 59 54 } 55 60 56 61 57 add_filter( 'query_vars', 'wphal_query_vars' ); … … 88 84 // delete all "hal namespace" transients 89 85 $sql = " 90 DELETE 86 DELETE 91 87 FROM {$wpdb->options} 92 88 WHERE option_name like '\_transient\_hal\_%' … … 112 108 if ( false === ( $value = get_transient( $transient_id ) ) ) { 113 109 $json = wphal_do_common_curl_call($url); 114 if($json) 115 set_transient( $transient_id, $json, $cache_expiration); 110 if ($json) { 111 set_transient($transient_id, $json, $cache_expiration); 112 } 116 113 return $json; 117 114 } else{ … … 145 142 return $json->response->numFound; 146 143 } 144 147 145 /** 148 146 * PLUGIN SHORTCODE CV-HAL … … 174 172 'type' => $default_type, 175 173 'id' => $default_id, 176 'contact' => $default_contact 174 'contact' => $default_contact, 175 'doctype_s' => null, 176 'debug' => false, 177 'option_groupe' => get_option('option_groupe') 177 178 ), 178 179 $param 179 180 )); 181 if ($doctype_s && !preg_match("/^[A-Z_ ]*$/", $doctype_s)) { 182 // Control of shortcode doctype_s which must be a valid doctype or a valid expression for doctype_s 183 // can accept: "ART OR REPORT AND NOT UNDEFINED" 184 $doctype_s = null; 185 } 186 if (! in_array($option_groupe, ['paginer', 'grouper'])) { 187 $option_groupe = 'paginer'; 188 } 189 180 190 $content = 'Plugin is not configured correctly or shortcode parameters are not valid, please check the <a href="https://doc.hal.science/afficher-une-liste-de-publications-dans-wordpress/" target="_blank" id="wrong_params">documentation</a>'; 181 191 … … 196 206 $facetQuery = !empty($facets) ? 'facet.field='.implode("&facet.field=", $facets).'&facet.limit=200&facet.mincount=1&facet=true':''; 197 207 198 if (get_option('option_groupe') == 'grouper') { 208 $url = wphal_api . '?q=*:*&fq=' . $type . ':(' . urlencode($id) . ')'; 209 if (!empty($doctype_s) && $doctype_s != "") { 210 $url .= '&fq=docType_s:('.$doctype_s.')'; 211 } 212 switch ($option_groupe) { 213 case 'grouper': 199 214 //cURL sur l'API pour récupérer les données 200 $url = wphal_api . '?q=*:*&fq=' . $type . ':(' . urlencode($id) . ')&group=true&group.field=docType_s&group.limit=1000&fl=docid,citationFull_s&'.$facetQuery.'&sort=' . wphal_producedDateY . '&wt=json&json.nl=arrarr'; 201 } elseif (get_option('option_groupe') == 'paginer') { 202 $url = wphal_api . '?q=*:*&fq=' . $type . ':(' . urlencode($id) . ')&fl=docid,citationFull_s&'.$facetQuery.'&sort=' . wphal_producedDateY . '&wt=json&json.nl=arrarr'; 203 } 215 $url .= '&group=true&group.field=docType_s&group.limit=1000'; 216 break; 217 case 'paginer': 218 break; 219 default: 220 // impossible 2 cases only 221 } 222 $url .= '&fl=docid,citationFull_s&'.$facetQuery.'&sort=' . wphal_producedDateY . '&wt=json&json.nl=arrarr'; 204 223 205 224 $json = wphal_do_get_data($url); 206 225 if(!isset($json->error)){ 207 $hal_page = (get_query_var('hal_page')) ? get_query_var('hal_page') : 1; 208 209 $content = '<div id="wphal-content">'; 226 $content = ""; 227 $hal_page = (get_query_var('hal_page')) ? get_query_var('hal_page') : 1; 228 if ($debug) { 229 $formattedJson = str_replace(["\n", ' '], ['<br />', ' '] , json_encode($json,JSON_PRETTY_PRINT)); 230 $content .= sprintf('<div class="debug"><ul><li>Option groupe: %s</li><li>url=%s</li><li>doctype_s: %s</li><li>json result: %s</li></ul></div>', 231 $option_groupe, $url, $doctype_s, $formattedJson ); 232 } 233 234 $content .= '<div id="wphal-content">'; 210 235 if (is_array($option_choix) && !empty($option_choix)){ 211 236 $content .= '<ul id="wphal-menu">'; … … 261 286 } 262 287 $content .= '</ul></li>'; 263 264 288 $content .= '</ul><br/><hr>'; 265 289 } … … 772 796 <div class="display" id="publications">'; 773 797 if(null === $json || !isset($jsontype->response)) { 774 if ( get_option('option_groupe')== 'grouper') {798 if ($option_groupe == 'grouper') { 775 799 $doctype = file_get_contents(plugin_dir_path(__FILE__) . 'json' . DIRECTORY_SEPARATOR . 'doctype_fr.json'); 776 800 $jsontype = json_decode($doctype); … … 796 820 } 797 821 } 798 } elseif ( get_option('option_groupe')== 'paginer') {822 } elseif ($option_groupe == 'paginer') { 799 823 800 824 //LISTE DES DOCUMENTS AVEC PAGINATION … … 821 845 822 846 $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'; 847 if (!empty($doctype_s) && $doctype_s != "") { 848 $url .= '&fq=docType_s:('.$doctype_s.')'; 849 } 823 850 $json = wphal_do_get_data($url); 824 851
Note: See TracChangeset
for help on using the changeset viewer.