Changeset 29527
- Timestamp:
- 01/18/08 14:42:00 (6 months ago)
- Files:
-
- a-year-before/trunk/ayb_posts.php (modified) (7 diffs)
- a-year-before/trunk/readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
a-year-before/trunk/ayb_posts.php
r28302 r29527 2 2 /* 3 3 Plugin Name: A Year Before 4 Version: 0.7beta 34 Version: 0.7beta4 5 5 Plugin URI: http://wuerzblog.de/2006/12/27/wordpress-plugin-a-year-before/ 6 6 Author: Ralf Thees … … 89 89 $range=urldecode($b[1]); 90 90 break; 91 case "anniversary": 92 $anniv=urldecode($b[1]); 93 break; 91 94 } 92 95 … … 100 103 $range_date1=date("Y-m-d H:i",strtotime($ayb_tz,mktime(0, 0, 0, date("m")-$dmonth, date("d")-$dday, date("Y")-$dyear))); 101 104 $range_date2=date("Y-m-d H:i",strtotime($ayb_tz,mktime(23,59,59, date("m")-$dmonth, date("d")-$dday+$range, date("Y")-$dyear))); 102 103 $q="SELECT ID, post_title, post_date FROM $wpdb->posts WHERE post_status='publish' AND post_password='' AND (post_date >= '".$range_date1."' AND post_date <= '".$range_date2."') ORDER BY post_date DESC"; 105 $month_day=substr($range_date1,4,7); 106 107 //$q="SELECT ID, post_title, post_date FROM $wpdb->posts WHERE post_status='publish' AND post_password='' AND (post_date >= '".$range_date1."' AND post_date <= '".$range_date2."') ORDER BY post_date DESC"; 108 $q="SELECT ID, post_title, post_date FROM $wpdb->posts WHERE post_status='publish' AND post_password='' AND (post_date LIKE '%".$month_day."%') ORDER BY post_date DESC"; 104 109 $result = $wpdb->get_results($q, OBJECT); 105 110 … … 151 156 $options = get_option("ayb_posts"); 152 157 if ( !is_array($options) ) { 153 $options = array('title'=>__('A year ago',$ayb_posts_domain), 'day'=>0, ' month'=>0, 'year'=>1, 'showdate'=>1, 'dateformat'=>__('Y-m-d',$ayb_posts_domain), 'notfound'=>__('No articles on this date.',$ayb_posts_domain),'range'=>0);158 $options = array('title'=>__('A year ago',$ayb_posts_domain), 'day'=>0, 'anniversary'=>0,'month'=>0, 'year'=>1, 'showdate'=>1, 'dateformat'=>__('Y-m-d',$ayb_posts_domain), 'notfound'=>__('No articles on this date.',$ayb_posts_domain),'range'=>0); 154 159 155 160 } … … 162 167 $notfound=$options["notfound"]; 163 168 $range=$options["range"]; 169 $anniv=$options["anniversary"]; 164 170 165 171 if ( $_POST['ayb_posts_submit'] ) { … … 173 179 $options["notfound"]=strip_tags(stripslashes($_POST['ayb_posts_notfound'])); 174 180 $options["range"]=strip_tags(stripslashes($_POST['ayb_posts_range'])); 181 $options["anniversary"]=strip_tags(stripslashes($_POST['ayb_posts_anniv'])); 175 182 update_option('ayb_posts', $options); 183 176 184 } 177 185 … … 186 194 echo '<p style="text-align:right;"><label for="ayb_posts_dateformat">' . __('Dateformat:',$ayb_posts_domain) . ' <input style="width: 45px;" id="ayb_posts_dateformat" name="ayb_posts_dateformat" type="text" value="'.$dateformat.'" /></label></p>'; 187 195 echo '<p style="text-align:right;"><label for="ayb_posts_notfound">' . __('Text, if no article found:','ayb_posts') . ' <input style="width: 200px;" id="ayb_posts_notfound" name="ayb_posts_notfound" type="text" value="'.$notfound.'" /></label></p>'; 196 echo '<p style="text-align:right;"><label for="ayb_posts_anniv">' . __('Anniversary-Mode:','ayb_posts') . ' <input style="width: 200px;" id="ayb_posts_anniv" name="ayb_posts_anniv" type="checkbox" value="1" '.(($anniv==0)?'':'checked').' /></label></p>'; 188 197 echo '<p style="text-align:right;"><input type="submit" id="ayb_posts_submit" name="ayb_posts_submit" value="'. __('Update',$ayb_posts_domain) . '" /></p>'; 189 198 a-year-before/trunk/readme.txt
r28302 r29527 76 76 == Changelog == 77 77 78 0.7beta4 79 80 * adding anniversary-mode. if anniversary=0, all articles matching the current day and the current month will be show, regardless of which year (beside the actual year of course). all settings of day, month, year and range will be ignored. 81 78 82 0.7beta3 79 83
