function admin_form(&$qa_content)
 {
     // process the admin form if admin hits Save-Changes-button
     $ok = null;
     if (qa_clicked('q2apro_popularqu_save')) {
         qa_opt('q2apro_popularqu_enabled', (bool) qa_post_text('q2apro_popularqu_enabled'));
         // empty or 1
         qa_opt('q2apro_popularqu_maxqu', (int) qa_post_text('q2apro_popularqu_maxqu'));
         qa_opt('q2apro_popularqu_lastdays', (int) qa_post_text('q2apro_popularqu_lastdays'));
         qa_opt('q2apro_popularqu_checkhours', (int) qa_post_text('q2apro_popularqu_checkhours'));
         qa_opt('q2apro_popularqu_answercount', (bool) qa_post_text('q2apro_popularqu_answercount'));
         $ok = qa_lang('admin/options_saved');
         // in case the options have been changed, update the widget
         q2apro_save_most_viewed_questions();
     }
     // form fields to display frontend for admin
     $fields = array();
     $fields[] = array('type' => 'checkbox', 'label' => qa_lang('q2apro_popularqu_lang/enable_plugin'), 'tags' => 'name="q2apro_popularqu_enabled"', 'value' => qa_opt('q2apro_popularqu_enabled'));
     $fields[] = array('type' => 'input', 'label' => qa_lang('q2apro_popularqu_lang/admin_maxqu'), 'tags' => 'name="q2apro_popularqu_maxqu"', 'value' => qa_opt('q2apro_popularqu_maxqu'));
     $fields[] = array('type' => 'checkbox', 'label' => qa_lang('q2apro_popularqu_lang/admin_answercount'), 'tags' => 'name="q2apro_popularqu_answercount"', 'value' => qa_opt('q2apro_popularqu_answercount'));
     $fields[] = array('type' => 'input', 'label' => qa_lang('q2apro_popularqu_lang/admin_lastdays'), 'tags' => 'name="q2apro_popularqu_lastdays"', 'value' => qa_opt('q2apro_popularqu_lastdays'));
     $fields[] = array('type' => 'input', 'label' => qa_lang('q2apro_popularqu_lang/admin_checkhours'), 'tags' => 'name="q2apro_popularqu_checkhours"', 'value' => qa_opt('q2apro_popularqu_checkhours'));
     $fields[] = array('type' => 'static', 'note' => qa_lang('q2apro_popularqu_lang/admin_lastcache') . ' ' . date('Y-m-d H:i:s', (double) qa_opt('q2apro_popularqu_checktime')));
     $fields[] = array('type' => 'static', 'note' => qa_lang('q2apro_popularqu_lang/admin_remember') . ' <a href="' . qa_path('admin/layout') . '">/admin/layout</a>');
     $fields[] = array('type' => 'static', 'note' => '<span style="font-size:75%;color:#789;">' . strtr(qa_lang('q2apro_popularqu_lang/contact'), array('^1' => '<a target="_blank" href="http://www.q2apro.com/forum/">', '^2' => '</a>')) . '</span>');
     return array('ok' => $ok && !isset($error) ? $ok : null, 'fields' => $fields, 'buttons' => array(array('label' => qa_lang('main/save_button'), 'tags' => 'name="q2apro_popularqu_save"')));
 }
    function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
    {
        if (time() - qa_opt('q2apro_popularqu_checktime') > qa_opt('q2apro_popularqu_checkhours') * 60 * 60) {
            q2apro_save_most_viewed_questions();
        }
        // output widget using cached values
        $output = '';
        $output .= '
			<div class="popularquestions-widget">
				<p>
					' . qa_lang('q2apro_popularqu_lang/most_popqu') . ' ' . qa_opt('q2apro_popularqu_lastdays') . ' ' . qa_lang('q2apro_popularqu_lang/days') . '
				</p>
				<ol>
					' . qa_opt('q2apro_popularqu_cached') . '
				</ol>
			</div>
		';
        // css (could also go into your theme css to save load)
        $output .= '
			<style type="text/css">
				.popularquestions-widget {
					margin:30px 0 30px 0;
				}
				.popularquestions-widget p {
					font-size:14px;
				}
				.popularquestions-widget ol {
					padding:0 10px 0 15px;
					font-size:12px;
				}
				.popularquestions-widget ol li {
					padding:5px 0;
				}
				.popularquestions-widget ol li a {
					color:#05B;
					word-wrap:break-word;
				}
				.popularquestions-widget ol li span {
					cursor:default;color:#555;
				}
			</style>
		';
        // output widget into theme
        $themeobject->output($output);
    }