Changeset 26047
- Timestamp:
- 12/04/07 20:50:44 (7 months ago)
- Files:
-
- a-year-before/trunk/ayb_posts-de_DE.mo (modified) (previous)
- a-year-before/trunk/ayb_posts-de_DE.po (modified) (2 diffs)
- a-year-before/trunk/ayb_posts.php (modified) (11 diffs)
- a-year-before/trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
a-year-before/trunk/ayb_posts-de_DE.po
r17247 r26047 3 3 "Project-Id-Version: A year before\n" 4 4 "POT-Creation-Date: \n" 5 "PO-Revision-Date: 2007- 08-21 01:56+0100\n"5 "PO-Revision-Date: 2007-12-04 19:58+0100\n" 6 6 "Last-Translator: Ralf Thees <ralf@wuerzblog.de>\n" 7 7 "Language-Team: <ralf@wuerzblog.de>\n" … … 9 9 "Content-Type: text/plain; charset=utf-8\n" 10 10 "Content-Transfer-Encoding: 8bit\n" 11 "X-Poedit-Basepath: /home/ralf/ programmierung/a-year-before/\n"11 "X-Poedit-Basepath: /home/ralf/\n" 12 12 "X-Poedit-KeywordsList: __;_e\n" 13 13 "X-Poedit-Language: German\n" 14 14 "X-Poedit-Country: GERMANY\n" 15 "X-Poedit-SearchPath-0: tags/0.6beta3\n"15 "X-Poedit-SearchPath-0: wp213/wp-content/plugins/a-year-before\n" 16 16 17 #: tags/0.6beta3/ayb_posts.php:2918 #: tags/0.6beta3/ayb_posts.php:12117 #: wp213/wp-content/plugins/a-year-before/ayb_posts.php:33 18 #: wp213/wp-content/plugins/a-year-before/ayb_posts.php:148 19 19 msgid "A year ago" 20 20 msgstr "Vor einem Jahr" 21 21 22 #: tags/0.6beta3/ayb_posts.php:4523 #: tags/0.6beta3/ayb_posts.php:12122 #: wp213/wp-content/plugins/a-year-before/ayb_posts.php:48 23 #: wp213/wp-content/plugins/a-year-before/ayb_posts.php:148 24 24 msgid "Y-m-d" 25 25 msgstr "d.m.Y" 26 26 27 #: tags/0.6beta3/ayb_posts.php:4628 #: tags/0.6beta3/ayb_posts.php:12127 #: wp213/wp-content/plugins/a-year-before/ayb_posts.php:49 28 #: wp213/wp-content/plugins/a-year-before/ayb_posts.php:148 29 29 msgid "No articles on this date." 30 30 msgstr "Keine Beiträge an diesem Tag." 31 31 32 #: tags/0.6beta3/ayb_posts.php:14632 #: wp213/wp-content/plugins/a-year-before/ayb_posts.php:175 33 33 msgid "Title:" 34 34 msgstr "Titel:" 35 35 36 #: tags/0.6beta3/ayb_posts.php:14736 #: wp213/wp-content/plugins/a-year-before/ayb_posts.php:176 37 37 msgid "Days before:" 38 38 msgstr "Tage zuvor:" 39 39 40 #: tags/0.6beta3/ayb_posts.php:14840 #: wp213/wp-content/plugins/a-year-before/ayb_posts.php:177 41 41 msgid "Months before:" 42 42 msgstr "Monate zuvor:" 43 43 44 #: tags/0.6beta3/ayb_posts.php:14944 #: wp213/wp-content/plugins/a-year-before/ayb_posts.php:178 45 45 msgid "Years before:" 46 46 msgstr "Jahre zuvor:" 47 47 48 #: tags/0.6beta3/ayb_posts.php:150 48 #: wp213/wp-content/plugins/a-year-before/ayb_posts.php:179 49 msgid "Lookup-range:" 50 msgstr "Rückschaudauer:" 51 52 #: wp213/wp-content/plugins/a-year-before/ayb_posts.php:180 49 53 msgid "Show date:" 50 54 msgstr "Zeige Datum an:" 51 55 52 #: tags/0.6beta3/ayb_posts.php:15156 #: wp213/wp-content/plugins/a-year-before/ayb_posts.php:181 53 57 msgid "Dateformat:" 54 58 msgstr "Datumsformat:" 55 59 56 #: tags/0.6beta3/ayb_posts.php:15260 #: wp213/wp-content/plugins/a-year-before/ayb_posts.php:182 57 61 msgid "Text, if no article found:" 58 62 msgstr "Text, wenn kein Artikel gefunden:" 59 63 60 #: tags/0.6beta3/ayb_posts.php:15364 #: wp213/wp-content/plugins/a-year-before/ayb_posts.php:183 61 65 msgid "Update" 62 66 msgstr "Aktualisieren" a-year-before/trunk/ayb_posts.php
r17316 r26047 2 2 /* 3 3 Plugin Name: A Year Before 4 Version: 0. 64 Version: 0.7beta1 5 5 Plugin URI: http://wuerzblog.de/2006/12/27/wordpress-plugin-a-year-before/ 6 6 Author: Ralf Thees … … 16 16 if ( !function_exists('register_sidebar_widget') ) 17 17 return; 18 $ayb_posts_is_widget=false; 19 register_widget_control("A Year Before","ayb_posts_widget_control",200,320); 20 register_sidebar_widget('A Year Before','ayb_posts'); 21 } 18 22 19 function ayb_posts($ para=Array()) {20 if (preg_match("/sidebar/i",$para["name"]))$ayb_posts_is_widget=true;23 function ayb_posts($ayb_para=Array()) { 24 if ( is_array($ayb_para) && sizeof($ayb_para)>0) $ayb_posts_is_widget=true; 21 25 22 26 global $wpdb, $ayb_posts_domain; 23 27 24 25 if ($ayb_posts_is_widget) extract($para);28 if ($ayb_posts_is_widget) { 29 extract($ayb_para); 26 30 27 $options = get_option("ayb_posts");31 $options = get_option("ayb_posts"); 28 32 if ( !is_array($options) ) { 29 33 $options = array('title'=>__('A year ago',$ayb_posts_domain)); 30 34 } 31 if ($ayb_posts_is_widget) { 32 $ para="";35 36 $ayb_para=""; 33 37 foreach ($options as $key => $val) { 34 $ para.="$key=$val&";35 }38 $ayb_para.="$key=$val&"; 39 } 36 40 } 37 41 … … 45 49 $dateformat=__('Y-m-d',$ayb_posts_domain); 46 50 $notfound=__("No articles on this date.",$ayb_posts_domain); 47 $parameter = explode('&', $para); 51 $range=1; 52 $ayb_parameter = explode('&', $ayb_para); 48 53 $i = 0; 49 while ($i < count($ parameter)) {50 $b = split('=', $ parameter[$i]);54 while ($i < count($ayb_parameter)) { 55 $b = split('=', $ayb_parameter[$i]); 51 56 switch ($b[0]) { 52 57 case "day": … … 74 79 $dateformat=urldecode($b[1]); 75 80 break; 81 case "range": 82 $range=urldecode($b[1]); 83 break; 76 84 } 77 85 … … 83 91 84 92 $datum = getdate(mktime(0, 0, 0, date("m")-$dmonth, date("d")-$dday, date("Y")-$dyear)); 93 $range_date1=date("Y-m-d",mktime(0, 0, 0, date("m")-$dmonth, date("d")-$dday, date("Y")-$dyear)).' 23:59:59'; 94 $range_date2=date("Y-m-d",mktime(0, 0, 0, date("m")-$dmonth, date("d")-$dday-$range, date("Y")-$dyear)).' 00:00:00'; 85 95 86 96 $q="SELECT ID, post_title, post_date_gmt FROM $wpdb->posts WHERE post_status='publish' AND post_password='' AND YEAR(post_date_gmt)=".$datum['year']." AND MONTH(post_date_gmt)=".$datum['mon']." AND DAYOFMONTH(post_date_gmt)=".$datum['mday']." ORDER BY post_date_gmt"; 97 $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"; 98 //echo $q; 87 99 $result = $wpdb->get_results($q, OBJECT); 100 //print_r($result); 88 101 89 102 //Ausgabe für's Widget … … 94 107 95 108 if ($showdate) { 96 $pdate='<span class="ayb_date">'.date($dateformat,mktime(0, 0, 0, date("m")-$dmonth , date("d")-$dday, date("Y")-$dyear))."</span> "; 97 } else { 109 $post_date=$result[0]->post_date; 110 $ts_post_date=mktime(0,0,0,substr($post_date,5,2),substr($post_date,8,2),substr($post_date,1,4)); 111 $pdate='<span class="ayb_date">'.date($dateformat,$ts_post_date)."</span> "; 112 113 } else { 98 114 $pdate=''; 99 115 } 100 116 if ($result) { 117 $post_date=$result[0]->post_date; 118 $ts_post_date=mktime(0,0,0,substr($post_date,5,2),substr($post_date,8,2),substr($post_date,1,4)); 119 $ts_date_old=$ts_post_date; 101 120 foreach ($result as $post) 102 121 { 103 $plink = get_permalink($post->ID); 104 $ptitle= $post->post_title; 122 $post_date=$post->post_date; 123 $ts_post_date=mktime(0,0,0,substr($post_date,5,2),substr($post_date,8,2),substr($post_date,1,4)); 124 $pdate='<span class="ayb_date">'.date($dateformat,$ts_post_date)."</span> "; 125 if ($ts_post_date !=$ts_date_old) { 126 break; 127 } else { 128 $ts_date_old=$ts_post_date; 129 } 130 $plink = get_permalink($post->ID); 131 $ptitle= $post->post_title; 105 132 echo $before.$pdate.'<a href="'.$plink.'" class="ayb_link">'.$ptitle.'</a></span>'.$after."\r"; 133 134 106 135 } 107 136 } else { 108 137 $pdate='<span class="ayb_date">'.date($dateformat,mktime(0, 0, 0, date("m")-$dmonth , date("d")-$dday, date("Y")-$dyear))."</span> "; 109 138 echo $before.$pdate.'<span class="ayb_notfound">'.$notfound.'</span>'.$after."\r"; 110 139 } … … 118 147 $options = get_option("ayb_posts"); 119 148 if ( !is_array($options) ) { 120 $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) );149 $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'=>1); 121 150 122 151 } … … 128 157 $dateformat=$options["dateformat"]; 129 158 $notfound=$options["notfound"]; 159 $range=$options["range"]; 130 160 131 161 if ( $_POST['ayb_posts_submit'] ) { … … 138 168 $options["dateformat"]=strip_tags(stripslashes($_POST['ayb_posts_dateformat'])); 139 169 $options["notfound"]=strip_tags(stripslashes($_POST['ayb_posts_notfound'])); 170 $options["range"]=strip_tags(stripslashes($_POST['ayb_posts_range'])); 140 171 update_option('ayb_posts', $options); 141 172 } … … 147 178 echo '<p style="text-align:right;"><label for="ayb_posts_month">' . __('Months before:',$ayb_posts_domain) . ' <input style="width: 30px;" id="ayb_posts_month" name="ayb_posts_month" type="text" value="'.$month.'" /></label></p>'; 148 179 echo '<p style="text-align:right;"><label for="ayb_posts_year">' . __('Years before:',$ayb_posts_domain) . ' <input style="width: 30px;" id="ayb_posts_year" name="ayb_posts_year" type="text" value="'.$year.'" /></label></p>'; 180 echo '<p style="text-align:right;"><label for="ayb_posts_range">' . __('Lookup-range:',$ayb_posts_domain) . ' <input style="width: 30px;" id="ayb_posts_year" name="ayb_posts_range" type="text" value="'.$range.'" /></label></p>'; 149 181 echo '<p style="text-align:right;"><label for="ayb_posts_showdate">' . __('Show date:',$ayb_posts_domain) . ' <input style="width: 15px;" id="ayb_posts_showdate" name="ayb_posts_showdate" type="checkbox" value="1"'.(($showdate==0)?'':'checked').' /></label></p>'; 150 182 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>'; … … 154 186 } 155 187 156 register_widget_control("A Year Before","ayb_posts_widget_control",200,320); 157 register_sidebar_widget('A Year Before','ayb_posts'); 158 } 188 159 189 // 160 190 add_action('widgets_init', 'ayb_posts_init'); a-year-before/trunk/readme.txt
r24342 r26047 54 54 * before : piece of HTML to insert before the title of the articles. Default `<li>` 55 55 * after: piece of HTML to insert after the title of the articles. Default `</li>` 56 * range: number of days the plugin will search back in the past for an article. Default 1 56 57 * showdate: shows the date (showdate=1) before every title or not (showdate=0) 57 58 * dateformat : dateformat as used by PHP. Default ist the german shortform »d.m.y« … … 66 67 The titles of the articles written half a year and two weeks before, also showing the date . If there was no article written on that day, the output will be »Nothing blogged on this day.« 67 68 69 `ayb_posts("range=14&dateformat=y-m-d");` 70 Looks up a year back for written articles. If none are found, the plugin will check the next 7 days in the past. If a article is found on some of this days, all articles of this day will be listed with a "year-month-day"-format. 71 68 72 == Styling == 69 73 … … 71 75 72 76 == Changelog == 77 78 0.7beta1 79 80 * added range-parameter. you can use e.g. year=1&range=7 if you want to look back one year for articles. if no article is found on this day, the plugin will look up to 7 days back and lists the articles of the day the first article was found. 81 82 0.6.1 83 84 * Fix for sidebars not named 'sidebar' 73 85 74 86 0.6
