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 | include/api.php +8 -20 2.7.12.6.2 View file →
@@ -36,15 +36,12 @@
36 36 * Returns the language set in admin language filter on backend ( false if set to all languages )
37 37 *
38 38 * @since 0.8.1
39 39 *
40 - * @param string $field Optional, the language field to return ( see PLL_Language ), defaults to 'slug', pass OBJECT constant to get the language object.
41 - * @return string|PLL_Language|bool The requested field for the current language
40 + * @param string $field Optional, the language field to return ( see PLL_Language ), defaults to 'slug'
41 + * @return string|bool The requested field for the current language
42 42 */
43 43 function pll_current_language( $field = 'slug' ) {
44 - if ( OBJECT === $field ) {
45 - return PLL()->curlang;
46 - }
47 44 return isset( PLL()->curlang->$field ) ? PLL()->curlang->$field : false;
48 45 }
49 46
50 47 /**
@@ -51,22 +48,13 @@
51 48 * Returns the default language
52 49 *
53 50 * @since 1.0
54 51 *
55 - * @param string $field Optional, the language field to return ( see PLL_Language ), defaults to 'slug', pass OBJECT constant to get the language object.
56 - * @return string|PLL_Language|bool The requested field for the default language
52 + * @param string $field Optional, the language field to return ( see PLL_Language ), defaults to 'slug'
53 + * @return string The requested field for the default language
57 54 */
58 55 function pll_default_language( $field = 'slug' ) {
59 - if ( isset( PLL()->options['default_lang'] ) ) {
60 - $lang = PLL()->model->get_language( PLL()->options['default_lang'] );
61 - if ( $lang ) {
62 - if ( OBJECT === $field ) {
63 - return $lang;
64 - }
65 - return isset( $lang->$field ) ? $lang->$field : false;
66 - }
67 - }
68 - return false;
56 + return isset( PLL()->options['default_lang'] ) && ( $lang = PLL()->model->get_language( PLL()->options['default_lang'] ) ) && isset( $lang->$field ) ? $lang->$field : false;
69 57 }
70 58
71 59 /**
72 60 * Among the post and its translations, returns the id of the post which is in the language represented by $slug
@@ -371,11 +359,11 @@
371 359 * Count posts in a language
372 360 *
373 361 * @since 1.5
374 362 *
375 - * @param string $lang Language code.
376 - * @param array $args WP_Query arguments ( accepted keys: post_type, m, year, monthnum, day, author, author_name, post_format, post_status ).
377 - * @return int Posts count.
363 + * @param string $lang language code
364 + * @param array $args ( accepted keys: post_type, m, year, monthnum, day, author, author_name, post_format )
365 + * @return int posts count
378 366 */
379 367 function pll_count_posts( $lang, $args = array() ) {
380 368 return PLL()->model->count_posts( PLL()->model->get_language( $lang ), $args );
381 369 }