Plugin Directory

Changeset 1352463


Ignore:
Timestamp:
02/17/2016 09:37:49 AM (10 years ago)
Author:
Friz
Message:

1.4.1

Location:
hal/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • hal/trunk/constantes.php

    r1346806 r1352463  
    1414
    1515// Constante pour le webservice des docType utilisé
    16 define('urltype', 'http://api.archives-ouvertes.fr/ref/docType');
     16define('urltype', 'http://api-test.archives-ouvertes.fr/ref/docType');
    1717
    1818// Constante pour la redirection vers le site halv3 onglet recherche
     
    2929
    3030// Constante de Version USERAGENT
    31 define('version', '1.4');
     31define('version', '1.4.1');
  • hal/trunk/readme.txt

    r1346746 r1352463  
    44Requires at least: 4.0
    55Tested up to: 4.4.2
    6 Stable tag: 1.4
     6Stable tag: 1.4.1
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    6262
    6363= 1.4 =
     64*Release Date - 17 February 2016*
     65
     66Widget :
     67
     68* Citation Full change to Citation Ref (shorter)
     69
     70Page :
     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 =
    6478*Release Date - 9 February 2016*
    6579
     
    7791* Typdoc in the good order (ART, COMM, etc...)
    7892* 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**
    8094
    8195= 1.3 =
  • hal/trunk/wp-hal.php

    r1346692 r1352463  
    44 * Plugin URI: http://www.ccsd.cnrs.fr
    55 * 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
    77 * Author: Baptiste Blondelle
    88 * Author URI: http://www.ccsd.cnrs.fr
     
    5555 * PLUGIN SHORTCODE
    5656 **********************************************************************************************************************/
    57 function cv_hal(){
     57function cv_hal($param){
    5858    if ( !function_exists('curl_init' ) ) {
    5959        echo 'Please check the';?> <a href="https://wordpress.org/plugins/hal/faq/" target="_blank" id="curl">FAQ</a><?php echo ' with the code : CURL';
    6060    } 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        }
    6170        if (get_option('option_idhal') != '') {
    6271            $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);
    6379
    6480            if (get_option('option_groupe') == 'grouper') {
    6581                //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';
    6783            } 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';
    6985            }
    7086
     
    190206                foreach ($facetdomain as $res) {
    191207                    $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>';
    193209                }
    194210                $content .= '</ul>';
     
    225241                foreach ($tab as $res) {
    226242                    $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>&nbsp;';
     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>&nbsp;';
    228244                }
    229245                $content .= '</div>';
     
    236252                $content .= '<div id="wphal-keyw">';
    237253                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>';
    239255                }
    240256                $content .= '</div>';
     
    261277                    }
    262278                    $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>';
    264280                }
    265281                $i = 1;
     
    273289                    } else {
    274290                        $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>';
    276292                    }
    277293                }
     
    301317                    }
    302318                    $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>';
    304320                }
    305321                $i = 1;
     
    313329                    } else {
    314330                        $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>';
    316332                    }
    317333                }
     
    342358                        break;
    343359                    }
    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>';
    345361                }
    346362                $i = 1;
     
    353369                        $i = $i + 1;
    354370                    } 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>';
    356372                    }
    357373                }
     
    381397                    }
    382398                    $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>';
    384400                }
    385401                $i = 1;
     
    393409                    } else {
    394410                        $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>';
    396412                    }
    397413                }
     
    422438                    }
    423439                    $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>';
    425441                }
    426442                $i = 1;
     
    434450                    } else {
    435451                        $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>';
    437453                    }
    438454                }
     
    462478                    }
    463479                    $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>';
    465481                }
    466482                $i = 1;
     
    474490                    } else {
    475491                        $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>';
    477493                    }
    478494                }
     
    503519                    }
    504520                    $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>';
    506522                }
    507523                $i = 1;
     
    514530                        $i = $i + 1;
    515531                    } 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>';
    517533                    }
    518534                }
     
    590606                $premiereEntree = ($pageActuelle - 1) * $messagesParPage;
    591607
    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';
    593609                $ch = curl_init($url);
    594610// Options
     
    690706        $content .= '</div>';
    691707
     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);
    692719    }
    693720    return  $content;
     
    711738        }
    712739    }
     740
    713741    return $solrsql;
    714742}
     
    716744function wp_adding_style() {
    717745    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__));
    722747
    723748    wp_enqueue_style('wp-hal-style1');
    724749    wp_enqueue_style('wp-hal-style2');
    725     wp_enqueue_style('wp-hal-style3');
    726750}
    727751
     
    737761    wp_enqueue_script('wp-hal-script2');
    738762    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);
    782764}
    783765
     
    884866            $content = '<ul class="widhal-ul">';
    885867            for ($i = 0; $i < $instance['nbdoc']; $i++) {
    886                 if ($instance['typetext']=='citationFull_s') {
    887                     $typetext = $json->response->docs[$i]->citationFull_s;
     868                if ($instance['typetext']=='citationRef_s') {
     869                    $typetext = $json->response->docs[$i]->citationRef_s;
    888870                } else {
    889871                    $typetext = $json->response->docs[$i]->title_s[0];
     
    936918            <select id="<?php echo $this->get_field_id("typetext");?>" name="<?php echo $this->get_field_name("typetext");?>">
    937919                <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="citationFull_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>
    939921            </select>
    940922        </p>
     
    964946    register_setting( 'wphal_option', 'option_idhal' );
    965947    register_setting( 'wphal_option', 'option_lang' );
     948    register_setting( 'wphal_option', 'option_css' );
    966949    register_setting( 'wphal_option', 'option_email' );
    967950    register_setting( 'wphal_option', 'option_tel' );
     
    10331016                            <tr valign="top">
    10341017                                <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>
    10361019                            </tr>
    10371020                            <tr valign="top">
    10381021                                <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>
    10401023                            </tr>
    10411024                            <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>
    10441027                            </tr>
    10451028                            <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>
    10481031                            </tr>
    10491032                            <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>
    10521035                            </tr>
    10531036                            <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>
    10561048                            </tr>
    10571049                        </table>
     
    10821074    delete_option('option_idhal');
    10831075    delete_option('option_lang');
     1076    delete_option('option_css');
    10841077    delete_option('option_email');
    10851078    delete_option('option_tel');
Note: See TracChangeset for help on using the changeset viewer.