function widget_rrm_popular_posts($args) { extract($args); $options = get_option('widget_rrm_popular_posts'); $opt = get_option('popular-posts'); $widget_condition = $opt['widget_condition']; // the condition specified in the widget control overrides the placement setting screen if ($options['condition']) { $condition = $options['condition']; } else { if ($widget_condition) { $condition = $widget_condition; } else { $condition = 'true'; } } $condition = stristr($condition, "return") ? $condition : "return " . $condition; $condition = rtrim($condition, '; ') . ' || is_admin();'; if (eval($condition)) { $title = empty($options['title']) ? __('Popular Posts', 'popular_posts_plugin') : $options['title']; if (!($number = (int) $options['number'])) { $number = 10; } else { if ($number < 1) { $number = 1; } else { if ($number > 15) { $number = 15; } } } $options = get_option('popular-posts'); $widget_parameters = $options['widget_parameters']; $output = PopularPosts::execute('limit=' . $number . '&' . $widget_parameters); if ($output) { echo $before_widget; echo $before_title . $title . $after_title; echo $output; echo $after_widget; } } }