PluginProbe
Polylang / 3.7.7
Polylang v3.7.7
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 | include/filters-links.php +15 -14 3.0 → 3.7.7 View file →
@@ -28,9 +28,9 @@
28 28 */
29 29 public $links_model;
30 30
31 31 /**
32 - * @var PLL_Links
32 + * @var PLL_Links|null
33 33 */
34 34 public $links;
35 35
36 36 /**
@@ -35,18 +35,18 @@
35 35
36 36 /**
37 37 * Current language.
38 38 *
39 - * @var PLL_Language
39 + * @var PLL_Language|null
40 40 */
41 41 public $curlang;
42 42
43 43 /**
44 - * Constructor
44 + * Constructor.
45 45 *
46 46 * @since 1.8
47 47 *
48 - * @param object $polylang
48 + * @param object $polylang The Polylang object.
49 49 */
50 50 public function __construct( &$polylang ) {
51 51 $this->links = &$polylang->links;
52 52 $this->links_model = &$polylang->links_model;
@@ -162,9 +162,11 @@
162 162
163 163 // In case someone calls get_term_link for the 'language' taxonomy.
164 164 if ( 'language' === $tax ) {
165 165 $lang = $this->model->get_language( $term->term_id );
166 - return $this->links_model->home_url( $lang );
166 + if ( $lang ) {
167 + return $this->links_model->home_url( $lang );
168 + }
167 169 }
168 170
169 171 return $link;
170 172 }
@@ -169,14 +171,14 @@
169 171 return $link;
170 172 }
171 173
172 174 /**
173 - * Keeps the preview post link on default domain when using multiple domains
175 + * Keeps the preview post link on default domain when using multiple domains.
174 176 *
175 177 * @since 1.6.1
176 178 *
177 - * @param string $url
178 - * @return string modified url
179 + * @param string $url URL used for the post preview.
180 + * @return string The modified url.
179 181 */
180 182 public function preview_post_link( $url ) {
181 183 return $this->links_model->remove_language_from_link( $url );
182 184 }
@@ -182,20 +184,19 @@
182 184 }
183 185
184 186 /**
185 187 * Modifies the post type archive links to add the language parameter
186 - * only if the post type is translated
188 + * only if the post type is translated.
187 189 *
188 190 * The filter was originally only on frontend but is needed on admin too for
189 - * compatibility with the archive link of the ACF link field since ACF 5.4.0
191 + * compatibility with the archive link of the ACF link field since ACF 5.4.0.
190 192 *
191 193 * @since 1.7.6
192 194 *
193 - * @param string $link
194 - * @param string $post_type
195 - * @return string modified link
195 + * @param string $link The post type archive permalink.
196 + * @param string $post_type Post type name.
197 + * @return string
196 198 */
197 199 public function post_type_archive_link( $link, $post_type ) {
198 200 return $this->model->is_translated_post_type( $post_type ) && 'post' !== $post_type ? $this->links_model->switch_language_in_link( $link, $this->curlang ) : $link;
199 201 }
200 202 }
201 -