15 )
$number = 15;
// It's important to use the $before_widget, $before_title,
// $after_title and $after_widget variables in your output.
echo $before_widget;
echo $before_title . $title . $after_title;
echo '
';
akpc_most_popular($number, '
');
echo '
';
echo $after_widget;
}
// This is the function that outputs the form to let users edit
// the widget's title and so on. It's an optional feature, but
// we'll use it because we can!
function widget_openxtra_mostpopular_control() {
// Collect our widget’s options.
$options = $newoptions = get_option('widget_openxtra_mostpopular');
// This is for handing the control form submission.
if ( $_POST['openxtra_mostpopular-submit'] ) {
// Clean up control form submission options
$newoptions['title'] = strip_tags(stripslashes($_POST['openxtra_mostpopular-title']));
$newoptions['number'] = strip_tags(stripslashes($_POST['openxtra_mostpopular-number']));
}
// If original widget options do not match control form
// submission options, update them.
if ( $options != $newoptions ) {
$options = $newoptions;
update_option('widget_openxtra_mostpopular', $options);
}
$title = attribute_escape($options['title']);
if ( !$number = (int) $options['number'] )
$number = 1;
?>