public static function render_metrics($content, $context = null)
    {
        $metrics = self::get_metrics(array(), null);
        if (empty($context)) {
            if ('comment_text' === current_filter()) {
                $context_type = 'comments';
                $context_id = get_comment_ID();
            } else {
                $context_type = get_post_type();
                $context_id = get_the_ID();
            }
            $context = apply_filters('evaluate_get_context', array('type' => $context_type, 'id' => $context_id));
        }
        $user_key = Evaluate_Voting::get_user_key();
        foreach ($metrics as $key => $metric) {
            if (in_array($context['type'], $metric['options']['usage']) && in_array($metric['type'], array_keys(self::$metric_types))) {
                wp_enqueue_script('evaluate-metrics');
                wp_enqueue_style('evaluate-metrics');
                wp_enqueue_style('evaluate-icons');
                ob_start();
                ?>
				<span class="metric metric-<?php 
                echo $metric['metric_id'];
                ?>
 metric-<?php 
                echo $metric['type'];
                ?>
"
					data-id="<?php 
                echo $metric['metric_id'];
                ?>
"
					data-context="<?php 
                echo $context_id;
                ?>
"
					data-nonce="<?php 
                echo Evaluate_Voting::get_nonce($metric['metric_id'], $context_id);
                ?>
">
					<?php 
                if (!empty($metric['options']['title'])) {
                    ?>
						<strong class="metric-title"><?php 
                    echo $metric['options']['title'];
                    ?>
</strong>
						<?php 
                }
                $metric_type = self::$metric_types[$metric['type']];
                $score = $metric_type->get_score($metric['metric_id'], $context['id']);
                $user_vote = $metric_type->get_vote($metric, $context['id'], $user_key);
                $metric_type->render_display($metric, $score, $user_vote);
                ?>
				</span>
				<?php 
                $content .= ob_get_clean();
            }
        }
        return $content;
    }
        if (is_user_logged_in()) {
            return get_current_user_id();
        } else {
            return self::get_client_ip();
        }
    }
    public static function set_vote($vote, $metric, $context_id, $user_id)
    {
        $metric_type = Evaluate_Metrics::get_metric_types()[$metric['type']];
        $old_vote = $metric_type->get_vote($metric, $context_id, $user_id);
        $vote = $metric_type->validate_vote($vote, $old_vote, $metric['options']);
        $metric_type->set_vote($vote, $metric, $context_id, $user_id);
        $score = $metric_type->get_score($metric['metric_id'], $context_id);
        $score = $metric_type->modify_score($score, $vote, $old_vote, $metric, $context_id);
        return array('count' => $score['count'], 'average' => $score['average'], 'data' => $score['data'], 'vote' => $vote);
    }
    public static function clear_votes($metric_id = null, $context = null)
    {
        global $wpdb;
        $where = array();
        if ($metric_id != null) {
            $where['metric_id'] = $metric_id;
        }
        if ($context != null) {
            $where['context_id'] = $context;
        }
        $wpdb->delete(Evaluate::$voting_table, $where);
    }
}
Evaluate_Voting::init();