PluginProbe
Polylang / 1.6.2
Polylang v1.6.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-permalinks.php

links-permalinks.php in Polylang 1.6.2, at include/links-permalinks.php

49 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * links model base class when using pretty permalinks
5 *
6 * @since 1.6
7 */
8 abstract class PLL_Links_Permalinks extends PLL_Links_Model {
9 public $using_permalinks = true;
10 protected $always_rewrite = array('date', 'root', 'comments', 'search', 'author', 'post_format');
11
12 /*
13 * returns the link to the first page when using pretty permalinks
14 *
15 * @since 1.2
16 *
17 * @param string $url url to modify
18 * @return string modified url
19 */
20 public function remove_paged_from_link($url) {
21 return preg_replace('#\/page\/[0-9]+\/#', '/', $url); // FIXME trailing slash ?
22 }
23
24 /*
25 * returns the link to the paged page when using pretty permalinks
26 *
27 * @since 1.5
28 *
29 * @param string $url url to modify
30 * @param int $page
31 * @return string modified url
32 */
33 public function add_paged_to_link($url, $page) {
34 return trailingslashit($url) . 'page/' . $page; // FIXME trailing slash ?
35 }
36
37 /*
38 * prepares rewrite rules filters
39 *
40 * @since 1.6
41 */
42 public function get_rewrite_rules_filters() {
43 // make sure we have the right post types and taxonomies
44 $types = array_values(array_merge($this->model->get_translated_post_types(), $this->model->get_translated_taxonomies()));
45 $types = array_merge($this->always_rewrite, $types);
46 return apply_filters('pll_rewrite_rules', $types); // allow plugins to add rewrite rules to the language filter
47 }
48 }
49