PluginProbe
Polylang / 3.1.4
Polylang v3.1.4
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 | settings/table-settings.php +27 -12 2.7.23.1.4 View file →
@@ -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 }
@@ -34,13 +37,14 @@
34 37 return array( 'wp-list-table', 'widefat', 'plugins', 'pll-settings' ); // get the style of the plugins list table + one specific class
35 38 }
36 39
37 40 /**
38 - * Displays a single row
41 + * Displays a single row.
39 42 *
40 43 * @since 1.8
41 44 *
42 - * @param object $item PLL_Settings_Module object
45 + * @param PLL_Settings_Module $item Settings module item.
46 + * @return void
43 47 */
44 48 public function single_row( $item ) {
45 49 // Classes to reuse css from the plugins list table
46 50 $classes = $item->is_active() ? 'active' : 'inactive';
@@ -84,13 +88,14 @@
84 88 }
85 89 }
86 90
87 91 /**
88 - * Generates the columns for a single row of the table
92 + * Generates the columns for a single row of the table.
89 93 *
90 94 * @since 1.8
91 95 *
92 - * @param object $item The current item
96 + * @param PLL_Settings_Module $item Settings module item.
97 + * @return void
93 98 */
94 99 protected function single_row_columns( $item ) {
95 100 $column_info = $this->get_column_info();
96 101 $columns = $column_info[0];
@@ -114,15 +119,15 @@
114 119 }
115 120 }
116 121
117 122 /**
118 - * Displays the item information in a column ( default case )
123 + * Displays the item information in a column (default case).
119 124 *
120 125 * @since 1.8
121 126 *
122 - * @param object $item
123 - * @param string $column_name
124 - * @return string
127 + * @param PLL_Settings_Module $item Settings module item.
128 + * @param string $column_name Column name.
129 + * @return string The column name.
125 130 */
126 131 protected function column_default( $item, $column_name ) {
127 132 if ( 'plugin-title' == $column_name ) {
128 133 return sprintf( '<strong>%s</strong>', esc_html( $item->title ) ) . $this->row_actions( $item->get_action_links(), true /*always visible*/ );
@@ -130,13 +135,13 @@
130 135 return $item->$column_name;
131 136 }
132 137
133 138 /**
134 - * Gets the list of columns
139 + * Gets the list of columns.
135 140 *
136 141 * @since 1.8
137 142 *
138 - * @return array the list of column titles
143 + * @return string[] The list of column titles.
139 144 */
140 145 public function get_columns() {
141 146 return array(
142 147 'cb' => '', // For the 4px border inherited from plugins when the module is activated
@@ -160,12 +165,21 @@
160 165 * Prepares the list of items for displaying
161 166 *
162 167 * @since 1.8
163 168 *
164 - * @param array $items
169 + * @param PLL_Settings_Module[] $items Array of settings module items.
170 + * @return void
165 171 */
166 172 public function prepare_items( $items = array() ) {
167 173 $this->_column_headers = array( $this->get_columns(), array(), $this->get_sortable_columns(), $this->get_primary_column_name() );
174 +
175 + // Sort rows, lowest priority on top.
176 + usort(
177 + $items,
178 + function( $a, $b ) {
179 + return $a->priority > $b->priority ? 1 : -1;
180 + }
181 + );
168 182 $this->items = $items;
169 183 }
170 184
171 185 /**
@@ -173,7 +187,8 @@
173 187 *
174 188 * @since 2.1
175 189 *
176 190 * @param string $which 'top' or 'bottom'
191 + * @return void
177 192 */
178 - protected function display_tablenav( $which ) {}
193 + protected function display_tablenav( $which ) {} // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
179 194 }