PluginProbe
Polylang / 3.2.2
Polylang v3.2.2
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.php

links.php in Polylang 3.2.2, at include/links.php

58 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package Polylang
4 */
5
6 /**
7 * Manages links related functions
8 *
9 * @since 1.2
10 */
11 class PLL_Links {
12 /**
13 * Stores the plugin options.
14 *
15 * @var array
16 */
17 public $options;
18
19 /**
20 * @var PLL_Model
21 */
22 public $model;
23
24 /**
25 * Instance of a child class of PLL_Links_Model.
26 *
27 * @var PLL_Links_Model
28 */
29 public $links_model;
30
31 /**
32 * Constructor
33 *
34 * @since 1.2
35 *
36 * @param object $polylang
37 */
38 public function __construct( &$polylang ) {
39 $this->links_model = &$polylang->links_model;
40 $this->model = &$polylang->model;
41 $this->options = &$polylang->options;
42 }
43
44 /**
45 * Returns the home url in the requested language.
46 *
47 * @since 1.3
48 *
49 * @param PLL_Language|string $language The language.
50 * @param bool $is_search Optional, whether we need the home url for a search form, defaults to false.
51 * @return string
52 */
53 public function get_home_url( $language, $is_search = false ) {
54 $language = is_object( $language ) ? $language : $this->model->get_language( $language );
55 return $is_search ? $language->search_url : $language->home_url;
56 }
57 }
58