PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 6.2.1
MainWP Dashboard: Self-hosted WordPress Management for Agencies v6.2.1
6.2.2 6.2.1 6.2 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1 6.0.12 6.0.11 4.6.0.1 5.0 5.0.1 5.0.2 5.0.3 5.0.3.1 5.0.3.2 5.1 5.1.1 5.2 5.2.1 All 155 releases
← All changes | class/class-mainwp-updates-table-helper.php +71 -19 5.2 → 6.2.1 View file →
@@ -6,8 +6,13 @@
6 6 */
7 7
8 8 namespace MainWP\Dashboard;
9 9
10 +// Exit if accessed directly.
11 +if ( ! defined( 'ABSPATH' ) ) {
12 + exit;
13 +}
14 +
10 15 /**
11 16 * Class MainWP_Updates_Table_Helper
12 17 *
13 18 * @package MainWP\Dashboard
@@ -72,10 +77,10 @@
72 77 $title = ( 'plugin' === $this->type ) ? esc_html__( 'Plugin', 'mainwp' ) : esc_html__( 'Theme', 'mainwp' );
73 78 }
74 79
75 80 $columns = array(
81 + 'site' => esc_html__( 'Website', 'mainwp' ),
76 82 'title' => $title,
77 - 'login' => '<i class="sign in alternate icon"></i>',
78 83 'version' => esc_html__( 'Version', 'mainwp' ),
79 84 'latest' => esc_html__( 'Latest', 'mainwp' ),
80 85 'trusted' => esc_html__( 'Trusted', 'mainwp' ),
81 86 'status' => esc_html__( 'Status', 'mainwp' ),
@@ -83,14 +88,19 @@
83 88 'action' => '',
84 89 );
85 90
86 91 if ( MAINWP_VIEW_PER_PLUGIN_THEME !== $this->view_per ) {
87 - unset( $columns['login'] );
92 + unset( $columns['site'] );
88 93 unset( $columns['client'] );
94 + } else {
95 + unset( $columns['title'] );
89 96 }
90 97 if ( MAINWP_VIEW_PER_PLUGIN_THEME === $this->view_per ) {
91 98 unset( $columns['trusted'] );
92 99 }
100 + if ( ! \mainwp_current_user_can( 'dashboard', 'manage_clients' ) ) {
101 + unset( $columns['client'] );
102 + }
93 103 return $columns;
94 104 }
95 105
96 106 /**
@@ -127,9 +137,8 @@
127 137 * @return array $collapsing_columns Array of collapsing columns.
128 138 */
129 139 public function get_collapsing_columns() {
130 140 return array(
131 - 'login' => true,
132 141 'version' => true,
133 142 'latest' => true,
134 143 'trusted' => true,
135 144 'status' => true,
@@ -172,14 +181,9 @@
172 181 *
173 182 * @param mixed $value Value of column.
174 183 */
175 184 public function column_trusted( $value ) {
176 - if ( $value ) {
177 - $label = '<span class="ui tiny basic green label mainwp-768-fluid">Trusted</span>';
178 - } else {
179 - $label = '<span class="ui tiny basic grey label mainwp-768-fluid">Not Trusted</span>';
180 - }
181 - return '<td class="mainwp-768-half-width-cell">' . $label . '</td>';
185 + return MainWP_Manage_Sites_Update_View::get_column_trusted( $value );
182 186 }
183 187
184 188 /**
185 189 * Status column.
@@ -193,30 +197,78 @@
193 197 $label = '<span class="ui tiny basic grey label mainwp-768-fluid">Inactive</span>';
194 198 }
195 199 return '<td class="mainwp-768-half-width-cell">' . $label . '</td>';
196 200 }
201 + /**
202 + * Title column.
203 + *
204 + * @param mixed $value Value of column.
205 + * @param object $website The website.
206 + *
207 + * @return string Column HTML.
208 + */
209 + public function column_site( $value, $website = null ) {
210 + if ( true !== $value ) {
211 + return '<td></td>';
212 + }
197 213
214 + $current_wpid = MainWP_System_Utility::get_current_wpid();
215 +
216 + $column_content = '';
217 +
218 + if ( empty( $current_wpid ) || $this->show_select ) {
219 + $column_content .= '<div class="ui child checkbox">
220 + <input type="checkbox" name="">
221 + </div>';
222 + }
223 +
224 + if ( empty( $current_wpid ) && ! empty( $website ) ) {
225 + $column_content .= MainWP_Utility::mainwp_display_site( $website );
226 + }
227 +
228 + return '<td>' . $column_content . '</td>';
229 + }
230 +
198 231 /**
232 + * Title column.
233 + *
234 + * @param mixed $value Value of column.
235 + *
236 + * @return string Column HTML.
237 + */
238 + public function column_title( $value ) {
239 +
240 + $current_wpid = MainWP_System_Utility::get_current_wpid();
241 +
242 + $column_content = '';
243 +
244 + if ( empty( $current_wpid ) || $this->show_select ) {
245 + $column_content .= '<div class="ui child checkbox">
246 + <input type="checkbox" name="">
247 + </div>';
248 + }
249 +
250 + $column_content .= $value;
251 +
252 + return '<td>' . $column_content . '</td>';
253 + }
254 +
255 + /**
199 256 * Default column.
200 257 *
201 258 * @param mixed $value Value of column.
202 259 * @param mixed $column_name Name of column.
203 260 * @param array $others others data.
261 + *
262 + * @return string Column HTML.
204 263 */
205 264 public function column_default( $value, $column_name, $others = array() ) {
206 - $current_wpid = MainWP_System_Utility::get_current_wpid();
207 - $class = '';
265 + $class = '';
208 266 if ( 'version' === $column_name || 'latest' === $column_name ) {
209 267 $class = 'mainwp-768-half-width-cell';
210 268 }
211 269
212 - $column_content = '';
213 - if ( 'title' === $column_name && ( empty( $current_wpid ) || $this->show_select ) ) {
214 - $column_content .= '<div class="ui child checkbox">
215 - <input type="checkbox" name="">
216 - </div>';
217 - }
218 - $column_content .= $value;
270 + $column_content = $value;
219 271
220 272 if ( 'latest' === $column_name && ! empty( $others['roll_info'] ) ) {
221 273 $column_content = $others['roll_info'] . ' ' . $column_content;
222 274 }
@@ -239,9 +291,9 @@
239 291 foreach ( $columns_header as $col => $title ) {
240 292 if ( isset( $row_columns[ $col ] ) ) {
241 293 $value = $row_columns[ $col ];
242 294 if ( method_exists( $this, 'column_' . $col ) ) {
243 - echo call_user_func( array( &$this, 'column_' . $col ), $value ); // phpcs:ignore WordPress.Security.EscapeOutput
295 + echo call_user_func( array( &$this, 'column_' . $col ), $value, $website, $others ); // phpcs:ignore WordPress.Security.EscapeOutput
244 296 } else {
245 297 echo $this->column_default( $value, $col, $others ); // phpcs:ignore WordPress.Security.EscapeOutput
246 298 }
247 299 }