PHP Class GP_Translation, GlotPress-WP

Inheritance: extends GP_Thing
Show file Open project: GlotPress/GlotPress-WP Class Usage Examples

Public Properties

Property Type Description
$date_added string Date when the translation was added.
$date_modified string Date when the translation was modified.
$field_names array List of field names for a translation.
$found_rows integer Number of found results.
$id integer ID of the translation.
$int_fields array List of field names which have an integer value.
$non_updatable_attributes array List of field names which cannot be updated.
$number_of_plural_translations integer Number of supported translations per original.
$original_id integer ID of the original.
$per_page integer Number of translations per page.
$status string Status of the translation.
$statuses array List of valid statuses.
$table_basename string Name of the database table.
$translation_0 string Translation for a singular form.
$translation_1 string Translation for a plural form.
$translation_2 string Translation for a second plural form.
$translation_3 string Translation for a third plural form.
$translation_4 string Translation for a fourth plural form.
$translation_5 string Translation for a fifth plural form.
$translation_set_id integer ID of the translation set.
$user_id integer ID of a user who submitted the translation.
$user_id_last_modified integer ID of a user (validator) who last changed the status of the translation.
$warnings array List of warnings when translation isn't correct.

Public Methods

Method Description
after_create ( ) : boolean Executes after creating a translation.
after_delete ( ) : boolean Executes after deleting a translation.
after_save ( ) : boolean Executes after saving a translation.
create ( $args )
fix_translation ( $translation )
for_export ( $project, $translation_set, $filters = null )
for_translation ( $project, $translation_set, $page, $filters = [], $sort = [] )
last_modified ( $translation_set )
normalize_fields ( array $args ) : array Normalizes an array with key-value pairs representing a GP_Translation object.
prepare_fields_for_save ( $args )
reject ( )
restrict_fields ( GP_Validation_Rules $rules ) Sets restriction rules for fields.
set_as_current ( )
set_fields ( $db_object )
set_status ( $status )
translations ( )

Method Details

after_create() public method

Executes after creating a translation.
Since: 1.0.0
public after_create ( ) : boolean
return boolean

after_delete() public method

Executes after deleting a translation.
Since: 2.0.0
public after_delete ( ) : boolean
return boolean

after_save() public method

Executes after saving a translation.
Since: 1.0.0
public after_save ( ) : boolean
return boolean

create() public method

public create ( $args )

fix_translation() public method

public fix_translation ( $translation )

for_export() public method

public for_export ( $project, $translation_set, $filters = null )

for_translation() public method

public for_translation ( $project, $translation_set, $page, $filters = [], $sort = [] )

last_modified() public method

public last_modified ( $translation_set )

normalize_fields() public method

Normalizes an array with key-value pairs representing a GP_Translation object.
Since: 1.0.0
public normalize_fields ( array $args ) : array
$args array Arguments for a GP_Translation object.
return array Normalized arguments for a GP_Translation object.

prepare_fields_for_save() public method

public prepare_fields_for_save ( $args )

reject() public method

public reject ( )

restrict_fields() public method

Sets restriction rules for fields.
Since: 1.0.0
public restrict_fields ( GP_Validation_Rules $rules )
$rules GP_Validation_Rules The validation rules instance.

set_as_current() public method

public set_as_current ( )

set_fields() public method

public set_fields ( $db_object )

set_status() public method

public set_status ( $status )

translations() public method

public translations ( )

Property Details

$date_added public property

Date when the translation was added.
public string $date_added
return string

$date_modified public property

Date when the translation was modified.
public string $date_modified
return string

$field_names public property

List of field names for a translation.
public array $field_names
return array

$found_rows public property

Number of found results.
public int $found_rows
return integer

$id public property

ID of the translation.
public int $id
return integer

$int_fields public property

List of field names which have an integer value.
public array $int_fields
return array

$non_updatable_attributes public property

List of field names which cannot be updated.
public array $non_updatable_attributes
return array

$number_of_plural_translations public static property

Number of supported translations per original.
public static int $number_of_plural_translations
return integer

$original_id public property

ID of the original.
public int $original_id
return integer

$per_page public property

Number of translations per page.
public int $per_page
return integer

$status public property

Status of the translation.
public string $status
return string

$statuses public static property

List of valid statuses.
public static array $statuses
return array

$table_basename public property

Name of the database table.
public string $table_basename
return string

$translation_0 public property

Translation for a singular form.
public string $translation_0
return string

$translation_1 public property

Translation for a plural form.
public string $translation_1
return string

$translation_2 public property

Translation for a second plural form.
public string $translation_2
return string

$translation_3 public property

Translation for a third plural form.
public string $translation_3
return string

$translation_4 public property

Translation for a fourth plural form.
public string $translation_4
return string

$translation_5 public property

Translation for a fifth plural form.
public string $translation_5
return string

$translation_set_id public property

ID of the translation set.
public int $translation_set_id
return integer

$user_id public property

ID of a user who submitted the translation.
public int $user_id
return integer

$user_id_last_modified public property

ID of a user (validator) who last changed the status of the translation.
Since: 2.1.0
public int $user_id_last_modified
return integer

$warnings public property

List of warnings when translation isn't correct.
public array $warnings
return array