PluginProbe
Polylang / 2.1
Polylang v2.1
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 -24 2.7.22.1 View file →
@@ -1,8 +1,8 @@
1 1 <?php
2 2
3 3 if ( ! class_exists( 'WP_List_Table' ) ) {
4 - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; // since WP 3.1
4 + require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); // since WP 3.1
5 5 }
6 6
7 7 /**
8 8 * A class to create a table to list all settings modules
@@ -15,15 +15,13 @@
15 15 * Constructor
16 16 *
17 17 * @since 1.8
18 18 */
19 - public function __construct() {
20 - parent::__construct(
21 - array(
22 - 'plural' => 'Settings', // Do not translate ( used for css class )
23 - 'ajax' => false,
24 - )
25 - );
19 + function __construct() {
20 + parent::__construct( array(
21 + 'plural' => 'Settings', // Do not translate ( used for css class )
22 + 'ajax' => false,
23 + ) );
26 24 }
27 25
28 26 /**
29 27 * Get the table classes for styling
@@ -54,13 +52,18 @@
54 52 echo '</tr>';
55 53
56 54 // Display an upgrade message if there is any, reusing css from the plugins updates
57 55 if ( $message = $item->get_upgrade_message() ) {
58 - printf(
59 - '<tr class="plugin-update-tr">
56 + printf( '
57 + <tr class="plugin-update-tr">
60 58 <td colspan="3" class="plugin-update colspanchange">%s</td>
61 59 </tr>',
62 - sprintf( '<div class="update-message notice inline notice-warning notice-alt"><p>%s</p></div>', $message ) // phpcs:ignore WordPress.Security.EscapeOutput
60 + sprintf(
61 + version_compare( $GLOBALS['wp_version'], '4.6', '<' ) ?
62 + '<div class="update-message">%s</div>' : // backward compatibility with WP < 4.6
63 + '<div class="update-message notice inline notice-warning notice-alt"><p>%s</p></div>',
64 + $message
65 + )
63 66 );
64 67 }
65 68
66 69 // The settings if there are
@@ -65,10 +68,10 @@
65 68
66 69 // The settings if there are
67 70 // "inactive" class to reuse css from the plugins list table
68 71 if ( $form = $item->get_form() ) {
69 - printf(
70 - '<tr id="pll-configure-%s" class="pll-configure inactive inline-edit-row" style="display: none;">
72 + printf( '
73 + <tr id="pll-configure-%s" class="pll-configure inactive inline-edit-row" style="display: none;">
71 74 <td colspan="3">
72 75 <legend>%s</legend>
73 76 %s
74 77 <p class="submit inline-edit-save">
@@ -75,12 +78,9 @@
75 78 %s
76 79 </p>
77 80 </td>
78 81 </tr>',
79 - esc_attr( $item->module ),
80 - esc_html( $item->title ),
81 - $form, // phpcs:ignore
82 - implode( $item->get_buttons() ) // phpcs:ignore
82 + esc_attr( $item->module ), esc_html( $item->title ), $form, implode( $item->get_buttons() )
83 83 );
84 84 }
85 85 }
86 86
@@ -91,25 +91,28 @@
91 91 *
92 92 * @param object $item The current item
93 93 */
94 94 protected function single_row_columns( $item ) {
95 - $column_info = $this->get_column_info();
96 - $columns = $column_info[0];
97 - $primary = $column_info[3];
95 + list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
98 96
99 - foreach ( array_keys( $columns ) as $column_name ) {
97 + foreach ( $columns as $column_name => $column_display_name ) {
100 98 $classes = "$column_name column-$column_name";
101 99 if ( $primary === $column_name ) {
102 100 $classes .= ' column-primary';
103 101 }
104 102
103 + if ( in_array( $column_name, $hidden ) ) {
104 + $classes .= ' hidden';
105 + }
106 +
105 107 if ( 'cb' == $column_name ) {
106 108 echo '<th scope="row" class="check-column">';
107 - echo $this->column_cb( $item ); // phpcs:ignore WordPress.Security.EscapeOutput
109 + echo $this->column_cb( $item );
108 110 echo '</th>';
109 - } else {
111 + }
112 + else {
110 113 printf( '<td class="%s">', esc_attr( $classes ) );
111 - echo $this->column_default( $item, $column_name ); // phpcs:ignore WordPress.Security.EscapeOutput
114 + echo $this->column_default( $item, $column_name );
112 115 echo '</td>';
113 116 }
114 117 }
115 118 }