Changeset 1352463
- Timestamp:
- 02/17/2016 09:37:49 AM (10 years ago)
- Location:
- hal/trunk
- Files:
-
- 3 edited
-
constantes.php (modified) (2 diffs)
-
readme.txt (modified) (3 diffs)
-
wp-hal.php (modified) (29 diffs)
Legend:
- Unmodified
- Added
- Removed
-
hal/trunk/constantes.php
r1346806 r1352463 14 14 15 15 // Constante pour le webservice des docType utilisé 16 define('urltype', 'http://api .archives-ouvertes.fr/ref/docType');16 define('urltype', 'http://api-test.archives-ouvertes.fr/ref/docType'); 17 17 18 18 // Constante pour la redirection vers le site halv3 onglet recherche … … 29 29 30 30 // Constante de Version USERAGENT 31 define('version', '1.4 ');31 define('version', '1.4.1'); -
hal/trunk/readme.txt
r1346746 r1352463 4 4 Requires at least: 4.0 5 5 Tested up to: 4.4.2 6 Stable tag: 1.4 6 Stable tag: 1.4.1 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 62 62 63 63 = 1.4 = 64 *Release Date - 17 February 2016* 65 66 Widget : 67 68 * Citation Full change to Citation Ref (shorter) 69 70 Page : 71 72 * **Important :** Now you can give parameters to the shortcode [cv-hal] to display multiple pages on your website with different IDs. If the shortcode doesn't have parameters, he will take parameters from the settings page of the plugin. Example : [cv-hal] => Settings Page Plugin ; [cv-hal id=184 type=authStructId_i] => Identifier Structure 184 73 * Modification about stylesheets, now in the setting page of the plugin you can give a path to your own stylesheet. It will be automatically loaded if the path is correct. 74 * Bug fixed on link URL in Metadata 75 * Improve the performance of the page 76 77 = 1.4 = 64 78 *Release Date - 9 February 2016* 65 79 … … 77 91 * Typdoc in the good order (ART, COMM, etc...) 78 92 * Add class or id for each item 79 * You can add a stylesheet in the repository "css" and call it "cvhal.css" to surcharge the css of the plugin and personalize your page. 93 * You can add a stylesheet in the repository "css" and call it "cvhal.css" to surcharge the css of the plugin and personalize your page. **Deleted** 80 94 81 95 = 1.3 = -
hal/trunk/wp-hal.php
r1346692 r1352463 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: 1.4 6 * Version: 1.4.1 7 7 * Author: Baptiste Blondelle 8 8 * Author URI: http://www.ccsd.cnrs.fr … … 55 55 * PLUGIN SHORTCODE 56 56 **********************************************************************************************************************/ 57 function cv_hal( ){57 function cv_hal($param){ 58 58 if ( !function_exists('curl_init' ) ) { 59 59 echo 'Please check the';?> <a href="https://wordpress.org/plugins/hal/faq/" target="_blank" id="curl">FAQ</a><?php echo ' with the code : CURL'; 60 60 } else { 61 if (file_exists(get_option('option_css'))){ 62 ?> 63 <style> 64 <?php 65 include get_option('option_css'); 66 ?> 67 </style> 68 <?php 69 } 61 70 if (get_option('option_idhal') != '') { 62 71 $idhal = verifSolr(get_option('option_idhal')); 72 extract(shortcode_atts(array( 73 'type' => get_option('option_type'), 74 'id' => $idhal 75 ), 76 $param 77 )); 78 $id = verifSolr($id); 63 79 64 80 if (get_option('option_groupe') == 'grouper') { 65 81 //cURL sur l'API pour récupérer les données 66 $url = api . '?q=*:*&fq=' . get_option('option_type') . ':(' . urlencode($idhal) . ')&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';82 $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'; 67 83 } elseif (get_option('option_groupe') == 'paginer') { 68 $url = api . '?q=*:*&fq=' . get_option('option_type') . ':(' . urlencode($idhal) . ')&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';84 $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'; 69 85 } 70 86 … … 190 206 foreach ($facetdomain as $res) { 191 207 $name = explode(delimiter, $res[0]); 192 $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . halv3 . '?q=domainAllCode_s:' . urlencode($name[0]) . "+AND+" . get_option('option_type') . ':' . get_option('option_idhal') . '" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';208 $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>'; 193 209 } 194 210 $content .= '</ul>'; … … 225 241 foreach ($tab as $res) { 226 242 $size = round($minsize + (($res[1] - $minval) * $step)); 227 $content .= '<a style="display: inline-block; font-size:' . $size . 'px" href="' . halv3 . '?q=keyword_s:' . urlencode('"' . $res[0] . '"') . "+AND+" . get_option('option_type') . ':' . get_option('option_idhal') . '" target="_blank">' . $res[0] . '</a> ';243 $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> '; 228 244 } 229 245 $content .= '</div>'; … … 236 252 $content .= '<div id="wphal-keyw">'; 237 253 foreach ($json->facet_counts->facet_fields->keyword_s as $res) { 238 $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . halv3 . '?q=keyword_s:' . urlencode('"' . $res[0] . '"') . "+AND+" . get_option('option_type') . ':' . get_option('option_idhal') . '" target="_blank">' . $res[0] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';254 $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>'; 239 255 } 240 256 $content .= '</div>'; … … 261 277 } 262 278 $name = explode(delimiter, $res[0]); 263 $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+" . get_option('option_type') . ':' . get_option('option_idhal') . '" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';279 $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>'; 264 280 } 265 281 $i = 1; … … 273 289 } else { 274 290 $name = explode(delimiter, $res[0]); 275 $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+" . get_option('option_type') . ':' . get_option('option_idhal') . '" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';291 $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>'; 276 292 } 277 293 } … … 301 317 } 302 318 $name = explode(delimiter, $res[0]); 303 $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . halv3 . '?q=journalId_i:' . urlencode($name[0]) . "+AND+" . get_option('option_type') . ':' . get_option('option_idhal') . '" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';319 $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>'; 304 320 } 305 321 $i = 1; … … 313 329 } else { 314 330 $name = explode(delimiter, $res[0]); 315 $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . halv3 . '?q=journalId_i:' . urlencode($name[0]) . "+AND+" . get_option('option_type') . ':' . get_option('option_idhal') . '" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';331 $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>'; 316 332 } 317 333 } … … 342 358 break; 343 359 } 344 $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . halv3 . '?q=producedDateY_i:' . urlencode($res[0]) . "+AND+" . get_option('option_type') . ':' . get_option('option_idhal') . '" target="_blank">' . $res[0] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';360 $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>'; 345 361 } 346 362 $i = 1; … … 353 369 $i = $i + 1; 354 370 } else { 355 $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . halv3 . '?q=producedDateY_i:' . urlencode($res[0]) . "+AND+" . get_option('option_type') . ':' . get_option('option_idhal') . '" target="_blank">' . $res[0] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';371 $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>'; 356 372 } 357 373 } … … 381 397 } 382 398 $name = explode(delimiter, $res[0]); 383 $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . halv3 . '?q=instStructId_i:' . urlencode($name[0]) . "+AND+" . get_option('option_type') . ':' . get_option('option_idhal') . '" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';399 $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>'; 384 400 } 385 401 $i = 1; … … 393 409 } else { 394 410 $name = explode(delimiter, $res[0]); 395 $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . halv3 . '?q=instStructId_i:' . urlencode($name[0]) . "+AND+" . get_option('option_type') . ':' . get_option('option_idhal') . '" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';411 $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>'; 396 412 } 397 413 } … … 422 438 } 423 439 $name = explode(delimiter, $res[0]); 424 $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . halv3 . '?q=labStructId_i:' . urlencode($name[0]) . "+AND+" . get_option('option_type') . ':' . get_option('option_idhal') . '" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';440 $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>'; 425 441 } 426 442 $i = 1; … … 434 450 } else { 435 451 $name = explode(delimiter, $res[0]); 436 $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . halv3 . '?q=labStructId_i:' . urlencode($name[0]) . "+AND+" . get_option('option_type') . ':' . get_option('option_idhal') . '" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';452 $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>'; 437 453 } 438 454 } … … 462 478 } 463 479 $name = explode(delimiter, $res[0]); 464 $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . halv3 . '?q=deptStructId_i:' . urlencode($name[0]) . "+AND+" . get_option('option_type') . ':' . get_option('option_idhal') . '" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';480 $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>'; 465 481 } 466 482 $i = 1; … … 474 490 } else { 475 491 $name = explode(delimiter, $res[0]); 476 $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . halv3 . '?q=deptStructId_i:' . urlencode($name[0]) . "+AND+" . get_option('option_type') . ':' . get_option('option_idhal') . '" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';492 $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>'; 477 493 } 478 494 } … … 503 519 } 504 520 $name = explode(delimiter, $res[0]); 505 $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . halv3 . '?q=rteamStructId_i:' . urlencode($name[0]) . "+AND+" . get_option('option_type') . ':' . get_option('option_idhal') . '" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';521 $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>'; 506 522 } 507 523 $i = 1; … … 514 530 $i = $i + 1; 515 531 } else { 516 $content .= '<li class="metadata" data-percentage="' . $res[1] . '"><a href="' . halv3 . '?q=rteamStructId_i:' . urlencode($name[0]) . "+AND+" . get_option('option_type') . ':' . get_option('option_idhal') . '" target="_blank">' . $name[1] . '</a><span class="wphal-nbmetadata">' . $res[1] . '</span></li>';532 $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>'; 517 533 } 518 534 } … … 590 606 $premiereEntree = ($pageActuelle - 1) * $messagesParPage; 591 607 592 $url = api . '?q=*:*&fq=' . get_option('option_type') . ':(' . urlencode($idhal) . ')&fl=docid,citationFull_s,keyword_s,bookTitle_s,producedDate_s,authFullName_s&start=' . $premiereEntree . '&rows=' . $messagesParPage . '&sort=' . producedDateY . '&wt=json';608 $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'; 593 609 $ch = curl_init($url); 594 610 // Options … … 690 706 $content .= '</div>'; 691 707 708 //--AFFICHAGE GRAPHIQUE DOMAINE--// 709 if (!is_null($facetdomain)) { 710 foreach ($facetdomain as $res) { 711 $name = explode(delimiter, $res[0])[1]; 712 $value = $res[1]; 713 $array[] = array($name, $value); 714 } 715 } 716 wp_localize_script('wp-hal-script4', 'WPWallSettings', json_encode($array)); 717 $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')); 718 wp_localize_script('wp-hal-script4', 'translate', $translation); 692 719 } 693 720 return $content; … … 711 738 } 712 739 } 740 713 741 return $solrsql; 714 742 } … … 716 744 function wp_adding_style() { 717 745 wp_register_style('wp-hal-style1', plugins_url('/css/style.css', __FILE__)); 718 if (file_exists(plugins_url('/css/cvhal.css', __FILE__))) { 719 wp_register_style('wp-hal-style2', plugins_url('/css/cvhal.css', __FILE__)); 720 } 721 wp_register_style('wp-hal-style3', plugins_url('/css/jquery.jqplot.css', __FILE__)); 746 wp_register_style('wp-hal-style2', plugins_url('/css/jquery.jqplot.css', __FILE__)); 722 747 723 748 wp_enqueue_style('wp-hal-style1'); 724 749 wp_enqueue_style('wp-hal-style2'); 725 wp_enqueue_style('wp-hal-style3');726 750 } 727 751 … … 737 761 wp_enqueue_script('wp-hal-script2'); 738 762 wp_enqueue_script('wp-hal-script3'); 739 wp_enqueue_script('wp-hal-script4'); 740 741 742 if (get_option('option_type')!= ''){ 743 $idhal = verifSolr(get_option('option_idhal')); 744 745 $url = api . '?q=*:*&fq='. get_option('option_type').':('. urlencode($idhal).')&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.mincount=1&facet=true&wt=json&json.nl=arrarr'; 746 747 $ch = curl_init($url); 748 // Options 749 $options = array( 750 CURLOPT_RETURNTRANSFER => true, 751 CURLOPT_HTTPHEADER => array('Content-type: application/json'), 752 CURLOPT_TIMEOUT => 10, 753 CURLOPT_USERAGENT => "HAL Plugin Wordpress ".version 754 ); 755 756 // Bind des options et de l'objet cURL que l'on va utiliser 757 curl_setopt_array($ch, $options); 758 // Récupération du résultat JSON 759 $json = json_decode(curl_exec($ch)); 760 curl_close($ch); 761 } 762 763 if (locale == 'fr_FR') { 764 $facetdomain = $json->facet_counts->facet_fields->fr_domainAllCodeLabel_fs; 765 } elseif (locale == 'en_US') { 766 $facetdomain = $json->facet_counts->facet_fields->en_domainAllCodeLabel_fs; 767 } elseif (locale == 'es_ES') { 768 $facetdomain = $json->facet_counts->facet_fields->es_domainAllCodeLabel_fs; 769 } else { 770 $facetdomain = $json->facet_counts->facet_fields->eu_domainAllCodeLabel_fs; 771 } 772 if(!is_null($facetdomain)){ 773 foreach ($facetdomain as $res){ 774 $name = explode(delimiter,$res[0])[1]; 775 $value = $res[1]; 776 $array[] = array($name,$value); 777 } 778 } 779 wp_localize_script('wp-hal-script4', 'WPWallSettings', json_encode($array)); 780 $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')); 781 wp_localize_script('wp-hal-script4', 'translate', $translation); 763 wp_enqueue_script('wp-hal-script4', false, array(), false, true); 782 764 } 783 765 … … 884 866 $content = '<ul class="widhal-ul">'; 885 867 for ($i = 0; $i < $instance['nbdoc']; $i++) { 886 if ($instance['typetext']=='citation Full_s') {887 $typetext = $json->response->docs[$i]->citation Full_s;868 if ($instance['typetext']=='citationRef_s') { 869 $typetext = $json->response->docs[$i]->citationRef_s; 888 870 } else { 889 871 $typetext = $json->response->docs[$i]->title_s[0]; … … 936 918 <select id="<?php echo $this->get_field_id("typetext");?>" name="<?php echo $this->get_field_name("typetext");?>"> 937 919 <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> 938 <option id="<?php echo $this->get_field_id("Citation");?>" value="citation Full_s" <?php echo ($instance["typetext"] == "citationFull_s")?'selected':''; ?>><label for="<?php echo $this->get_field_id("Citation");?>"><?php echo __("Citation", 'wp-hal')?></label></option>920 <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> 939 921 </select> 940 922 </p> … … 964 946 register_setting( 'wphal_option', 'option_idhal' ); 965 947 register_setting( 'wphal_option', 'option_lang' ); 948 register_setting( 'wphal_option', 'option_css' ); 966 949 register_setting( 'wphal_option', 'option_email' ); 967 950 register_setting( 'wphal_option', 'option_tel' ); … … 1033 1016 <tr valign="top"> 1034 1017 <th scope="row"><?php echo __('Email','wp-hal');?></th> 1035 <td><input type="text" 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>1018 <td><input type="text" style="width:300px;" placeholder="Exemple : [email protected]" 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> 1036 1019 </tr> 1037 1020 <tr valign="top"> 1038 1021 <th scope="row"><?php echo __('Téléphone','wp-hal');?></th> 1039 <td><input type="text" 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>1022 <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> 1040 1023 </tr> 1041 1024 <tr> 1042 <th>Facebook </th>1043 <td> http://www.facebook.com/<input type="text" 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>1025 <th>Facebook (http://www.facebook.com/)</th> 1026 <td><input type="text" style="width:300px;" placeholder="Exemple : face.bouc" 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> 1044 1027 </tr> 1045 1028 <tr> 1046 <th>Twitter </th>1047 <td> http://www.twitter.com/<input type="text" 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>1029 <th>Twitter (http://www.twitter.com/)</th> 1030 <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> 1048 1031 </tr> 1049 1032 <tr> 1050 <th>Google + </th>1051 <td> https://plus.google.com/u/0/+<input type="text" 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>1033 <th>Google + (https://plus.google.com/u/0/+)</th> 1034 <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> 1052 1035 </tr> 1053 1036 <tr> 1054 <th>LinkedIn</th> 1055 <td>https://www.linkedin.com/in/<input type="text" 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> 1037 <th>LinkedIn (https://www.linkedin.com/in/)</th> 1038 <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> 1039 </tr> 1040 <tr valign="top"> 1041 <th scope="row" style="font-size: 18px;"><?php echo __('Feuille de style CSS :','wp-hal');?></th> 1042 </tr> 1043 <tr valign="top"> 1044 <th scope="row"><?php echo __("Chemin d'accès fichier CSS",'wp-hal');?></th> 1045 <td> 1046 <input type="text" style="width:400px;" placeholder="Exemple : C:\Users\110\Pictures\test.css" name="option_css" id="option_css" value="<?php echo get_option('option_css'); ?>"/> 1047 </td> 1056 1048 </tr> 1057 1049 </table> … … 1082 1074 delete_option('option_idhal'); 1083 1075 delete_option('option_lang'); 1076 delete_option('option_css'); 1084 1077 delete_option('option_email'); 1085 1078 delete_option('option_tel');
Note: See TracChangeset
for help on using the changeset viewer.