Changeset 2690733
- Timestamp:
- 03/08/2022 11:28:11 AM (4 years ago)
- Location:
- borrufa-widget/trunk/Borrufa-Widget
- Files:
-
- 8 edited
-
borrufa-widget/trunk/Borrufa-Widget/borrufa_widget.php (modified) (2 diffs)
-
borrufa-widget/trunk/Borrufa-Widget/borrufa_widget_class.php (modified) (15 diffs)
-
borrufa-widget/trunk/Borrufa-Widget/readme.txt (modified) (3 diffs)
-
borrufa-widget/trunk/borrufa_widget.php (modified) (2 diffs)
-
borrufa-widget/trunk/borrufa_widget_class.php (modified) (15 diffs)
-
borrufa-widget/trunk/readme.txt (modified) (3 diffs)
-
borrufa_widget.php (modified) (2 diffs)
-
borrufa_widget_class.php (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
borrufa-widget/trunk/Borrufa-Widget/borrufa-widget/trunk/Borrufa-Widget/borrufa_widget.php
r2012876 r2690733 5 5 Description: 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. 6 6 Author: Jordi Soler 7 Version: 1.0. 27 Version: 1.0.4 8 8 Author URI: https://laborrufa.com 9 9 License: GPL2 … … 20 20 register_widget("borrufa_widget_class"); 21 21 } 22 23 wp_enqueue_style( 'wp-color-picker' ); 24 wp_enqueue_script( 'wp-color-picker' ); 22 25 } -
borrufa-widget/trunk/Borrufa-Widget/borrufa-widget/trunk/Borrufa-Widget/borrufa_widget_class.php
r2012876 r2690733 18 18 ( 19 19 "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", 20 32 ); 21 33 $instance = wp_parse_args((array)$instance,$defaults); … … 27 39 $lb_widget_va = isset( $instance['lb_widget_va'] ) ? (bool) $instance['lb_widget_va'] : false; 28 40 $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; 29 42 $lb_widget_mis = isset( $instance['lb_widget_mis'] ) ? (bool) $instance['lb_widget_mis'] : false; 30 43 $lb_num = isset( $instance['lb_num'] ) ? absint( $instance['lb_num'] ) : 1; 31 44 $lb_data = isset( $instance['lb_data'] ) ? (bool) $instance['lb_data'] : false; 32 45 $lb_widget_target = isset( $instance['lb_widget_target'] ) ? $instance['lb_widget_target'] : 1; 46 $lb_color = isset( $instance['lb_color'] ) ? $instance['lb_color'] : "#000000"; 33 47 ?> 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> 35 49 36 50 <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> … … 54 68 <label for="<?php echo $this->get_field_id( 'lb_widget_esp' ); ?>"><?php _e( 'Esports' ); ?></label></p> 55 69 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 56 73 <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' ); ?>" /> 57 74 <label for="<?php echo $this->get_field_id( 'lb_widget_mis' ); ?>"><?php _e( 'Miscel·lani' ); ?></label></p> … … 61 78 62 79 <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> 64 81 65 82 <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' ); ?>" /> … … 72 89 foreach ( $target_options as $target_value => $target_code ) { 73 90 echo '<option value="' . $target_code . '" id="' . $target_code . '"', $lb_widget_target == $target_code ? ' selected="selected"' : '', '>', $target_value, '</option>'; 91 74 92 } ?> </select> 75 93 </p> 76 94 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> 77 109 <hr style="background: #ccc; border: 0; height: 1px; margin: 20px 0;" /> 78 110 … … 92 124 $instance['lb_widget_va'] = isset( $new_instance['lb_widget_va'] ) ? (bool) $new_instance['lb_widget_va'] : false; 93 125 $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; 94 127 $instance['lb_widget_mis'] = isset( $new_instance['lb_widget_mis'] ) ? (bool) $new_instance['lb_widget_mis'] : false; 95 128 $instance['lb_num'] = (int) $new_instance['lb_num']; 96 129 $instance['lb_data'] = isset( $new_instance['lb_data'] ) ? (bool) $new_instance['lb_data'] : false; 97 130 $instance[ 'lb_widget_target' ] = $new_instance[ 'lb_widget_target' ]; 131 $instance['lb_color'] = isset( $new_instance['lb_color'] ) ? $new_instance['lb_color'] : "#000000"; 98 132 return $instance; 99 133 } … … 109 143 $lb_widget_va = isset( $instance['lb_widget_va'] ) ? $instance['lb_widget_va'] : false; 110 144 $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; 111 146 $lb_widget_mis = isset( $instance['lb_widget_mis'] ) ? $instance['lb_widget_mis'] : false; 112 147 $lb_num = ( ! empty( $instance['lb_num'] ) ) ? absint( $instance['lb_num'] ) : 1; … … 115 150 $lb_data = isset( $instance['lb_data'] ) ? $instance['lb_data'] : false; 116 151 $lb_widget_target = empty( $instance['lb_widget_target'] ) ? ' ' : $instance['lb_widget_target']; 152 $lb_color = $instance['lb_color']; 117 153 echo $before_widget; 118 154 echo $before_title.$titol.$after_title; … … 127 163 <?php if (!empty($items)) { ?> 128 164 <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> < ?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <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> <span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <?php _e( '[La borrufa | Pirineu comarques]' ); ?></span> 135 171 </div> 136 172 <?php endforeach; } } ?> … … 144 180 <?php if (!empty($items)) { ?> 145 181 <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> < ?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <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> <span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <?php _e( '[La borrufa | Pirineu comarques]' ); ?></span> 152 188 </div> 153 189 <?php endforeach; } } ?> … … 161 197 <?php if (!empty($items)) { ?> 162 198 <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> < ?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <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> <span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <?php _e( '[La borrufa | Pirineu comarques]' ); ?></span> 169 205 </div> 170 206 <?php endforeach; } } ?> … … 178 214 <?php if (!empty($items)) { ?> 179 215 <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> < ?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <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> <span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <?php _e( '[La borrufa | Pirineu comarques]' ); ?></span> 186 222 </div> 187 223 <?php endforeach; } } ?> … … 191 227 $rss = fetch_rss('https://laborrufa.com/noticies/val-daran/feed/'); 192 228 $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); } 194 232 ?> 195 233 <?php if (!empty($items)) { ?> 196 234 <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> < ?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <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> <span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <?php _e( '[La borrufa | Pirineu comarques]' ); ?></span> 203 241 </div> 204 242 <?php endforeach; } } ?> … … 212 250 <?php if (!empty($items)) { ?> 213 251 <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> <?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <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> <span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <?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> <span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <?php _e( '[La borrufa | Pirineu comarques]' ); ?></span> 220 275 </div> 221 276 <?php endforeach; } } ?> … … 229 284 <?php if (!empty($items)) { ?> 230 285 <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> <?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <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> <span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <?php _e( '[La borrufa | Pirineu comarques]' ); ?></span> 292 </div> 293 238 294 <?php endforeach; } } ?> 239 295 <?php } 240 296 } 297 241 298 echo $after_widget; 242 299 ?> -
borrufa-widget/trunk/Borrufa-Widget/borrufa-widget/trunk/Borrufa-Widget/readme.txt
r2654774 r2690733 4 4 Language: Català 5 5 Requires at least: 4.3 6 Tested up to: 5. 47 Stable tag: 1.0. 36 Tested up to: 5.9.1 7 Stable tag: 1.0.4 8 8 9 9 … … 32 32 33 33 == Changelog == 34 = 1.0.2 = 35 * Primera versió del plugin borrufa-widget. 34 36 = 1.0.3 = 35 37 * 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 . 38 40 39 41 … … 41 43 42 44 --Jordi Soler 43 http ://laborrufa.com/45 https://laborrufa.com/ 44 46 == Copyright © Serveis Publicitaris del Pirineu S.L. == -
borrufa-widget/trunk/Borrufa-Widget/borrufa-widget/trunk/borrufa_widget.php
r2012876 r2690733 5 5 Description: 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. 6 6 Author: Jordi Soler 7 Version: 1.0. 27 Version: 1.0.4 8 8 Author URI: https://laborrufa.com 9 9 License: GPL2 … … 20 20 register_widget("borrufa_widget_class"); 21 21 } 22 23 wp_enqueue_style( 'wp-color-picker' ); 24 wp_enqueue_script( 'wp-color-picker' ); 22 25 } -
borrufa-widget/trunk/Borrufa-Widget/borrufa-widget/trunk/borrufa_widget_class.php
r2012876 r2690733 18 18 ( 19 19 "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", 20 32 ); 21 33 $instance = wp_parse_args((array)$instance,$defaults); … … 27 39 $lb_widget_va = isset( $instance['lb_widget_va'] ) ? (bool) $instance['lb_widget_va'] : false; 28 40 $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; 29 42 $lb_widget_mis = isset( $instance['lb_widget_mis'] ) ? (bool) $instance['lb_widget_mis'] : false; 30 43 $lb_num = isset( $instance['lb_num'] ) ? absint( $instance['lb_num'] ) : 1; 31 44 $lb_data = isset( $instance['lb_data'] ) ? (bool) $instance['lb_data'] : false; 32 45 $lb_widget_target = isset( $instance['lb_widget_target'] ) ? $instance['lb_widget_target'] : 1; 46 $lb_color = isset( $instance['lb_color'] ) ? $instance['lb_color'] : "#000000"; 33 47 ?> 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> 35 49 36 50 <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> … … 54 68 <label for="<?php echo $this->get_field_id( 'lb_widget_esp' ); ?>"><?php _e( 'Esports' ); ?></label></p> 55 69 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 56 73 <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' ); ?>" /> 57 74 <label for="<?php echo $this->get_field_id( 'lb_widget_mis' ); ?>"><?php _e( 'Miscel·lani' ); ?></label></p> … … 61 78 62 79 <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> 64 81 65 82 <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' ); ?>" /> … … 72 89 foreach ( $target_options as $target_value => $target_code ) { 73 90 echo '<option value="' . $target_code . '" id="' . $target_code . '"', $lb_widget_target == $target_code ? ' selected="selected"' : '', '>', $target_value, '</option>'; 91 74 92 } ?> </select> 75 93 </p> 76 94 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> 77 109 <hr style="background: #ccc; border: 0; height: 1px; margin: 20px 0;" /> 78 110 … … 92 124 $instance['lb_widget_va'] = isset( $new_instance['lb_widget_va'] ) ? (bool) $new_instance['lb_widget_va'] : false; 93 125 $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; 94 127 $instance['lb_widget_mis'] = isset( $new_instance['lb_widget_mis'] ) ? (bool) $new_instance['lb_widget_mis'] : false; 95 128 $instance['lb_num'] = (int) $new_instance['lb_num']; 96 129 $instance['lb_data'] = isset( $new_instance['lb_data'] ) ? (bool) $new_instance['lb_data'] : false; 97 130 $instance[ 'lb_widget_target' ] = $new_instance[ 'lb_widget_target' ]; 131 $instance['lb_color'] = isset( $new_instance['lb_color'] ) ? $new_instance['lb_color'] : "#000000"; 98 132 return $instance; 99 133 } … … 109 143 $lb_widget_va = isset( $instance['lb_widget_va'] ) ? $instance['lb_widget_va'] : false; 110 144 $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; 111 146 $lb_widget_mis = isset( $instance['lb_widget_mis'] ) ? $instance['lb_widget_mis'] : false; 112 147 $lb_num = ( ! empty( $instance['lb_num'] ) ) ? absint( $instance['lb_num'] ) : 1; … … 115 150 $lb_data = isset( $instance['lb_data'] ) ? $instance['lb_data'] : false; 116 151 $lb_widget_target = empty( $instance['lb_widget_target'] ) ? ' ' : $instance['lb_widget_target']; 152 $lb_color = $instance['lb_color']; 117 153 echo $before_widget; 118 154 echo $before_title.$titol.$after_title; … … 127 163 <?php if (!empty($items)) { ?> 128 164 <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> < ?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <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> <span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <?php _e( '[La borrufa | Pirineu comarques]' ); ?></span> 135 171 </div> 136 172 <?php endforeach; } } ?> … … 144 180 <?php if (!empty($items)) { ?> 145 181 <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> < ?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <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> <span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <?php _e( '[La borrufa | Pirineu comarques]' ); ?></span> 152 188 </div> 153 189 <?php endforeach; } } ?> … … 161 197 <?php if (!empty($items)) { ?> 162 198 <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> < ?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <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> <span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <?php _e( '[La borrufa | Pirineu comarques]' ); ?></span> 169 205 </div> 170 206 <?php endforeach; } } ?> … … 178 214 <?php if (!empty($items)) { ?> 179 215 <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> < ?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <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> <span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <?php _e( '[La borrufa | Pirineu comarques]' ); ?></span> 186 222 </div> 187 223 <?php endforeach; } } ?> … … 191 227 $rss = fetch_rss('https://laborrufa.com/noticies/val-daran/feed/'); 192 228 $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); } 194 232 ?> 195 233 <?php if (!empty($items)) { ?> 196 234 <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> < ?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <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> <span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <?php _e( '[La borrufa | Pirineu comarques]' ); ?></span> 203 241 </div> 204 242 <?php endforeach; } } ?> … … 212 250 <?php if (!empty($items)) { ?> 213 251 <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> <?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <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> <span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <?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> <span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <?php _e( '[La borrufa | Pirineu comarques]' ); ?></span> 220 275 </div> 221 276 <?php endforeach; } } ?> … … 229 284 <?php if (!empty($items)) { ?> 230 285 <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> <?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <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> <span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <?php _e( '[La borrufa | Pirineu comarques]' ); ?></span> 292 </div> 293 238 294 <?php endforeach; } } ?> 239 295 <?php } 240 296 } 297 241 298 echo $after_widget; 242 299 ?> -
borrufa-widget/trunk/Borrufa-Widget/borrufa-widget/trunk/readme.txt
r2654772 r2690733 4 4 Language: Català 5 5 Requires at least: 4.3 6 Tested up to: 5. 47 Stable tag: 1.0. 36 Tested up to: 5.9.1 7 Stable tag: 1.0.4 8 8 9 9 … … 32 32 33 33 == Changelog == 34 = 1.0.2 = 35 * Primera versió del plugin borrufa-widget. 34 36 = 1.0.3 = 35 37 * 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 . 38 40 39 41 … … 41 43 42 44 --Jordi Soler 43 http ://laborrufa.com/45 https://laborrufa.com/ 44 46 == Copyright © Serveis Publicitaris del Pirineu S.L. == -
borrufa-widget/trunk/Borrufa-Widget/borrufa_widget.php
r2012876 r2690733 5 5 Description: 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. 6 6 Author: Jordi Soler 7 Version: 1.0. 37 Version: 1.0.4 8 8 Author URI: https://laborrufa.com 9 9 License: GPL2 … … 20 20 register_widget("borrufa_widget_class"); 21 21 } 22 23 wp_enqueue_style( 'wp-color-picker' ); 24 wp_enqueue_script( 'wp-color-picker' ); 22 25 } -
borrufa-widget/trunk/Borrufa-Widget/borrufa_widget_class.php
r2012876 r2690733 18 18 ( 19 19 "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", 20 32 ); 21 33 $instance = wp_parse_args((array)$instance,$defaults); … … 32 44 $lb_data = isset( $instance['lb_data'] ) ? (bool) $instance['lb_data'] : false; 33 45 $lb_widget_target = isset( $instance['lb_widget_target'] ) ? $instance['lb_widget_target'] : 1; 46 $lb_color = isset( $instance['lb_color'] ) ? $instance['lb_color'] : "#000000"; 34 47 ?> 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> 36 49 37 50 <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> … … 65 78 66 79 <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> 68 81 69 82 <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' ); ?>" /> … … 76 89 foreach ( $target_options as $target_value => $target_code ) { 77 90 echo '<option value="' . $target_code . '" id="' . $target_code . '"', $lb_widget_target == $target_code ? ' selected="selected"' : '', '>', $target_value, '</option>'; 91 78 92 } ?> </select> 79 93 </p> 80 94 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> 81 109 <hr style="background: #ccc; border: 0; height: 1px; margin: 20px 0;" /> 82 110 … … 101 129 $instance['lb_data'] = isset( $new_instance['lb_data'] ) ? (bool) $new_instance['lb_data'] : false; 102 130 $instance[ 'lb_widget_target' ] = $new_instance[ 'lb_widget_target' ]; 131 $instance['lb_color'] = isset( $new_instance['lb_color'] ) ? $new_instance['lb_color'] : "#000000"; 103 132 return $instance; 104 133 } … … 121 150 $lb_data = isset( $instance['lb_data'] ) ? $instance['lb_data'] : false; 122 151 $lb_widget_target = empty( $instance['lb_widget_target'] ) ? ' ' : $instance['lb_widget_target']; 152 $lb_color = $instance['lb_color']; 123 153 echo $before_widget; 124 154 echo $before_title.$titol.$after_title; … … 133 163 <?php if (!empty($items)) { ?> 134 164 <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> < ?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <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> <span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <?php _e( '[La borrufa | Pirineu comarques]' ); ?></span> 141 171 </div> 142 172 <?php endforeach; } } ?> … … 150 180 <?php if (!empty($items)) { ?> 151 181 <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> < ?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <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> <span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <?php _e( '[La borrufa | Pirineu comarques]' ); ?></span> 158 188 </div> 159 189 <?php endforeach; } } ?> … … 167 197 <?php if (!empty($items)) { ?> 168 198 <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> < ?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <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> <span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <?php _e( '[La borrufa | Pirineu comarques]' ); ?></span> 175 205 </div> 176 206 <?php endforeach; } } ?> … … 184 214 <?php if (!empty($items)) { ?> 185 215 <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> < ?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <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> <span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <?php _e( '[La borrufa | Pirineu comarques]' ); ?></span> 192 222 </div> 193 223 <?php endforeach; } } ?> … … 197 227 $rss = fetch_rss('https://laborrufa.com/noticies/val-daran/feed/'); 198 228 $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); } 200 232 ?> 201 233 <?php if (!empty($items)) { ?> 202 234 <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> < ?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <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> <span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <?php _e( '[La borrufa | Pirineu comarques]' ); ?></span> 209 241 </div> 210 242 <?php endforeach; } } ?> … … 218 250 <?php if (!empty($items)) { ?> 219 251 <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> < ?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <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> <span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <?php _e( '[La borrufa | Pirineu comarques]' ); ?></span> 226 258 </div> 227 259 <?php endforeach; } } ?> … … 235 267 <?php if (!empty($items)) { ?> 236 268 <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> < ?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <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> <span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <?php _e( '[La borrufa | Pirineu comarques]' ); ?></span> 243 275 </div> 244 276 <?php endforeach; } } ?> … … 252 284 <?php if (!empty($items)) { ?> 253 285 <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> <?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <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> <span style="color:<?php echo $lb_color; ?>"><?php if ($lb_data){ echo date( 'd/m/Y', strtotime($item['pubdate'])); } ?> <?php _e( '[La borrufa | Pirineu comarques]' ); ?></span> 292 </div> 293 261 294 <?php endforeach; } } ?> 262 295 <?php } 263 296 } 297 264 298 echo $after_widget; 265 299 ?>
Note: See TracChangeset
for help on using the changeset viewer.