Changeset 17216

Show
Ignore:
Timestamp:
08/20/07 22:08:41 (11 months ago)
Author:
wuerzblog
Message:

Localization of source
Cleanup

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • a-year-before/tags/0.6beta3/ayb_posts.php

    r16351 r17216  
    22/* 
    33Plugin Name: A Year Before 
    4 Version: 0.6beta2 
     4Version: 0.6beta3 
    55Plugin URI: http://wuerzblog.de/2006/12/27/wordpress-plugin-a-year-before/ 
    66Author: Ralf Thees 
     
    88Description: Gibt die Artikel an, die vor einem Jahr oder einer beliebigen Zeitspanne veröffentlicht wurden. 
    99*/ 
     10 
     11$ayb_posts_domain = 'ayb_posts'; 
     12 
    1013function ayb_posts_init() { 
    1114      if ( !function_exists('register_sidebar_widget') ) 
     
    1518            if (preg_match("/sidebar/i",$para["name"])) $ayb_posts_is_widget=true; 
    1619 
    17             //print_r( $para); 
    18             global $wpdb; 
     20            global $wpdb, $ayb_posts_domain; 
     21            load_plugin_textdomain($ayb_posts_domain, 'wp-content/plugins'); 
     22             
    1923            if ($ayb_posts_is_widget) extract($para); 
    2024 
    2125            $options = get_option("ayb_posts"); 
    2226                  if ( !is_array($options) ) { 
    23                         $options = array('title'=>'Vor exakt einem Jahr'); 
     27                        $options = array('title'=>__('Vor einem Jahr',$ayb_posts_domain)); 
    2428                  } 
    2529            if ($ayb_posts_is_widget) { 
     
    2832                        $para.="$key=$val&"; 
    2933            } 
    30             //echo $para; 
    3134            } 
    3235 
     
    3942      $showdate=1; 
    4043      $dateformat="d.m.y"; 
    41       $notfound="Keine Beitrag an diesem Tag."
     44      $notfound=__("Kein Beitrag an diesem Tag.",$ayb_posts_domain)
    4245      $parameter = explode('&', $para); 
    4346      $i = 0; 
     
    7982      $datum  = getdate(mktime(0, 0, 0, date("m")-$dmonth, date("d")-$dday, date("Y")-$dyear)); 
    8083 
    81  
    82       $q="SELECT ID, post_title, post_date_gmt FROM $wpdb->posts WHERE post_status='publish' AND post_password='' AND YEAR(post_date_gmt)=YEAR(NOW()- INTERVAL $dyear YEAR) AND MONTH(post_date_gmt)=MONTH(NOW()- INTERVAL $dmonth MONTH) AND DAYOFMONTH(post_date_gmt)=DAYOFMONTH(NOW()- INTERVAL $dday DAY) ORDER BY post_date_gmt"; 
    8384      $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"; 
    84       //echo $q; 
    8585      $result = $wpdb->get_results($q, OBJECT); 
    86       //print_r($result); 
    8786 
    8887      //Ausgabe für's Widget 
     
    117116            $options = get_option("ayb_posts"); 
    118117            if ( !is_array($options) ) { 
    119                   /*$options = array('title'=>'Vor einem Jahr'); 
    120                   $options = array('day'=>0); 
    121                   $options = array('month'=>0); 
    122                   $options = array('year'=>1); 
    123                   $options = array('showdate'=>1); 
    124                   $options = array('dateformat'=>'d.m.Y'); 
    125                   $options = array('notfound'=>'Kein Beitrag an diesem Tag'); 
    126                   */ 
    127                   $options = array('title'=>'Vor einem Jahr', 'day'=>0, 'month'=>0, 'year'=>1, 'showdate'=>1, 'dateformat'=>'d.m.Y', 'notfound'=>'Kein Beitrag an diesem Tag'); 
     118                  $options = array('title'=>__('Vor einem Jahr',$ayb_posts_domain), 'day'=>0, 'month'=>0, 'year'=>1, 'showdate'=>1, 'dateformat'=>'d.m.Y', 'notfound'=>__('Kein Beitrag an diesem Tag.',$ayb_posts_domain)); 
    128119 
    129120            } 
     
    138129            if ( $_POST['ayb_posts_submit'] ) { 
    139130 
    140                   // Remember to sanitize and format use input appropriately. 
    141131                  $options['title'] = strip_tags(stripslashes($_POST['ayb_posts_title'])); 
    142132                  $options["day"]=strip_tags(stripslashes($_POST['ayb_posts_day'])); 
     
    149139            } 
    150140 
    151             // Be sure you format your options to be valid HTML attributes. 
    152141            $title = htmlspecialchars($options['title'], ENT_QUOTES); 
    153142 
    154             // Here is our little form segment. Notice that we don't need a 
    155             // complete form. This will be embedded into the existing form. 
    156             echo '<p style="text-align:right;"><label for="ayb_posts_title">' . __('Title:') . ' <input style="width: 200px;" id="ayb_posts_title" name="ayb_posts_title" type="text" value="'.$title.'" /></label></p>'; 
    157             echo '<p style="text-align:right;"><label for="ayb_posts_day">' . __('Tage zuvor:') . ' <input style="width: 30px;" id="ayb_posts_day" name="ayb_posts_day" type="text" value="'.$day.'" /></label></p>'; 
    158             echo '<p style="text-align:right;"><label for="ayb_posts_month">' . __('Monate zuvor:') . ' <input style="width: 30px;" id="ayb_posts_month" name="ayb_posts_month" type="text" value="'.$month.'" /></label></p>'; 
    159             echo '<p style="text-align:right;"><label for="ayb_posts_year">' . __('Jahre zuvor:') . ' <input style="width: 30px;" id="ayb_posts_year" name="ayb_posts_year" type="text" value="'.$year.'" /></label></p>'; 
    160             echo '<p style="text-align:right;"><label for="ayb_posts_showdate">' . __('Zeige Datum an:') . ' <input style="width: 15px;" id="ayb_posts_showdate" name="ayb_posts_showdate" type="checkbox" value="1"'.(($showdate==0)?'':'checked').' /></label></p>'; 
    161             echo '<p style="text-align:right;"><label for="ayb_posts_dateformat">' . __('Datumsformat:') . ' <input style="width: 30px;" id="ayb_posts_dateformat" name="ayb_posts_dateformat" type="text" value="'.$dateformat.'" /></label></p>'; 
    162             echo '<p style="text-align:right;"><label for="ayb_posts_notfound">' . __('Text wenn kein gefundener Beitrag:') . ' <input style="width: 200px;" id="ayb_posts_notfound" name="ayb_posts_notfound" type="text" value="'.$notfound.'" /></label></p>'; 
    163             echo '<input type="hidden" id="ayb_posts_submit" name="ayb_posts_submit" value="1" />'; 
     143            echo '<p style="text-align:right;"><label for="ayb_posts_title">' . __('Titel:',$ayb_posts_domain) . ' <input style="width: 200px;" id="ayb_posts_title" name="ayb_posts_title" type="text" value="'.$title.'" /></label></p>'; 
     144            echo '<p style="text-align:right;"><label for="ayb_posts_day">' . __('Tage zuvor:',$ayb_posts_domain) . ' <input style="width: 30px;" id="ayb_posts_day" name="ayb_posts_day" type="text" value="'.$day.'" /></label></p>'; 
     145            echo '<p style="text-align:right;"><label for="ayb_posts_month">' . __('Monate zuvor:',$ayb_posts_domain) . ' <input style="width: 30px;" id="ayb_posts_month" name="ayb_posts_month" type="text" value="'.$month.'" /></label></p>'; 
     146            echo '<p style="text-align:right;"><label for="ayb_posts_year">' . __('Jahre zuvor:',$ayb_posts_domain) . ' <input style="width: 30px;" id="ayb_posts_year" name="ayb_posts_year" type="text" value="'.$year.'" /></label></p>'; 
     147            echo '<p style="text-align:right;"><label for="ayb_posts_showdate">' . __('Zeige Datum an:',$ayb_posts_domain) . ' <input style="width: 15px;" id="ayb_posts_showdate" name="ayb_posts_showdate" type="checkbox" value="1"'.(($showdate==0)?'':'checked').' /></label></p>'; 
     148            echo '<p style="text-align:right;"><label for="ayb_posts_dateformat">' . __('Datumsformat:',$ayb_posts_domain) . ' <input style="width: 45px;" id="ayb_posts_dateformat" name="ayb_posts_dateformat" type="text" value="'.$dateformat.'" /></label></p>'; 
     149            echo '<p style="text-align:right;"><label for="ayb_posts_notfound">' . __('Text, wenn kein Beitrag gefunden:',$ayb_posts_domain) . ' <input style="width: 200px;" id="ayb_posts_notfound" name="ayb_posts_notfound" type="text" value="'.$notfound.'" /></label></p>'; 
     150            echo '<p style="text-align:right;"><input type="submit" id="ayb_posts_submit" name="ayb_posts_submit" value="'. __('Aktualisieren',$ayb_posts_domain) . '" /></p>'; 
    164151 
    165152      } 
    166153 
    167       register_widget_control("A Year Before","ayb_posts_widget_control",200,300); 
     154      register_widget_control("A Year Before","ayb_posts_widget_control",200,320); 
    168155      register_sidebar_widget('A Year Before','ayb_posts'); 
    169156}