Core class used to implement the translation sets.
since | 1.0.0 |
---|---|
package | GlotPress |
inherited_from | \GP_Thing |
__construct($fields = array()
)
after_create() : boolean
This is a placeholder function which should be implemented in the child classes.
since | 3.0.0 |
---|---|
inherited_from | \GP_Thing::after_create() |
boolean
after_create() : boolean
This is a placeholder function which should be implemented in the child classes.
boolean
after_delete() : boolean
This is a placeholder function which should be implemented in the child classes.
since | 3.0.0 |
---|---|
inherited_from | \GP_Thing::after_delete() |
boolean
after_delete() : boolean
This is a placeholder function which should be implemented in the child classes.
boolean
after_save(\GP_Translation_Set $translation_set_before) : boolean
This is a placeholder function which should be implemented in the child classes.
since | 3.0.0 |
---|---|
inherited_from | \GP_Thing::after_save() |
\GP_Translation_Set
Translation set before the update.
boolean
after_save(\GP_Thing $thing_before) : boolean
This is a placeholder function which should be implemented in the child classes.
\GP_Thing
Object before the update.
boolean
all($order = null
)
all_count() : integer
integer
Number of all originals.apply_default_conditions($conditions_str)
by_locale($locale_slug)
by_project_id($project_id)
by_project_id_slug_and_locale($project_id, $slug, $locale_slug)
changesrequested_count() : integer
integer
Number of "changes requested" translations.coerce(array|object $thing) : \GP_Thing | false
since | 1.0.0 |
---|
array
object
Data about the thing retrieved from the database.
\GP_Thing
false
Thing object on success, false on failure.copy_translations_from($source_translation_set_id)
This function doesn't merge then, just copies unconditionally. If a translation already exists, it will be duplicated. When copying translations from another project, it will search to find the original first.
create($args) : mixed
array associative array with fields as keys and values as values
mixed
the object corresponding to the inserted row or false on errorcreate_and_select($args) : mixed
array see create()
mixed
the selected object or false on errorcurrent_count() : integer
integer
Number of current translations.delete() : boolean
since | 2.0.0 |
---|---|
inherited_from | \GP_Thing::delete() |
boolean
delete()
since | 1.0.0 |
---|
delete_all(array $where = null
)
since | 1.0.0 |
---|
array
An array of conditions to use to for a SQL "where" clause, if null, not used and all matching rows will be deleted.
delete_many(array $where)
since | 2.0.0 |
---|
array
An array of conditions to use to for a SQL "where" clause, if not passed, no rows will be deleted.
existing_locales()
existing_slugs()
fields()
find(string|array $conditions, string|array $order = null
) : mixed
since | 1.0.0 |
---|
string
array
string
array
Optional.
mixed
find_many(string|array $conditions, string|array $order = null
) : mixed
since | 1.0.0 |
---|
string
array
string
array
Optional.
mixed
find_many_no_map(string|array $conditions, string|array $order = null
) : mixed
since | 1.0.0 |
---|
string
array
string
array
Optional.
mixed
find_no_map(string|array $conditions, string|array $order = null
) : mixed
since | 1.0.0 |
---|
string
array
string
array
Optional.
mixed
find_one(string|array $conditions, string|array $order = null
) : mixed
since | 1.0.0 |
---|
string
array
string
array
Optional.
mixed
force_false_to_null($value)
found_rows()
fuzzy_count() : integer
integer
Number of fuzzy translations.get(\GP_Thing|integer $thing_or_id) : \GP_Thing | false
since | 1.0.0 |
---|
\GP_Thing
integer
ID of a thing or GP_Thing object.
\GP_Thing
false
Thing object on success, false on failure.get_db_field_formats($args)
get_static($name, $default = null
)
has_static($name)
import(\Translations $translations, string $desired_status = 'current'
) : boolean
\Translations
the translations to be imported to this translation-set.
string
'current', 'waiting' or 'fuzzy'.
boolean
or voidlast_modified() : string | false
since | 1.0.0 |
---|
string
false
The last modified date on success, false on failure.like_escape_printf($s)
many(string $query, mixed $args) : array<mixed,\GP_Thing>
since | 1.0.0 |
---|---|
since | 3.0.0 Added spread operator and require `$query` argument to be set. |
see | |
see |
string
Query statement with optional sprintf()-like placeholders.
mixed
Optional arguments to pass to the GP_Thing::prepare() function.
array<mixed,\GP_Thing>
A list of GP_Thing objects.many_no_map(string $query, mixed $args) : array<mixed,object>
since | 1.0.0 |
---|---|
since | 3.0.0 Added spread operator and require `$query` argument to be set. |
see | |
see |
string
Query statement with optional sprintf()-like placeholders.
mixed
Optional arguments to pass to the GP_Thing::prepare() function.
array<mixed,object>
Database query results.map(mixed $results) : array<mixed,\GP_Thing> | array<mixed,object>
since | 1.0.0 |
---|
mixed
The results from the database.
array<mixed,\GP_Thing>
array<mixed,object>
If enabled, a list of objects mapped to GP_Thing.map_no_map(mixed $results) : mixed
since | 1.0.0 |
---|
mixed
The results, unmapped.
mixed
name_with_locale(string $separator = '→'
) : string
If the slug of the locale is not 'default' then the name of the current translation sets gets added as a suffix.
since | 1.0.0 |
---|
string
Separator, in case the slug is not 'default'. Default: '→'.
string
The English name of a locale.normalize_fields(array $args) : array
since | 1.0.0 |
---|---|
inherited_from | \GP_Thing::normalize_fields() |
array
Arguments for a GP_Translation_Set object.
array
Normalized arguments for a GP_Translation_Set object.normalize_fields(array $args) : array
todo | Include default type handling. For example dates 0000-00-00 should be set to null |
---|---|
since | 1.0.0 |
since | 3.0.0 Normalizes int fields to be integers. |
array
Arguments for a GP_Thing object.
array
Normalized arguments for a GP_Thing object.now_in_mysql_format()
one(string $query, mixed $args) : \GP_Thing | false
since | 1.0.0 |
---|---|
since | 3.0.0 Added spread operator and require `$query` argument to be set. |
see | |
see |
string
Query statement with optional sprintf()-like placeholders.
mixed
Optional arguments to pass to the GP_Thing::prepare() function.
\GP_Thing
false
Thing object on success, false on failure.percent_translated()
prepare(string $query, mixed $args) : string
since | 1.0.0 |
---|---|
since | 3.0.0 Added spread operator and require `$query` argument to be set. |
see |
string
Query statement with optional sprintf()-like placeholders.
mixed
Optional arguments to pass to the GP_Thing::prepare() function.
string
Sanitized query string, if there is a query to prepare.prepare_fields_for_create($args)
prepare_fields_for_save($args)
query(string $query, mixed $args) : integer | boolean
reload() : \GP_Thing
\GP_Thing
Thing object.restrict_fields(\GP_Validation_Rules $rules)
since | 1.0.0 |
---|---|
inherited_from | \GP_Thing::restrict_fields() |
\GP_Validation_Rules
The validation rules instance.
restrict_fields(\GP_Validation_Rules $rules)
since | 1.0.0 |
---|
\GP_Validation_Rules
The validation rules instance.
save(mixed $args = null
) : boolean | null
since | 1.0.0 |
---|
mixed
Values to update.
boolean
null
Null and false on failure, true on success.select_all_from_conditions_and_order($conditions, $order = null
)
set_fields(array $fields)
array
Fields for a GP_Thing object.
set_static($name, $value)
sql_condition_from_php_value(mixed $php_value) : string
Examples:
Input: null
Output: IS NULL
Input: 'foo'
Output: = 'foo'
Input: 1
or '1'
Output: = 1
since | 1.0.0 |
---|
mixed
The PHP value to convert to conditions.
string
SQL conditions.sql_from_conditions($conditions)
sql_from_order($order_by, $order_how = ''
)
sql_limit_for_paging($page, $per_page = null
)
untranslated_count() : integer
integer
Number of untranslated originals.update($data, $where = null
)
array associative array with fields as keys and updated values as values
update_status_breakdown()
validate()
value(string $query, mixed $args) : string | null
since | 1.0.0 |
---|---|
since | 3.0.0 Added spread operator and require `$query` argument to be set. |
see | |
see |
string
Query statement with optional sprintf()-like placeholders.
mixed
Optional arguments to pass to the GP_Thing::prepare() function.
string
null
Database query result (as string), or false on failure.waiting_count() : integer
integer
Number of waiting translations.warnings_count() : integer
integer
Number of translations with warnings._no_map(string $name, mixed $args) : mixed
since | 1.0.0 |
---|
string
Method name.
mixed
Method-dependent arguments.
mixed
$all_count : integer
$changesrequested_count : integer
$class
$current_count : integer
$default_conditions
$errors
array()
$field_names
array('id', 'name', 'slug', 'project_id', 'locale')
inherited_from | \GP_Thing::field_names |
---|
$field_names
array()
$fuzzy_count : integer
$id : integer
inherited_from | \GP_Thing::id |
---|
$id
$int_fields
array('id', 'project_id')
inherited_from | \GP_Thing::int_fields |
---|
$int_fields
array()
$locale : string
$map_results
true
$name : string
$name_with_locale : string
$non_db_field_names
array('current_count', 'untranslated_count', 'waiting_count', 'fuzzy_count', 'all_count', 'warnings_count', 'percent_translated', 'wp_locale', 'last_modified')
inherited_from | \GP_Thing::non_db_field_names |
---|
$non_db_field_names
array()
$non_updatable_attributes
array('id')
inherited_from | \GP_Thing::non_updatable_attributes |
---|
$non_updatable_attributes
$old_count : integer
$per_page
30
$percent_translated : integer
$project : \GP_Project
$project_id : integer
$rejected_count : integer
$slug : string
$static
array()
$static_by_class
array()
$table
null
$table_basename
'gp_translation_sets'
inherited_from | \GP_Thing::table_basename |
---|
$table_basename
$untranslated_count : integer
$validation_rules
null
$validation_rules_by_class
array()
$waiting_count : integer
$warnings_count : integer
$wp_locale : string