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