class-wpml-tm-post-link-factory.php
1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
/**
* Class WPML_TM_Post_Link_Factory
*
* Creates post links for the TM dashboard and the translation queue
*/
class WPML_TM_Post_Link_Factory {
/** @var SitePress $sitepress */
private $sitepress;
public function __construct( SitePress $sitepress ) {
$this->sitepress = $sitepress;
}
/**
* Link to the front end, link text is the post title
*
* @param int $post_id
*
* @return string
*/
public function view_link( $post_id ) {
return (string) ( new WPML_TM_Post_View_Link_Title( $this->sitepress,
(int) $post_id ) );
}
/**
* Link to the front end, link text is given by the anchor
*
* @param int $post_id
* @param string $anchor
*
* @return string
*/
public function view_link_anchor( $post_id, $anchor, $target = '' ) {
return (string) ( new WPML_TM_Post_View_Link_Anchor( $this->sitepress,
(int) $post_id, $anchor, $target ) );
}
/**
* Link to the backend, link text is given by the anchor
*
* @param int $post_id
* @param string $anchor
*
* @return string
*/
public function edit_link_anchor( $post_id, $anchor ) {
return (string) ( new WPML_TM_Post_Edit_Link_Anchor( $this->sitepress,
(int) $post_id, $anchor ) );
}
}