PHP Класс Inpsyde\MultilingualPress\API\WPDBContentRelations

С версии: 3.0.0
Наследование: implements Inpsyde\MultilingualPress\API\ContentRelations
Показать файл Открыть проект

Открытые методы

Метод Описание
__construct ( Inpsyde\MultilingualPress\Database\Table $table, Inpsyde\MultilingualPress\API\SiteRelations $site_relations ) Constructor. Sets up the properties.
delete_relation ( integer $source_site_id, integer $target_site_id, integer $source_content_id, integer $target_content_id, string $type = 'post' ) : integer Delete a relation according to the given parameters.
duplicate_relations ( integer $source_site_id, integer $destination_site_id, string $type = '' ) : integer Copies all relations of the given (or any) content type from the given source site to the given destination site.
get_element_for_site ( integer $source_site_id, integer $target_site_id, integer $source_content_id, string $type ) : integer Return the term taxonomy ID of the given target site for the given source term.
get_existing_translation_ids ( integer $source_site_id, integer $target_site_id, integer $source_content_id, integer $target_content_id, string $type ) : array Return the existing translation IDs according to the given parameters.
get_relations ( integer $source_site_id, integer $source_content_id, string $type = 'post' ) : array Return an array with site IDs as keys and content IDs as values.
get_translation_ids ( integer $source_site_id, integer $target_site_id, integer $source_content_id, integer $target_content_id, string $type ) : array Return the existing (or new) translation IDs according to the given parameters.
has_site_relations ( integer $site_id, string $type = '' ) : boolean Checks if the site with the given ID has any relations of the given (or any) content type.
relate_all_posts ( integer $source_site_id, integer $destination_site_id ) : integer Relates all posts between the given source site and the given destination site.
relate_all_terms ( integer $source_site_id, integer $destination_site_id ) : integer Relates all terms between the given source site and the given destination site.
set_relation ( integer $source_site_id, integer $target_site_id, integer $source_content_id, integer $target_content_id, string $type = 'post' ) : boolean Set a relation according to the given parameters.

Приватные методы

Метод Описание
clean_up_duplicated_translation_ids ( array $relations, string $type ) : integer Delete duplicate database entries.
get_cache_key ( integer $source_site_id, integer $source_content_id, string $type ) : string Return the cache key for the given arguments.
get_new_translation_ids ( integer $source_site_id, integer $source_content_id, string $type ) : array Return new translation IDs for the given parameters.
insert_row ( integer $source_site_id, integer $target_site_id, integer $source_content_id, integer $target_content_id, string $type ) : integer Insert a row into the link table.

Описание методов

__construct() публичный метод

Constructor. Sets up the properties.
С версии: 3.0.0
public __construct ( Inpsyde\MultilingualPress\Database\Table $table, Inpsyde\MultilingualPress\API\SiteRelations $site_relations )
$table Inpsyde\MultilingualPress\Database\Table Content relations table object.
$site_relations Inpsyde\MultilingualPress\API\SiteRelations Site relations API object.

delete_relation() публичный метод

Delete a relation according to the given parameters.
public delete_relation ( integer $source_site_id, integer $target_site_id, integer $source_content_id, integer $target_content_id, string $type = 'post' ) : integer
$source_site_id integer Source blog ID.
$target_site_id integer Target blog ID.
$source_content_id integer Source post ID or term taxonomy ID.
$target_content_id integer Target post ID or term taxonomy ID.
$type string Content type.
Результат integer Number of deleted rows

duplicate_relations() публичный метод

This method is suited to be used after site duplication, because both sites are assumed to have the exact same content IDs.
С версии: 3.0.0
public duplicate_relations ( integer $source_site_id, integer $destination_site_id, string $type = '' ) : integer
$source_site_id integer Source site ID.
$destination_site_id integer Destination site ID.
$type string Optional. Content type. Defaults to empty string.
Результат integer The number of relations duplicated.

get_element_for_site() публичный метод

Return the term taxonomy ID of the given target site for the given source term.
public get_element_for_site ( integer $source_site_id, integer $target_site_id, integer $source_content_id, string $type ) : integer
$source_site_id integer Source blog ID.
$target_site_id integer Target blog ID.
$source_content_id integer Source post ID or term taxonomy ID.
$type string Content type.
Результат integer

get_existing_translation_ids() публичный метод

Return the existing translation IDs according to the given parameters.
public get_existing_translation_ids ( integer $source_site_id, integer $target_site_id, integer $source_content_id, integer $target_content_id, string $type ) : array
$source_site_id integer Source blog ID.
$target_site_id integer Target blog ID.
$source_content_id integer Source post ID or term taxonomy ID.
$target_content_id integer Target post ID or term taxonomy ID.
$type string Content type.
Результат array

get_relations() публичный метод

Return an array with site IDs as keys and content IDs as values.
public get_relations ( integer $source_site_id, integer $source_content_id, string $type = 'post' ) : array
$source_site_id integer Source blog ID.
$source_content_id integer Source post ID or term taxonomy ID.
$type string Content type.
Результат array

get_translation_ids() публичный метод

Return the existing (or new) translation IDs according to the given parameters.
public get_translation_ids ( integer $source_site_id, integer $target_site_id, integer $source_content_id, integer $target_content_id, string $type ) : array
$source_site_id integer Source blog ID.
$target_site_id integer Target blog ID.
$source_content_id integer Source post ID or term taxonomy ID.
$target_content_id integer Target post ID or term taxonomy ID.
$type string Content type.
Результат array

has_site_relations() публичный метод

Checks if the site with the given ID has any relations of the given (or any) content type.
С версии: 3.0.0
public has_site_relations ( integer $site_id, string $type = '' ) : boolean
$site_id integer Site ID.
$type string Optional. Content type. Defaults to empty string.
Результат boolean Whether or not the site with the given ID has any relations of the given (or any) content type.

relate_all_posts() публичный метод

This method is suited to be used after site duplication, because both sites are assumed to have the exact same post IDs. Furthermore, the current site is assumed to be either the source site or the destination site.
С версии: 3.0.0
public relate_all_posts ( integer $source_site_id, integer $destination_site_id ) : integer
$source_site_id integer Source site ID.
$destination_site_id integer Destination site ID.
Результат integer The number of relations inserted.

relate_all_terms() публичный метод

This method is suited to be used after site duplication, because both sites are assumed to have the exact same term taxonomy IDs. Furthermore, the current site is assumed to be either the source site or the destination site.
С версии: 3.0.0
public relate_all_terms ( integer $source_site_id, integer $destination_site_id ) : integer
$source_site_id integer Source site ID.
$destination_site_id integer Destination site ID.
Результат integer The number of relations inserted.

set_relation() публичный метод

Set a relation according to the given parameters.
public set_relation ( integer $source_site_id, integer $target_site_id, integer $source_content_id, integer $target_content_id, string $type = 'post' ) : boolean
$source_site_id integer Source blog ID.
$target_site_id integer Target blog ID.
$source_content_id integer Source post ID or term taxonomy ID.
$target_content_id integer Target post ID or term taxonomy ID.
$type string Content type.
Результат boolean