PluginProbe
Polylang / 1.7.3
Polylang v1.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
polylang / include / links-model.php

links-model.php in Polylang 1.7.3, at include/links-model.php

52 lines 965 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * links model abstract class
5 *
6 * @since 1.5
7 */
8 abstract class PLL_Links_Model {
9 public $model, $options;
10 public $home; // used to store the home url before it is filtered
11 public $using_permalinks;
12
13 /*
14 * constructor
15 *
16 * @since 1.5
17 *
18 * @param object $model PLL_Model instance
19 */
20 public function __construct(&$model) {
21 $this->model = &$model;
22 $this->options = &$model->options;
23
24 $this->home = home_url();
25 }
26
27 /*
28 * changes the language code in url
29 *
30 * @since 1.5
31 *
32 * @param string $url url to modify
33 * @param object $lang language
34 * @return string modified url
35 */
36 public function switch_language_in_link($url, $lang) {
37 $url = $this->remove_language_from_link($url);
38 return $this->add_language_to_link($url, $lang);
39 }
40
41 /*
42 * get hosts managed on the website
43 *
44 * @since 1.5
45 *
46 * @return array list of hosts
47 */
48 public function get_hosts() {
49 return array(parse_url($this->home, PHP_URL_HOST));
50 }
51 }
52