WordPress.org

Plugin Directory

Changeset 222482


Ignore:
Timestamp:
03/28/10 15:38:21 (4 years ago)
Author:
stefsoton
Message:

Upload version 1.0

Location:
google-news-widget/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • google-news-widget/trunk/google-news-widget.php

    r220354 r222482  
    44 * Plugin URI: http://www.stefaniamarchisio.com/goggle-news-widget-shortcode-plugin/ 
    55 * Description: A customizable list of Google News given language/country, (searchkey(s) or topic) and the number of displayable news. It works as both widget and shortcode. 
    6  * Version: 0.9 
     6 * Version: 1.0 
    77 * Author: Stefania Marchisio 
    88 * Author URI: http://stefaniamarchisio.com/about/ 
     
    9898        echo $before_widget; 
    9999 
    100         /* Display the widget title if one was input (before and after defined by themes). */ 
    101         if ( $title ) { 
    102        if ( $lkbtitle ) $title = "<a target='" . $target . "' href='$feed' title='$title'>$title</a>"; 
    103        echo $before_title . $title . $after_title; 
    104     } 
    105100        /* Define the feed according to params entered */ 
    106101        $feed = "http://news.google.com/news?cf=all&ned=" . $location. "&output=rss"; 
    107     if ( $geo ) { $feed .= "&geo=$geo"; } 
     102                if ( $geo ) { $feed .= "&geo=$geo"; } 
    108103        if ( $name ) { $feed .= "&q=$name"; } 
    109104        if ( $topic ) { $feed .= "&topic=$topic"; } 
     105 
     106        $tle = ''; 
     107              /* Display the widget title if one was input (before and after defined by themes). */ 
     108        if ( $title ) { 
     109                  if ( $lkbtitle ) $tle = "<a target='" . $target . "' href='$feed' title='$title'><img src='/wp-content/plugins/google-news-widget/rss-cube.gif' width='25px' height='25px' title=' [feed link] '></a> "; 
     110                  echo $before_title . $tle . $title . $after_title; 
     111              } 
    110112 
    111113    echo gnw_List($feed, $num, $list, $target, $pubdate, $pubtime, $pubauthor, $excerpt, $charex); 
     
    276278        <!-- Widget Title: Text Input --> 
    277279        <p> 
    278             <label for="<?php echo $this->get_field_id( 'geo' ); ?>"><?php _e('Local:', 'googlenews'); ?></label> 
    279             <input id="<?php echo $this->get_field_id( 'geo' ); ?>" name="<?php echo $this->get_field_name( 'geo' ); ?>" value="<?php echo $instance['geo']; ?>" style="width:100%;" /> 
     280        <label for="<?php echo $this->get_field_id( 'geo' ); ?>"><?php _e('Local:', 'googlenews'); ?></label> 
     281        <input id="<?php echo $this->get_field_id( 'geo' ); ?>" name="<?php echo $this->get_field_name( 'geo' ); ?>" value="<?php echo $instance['geo']; ?>" style="width:100%;" /> 
    280282        </p> 
    281283 
     
    288290        <!-- Show Publication Date? Checkbox --> 
    289291        <p> 
    290             <label for="<?php echo $this->get_field_id( 'pubdate' ); ?>"><?php _e('Show publication date?', 'googlenews'); ?></label> 
    291             <input class="checkbox" type="checkbox" <?php checked( $instance['pubdate'], 'on' ); ?> id="<?php echo $this->get_field_id( 'pubdate' ); ?>" name="<?php echo $this->get_field_name( 'pubdate' ); ?>" />  
     292        <label for="<?php echo $this->get_field_id( 'pubdate' ); ?>"><?php _e('Show publication date?', 'googlenews'); ?></label> 
     293        <input class="checkbox" type="checkbox" <?php checked( $instance['pubdate'], 'on' ); ?> id="<?php echo $this->get_field_id( 'pubdate' ); ?>" name="<?php echo $this->get_field_name( 'pubdate' ); ?>" />  
    292294        </p> 
    293295 
    294296        <!-- Show Publication Time? Checkbox --> 
    295297        <p> 
    296             <label for="<?php echo $this->get_field_id( 'pubtime' ); ?>"><?php _e('Show publication time?', 'googlenews'); ?></label> 
    297             <input class="checkbox" type="checkbox" <?php checked( $instance['pubtime'], 'on' ); ?> id="<?php echo $this->get_field_id( 'pubtime' ); ?>" name="<?php echo $this->get_field_name( 'pubtime' ); ?>" />  
     298        <label for="<?php echo $this->get_field_id( 'pubtime' ); ?>"><?php _e('Show publication time?', 'googlenews'); ?></label> 
     299        <input class="checkbox" type="checkbox" <?php checked( $instance['pubtime'], 'on' ); ?> id="<?php echo $this->get_field_id( 'pubtime' ); ?>" name="<?php echo $this->get_field_name( 'pubtime' ); ?>" />  
    298300        </p> 
    299301 
     
    309311    <!-- List Type: Select Box --> 
    310312    <p> 
    311         <label for="<?php echo $this->get_field_id( 'list' ); ?>"><?php _e('List Type:', 'googlenews'); ?></label>  
    312         <select id="<?php echo $this->get_field_id( 'list' ); ?>" name="<?php echo $this->get_field_name( 'list' ); ?>" class="widefat" style="width:100%;"> 
     313    <label for="<?php echo $this->get_field_id( 'list' ); ?>"><?php _e('List Type:', 'googlenews'); ?></label>  
     314    <select id="<?php echo $this->get_field_id( 'list' ); ?>" name="<?php echo $this->get_field_name( 'list' ); ?>" class="widefat" style="width:100%;"> 
    313315<option value="UL" <?php if ('UL' == $instance['list']) echo 'selected';?>>Unordered (or Dotted) List (default)</option> 
    314316<option value="OL" <?php if ('OL' == $instance['list']) echo 'selected';?>>Ordered (or Numbered) List</option> 
    315         </select> 
    316         </p> 
    317  
    318         <!-- Target: Select Box --> 
    319         <p> 
    320         <label for="<?php echo $this->get_field_id( 'target' ); ?>"><?php _e('Target:', 'googlenews'); ?></label>  
    321         <select id="<?php echo $this->get_field_id( 'target' ); ?>" name="<?php echo $this->get_field_name( 'target' ); ?>" class="widefat" style="width:100%;"> 
     317    </select> 
     318    </p> 
     319 
     320    <!-- Target: Select Box --> 
     321    <p> 
     322    <label for="<?php echo $this->get_field_id( 'target' ); ?>"><?php _e('Target:', 'googlenews'); ?></label>  
     323    <select id="<?php echo $this->get_field_id( 'target' ); ?>" name="<?php echo $this->get_field_name( 'target' ); ?>" class="widefat" style="width:100%;"> 
    322324<option value="_blank" <?php if ('_blank' == $instance['target']) echo 'selected';?>>Open link in a new window (default)</option> 
    323325<option value="_self" <?php if ('_self' == $instance['target']) echo 'selected';?>>Open link in the same window</option> 
    324         </select> 
    325         </p> 
     326    </select> 
     327    </p> 
    326328 
    327329    <!-- Show Author? Checkbox --> 
    328330    <p> 
    329         <label for="<?php echo $this->get_field_id( 'pubauthor' ); ?>"><?php _e('Show footer [linkto this author]?', 'googlenews'); ?></label> 
    330         <input class="checkbox" type="checkbox" <?php checked( $instance['pubauthor'], 'on' ); ?> id="<?php echo $this->get_field_id( 'pubauthor' ); ?>" name="<?php echo $this->get_field_name( 'pubauthor' ); ?>" />  
     331    <label for="<?php echo $this->get_field_id( 'pubauthor' ); ?>"><?php _e('Show footer [linkto this author]?', 'googlenews'); ?></label> 
     332    <input class="checkbox" type="checkbox" <?php checked( $instance['pubauthor'], 'on' ); ?> id="<?php echo $this->get_field_id( 'pubauthor' ); ?>" name="<?php echo $this->get_field_name( 'pubauthor' ); ?>" />  
    331333    <br /><span style="font-size: 0.9em;">(please, say yes)</span> 
    332334    </p> 
     
    361363     "pubauthor" => true, 
    362364     "excerpt" => false, 
    363      "charex" => '' 
     365     "charex" => '', 
     366     "title" => '', 
     367     "link" => false 
    364368     ), $atts)); 
    365369 
     
    369373     if ( $search ) { $feed .= "&q=$search"; } 
    370374     if ( $topic ) { $feed .= "&topic=$topic"; } 
    371  
    372      return gnw_List($feed, $num, $list, $target, $pubdate, $pubtime, $pubauthor, $excerpt, $charex); 
     375     $tle = ""; 
     376     if ( $link || $title ) {  
     377        if ( $link ) $tle = "<a href='$feed'><img src='/wp-content/plugins/google-news-widget/rss-cube.gif' width='25px' height='25px' alt=' [feed link] '></a> ";  
     378        $tle .= $title;  
     379     } 
     380     return $tle . gnw_List($feed, $num, $list, $target, $pubdate, $pubtime, $pubauthor, $excerpt, $charex); 
    373381} 
    374382 
     
    376384    // decoding needed when you use a shortcode as URLs are encoded by the shortcode 
    377385    $feed = html_entity_decode($feed);   
    378        $flist = "Error message: "; 
     386        $flist = "Error message: "; 
    379387 
    380388    // check whether a feed URL has been entered 
    381389    if ($feed) { 
    382         libxml_use_internal_errors(true); 
     390        // debug string 
     391              // echo "<a href='$feed'>$feed</a>"; 
     392                libxml_use_internal_errors(true); 
    383393        if ( $rss = simplexml_load_file($feed) ) {  
    384394            // check whether it is an RSS format feed 
     
    390400                foreach ($rss->channel->item as $item ) { 
    391401                    $flist .= "<li>"; 
    392                                          
    393                                         if ($item->title || $item->description) { 
     402                                   if ($item->title || $item->description) { 
    394403 
    395404                    if ( $item->link ) { 
    396                         $motext = isset( $item->description ) ? htmlentities($item->description): htmlentities($item->title); 
    397                         $flist .= "<a target='". $target . "' href='$item->link' title='$motext'>"; 
     405                       $motext = isset( $item->description ) ? strip_tags(str_replace("><","> <",$item->description)): strip_tags($item->title); 
     406                       $flist .= "<a target='". $target . "' href='$item->link' title='$motext'>"; 
    398407                    } 
    399408 
  • google-news-widget/trunk/readme.txt

    r220354 r222482  
    55Requires at least: 2.8 
    66Tested up to: 2.9.2 
    7 Stable tag: 0.9 
     7Stable tag: 1.0 
    88 
    99A customizable list of Google News given language-country, searchkey(s) or topic, number of news and whether you want publication date, time.  
     
    4242 
    4343== Changelog == 
     44 
     45= 1.0 =  
     46 
     47* New feature: Made linkable/not shortcode title 
     48* Change feature: Added a feed small icon linking to its feed URL (instead of linking the title directly) 
     49* Improvement: HTML tags are now stripped from the description to make the mouseover experience more meaningful  
     50* Fixed a bug which prevented the title to be linkable 
    4451 
    4552= 0.9 =  
     
    9299 
    93100== Upgrade Notice == 
     101 
     102= 1.0 = 
     103* New feature: Made linkable/not shortcode title 
     104* Change feature: Added a feed small icon linking to its feed URL (instead of linking the title directly) 
     105* Improvement: HTML tags are now stripped from the description to make the mouseover experience more meaningful  
     106 
     107= 0.9 = 
     108* Non-standard chars are properly displayed  
    94109 
    95110= 0.9 = 
Note: See TracChangeset for help on using the changeset viewer.