<?php
/*
Plugin Name: Name des Widgetplugins
Plugin URI: http://
Description: Eine kurze Beschreibung
Author: Dein Name
Version: 0.0
License: deine Linzenzvergabe
Author URI: http://
*/

// Widget initialisieren, wenn Widget-Plugin aktiv
function FB_Init_Widget() {
  if (!
function_exists('register_sidebar_widget'))
    return;
  
  
// Dein Widget einbinden
  
function widget_FB_IHR_NAME($args) {
    if (
is_home()) {
      
extract($args);
      
      
$options get_option('widget_FB_IHR_NAME');
      
        
// Optionale Abfrage fuer die Uebergabe von Parametern
        // Hier kann man beispielsweise OPTIONS abfragen
        
$OPTION_1 $options['OPTION_1'] ? 'checked="checked"' '';
        if (
$OPTION_1 == 'checked="checked"'$PARAMETER 1;

      
$title $options['title'];
      
      echo 
$before_widget;
      
      if (
$title != '') {
        echo 
$before_title $title $after_title;
      }
      
      
// Nun rufen wir die Funktion(en) auf, die die neue Funktionalitaet enthaelt
      
Der_Code_des_eigentlichen_Plugins($PARAMETER);
      
      echo 
$after_widget;
    }
  }

  
// Hier steht der Code der Funktion(en), die die eigentliche Funktionalitaet enthaelt
  
function Der_Code_des_eigentlichen_Plugins(Parameter) {
  
  }
  
  
// Widget-Control
  
function widget_control_FB_IHR_NAME() {
    
$options $newoptions get_option('widget_FB_IHR_NAME');
    if ( 
$_POST['widget_FB_IHR_NAME_submit'] ) {
      
      
// Abfrage einer Option im Control-Fenster
      
$newoptions['OPTION_1'] = isset($_POST['widget_FB_IHR_NAME_OPTION_1']);
      
      
// Abfrage des Title im Control-Fenster
      
$newoptions['title'] = strip_tags(stripslashes($_POST['widget_FB_IHR_NAME_title']));
    }
    if ( 
$options != $newoptions ) {
      
$options $newoptions;
      
update_option('widget_FB_IHR_NAME'$options);
    }
    
    
$title wp_specialchars($options['title']);
  
?>
  <!-- Ausgabe im Control-Fenster des Adminbereichs von WP  -->
    <p>
      <label for="widget_FB_IHR_NAME_title"><?php _e('Title:'); ?> 
        <input style="width: 200px;" id="widget_FB_IHR_NAME_title" name="widget_FB_IHR_NAME_title" type="text" value="<?php echo $title?>" />
      </label>
    </p>
    <p style="text-align:right;margin-right:40px;">
      <label for="widget_FB_IHR_NAME_OPTION_1" style="text-align:right;">OPTION_1 
        <input class="checkbox" type="checkbox" <?php echo $OPTION_1?> id="widget_FB_IHR_NAME_OPTION_1" name="widget_FB_IHR_NAME_OPTION_1" />
      </label>
    </p>
    <p style="text-align:right;margin-right:40px;"><?php echo $error?>
    </p>
    <input type="hidden" id="widget_FB_IHR_NAME_submit" name="widget_FB_IHR_NAME_submit" value="1" />
  <?php
  
}
  
  
// Widget im Admin-Panel hinzufuegen - register_sidebar_widget($name, $callback) 
  
register_sidebar_widget('DEIN_NAME''widget_FB_IHR_NAME');
  
// Zusaetzliche Argumente im Widget-Control - register_widget_control($name, $callback, $width , $height);
  
register_widget_control('DEIN_NAME''widget_control_FB_IHR_NAME'200100);
}

// Integration in WP - add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1);
add_action('plugins_loaded''FB_Init_Widget');
?>