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