PluginProbe
Polylang / 3.1.4
Polylang v3.1.4
3.8.10 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 All 234 releases
← All changes | frontend/frontend-links.php +25 -11 2.7.1 → 3.1.4 View file →
@@ -1,5 +1,8 @@
1 1 <?php
2 +/**
3 + * @package Polylang
4 + */
2 5
3 6 /**
4 7 * Manages links filters and url of translations on frontend
5 8 *
@@ -5,12 +8,23 @@
5 8 *
6 9 * @since 1.2
7 10 */
8 11 class PLL_Frontend_Links extends PLL_Links {
12 + /**
13 + * Current language.
14 + *
15 + * @var PLL_Language
16 + */
9 17 public $curlang;
10 - public $cache; // Our internal non persistent cache object
11 18
12 19 /**
20 + * Internal non persistent cache object.
21 + *
22 + * @var PLL_Cache
23 + */
24 + public $cache;
25 +
26 + /**
13 27 * Constructor
14 28 *
15 29 * @since 1.2
16 30 *
@@ -24,13 +38,13 @@
24 38
25 39 }
26 40
27 41 /**
28 - * Returns the url of the translation ( if exists ) of the current page
42 + * Returns the url of the translation (if it exists) of the current page.
29 43 *
30 44 * @since 0.1
31 45 *
32 - * @param object $language
46 + * @param PLL_Language $language Language object.
33 47 * @return string
34 48 */
35 49 public function get_translation_url( $language ) {
36 50 global $wp_query;
@@ -43,16 +57,16 @@
43 57 // See https://wordpress.org/support/topic/patch-for-fixing-a-notice
44 58 $queried_object_id = $wp_query->get_queried_object_id();
45 59
46 60 /**
47 - * Filter the translation url before Polylang attempts to find one
48 - * Internally used by Polylang for the static front page and posts page
61 + * Filters the translation url before Polylang attempts to find one.
62 + * Internally used by Polylang for the static front page and posts page.
49 63 *
50 64 * @since 1.8
51 65 *
52 - * @param string $url Empty or the url of the translation of teh current page
53 - * @param object $language Language of the translation
54 - * @param int $queried_object_id Queried object id
66 + * @param string $url Empty or the url of the translation of teh current page.
67 + * @param PLL_Language $language Language of the translation.
68 + * @param int $queried_object_id Queried object id.
55 69 */
56 70 if ( ! $url = apply_filters( 'pll_pre_translation_url', '', $language, $queried_object_id ) ) {
57 71 $qv = $wp_query->query_vars;
58 72
@@ -195,14 +209,14 @@
195 209 return apply_filters( 'pll_get_archive_url', $url, $language );
196 210 }
197 211
198 212 /**
199 - * Returns the home url in the right language
213 + * Returns the home url in the right language.
200 214 *
201 215 * @since 0.1
202 216 *
203 - * @param object $language Optional, defaults to current language
204 - * @param bool $is_search Optional, whether we need the home url for a search form, defaults to false
217 + * @param PLL_Language|string $language Optional, defaults to current language.
218 + * @param bool $is_search Optional, whether we need the home url for a search form, defaults to false.
205 219 */
206 220 public function get_home_url( $language = '', $is_search = false ) {
207 221 if ( empty( $language ) ) {
208 222 $language = $this->curlang;