PHP Interface Inpsyde\MultilingualPress\API\Languages

Since: 3.0.0
Show file Open project: inpsyde/multilingual-press Interface Usage Examples

Public Methods

Method Description
get_all_languages ( ) : object[] Returns an array with objects of all available languages.
get_language_by_http_code ( string $http_code, string $field = 'native_name', string | string[] $fallbacks = ['native_name', 'english_name'] ) : string | string[] Returns the desired field value of the language with the given HTTP code.
get_languages ( array $args = [] ) : object[] Returns all languages according to the given arguments.
update_languages_by_id ( array $languages ) : integer Updates the given languages.

Method Details

get_all_languages() public method

Returns an array with objects of all available languages.
Since: 3.0.0
public get_all_languages ( ) : object[]
return object[] The array with objects of all available languages.

get_language_by_http_code() public method

Returns the desired field value of the language with the given HTTP code.
Since: 3.0.0
public get_language_by_http_code ( string $http_code, string $field = 'native_name', string | string[] $fallbacks = ['native_name', 'english_name'] ) : string | string[]
$http_code string Language HTTP code.
$field string Optional. The field which should be queried. Defaults to 'native_name'.
$fallbacks string | string[] Optional. Falback language fields. Defaults to native and English name.
return string | string[] The desired field value, an empty string on failure, or an array for field 'all'.

get_languages() public method

Returns all languages according to the given arguments.
Since: 3.0.0
public get_languages ( array $args = [] ) : object[]
$args array Arguments.
return object[] The array with objects of all languages according to the given arguments.

update_languages_by_id() public method

Updates the given languages.
Since: 3.0.0
public update_languages_by_id ( array $languages ) : integer
$languages array An array with language IDs as keys and one or more fields as values.
return integer The number of updated languages.