Beispiel #1
0
 /**
  * @package Kopa
  * @subpackage Core
  * @author thethangtran <*****@*****.**>
  * @since 1.0.0         
  */
 function kopa_set_view_count()
 {
     check_ajax_referer('kopa_set_view_count', 'ajax_nonce');
     if (!empty($_POST['post_id'])) {
         $post_id = (int) $_POST['post_id'];
         $data['count'] = (int) KopaUtil::set_views($post_id);
         if ($data['count'] < 2) {
             $data['suffix'] = __('View', kopa_get_domain());
         } else {
             $data['suffix'] = __('Views', kopa_get_domain());
         }
         echo json_encode($data);
     }
     die;
 }