Changeset 26047

Show
Ignore:
Timestamp:
12/04/07 20:50:44 (7 months ago)
Author:
wuerzblog
Message:

Cleanup

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • a-year-before/trunk/ayb_posts-de_DE.po

    r17247 r26047  
    33"Project-Id-Version: A year before\n" 
    44"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" 
    66"Last-Translator: Ralf Thees <ralf@wuerzblog.de>\n" 
    77"Language-Team:  <ralf@wuerzblog.de>\n" 
     
    99"Content-Type: text/plain; charset=utf-8\n" 
    1010"Content-Transfer-Encoding: 8bit\n" 
    11 "X-Poedit-Basepath: /home/ralf/programmierung/a-year-before/\n" 
     11"X-Poedit-Basepath: /home/ralf/\n" 
    1212"X-Poedit-KeywordsList: __;_e\n" 
    1313"X-Poedit-Language: German\n" 
    1414"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" 
    1616 
    17 #: tags/0.6beta3/ayb_posts.php:29 
    18 #: tags/0.6beta3/ayb_posts.php:121 
     17#: wp213/wp-content/plugins/a-year-before/ayb_posts.php:33 
     18#: wp213/wp-content/plugins/a-year-before/ayb_posts.php:148 
    1919msgid "A year ago" 
    2020msgstr "Vor einem Jahr" 
    2121 
    22 #: tags/0.6beta3/ayb_posts.php:45 
    23 #: tags/0.6beta3/ayb_posts.php:121 
     22#: wp213/wp-content/plugins/a-year-before/ayb_posts.php:48 
     23#: wp213/wp-content/plugins/a-year-before/ayb_posts.php:148 
    2424msgid "Y-m-d" 
    2525msgstr "d.m.Y" 
    2626 
    27 #: tags/0.6beta3/ayb_posts.php:46 
    28 #: tags/0.6beta3/ayb_posts.php:121 
     27#: wp213/wp-content/plugins/a-year-before/ayb_posts.php:49 
     28#: wp213/wp-content/plugins/a-year-before/ayb_posts.php:148 
    2929msgid "No articles on this date." 
    3030msgstr "Keine Beiträge an diesem Tag." 
    3131 
    32 #: tags/0.6beta3/ayb_posts.php:146 
     32#: wp213/wp-content/plugins/a-year-before/ayb_posts.php:175 
    3333msgid "Title:" 
    3434msgstr "Titel:" 
    3535 
    36 #: tags/0.6beta3/ayb_posts.php:147 
     36#: wp213/wp-content/plugins/a-year-before/ayb_posts.php:176 
    3737msgid "Days before:" 
    3838msgstr "Tage zuvor:" 
    3939 
    40 #: tags/0.6beta3/ayb_posts.php:148 
     40#: wp213/wp-content/plugins/a-year-before/ayb_posts.php:177 
    4141msgid "Months before:" 
    4242msgstr "Monate zuvor:" 
    4343 
    44 #: tags/0.6beta3/ayb_posts.php:149 
     44#: wp213/wp-content/plugins/a-year-before/ayb_posts.php:178 
    4545msgid "Years before:" 
    4646msgstr "Jahre zuvor:" 
    4747 
    48 #: tags/0.6beta3/ayb_posts.php:150 
     48#: wp213/wp-content/plugins/a-year-before/ayb_posts.php:179 
     49msgid "Lookup-range:" 
     50msgstr "Rückschaudauer:" 
     51 
     52#: wp213/wp-content/plugins/a-year-before/ayb_posts.php:180 
    4953msgid "Show date:" 
    5054msgstr "Zeige Datum an:" 
    5155 
    52 #: tags/0.6beta3/ayb_posts.php:15
     56#: wp213/wp-content/plugins/a-year-before/ayb_posts.php:18
    5357msgid "Dateformat:" 
    5458msgstr "Datumsformat:" 
    5559 
    56 #: tags/0.6beta3/ayb_posts.php:15
     60#: wp213/wp-content/plugins/a-year-before/ayb_posts.php:18
    5761msgid "Text, if no article found:" 
    5862msgstr "Text, wenn kein Artikel gefunden:" 
    5963 
    60 #: tags/0.6beta3/ayb_posts.php:15
     64#: wp213/wp-content/plugins/a-year-before/ayb_posts.php:18
    6165msgid "Update" 
    6266msgstr "Aktualisieren" 
  • a-year-before/trunk/ayb_posts.php

    r17316 r26047  
    22/* 
    33Plugin Name: A Year Before 
    4 Version: 0.6 
     4Version: 0.7beta1 
    55Plugin URI: http://wuerzblog.de/2006/12/27/wordpress-plugin-a-year-before/ 
    66Author: Ralf Thees 
     
    1616      if ( !function_exists('register_sidebar_widget') ) 
    1717      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} 
    1822       
    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; 
    2125 
    2226            global $wpdb, $ayb_posts_domain; 
    2327             
    24              
    25             if ($ayb_posts_is_widget) extract($para); 
     28            if ($ayb_posts_is_widget) { 
     29                 extract($ayb_para); 
    2630 
    27             $options = get_option("ayb_posts"); 
     31                 $options = get_option("ayb_posts"); 
    2832                  if ( !is_array($options) ) { 
    2933                        $options = array('title'=>__('A year ago',$ayb_posts_domain)); 
    3034                  } 
    31             if ($ayb_posts_is_widget) { 
    32                   $para=""; 
     35 
     36                  $ayb_para=""; 
    3337                  foreach ($options as $key => $val) { 
    34                         $para.="$key=$val&"; 
    35            
     38                        $ayb_para.="$key=$val&"; 
     39                 
    3640            } 
    3741 
     
    4549      $dateformat=__('Y-m-d',$ayb_posts_domain); 
    4650      $notfound=__("No articles on this date.",$ayb_posts_domain); 
    47       $parameter = explode('&', $para); 
     51      $range=1; 
     52      $ayb_parameter = explode('&', $ayb_para); 
    4853      $i = 0; 
    49       while ($i < count($parameter)) { 
    50       $b = split('=', $parameter[$i]); 
     54      while ($i < count($ayb_parameter)) { 
     55      $b = split('=', $ayb_parameter[$i]); 
    5156      switch ($b[0]) { 
    5257            case "day": 
     
    7479                  $dateformat=urldecode($b[1]); 
    7580                  break; 
     81            case "range": 
     82                  $range=urldecode($b[1]); 
     83                  break; 
    7684      } 
    7785 
     
    8391 
    8492      $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'; 
    8595 
    8696      $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;   
    8799      $result = $wpdb->get_results($q, OBJECT); 
     100      //print_r($result); 
    88101 
    89102      //Ausgabe für's Widget 
     
    94107 
    95108      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 { 
    98114            $pdate=''; 
    99115            } 
    100116      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; 
    101120            foreach ($result as $post) 
    102121                  { 
    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; 
    105132                  echo $before.$pdate.'<a href="'.$plink.'" class="ayb_link">'.$ptitle.'</a></span>'.$after."\r"; 
     133             
     134                         
    106135                  } 
    107136            } else { 
    108  
     137$pdate='<span class="ayb_date">'.date($dateformat,mktime(0, 0, 0, date("m")-$dmonth  , date("d")-$dday, date("Y")-$dyear))."</span> "; 
    109138                  echo $before.$pdate.'<span class="ayb_notfound">'.$notfound.'</span>'.$after."\r"; 
    110139            } 
     
    118147            $options = get_option("ayb_posts"); 
    119148            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); 
    121150 
    122151            } 
     
    128157            $dateformat=$options["dateformat"]; 
    129158            $notfound=$options["notfound"]; 
     159            $range=$options["range"]; 
    130160 
    131161            if ( $_POST['ayb_posts_submit'] ) { 
     
    138168                  $options["dateformat"]=strip_tags(stripslashes($_POST['ayb_posts_dateformat'])); 
    139169                  $options["notfound"]=strip_tags(stripslashes($_POST['ayb_posts_notfound'])); 
     170                  $options["range"]=strip_tags(stripslashes($_POST['ayb_posts_range'])); 
    140171                  update_option('ayb_posts', $options); 
    141172            } 
     
    147178            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>'; 
    148179            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>';             
    149181            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>'; 
    150182            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>'; 
     
    154186      } 
    155187 
    156       register_widget_control("A Year Before","ayb_posts_widget_control",200,320); 
    157       register_sidebar_widget('A Year Before','ayb_posts'); 
    158 
     188       
    159189// 
    160190add_action('widgets_init', 'ayb_posts_init'); 
  • a-year-before/trunk/readme.txt

    r24342 r26047  
    5454* before : piece of HTML to insert before the title of the articles. Default `<li>` 
    5555* 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 
    5657* showdate: shows the date (showdate=1) before every title or not (showdate=0) 
    5758* dateformat : dateformat as used by PHP. Default ist the german shortform »d.m.y« 
     
    6667The 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.« 
    6768 
     69`ayb_posts("range=14&dateformat=y-m-d");` 
     70Looks 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 
    6872== Styling == 
    6973 
     
    7175 
    7276== Changelog == 
     77 
     780.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 
     820.6.1 
     83 
     84* Fix for sidebars not named 'sidebar' 
    7385 
    74860.6