WP_Plugins_List_Table::_order_callback
Callback to sort plugins by a given column.
Метод класса: WP_Plugins_List_Table{}
Хуков нет.
Возвращает
int. Negative if $plugin_a sorts before $plugin_b, positive if after, 0 if equal.
Использование
$WP_Plugins_List_Table = new WP_Plugins_List_Table(); $WP_Plugins_List_Table->_order_callback( $plugin_a, $plugin_b );
- $plugin_a(array<string, mixed>) (обязательный)
- First plugin data array to compare.
- $plugin_b(array<string, mixed>) (обязательный)
- Second plugin data array to compare.
Заметки
Global. Строка. $orderby The column name to sort by. |
Global. Строка. $order The sort direction ('ASC' or 'DESC'). |
Список изменений
| С версии 3.1.0 | Введена. |
Код WP_Plugins_List_Table::_order_callback() WP Plugins List Table:: order callback WP 7.1.2
public function _order_callback( $plugin_a, $plugin_b ) {
global $orderby, $order;
$a = $plugin_a[ $orderby ];
$b = $plugin_b[ $orderby ];
if ( $a === $b ) {
return 0;
}
if ( 'DESC' === $order ) {
return strcasecmp( $b, $a );
} else {
return strcasecmp( $a, $b );
}
}