PluginProbe
Polylang / 3.1.4
Polylang v3.1.4
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/links-subdomain.php +18 -9 2.7.13.1.4 View file →
@@ -1,5 +1,8 @@
1 1 <?php
2 +/**
3 + * @package Polylang
4 + */
2 5
3 6 /**
4 7 * Links model for use when the language code is added in url as a subdomain
5 8 * for example en.mysite.com/something
@@ -7,16 +10,22 @@
7 10 *
8 11 * @since 1.2
9 12 */
10 13 class PLL_Links_Subdomain extends PLL_Links_Abstract_Domain {
14 + /**
15 + * Stores whether the home url includes www. or not.
16 + * Either '://' or '://www.'.
17 + *
18 + * @var string
19 + */
11 20 protected $www;
12 21
13 22 /**
14 - * Constructor
23 + * Constructor.
15 24 *
16 25 * @since 1.7.4
17 26 *
18 - * @param object $model PLL_Model instance
27 + * @param PLL_Model $model Instance of PLL_Model.
19 28 */
20 29 public function __construct( &$model ) {
21 30 parent::__construct( $model );
22 31 $this->www = ( false === strpos( $this->home, '://www.' ) ) ? '://' : '://www.';
@@ -22,16 +31,16 @@
22 31 $this->www = ( false === strpos( $this->home, '://www.' ) ) ? '://' : '://www.';
23 32 }
24 33
25 34 /**
26 - * Adds the language code in url
27 - * links_model interface
35 + * Adds the language code in a url.
36 + * links_model interface.
28 37 *
29 38 * @since 1.2
30 39 *
31 - * @param string $url url to modify
32 - * @param object $lang language
33 - * @return string modified url
40 + * @param string $url The url to modify.
41 + * @param PLL_Language $lang The language object.
42 + * @return string Modified url.
34 43 */
35 44 public function add_language_to_link( $url, $lang ) {
36 45 if ( ! empty( $lang ) && false === strpos( $url, '://' . $lang->slug . '.' ) ) {
37 46 $url = $this->options['default_lang'] == $lang->slug && $this->options['hide_default'] ? $url : str_replace( $this->www, '://' . $lang->slug . '.', $url );
@@ -64,13 +73,13 @@
64 73 return $url;
65 74 }
66 75
67 76 /**
68 - * Get hosts managed on the website
77 + * Get hosts managed on the website.
69 78 *
70 79 * @since 1.5
71 80 *
72 - * @return array list of hosts
81 + * @return string[] The list of hosts.
73 82 */
74 83 public function get_hosts() {
75 84 $hosts = array();
76 85 foreach ( $this->model->get_languages_list() as $lang ) {