| @@ -1,5 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | +/** | |
| 3 | + * @package Polylang | |
| 4 | + */ | |
| 2 | 5 | |
| 3 | 6 | if ( ! class_exists( 'WP_List_Table' ) ) { |
| 4 | 7 | require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; // since WP 3.1 |
| 5 | 8 | } |
| @@ -26,13 +29,14 @@ | ||
| 26 | 29 | ); |
| 27 | 30 | } |
| 28 | 31 | |
| 29 | 32 | /** |
| 30 | - * Generates content for a single row of the table | |
| 33 | + * Generates content for a single row of the table. | |
| 31 | 34 | * |
| 32 | 35 | * @since 1.8 |
| 33 | 36 | * |
| 34 | - * @param object $item The current item | |
| 37 | + * @param PLL_Language $item The language item. | |
| 38 | + * @return void | |
| 35 | 39 | */ |
| 36 | 40 | public function single_row( $item ) { |
| 37 | 41 | /** |
| 38 | 42 | * Filter the list of classes assigned a row in the languages list table |
| @@ -38,10 +42,10 @@ | ||
| 38 | 42 | * Filter the list of classes assigned a row in the languages list table |
| 39 | 43 | * |
| 40 | 44 | * @since 1.8 |
| 41 | 45 | * |
| 42 | - * @param array $classes list of class names | |
| 43 | - * @param object $item the current item | |
| 46 | + * @param array $classes The list of class names. | |
| 47 | + * @param PLL_Language $item The language item. | |
| 44 | 48 | */ |
| 45 | 49 | $classes = apply_filters( 'pll_languages_row_classes', array(), $item ); |
| 46 | 50 | echo '<tr' . ( empty( $classes ) ? '>' : ' class="' . esc_attr( implode( ' ', $classes ) ) . '">' ); |
| 47 | 51 | $this->single_row_columns( $item ); |
| @@ -48,15 +52,15 @@ | ||
| 48 | 52 | echo '</tr>'; |
| 49 | 53 | } |
| 50 | 54 | |
| 51 | 55 | /** |
| 52 | - * Displays the item information in a column ( default case ) | |
| 56 | + * Displays the item information in a column ( default case ). | |
| 53 | 57 | * |
| 54 | 58 | * @since 0.1 |
| 55 | 59 | * |
| 56 | - * @param object $item | |
| 57 | - * @param string $column_name | |
| 58 | - * @return string | |
| 60 | + * @param PLL_Language $item The language item. | |
| 61 | + * @param string $column_name The column name. | |
| 62 | + * @return string|int | |
| 59 | 63 | */ |
| 60 | 64 | public function column_default( $item, $column_name ) { |
| 61 | 65 | switch ( $column_name ) { |
| 62 | 66 | case 'locale': |
| @@ -67,9 +71,9 @@ | ||
| 67 | 71 | case 'count': |
| 68 | 72 | return (int) $item->$column_name; |
| 69 | 73 | |
| 70 | 74 | default: |
| 71 | - return $item->$column_name; // flag | |
| 75 | + return $item->$column_name; // Flag. | |
| 72 | 76 | } |
| 73 | 77 | } |
| 74 | 78 | |
| 75 | 79 | /** |
| @@ -77,9 +81,9 @@ | ||
| 77 | 81 | * Displays the edit and delete action links |
| 78 | 82 | * |
| 79 | 83 | * @since 0.1 |
| 80 | 84 | * |
| 81 | - * @param object $item | |
| 85 | + * @param PLL_Language $item The language item. | |
| 82 | 86 | * @return string |
| 83 | 87 | */ |
| 84 | 88 | public function column_name( $item ) { |
| 85 | 89 | return sprintf( |
| @@ -95,9 +99,9 @@ | ||
| 95 | 99 | * Displays the 'make default' action link |
| 96 | 100 | * |
| 97 | 101 | * @since 1.8 |
| 98 | 102 | * |
| 99 | - * @param object $item | |
| 103 | + * @param PLL_Language $item The language item. | |
| 100 | 104 | * @return string |
| 101 | 105 | */ |
| 102 | 106 | public function column_default_lang( $item ) { |
| 103 | 107 | $options = get_option( 'polylang' ); |
| @@ -113,14 +117,14 @@ | ||
| 113 | 117 | esc_html( sprintf( __( 'Choose %s as default language', 'polylang' ), $item->name ) ) |
| 114 | 118 | ); |
| 115 | 119 | |
| 116 | 120 | /** |
| 117 | - * Filter the default language row action in the languages list table | |
| 121 | + * Filters the default language row action in the languages list table. | |
| 118 | 122 | * |
| 119 | 123 | * @since 1.8 |
| 120 | 124 | * |
| 121 | - * @param string $s html markup of the action | |
| 122 | - * @param object $item | |
| 125 | + * @param string $s The html markup of the action. | |
| 126 | + * @param PLL_Language $item The language item. | |
| 123 | 127 | */ |
| 124 | 128 | $s = apply_filters( 'pll_default_lang_row_action', $s, $item ); |
| 125 | 129 | } else { |
| 126 | 130 | $s = sprintf( |
| @@ -137,9 +141,9 @@ | ||
| 137 | 141 | * Gets the list of columns |
| 138 | 142 | * |
| 139 | 143 | * @since 0.1 |
| 140 | 144 | * |
| 141 | - * @return array the list of column titles | |
| 145 | + * @return string[] The list of column titles. | |
| 142 | 146 | */ |
| 143 | 147 | public function get_columns() { |
| 144 | 148 | return array( |
| 145 | 149 | 'name' => esc_html__( 'Full name', 'polylang' ), |
| @@ -184,11 +188,11 @@ | ||
| 184 | 188 | * Generates and display row actions links for the list table. |
| 185 | 189 | * |
| 186 | 190 | * @since 1.8 |
| 187 | 191 | * |
| 188 | - * @param object $item The item being acted upon. | |
| 189 | - * @param string $column_name Current column name. | |
| 190 | - * @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. | |
| 191 | 195 | * @return string The row actions output. |
| 192 | 196 | */ |
| 193 | 197 | protected function handle_row_actions( $item, $column_name, $primary ) { |
| 194 | 198 | if ( $primary !== $column_name ) { |
| @@ -211,14 +215,14 @@ | ||
| 211 | 215 | ), |
| 212 | 216 | ); |
| 213 | 217 | |
| 214 | 218 | /** |
| 215 | - * Filter the list of row actions in the languages list table | |
| 219 | + * Filters the list of row actions in the languages list table. | |
| 216 | 220 | * |
| 217 | 221 | * @since 1.8 |
| 218 | 222 | * |
| 219 | - * @param array $actions list of html markup actions | |
| 220 | - * @param object $item | |
| 223 | + * @param array $actions A list of html markup actions. | |
| 224 | + * @param PLL_Language $item The language item. | |
| 221 | 225 | */ |
| 222 | 226 | $actions = apply_filters( 'pll_languages_row_actions', $actions, $item ); |
| 223 | 227 | |
| 224 | 228 | return $this->row_actions( $actions ); |
| @@ -250,8 +254,9 @@ | ||
| 250 | 254 | * |
| 251 | 255 | * @since 0.1 |
| 252 | 256 | * |
| 253 | 257 | * @param array $data |
| 258 | + * @return void | |
| 254 | 259 | */ |
| 255 | 260 | public function prepare_items( $data = array() ) { |
| 256 | 261 | $per_page = $this->get_items_per_page( 'pll_lang_per_page' ); |
| 257 | 262 | $this->_column_headers = array( $this->get_columns(), array(), $this->get_sortable_columns() ); |