PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / trunk
MainWP Dashboard: Self-hosted WordPress Management for Agencies vtrunk
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 5.2.2 5.3 All 153 releases
← All changes | widgets/widget-mainwp-widget-plugins.php +42 -15 5.3trunk View file →
@@ -8,8 +8,13 @@
8 8 */
9 9
10 10 namespace MainWP\Dashboard;
11 11
12 +// Exit if accessed directly.
13 +if ( ! defined( 'ABSPATH' ) ) {
14 + exit;
15 +}
16 +
12 17 /**
13 18 * Class MainWP_Widget_Plugins
14 19 */
15 20 class MainWP_Widget_Plugins { // phpcs:ignore Generic.Classes.OpeningBraceSameLine.ContentAfterBrace -- NOSONAR.
@@ -119,12 +124,23 @@
119 124
120 125 $inactive_plugins = MainWP_Utility::get_sub_array_having( $allPlugins, 'active', 0 );
121 126 $inactive_plugins = MainWP_Utility::sortmulti( $inactive_plugins, 'name', 'asc' );
122 127
128 + $wp_info = MainWP_DB::instance()->get_website_option( $website, 'site_info' );
129 + $wp_info = ! empty( $wp_info ) ? json_decode( $wp_info, true ) : array();
130 +
131 + if ( ! is_array( $wp_info ) ) {
132 + $wp_info = array();
133 + }
134 +
135 + $use_tzformat = ! empty( $wp_info['format_datetime'] ) && is_array( $wp_info['format_datetime'] ) ? $wp_info['format_datetime'] : array();
136 + $offs = ! empty( $use_tzformat['gmt_offset'] ) ? intval( $use_tzformat['gmt_offset'] ) : 0;
137 + $offs_info = esc_html__( ' - Timezone:', 'mainwp' ) . ' UTC' . ( $offs >= 0 ? '+' . $offs : $offs );
138 +
123 139 ?>
124 140 <div class="ui grid mainwp-widget-header">
125 141 <div class="twelve wide column">
126 - <h3 class="ui header handle-drag">
142 + <h2 class="ui header handle-drag">
127 143 <?php
128 144 /**
129 145 * Filter: mainwp_plugins_widget_title
130 146 *
@@ -136,9 +152,9 @@
136 152 */
137 153 echo esc_html( apply_filters( 'mainwp_plugins_widget_title', esc_html__( 'Plugins', 'mainwp' ), $website ) );
138 154 ?>
139 155 <div class="sub header"><?php esc_html_e( 'Installed plugins on the child site', 'mainwp' ); ?></div>
140 - </h3>
156 + </h2>
141 157 </div>
142 158 <div class="four wide column right aligned">
143 159 <div class="ui dropdown right pointing mainwp-dropdown-tab">
144 160 <i class="vertical ellipsis icon"></i>
@@ -161,10 +177,11 @@
161 177 *
162 178 * @since 4.1
163 179 */
164 180 do_action( 'mainwp_plugins_widget_top', $website, $allPlugins );
181 + $site_info = $website->name . ' (' . $website->url . ') ' . ( ! empty( $offs_info ) ? $offs_info : '' );
165 182 ?>
166 - <div id="mainwp-widget-active-plugins" class="ui tab active" data-tab="active_plugins">
183 + <div id="mainwp-widget-active-plugins" class="ui tab active" data-tab="active_plugins" site-info="<?php echo esc_attr( $site_info ); ?>" site-id="<?php echo intval( $website->id ); ?>">
167 184 <?php
168 185 /**
169 186 * Action: mainwp_before_active_plugins_list
170 187 *
@@ -182,26 +199,33 @@
182 199 $_count = count( $actived_plugins );
183 200 for ( $i = 0; $i < $_count; $i++ ) {
184 201 $slug = wp_strip_all_tags( $actived_plugins[ $i ]['slug'] );
185 202 $plugin_directory = dirname( $slug );
203 + $plugin_name = $actived_plugins[ $i ]['name'];
204 + $plugin_title = $plugin_name . ' ' . $actived_plugins[ $i ]['version'];
186 205 ?>
187 - <div class="item <?php echo esc_html( dirname( $slug ) ); ?> row-manage-item">
206 + <div class="item <?php echo esc_html( dirname( $slug ) ); ?> row-manage-item" plugin-title="<?php echo esc_attr( $plugin_title ); ?>" plugin-name="<?php echo esc_attr( $plugin_name ); ?>" plugin-slug="<?php echo esc_attr( $slug ); ?>">
188 207 <input class="pluginSlug" type="hidden" name="slug" value="<?php echo esc_attr( wp_strip_all_tags( $actived_plugins[ $i ]['slug'] ) ); ?>"/>
189 208 <input class="websiteId" type="hidden" name="id" value="<?php echo esc_attr( $website->id ); ?>"/>
190 209 <div class="right floated pluginsAction">
191 - <?php if ( \mainwp_current_user_can( 'dashboard', 'activate_deactivate_plugins' ) ) { ?>
192 - <div class="ui right pointing dropdown icon mini button">
193 - <i class="ellipsis horizontal icon"></i>
210 + <div class="ui right pointing dropdown">
211 + <i class="ellipsis vertical icon"></i>
194 212 <div class="menu">
213 + <?php if ( \mainwp_current_user_can( 'dashboard', 'activate_deactivate_plugins' ) ) { ?>
195 214 <div class="mainwp-plugin-deactivate item <?php echo $is_demo ? 'disabled' : ''; ?>"><?php esc_html_e( 'Deactivate', 'mainwp' ); ?></div>
215 + <?php } ?>
216 + <?php if ( \mainwp_current_user_can( 'dashboard', 'delete_plugins' ) ) { ?>
217 + <a href="#" class="mainwp-plugin-delete item <?php echo $is_demo ? 'disabled' : ''; ?>"><?php esc_html_e( 'Delete', 'mainwp' ); // phpcs:ignore WordPress.Security.EscapeOutput ?></a>
218 + <?php } ?>
219 + <a href="#" history-view="widget-plugins" class="mainwp-show-history item <?php echo $is_demo ? 'disabled' : ''; ?>"><?php esc_html_e( 'History', 'mainwp' ); ?></a>
196 220 </div>
197 221 </div>
198 - <?php } ?>
222 +
199 223 </div>
200 224 <div class="middle aligned content">
201 225 <?php echo MainWP_System_Utility::get_plugin_icon( $plugin_directory ); // phpcs:ignore WordPress.Security.EscapeOutput ?>&nbsp;&nbsp;&nbsp;&nbsp;
202 226 <a href="<?php echo esc_url( admin_url() . 'plugin-install.php?tab=plugin-information&wpplugin=' . intval( $website->id ) . '&plugin=' . esc_html( dirname( wp_strip_all_tags( $actived_plugins[ $i ]['slug'] ) ) ) ); ?>" target="_blank" class="open-plugin-details-modal" title="More information about <?php echo wp_strip_all_tags( $actived_plugins[ $i ]['name'] ); // phpcs:ignore WordPress.Security.EscapeOutput ?>">
203 - <?php echo esc_html( $actived_plugins[ $i ]['name'] . ' ' . $actived_plugins[ $i ]['version'] ); ?>
227 + <?php echo esc_html( $plugin_title ); ?>
204 228 </a>
205 229 </div>
206 230 <div class="mainwp-row-actions-working">
207 231 <i class="notched circle loading icon"></i> <?php esc_html_e( 'Please wait...', 'mainwp' ); ?>
@@ -236,21 +260,23 @@
236 260 * @since 4.1
237 261 */
238 262 do_action( 'mainwp_before_inactive_plugins_list', $website, $inactive_plugins );
239 263 ?>
240 - <div class="ui middle aligned divided selection list">
264 + <div class="ui middle aligned divided list">
241 265 <?php
242 266 $_count = count( $inactive_plugins );
243 267 for ( $i = 0; $i < $_count; $i++ ) {
244 268 $slug = $inactive_plugins[ $i ]['slug'];
245 269 $plugin_directory = dirname( $slug );
270 + $plugin_name = $inactive_plugins[ $i ]['name'];
271 + $plugin_title = $plugin_name . ' ' . $inactive_plugins[ $i ]['version'];
246 272 ?>
247 - <div class="item <?php echo esc_html( sanitize_text_field( dirname( $slug ) ) ); ?> row-manage-item">
273 + <div class="item <?php echo esc_html( sanitize_text_field( dirname( $slug ) ) ); ?> row-manage-item" plugin-title="<?php echo esc_attr( $plugin_title ); ?>" plugin-name="<?php echo esc_attr( $plugin_name ); ?>" plugin-slug="<?php echo esc_attr( $slug ); ?>">
248 274 <input class="pluginSlug" type="hidden" name="slug" value="<?php echo esc_attr( wp_strip_all_tags( $inactive_plugins[ $i ]['slug'] ) ); ?>"/>
249 275 <input class="websiteId" type="hidden" name="id" value="<?php echo esc_attr( $website->id ); ?>"/>
250 276 <div class="right floated content pluginsAction">
251 - <div class="ui right pointing dropdown icon mini button">
252 - <i class="ellipsis horizontal icon"></i>
277 + <div class="ui right pointing dropdown">
278 + <i class="ellipsis vertical icon"></i>
253 279 <div class="menu">
254 280 <?php if ( \mainwp_current_user_can( 'dashboard', 'activate_deactivate_plugins' ) ) { ?>
255 281 <a href="#" class="mainwp-plugin-activate item <?php echo $is_demo ? 'disabled' : ''; ?>"><?php esc_html_e( 'Activate', 'mainwp' );// phpcs:ignore WordPress.Security.EscapeOutput ?></a>
256 282 <?php } ?>
@@ -256,8 +282,9 @@
256 282 <?php } ?>
257 283 <?php if ( \mainwp_current_user_can( 'dashboard', 'delete_plugins' ) ) { ?>
258 284 <a href="#" class="mainwp-plugin-delete item <?php echo $is_demo ? 'disabled' : ''; ?>"><?php esc_html_e( 'Delete', 'mainwp' ); // phpcs:ignore WordPress.Security.EscapeOutput ?></a>
259 285 <?php } ?>
286 + <a href="#" history-view="widget-plugins" class="mainwp-show-history item <?php echo $is_demo ? 'disabled' : ''; ?>"><?php esc_html_e( 'History', 'mainwp' ); ?></a>
260 287 </div>
261 288 </div>
262 289 </div>
263 290 <div class="middle aligned content">
@@ -262,9 +289,9 @@
262 289 </div>
263 290 <div class="middle aligned content">
264 291 <?php echo MainWP_System_Utility::get_plugin_icon( $plugin_directory ); // phpcs:ignore WordPress.Security.EscapeOutput ?>&nbsp;&nbsp;&nbsp;&nbsp;
265 292 <a href="<?php echo esc_url( admin_url() . 'plugin-install.php?tab=plugin-information&wpplugin=' . intval( $website->id ) . '&plugin=' . esc_html( dirname( $inactive_plugins[ $i ]['slug'] ) ) ); ?>" target="_blank" class="open-plugin-details-modal" title="More information about <?php echo wp_strip_all_tags( $inactive_plugins[ $i ]['name'] ); // phpcs:ignore WordPress.Security.EscapeOutput ?>">
266 - <?php echo esc_html( $inactive_plugins[ $i ]['name'] . ' ' . $inactive_plugins[ $i ]['version'] ); ?>
293 + <?php echo esc_html( $plugin_title ); ?>
267 294 </a>
268 295 </div>
269 296 <div class="mainwp-row-actions-working">
270 297 <i class="ui active inline loader tiny"></i> <?php esc_html_e( 'Please wait...', 'mainwp' ); ?>
@@ -289,9 +316,9 @@
289 316 </div>
290 317 <div class="ui two column grid mainwp-widget-footer">
291 318 <div class="left aligned middle aligned column"></div>
292 319 <div class="right aligned middle aligned column">
293 - <a href="admin.php?page=PluginsManage"><?php esc_html_e( 'Manage Plugins', 'mainwp' ); ?></a>
320 + <a href="admin.php?page=PluginsManage" class="ui mini basic button"><?php esc_html_e( 'Manage Plugins', 'mainwp' ); ?></a>
294 321 </div>
295 322 </div>
296 323 <?php
297 324 /**