| @@ -29,13 +29,14 @@ | ||
| 29 | 29 | ); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | - * Generates content for a single row of the table | |
| 33 | + * Generates content for a single row of the table. | |
| 34 | 34 | * |
| 35 | 35 | * @since 1.8 |
| 36 | 36 | * |
| 37 | - * @param object $item The current item | |
| 37 | + * @param PLL_Language $item The language item. | |
| 38 | + * @return void | |
| 38 | 39 | */ |
| 39 | 40 | public function single_row( $item ) { |
| 40 | 41 | /** |
| 41 | 42 | * Filter the list of classes assigned a row in the languages list table |
| @@ -41,10 +42,10 @@ | ||
| 41 | 42 | * Filter the list of classes assigned a row in the languages list table |
| 42 | 43 | * |
| 43 | 44 | * @since 1.8 |
| 44 | 45 | * |
| 45 | - * @param array $classes list of class names | |
| 46 | - * @param object $item the current item | |
| 46 | + * @param array $classes The list of class names. | |
| 47 | + * @param PLL_Language $item The language item. | |
| 47 | 48 | */ |
| 48 | 49 | $classes = apply_filters( 'pll_languages_row_classes', array(), $item ); |
| 49 | 50 | echo '<tr' . ( empty( $classes ) ? '>' : ' class="' . esc_attr( implode( ' ', $classes ) ) . '">' ); |
| 50 | 51 | $this->single_row_columns( $item ); |
| @@ -51,15 +52,15 @@ | ||
| 51 | 52 | echo '</tr>'; |
| 52 | 53 | } |
| 53 | 54 | |
| 54 | 55 | /** |
| 55 | - * Displays the item information in a column ( default case ) | |
| 56 | + * Displays the item information in a column ( default case ). | |
| 56 | 57 | * |
| 57 | 58 | * @since 0.1 |
| 58 | 59 | * |
| 59 | - * @param object $item | |
| 60 | - * @param string $column_name | |
| 61 | - * @return string | |
| 60 | + * @param PLL_Language $item The language item. | |
| 61 | + * @param string $column_name The column name. | |
| 62 | + * @return string|int | |
| 62 | 63 | */ |
| 63 | 64 | public function column_default( $item, $column_name ) { |
| 64 | 65 | switch ( $column_name ) { |
| 65 | 66 | case 'locale': |
| @@ -70,9 +71,9 @@ | ||
| 70 | 71 | case 'count': |
| 71 | 72 | return (int) $item->$column_name; |
| 72 | 73 | |
| 73 | 74 | default: |
| 74 | - return $item->$column_name; // flag | |
| 75 | + return $item->$column_name; // Flag. | |
| 75 | 76 | } |
| 76 | 77 | } |
| 77 | 78 | |
| 78 | 79 | /** |
| @@ -80,9 +81,9 @@ | ||
| 80 | 81 | * Displays the edit and delete action links |
| 81 | 82 | * |
| 82 | 83 | * @since 0.1 |
| 83 | 84 | * |
| 84 | - * @param object $item | |
| 85 | + * @param PLL_Language $item The language item. | |
| 85 | 86 | * @return string |
| 86 | 87 | */ |
| 87 | 88 | public function column_name( $item ) { |
| 88 | 89 | return sprintf( |
| @@ -98,9 +99,9 @@ | ||
| 98 | 99 | * Displays the 'make default' action link |
| 99 | 100 | * |
| 100 | 101 | * @since 1.8 |
| 101 | 102 | * |
| 102 | - * @param object $item | |
| 103 | + * @param PLL_Language $item The language item. | |
| 103 | 104 | * @return string |
| 104 | 105 | */ |
| 105 | 106 | public function column_default_lang( $item ) { |
| 106 | 107 | $options = get_option( 'polylang' ); |
| @@ -116,14 +117,14 @@ | ||
| 116 | 117 | esc_html( sprintf( __( 'Choose %s as default language', 'polylang' ), $item->name ) ) |
| 117 | 118 | ); |
| 118 | 119 | |
| 119 | 120 | /** |
| 120 | - * Filter the default language row action in the languages list table | |
| 121 | + * Filters the default language row action in the languages list table. | |
| 121 | 122 | * |
| 122 | 123 | * @since 1.8 |
| 123 | 124 | * |
| 124 | - * @param string $s html markup of the action | |
| 125 | - * @param object $item | |
| 125 | + * @param string $s The html markup of the action. | |
| 126 | + * @param PLL_Language $item The language item. | |
| 126 | 127 | */ |
| 127 | 128 | $s = apply_filters( 'pll_default_lang_row_action', $s, $item ); |
| 128 | 129 | } else { |
| 129 | 130 | $s = sprintf( |
| @@ -140,9 +141,9 @@ | ||
| 140 | 141 | * Gets the list of columns |
| 141 | 142 | * |
| 142 | 143 | * @since 0.1 |
| 143 | 144 | * |
| 144 | - * @return array the list of column titles | |
| 145 | + * @return string[] The list of column titles. | |
| 145 | 146 | */ |
| 146 | 147 | public function get_columns() { |
| 147 | 148 | return array( |
| 148 | 149 | 'name' => esc_html__( 'Full name', 'polylang' ), |
| @@ -187,11 +188,11 @@ | ||
| 187 | 188 | * Generates and display row actions links for the list table. |
| 188 | 189 | * |
| 189 | 190 | * @since 1.8 |
| 190 | 191 | * |
| 191 | - * @param object $item The item being acted upon. | |
| 192 | - * @param string $column_name Current column name. | |
| 193 | - * @param string $primary Primary column name. | |
| 192 | + * @param PLL_Language $item The language item being acted upon. | |
| 193 | + * @param string $column_name Current column name. | |
| 194 | + * @param string $primary Primary column name. | |
| 194 | 195 | * @return string The row actions output. |
| 195 | 196 | */ |
| 196 | 197 | protected function handle_row_actions( $item, $column_name, $primary ) { |
| 197 | 198 | if ( $primary !== $column_name ) { |
| @@ -214,14 +215,14 @@ | ||
| 214 | 215 | ), |
| 215 | 216 | ); |
| 216 | 217 | |
| 217 | 218 | /** |
| 218 | - * Filter the list of row actions in the languages list table | |
| 219 | + * Filters the list of row actions in the languages list table. | |
| 219 | 220 | * |
| 220 | 221 | * @since 1.8 |
| 221 | 222 | * |
| 222 | - * @param array $actions list of html markup actions | |
| 223 | - * @param object $item | |
| 223 | + * @param array $actions A list of html markup actions. | |
| 224 | + * @param PLL_Language $item The language item. | |
| 224 | 225 | */ |
| 225 | 226 | $actions = apply_filters( 'pll_languages_row_actions', $actions, $item ); |
| 226 | 227 | |
| 227 | 228 | return $this->row_actions( $actions ); |
| @@ -227,14 +228,14 @@ | ||
| 227 | 228 | return $this->row_actions( $actions ); |
| 228 | 229 | } |
| 229 | 230 | |
| 230 | 231 | /** |
| 231 | - * Sort items | |
| 232 | + * Sorts language items. | |
| 232 | 233 | * |
| 233 | 234 | * @since 0.1 |
| 234 | 235 | * |
| 235 | - * @param object $a The first object to compare | |
| 236 | - * @param object $b The second object to compare | |
| 236 | + * @param PLL_Language $a The first language to compare. | |
| 237 | + * @param PLL_Language $b The second language to compare. | |
| 237 | 238 | * @return int -1 or 1 if $a is considered to be respectively less than or greater than $b. |
| 238 | 239 | */ |
| 239 | 240 | protected function usort_reorder( $a, $b ) { |
| 240 | 241 | $orderby = ! empty( $_GET['orderby'] ) ? sanitize_key( $_GET['orderby'] ) : 'name'; // phpcs:ignore WordPress.Security.NonceVerification |
| @@ -243,18 +244,19 @@ | ||
| 243 | 244 | $result = $a->$orderby > $b->$orderby ? 1 : -1; |
| 244 | 245 | } else { |
| 245 | 246 | $result = strcmp( $a->$orderby, $b->$orderby ); |
| 246 | 247 | } |
| 247 | - // Send final sort direction to usort | |
| 248 | + // Send final sort direction to usort. | |
| 248 | 249 | return ( empty( $_GET['order'] ) || 'asc' === $_GET['order'] ) ? $result : -$result; // phpcs:ignore WordPress.Security.NonceVerification |
| 249 | 250 | } |
| 250 | 251 | |
| 251 | 252 | /** |
| 252 | - * Prepares the list of items for displaying | |
| 253 | + * Prepares the list of languages for display. | |
| 253 | 254 | * |
| 254 | 255 | * @since 0.1 |
| 255 | 256 | * |
| 256 | - * @param array $data | |
| 257 | + * @param PLL_Language[] $data The list of languages. | |
| 258 | + * @return void | |
| 257 | 259 | */ |
| 258 | 260 | public function prepare_items( $data = array() ) { |
| 259 | 261 | $per_page = $this->get_items_per_page( 'pll_lang_per_page' ); |
| 260 | 262 | $this->_column_headers = array( $this->get_columns(), array(), $this->get_sortable_columns() ); |