Returns all languages according to the given arguments.
public get_languages ( array $args = [] ) : object[] | ||
$args | array | Arguments. |
Résultat | object[] | The array with objects of all languages according to the given arguments. |
/** * @return void */ private function print_tbody() { $rows = $this->languages->get_languages(['number' => $this->pagination_data->get_items_per_page(), 'page' => $this->pagination_data->get_current_page()]); if (!$rows) { ?> <tr> <td colspan="<?php echo count($this->columns); ?> "> <p> <?php _e('No items found. We recommend to reinstall this plugin.', 'multilingual-press'); ?> </p> </td> </tr> <?php return; } foreach ($rows as $id => $row) { $this->print_row($id, $row); } }
/** * Update option WPLANG in DB for new sites. * * @param int $blog_id * @return void */ private function update_wplang($blog_id) { $posted = $this->get_posted_language(); if (!$posted) { return; } $available_language = $this->languages->get_languages(['fields' => 'wp_locale', 'conditions' => [['field' => 'http_name', 'value' => $posted]]]); // no results found? -> return if (empty($available_language)) { return; } // getting the first wp_locale $wp_locale = $available_language[0]->wp_locale; $available_lang_files = get_available_languages(); if (!in_array($wp_locale, $available_lang_files, true)) { return; } update_blog_option($blog_id, 'WPLANG', $wp_locale); }