| @@ -8,19 +8,51 @@ | ||
| 8 | 8 | * |
| 9 | 9 | * @since 1.6 |
| 10 | 10 | */ |
| 11 | 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 | + */ | |
| 12 | 17 | public $using_permalinks = true; |
| 13 | - protected $index = 'index.php'; // Need this before $wp_rewrite is created, also hardcoded in wp-includes/rewrite.php | |
| 14 | - 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 | + */ | |
| 15 | 47 | protected $always_rewrite = array( 'date', 'root', 'comments', 'search', 'author' ); |
| 16 | 48 | |
| 17 | 49 | /** |
| 18 | - * Constructor | |
| 50 | + * Constructor. | |
| 19 | 51 | * |
| 20 | 52 | * @since 1.8 |
| 21 | 53 | * |
| 22 | - * @param object $model PLL_Model instance | |
| 54 | + * @param PLL_Model $model PLL_Model instance. | |
| 23 | 55 | */ |
| 24 | 56 | public function __construct( &$model ) { |
| 25 | 57 | parent::__construct( $model ); |
| 26 | 58 | |
| @@ -72,13 +104,13 @@ | ||
| 72 | 104 | return apply_filters( 'pll_add_paged_to_link', user_trailingslashit( trailingslashit( $url ) . 'page/' . $page, 'paged' ), $url, $page ); |
| 73 | 105 | } |
| 74 | 106 | |
| 75 | 107 | /** |
| 76 | - * Returns the home url | |
| 108 | + * Returns the home url. | |
| 77 | 109 | * |
| 78 | 110 | * @since 1.3.1 |
| 79 | 111 | * |
| 80 | - * @param object $lang PLL_Language object | |
| 112 | + * @param PLL_Language $lang PLL_Language object. | |
| 81 | 113 | * @return string |
| 82 | 114 | */ |
| 83 | 115 | public function home_url( $lang ) { |
| 84 | 116 | return trailingslashit( parent::home_url( $lang ) ); |
| @@ -84,14 +116,14 @@ | ||
| 84 | 116 | return trailingslashit( parent::home_url( $lang ) ); |
| 85 | 117 | } |
| 86 | 118 | |
| 87 | 119 | /** |
| 88 | - * Returns the static front page url | |
| 120 | + * Returns the static front page url. | |
| 89 | 121 | * |
| 90 | 122 | * @since 1.8 |
| 91 | 123 | * |
| 92 | - * @param object $lang | |
| 93 | - * @return string | |
| 124 | + * @param PLL_Language $lang The language object. | |
| 125 | + * @return string The static front page url. | |
| 94 | 126 | */ |
| 95 | 127 | public function front_page_url( $lang ) { |
| 96 | 128 | if ( $this->options['hide_default'] && $lang->slug == $this->options['default_lang'] ) { |
| 97 | 129 | return trailingslashit( $this->home ); |
| @@ -104,8 +136,10 @@ | ||
| 104 | 136 | /** |
| 105 | 137 | * Prepares rewrite rules filters |
| 106 | 138 | * |
| 107 | 139 | * @since 1.6 |
| 140 | + * | |
| 141 | + * @return string[] | |
| 108 | 142 | */ |
| 109 | 143 | public function get_rewrite_rules_filters() { |
| 110 | 144 | // Make sure we have the right post types and taxonomies |
| 111 | 145 | $types = array_values( array_merge( $this->model->get_translated_post_types(), $this->model->get_translated_taxonomies(), $this->model->get_filtered_taxonomies() ) ); |