Plugin Directory

Changeset 2690733


Ignore:
Timestamp:
03/08/2022 11:28:11 AM (4 years ago)
Author:
idroj
Message:

1.0.4

Location:
borrufa-widget/trunk/Borrufa-Widget
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • borrufa-widget/trunk/Borrufa-Widget/borrufa-widget/trunk/Borrufa-Widget/borrufa_widget.php

    r2012876 r2690733  
    55Description: Mètode senzill per afegir a la barra lateral o al peu del tema, les notícies de les comarques del Pirineu de Lleida, publicades diàriament a La borrufa, compatible per a qualsevol tema WordPress.
    66Author: Jordi Soler
    7 Version: 1.0.2
     7Version: 1.0.4
    88Author URI: https://laborrufa.com
    99License:   GPL2
     
    2020        register_widget("borrufa_widget_class");
    2121    }
     22       
     23        wp_enqueue_style( 'wp-color-picker' );
     24        wp_enqueue_script( 'wp-color-picker' );
    2225}
  • borrufa-widget/trunk/Borrufa-Widget/borrufa-widget/trunk/Borrufa-Widget/borrufa_widget_class.php

    r2012876 r2690733  
    1818        (
    1919            "titol" => __( 'Notícies La borrufa' ),
     20            "lb_widget_au" => false,
     21            "lb_widget_ar" => false,
     22            "lb_widget_pj" => false,
     23            "lb_widget_ps" => false,
     24            "lb_widget_va" => false,
     25            "lb_widget_esp" => false,
     26            "lb_widget_nat" => false,
     27            "lb_widget_mis" => false,
     28            "lb_num" => 1,
     29            "lb_data" => false,
     30            "lb_widget_target" => 1,
     31            "lb_color" => "#000000",
    2032        );
    2133        $instance = wp_parse_args((array)$instance,$defaults);
     
    2739        $lb_widget_va = isset( $instance['lb_widget_va'] ) ? (bool) $instance['lb_widget_va'] : false;
    2840        $lb_widget_esp = isset( $instance['lb_widget_esp'] ) ? (bool) $instance['lb_widget_esp'] : false;
     41        $lb_widget_nat = isset( $instance['lb_widget_nat'] ) ? (bool) $instance['lb_widget_nat'] : false;
    2942        $lb_widget_mis = isset( $instance['lb_widget_mis'] ) ? (bool) $instance['lb_widget_mis'] : false;
    3043        $lb_num    = isset( $instance['lb_num'] ) ? absint( $instance['lb_num'] ) : 1;
    3144        $lb_data = isset( $instance['lb_data'] ) ? (bool) $instance['lb_data'] : false;
    3245        $lb_widget_target = isset( $instance['lb_widget_target'] ) ? $instance['lb_widget_target'] : 1;
     46        $lb_color = isset( $instance['lb_color'] ) ? $instance['lb_color'] : "#000000";
    3347        ?>
    34         <p>Títol : <input type="text" name="<?php echo $this->get_field_name("titol")?>" value="<?php echo $titol?>" class="widefat" /></p>
     48        <p>Títol : <input type="text" name="<?php echo $this->get_field_name("titol")?>" value="<?php echo $titol; ?>" class="widefat" /></p>
    3549
    3650        <p><?php _e( 'Selecciona les comarques o categories que siguin del teu interès, per enllaçar amb les darreres notícies publicades a La borrufa.' ); ?></p>
     
    5468        <label for="<?php echo $this->get_field_id( 'lb_widget_esp' ); ?>"><?php _e( 'Esports' ); ?></label></p>
    5569       
     70                <p><input class="checkbox" type="checkbox"<?php checked( $lb_widget_nat ); ?> id="<?php echo $this->get_field_id( 'lb_widget_nat' ); ?>" name="<?php echo $this->get_field_name( 'lb_widget_nat' ); ?>" />
     71        <label for="<?php echo $this->get_field_id( 'lb_widget_nat' ); ?>"><?php _e( 'Natura' ); ?></label></p>
     72       
    5673        <p><input class="checkbox" type="checkbox"<?php checked( $lb_widget_mis ); ?> id="<?php echo $this->get_field_id( 'lb_widget_mis' ); ?>" name="<?php echo $this->get_field_name( 'lb_widget_mis' ); ?>" />
    5774        <label for="<?php echo $this->get_field_id( 'lb_widget_mis' ); ?>"><?php _e( 'Miscel·lani' ); ?></label></p>
     
    6178       
    6279        <p><label for="<?php echo $this->get_field_id( 'lb_num' ); ?>"><?php _e( 'Nombre de notícies que cal mostrar :' ); ?></label>
    63         <input class="tiny-text" id="<?php echo $this->get_field_id( 'lb_num' ); ?>" name="<?php echo $this->get_field_name( 'lb_num' ); ?>" type="number" step="1" min="1" value="<?php echo $lb_num; ?>" size="3" /></p>
     80        <input class="tiny-text" id="<?php echo $this->get_field_id( 'lb_num' ); ?>" name="<?php echo $this->get_field_name( 'lb_num' ); ?>" type="number" step="1" min="1" max= "8" value="<?php echo $lb_num; ?>" size="3" /></p>
    6481       
    6582        <p><input class="checkbox" type="checkbox"<?php checked( $lb_data ); ?> id="<?php echo $this->get_field_id( 'lb_data' ); ?>" name="<?php echo $this->get_field_name( 'lb_data' ); ?>" />
     
    7289                foreach ( $target_options as $target_value => $target_code ) {
    7390                    echo '<option value="' . $target_code . '" id="' . $target_code . '"', $lb_widget_target == $target_code ? ' selected="selected"' : '', '>', $target_value, '</option>';
     91                   
    7492                } ?>    </select>
    7593        </p>
    7694       
     95        <p><label for="<?php echo $this->get_field_id( 'lb_color' ); ?>"><?php _e( 'Color títol de comarques :' ); ?></label>
     96                    <input type="text" class="colorPickerBorrufa" name="<?php echo $this->get_field_name( 'lb_color' ); ?>"  id="<?php echo $this->get_field_id( 'lb_color' ); ?>" value="<?php echo $lb_color; ?>" data-default-color="#000000"/>
     97        </p>
     98        <script type="text/javascript">
     99          jQuery(document).ready(function() {
     100            //jQuery('.colorPickerBorrufa').wpColorPicker();
     101            jQuery('.colorPickerBorrufa').wpColorPicker({
     102                change: function(e, ui) {
     103                    jQuery( e.target ).val( ui.color.toString() );
     104                    jQuery( e.target ).trigger('change'); // enable widget "Save" button
     105                }
     106            });
     107           });
     108        </script>
    77109        <hr style="background: #ccc; border: 0; height: 1px; margin: 20px 0;" />
    78110       
     
    92124        $instance['lb_widget_va'] = isset( $new_instance['lb_widget_va'] ) ? (bool) $new_instance['lb_widget_va'] : false;
    93125        $instance['lb_widget_esp'] = isset( $new_instance['lb_widget_esp'] ) ? (bool) $new_instance['lb_widget_esp'] : false;
     126        $instance['lb_widget_nat'] = isset( $new_instance['lb_widget_nat'] ) ? (bool) $new_instance['lb_widget_nat'] : false;
    94127        $instance['lb_widget_mis'] = isset( $new_instance['lb_widget_mis'] ) ? (bool) $new_instance['lb_widget_mis'] : false;
    95128        $instance['lb_num'] = (int) $new_instance['lb_num'];
    96129        $instance['lb_data'] = isset( $new_instance['lb_data'] ) ? (bool) $new_instance['lb_data'] : false;
    97130        $instance[ 'lb_widget_target' ] = $new_instance[ 'lb_widget_target' ];
     131        $instance['lb_color'] = isset( $new_instance['lb_color'] ) ? $new_instance['lb_color'] : "#000000";
    98132        return $instance;
    99133    }
     
    109143        $lb_widget_va = isset( $instance['lb_widget_va'] ) ? $instance['lb_widget_va'] : false;
    110144        $lb_widget_esp = isset( $instance['lb_widget_esp'] ) ? $instance['lb_widget_esp'] : false;
     145        $lb_widget_nat = isset( $instance['lb_widget_nat'] ) ? $instance['lb_widget_nat'] : false;
    111146        $lb_widget_mis = isset( $instance['lb_widget_mis'] ) ? $instance['lb_widget_mis'] : false;
    112147        $lb_num = ( ! empty( $instance['lb_num'] ) ) ? absint( $instance['lb_num'] ) : 1;
     
    115150        $lb_data = isset( $instance['lb_data'] ) ? $instance['lb_data'] : false;
    116151        $lb_widget_target  = empty( $instance['lb_widget_target'] ) ? '&nbsp;' : $instance['lb_widget_target'];
     152        $lb_color = $instance['lb_color'];
    117153        echo $before_widget;
    118154        echo $before_title.$titol.$after_title;
     
    127163    <?php if (!empty($items)) { ?>
    128164        <br />
    129         <span><b>Alt Urgell</b></span>
    130     <?php
    131     foreach ( $items as $item ) : ?> 
    132     <div>
    133     <br />
    134        <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<span><?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
     165        <span style="color:<?php echo $lb_color; ?>"><b>Alt Urgell</b></span>
     166    <?php
     167    foreach ( $items as $item ) : ?> 
     168    <div>
     169    <br />
     170       <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
    135171    </div>
    136172    <?php endforeach; } } ?>
     
    144180    <?php if (!empty($items)) { ?>
    145181        <br />
    146         <span><b>Alta Ribagorça</b></span>
    147     <?php
    148     foreach ( $items as $item ) : ?> 
    149     <div>
    150     <br />
    151        <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<span><?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
     182        <span style="color:<?php echo $lb_color; ?>"><b>Alta Ribagorça</b></span>
     183    <?php
     184    foreach ( $items as $item ) : ?> 
     185    <div>
     186    <br />
     187       <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
    152188    </div>
    153189    <?php endforeach; } } ?>
     
    161197    <?php if (!empty($items)) { ?>
    162198        <br />
    163         <span><b>Pallars Jussà</b></span>
    164     <?php
    165     foreach ( $items as $item ) : ?> 
    166     <div>
    167     <br />
    168        <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<span><?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
     199        <span style="color:<?php echo $lb_color; ?>"><b>Pallars Jussà</b></span>
     200    <?php
     201    foreach ( $items as $item ) : ?> 
     202    <div>
     203    <br />
     204       <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
    169205    </div>
    170206    <?php endforeach; } } ?>
     
    178214    <?php if (!empty($items)) { ?>
    179215        <br />
    180         <span><b>Pallars Sobirà</b></span>
    181     <?php
    182     foreach ( $items as $item ) : ?> 
    183     <div>
    184     <br />
    185        <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<span><?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
     216        <span style="color:<?php echo $lb_color; ?>"><b>Pallars Sobirà</b></span>
     217    <?php
     218    foreach ( $items as $item ) : ?> 
     219    <div>
     220    <br />
     221       <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
    186222    </div>
    187223    <?php endforeach; } } ?>
     
    191227    $rss = fetch_rss('https://laborrufa.com/noticies/val-daran/feed/');
    192228    $items = $lb_num;
    193     $items = array_slice($rss->items, 0, $lb_num);
     229    if (is_array($rss->items)) {
     230    $items = array_slice($rss->items, 0, $lb_num);
     231    } else { var_dump($rss->items); }
    194232    ?>
    195233    <?php if (!empty($items)) { ?>
    196234        <br />
    197         <span><b>Val d'Aran</b></span>
    198     <?php
    199     foreach ( $items as $item ) : ?>
    200     <div>
    201     <br />
    202        <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<span><?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
     235        <span style="color:<?php echo $lb_color; ?>"><b>Val d'Aran</b></span>
     236    <?php
     237    foreach ( $items as $item ) : ?>
     238    <div>
     239    <br />
     240       <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
    203241    </div>
    204242    <?php endforeach; } } ?>
     
    212250    <?php if (!empty($items)) { ?>
    213251        <br />
    214         <span><b>Esports</b></span>
    215     <?php
    216     foreach ( $items as $item ) : ?>
    217     <div>
    218     <br />
    219        <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<span><?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
     252        <span style="color:<?php echo $lb_color; ?>"><b>Esports</b></span>
     253    <?php
     254    foreach ( $items as $item ) : ?>
     255    <div>
     256    <br />
     257       <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
     258    </div>
     259    <?php endforeach; } } ?>
     260   
     261        <?php if ( $lb_widget_nat) {
     262    include_once(ABSPATH . WPINC . '/rss.php'); 
     263    $rss = fetch_rss('https://laborrufa.com/natura-i-esports/natura/feed/');
     264    $items = $lb_num;
     265    $items = array_slice($rss->items, 0, $lb_num);
     266    ?>
     267    <?php if (!empty($items)) { ?>
     268        <br />
     269        <span style="color:<?php echo $lb_color; ?>"><b>Natura</b></span>
     270    <?php
     271    foreach ( $items as $item ) : ?>
     272    <div>
     273    <br />
     274       <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
    220275    </div>
    221276    <?php endforeach; } } ?>
     
    229284    <?php if (!empty($items)) { ?>
    230285        <br />
    231         <span><b>Miscel·lani</b></span>
    232     <?php
    233     foreach ( $items as $item ) : ?>
    234     <div>
    235     <br />
    236        <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<span><?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
    237     </div>
     286        <span style="color:<?php echo $lb_color; ?>"><b>Miscel·lani</b></span>
     287    <?php
     288    foreach ( $items as $item ) : ?>
     289    <div>
     290    <br />
     291       <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
     292    </div>
     293
    238294    <?php endforeach; } } ?>
    239295    <?php }
    240296    }
     297
    241298    echo $after_widget;
    242299?>
  • borrufa-widget/trunk/Borrufa-Widget/borrufa-widget/trunk/Borrufa-Widget/readme.txt

    r2654774 r2690733  
    44Language: Català
    55Requires at least: 4.3
    6 Tested up to: 5.4
    7 Stable tag: 1.0.3
     6Tested up to: 5.9.1
     7Stable tag: 1.0.4
    88
    99
     
    3232
    3333== Changelog ==
     34= 1.0.2 =
     35* Primera versió del plugin borrufa-widget.
    3436= 1.0.3 =
    3537* Ampliació d'una nova categoria en les seccions de notícies .
    36 = 1.0.2 =
    37 * Primera versió del plugin borrufa-widget.
     38= 1.0.4 =
     39* Ampliació d'una paleta de color per a títols de notícies .
    3840
    3941
     
    4143
    4244--Jordi Soler
    43 http://laborrufa.com/
     45https://laborrufa.com/
    4446== Copyright © Serveis Publicitaris del Pirineu S.L. ==
  • borrufa-widget/trunk/Borrufa-Widget/borrufa-widget/trunk/borrufa_widget.php

    r2012876 r2690733  
    55Description: Mètode senzill per afegir a la barra lateral o al peu del tema, les notícies de les comarques del Pirineu de Lleida, publicades diàriament a La borrufa, compatible per a qualsevol tema WordPress.
    66Author: Jordi Soler
    7 Version: 1.0.2
     7Version: 1.0.4
    88Author URI: https://laborrufa.com
    99License:   GPL2
     
    2020        register_widget("borrufa_widget_class");
    2121    }
     22       
     23        wp_enqueue_style( 'wp-color-picker' );
     24        wp_enqueue_script( 'wp-color-picker' );
    2225}
  • borrufa-widget/trunk/Borrufa-Widget/borrufa-widget/trunk/borrufa_widget_class.php

    r2012876 r2690733  
    1818        (
    1919            "titol" => __( 'Notícies La borrufa' ),
     20            "lb_widget_au" => false,
     21            "lb_widget_ar" => false,
     22            "lb_widget_pj" => false,
     23            "lb_widget_ps" => false,
     24            "lb_widget_va" => false,
     25            "lb_widget_esp" => false,
     26            "lb_widget_nat" => false,
     27            "lb_widget_mis" => false,
     28            "lb_num" => 1,
     29            "lb_data" => false,
     30            "lb_widget_target" => 1,
     31            "lb_color" => "#000000",
    2032        );
    2133        $instance = wp_parse_args((array)$instance,$defaults);
     
    2739        $lb_widget_va = isset( $instance['lb_widget_va'] ) ? (bool) $instance['lb_widget_va'] : false;
    2840        $lb_widget_esp = isset( $instance['lb_widget_esp'] ) ? (bool) $instance['lb_widget_esp'] : false;
     41        $lb_widget_nat = isset( $instance['lb_widget_nat'] ) ? (bool) $instance['lb_widget_nat'] : false;
    2942        $lb_widget_mis = isset( $instance['lb_widget_mis'] ) ? (bool) $instance['lb_widget_mis'] : false;
    3043        $lb_num    = isset( $instance['lb_num'] ) ? absint( $instance['lb_num'] ) : 1;
    3144        $lb_data = isset( $instance['lb_data'] ) ? (bool) $instance['lb_data'] : false;
    3245        $lb_widget_target = isset( $instance['lb_widget_target'] ) ? $instance['lb_widget_target'] : 1;
     46        $lb_color = isset( $instance['lb_color'] ) ? $instance['lb_color'] : "#000000";
    3347        ?>
    34         <p>Títol : <input type="text" name="<?php echo $this->get_field_name("titol")?>" value="<?php echo $titol?>" class="widefat" /></p>
     48        <p>Títol : <input type="text" name="<?php echo $this->get_field_name("titol")?>" value="<?php echo $titol; ?>" class="widefat" /></p>
    3549
    3650        <p><?php _e( 'Selecciona les comarques o categories que siguin del teu interès, per enllaçar amb les darreres notícies publicades a La borrufa.' ); ?></p>
     
    5468        <label for="<?php echo $this->get_field_id( 'lb_widget_esp' ); ?>"><?php _e( 'Esports' ); ?></label></p>
    5569       
     70                <p><input class="checkbox" type="checkbox"<?php checked( $lb_widget_nat ); ?> id="<?php echo $this->get_field_id( 'lb_widget_nat' ); ?>" name="<?php echo $this->get_field_name( 'lb_widget_nat' ); ?>" />
     71        <label for="<?php echo $this->get_field_id( 'lb_widget_nat' ); ?>"><?php _e( 'Natura' ); ?></label></p>
     72       
    5673        <p><input class="checkbox" type="checkbox"<?php checked( $lb_widget_mis ); ?> id="<?php echo $this->get_field_id( 'lb_widget_mis' ); ?>" name="<?php echo $this->get_field_name( 'lb_widget_mis' ); ?>" />
    5774        <label for="<?php echo $this->get_field_id( 'lb_widget_mis' ); ?>"><?php _e( 'Miscel·lani' ); ?></label></p>
     
    6178       
    6279        <p><label for="<?php echo $this->get_field_id( 'lb_num' ); ?>"><?php _e( 'Nombre de notícies que cal mostrar :' ); ?></label>
    63         <input class="tiny-text" id="<?php echo $this->get_field_id( 'lb_num' ); ?>" name="<?php echo $this->get_field_name( 'lb_num' ); ?>" type="number" step="1" min="1" value="<?php echo $lb_num; ?>" size="3" /></p>
     80        <input class="tiny-text" id="<?php echo $this->get_field_id( 'lb_num' ); ?>" name="<?php echo $this->get_field_name( 'lb_num' ); ?>" type="number" step="1" min="1" max= "8" value="<?php echo $lb_num; ?>" size="3" /></p>
    6481       
    6582        <p><input class="checkbox" type="checkbox"<?php checked( $lb_data ); ?> id="<?php echo $this->get_field_id( 'lb_data' ); ?>" name="<?php echo $this->get_field_name( 'lb_data' ); ?>" />
     
    7289                foreach ( $target_options as $target_value => $target_code ) {
    7390                    echo '<option value="' . $target_code . '" id="' . $target_code . '"', $lb_widget_target == $target_code ? ' selected="selected"' : '', '>', $target_value, '</option>';
     91                   
    7492                } ?>    </select>
    7593        </p>
    7694       
     95        <p><label for="<?php echo $this->get_field_id( 'lb_color' ); ?>"><?php _e( 'Color títol de comarques :' ); ?></label>
     96                    <input type="text" class="colorPickerBorrufa" name="<?php echo $this->get_field_name( 'lb_color' ); ?>"  id="<?php echo $this->get_field_id( 'lb_color' ); ?>" value="<?php echo $lb_color; ?>" data-default-color="#000000"/>
     97        </p>
     98        <script type="text/javascript">
     99          jQuery(document).ready(function() {
     100            //jQuery('.colorPickerBorrufa').wpColorPicker();
     101            jQuery('.colorPickerBorrufa').wpColorPicker({
     102                change: function(e, ui) {
     103                    jQuery( e.target ).val( ui.color.toString() );
     104                    jQuery( e.target ).trigger('change'); // enable widget "Save" button
     105                }
     106            });
     107           });
     108        </script>
    77109        <hr style="background: #ccc; border: 0; height: 1px; margin: 20px 0;" />
    78110       
     
    92124        $instance['lb_widget_va'] = isset( $new_instance['lb_widget_va'] ) ? (bool) $new_instance['lb_widget_va'] : false;
    93125        $instance['lb_widget_esp'] = isset( $new_instance['lb_widget_esp'] ) ? (bool) $new_instance['lb_widget_esp'] : false;
     126        $instance['lb_widget_nat'] = isset( $new_instance['lb_widget_nat'] ) ? (bool) $new_instance['lb_widget_nat'] : false;
    94127        $instance['lb_widget_mis'] = isset( $new_instance['lb_widget_mis'] ) ? (bool) $new_instance['lb_widget_mis'] : false;
    95128        $instance['lb_num'] = (int) $new_instance['lb_num'];
    96129        $instance['lb_data'] = isset( $new_instance['lb_data'] ) ? (bool) $new_instance['lb_data'] : false;
    97130        $instance[ 'lb_widget_target' ] = $new_instance[ 'lb_widget_target' ];
     131        $instance['lb_color'] = isset( $new_instance['lb_color'] ) ? $new_instance['lb_color'] : "#000000";
    98132        return $instance;
    99133    }
     
    109143        $lb_widget_va = isset( $instance['lb_widget_va'] ) ? $instance['lb_widget_va'] : false;
    110144        $lb_widget_esp = isset( $instance['lb_widget_esp'] ) ? $instance['lb_widget_esp'] : false;
     145        $lb_widget_nat = isset( $instance['lb_widget_nat'] ) ? $instance['lb_widget_nat'] : false;
    111146        $lb_widget_mis = isset( $instance['lb_widget_mis'] ) ? $instance['lb_widget_mis'] : false;
    112147        $lb_num = ( ! empty( $instance['lb_num'] ) ) ? absint( $instance['lb_num'] ) : 1;
     
    115150        $lb_data = isset( $instance['lb_data'] ) ? $instance['lb_data'] : false;
    116151        $lb_widget_target  = empty( $instance['lb_widget_target'] ) ? '&nbsp;' : $instance['lb_widget_target'];
     152        $lb_color = $instance['lb_color'];
    117153        echo $before_widget;
    118154        echo $before_title.$titol.$after_title;
     
    127163    <?php if (!empty($items)) { ?>
    128164        <br />
    129         <span><b>Alt Urgell</b></span>
    130     <?php
    131     foreach ( $items as $item ) : ?> 
    132     <div>
    133     <br />
    134        <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<span><?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
     165        <span style="color:<?php echo $lb_color; ?>"><b>Alt Urgell</b></span>
     166    <?php
     167    foreach ( $items as $item ) : ?> 
     168    <div>
     169    <br />
     170       <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
    135171    </div>
    136172    <?php endforeach; } } ?>
     
    144180    <?php if (!empty($items)) { ?>
    145181        <br />
    146         <span><b>Alta Ribagorça</b></span>
    147     <?php
    148     foreach ( $items as $item ) : ?> 
    149     <div>
    150     <br />
    151        <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<span><?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
     182        <span style="color:<?php echo $lb_color; ?>"><b>Alta Ribagorça</b></span>
     183    <?php
     184    foreach ( $items as $item ) : ?> 
     185    <div>
     186    <br />
     187       <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
    152188    </div>
    153189    <?php endforeach; } } ?>
     
    161197    <?php if (!empty($items)) { ?>
    162198        <br />
    163         <span><b>Pallars Jussà</b></span>
    164     <?php
    165     foreach ( $items as $item ) : ?> 
    166     <div>
    167     <br />
    168        <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<span><?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
     199        <span style="color:<?php echo $lb_color; ?>"><b>Pallars Jussà</b></span>
     200    <?php
     201    foreach ( $items as $item ) : ?> 
     202    <div>
     203    <br />
     204       <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
    169205    </div>
    170206    <?php endforeach; } } ?>
     
    178214    <?php if (!empty($items)) { ?>
    179215        <br />
    180         <span><b>Pallars Sobirà</b></span>
    181     <?php
    182     foreach ( $items as $item ) : ?> 
    183     <div>
    184     <br />
    185        <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<span><?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
     216        <span style="color:<?php echo $lb_color; ?>"><b>Pallars Sobirà</b></span>
     217    <?php
     218    foreach ( $items as $item ) : ?> 
     219    <div>
     220    <br />
     221       <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
    186222    </div>
    187223    <?php endforeach; } } ?>
     
    191227    $rss = fetch_rss('https://laborrufa.com/noticies/val-daran/feed/');
    192228    $items = $lb_num;
    193     $items = array_slice($rss->items, 0, $lb_num);
     229    if (is_array($rss->items)) {
     230    $items = array_slice($rss->items, 0, $lb_num);
     231    } else { var_dump($rss->items); }
    194232    ?>
    195233    <?php if (!empty($items)) { ?>
    196234        <br />
    197         <span><b>Val d'Aran</b></span>
    198     <?php
    199     foreach ( $items as $item ) : ?>
    200     <div>
    201     <br />
    202        <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<span><?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
     235        <span style="color:<?php echo $lb_color; ?>"><b>Val d'Aran</b></span>
     236    <?php
     237    foreach ( $items as $item ) : ?>
     238    <div>
     239    <br />
     240       <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
    203241    </div>
    204242    <?php endforeach; } } ?>
     
    212250    <?php if (!empty($items)) { ?>
    213251        <br />
    214         <span><b>Esports</b></span>
    215     <?php
    216     foreach ( $items as $item ) : ?>
    217     <div>
    218     <br />
    219        <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<span><?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
     252        <span style="color:<?php echo $lb_color; ?>"><b>Esports</b></span>
     253    <?php
     254    foreach ( $items as $item ) : ?>
     255    <div>
     256    <br />
     257       <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
     258    </div>
     259    <?php endforeach; } } ?>
     260   
     261        <?php if ( $lb_widget_nat) {
     262    include_once(ABSPATH . WPINC . '/rss.php'); 
     263    $rss = fetch_rss('https://laborrufa.com/natura-i-esports/natura/feed/');
     264    $items = $lb_num;
     265    $items = array_slice($rss->items, 0, $lb_num);
     266    ?>
     267    <?php if (!empty($items)) { ?>
     268        <br />
     269        <span style="color:<?php echo $lb_color; ?>"><b>Natura</b></span>
     270    <?php
     271    foreach ( $items as $item ) : ?>
     272    <div>
     273    <br />
     274       <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
    220275    </div>
    221276    <?php endforeach; } } ?>
     
    229284    <?php if (!empty($items)) { ?>
    230285        <br />
    231         <span><b>Miscel·lani</b></span>
    232     <?php
    233     foreach ( $items as $item ) : ?>
    234     <div>
    235     <br />
    236        <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<span><?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
    237     </div>
     286        <span style="color:<?php echo $lb_color; ?>"><b>Miscel·lani</b></span>
     287    <?php
     288    foreach ( $items as $item ) : ?>
     289    <div>
     290    <br />
     291       <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
     292    </div>
     293
    238294    <?php endforeach; } } ?>
    239295    <?php }
    240296    }
     297
    241298    echo $after_widget;
    242299?>
  • borrufa-widget/trunk/Borrufa-Widget/borrufa-widget/trunk/readme.txt

    r2654772 r2690733  
    44Language: Català
    55Requires at least: 4.3
    6 Tested up to: 5.4
    7 Stable tag: 1.0.3
     6Tested up to: 5.9.1
     7Stable tag: 1.0.4
    88
    99
     
    3232
    3333== Changelog ==
     34= 1.0.2 =
     35* Primera versió del plugin borrufa-widget.
    3436= 1.0.3 =
    3537* Ampliació d'una nova categoria en les seccions de notícies .
    36 = 1.0.2 =
    37 * Primera versió del plugin borrufa-widget.
     38= 1.0.4 =
     39* Ampliació d'una paleta de color per a títols de notícies .
    3840
    3941
     
    4143
    4244--Jordi Soler
    43 http://laborrufa.com/
     45https://laborrufa.com/
    4446== Copyright © Serveis Publicitaris del Pirineu S.L. ==
  • borrufa-widget/trunk/Borrufa-Widget/borrufa_widget.php

    r2012876 r2690733  
    55Description: Mètode senzill per afegir a la barra lateral o al peu del tema, les notícies de les comarques del Pirineu de Lleida, publicades diàriament a La borrufa, compatible per a qualsevol tema WordPress.
    66Author: Jordi Soler
    7 Version: 1.0.3
     7Version: 1.0.4
    88Author URI: https://laborrufa.com
    99License:   GPL2
     
    2020        register_widget("borrufa_widget_class");
    2121    }
     22       
     23        wp_enqueue_style( 'wp-color-picker' );
     24        wp_enqueue_script( 'wp-color-picker' );
    2225}
  • borrufa-widget/trunk/Borrufa-Widget/borrufa_widget_class.php

    r2012876 r2690733  
    1818        (
    1919            "titol" => __( 'Notícies La borrufa' ),
     20            "lb_widget_au" => false,
     21            "lb_widget_ar" => false,
     22            "lb_widget_pj" => false,
     23            "lb_widget_ps" => false,
     24            "lb_widget_va" => false,
     25            "lb_widget_esp" => false,
     26            "lb_widget_nat" => false,
     27            "lb_widget_mis" => false,
     28            "lb_num" => 1,
     29            "lb_data" => false,
     30            "lb_widget_target" => 1,
     31            "lb_color" => "#000000",
    2032        );
    2133        $instance = wp_parse_args((array)$instance,$defaults);
     
    3244        $lb_data = isset( $instance['lb_data'] ) ? (bool) $instance['lb_data'] : false;
    3345        $lb_widget_target = isset( $instance['lb_widget_target'] ) ? $instance['lb_widget_target'] : 1;
     46        $lb_color = isset( $instance['lb_color'] ) ? $instance['lb_color'] : "#000000";
    3447        ?>
    35         <p>Títol : <input type="text" name="<?php echo $this->get_field_name("titol")?>" value="<?php echo $titol?>" class="widefat" /></p>
     48        <p>Títol : <input type="text" name="<?php echo $this->get_field_name("titol")?>" value="<?php echo $titol; ?>" class="widefat" /></p>
    3649
    3750        <p><?php _e( 'Selecciona les comarques o categories que siguin del teu interès, per enllaçar amb les darreres notícies publicades a La borrufa.' ); ?></p>
     
    6578       
    6679        <p><label for="<?php echo $this->get_field_id( 'lb_num' ); ?>"><?php _e( 'Nombre de notícies que cal mostrar :' ); ?></label>
    67         <input class="tiny-text" id="<?php echo $this->get_field_id( 'lb_num' ); ?>" name="<?php echo $this->get_field_name( 'lb_num' ); ?>" type="number" step="1" min="1" value="<?php echo $lb_num; ?>" size="3" /></p>
     80        <input class="tiny-text" id="<?php echo $this->get_field_id( 'lb_num' ); ?>" name="<?php echo $this->get_field_name( 'lb_num' ); ?>" type="number" step="1" min="1" max= "8" value="<?php echo $lb_num; ?>" size="3" /></p>
    6881       
    6982        <p><input class="checkbox" type="checkbox"<?php checked( $lb_data ); ?> id="<?php echo $this->get_field_id( 'lb_data' ); ?>" name="<?php echo $this->get_field_name( 'lb_data' ); ?>" />
     
    7689                foreach ( $target_options as $target_value => $target_code ) {
    7790                    echo '<option value="' . $target_code . '" id="' . $target_code . '"', $lb_widget_target == $target_code ? ' selected="selected"' : '', '>', $target_value, '</option>';
     91                   
    7892                } ?>    </select>
    7993        </p>
    8094       
     95        <p><label for="<?php echo $this->get_field_id( 'lb_color' ); ?>"><?php _e( 'Color títol de comarques :' ); ?></label>
     96                    <input type="text" class="colorPickerBorrufa" name="<?php echo $this->get_field_name( 'lb_color' ); ?>"  id="<?php echo $this->get_field_id( 'lb_color' ); ?>" value="<?php echo $lb_color; ?>" data-default-color="#000000"/>
     97        </p>
     98        <script type="text/javascript">
     99          jQuery(document).ready(function() {
     100            //jQuery('.colorPickerBorrufa').wpColorPicker();
     101            jQuery('.colorPickerBorrufa').wpColorPicker({
     102                change: function(e, ui) {
     103                    jQuery( e.target ).val( ui.color.toString() );
     104                    jQuery( e.target ).trigger('change'); // enable widget "Save" button
     105                }
     106            });
     107           });
     108        </script>
    81109        <hr style="background: #ccc; border: 0; height: 1px; margin: 20px 0;" />
    82110       
     
    101129        $instance['lb_data'] = isset( $new_instance['lb_data'] ) ? (bool) $new_instance['lb_data'] : false;
    102130        $instance[ 'lb_widget_target' ] = $new_instance[ 'lb_widget_target' ];
     131        $instance['lb_color'] = isset( $new_instance['lb_color'] ) ? $new_instance['lb_color'] : "#000000";
    103132        return $instance;
    104133    }
     
    121150        $lb_data = isset( $instance['lb_data'] ) ? $instance['lb_data'] : false;
    122151        $lb_widget_target  = empty( $instance['lb_widget_target'] ) ? '&nbsp;' : $instance['lb_widget_target'];
     152        $lb_color = $instance['lb_color'];
    123153        echo $before_widget;
    124154        echo $before_title.$titol.$after_title;
     
    133163    <?php if (!empty($items)) { ?>
    134164        <br />
    135         <span><b>Alt Urgell</b></span>
    136     <?php
    137     foreach ( $items as $item ) : ?> 
    138     <div>
    139     <br />
    140        <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<span><?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
     165        <span style="color:<?php echo $lb_color; ?>"><b>Alt Urgell</b></span>
     166    <?php
     167    foreach ( $items as $item ) : ?> 
     168    <div>
     169    <br />
     170       <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
    141171    </div>
    142172    <?php endforeach; } } ?>
     
    150180    <?php if (!empty($items)) { ?>
    151181        <br />
    152         <span><b>Alta Ribagorça</b></span>
    153     <?php
    154     foreach ( $items as $item ) : ?> 
    155     <div>
    156     <br />
    157        <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<span><?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
     182        <span style="color:<?php echo $lb_color; ?>"><b>Alta Ribagorça</b></span>
     183    <?php
     184    foreach ( $items as $item ) : ?> 
     185    <div>
     186    <br />
     187       <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
    158188    </div>
    159189    <?php endforeach; } } ?>
     
    167197    <?php if (!empty($items)) { ?>
    168198        <br />
    169         <span><b>Pallars Jussà</b></span>
    170     <?php
    171     foreach ( $items as $item ) : ?> 
    172     <div>
    173     <br />
    174        <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<span><?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
     199        <span style="color:<?php echo $lb_color; ?>"><b>Pallars Jussà</b></span>
     200    <?php
     201    foreach ( $items as $item ) : ?> 
     202    <div>
     203    <br />
     204       <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
    175205    </div>
    176206    <?php endforeach; } } ?>
     
    184214    <?php if (!empty($items)) { ?>
    185215        <br />
    186         <span><b>Pallars Sobirà</b></span>
    187     <?php
    188     foreach ( $items as $item ) : ?> 
    189     <div>
    190     <br />
    191        <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<span><?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
     216        <span style="color:<?php echo $lb_color; ?>"><b>Pallars Sobirà</b></span>
     217    <?php
     218    foreach ( $items as $item ) : ?> 
     219    <div>
     220    <br />
     221       <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
    192222    </div>
    193223    <?php endforeach; } } ?>
     
    197227    $rss = fetch_rss('https://laborrufa.com/noticies/val-daran/feed/');
    198228    $items = $lb_num;
    199     $items = array_slice($rss->items, 0, $lb_num);
     229    if (is_array($rss->items)) {
     230    $items = array_slice($rss->items, 0, $lb_num);
     231    } else { var_dump($rss->items); }
    200232    ?>
    201233    <?php if (!empty($items)) { ?>
    202234        <br />
    203         <span><b>Val d'Aran</b></span>
    204     <?php
    205     foreach ( $items as $item ) : ?>
    206     <div>
    207     <br />
    208        <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<span><?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
     235        <span style="color:<?php echo $lb_color; ?>"><b>Val d'Aran</b></span>
     236    <?php
     237    foreach ( $items as $item ) : ?>
     238    <div>
     239    <br />
     240       <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
    209241    </div>
    210242    <?php endforeach; } } ?>
     
    218250    <?php if (!empty($items)) { ?>
    219251        <br />
    220         <span><b>Esports</b></span>
    221     <?php
    222     foreach ( $items as $item ) : ?>
    223     <div>
    224     <br />
    225        <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<span><?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
     252        <span style="color:<?php echo $lb_color; ?>"><b>Esports</b></span>
     253    <?php
     254    foreach ( $items as $item ) : ?>
     255    <div>
     256    <br />
     257       <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
    226258    </div>
    227259    <?php endforeach; } } ?>
     
    235267    <?php if (!empty($items)) { ?>
    236268        <br />
    237         <span><b>Natura</b></span>
    238     <?php
    239     foreach ( $items as $item ) : ?>
    240     <div>
    241     <br />
    242        <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<span><?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
     269        <span style="color:<?php echo $lb_color; ?>"><b>Natura</b></span>
     270    <?php
     271    foreach ( $items as $item ) : ?>
     272    <div>
     273    <br />
     274       <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
    243275    </div>
    244276    <?php endforeach; } } ?>
     
    252284    <?php if (!empty($items)) { ?>
    253285        <br />
    254         <span><b>Miscel·lani</b></span>
    255     <?php
    256     foreach ( $items as $item ) : ?>
    257     <div>
    258     <br />
    259        <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<span><?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
    260     </div>
     286        <span style="color:<?php echo $lb_color; ?>"><b>Miscel·lani</b></span>
     287    <?php
     288    foreach ( $items as $item ) : ?>
     289    <div>
     290    <br />
     291       <a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'<?php if ( $lb_widget_target == 1 ) { ?> target="_blank" <?php } ?>><?php echo $item['title']; ?></a>&nbsp;<span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?>&nbsp;<?php _e( '[La borrufa | Pirineu comarques]' ); ?></span>
     292    </div>
     293
    261294    <?php endforeach; } } ?>
    262295    <?php }
    263296    }
     297
    264298    echo $after_widget;
    265299?>
Note: See TracChangeset for help on using the changeset viewer.