• palbaret

    (@palbaret)


    I have modified the plugin by:
    in order to fix the message Fichier non disponible !
    https://feed.evangelizo.org/v2/reader.php returns an error 500 when displaying the Saint:

     public function widget($args, $instance)
        {
            echo $args['before_widget'];
    
            if (!empty($instance['title']))
                echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
    
            $date = date_i18n('Ymd');
            $type = ($instance['type'] != '') ? esc_attr($instance['type']) : '';
            $lang = ($instance['lang'] != '') ? esc_attr($instance['lang']) : '';
            $cont = ($instance['content'] != '') ? esc_attr($instance['content']) : '';
            $publicite = $instance['publicite'];
            $url = "https://feed.evangelizo.org/v2/reader.php?date=" . $date . "&type=" . $type . "&lang=" . $lang . "&content=" . $cont;
            $context = stream_context_create(array(
                'http' => array(
                    'ignore_errors' => true
                )
            ));
    
            if (!$h = fopen($url, 'r', null, $context)) {
                // Fichier non disponible
                echo "<span style='color: #FF0000; font-weight: bold;'>Fichier non disponible !</span> " . $url . "<br />";
            } else {
                $str = '';
                while (!feof($h)) {
                    $str .= fgets($h);
                }
            }
            if ($type === "saint") {
                $str = str_replace("/v2/", "https://feed.evangelizo.org/v2/", $str);
            }
    
            // Debug
            // echo $url . "<br />";
            // echo '<p>Réponse : </p><p style="width: 800px; display: block;">' . htmlspecialchars( $str ) . '</p>';
    
            // Réponse
            echo '<p>' . $str . '</p>';
    
            echo '<p class="evangelizo-org">';
            echo ($publicite == true) ? __('Free service provided by <a href="https://www.evangelizo.org/" target="_blank">Evangelizo.org</a>.', 'saint-du-jour-reloaded') : '';
            echo '</p>';
    
            echo $args['after_widget'];
        }
  • The topic ‘Fichier non disponible ! FIX’ is closed to new replies.