function widget($args, $instance) { extract($args); $name = empty($instance['name']) ? '' : $instance['name']; //$MyWidget = MCW_get_mywidget_by_name($name); $code = empty($instance['code']) ? $MyWidget['code'] : $instance['code']; $kind = empty($instance['kind']) ? $MyWidget['kind'] : $instance['kind']; $title = empty($instance['title']) ? $MyWidget['title'] : $instance['title']; $title = apply_filters('widget_title', $title); $myfilteroptions = MCW_get_option('filters'); $max = count($myfilteroptions); for ($i = 0; $i < $max; ++$i) { $filter_ID = 'filter-' . $myfilteroptions[$i][0]; $MyWidget[$filter_ID] = empty($instance[$filter_ID]) ? $MyWidget[$filter_ID] : $instance[$filter_ID]; } $beforecode = empty($instance['beforecode']) ? $MyWidget['beforecode'] : $instance['beforecode']; $foreign_id = empty($instance['foreign_id']) ? $MyWidget['foreign_id'] : $instance['foreign_id']; $MyWidget['kind'] = $kind; $MyWidget['name'] = $name; $MyWidget['code'] = $code; $MyWidget['beforecode'] = $beforecode; $MyWidget['foreign_id'] = $foreign_id; MCW_logfile("prüfung ob filter zulässig."); //debugging only $myfilteroptions = MCW_get_option('filters'); $max = count($myfilteroptions); $erg = false; $temp = false; for ($i = 0; $i < $max; ++$i) { $c = 'if (' . stripslashes($myfilteroptions[$i][1]) . '){$temp = true;}'; // filter würde greifen eval($c); if ($temp && $instance['filter-' . $myfilteroptions[$i][0]] == 1) { // und filter wurde aktiviert $visible = true; break; } } if ($visible) { MCW_logfile("Darstellung ist zulässig."); //debugging only # Before the widget if ($title != "") { echo $before_widget; } if (trim($title) != "") { $output = $before_title . $title . $after_title; } $output = $output . MCW_run_code($MyWidget); # apply filters if (MCW_get_option('use_wpfilter')) { $wpfilter = MCW_get_option('wpfilter'); $output = apply_filters($wpfilter, $output); } echo $output; # After the widget if ($title != "") { echo $after_widget; } } }
function MCW_make_available_outside($content) { $Widget_IDs_all = MCW_get_all_widget_IDs(); $maxi = count($Widget_IDs_all); if (!empty($Widget_IDs_all)) { for ($windex = 0; $windex < $maxi; ++$windex) { $widget = MCW_get_mywidget_by_index($windex); if (MCW_get_option('use_custag')) { if (MCW_checkshow($widget['filter'])) { //MCW_logfile('filter anwenden für '.$maxi.' widgets'); //debugging only $output = MCW_run_code($widget); $content = eregi_replace('<!--' . $widget["name"] . '-->', $output, $content); } } } } return $content; }