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