PluginProbe
Polylang / 2.6.2
Polylang v2.6.2
3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 3.0.3 All 233 releases
← All changes | admin/admin-links.php +42 -45 3.02.6.2 View file →
@@ -1,11 +1,8 @@
1 1 <?php
2 -/**
3 - * @package Polylang
4 - */
5 2
6 3 /**
7 - * Manages links related functions.
4 + * Manages links related functions
8 5 *
9 6 * @since 1.8
10 7 */
11 8 class PLL_Admin_Links extends PLL_Links {
@@ -10,14 +7,14 @@
10 7 */
11 8 class PLL_Admin_Links extends PLL_Links {
12 9
13 10 /**
14 - * Returns the html markup for a new translation link.
11 + * Returns html markup for a new translation link
15 12 *
16 13 * @since 2.6
17 14 *
18 - * @param string $link The new translation link.
19 - * @param PLL_Language $language The language of the new translation.
15 + * @param string $link The new translation link.
16 + * @param object $language The language of the new translation.
20 17 * @return string
21 18 */
22 19 protected function new_translation_link( $link, $language ) {
23 20 $str = '';
@@ -37,14 +34,14 @@
37 34 return $str;
38 35 }
39 36
40 37 /**
41 - * Returns the html markup for a translation link.
38 + * Returns html markup for a translation link
42 39 *
43 40 * @since 2.6
44 41 *
45 - * @param string $link The translation link.
46 - * @param PLL_Language $language The language of the translation.
42 + * @param string $link The translation link.
43 + * @param object $language The language of the translation.
47 44 * @return string
48 45 */
49 46 public function edit_translation_link( $link, $language ) {
50 47 return $link ? sprintf(
@@ -55,22 +52,22 @@
55 52 ) : '';
56 53 }
57 54
58 55 /**
59 - * Get the link to create a new post translation.
56 + * Get the link to create a new post translation
60 57 *
61 58 * @since 1.5
62 59 *
63 - * @param int $post_id The source post id.
64 - * @param PLL_Language $language The language of the new translation.
65 - * @param string $context Optional. Defaults to 'display' which encodes '&' to '&amp;'.
66 - * Otherwise, preserves '&'.
60 + * @param int $post_id The source post id.
61 + * @param object $language The language of the new translation.
62 + * @param string $context Optional. Defaults to 'display' which encodes '&' to '&amp;'.
63 + * Otherwise, preserves '&'.
67 64 * @return string
68 65 */
69 66 public function get_new_post_translation_link( $post_id, $language, $context = 'display' ) {
70 67 $post_type = get_post_type( $post_id );
71 68 $post_type_object = get_post_type_object( get_post_type( $post_id ) );
72 - if ( empty( $post_type_object ) || ! current_user_can( $post_type_object->cap->create_posts ) ) {
69 + if ( ! current_user_can( $post_type_object->cap->create_posts ) ) {
73 70 return '';
74 71 }
75 72
76 73 // Special case for the privacy policy page which is associated to a specific capability
@@ -112,26 +109,26 @@
112 109 }
113 110 }
114 111
115 112 /**
116 - * Filters the new post translation link.
113 + * Filter the new post translation link
117 114 *
118 115 * @since 1.8
119 116 *
120 - * @param string $link The new post translation link.
121 - * @param PLL_Language $language The language of the new translation.
122 - * @param int $post_id The source post id.
117 + * @param string $link the new post translation link
118 + * @param object $language the language of the new translation
119 + * @param int $post_id the source post id
123 120 */
124 121 return apply_filters( 'pll_get_new_post_translation_link', $link, $language, $post_id );
125 122 }
126 123
127 124 /**
128 - * Returns the html markup for a new post translation link.
125 + * Returns html markup for a new post translation link
129 126 *
130 127 * @since 1.8
131 128 *
132 - * @param int $post_id The source post id.
133 - * @param PLL_Language $language The language of the new translation.
129 + * @param int $post_id
130 + * @param object $language
134 131 * @return string
135 132 */
136 133 public function new_post_translation_link( $post_id, $language ) {
137 134 $link = $this->get_new_post_translation_link( $post_id, $language );
@@ -138,13 +135,13 @@
138 135 return $this->new_translation_link( $link, $language );
139 136 }
140 137
141 138 /**
142 - * Returns the html markup for a post translation link.
139 + * Returns html markup for a translation link
143 140 *
144 141 * @since 1.4
145 142 *
146 - * @param int $post_id The translation post id.
143 + * @param int $post_id translation post id
147 144 * @return string
148 145 */
149 146 public function edit_post_translation_link( $post_id ) {
150 147 $link = get_edit_post_link( $post_id );
@@ -152,16 +149,16 @@
152 149 return $this->edit_translation_link( $link, $language );
153 150 }
154 151
155 152 /**
156 - * Get the link to create a new term translation.
153 + * Get the link to create a new term translation
157 154 *
158 155 * @since 1.5
159 156 *
160 - * @param int $term_id Source term id.
161 - * @param string $taxonomy Taxonomy name.
162 - * @param string $post_type Post type name.
163 - * @param PLL_Language $language The language of the new translation.
157 + * @param int $term_id
158 + * @param string $taxonomy
159 + * @param string $post_type
160 + * @param object $language
164 161 * @return string
165 162 */
166 163 public function get_new_term_translation_link( $term_id, $taxonomy, $post_type, $language ) {
167 164 $tax = get_taxonomy( $taxonomy );
@@ -178,30 +175,30 @@
178 175
179 176 $link = add_query_arg( $args, admin_url( 'edit-tags.php' ) );
180 177
181 178 /**
182 - * Filters the new term translation link.
179 + * Filter the new term translation link
183 180 *
184 181 * @since 1.8
185 182 *
186 - * @param string $link The new term translation link.
187 - * @param PLL_Language $language The language of the new translation.
188 - * @param int $term_id The source term id.
189 - * @param string $taxonomy Taxonomy name.
190 - * @param string $post_type Post type name.
183 + * @param string $link the new term translation link
184 + * @param object $language the language of the new translation
185 + * @param int $term_id the source term id
186 + * @param string $taxonomy
187 + * @param string $post_type
191 188 */
192 189 return apply_filters( 'pll_get_new_term_translation_link', $link, $language, $term_id, $taxonomy, $post_type );
193 190 }
194 191
195 192 /**
196 - * Returns the html markup for a new term translation.
193 + * Returns html markup for a new term translation
197 194 *
198 195 * @since 1.8
199 196 *
200 - * @param int $term_id Source term id.
201 - * @param string $taxonomy Taxonomy name.
202 - * @param string $post_type Post type name.
203 - * @param PLL_Language $language The language of the new translation.
197 + * @param int $term_id
198 + * @param string $taxonomy
199 + * @param string $post_type
200 + * @param object $language
204 201 * @return string
205 202 */
206 203 public function new_term_translation_link( $term_id, $taxonomy, $post_type, $language ) {
207 204 $link = $this->get_new_term_translation_link( $term_id, $taxonomy, $post_type, $language );
@@ -208,15 +205,15 @@
208 205 return $this->new_translation_link( $link, $language );
209 206 }
210 207
211 208 /**
212 - * Returns the html markup for a term translation link.
209 + * Returns html markup for a term translation link
213 210 *
214 211 * @since 1.4
215 212 *
216 - * @param int $term_id Translation term id.
217 - * @param string $taxonomy Taxonomy name.
218 - * @param string $post_type Post type name.
213 + * @param object $term_id translation term id
214 + * @param string $taxonomy
215 + * @param string $post_type
219 216 * @return string
220 217 */
221 218 public function edit_term_translation_link( $term_id, $taxonomy, $post_type ) {
222 219 $link = get_edit_term_link( $term_id, $taxonomy, $post_type );