Changeset 17353
- Timestamp:
- 08/24/07 00:24:56 (11 months ago)
- Files:
-
- accessible-news-ticker/trunk/ant.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
accessible-news-ticker/trunk/ant.php
r16446 r17353 5 5 Description: Display latest posts or RSS news in an accessible/unobtrusive scroll box. Based on Chris Heilmann's <a href="http://onlinetools.org/tools/domnews/">DOMnews 1.0</a>. 6 6 Author: Pixline 7 Version: 0.3rc 17 Version: 0.3rc2 8 8 Author URI: http://pixline.net/ 9 9 … … 30 30 $parts = pathinfo(__FILE__); 31 31 define("CACHE_PATH",str_replace("plugins/accessible-news-ticker","cache-feed",$parts['dirname'])); 32 33 function widget_ant_install(){ 34 if(!is_dir(CACHE_PATH) && !is_writeable(CACHE_PATH)){ mkdir(CACHE_PATH, 0777); } 35 $ant_defaults = array("title"=>"Latest News", "howmany"=>5, "content"=>"posts", "category"=>"", "feedurl"=> ""); 36 add_option('widget_ant_options',$ant_defauls); 37 } 38 32 39 register_activation_hook(__FILE__, 'widget_ant_install'); 33 34 function widget_ant_install(){35 if(!is_dir(CACHE_PATH) && !is_writeable(CACHE_PATH))36 mkdir(CACHE_PATH, 0777);37 }38 39 40 include_once(get_bloginfo('url')."/wp-content/plugins/accessible-news-ticker/includes/simplepie.inc"); 40 41 … … 96 97 97 98 function widget_ant($args) { 98 #$url = "http://feeds.feedburner.com/pixline";99 99 100 100 extract($args); 101 101 $options = get_option('widget_ant_options'); 102 $title = empty($options['title']) ? 'Latest News' : $options['title'];102 $title = empty($options['title']) ? 'Latest News' : $options['title']; 103 103 $howmany = empty($options['howmany']) ? 5 : $options['howmany']; 104 104 $kind = empty($options['content']) ? 'posts' : $options['content']; 105 $antcat = empty($options['category']) ? '' : $options['category']; 105 106 $url = empty($options['feedurl']) ? '' : $options['feedurl']; 106 107 … … 110 111 switch($kind): 111 112 case 'posts': 112 $news = get_posts("numberposts=".$howmany );113 $news = get_posts("numberposts=".$howmany."&category=".$antcat); 113 114 echo "<div id='accessible-news-ticker'>"; 114 115 echo "<ul>"; … … 162 163 $newoptions['howmany'] = strip_tags(stripslashes($_POST['ant-howmany'])); 163 164 $newoptions['content'] = strip_tags(stripslashes($_POST['ant-content'])); 165 $newoptions['category'] = strip_tags(stripslashes($_POST['ant-category'])); 164 166 $newoptions['feedurl'] = strip_tags(stripslashes($_POST['ant-feedurl'])); 165 167 } … … 200 202 </label> 201 203 204 <label for="ant-category" style="line-height:35px;display:block;">(if latest posts) Category: 205 <select id='ant-category' name="ant-category"> 206 <option value='' label='All Categories'>All Categories</option> 207 <?php 208 # $opzioni = array("posts"=>"Latest Posts","rss"=>"RSS Feed"); 209 $opzioni = get_categories('type=post&hide_empty=1&hierarchical=0'); 210 211 foreach($opzioni as $opzione): 212 if($options['category'] == $opzione->cat_ID) $selected3 = " selected='selected'"; else $selected3 = ""; 213 echo "<option value='".$opzione->cat_ID."' label=' ".$opzione->cat_name."'".$selected3."> ".$opzione->cat_name."</option>"; 214 # print_r($opzione); 215 endforeach; 216 ?> 217 </select> 218 </label> 219 220 202 221 <label for="ant-feedurl" style="line-height:35px;display:block;">RSS Feed URL: 203 222 <?php if($options['feedurl'] != "") $value = $options['feedurl']; ?> … … 216 235 217 236 register_sidebar_widget('ANT News Ticker', 'widget_ant'); 218 register_widget_control('ANT News Ticker', 'widget_ant_control', 350, 260);237 register_widget_control('ANT News Ticker', 'widget_ant_control', 350, 300); 219 238 if(!is_admin()): 220 239 add_action('wp_head','widget_ant_headscript');
