function wpsteam_achievements_options_page()
{
    if (!current_user_can('manage_options')) {
        wp_die('You do not have suggicient permissions to access this page.');
    }
    global $plugin_url;
    global $options;
    if (isset($_POST['wpsteamname_form_submitted'])) {
        $hidden_field = esc_html($_POST['wpsteamname_form_submitted']);
        if ($hidden_field == 'Y') {
            $wpsteamname = esc_html($_POST['wpsteamname']);
            $wpsteam_profile = wpsteam_achievements_get_profile($wpsteamname);
            $wpsteam_tf2_xml = wpsteam_tf2_xml($wpsteamname);
            $achievement_count = count_achievements($wpsteam_tf2_xml);
            $achievements = most_recent_achievements($wpsteam_tf2_xml);
            $options['wpsteamname'] = $wpsteamname;
            $options['wpsteam_profile'] = $wpsteam_profile;
            $options['achievement_count'] = $achievement_count;
            $options['last_updated'] = time();
            $options['most_recent_achievement'] = $achievements;
            update_option('wpsteam_achievements', $options);
        }
    }
    $options = get_option('wpsteam_achievements');
    if ($options != '') {
        $wpsteamname = $options['wpsteamname'];
        $achievement_count = $options['achievement_count'];
        $wpsteam_profile = $options['wpsteam_profile'];
        $achievements = $options['most_recent_achievement'];
    }
    require 'inc/options-page-wrapper.php';
}
Example #2
0
     change_work_status_of_achievement(filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT), filter_input(INPUT_POST, 'status', FILTER_SANITIZE_NUMBER_INT));
     break;
 case "change_work_status_of_action":
     change_work_status_of_action(filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT), filter_input(INPUT_POST, 'work', FILTER_SANITIZE_NUMBER_INT));
     break;
 case "clear_due_date":
     clear_due_date(filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT));
     break;
 case "complete_achievement":
     complete_achievement(filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT));
     break;
 case "complete_todo":
     complete_todo(filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT));
     break;
 case "count_achievements":
     echo json_encode(count_achievements());
     break;
 case "create_achievement":
     create_achievement(filter_input(INPUT_POST, 'name', FILTER_SANITIZE_STRING), filter_input(INPUT_POST, 'parent', FILTER_SANITIZE_NUMBER_INT));
     break;
 case "create_action":
     create_action(filter_input(INPUT_POST, 'achievement_id', FILTER_SANITIZE_NUMBER_INT), filter_input(INPUT_POST, 'action', FILTER_SANITIZE_STRING));
     break;
 case "create_new_action":
     create_new_action(filter_input(INPUT_POST, 'action', FILTER_SANITIZE_STRING));
     break;
 case "create_note":
     create_note(filter_input(INPUT_POST, 'note', FILTER_SANITIZE_STRING), filter_input(INPUT_POST, 'achievement_id', FILTER_SANITIZE_NUMBER_INT));
     break;
 case "create_relation":
     create_relation(filter_input(INPUT_POST, 'a', FILTER_SANITIZE_NUMBER_INT), filter_input(INPUT_POST, 'b', FILTER_SANITIZE_NUMBER_INT));