PluginProbe
Polylang / 2.9
Polylang v2.9
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 | include/api.php +30 -1 2.72.9 View file →
@@ -1,5 +1,8 @@
1 1 <?php
2 +/**
3 + * @package Polylang
4 + */
2 5
3 6 /**
4 7 * Template tag: displays the language switcher
5 8 *
@@ -17,8 +20,9 @@
17 20 * post_id => if not null, link to translations of post defined by post_id, defaults to null
18 21 * raw => set this to true to build your own custom language switcher, defaults to 0
19 22 * item_spacing => whether to preserve or discard whitespace between list items, valid options are 'preserve' and 'discard', defaults to preserve
20 23 *
24 + * @api
21 25 * @since 0.5
22 26 *
23 27 * @param array $args optional
24 28 * @return null|string|array null if displaying, array if raw is requested, string otherwise
@@ -34,8 +38,9 @@
34 38 /**
35 39 * Returns the current language on frontend
36 40 * Returns the language set in admin language filter on backend ( false if set to all languages )
37 41 *
42 + * @api
38 43 * @since 0.8.1
39 44 *
40 45 * @param string $field Optional, the language field to return ( see PLL_Language ), defaults to 'slug', pass OBJECT constant to get the language object.
41 46 * @return string|PLL_Language|bool The requested field for the current language
@@ -49,8 +54,9 @@
49 54
50 55 /**
51 56 * Returns the default language
52 57 *
58 + * @api
53 59 * @since 1.0
54 60 *
55 61 * @param string $field Optional, the language field to return ( see PLL_Language ), defaults to 'slug', pass OBJECT constant to get the language object.
56 62 * @return string|PLL_Language|bool The requested field for the default language
@@ -70,8 +76,9 @@
70 76
71 77 /**
72 78 * Among the post and its translations, returns the id of the post which is in the language represented by $slug
73 79 *
80 + * @api
74 81 * @since 0.5
75 82 *
76 83 * @param int $post_id post id
77 84 * @param string $slug optional language code, defaults to current language
@@ -83,8 +90,9 @@
83 90
84 91 /**
85 92 * Among the term and its translations, returns the id of the term which is in the language represented by $slug
86 93 *
94 + * @api
87 95 * @since 0.5
88 96 *
89 97 * @param int $term_id term id
90 98 * @param string $slug optional language code, defaults to current language
@@ -96,8 +104,9 @@
96 104
97 105 /**
98 106 * Returns the home url in the current language
99 107 *
108 + * @api
100 109 * @since 0.8
101 110 *
102 111 * @param string $lang language code ( optional on frontend )
103 112 * @return string
@@ -112,8 +121,9 @@
112 121
113 122 /**
114 123 * Registers a string for translation in the "strings translation" panel
115 124 *
125 + * @api
116 126 * @since 0.6
117 127 *
118 128 * @param string $name a unique name for the string
119 129 * @param string $string the string to register
@@ -119,9 +129,9 @@
119 129 * @param string $string the string to register
120 130 * @param string $context optional the group in which the string is registered, defaults to 'polylang'
121 131 * @param bool $multiline optional whether the string table should display a multiline textarea or a single line input, defaults to single line
122 132 */
123 -function pll_register_string( $name, $string, $context = 'polylang', $multiline = false ) {
133 +function pll_register_string( $name, $string, $context = 'Polylang', $multiline = false ) {
124 134 if ( PLL() instanceof PLL_Admin_Base ) {
125 135 PLL_Admin_Strings::register_string( $name, $string, $context, $multiline );
126 136 }
127 137 }
@@ -128,8 +138,9 @@
128 138
129 139 /**
130 140 * Translates a string ( previously registered with pll_register_string )
131 141 *
142 + * @api
132 143 * @since 0.6
133 144 *
134 145 * @param string $string the string to translate
135 146 * @return string the string translation in the current language
@@ -140,8 +151,9 @@
140 151
141 152 /**
142 153 * Translates a string ( previously registered with pll_register_string ) and escapes it for safe use in HTML output.
143 154 *
155 + * @api
144 156 * @since 2.1
145 157 *
146 158 * @param string $string the string to translate
147 159 * @return string translation in the current language
@@ -152,8 +164,9 @@
152 164
153 165 /**
154 166 * Translates a string ( previously registered with pll_register_string ) and escapes it for safe use in HTML attributes.
155 167 *
168 + * @api
156 169 * @since 2.1
157 170 *
158 171 * @param string $string The string to translate
159 172 * @return string
@@ -165,8 +178,9 @@
165 178 /**
166 179 * Echoes a translated string ( previously registered with pll_register_string )
167 180 * It is an equivalent of _e() and is not escaped.
168 181 *
182 + * @api
169 183 * @since 0.6
170 184 *
171 185 * @param string $string The string to translate
172 186 */
@@ -176,8 +190,9 @@
176 190
177 191 /**
178 192 * Echoes a translated string ( previously registered with pll_register_string ) and escapes it for safe use in HTML output.
179 193 *
194 + * @api
180 195 * @since 2.1
181 196 *
182 197 * @param string $string The string to translate
183 198 */
@@ -187,8 +202,9 @@
187 202
188 203 /**
189 204 * Echoes a translated a string ( previously registered with pll_register_string ) and escapes it for safe use in HTML attributes.
190 205 *
206 + * @api
191 207 * @since 2.1
192 208 *
193 209 * @param string $string The string to translate
194 210 */
@@ -198,8 +214,9 @@
198 214
199 215 /**
200 216 * Translates a string ( previously registered with pll_register_string )
201 217 *
218 + * @api
202 219 * @since 1.5.4
203 220 *
204 221 * @param string $string the string to translate
205 222 * @param string $lang language code
@@ -231,8 +248,9 @@
231 248
232 249 /**
233 250 * Returns true if Polylang manages languages and translations for this post type
234 251 *
252 + * @api
235 253 * @since 1.0.1
236 254 *
237 255 * @param string $post_type Post type name
238 256 * @return bool
@@ -243,8 +261,9 @@
243 261
244 262 /**
245 263 * Returns true if Polylang manages languages and translations for this taxonomy
246 264 *
265 + * @api
247 266 * @since 1.0.1
248 267 *
249 268 * @param string $tax Taxonomy name
250 269 * @return bool
@@ -260,8 +279,9 @@
260 279 *
261 280 * hide_empty => hides languages with no posts if set to true ( defaults to false )
262 281 * fields => return only that field if set ( see PLL_Language for a list of fields )
263 282 *
283 + * @api
264 284 * @since 1.5
265 285 *
266 286 * @param array $args list of parameters
267 287 * @return array
@@ -273,8 +293,9 @@
273 293
274 294 /**
275 295 * Set the post language
276 296 *
297 + * @api
277 298 * @since 1.5
278 299 *
279 300 * @param int $id post id
280 301 * @param string $lang language code
@@ -285,8 +306,9 @@
285 306
286 307 /**
287 308 * Set the term language
288 309 *
310 + * @api
289 311 * @since 1.5
290 312 *
291 313 * @param int $id term id
292 314 * @param string $lang language code
@@ -297,8 +319,9 @@
297 319
298 320 /**
299 321 * Save posts translations
300 322 *
323 + * @api
301 324 * @since 1.5
302 325 *
303 326 * @param array $arr an associative array of translations with language code as key and post id as value
304 327 */
@@ -308,8 +331,9 @@
308 331
309 332 /**
310 333 * Save terms translations
311 334 *
335 + * @api
312 336 * @since 1.5
313 337 *
314 338 * @param array $arr an associative array of translations with language code as key and term id as value
315 339 */
@@ -319,8 +343,9 @@
319 343
320 344 /**
321 345 * Returns the post language
322 346 *
347 + * @api
323 348 * @since 1.5.4
324 349 *
325 350 * @param int $post_id
326 351 * @param string $field Optional, the language field to return ( see PLL_Language ), defaults to 'slug'
@@ -332,8 +357,9 @@
332 357
333 358 /**
334 359 * Returns the term language
335 360 *
361 + * @api
336 362 * @since 1.5.4
337 363 *
338 364 * @param int $term_id
339 365 * @param string $field Optional, the language field to return ( see PLL_Language ), defaults to 'slug'
@@ -345,8 +371,9 @@
345 371
346 372 /**
347 373 * Returns an array of translations of a post
348 374 *
375 + * @api
349 376 * @since 1.8
350 377 *
351 378 * @param int $post_id
352 379 * @return array an associative array of translations with language code as key and translation post_id as value
@@ -357,8 +384,9 @@
357 384
358 385 /**
359 386 * Returns an array of translations of a term
360 387 *
388 + * @api
361 389 * @since 1.8
362 390 *
363 391 * @param int $term_id
364 392 * @return array an associative array of translations with language code as key and translation term_id as value
@@ -369,8 +397,9 @@
369 397
370 398 /**
371 399 * Count posts in a language
372 400 *
401 + * @api
373 402 * @since 1.5
374 403 *
375 404 * @param string $lang Language code.
376 405 * @param array $args WP_Query arguments ( accepted keys: post_type, m, year, monthnum, day, author, author_name, post_format, post_status ).