Пример #1
0
 static function get_unique_source_counts_by_type()
 {
     global $polylang;
     $lgtm = new Lingotek_Model();
     // FIXME not created by Lingotek as Polylang believes we are doing ajax on frontend
     foreach ($polylang->model->get_translated_post_types() as $post_type) {
         $count = $lgtm->count_posts($post_type);
         $post_type_object = get_post_type_object($post_type);
         $response['types'][$post_type_object->labels->name] = isset($count['total']) ? $count['total'] : 0;
         //only count translation sets
     }
     foreach ($polylang->model->get_translated_taxonomies() as $tax) {
         $count = $lgtm->count_terms($tax);
         $taxonomy = get_taxonomy($tax);
         $response['types'][$taxonomy->labels->name] = isset($count['total']) ? $count['total'] : 0;
         //only count translation sets
     }
     $response['total'] = array_sum($response['types']);
     return $response;
 }