function prepare_items() { $data = $this->strings; $active_data = $this->active_strings; $s = empty($_GET['s']) ? '' : wp_unslash($_GET['s']); foreach ($data as $key => $row) { if (-1 !== $this->selected_group && $row['context'] !== $this->selected_group || !empty($s) && stripos($row['name'], $s) === false && stripos($row['string'], $s) === false) { unset($data[$key]); } } $count = 0; foreach ($data as $key => $row) { $data[$key]['row'] = $count; $mo = new HOCWP_MO(); $translation = $mo->import_from_db($row['string']); $data[$key]['translation'] = $translation; if (!isset($active_data[$key])) { $data[$key]['bulk_action'] = true; } $count++; } $per_page = $this->get_items_per_page('hocwp_string_translation_posts_per_page'); $this->_column_headers = array($this->get_columns(), array(), $this->get_sortable_columns()); if (!empty($_GET['orderby'])) { usort($data, array(&$this, 'usort_reorder')); } $total_items = count($data); $this->items = array_slice($data, ($this->get_pagenum() - 1) * $per_page, $per_page); $this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $per_page, 'total_pages' => ceil($total_items / $per_page))); }