public function get_summary()
 {
     $result = false;
     $source_language = filter_input(INPUT_GET, 'source_language', FILTER_DEFAULT);
     $valid_nonce = check_ajax_referer('wpml_words_count_summary', 'nonce', false);
     if ($valid_nonce) {
         $rows = array();
         if ($source_language) {
             $rows = $this->wpml_tm_words_count->get_summary($source_language);
         }
         if (count($rows)) {
             $this->wpml_tm_words_count_summary->rows = $rows;
             $result = $this->wpml_tm_words_count_summary->get_view();
         }
     }
     if ($result) {
         return $this->wpml_wp_api->wp_send_json_success($result);
     } else {
         return $this->wpml_wp_api->wp_send_json_error('Error!');
     }
 }
 public function get_summary()
 {
     $result = false;
     $source_language = filter_input(INPUT_GET, 'source_language', FILTER_DEFAULT);
     $offset = filter_input(INPUT_GET, 'offset', FILTER_DEFAULT);
     $valid_nonce = check_ajax_referer('wpml_words_count_summary', 'nonce', false);
     if ($valid_nonce) {
         $rows = array();
         if ($source_language) {
             $rows = $this->wpml_tm_words_count->get_summary($source_language, $offset);
             $overall_count = array_shift($rows);
         }
         if (count($rows) && isset($overall_count)) {
             $this->wpml_tm_words_count_summary->rows = $rows;
             $result = $this->wpml_tm_words_count_summary->get_view() . '<span id="wpml_tm_wc_post_ratio" style="display:none;">' . (int) ($overall_count * 100) . '%</span>';
         }
     }
     if ($result) {
         return $this->wpml_wp_api->wp_send_json_success($result);
     } else {
         return $this->wpml_wp_api->wp_send_json_error('Error!');
     }
 }