Plugin Directory

Changeset 3148652


Ignore:
Timestamp:
09/09/2024 11:58:28 AM (18 months ago)
Author:
ccsd
Message:

fix warnings and handle response with error

File:
1 edited

Legend:

Unmodified
Added
Removed
  • hal/trunk/wp-hal.php

    r2879158 r3148652  
    178178            $param
    179179        ));
     180        $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>';
    180181
    181182        /** @var  $id         :  defined by extract
     
    203204
    204205            $json = wphal_do_get_data($url);
     206            if(!isset($json->error)){
    205207            $hal_page = (get_query_var('hal_page')) ? get_query_var('hal_page') : 1;
    206208
     
    921923    </div>
    922924</div>';
    923         }else{
    924             $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>';
    925         }
     925        }}
    926926        $content .= '<div class="wphal-footer">';
    927927        $content .= '<p style="color:#B3B2B0">' . __("Documents récupérés de l'archive ouverte HAL", 'wp-hal') . '&nbsp;<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>';
     
    10891089            foreach($facet_fields->{'affiliated_'.$k} as $r){
    10901090                $t = explode(wphal_delimiter_join, $r[0]);
    1091                 if (isset($result[$t[1]])){
     1091                if (!isset($result[$t[1]])){
    10921092                    $result[$t[1]] = $r[1];
    10931093                }else {
     
    12081208                $json = wphal_do_get_data($url);
    12091209
    1210                 $count_results = count($json->response->docs);
    1211                 if ($count_results > 0) {
     1210                $count_results = is_array($json->response->docs) ? count($json->response->docs) : 0;
     1211                if (isset($json->response->docs) && $count_results > 0) {
    12121212                    $content = '<ul class="widhal-ul">';
    12131213                    for ($i = 0; $i < $count_results - 1; $i++) {
Note: See TracChangeset for help on using the changeset viewer.