<a href="#" title="Edit Widget">
                      <img src="<?php 
            echo MCW_get_url('edit');
            ?>
" onClick="Effect.toggle('<?php 
            echo $element_widget_container . $i;
            ?>
', 'slide', {duration:0.5}); return true;">
                    </a>
                  </th>
                <?php 
        }
        ?>
        	      <td align="left" width="100%">
                  <?php 
        $help_plausi_failed = MCW_plausibility_check($help_widget);
        ?>
                  <?php 
        if ($help_plausi_failed) {
            echo '<div id="' . $element_widget_warning . $i . '" class="mcw_error" onClick="Effect.toggle(\'' . $element_widget_container . $i . '\', \'slide\', {duration:0.5});return true;"><p><b>Code did not pass the plausibility check. Please review!</b> <br><i>(' . $help_plausi_failed . ')</i></p></div>';
        }
        ?>
                  <div id="<?php 
        echo $element_widget_container . $i;
        ?>
" style="display:<?php 
        if ($javascript_is_allowed) {
            echo 'none';
        } else {
            echo 'block';
        }
function MCW_eval_code($args)
{
    extract($args);
    if (!isset($i)) {
        $funcArgs = func_get_args();
        // for wp2.2.1
        $i = $funcArgs[1];
    }
    if (!isset($name)) {
        $name = $args['name'];
        // for wp2.2.1
    }
    if (!isset($force_eval)) {
        $force_eval = $args['force_eval'];
        // for wp2.2.1
    }
    if (!isset($debug_mode)) {
        $debug_mode = $args['debug_mode'];
        // for wp2.2.1
    }
    $MyWidget = MCW_get_mywidget_by_name($name);
    if (!isset($MyWidget)) {
        $MyWidget = MCW_get_mywidget_by_index($i);
    }
    $code = $MyWidget['code'];
    //html or php
    $precode = $MyWidget['beforecode'];
    //html
    $mcw_id = $MyWidget['name'];
    //widget-ID
    $mcw_title = $MyWidget['title'];
    //widget-title
    $mcw_theme = array('before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title);
    if (isset($code)) {
        $code = stripslashes($code);
        $precode = stripslashes($precode);
        if (MCW_checkshow($MyWidget['filter']) || $force_eval) {
            if ($debug_mode == '') {
                /* productive code evaluation */
                if ($MyWidget['foreign_id'] == '' || MCW_get_option('copy_widget') == false) {
                    $output = MCW_run_code($MyWidget, $force_eval, $mcw_theme);
                } else {
                    $rec_check = MCW_check_chain($MyWidget);
                    if ($rec_check['clean'] == false) {
                        $output = $before_widget . '<div class="mcw_error">DANGER: Current widget configuration would lead to infinite loops: <br><code>' . $rec_check['chain'] . '</code></div>' . $after_widget;
                    } else {
                        $output = MCW_eval_foreign_widget($MyWidget['foreign_id'], $mcw_theme);
                    }
                }
                $wpfilter = MCW_get_option('wpfilter');
                if (MCW_get_option('use_wpfilter')) {
                    $output = apply_filters($wpfilter, $output);
                }
                echo $output;
            } else {
                if ($MyWidget['foreign_id'] != '' && MCW_get_option('copy_widget') == true) {
                    $widget_buffer = MCW_get_mywidget_by_name($MyWidget['foreign_id']);
                    if ($widget_buffer == '') {
                        echo '<br><div class="mcw_debug"><b>Debugging is not possible for foreign widgets.</b></div>';
                    } else {
                        // evaluate "foreign" MyCustomWidget
                        $widget_buffer = MCW_check_chain($widget_buffer);
                        echo '<br><div class="mcw_debug"><b>Debugging is not possible for this CustomWidget. <br>Please try again with the original one. <code>' . $widget_buffer['chain'] . '</code></b></div>';
                    }
                } else {
                    // title
                    if ($mcw_title) {
                        echo '<br><div class="mcw_debug"><b>Title:</b> <pre><code>' . MCW_make_html_writeable($mcw_title) . '</pre></code></div>';
                    }
                    echo $mcw_title;
                    // true html-code
                    if ($precode) {
                        echo '<br><div class="mcw_debug"><b>Precode:</b> <pre><code>' . MCW_make_html_writeable($precode) . '</pre></code></div>';
                    }
                    echo $precode;
                    if ($MyWidget['kind'] == "html") {
                        // html-code
                        $true_html = substr_count($code, '<?php');
                        if ($true_html == 0) {
                            //true html-code --> easy
                            echo '<br><div class="mcw_debug"><b>HTML:</b> <pre><code>' . MCW_make_html_writeable($code) . '</pre></code></div>';
                            echo $code;
                        } else {
                            // html-php-mix --> this can be tricky
                            $help_open_tag = '<?php';
                            $help_close_tag = '?' . '>';
                            $temp_widget = array('code' => $code, 'kind' => 'hmtl', 'foreign_id' => '', 'name' => $mcw_id);
                            echo MCW_plausibility_check($temp_widget);
                            /* NEW Code-evaluation */
                            $i = substr_count($code, $help_open_tag);
                            $counter = 1;
                            while ($i > 0) {
                                //split code into php- and html-pieces
                                //GRAB HTML-CODE
                                $temp_html = substr($code, 0, strpos($code, $help_open_tag));
                                //remove leading php-open-tag
                                $code = stristr($code, $help_open_tag);
                                $code = substr($code, 5, strlen($code) - 5);
                                //GRAB PHP-CODE
                                //$temp_php = stristr($code_rest, $help_close_tag, true); // only with php 6.0.0
                                $temp_php = substr($code, 0, strpos($code, $help_close_tag));
                                //remove leading php-close-tag
                                $code = stristr($code, $help_close_tag);
                                $code = substr($code, 2, strlen($code) - 2);
                                $i = substr_count($code, $help_open_tag);
                                echo '<br><div class="mcw_debug"><b>' . $counter . '. HTML:</b><pre><code> ' . MCW_make_html_writeable($temp_html) . '</pre></code></div>';
                                echo $temp_html;
                                echo '<br><div class="mcw_debug"><b>' . $counter . '. PHP:</b><pre><code> ' . MCW_make_html_writeable($temp_php) . '</pre></code></div>';
                                eval($temp_php);
                                $counter = $counter + 1;
                            }
                            if (strlen($code) > 0) {
                                //HTML code left
                                echo '<br><div class="mcw_debug"><b>' . $counter . '. HTML:</b><pre><code> ' . MCW_make_html_writeable($code) . '</pre></code></div>';
                                echo $code;
                            }
                        }
                    } else {
                        $help_open_tag = '<?php';
                        $help_close_tag = '?' . '>';
                        $true_php = substr_count($code, $help_close_tag);
                        $true_php = $true_php == 0;
                        if ($true_php) {
                            //true php-code --> high performance
                            echo '<br><div class="mcw_debug"><b>PHP:</b> ' . MCW_make_html_writeable($code) . '</div>';
                            eval($code);
                        } else {
                            $temp_widget = array('code' => $code, 'kind' => 'php', 'foreign_id' => '', 'name' => $mcw_id);
                            echo MCW_plausibility_check($temp_widget);
                            /* NEW Code-evaluation */
                            $i = substr_count($code, $help_close_tag);
                            $counter = 1;
                            while ($i > 0) {
                                //split code into php- and html-pieces
                                //GRAB PHP-CODE
                                $temp_php = substr($code, 0, strpos($code, $help_close_tag));
                                //remove leading php-close-tag
                                $code = stristr($code, $help_close_tag);
                                $code = substr($code, 2, strlen($code) - 2);
                                //GRAB HTML-CODE
                                $temp_html = substr($code, 0, strpos($code, $help_open_tag));
                                //remove leading php-open-tag
                                $code = stristr($code, $help_open_tag);
                                $code = substr($code, 5, strlen($code) - 5);
                                $i = substr_count($code, $help_close_tag);
                                echo '<br><div class="mcw_debug"><b>' . $counter . '. PHP:</b><pre><code> ' . MCW_make_html_writeable($temp_php) . '</pre></code></div>';
                                eval($temp_php);
                                echo '<br><div class="mcw_debug"><b>' . $counter . '. HTML:</b><pre><code> ' . MCW_make_html_writeable($temp_html) . '</pre></code></div>';
                                echo $temp_html;
                                $counter = $counter + 1;
                            }
                            if (strlen($code) > 0) {
                                //PHP code left
                                echo '<br><div class="mcw_debug"><b>' . $counter . '. PHP:</b><pre><code> ' . MCW_make_html_writeable($code) . '</pre></code></div>';
                                eval($code);
                            }
                        }
                    }
                }
            }
        }
    }
}