/**
  * Prepare item for record add in wp list table
  *
  * @since 1.0
  * @param Null
  * @return Array
  */
 public function prepare_items()
 {
     $orderby = Utils_Helper::request('orderby', 'total', 'sanitize_sql_orderby');
     $order_type = Utils_Helper::request('order', 'desc', 'sanitize_sql_orderby');
     $reference = $this->_verify_sql_orderby($orderby, 'total');
     $order = $this->_verify_sql_order($order_type, 'desc');
     $posts_per_page = $this->get_items_per_page('ssb_posts_per_page', self::POSTS_PER_PAGE);
     $current_page = $this->get_pagenum();
     $total_results = self::_total_results();
     $this->_column_headers = $this->get_column_info();
     $this->set_pagination_args(array('total_items' => $total_results, 'total_pages' => $total_results / $posts_per_page, 'per_page' => $posts_per_page));
     $this->items = self::_get_sharing_report($posts_per_page, $current_page, $reference, $order);
 }
 /**
  * Retrieve the requests
  *
  * @since 1.2
  * @global $wpdb
  * @param Null
  * @return Void
  */
 public static function global_counts_social_share()
 {
     global $wpdb;
     $post_id = Utils_Helper::request('reference', false, 'intval');
     $post_title = get_the_title($post_id);
     $count_facebook = Utils_Helper::request('count_facebook', 0, 'intval');
     $count_twitter = Utils_Helper::request('count_twitter', 0, 'intval');
     $count_google = Utils_Helper::request('count_google', 0, 'intval');
     $count_linkedin = Utils_Helper::request('count_linkedin', 0, 'intval');
     $count_pinterest = Utils_Helper::request('count_pinterest', 0, 'intval');
     $total = $count_facebook + $count_twitter + $count_google + $count_linkedin + $count_pinterest;
     $nonce = Utils_Helper::request('nonce', false, 'esc_html');
     $table = $wpdb->prefix . Setting::TABLE_NAME;
     if (static::_verify_request($post_id, $nonce)) {
         exit(0);
     }
     if ($total > 0) {
         static::_select($table, array('post_id' => $post_id, 'post_title' => $post_title, 'count_facebook' => $count_facebook, 'count_twitter' => $count_twitter, 'count_google' => $count_google, 'count_linkedin' => $count_linkedin, 'count_pinterest' => $count_pinterest, 'total' => $total));
     }
     exit(1);
 }