PluginProbe
Polylang / 2.7.3
Polylang v2.7.3
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/language.php +17 -27 2.82.7.3 View file →
@@ -1,8 +1,5 @@
1 1 <?php
2 -/**
3 - * @package Polylang
4 - */
5 2
6 3 /**
7 4 * A language object is made of two terms in 'language' and 'term_language' taxonomies
8 5 * manipulating only one object per language instead of two terms should make things easier
@@ -83,9 +80,9 @@
83 80 $this->description = &$this->locale; // Backward compatibility with Polylang < 1.2
84 81
85 82 $this->mo_id = PLL_MO::get_id( $this );
86 83
87 - $languages = include POLYLANG_DIR . '/settings/languages.php';
84 + $languages = include PLL_SETTINGS_INC . '/languages.php';
88 85 $this->w3c = isset( $languages[ $this->locale ]['w3c'] ) ? $languages[ $this->locale ]['w3c'] : str_replace( '_', '-', $this->locale );
89 86 if ( isset( $languages[ $this->locale ]['facebook'] ) ) {
90 87 $this->facebook = $languages[ $this->locale ]['facebook'];
91 88 }
@@ -239,23 +236,23 @@
239 236 );
240 237 }
241 238
242 239 /**
243 - * Returns the html of the custom flag if any, or the default flag otherwise.
240 + * Replace flag by custom flag
241 + * Takes care of url scheme
244 242 *
245 - * @since 2.8
243 + * @since 1.7
246 244 */
247 - public function get_display_flag() {
248 - return empty( $this->custom_flag ) ? $this->flag : $this->custom_flag;
249 - }
245 + public function set_custom_flag() {
246 + // Overwrite with custom flags on frontend only
247 + if ( ! empty( $this->custom_flag ) ) {
248 + $this->flag = $this->custom_flag;
249 + $this->flag_url = $this->custom_flag_url;
250 + unset( $this->custom_flag, $this->custom_flag_url ); // hide this
251 + }
250 252
251 - /**
252 - * Returns the url of the custom flag if any, or the default flag otherwise.
253 - *
254 - * @since 2.8
255 - */
256 - public function get_display_flag_url() {
257 - return empty( $this->custom_flag_url ) ? $this->flag : $this->custom_flag_url;
253 + // Set url scheme, also for default flags
254 + $this->flag_url = set_url_scheme( $this->flag_url );
258 255 }
259 256
260 257 /**
261 258 * Updates post and term count
@@ -280,23 +277,16 @@
280 277 $this->home_url = $home_url;
281 278 }
282 279
283 280 /**
284 - * Sets the scheme of the home url and the flag urls
281 + * Set home_url scheme
282 + * this can't be cached across pages
285 283 *
286 - * This can't be cached across pages.
287 - *
288 - * @since 2.8
284 + * @since 1.6.4
289 285 */
290 - public function set_url_scheme() {
286 + public function set_home_url_scheme() {
291 287 $this->home_url = set_url_scheme( $this->home_url );
292 288 $this->search_url = set_url_scheme( $this->search_url );
293 -
294 - // Set url scheme, also for the flags.
295 - $this->flag_url = set_url_scheme( $this->flag_url );
296 - if ( ! empty( $this->custom_flag_url ) ) {
297 - $this->custom_flag_url = set_url_scheme( $this->custom_flag_url );
298 - }
299 289 }
300 290
301 291 /**
302 292 * Returns the language locale