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-permalinks.php +46 -9 2.73.1.4 View file →
@@ -1,5 +1,8 @@
1 1 <?php
2 +/**
3 + * @package Polylang
4 + */
2 5
3 6 /**
4 7 * Links model base class when using pretty permalinks
5 8 *
@@ -5,19 +8,51 @@
5 8 *
6 9 * @since 1.6
7 10 */
8 11 abstract class PLL_Links_Permalinks extends PLL_Links_Model {
12 + /**
13 + * Tells this child class of PLL_Links_Model is for pretty permalinks.
14 + *
15 + * @var bool
16 + */
9 17 public $using_permalinks = true;
10 - protected $index = 'index.php'; // Need this before $wp_rewrite is created, also hardcoded in wp-includes/rewrite.php
11 - protected $root, $use_trailing_slashes;
18 +
19 + /**
20 + * The name of the index file which is the entry point to all requests.
21 + * We need this before the global $wp_rewrite is created.
22 + * Also hardcoded in WP_Rewrite.
23 + *
24 + * @var string
25 + */
26 + protected $index = 'index.php';
27 +
28 + /**
29 + * The prefix for all permalink structures.
30 + *
31 + * @var string
32 + */
33 + protected $root;
34 +
35 + /**
36 + * Whether to add trailing slashes.
37 + *
38 + * @var bool
39 + */
40 + protected $use_trailing_slashes;
41 +
42 + /**
43 + * The name of the rewrite rules to always modify.
44 + *
45 + * @var string[]
46 + */
12 47 protected $always_rewrite = array( 'date', 'root', 'comments', 'search', 'author' );
13 48
14 49 /**
15 - * Constructor
50 + * Constructor.
16 51 *
17 52 * @since 1.8
18 53 *
19 - * @param object $model PLL_Model instance
54 + * @param PLL_Model $model PLL_Model instance.
20 55 */
21 56 public function __construct( &$model ) {
22 57 parent::__construct( $model );
23 58
@@ -69,13 +104,13 @@
69 104 return apply_filters( 'pll_add_paged_to_link', user_trailingslashit( trailingslashit( $url ) . 'page/' . $page, 'paged' ), $url, $page );
70 105 }
71 106
72 107 /**
73 - * Returns the home url
108 + * Returns the home url.
74 109 *
75 110 * @since 1.3.1
76 111 *
77 - * @param object $lang PLL_Language object
112 + * @param PLL_Language $lang PLL_Language object.
78 113 * @return string
79 114 */
80 115 public function home_url( $lang ) {
81 116 return trailingslashit( parent::home_url( $lang ) );
@@ -81,14 +116,14 @@
81 116 return trailingslashit( parent::home_url( $lang ) );
82 117 }
83 118
84 119 /**
85 - * Returns the static front page url
120 + * Returns the static front page url.
86 121 *
87 122 * @since 1.8
88 123 *
89 - * @param object $lang
90 - * @return string
124 + * @param PLL_Language $lang The language object.
125 + * @return string The static front page url.
91 126 */
92 127 public function front_page_url( $lang ) {
93 128 if ( $this->options['hide_default'] && $lang->slug == $this->options['default_lang'] ) {
94 129 return trailingslashit( $this->home );
@@ -101,8 +136,10 @@
101 136 /**
102 137 * Prepares rewrite rules filters
103 138 *
104 139 * @since 1.6
140 + *
141 + * @return string[]
105 142 */
106 143 public function get_rewrite_rules_filters() {
107 144 // Make sure we have the right post types and taxonomies
108 145 $types = array_values( array_merge( $this->model->get_translated_post_types(), $this->model->get_translated_taxonomies(), $this->model->get_filtered_taxonomies() ) );