PHP Class Inpsyde\MultilingualPress\API\WPDBSiteRelations

Since: 3.0.0
Inheritance: implements Inpsyde\MultilingualPress\API\SiteRelations
Show file Open project: inpsyde/multilingual-press

Public Methods

Method Description
__construct ( Inpsyde\MultilingualPress\Database\Table $table ) Constructor. Sets up the properties.
delete_relation ( integer $site_1, integer $site_2 ) : integer Deletes the relationship between the given sites. If only one site is given, all its relations will be deleted.
get_all_relations ( ) : int[] Returns an array with site IDs as keys and arrays with the IDs of all related sites as values.
get_related_site_ids ( integer $site_id, boolean $include_site = false ) : int[] Returns an array holding the IDs of all sites related to the site with the given (or current) ID.
insert_relations ( integer $base_site_id, array $site_ids ) : integer Creates relations between one site and one or more other sites.

Private Methods

Method Description
get_site_relations_from_query_results ( array $rows ) : int[] Returns a formatted array with site relations included in the given query results.
get_value_pair ( integer $site_1, integer $site_2 ) : string Returns a (value1, value2) syntax string according to the given site IDs.

Method Details

__construct() public method

Constructor. Sets up the properties.
Since: 3.0.0
public __construct ( Inpsyde\MultilingualPress\Database\Table $table )
$table Inpsyde\MultilingualPress\Database\Table Site relations table object.

delete_relation() public method

Deletes the relationship between the given sites. If only one site is given, all its relations will be deleted.
Since: 3.0.0
public delete_relation ( integer $site_1, integer $site_2 ) : integer
$site_1 integer Site ID.
$site_2 integer Optional. Another site ID. Defaults to 0.
return integer The number of rows affected.

get_all_relations() public method

Returns an array with site IDs as keys and arrays with the IDs of all related sites as values.
Since: 3.0.0
public get_all_relations ( ) : int[]
return int[] The array with site IDs as keys and arrays with the IDs of all related sites as values.

insert_relations() public method

Creates relations between one site and one or more other sites.
Since: 3.0.0
public insert_relations ( integer $base_site_id, array $site_ids ) : integer
$base_site_id integer Base site ID.
$site_ids array An array of site IDs.
return integer The number of rows affected.