PluginProbe
Polylang / 2.8
Polylang v2.8
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-directory.php +17 -26 3.02.8 View file →
@@ -10,21 +10,16 @@
10 10 *
11 11 * @since 1.2
12 12 */
13 13 class PLL_Links_Directory extends PLL_Links_Permalinks {
14 - /**
15 - * Relative path to the home url.
16 - *
17 - * @var string
18 - */
19 14 protected $home_relative;
20 15
21 16 /**
22 - * Constructor.
17 + * Constructor
23 18 *
24 19 * @since 1.2
25 20 *
26 - * @param PLL_Model $model PLL_Model instance.
21 + * @param object $model PLL_Model instance
27 22 */
28 23 public function __construct( &$model ) {
29 24 parent::__construct( $model );
30 25
@@ -40,10 +35,8 @@
40 35 /**
41 36 * Called only at first object creation to avoid duplicating filters when switching blog
42 37 *
43 38 * @since 1.6
44 - *
45 - * @return void
46 39 */
47 40 public function init() {
48 41 if ( did_action( 'setup_theme' ) ) {
49 42 $this->add_permastruct();
@@ -55,16 +48,16 @@
55 48 add_action( 'pre_option_rewrite_rules', array( $this, 'prepare_rewrite_rules' ) );
56 49 }
57 50
58 51 /**
59 - * Adds the language code in a url.
60 - * links_model interface.
52 + * Adds the language code in url
53 + * links_model interface
61 54 *
62 55 * @since 1.2
63 56 *
64 - * @param string $url The url to modify.
65 - * @param PLL_Language $lang The language object.
66 - * @return string Modified url.
57 + * @param string $url url to modify
58 + * @param object $lang language
59 + * @return string modified url
67 60 */
68 61 public function add_language_to_link( $url, $lang ) {
69 62 if ( ! empty( $lang ) ) {
70 63 $base = $this->options['rewrite'] ? '' : 'language/';
@@ -132,14 +125,14 @@
132 125 return preg_match( $pattern, trailingslashit( $path ), $matches ) ? $matches[1] : ''; // $matches[1] is the slug of the requested language
133 126 }
134 127
135 128 /**
136 - * Returns the home url in a given language.
137 - * links_model interface.
129 + * Returns the home url
130 + * links_model interface
138 131 *
139 132 * @since 1.3.1
140 133 *
141 - * @param PLL_Language $lang PLL_Language object.
134 + * @param object $lang PLL_Language object
142 135 * @return string
143 136 */
144 137 public function home_url( $lang ) {
145 138 $base = $this->options['rewrite'] ? '' : 'language/';
@@ -150,10 +143,8 @@
150 143 /**
151 144 * Optionally removes 'language' in permalinks so that we get http://www.myblog/en/ instead of http://www.myblog/language/en/
152 145 *
153 146 * @since 1.2
154 - *
155 - * @return void
156 147 */
157 148 public function add_permastruct() {
158 149 // Language information always in front of the uri ( 'with_front' => false )
159 150 // The 3rd parameter structure has been modified in WP 3.4
@@ -163,14 +154,14 @@
163 154 }
164 155 }
165 156
166 157 /**
167 - * Prepares the rewrite rules filters.
158 + * Prepares rewrite rules filters
168 159 *
169 160 * @since 0.8.1
170 161 *
171 - * @param mixed $pre Not used as the filter is used as an action.
172 - * @return mixed
162 + * @param array $pre not used
163 + * @return unmodified $pre
173 164 */
174 165 public function prepare_rewrite_rules( $pre ) {
175 166 // Don't modify the rules if there is no languages created yet
176 167 // Make sure to add filter only once and if all custom post types and taxonomies have been registered
@@ -188,15 +179,15 @@
188 179 }
189 180
190 181 /**
191 182 * The rewrite rules !
192 - * Always make sure that the default language is at the end in case the language information is hidden for default language.
193 - * Thanks to brbrbr http://wordpress.org/support/topic/plugin-polylang-rewrite-rules-not-correct.
183 + * always make sure the default language is at the end in case the language information is hidden for default language
184 + * thanks to brbrbr http://wordpress.org/support/topic/plugin-polylang-rewrite-rules-not-correct
194 185 *
195 186 * @since 0.8.1
196 187 *
197 - * @param string[] $rules Rewrite rules.
198 - * @return string[] Modified rewrite rules.
188 + * @param array $rules rewrite rules
189 + * @return array modified rewrite rules
199 190 */
200 191 public function rewrite_rules( $rules ) {
201 192 $filter = str_replace( '_rewrite_rules', '', current_filter() );
202 193