/**
  * Creates the edit form for the widget.
  *
  */
 function form($instance)
 {
     global $mcw_prefix;
     global $mcw_path;
     //if (!empty($instance)){
     include_once MCW_get_url('style');
     //}
     //Defaults
     $defaults = MCW_get_default_options();
     $instance = wp_parse_args((array) $instance, array('title' => '', 'kind' => $defaults['std_kind'], 'name' => $this->id, 'filter-all' => 1));
     $title = htmlspecialchars($instance['title']);
     echo '<div class="mcw-row-"><label for="' . $this->get_field_name('title') . '"><input type="text" id="' . $this->get_field_id('title') . '" name="' . $this->get_field_name('title') . '" value="' . $title . '" size="13" ></label></div>';
     echo '<div class="mcw-row-small"><nobr><label for="' . $this->get_field_name('kind') . '_php"><input type="radio" id="' . $this->get_field_id('kind') . '_php" name="' . $this->get_field_name('kind') . '" value="php" checked="checked"> PHP</label></nobr>';
     echo '<nobr><label for="' . $this->get_field_name('kind') . '_html"><input type="radio" id="' . $this->get_field_id('kind') . '_html" name="' . $this->get_field_name('kind') . '" value="html"' . MCW_check($instance['kind'], "html") . '> HTML</label></nobr></div><br>';
     //echo '<div class="mcw-row">'.MCW_get_input_code($instance, $this).'</div>';
     echo '<div class="mcw-row"><textarea cols="60" id="' . $this->get_field_id('code') . '" name="' . $this->get_field_name('code') . '" style="height:' . MCW_get_option('code_height') . 'px; font-family:Courier, Monaco, monospace;" >' . stripslashes($instance["code"]) . '</textarea><br></div>';
     //echo '<div class="mcw-row-small">'.MCW_get_input_filters($instance, $this).'</div>';
     $myfilteroptions = MCW_get_option('filters');
     // get all filters
     if (empty($myfilteroptions)) {
         $myfilteroptions = array('all' => '1');
     }
     $max = count($myfilteroptions);
     echo '<div class="mcw-row-small">';
     for ($i = 0; $i < $max; ++$i) {
         echo '<nobr><label for="' . $this->get_field_id('filter' . '-' . $myfilteroptions[$i][0]) . '">';
         echo '<input type="checkbox" id="' . $this->get_field_id('filter' . '-' . $myfilteroptions[$i][0]) . '" name="' . $this->get_field_name('filter' . '-' . $myfilteroptions[$i][0]) . '" value="1" ';
         echo MCW_check($instance['filter-' . $myfilteroptions[$i][0]], "1");
         //active or not
         echo '> ' . $myfilteroptions[$i][0] . ' </label></nobr>';
     }
     echo '</div>';
 }
function MCW_get_input_filters($filtername, $widgetindex = '', $filtervalue = array('all' => 1), $display_only = false)
{
    $myfilteroptions = MCW_get_all_filters();
    global $mcw_filters_tooltip;
    if ($display_only) {
        $disabler = ' disabled= "true"';
    } else {
        $disabler = '';
    }
    $max = count($myfilteroptions);
    $result = '<div onmouseover="Tip(&#39;' . $mcw_filters_tooltip . '&#39;)" onmouseout="UnTip()">';
    for ($i = 0; $i < $max; ++$i) {
        $result = $result . '<nobr><label for="' . $filtername . $widgetindex . '[' . $myfilteroptions[$i][0] . ']"><input type="checkbox" id="' . $filtername . $widgetindex . '[' . $myfilteroptions[$i][0] . ']" name="' . $filtername . $widgetindex . '[' . $myfilteroptions[$i][0] . ']" value="1" ' . MCW_check($filtervalue[$myfilteroptions[$i][0]], "1") . $disabler . '> ' . $myfilteroptions[$i][0] . ' </label></nobr>';
    }
    $result = $result . '</div>';
    return $result;
}