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 | pages/page-mainwp-updates-per-item.php +227 -216 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_Per_Item.
12 17 */
13 18 class MainWP_Updates_Per_Item { // phpcs:ignore Generic.Classes.OpeningBraceSameLine.ContentAfterBrace -- NOSONAR.
@@ -25,9 +30,9 @@
25 30
26 31 /**
27 32 * Method render_plugins_updates()
28 33 *
29 - * Render Plugins updates
34 + * Render Plugin updates
30 35 *
31 36 * @param object $websites the websites.
32 37 * @param int $total_plugin_upgrades total plugin updates.
33 38 * @param mixed $userExtension user extension.
@@ -48,41 +53,23 @@
48 53 * @uses \MainWP\Dashboard\MainWP_Updates::render_site_link_dashboard()
49 54 * @uses \MainWP\Dashboard\MainWP_Updates::get_continue_update_selector()
50 55 */
51 56 public static function render_plugins_updates( $websites, $total_plugin_upgrades, $userExtension, $allPlugins, $pluginsInfo, $trustedPlugins ) { // phpcs:ignore -- NOSONAR - complex.
52 - $is_demo = MainWP_Demo_Handle::is_demo_mode();
53 57 ?>
54 - <table class="ui tablet stackable table mainwp-manage-updates-table main-master-checkbox" id="mainwp-plugins-updates-table">
58 + <?php if ( 0 < $total_plugin_upgrades ) : ?>
59 + <table class="ui tablet stackable table mainwp-manage-updates-table main-master-checkbox mainwp-js-persistent-table" id="mainwp-plugins-updates-table">
55 60 <thead>
56 61 <tr>
57 62 <th scope="col" class="collapsing no-sort trigger-all-accordion"><span class="trigger-handle-arrow"><i class="caret right icon"></i><i class="caret down icon"></i></span></th>
58 - <th scope="col" class="eight wide indicator-accordion-sorting handle-accordion-sorting">
63 + <th scope="col" class="eight wide indicator-accordion-sorting handle-accordion-sorting" data-key="plugin">
59 64 <div class="ui main-master checkbox ">
60 65 <input type="checkbox" name=""><label><?php esc_html_e( 'Plugin', 'mainwp' ); ?></label>
61 66 </div>
62 67 <?php MainWP_UI::render_sorting_icons(); ?>
63 68 </th>
64 - <th scope="col" class="two wide indicator-accordion-sorting handle-accordion-sorting"><?php echo intval( $total_plugin_upgrades ) . ' ' . esc_html( _n( 'Update', 'Updates', $total_plugin_upgrades, 'mainwp' ) ); ?><?php MainWP_UI::render_sorting_icons(); ?></th>
65 - <th scope="col" class="two wide indicator-accordion-sorting handle-accordion-sorting"><?php esc_html_e( 'Trusted', 'mainwp' ); ?><?php MainWP_UI::render_sorting_icons(); ?></th>
66 - <th scope="col" class="four wide no-sort right aligned">
67 - <?php MainWP_UI::render_show_all_updates_button(); ?>
68 - <?php
69 - if ( MainWP_Updates::user_can_update_plugins() ) {
70 - MainWP_Updates::set_continue_update_html_selector( 'plugins_global_upgrade_all' );
71 - if ( 0 < $total_plugin_upgrades ) {
72 - if ( $is_demo ) {
73 - MainWP_Demo_Handle::get_instance()->render_demo_disable_button( '<a href="javascript:void(0)" disabled="disabled" class="ui mini green basic button disabled mainwp-update-selected-button">' . esc_html__( 'Update Selected Plugins', 'mainwp' ) . '</a>' );
74 - MainWP_Demo_Handle::get_instance()->render_demo_disable_button( '<a href="javascript:void(0)" disabled="disabled" class="ui mini green button disabled mainwp-update-all-button">' . esc_html__( 'Update All Plugins', 'mainwp' ) . '</a>' );
75 - } else {
76 - ?>
77 - <a href="javascript:void(0)" data-tooltip="<?php esc_html_e( 'Update Selected Plugins.', 'mainwp' ); ?>" onClick="updatesoverview_plugins_global_upgrade_all( false, true ); return false;" class="ui mini green basic button mainwp-update-selected-button" data-inverted="" data-position="top right"><?php esc_html_e( 'Update Selected Plugins' ); ?></a>
78 - <a href="javascript:void(0)" data-tooltip="<?php esc_html_e( 'Update all sites.', 'mainwp' ); ?>" onClick="updatesoverview_plugins_global_upgrade_all(); return false;" class="ui mini green button mainwp-update-all-button" data-inverted="" data-position="top right"><?php esc_html_e( 'Update All Plugins' ); ?></a>
79 - <?php
80 - }
81 - }
82 - }
83 - ?>
84 - </th>
69 + <th scope="col" class="two wide indicator-accordion-sorting handle-accordion-sorting" data-key="update"><?php echo intval( $total_plugin_upgrades ) . ' ' . esc_html( _n( 'Update', 'Updates', $total_plugin_upgrades, 'mainwp' ) ); ?><?php MainWP_UI::render_sorting_icons(); ?></th>
70 + <th scope="col" class="two wide indicator-accordion-sorting handle-accordion-sorting" data-key="trusted"><?php esc_html_e( 'Trusted', 'mainwp' ); ?><?php MainWP_UI::render_sorting_icons(); ?></th>
71 + <th scope="col" class="four wide no-sort right aligned"><?php MainWP_UI::render_show_all_updates_button(); ?></th>
85 72 </tr>
86 73 </thead>
87 74 <?php
88 75 $updates_table_helper = new MainWP_Updates_Table_Helper( $userExtension->site_view );
@@ -96,9 +83,9 @@
96 83 ?>
97 84 <tr class="ui title master-checkbox">
98 85 <td class="accordion-trigger"><i class="icon dropdown"></i></td>
99 86 <td class="middle aligned">
100 - <div class="ui master checkbox">
87 + <div class="ui middle aligned fitted master checkbox">
101 88 <input type="checkbox" name="">
102 89 </div>
103 90 &nbsp;&nbsp;<?php echo MainWP_System_Utility::get_plugin_icon( $pluginsInfo[ $slug ]['slug'] ); // phpcs:ignore WordPress.Security.EscapeOutput ?>&nbsp;&nbsp;&nbsp;&nbsp;
104 91 <a href="<?php echo esc_url( admin_url() ) . 'plugin-install.php?tab=plugin-information&plugin=' . esc_attr( $pluginsInfo[ $slug ]['slug'] ) . '&url=' . ( isset( $pluginsInfo[ $slug ]['PluginURI'] ) ? rawurlencode( $pluginsInfo[ $slug ]['PluginURI'] ) : '' ) . '&name=' . rawurlencode( $pluginsInfo[ $slug ]['name'] ); ?>" target="_blank" class="open-plugin-details-modal" open-wpplugin="yes">
@@ -116,17 +103,12 @@
116 103 <?php
117 104 if ( MAINWP_VIEW_PER_PLUGIN_THEME === (int) $userExtension->site_view ) {
118 105 MainWP_Updates::set_continue_update_html_selector( 'plugins_upgrade_all', $slug );
119 106 }
120 - if ( $is_demo ) {
121 - MainWP_Demo_Handle::get_instance()->render_demo_disable_button( '<a href="javascript:void(0)" disabled="disabled" class="ui mini basic button green disabled mainwp-update-selected-button">' . esc_html__( 'Update Selected', 'mainwp' ) . '</a>' );
122 - MainWP_Demo_Handle::get_instance()->render_demo_disable_button( '<a href="javascript:void(0)" disabled="disabled" class="ui mini button green disabled mainwp-update-all-button">' . esc_html__( 'Update All', 'mainwp' ) . '</a>' );
123 - } else {
124 - ?>
107 + ?>
125 108 <a href="javascript:void(0)" class="mainwp-update-selected-button ui mini basic button green <?php MainWP_Updates::get_continue_update_selector(); ?>" onClick="event.stopPropagation(); updatesoverview_plugins_upgrade_all( '<?php echo esc_js( $plugin_name ); ?>', '<?php echo esc_attr( rawurlencode( $pluginsInfo[ $slug ]['name'] ) ); ?>', true ); return false;"><?php esc_html_e( 'Update Selected', 'mainwp' ); ?></a>
126 109 <a href="javascript:void(0)" class="mainwp-update-all-button ui mini button green <?php MainWP_Updates::get_continue_update_selector(); ?>" onClick="return updatesoverview_plugins_upgrade_all( '<?php echo esc_js( $plugin_name ); ?>', '<?php echo esc_attr( rawurlencode( $pluginsInfo[ $slug ]['name'] ) ); ?>' )"><?php esc_html_e( 'Update All', 'mainwp' ); ?></a>
127 110 <?php } ?>
128 - <?php } ?>
129 111 <?php } ?>
130 112 </td>
131 113 </tr>
132 114 <tr class="plugins-bulk-updates child-checkbox content" plugin_slug="<?php echo esc_attr( $plugin_name ); ?>" plugin_name="<?php echo esc_attr( rawurlencode( $pluginsInfo[ $slug ]['name'] ) ); ?>" premium="<?php echo $pluginsInfo[ $slug ]['premium'] ? 1 : 0; ?>">
@@ -167,9 +149,9 @@
167 149 foreach ( $decodedPremiumUpgrades as $crrSlug => $premiumUpgrade ) {
168 150 $premiumUpgrade['premium'] = true;
169 151 if ( 'plugin' === $premiumUpgrade['type'] ) {
170 152 if ( ! isset( $plugin_upgrades[ $crrSlug ] ) ) {
171 - $plugin_upgrades[ $crrSlug ] = array();
153 + continue;
172 154 }
173 155 $premiumUpgrade = array_filter( $premiumUpgrade );
174 156 $plugin_upgrades[ $crrSlug ] = array_merge( $plugin_upgrades[ $crrSlug ], $premiumUpgrade );
175 157 }
@@ -187,12 +169,13 @@
187 169 }
188 170 $plugin_upgrade = $plugin_upgrades[ $slug ];
189 171
190 172 $last_version = $plugin_upgrade['update']['new_version'];
191 - $row_columns = array(
192 - 'title' => MainWP_Updates::render_site_link_dashboard( $website, false ),
193 - 'login' => '<a href="admin.php?page=SiteOpen&newWindow=yes&websiteid=' . intval( $website->id ) . '&_opennonce=' . wp_create_nonce( 'mainwp-admin-nonce' ) . '" data-tooltip="' . esc_attr__( 'Jump to the site WP Admin', 'mainwp' ) . '" data-position="bottom right" data-inverted="" class="open_newwindow_wpadmin" target="_blank"><i class="sign in icon"></i></a>',
194 - 'version' => '<strong class="mainwp-768-show">' . esc_html__( 'Version: ', 'mainwp' ) . '</strong>' . esc_html( $plugin_upgrade['Version'] ),
173 + $current_ver = $plugin_upgrade['Version'] ?? '';
174 +
175 + $row_columns = array(
176 + 'site' => true,
177 + 'version' => '<strong class="mainwp-768-show">' . esc_html__( 'Version: ', 'mainwp' ) . '</strong>' . esc_html( $current_ver ),
195 178 'latest' => '<strong class="mainwp-768-show">' . esc_html__( 'Latest: ', 'mainwp' ) . '</strong><a href="' . admin_url() . 'plugin-install.php?tab=plugin-information&wpplugin=' . intval( $website->id ) . '&plugin=' . esc_attr( $plugin_upgrade['update']['slug'] ) . '&url=' . ( isset( $plugin_upgrade['PluginURI'] ) ? rawurlencode( $plugin_upgrade['PluginURI'] ) : '' ) . '&name=' . rawurlencode( $plugin_upgrade['Name'] ) . '&section=changelog" target="_blank" class="open-plugin-details-modal">' . esc_html( $last_version ) . '</a>',
196 179 'trusted' => ( in_array( $slug, $trustedPlugins ) ? true : false ),
197 180 'status' => ( isset( $plugin_upgrade['active'] ) && $plugin_upgrade['active'] ) ? true : false,
198 181 'client' => ( isset( $website->client_name ) && '' !== $website->client_name ) ? '<a href="admin.php?page=ManageClients&client_id=' . intval( $website->client_id ) . '" data-tooltip="' . __( 'Jump to the client', 'mainwp' ) . '" data-position="right center" data-inverted="">' . $website->client_name . '</a>' : '',
@@ -203,40 +186,45 @@
203 186 $msg = MainWP_Updates_Helper::get_roll_msg( $rollPlugins[ $slug ][ $last_version ], true, 'notice' );
204 187 $others['roll_info'] = $msg;
205 188 }
206 189
190 + $tz_info = MainWP_Updates::get_site_tz_info( $website );
191 +
192 + $compatible_php = isset( $plugin_upgrade['wp_compatible'] ) ? $plugin_upgrade['wp_compatible'] : true;
193 + $compatible_wp = isset( $plugin_upgrade['php_compatible'] ) ? $plugin_upgrade['php_compatible'] : true;
194 +
207 195 ?>
208 - <tr site_id="<?php echo esc_attr( $website->id ); ?>" plugin_slug="<?php echo esc_attr( $plugin_name ); ?>" last-version="<?php echo esc_attr( rawurlencode( $last_version ) ); ?>" site_name="<?php echo esc_attr( rawurlencode( stripslashes( $website->name ) ) ); ?>" updated="0" <?php echo $first_wpplugin ? 'open-wpplugin-siteid="' . intval( $website->id ) . '"' : ''; ?>>
196 + <tr site_id="<?php echo esc_attr( $website->id ); ?>" site_name="<?php echo esc_attr( $website->name ); ?>" site_url="<?php echo esc_attr( $website->url ); ?>" plugin_slug="<?php echo esc_attr( $plugin_name ); ?>" plugin_name="<?php echo esc_attr( $plugin_upgrade['Name'] ); ?>" last-version="<?php echo esc_attr( rawurlencode( $last_version ) ); ?>" site_name="<?php echo esc_attr( stripslashes( $website->name ) ); ?>" updated="0" <?php echo $first_wpplugin ? 'open-wpplugin-siteid="' . intval( $website->id ) . '"' : ''; ?> tz-info="<?php echo esc_attr( $tz_info ); ?>">
209 197 <?php
210 198 $row_columns = $updates_table_helper->render_columns( $row_columns, $website, $others );
211 199 $action_rendered = isset( $row_columns['action'] ) ? true : false;
212 200 if ( ! $action_rendered ) {
213 201 ?>
214 - <td class="right aligned">
215 - <?php if ( MainWP_Updates::user_can_ignore_updates() ) { ?>
216 - <div class="ui mini buttons">
217 - <div class="ui button"><?php esc_html_e( 'Ignore Update', 'mainwp' ); ?></div>
218 - <div class="ui floating dropdown icon button">
219 - <i class="dropdown icon"></i>
220 - <div class="menu">
221 - <a href="javascript:void(0)" class="mainwp-ignore-update-button item" onClick="return updatesoverview_plugins_ignore_detail( '<?php echo esc_js( $plugin_name ); ?>', '<?php echo esc_js( rawurlencode( $plugin_upgrade['Name'] ) ); ?>', <?php echo intval( $website->id ); ?>, this, '<?php echo esc_js( rawurlencode( $last_version ) ); ?>' )"><?php esc_html_e( 'Ignore this version', 'mainwp' ); ?></a>
222 - <a href="javascript:void(0)" class="item mainwp-ignore-globally-button" onClick="return updatesoverview_plugins_ignore_all( '<?php echo esc_js( $plugin_name ); ?>', '<?php echo esc_attr( rawurlencode( $pluginsInfo[ $slug ]['name'] ) ); ?>', this, '<?php echo esc_js( rawurlencode( $last_version ) ); ?>' )"><?php esc_html_e( 'Ignore this version globally', 'mainwp' ); ?></a>
223 - <a href="javascript:void(0)" class="mainwp-ignore-update-button item" onClick="return updatesoverview_plugins_ignore_detail( '<?php echo esc_js( $plugin_name ); ?>', '<?php echo esc_js( rawurlencode( $plugin_upgrade['Name'] ) ); ?>', <?php echo intval( $website->id ); ?>, this, 'all_versions' )"><?php esc_html_e( 'Ignore all versions', 'mainwp' ); ?></a>
202 + <td class="right aligned">
203 + <a href="#" history-view="update-plugin-per-item" class="mainwp-show-history ui mini button"><?php esc_html_e( 'History', 'mainwp' ); ?></a>
204 + <?php if ( MainWP_Updates::user_can_ignore_updates() ) : ?>
205 + <div class="ui top left pointing dropdown mini button">
206 + <?php esc_html_e( 'Ignore', 'mainwp' ); ?><i class="dropdown icon"></i>
207 + <div class="menu">
208 + <a href="javascript:void(0)" class="mainwp-ignore-update-button item" onClick="return updatesoverview_plugins_ignore_detail( '<?php echo esc_js( $plugin_name ); ?>', '<?php echo esc_js( rawurlencode( $plugin_upgrade['Name'] ) ); ?>', <?php echo intval( $website->id ); ?>, this, '<?php echo esc_js( rawurlencode( $last_version ) ); ?>' )"><?php esc_html_e( 'Ignore this version', 'mainwp' ); ?></a>
209 + <a href="javascript:void(0)" class="mainwp-ignore-globally-button item" onClick="return updatesoverview_plugins_ignore_all( '<?php echo esc_js( $plugin_name ); ?>', '<?php echo esc_attr( rawurlencode( $pluginsInfo[ $slug ]['name'] ) ); ?>', this, '<?php echo esc_js( rawurlencode( $last_version ) ); ?>' )"><?php esc_html_e( 'Ignore this version globally', 'mainwp' ); ?></a>
210 + <a href="javascript:void(0)" class="mainwp-ignore-update-button item" onClick="return updatesoverview_plugins_ignore_detail( '<?php echo esc_js( $plugin_name ); ?>', '<?php echo esc_js( rawurlencode( $plugin_upgrade['Name'] ) ); ?>', <?php echo intval( $website->id ); ?>, this, 'all_versions' )"><?php esc_html_e( 'Ignore all versions', 'mainwp' ); ?></a>
211 + </div>
224 212 </div>
225 - </div>
226 - </div>
227 - <?php } ?>
228 - <?php
229 - if ( MainWP_Updates::user_can_update_plugins() ) {
230 - if ( $is_demo ) {
231 - MainWP_Demo_Handle::get_instance()->render_demo_disable_button( '<a href="javascript:void(0)" class="ui mini green button disabled" disabled="disabled">' . esc_html__( 'Update Now', 'mainwp' ) . '</a>' );
232 - } else {
213 + <?php endif; ?>
214 + <?php
215 + if ( MainWP_Updates::user_can_update_plugins() ) :
216 + if ( $compatible_php && $compatible_wp ) {
217 + ?>
218 + <a href="javascript:void(0)" class="mainwp-update-now-button ui mini green button" onClick="return updatesoverview_plugins_upgrade( '<?php echo esc_js( $plugin_name ); ?>', <?php echo intval( $website->id ); ?> )"><?php esc_html_e( 'Update', 'mainwp' ); ?></a>
219 + <?php
220 + } else {
221 + self::render_incompatible_message( $compatible_php, $compatible_wp );
222 + }
233 223 ?>
234 - <a href="javascript:void(0)" class="mainwp-update-now-button ui mini green button" onClick="return updatesoverview_plugins_upgrade( '<?php echo esc_js( $plugin_name ); ?>', <?php echo intval( $website->id ); ?> )"><?php esc_html_e( 'Update Now', 'mainwp' ); ?></a>
235 - <?php } ?>
224 + <?php endif; ?>
225 + </td>
236 226 <?php } ?>
237 - </td>
238 - <?php } ?>
239 227 </tr>
240 228 <?php
241 229 $first_wpplugin = false;
242 230 }
@@ -246,33 +234,65 @@
246 234 </td>
247 235 </tr>
248 236 <?php } ?>
249 237 </tbody>
250 - <tfoot>
251 - <tr>
252 - <th scope="col" class="collapsing no-sort"></th>
253 - <th scope="col" >
254 - <div class="ui main-master checkbox ">
255 - <input type="checkbox" name="">
256 - </div>
257 - <?php esc_html_e( 'Plugin', 'mainwp' ); ?>
258 - </th>
259 - <th scope="col" ><?php echo intval( $total_plugin_upgrades ) . ' ' . esc_html( _n( 'Update', 'Updates', $total_plugin_upgrades, 'mainwp' ) ); ?></th>
260 - <th scope="col" ><?php esc_html_e( 'Trusted', 'mainwp' ); ?></th>
261 - <th scope="col" class="no-sort right aligned"></th>
262 - </tr>
263 - </tfoot>
264 238 </table>
239 + <?php else : ?>
240 + <?php MainWP_UI::render_empty_page_placeholder( __( 'Plugins are up to date', 'mainwp' ), __( 'No plugin updates available right now.', 'mainwp' ) ); ?>
241 + <?php endif; ?>
265 242 <?php
266 243 }
267 244
268 245 /**
246 + * Method render_incompatible_message().
247 + *
248 + * @param mixed $compatible_php Compatible php.
249 + * @param mixed $compatible_wp Compatible wp. *
250 + * @param mixed $echo_content Print content or not.
251 + *
252 + * @return string Message
253 + */
254 + public static function render_incompatible_message( $compatible_php, $compatible_wp, $echo_content = true ) {
255 + $msg = static::get_incompatible_message( $compatible_php, $compatible_wp );
256 + if ( ! empty( $msg ) ) {
257 + $html = '<span class="ui yellow message">' . esc_html( $msg ) . '</span>';
258 + if ( $echo_content ) {
259 + echo $html; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
260 + } else {
261 + return $html;
262 + }
263 + }
264 + return '';
265 + }
266 +
267 + /**
268 + * Method get_incompatible_message().
269 + *
270 + * @param mixed $compatible_php Compatible php.
271 + * @param mixed $compatible_wp Compatible wp.
272 + * @return string Message
273 + */
274 + public static function get_incompatible_message( $compatible_php, $compatible_wp ) {
275 + $msg = '';
276 + if ( ! $compatible_php || ! $compatible_wp ) {
277 + if ( ! $compatible_php && ! $compatible_wp ) {
278 + $msg .= __( 'This plugin does not work with your versions of WordPress and PHP.', 'mainwp' );
279 + } elseif ( ! $compatible_wp ) {
280 + $msg .= __( 'This plugin does not work with your version of WordPress.', 'mainwp' );
281 + } elseif ( ! $compatible_php ) {
282 + $msg .= __( 'This plugin does not work with your version of PHP.', 'mainwp' );
283 + }
284 + }
285 + return $msg;
286 + }
287 +
288 + /**
269 289 * Method render_themes_updates()
270 290 *
271 - * Render themes updates
291 + * Render theme updates
272 292 *
273 293 * @param object $websites the websites.
274 - * @param int $total_theme_upgrades total themes updates.
294 + * @param int $total_theme_upgrades total theme updates.
275 295 * @param mixed $userExtension user extension.
276 296 * @param array $allThemes all themes.
277 297 * @param array $themesInfo themes information.
278 298 * @param array $trustedThemes trusted themes.
@@ -291,41 +311,23 @@
291 311 * @uses \MainWP\Dashboard\MainWP_Updates::get_continue_update_selector()
292 312 */
293 313 public static function render_themes_updates( $websites, $total_theme_upgrades, $userExtension, $allThemes, $themesInfo, $trustedThemes ) { // phpcs:ignore -- NOSONAR - complex.
294 314 $updates_table_helper = new MainWP_Updates_Table_Helper( $userExtension->site_view, 'theme' );
295 - $is_demo = MainWP_Demo_Handle::is_demo_mode();
296 315 ?>
297 - <table class="ui tablet stackable table mainwp-manage-updates-table main-master-checkbox" id="mainwp-themes-updates-table">
316 + <?php if ( 0 < $total_theme_upgrades ) : ?>
317 + <table class="ui tablet stackable table mainwp-manage-updates-table main-master-checkbox mainwp-js-persistent-table mainwp-themes-updates-items-table" id="mainwp-themes-updates-table">
298 318 <thead>
299 319 <tr>
300 320 <th scope="col" class="collapsing no-sort trigger-all-accordion"><span class="trigger-handle-arrow"><i class="caret right icon"></i><i class="caret down icon"></i></span></th>
301 - <th scope="col" class="eight wide handle-accordion-sorting indicator-accordion-sorting">
321 + <th scope="col" class="eight wide handle-accordion-sorting indicator-accordion-sorting" data-key="theme">
302 322 <div class="ui main-master checkbox ">
303 323 <input type="checkbox" name=""><label><?php esc_html_e( 'Theme', 'mainwp' ); ?></label>
304 324 </div>
305 325 <?php MainWP_UI::render_sorting_icons(); ?>
306 326 </th>
307 - <th scope="col" class="two wide handle-accordion-sorting indicator-accordion-sorting"><?php echo intval( $total_theme_upgrades ) . ' ' . esc_html( _n( 'Update', 'Updates', $total_theme_upgrades, 'mainwp' ) ); ?><?php MainWP_UI::render_sorting_icons(); ?></th>
308 - <th scope="col" class="two wide handle-accordion-sorting indicator-accordion-sorting"><?php esc_html_e( 'Trusted', 'mainwp' ); ?><?php MainWP_UI::render_sorting_icons(); ?></th>
309 - <th scope="col" class="four wide no-sort right aligned">
310 - <?php MainWP_UI::render_show_all_updates_button(); ?>
311 - <?php
312 - if ( MainWP_Updates::user_can_update_themes() ) {
313 - MainWP_Updates::set_continue_update_html_selector( 'themes_global_upgrade_all' );
314 - if ( 0 < $total_theme_upgrades ) {
315 - if ( $is_demo ) {
316 - MainWP_Demo_Handle::get_instance()->render_demo_disable_button( '<a href="javascript:void(0)" class="ui mini green basic button disabled mainwp-update-selected-button" disabled="disabled">' . esc_html__( 'Update Selected Themes', 'mainwp' ) . '</a>' );
317 - MainWP_Demo_Handle::get_instance()->render_demo_disable_button( '<a href="javascript:void(0)" class="ui mini green button disabled mainwp-update-all-button" disabled="disabled">' . esc_html__( 'Update All Themes', 'mainwp' ) . '</a>' );
318 - } else {
319 - ?>
320 - <a href="javascript:void(0)" onClick="updatesoverview_themes_global_upgrade_all( false, true );return false;" class="ui mini green basic button mainwp-update-selected-button" data-tooltip="<?php esc_html_e( 'Update selected sites.', 'mainwp' ); ?>" data-inverted="" data-position="top right"><?php esc_html_e( 'Update Selected Themes' ); ?></a>
321 - <a href="javascript:void(0)" onClick="updatesoverview_themes_global_upgrade_all();return false;" class="ui mini green button mainwp-update-all-button" data-tooltip="<?php esc_html_e( 'Update all sites.', 'mainwp' ); ?>" data-inverted="" data-position="top right"><?php esc_html_e( 'Update All Themes' ); ?></a>
322 - <?php
323 - }
324 - }
325 - }
326 - ?>
327 - </th>
327 + <th scope="col" class="two wide handle-accordion-sorting indicator-accordion-sorting" data-key="update"><?php echo intval( $total_theme_upgrades ) . ' ' . esc_html( _n( 'Update', 'Updates', $total_theme_upgrades, 'mainwp' ) ); ?><?php MainWP_UI::render_sorting_icons(); ?></th>
328 + <th scope="col" class="two wide handle-accordion-sorting indicator-accordion-sorting" data-key="trusted"><?php esc_html_e( 'Trusted', 'mainwp' ); ?><?php MainWP_UI::render_sorting_icons(); ?></th>
329 + <th scope="col" class="four wide no-sort right aligned"><?php MainWP_UI::render_show_all_updates_button(); ?></th>
328 330 </tr>
329 331 </thead>
330 332 <tbody id="themes-updates-global" class="ui accordion">
331 333 <?php foreach ( $allThemes as $slug => $val ) { ?>
@@ -335,12 +337,13 @@
335 337 $trusted = in_array( $slug, $trustedThemes ) ? 1 : 0;
336 338 ?>
337 339 <tr class="ui title master-checkbox">
338 340 <td class="accordion-trigger"><i class="icon dropdown"></i></td>
339 - <td>
340 - <div class="ui master checkbox">
341 - <input type="checkbox" name=""><label><?php echo MainWP_System_Utility::get_theme_icon( $slug ); // phpcs:ignore WordPress.Security.EscapeOutput ?>&nbsp;&nbsp;&nbsp;&nbsp;<?php echo esc_html( $themesInfo[ $slug ]['name'] ); ?></label>
342 - </div>
341 + <td class="middle aligned">
342 + <div class="ui middle aligned fitted master checkbox">
343 + <input type="checkbox" name="">
344 + </div>
345 + &nbsp;&nbsp;<?php echo MainWP_System_Utility::get_theme_icon( $slug ); // phpcs:ignore WordPress.Security.EscapeOutput ?>&nbsp;&nbsp;&nbsp;&nbsp;<?php echo esc_html( $themesInfo[ $slug ]['name'] ); ?>
343 346 </td>
344 347 <td sort-value="<?php echo intval( $cnt ); ?>"><?php echo intval( $cnt ); ?> <?php echo esc_html( _n( 'Update', 'Updates', $cnt, 'mainwp' ) ); ?></td>
345 348 <td sort-value="<?php echo esc_attr( $trusted ); ?>"><?php echo $trusted ? '<span class="ui tiny green label">Trusted</span>' : '<span class="ui tiny grey label">Not Trusted</span>'; ?></td>
346 349 <td class="right aligned">
@@ -352,17 +355,13 @@
352 355 if ( 0 < $cnt ) {
353 356 if ( MAINWP_VIEW_PER_PLUGIN_THEME === (int) $userExtension->site_view ) {
354 357 MainWP_Updates::set_continue_update_html_selector( 'themes_upgrade_all', $slug );
355 358 }
356 - if ( $is_demo ) {
357 - MainWP_Demo_Handle::get_instance()->render_demo_disable_button( '<a href="javascript:void(0)" class="ui mini basic button disabled mainwp-update-selected-button" disabled="disabled">' . esc_html__( 'Update Selected', 'mainwp' ) . '</a>' );
358 - MainWP_Demo_Handle::get_instance()->render_demo_disable_button( '<a href="javascript:void(0)" class="ui mini button green disabled mainwp-update-all-button" disabled="disabled">' . esc_html__( 'Update All', 'mainwp' ) . '</a>' );
359 - } else {
360 - ?>
359 + ?>
361 360 <a href="javascript:void(0)" class="mainwp-update-selected-button ui mini basic button green <?php MainWP_Updates::get_continue_update_selector(); ?>" onClick="updatesoverview_themes_upgrade_all( '<?php echo esc_js( $theme_name ); ?>', '<?php echo esc_js( rawurlencode( $themesInfo[ $slug ]['name'] ) ); ?>', true ); return false;"><?php esc_html_e( 'Update Selected', 'mainwp' ); ?></a>
362 361 <a href="javascript:void(0)" class="mainwp-update-all-button ui mini button green <?php MainWP_Updates::get_continue_update_selector(); ?>" onClick="updatesoverview_themes_upgrade_all( '<?php echo esc_js( $theme_name ); ?>', '<?php echo esc_js( rawurlencode( $themesInfo[ $slug ]['name'] ) ); ?>' ); return false;"><?php esc_html_e( 'Update All', 'mainwp' ); ?></a>
362 +
363 363 <?php } ?>
364 - <?php } ?>
365 364 <?php } ?>
366 365 </td>
367 366 </tr>
368 367 <tr class="themes-bulk-updates child-checkbox content" theme_slug="<?php echo esc_attr( $theme_name ); ?>" theme_name="<?php echo esc_attr( rawurlencode( $themesInfo[ $slug ]['name'] ) ); ?>" premium="<?php echo $themesInfo[ $slug ]['premium'] ? 1 : 0; ?>">
@@ -419,12 +418,15 @@
419 418 continue;
420 419 }
421 420 $theme_upgrade = $theme_upgrades[ $slug ];
422 421 $last_version = $theme_upgrade['update']['new_version'];
423 - $row_columns = array(
424 - 'title' => MainWP_Updates::render_site_link_dashboard( $website, false ),
425 - 'login' => '<a href="admin.php?page=SiteOpen&newWindow=yes&websiteid=' . intval( $website->id ) . '&_opennonce=' . wp_create_nonce( 'mainwp-admin-nonce' ) . '" data-tooltip="' . esc_attr__( 'Jump to the site WP Admin', 'mainwp' ) . '" data-position="bottom right" data-inverted="" class="open_newwindow_wpadmin" target="_blank"><i class="sign in icon"></i></a>',
426 - 'version' => '<strong class="mainwp-768-show">' . esc_html__( 'Version: ', 'mainwp' ) . '</strong>' . esc_html( $theme_upgrade['Version'] ),
422 + $current_ver = $theme_upgrade['Version'] ?? '';
423 + if ( empty( $current_ver ) ) {
424 + $current_ver = static::get_installed_theme_version( $website, $slug );
425 + }
426 + $row_columns = array(
427 + 'site' => true,
428 + 'version' => '<strong class="mainwp-768-show">' . esc_html__( 'Version: ', 'mainwp' ) . '</strong>' . esc_html( $current_ver ),
427 429 'latest' => '<strong class="mainwp-768-show">' . esc_html__( 'Latest: ', 'mainwp' ) . '</strong>' . esc_html( $last_version ),
428 430 'trusted' => ( in_array( $slug, $trustedThemes ) ? true : false ),
429 431 'status' => ( isset( $theme_upgrade['active'] ) && $theme_upgrade['active'] ) ? true : false,
430 432 'client' => ( isset( $website->client_name ) && '' !== $website->client_name ) ? '<a href="admin.php?page=ManageClients&client_id=' . intval( $website->client_id ) . '" data-tooltip="' . __( 'Jump to the client', 'mainwp' ) . '" data-position="right center" data-inverted="">' . $website->client_name . '</a>' : '',
@@ -435,21 +437,22 @@
435 437 $msg = MainWP_Updates_Helper::get_roll_msg( $rollThemes[ $slug ][ $last_version ], true, 'notice' );
436 438 $others['roll_info'] = $msg;
437 439 }
438 440
441 + $tz_info = MainWP_Updates::get_site_tz_info( $website );
442 +
439 443 ?>
440 - <tr site_id="<?php echo esc_attr( $website->id ); ?>" theme_slug="<?php echo esc_attr( $theme_name ); ?>" last-version="<?php echo esc_attr( rawurlencode( $last_version ) ); ?>" site_name="<?php echo esc_attr( rawurlencode( stripslashes( $website->name ) ) ); ?>" updated="0">
444 + <tr site_id="<?php echo esc_attr( $website->id ); ?>" theme_slug="<?php echo esc_attr( $theme_name ); ?>" theme_name="<?php echo esc_attr( $theme_upgrade['Name'] ); ?>" last-version="<?php echo esc_attr( rawurlencode( $last_version ) ); ?>" site_name="<?php echo esc_attr( rawurlencode( stripslashes( $website->name ) ) ); ?>" site_url="<?php echo esc_attr( $website->url ); ?>" updated="0" tz-info="<?php echo esc_attr( $tz_info ); ?>">
441 445 <?php
442 446 $row_columns = $updates_table_helper->render_columns( $row_columns, $website, $others );
443 447 $action_rendered = isset( $row_columns['action'] ) ? true : false;
444 448 if ( ! $action_rendered ) {
445 449 ?>
446 - <td class="right aligned">
447 - <?php if ( MainWP_Updates::user_can_ignore_updates() ) { ?>
448 - <div class="ui mini buttons">
449 - <div class="ui button"><?php esc_html_e( 'Ignore Update', 'mainwp' ); ?></div>
450 - <div class="ui floating dropdown icon button">
451 - <i class="dropdown icon"></i>
450 + <td class="right aligned">
451 + <a href="#" history-view="update-theme-per-item" class="mainwp-show-history ui mini button"><?php esc_html_e( 'History', 'mainwp' ); ?></a>
452 + <?php if ( MainWP_Updates::user_can_ignore_updates() ) { ?>
453 + <div class="ui top left pointing dropdown mini button">
454 + <?php esc_html_e( 'Ignore', 'mainwp' ); ?><i class="dropdown icon"></i>
452 455 <div class="menu">
453 456 <a href="javascript:void(0)" class="mainwp-ignore-update-button item" onClick="return updatesoverview_themes_ignore_detail( '<?php echo esc_js( $theme_name ); ?>', '<?php echo esc_js( rawurlencode( $theme_upgrade['Name'] ) ); ?>', <?php echo intval( $website->id ); ?>, this, '<?php echo esc_js( rawurlencode( $last_version ) ); ?>' )"><?php esc_html_e( 'Ignore this version', 'mainwp' ); ?></a>
454 457 <a href="javascript:void(0)" class="item mainwp-ignore-globally-button" onClick="return updatesoverview_themes_ignore_all( '<?php echo esc_js( $theme_name ); ?>', '<?php echo esc_js( rawurlencode( $theme_upgrade['Name'] ) ); ?>', this, '<?php echo esc_js( rawurlencode( $last_version ) ); ?>' )"><?php esc_html_e( 'Ignore this version globally', 'mainwp' ); ?></a>
455 458 <a href="javascript:void(0)" class="mainwp-ignore-update-button item" onClick="return updatesoverview_themes_ignore_detail( '<?php echo esc_js( $theme_name ); ?>', '<?php echo esc_js( rawurlencode( $theme_upgrade['Name'] ) ); ?>', <?php echo intval( $website->id ); ?>, this, 'all_versions' )"><?php esc_html_e( 'Ignore all versions', 'mainwp' ); ?></a>
@@ -454,21 +457,14 @@
454 457 <a href="javascript:void(0)" class="item mainwp-ignore-globally-button" onClick="return updatesoverview_themes_ignore_all( '<?php echo esc_js( $theme_name ); ?>', '<?php echo esc_js( rawurlencode( $theme_upgrade['Name'] ) ); ?>', this, '<?php echo esc_js( rawurlencode( $last_version ) ); ?>' )"><?php esc_html_e( 'Ignore this version globally', 'mainwp' ); ?></a>
455 458 <a href="javascript:void(0)" class="mainwp-ignore-update-button item" onClick="return updatesoverview_themes_ignore_detail( '<?php echo esc_js( $theme_name ); ?>', '<?php echo esc_js( rawurlencode( $theme_upgrade['Name'] ) ); ?>', <?php echo intval( $website->id ); ?>, this, 'all_versions' )"><?php esc_html_e( 'Ignore all versions', 'mainwp' ); ?></a>
456 459 </div>
457 460 </div>
458 - </div>
461 + <?php } ?>
462 + <?php if ( MainWP_Updates::user_can_update_themes() ) : ?>
463 + <a href="javascript:void(0)" class="mainwp-update-now-button ui mini green button" onClick="return updatesoverview_themes_upgrade( '<?php echo esc_js( $theme_name ); ?>', <?php echo intval( $website->id ); ?> )"><?php esc_html_e( 'Update', 'mainwp' ); ?></a>
464 + <?php endif; ?>
465 + </td>
459 466 <?php } ?>
460 - <?php
461 - if ( MainWP_Updates::user_can_update_themes() ) {
462 - if ( $is_demo ) {
463 - MainWP_Demo_Handle::get_instance()->render_demo_disable_button( '<a href="javascript:void(0)" class="ui mini green button disabled" disabled="disabled">' . esc_html__( 'Update Now', 'mainwp' ) . '</a>' );
464 - } else {
465 - ?>
466 - <a href="javascript:void(0)" class="mainwp-update-now-button ui mini green button" onClick="return updatesoverview_themes_upgrade( '<?php echo esc_js( $theme_name ); ?>', <?php echo intval( $website->id ); ?> )"><?php esc_html_e( 'Update Now', 'mainwp' ); ?></a>
467 - <?php } ?>
468 - <?php } ?>
469 - </td>
470 - <?php } ?>
471 467 </tr>
472 468 <?php
473 469 }
474 470 ?>
@@ -477,22 +473,49 @@
477 473 </td>
478 474 </tr>
479 475 <?php } ?>
480 476 </tbody>
481 - <tfoot>
482 - <tr>
483 - <th scope="col" class="collapsing no-sort"></th>
484 - <th scope="col" ><?php esc_html_e( 'Theme', 'mainwp' ); ?></th>
485 - <th scope="col" ><?php echo intval( $total_theme_upgrades ) . ' ' . esc_html( _n( 'Update', 'Updates', $total_theme_upgrades, 'mainwp' ) ); ?></th>
486 - <th scope="col" ><?php esc_html_e( 'Trusted', 'mainwp' ); ?></th>
487 - <th scope="col" class="no-sort right aligned"></th>
488 - </tr>
489 - </tfoot>
490 477 </table>
478 + <?php else : ?>
479 + <?php MainWP_UI::render_empty_page_placeholder( __( 'Themes are up to date', 'mainwp' ), __( 'No theme updates available right now.', 'mainwp' ) ); ?>
480 + <?php endif; ?>
491 481 <?php
492 482 }
493 483
484 +
494 485 /**
486 + * Get the installed version of a theme for a website.
487 + *
488 + * @param object $website Website object containing installed themes.
489 + * @param string $slug Theme slug to look up.
490 + * @return string Installed theme version, or an empty string if not found.
491 + */
492 + public static function get_installed_theme_version( $website, $slug ) {
493 + static $site_themes = array();
494 +
495 + $siteid = is_object( $website ) && isset( $website->id ) ? (int) $website->id : 0;
496 +
497 + if ( $siteid && ! isset( $site_themes[ $siteid ] ) && ! empty( $website->themes ) ) {
498 + $themes = json_decode( $website->themes, true );
499 + $site_themes[ $siteid ] = $themes;
500 + }
501 +
502 + $installed_themes = $siteid && ! empty( $site_themes[ $siteid ] ) ? $site_themes[ $siteid ] : array();
503 +
504 + $current_ver = '';
505 + if ( is_array( $installed_themes ) ) {
506 + foreach ( $installed_themes as $installed_theme ) {
507 + if ( is_array( $installed_theme ) && isset( $installed_theme['slug'] ) && $installed_theme['slug'] === $slug ) {
508 + $current_ver = $installed_theme['version'] ?? '';
509 + break;
510 + }
511 + }
512 + }
513 +
514 + return $current_ver;
515 + }
516 +
517 + /**
495 518 * Method render_trans_update()
496 519 *
497 520 * Render translations updates
498 521 *
@@ -511,30 +534,33 @@
511 534 * @uses \MainWP\Dashboard\MainWP_Updates::get_continue_update_selector()
512 535 * @uses \MainWP\Dashboard\MainWP_Updates::render_site_link_dashboard()
513 536 */
514 537 public static function render_trans_update( $websites, $total_translation_upgrades, $userExtension, $allTranslations, $translationsInfo ) { // phpcs:ignore -- NOSONAR - complex.
515 - $is_demo = MainWP_Demo_Handle::is_demo_mode();
538 + $user_can_see_client = \mainwp_current_user_can( 'dashboard', 'manage_clients' );
539 + $trustedPlugins = ! empty( $userExtension->trusted_plugins ) ? json_decode( $userExtension->trusted_plugins, true ) : array();
540 + if ( ! is_array( $trustedPlugins ) ) {
541 + $trustedPlugins = array();
542 + }
543 +
544 + $trustedThemes = json_decode( $userExtension->trusted_themes, true );
545 + if ( ! is_array( $trustedThemes ) ) {
546 + $trustedThemes = array();
547 + }
516 548 ?>
517 - <table class="ui tablet stackable table mainwp-manage-updates-table main-master-checkbox" id="mainwp-translations-sites-table">
549 +
550 + <?php if ( 0 < $total_translation_upgrades ) : ?>
551 + <table class="ui tablet stackable table mainwp-manage-updates-table main-master-checkbox mainwp-js-persistent-table" id="mainwp-translations-sites-table">
518 552 <thead>
519 553 <tr>
520 554 <th scope="col" class="collapsing no-sort trigger-all-accordion"><span class="trigger-handle-arrow"><i class="caret right icon"></i><i class="caret down icon"></i></span></th>
521 - <th scope="col" class="eight wide indicator-accordion-sorting handle-accordion-sorting">
555 + <th scope="col" class="eight wide indicator-accordion-sorting handle-accordion-sorting" data-key="translation">
522 556 <div class="ui main-master checkbox ">
523 557 <input type="checkbox" name=""><label><?php esc_html_e( 'Translation', 'mainwp' ); ?></label>
524 558 </div>
525 559 <?php MainWP_UI::render_sorting_icons(); ?>
526 560 </th>
527 - <th scope="col" class="two wideindicator-accordion-sorting handle-accordion-sorting"><?php esc_html_e( 'Updates', 'mainwp' ); ?><?php MainWP_UI::render_sorting_icons(); ?></th>
528 - <th scope="col" class="six wide right aligned">
529 - <?php MainWP_UI::render_show_all_updates_button(); ?>
530 - <?php if ( MainWP_Updates::user_can_update_trans() ) { ?>
531 - <?php if ( 0 < $total_translation_upgrades ) { ?>
532 - <a href="javascript:void(0)" onClick="updatesoverview_translations_global_upgrade_all( false, true ); return false;" class="ui button mini basic green mainwp-update-selected-button" data-tooltip="<?php esc_html_e( 'Update selected translations', 'mainwp' ); ?>" data-inverted="" data-position="top right"><?php esc_html_e( 'Update Selected Translations', 'mainwp' ); ?></a>
533 - <a href="javascript:void(0)" onClick="updatesoverview_translations_global_upgrade_all(); return false;" class="ui button mini green mainwp-update-all-button" data-tooltip="<?php esc_html_e( 'Update all translations', 'mainwp' ); ?>" data-inverted="" data-position="top right"><?php esc_html_e( 'Update All Translations', 'mainwp' ); ?></a>
534 - <?php } ?>
535 - <?php } ?>
536 - </th>
561 + <th scope="col" class="two wide indicator-accordion-sorting handle-accordion-sorting" data-key="trusted"><?php esc_html_e( 'Updates', 'mainwp' ); ?><?php MainWP_UI::render_sorting_icons(); ?></th>
562 + <th scope="col" class="six wide right aligned"><?php MainWP_UI::render_show_all_updates_button(); ?></th>
537 563 </tr>
538 564 </thead>
539 565 <tbody id="translations-updates-global" class="ui accordion">
540 566 <?php foreach ( $allTranslations as $slug => $val ) { ?>
@@ -553,14 +579,10 @@
553 579 if ( 0 < $cnt ) {
554 580 if ( MAINWP_VIEW_PER_PLUGIN_THEME === (int) $userExtension->site_view ) {
555 581 MainWP_Updates::set_continue_update_html_selector( 'translations_upgrade_all', $slug );
556 582 }
557 - if ( $is_demo ) {
558 - MainWP_Demo_Handle::get_instance()->render_demo_disable_button( '<a href="javascript:void(0)" class="ui mini button green disabled mainwp-update-all-button" disabled="disabled">' . esc_html__( 'Update All', 'mainwp' ) . '</a>' );
559 - } else {
560 - ?>
583 + ?>
561 584 <a href="javascript:void(0)" class="mainwp-update-all-button ui mini button green <?php MainWP_Updates::get_continue_update_selector(); ?>" onClick="updatesoverview_translations_upgrade_all( '<?php echo esc_js( $slug ); ?>', '<?php echo esc_js( rawurlencode( $translationsInfo[ $slug ]['name'] ) ); ?>' ); return false;"><?php esc_html_e( 'Update All', 'mainwp' ); ?></a>
562 - <?php } ?>
563 585 <?php } ?>
564 586 <?php } ?>
565 587 </td>
566 588 </tr>
@@ -570,9 +592,12 @@
570 592 <thead class="mainwp-768-hide">
571 593 <tr>
572 594 <th scope="col"><?php esc_html_e( 'Website', 'mainwp' ); ?></th>
573 595 <th scope="col"><?php esc_html_e( 'Version', 'mainwp' ); ?></th>
596 + <th scope="col" ><?php esc_html_e( 'Trusted', 'mainwp' ); ?></th>
597 + <?php if ( $user_can_see_client ) { ?>
574 598 <th scope="col"><?php esc_html_e( 'Client', 'mainwp' ); ?></th>
599 + <?php } ?>
575 600 <th scope="col" class="collapsing no-sort"></th>
576 601 </tr>
577 602 </thead>
578 603 <tbody class="translations-bulk-updates" translation_slug="<?php echo esc_attr( $slug ); ?>" translation_name="<?php echo esc_attr( rawurlencode( $translationsInfo[ $slug ]['name'] ) ); ?>">
@@ -591,26 +616,29 @@
591 616 continue;
592 617 }
593 618 ?>
594 619 <tr site_id="<?php echo esc_attr( $website->id ); ?>" site_name="<?php echo esc_attr( rawurlencode( stripslashes( $website->name ) ) ); ?>" updated="0">
595 - <td>
596 - <div class="ui child checkbox">
597 - <input type="checkbox" name="">
598 - </div>
599 - <?php MainWP_Updates::render_site_link_dashboard( $website ); ?>
620 + <td class="middle aligned">
621 + <div class="ui child checkbox middle aligned fitted">
622 + <input type="checkbox" name="">
623 + </div>
624 + <span class="ui middle aligned fitted" >
625 + <?php MainWP_Updates::render_site_link_dashboard( $website ); ?>
626 + </span>
600 627 </td>
601 628 <td><strong class="mainwp-768-show"><?php esc_html_e( 'Version:', 'mainwp' ); ?></strong> <?php echo esc_html( $translation_upgrade['version'] ); ?></td>
629 + <?php
630 + // trusted column.
631 + $is_trust = MainWP_Manage_Sites_Update_View::is_trans_trusted_update( $translation_upgrade, $trustedPlugins, $trustedThemes );
632 + echo MainWP_Manage_Sites_Update_View::get_column_trusted($is_trust ); //phpcs:ignore -- NOSONAR - escaped.
633 + ?>
634 + <?php if ( $user_can_see_client ) { ?>
602 635 <td><a href="<?php echo 'admin.php?page=ManageClients&client_id=' . intval( $website->client_id ); ?>" data-tooltip="<?php esc_attr_e( 'Jump to the client', 'mainwp' ); ?>" data-position="right center" data-inverted="" ><?php echo esc_html( $website->client_name ); ?></a></td>
636 + <?php } ?>
603 637 <td class="right aligned">
604 - <?php
605 - if ( MainWP_Updates::user_can_update_trans() ) {
606 - if ( $is_demo ) {
607 - MainWP_Demo_Handle::get_instance()->render_demo_disable_button( '<a href="javascript:void(0)" class="ui green button mini disabled" disabled="disabled">' . esc_html__( 'Update Now', 'mainwp' ) . '</a>' );
608 - } else {
609 - ?>
610 - <a href="javascript:void(0)" class="mainwp-update-now-button ui green mini button" onClick="return updatesoverview_upgrade_translation( <?php echo esc_attr( $website->id ); ?>, '<?php echo esc_js( $slug ); ?>' )"><?php esc_html_e( 'Update Now', 'mainwp' ); ?></a>
611 - <?php } ?>
612 - <?php } ?>
638 + <?php if ( MainWP_Updates::user_can_update_trans() ) : ?>
639 + <a href="javascript:void(0)" class="mainwp-update-now-button ui green mini button" onClick="return updatesoverview_upgrade_translation( <?php echo esc_attr( $website->id ); ?>, '<?php echo esc_js( $slug ); ?>' )"><?php esc_html_e( 'Update', 'mainwp' ); ?></a>
640 + <?php endif; ?>
613 641 </td>
614 642 </tr>
615 643 <?php
616 644 }
@@ -620,22 +648,12 @@
620 648 </td>
621 649 </tr>
622 650 <?php } ?>
623 651 </tbody>
624 - <tfoot>
625 - <tr>
626 - <th scope="col" class="collapsing no-sort"></th>
627 - <th scope="col" >
628 - <div class="ui main-master checkbox ">
629 - <input type="checkbox" name=""><label><?php esc_html_e( 'Translation', 'mainwp' ); ?></label>
630 - </div>
631 -
632 - </th>
633 - <th scope="col" ><?php esc_html_e( 'Updates', 'mainwp' ); ?></th>
634 - <th scope="col" class="right aligned"></th>
635 - </tr>
636 - </tfoot>
637 652 </table>
653 + <?php else : ?>
654 + <?php MainWP_UI::render_empty_page_placeholder( __( 'Translations are up to date', 'mainwp' ), __( 'No translation updates available right now.', 'mainwp' ) ); ?>
655 + <?php endif; ?>
638 656 <?php
639 657 }
640 658
641 659 /**
@@ -643,9 +661,9 @@
643 661 *
644 662 * Render abandoned plugins
645 663 *
646 664 * @param object $websites the websites.
647 - * @param array $allPluginsOutdate all abandoned plugins.
665 + * @param array $allPluginsOutdate All abandoned plugins.
648 666 * @param array $decodedDismissedPlugins all dismissed abandoned plugins.
649 667 *
650 668 * @throws \MainWP_Exception Error message.
651 669 *
@@ -657,20 +675,21 @@
657 675 * @uses \MainWP\Dashboard\MainWP_Updates::user_can_ignore_updates()
658 676 * @uses \MainWP\Dashboard\MainWP_Updates::render_site_link_dashboard()
659 677 */
660 678 public static function render_abandoned_plugins( $websites, $allPluginsOutdate, $decodedDismissedPlugins ) { // phpcs:ignore -- NOSONAR - complex.
661 - $str_format = esc_html__( 'Updated %s days ago', 'mainwp' );
679 + // translators: %s is the number of days since the plugin was last updated.
680 + $str_format = esc_html__( 'Updated %s days ago', 'mainwp' );
681 + $count_abandoned = count( $allPluginsOutdate );
662 682 ?>
663 - <table class="ui tablet stackable table mainwp-manage-updates-table" id="mainwp-abandoned-plugins-items-table">
683 + <?php if ( 0 < $count_abandoned ) : ?>
684 + <table class="ui tablet stackable table mainwp-manage-updates-table mainwp-js-persistent-table" id="mainwp-abandoned-plugins-items-table">
664 685 <thead>
665 686 <tr>
666 687 <th scope="col" class="collapsing no-sort trigger-all-accordion"><span class="trigger-handle-arrow"><i class="caret right icon"></i><i class="caret down icon"></i></span></th>
667 688 <th scope="col" class="no-sort"></th>
668 - <th scope="col" class="indicator-accordion-sorting handle-accordion-sorting"><?php esc_html_e( 'Plugin', 'mainwp' ); ?><?php MainWP_UI::render_sorting_icons(); ?></th>
669 - <th scope="col" class="indicator-accordion-sorting handle-accordion-sorting"><?php esc_html_e( 'Abandoned', 'mainwp' ); ?><?php MainWP_UI::render_sorting_icons(); ?></th>
670 - <th scope="col" class="collapsing no-sort">
671 - <?php MainWP_UI::render_show_all_updates_button(); ?>
672 - </th>
689 + <th scope="col" class="indicator-accordion-sorting handle-accordion-sorting" data-key="plugin"><?php esc_html_e( 'Plugin', 'mainwp' ); ?><?php MainWP_UI::render_sorting_icons(); ?></th>
690 + <th scope="col" class="indicator-accordion-sorting handle-accordion-sorting" data-key="abandoned"><?php esc_html_e( 'Abandoned', 'mainwp' ); ?><?php MainWP_UI::render_sorting_icons(); ?></th>
691 + <th scope="col" class="collapsing no-sort"><?php MainWP_UI::render_show_all_updates_button(); ?></th>
673 692 </tr>
674 693 </thead>
675 694 <tbody class="ui accordion">
676 695 <?php foreach ( $allPluginsOutdate as $slug => $val ) { ?>
@@ -758,18 +777,12 @@
758 777 </td>
759 778 </tr>
760 779 <?php } ?>
761 780 </tbody>
762 - <tfoot>
763 - <tr>
764 - <th scope="col" class="collapsing no-sort trigger-all-accordion"><span class="trigger-handle-arrow"><i class="caret right icon"></i><i class="caret down icon"></i></span></th>
765 - <th scope="col" class="no-sort"></th>
766 - <th scope="col" class="indicator-accordion-sorting handle-accordion-sorting"><?php esc_html_e( 'Plugin', 'mainwp' ); ?><?php MainWP_UI::render_sorting_icons(); ?></th>
767 - <th scope="col" class="indicator-accordion-sorting handle-accordion-sorting"><?php esc_html_e( 'Abandoned', 'mainwp' ); ?><?php MainWP_UI::render_sorting_icons(); ?></th>
768 - <th scope="col" class="collapsing no-sort"></th>
769 - </tr>
770 - </tfoot>
771 781 </table>
782 + <?php else : ?>
783 + <?php MainWP_UI::render_empty_page_placeholder( __( 'No abandoned plugins detected', 'mainwp' ), __( 'None of your plugins are currently marked as abandoned.', 'mainwp' ) ); ?>
784 + <?php endif; ?>
772 785 <?php
773 786 }
774 787
775 788 /**
@@ -789,16 +802,19 @@
789 802 * @uses \MainWP\Dashboard\MainWP_Updates::user_can_ignore_updates()
790 803 * @uses \MainWP\Dashboard\MainWP_Updates::render_site_link_dashboard()
791 804 */
792 805 public static function render_abandoned_themes( $websites, $allThemesOutdate, $decodedDismissedThemes ) { // phpcs:ignore -- NOSONAR - complex.
793 - $str_format = esc_html__( 'Updated %s days ago', 'mainwp' );
806 + // translators: %s is the number of days since the theme was last updated.
807 + $str_format = esc_html__( 'Updated %s days ago', 'mainwp' );
808 + $count_abandoned = count( $allThemesOutdate );
794 809 ?>
795 - <table class="ui tablet stackable table mainwp-manage-updates-table" id="mainwp-themes-updates-table">
810 + <?php if ( 0 < $count_abandoned ) : ?>
811 + <table class="ui tablet stackable table mainwp-manage-updates-table mainwp-js-persistent-table mainwp-themes-updates-items-table" id="mainwp-themes-abandoned-updates-table">
796 812 <thead>
797 813 <tr>
798 814 <th scope="col" class="collapsing no-sort trigger-all-accordion"><span class="trigger-handle-arrow"><i class="caret right icon"></i><i class="caret down icon"></i></span></th>
799 - <th scope="col" scope="col" class="indicator-accordion-sorting handle-accordion-sorting"><?php esc_html_e( 'Theme', 'mainwp' ); ?><?php MainWP_UI::render_sorting_icons(); ?></th>
800 - <th scope="col" class="indicator-accordion-sorting handle-accordion-sorting"><?php esc_html_e( 'Abandoned', 'mainwp' ); ?><?php MainWP_UI::render_sorting_icons(); ?></th>
815 + <th scope="col" scope="col" class="indicator-accordion-sorting handle-accordion-sorting" data-key="theme"><?php esc_html_e( 'Theme', 'mainwp' ); ?><?php MainWP_UI::render_sorting_icons(); ?></th>
816 + <th scope="col" class="indicator-accordion-sorting handle-accordion-sorting" data-key="abandoned"><?php esc_html_e( 'Abandoned', 'mainwp' ); ?><?php MainWP_UI::render_sorting_icons(); ?></th>
801 817 <th scope="col" class="collapsing no-sort">
802 818 <?php MainWP_UI::render_show_all_updates_button(); ?>
803 819 </th>
804 820 </tr>
@@ -887,16 +903,11 @@
887 903 </td>
888 904 </tr>
889 905 <?php } ?>
890 906 </tbody>
891 - <tfoot>
892 - <tr>
893 - <th scope="col" class="collapsing no-sort"></th>
894 - <th scope="col" ><?php esc_html_e( 'Theme', 'mainwp' ); ?></th>
895 - <th scope="col" ><?php esc_html_e( 'Abandoned', 'mainwp' ); ?></th>
896 - <th scope="col" class="collapsing no-sort"></th>
897 - </tr>
898 - </tfoot>
899 907 </table>
908 + <?php else : ?>
909 + <?php MainWP_UI::render_empty_page_placeholder( __( 'No abandoned themes detected', 'mainwp' ), __( 'None of your themes are currently marked as abandoned.', 'mainwp' ) ); ?>
910 + <?php endif; ?>
900 911 <?php
901 912 }
902 913 }