| 1 |
<?php |
| 2 |
/** |
| 3 |
* MainWP Updates Page. |
| 4 |
* |
| 5 |
* @package MainWP/Dashboard |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace MainWP\Dashboard; |
| 9 |
|
| 10 |
// Exit if accessed directly. |
| 11 |
if ( ! defined( 'ABSPATH' ) ) { |
| 12 |
exit; |
| 13 |
} |
| 14 |
|
| 15 |
/** |
| 16 |
* Class MainWP_Updates |
| 17 |
* |
| 18 |
* @package MainWP\Dashboard |
| 19 |
*/ |
| 20 |
class MainWP_Updates { // phpcs:ignore Generic.Classes.OpeningBraceSameLine.ContentAfterBrace -- NOSONAR. |
| 21 |
|
| 22 |
/** |
| 23 |
* User can ignore updates. |
| 24 |
* |
| 25 |
* @var bool $user_can_ignore_updates User can ignore updates. |
| 26 |
*/ |
| 27 |
public static $user_can_ignore_updates = null; |
| 28 |
|
| 29 |
/** |
| 30 |
* User can update translations. |
| 31 |
* |
| 32 |
* @var bool $user_can_update_trans User can update translations. |
| 33 |
*/ |
| 34 |
public static $user_can_update_trans = null; |
| 35 |
|
| 36 |
/** |
| 37 |
* User can update WordPress core files. |
| 38 |
* |
| 39 |
* @var bool $user_can_update_wp User can update WordPress core files. |
| 40 |
*/ |
| 41 |
public static $user_can_update_wp = null; |
| 42 |
|
| 43 |
/** |
| 44 |
* User can update themes. |
| 45 |
* |
| 46 |
* @var bool $user_can_update_themes User can update themes. |
| 47 |
*/ |
| 48 |
public static $user_can_update_themes = null; |
| 49 |
|
| 50 |
/** |
| 51 |
* User can update plugins. |
| 52 |
* |
| 53 |
* @var bool $user_can_update_plugins User can update plugins. |
| 54 |
*/ |
| 55 |
public static $user_can_update_plugins = null; |
| 56 |
|
| 57 |
/** |
| 58 |
* Placeholder for continue selector. |
| 59 |
* |
| 60 |
* @var string $continue_selector Placeholder for continue selector. |
| 61 |
*/ |
| 62 |
public static $continue_selector = ''; |
| 63 |
|
| 64 |
/** |
| 65 |
* Placeholder for continue update. |
| 66 |
* |
| 67 |
* @var string $continue_update Placeholder for continue update. |
| 68 |
*/ |
| 69 |
public static $continue_update = ''; |
| 70 |
|
| 71 |
/** |
| 72 |
* Placeholder for continue update slug. |
| 73 |
* |
| 74 |
* @var string $continue_update_slug Placeholder for continue update slug. |
| 75 |
*/ |
| 76 |
public static $continue_update_slug = ''; |
| 77 |
|
| 78 |
/** |
| 79 |
* Cached ignored updates counts. |
| 80 |
* |
| 81 |
* @var array $ignored_updates_counts Cached ignored updates counts. |
| 82 |
*/ |
| 83 |
public static $ignored_updates_counts = array(); |
| 84 |
|
| 85 |
/** |
| 86 |
* Public static varable to hold Subpages information. |
| 87 |
* |
| 88 |
* @var array $subPages |
| 89 |
*/ |
| 90 |
public static $subPages; |
| 91 |
|
| 92 |
/** |
| 93 |
* Current page. |
| 94 |
* |
| 95 |
* @static |
| 96 |
* @var string $page Current page. |
| 97 |
*/ |
| 98 |
public static $page; |
| 99 |
|
| 100 |
/** |
| 101 |
* Gets Class Name. |
| 102 |
* |
| 103 |
* @return object |
| 104 |
*/ |
| 105 |
public static function get_class_name() { |
| 106 |
return __CLASS__; |
| 107 |
} |
| 108 |
|
| 109 |
/** |
| 110 |
* Instantiates MainWP Updates Page. |
| 111 |
* |
| 112 |
* @uses \MainWP\Dashboard\MainWP_Post::get_class_name() |
| 113 |
*/ |
| 114 |
public static function init() { |
| 115 |
/** |
| 116 |
* This hook allows you to render the Post page header via the 'mainwp-pageheader-updates' action. |
| 117 |
* |
| 118 |
* This hook is normally used in the same context of 'mainwp-getsubpages-updates' |
| 119 |
* |
| 120 |
* @see \MainWP_Updates::render_header |
| 121 |
*/ |
| 122 |
add_action( 'mainwp-pageheader-updates', array( MainWP_Post::get_class_name(), 'render_header' ) ); |
| 123 |
|
| 124 |
/** |
| 125 |
* This hook allows you to render the Updates page footer via the 'mainwp-pagefooter-updates' action. |
| 126 |
* |
| 127 |
* This hook is normally used in the same context of 'mainwp-getsubpages-updates' |
| 128 |
* |
| 129 |
* @see \MainWP_Updates::render_footer |
| 130 |
*/ |
| 131 |
add_action( 'mainwp-pagefooter-updates', array( MainWP_Post::get_class_name(), 'render_footer' ) ); |
| 132 |
|
| 133 |
add_action( 'mainwp_help_sidebar_content', array( static::get_class_name(), 'mainwp_help_content' ) ); |
| 134 |
add_action( 'admin_init', array( static::get_class_name(), 'admin_init' ) ); |
| 135 |
} |
| 136 |
|
| 137 |
/** |
| 138 |
* Init method. |
| 139 |
*/ |
| 140 |
public static function admin_init() { |
| 141 |
static::handle_post_staging_sites_view(); |
| 142 |
} |
| 143 |
|
| 144 |
/** |
| 145 |
* Renders init updates menu. |
| 146 |
* |
| 147 |
* @uses \MainWP\Dashboard\MainWP_Menu::add_left_menu() |
| 148 |
*/ |
| 149 |
public static function init_menu() { |
| 150 |
static::init_left_menu( static::$subPages ); |
| 151 |
add_action( 'load-' . static::$page, array( static::get_class_name(), 'on_load_page' ) ); |
| 152 |
} |
| 153 |
|
| 154 |
/** |
| 155 |
* Initiates Updates menu. |
| 156 |
* |
| 157 |
* @param array $subPages Sub pages array. |
| 158 |
* |
| 159 |
* @uses \MainWP\Dashboard\MainWP_Menu::add_left_menu() |
| 160 |
* @uses \MainWP\Dashboard\MainWP_Menu::init_subpages_left_menu() |
| 161 |
* @uses \MainWP\Dashboard\MainWP_Menu::is_disable_menu_item() |
| 162 |
*/ |
| 163 |
public static function init_left_menu( $subPages = array() ) { |
| 164 |
static::$page = add_submenu_page( |
| 165 |
'mainwp_tab', |
| 166 |
__( 'Updates', 'mainwp' ), |
| 167 |
'<span id="mainwp-Updates">' . esc_html__( 'Updates', 'mainwp' ) . '</span>', |
| 168 |
'read', |
| 169 |
'UpdatesManage', |
| 170 |
array( |
| 171 |
static::get_class_name(), |
| 172 |
'render', |
| 173 |
) |
| 174 |
); |
| 175 |
|
| 176 |
$updates_count = MainWP_Common_Handler::instance()->sites_available_updates_count(); |
| 177 |
|
| 178 |
$label_color_plugins = ''; |
| 179 |
$label_color_themes = ''; |
| 180 |
$label_color_wp = ''; |
| 181 |
$label_color_translations = ''; |
| 182 |
$label_color_total = ''; |
| 183 |
|
| 184 |
if ( isset( $updates_count['plugins'] ) && 0 < $updates_count['plugins'] ) { |
| 185 |
$label_color_plugins = 'green'; |
| 186 |
} |
| 187 |
|
| 188 |
if ( isset( $updates_count['wp'] ) && 0 < $updates_count['wp'] ) { |
| 189 |
$label_color_wp = 'green'; |
| 190 |
} |
| 191 |
|
| 192 |
if ( isset( $updates_count['themes'] ) && 0 < $updates_count['themes'] ) { |
| 193 |
$label_color_themes = 'green'; |
| 194 |
} |
| 195 |
|
| 196 |
if ( isset( $updates_count['translations'] ) && 0 < $updates_count['translations'] ) { |
| 197 |
$label_color_translations = 'green'; |
| 198 |
} |
| 199 |
|
| 200 |
if ( isset( $updates_count['total'] ) && 0 < $updates_count['total'] ) { |
| 201 |
$label_color_total = 'green'; |
| 202 |
} |
| 203 |
|
| 204 |
MainWP_Menu::add_left_menu( |
| 205 |
array( |
| 206 |
'title' => esc_html__( 'Updates', 'mainwp' ) . ' <span class="ui ' . $label_color_total . ' mini label">' . intval( $updates_count['total'] ) . '</span>', |
| 207 |
'parent_key' => 'managesites', |
| 208 |
'slug' => 'UpdatesManage', |
| 209 |
'href' => 'admin.php?page=UpdatesManage', |
| 210 |
'icon' => '<i class="sync icon"></i>', |
| 211 |
'desc' => 'Manage updates on your child sites', |
| 212 |
'leftsub_order' => 4, |
| 213 |
), |
| 214 |
1 |
| 215 |
); |
| 216 |
|
| 217 |
$init_sub_subleftmenu = array( |
| 218 |
array( |
| 219 |
'title' => esc_html__( 'Plugins', 'mainwp' ) . ' <span class="ui ' . $label_color_plugins . ' tiny label">' . intval( $updates_count['plugins'] ) . '</span>', |
| 220 |
'parent_key' => 'UpdatesManage', |
| 221 |
'href' => 'admin.php?page=UpdatesManage&tab=plugins-updates', |
| 222 |
'slug' => 'UpdatesManage', |
| 223 |
'right' => '', |
| 224 |
), |
| 225 |
array( |
| 226 |
'title' => esc_html__( 'Themes', 'mainwp' ) . ' <span class="ui ' . $label_color_themes . ' tiny label">' . intval( $updates_count['themes'] ) . '</span>', |
| 227 |
'parent_key' => 'UpdatesManage', |
| 228 |
'href' => 'admin.php?page=UpdatesManage&tab=themes-updates', |
| 229 |
'slug' => 'UpdatesManage', |
| 230 |
'right' => '', |
| 231 |
), |
| 232 |
array( |
| 233 |
'title' => esc_html__( 'WordPress', 'mainwp' ) . ' <span class="ui ' . $label_color_wp . ' tiny label">' . intval( $updates_count['wp'] ) . '</span>', |
| 234 |
'parent_key' => 'UpdatesManage', |
| 235 |
'href' => 'admin.php?page=UpdatesManage&tab=wordpress-updates', |
| 236 |
'slug' => 'UpdatesManage&tab=wordpress-updates', |
| 237 |
'right' => '', |
| 238 |
'active_params' => array( 'tab' => 'updates-ignore' ), |
| 239 |
), |
| 240 |
array( |
| 241 |
'title' => esc_html__( 'Updates Ignore', 'mainwp' ), |
| 242 |
'parent_key' => 'UpdatesManage', |
| 243 |
'slug' => 'UpdatesManage&tab=updates-ignore', |
| 244 |
'href' => '', // fix warning. |
| 245 |
'menu_hidden' => true, |
| 246 |
), |
| 247 |
); |
| 248 |
|
| 249 |
$show_language_updates = get_option( 'mainwp_show_language_updates', 1 ); |
| 250 |
if ( $show_language_updates ) { |
| 251 |
$init_sub_subleftmenu[] = array( |
| 252 |
'title' => esc_html__( 'Translation', 'mainwp' ) . ' <span class="ui ' . $label_color_translations . ' tiny label">' . intval( $updates_count['translations'] ) . '</span>', |
| 253 |
'parent_key' => 'UpdatesManage', |
| 254 |
'href' => 'admin.php?page=UpdatesManage&tab=translations-updates', |
| 255 |
'slug' => 'UpdatesManage&tab=translations-updates', |
| 256 |
'right' => '', |
| 257 |
); |
| 258 |
} |
| 259 |
|
| 260 |
$init_sub_subleftmenu = apply_filters( 'mainwp_sub_leftmenu_updates', $init_sub_subleftmenu ); |
| 261 |
|
| 262 |
MainWP_Menu::init_subpages_left_menu( $subPages, $init_sub_subleftmenu, 'UpdatesManage', 'UpdatesManage' ); |
| 263 |
|
| 264 |
foreach ( $init_sub_subleftmenu as $item ) { |
| 265 |
if ( MainWP_Menu::is_disable_menu_item( 3, $item['slug'] ) ) { |
| 266 |
continue; |
| 267 |
} |
| 268 |
MainWP_Menu::add_left_menu( $item, 2 ); |
| 269 |
} |
| 270 |
} |
| 271 |
|
| 272 |
/** |
| 273 |
* Method on_load_page() |
| 274 |
* |
| 275 |
* Run on page load. |
| 276 |
*/ |
| 277 |
public static function on_load_page() { |
| 278 |
add_filter( 'mainwp_header_actions_right', array( static::get_class_name(), 'screen_options' ), 10, 2 ); |
| 279 |
} |
| 280 |
|
| 281 |
/** |
| 282 |
* Method screen_options() |
| 283 |
* |
| 284 |
* Create Page Settings button. |
| 285 |
* |
| 286 |
* @param mixed $input Page Settings button HTML. |
| 287 |
* |
| 288 |
* @return mixed Page Settings button. |
| 289 |
*/ |
| 290 |
public static function screen_options( $input ) { |
| 291 |
return $input . |
| 292 |
'<a class="ui button basic icon" onclick="mainwp_manage_updates_screen_options(); return false;" data-inverted="" data-position="bottom right" href="#" target="_blank" data-tooltip="' . esc_html__( 'Page Settings', 'mainwp' ) . '"> |
| 293 |
<i class="cog icon"></i> |
| 294 |
</a>'; |
| 295 |
} |
| 296 |
|
| 297 |
/** |
| 298 |
* Sets the MainWP Update page page title and pass it off to method MainWP_UI::render_top_header(). |
| 299 |
* |
| 300 |
* @uses \MainWP\Dashboard\MainWP_UI::render_top_header() |
| 301 |
*/ |
| 302 |
public static function render_header( $current_tab = '' ) { |
| 303 |
|
| 304 |
$title = esc_html__( 'Available Updates', 'mainwp' ); |
| 305 |
|
| 306 |
if ( 'abandoned-plugins' === $current_tab ) { |
| 307 |
$title = esc_html__( 'Abandoned Plugins', 'mainwp' ); |
| 308 |
} elseif ( 'abandoned-themes' === $current_tab ) { |
| 309 |
$title = esc_html__( 'Abandoned Themes', 'mainwp' ); |
| 310 |
} |
| 311 |
|
| 312 |
$params = array( |
| 313 |
'title' => $title, |
| 314 |
); |
| 315 |
|
| 316 |
MainWP_UI::render_top_header( $params ); |
| 317 |
} |
| 318 |
|
| 319 |
/** |
| 320 |
* Closes the page container. |
| 321 |
*/ |
| 322 |
public static function render_footer() { |
| 323 |
echo '</div>'; |
| 324 |
} |
| 325 |
|
| 326 |
/** |
| 327 |
* Generates individual site overview page link. |
| 328 |
* |
| 329 |
* @param object $website The site object. |
| 330 |
* @param bool $echo_out Either echo or not. |
| 331 |
* |
| 332 |
* @return string Dashboard link. |
| 333 |
*/ |
| 334 |
public static function render_site_link_dashboard( $website, $echo_out = true ) { |
| 335 |
$lnk = '<a href="' . esc_url( admin_url( 'admin.php?page=managesites&dashboard=' . $website->id ) ) . '" data-inverted="" data-tooltip="' . esc_html__( 'Visit this dashboard.', 'mainwp' ) . '">' . stripslashes( $website->name ) . '</a>'; |
| 336 |
if ( $echo_out ) { |
| 337 |
echo $lnk; // phpcs:ignore WordPress.Security.EscapeOutput |
| 338 |
} else { |
| 339 |
return $lnk; |
| 340 |
} |
| 341 |
} |
| 342 |
|
| 343 |
/** |
| 344 |
* Checks if the current user has permission to uignore updates. |
| 345 |
* |
| 346 |
* @return bool Whether user can ignore updates or not. |
| 347 |
*/ |
| 348 |
public static function user_can_ignore_updates() { |
| 349 |
if ( null === static::$user_can_ignore_updates ) { |
| 350 |
static::$user_can_ignore_updates = \mainwp_current_user_can( 'dashboard', 'ignore_unignore_updates' ); |
| 351 |
} |
| 352 |
return static::$user_can_ignore_updates; |
| 353 |
} |
| 354 |
|
| 355 |
/** |
| 356 |
* Checks if the current user has permission to update translations. |
| 357 |
* |
| 358 |
* @return bool Whether user can update translations or not. |
| 359 |
*/ |
| 360 |
public static function user_can_update_trans() { |
| 361 |
if ( null === static::$user_can_update_trans ) { |
| 362 |
static::$user_can_update_trans = \mainwp_current_user_can( 'dashboard', 'update_translations' ); |
| 363 |
} |
| 364 |
return static::$user_can_update_trans; |
| 365 |
} |
| 366 |
|
| 367 |
/** |
| 368 |
* Checks if the current user has permission to update WordPress core files. |
| 369 |
* |
| 370 |
* @return bool Whether user can update WordPress or not. |
| 371 |
*/ |
| 372 |
public static function user_can_update_wp() { |
| 373 |
if ( null === static::$user_can_update_wp ) { |
| 374 |
static::$user_can_update_wp = \mainwp_current_user_can( 'dashboard', 'update_wordpress' ); |
| 375 |
} |
| 376 |
return static::$user_can_update_wp; |
| 377 |
} |
| 378 |
|
| 379 |
/** |
| 380 |
* Checks if the current user has permission to update themes. |
| 381 |
* |
| 382 |
* @return bool Whether user can update themes or not. |
| 383 |
*/ |
| 384 |
public static function user_can_update_themes() { |
| 385 |
if ( null === static::$user_can_update_themes ) { |
| 386 |
static::$user_can_update_themes = \mainwp_current_user_can( 'dashboard', 'update_themes' ); |
| 387 |
} |
| 388 |
return static::$user_can_update_themes; |
| 389 |
} |
| 390 |
|
| 391 |
/** |
| 392 |
* Checks if the current user has permission to update plugins. |
| 393 |
* |
| 394 |
* @return bool Whether user can update plugins or not. |
| 395 |
*/ |
| 396 |
public static function user_can_update_plugins() { |
| 397 |
if ( null === static::$user_can_update_plugins ) { |
| 398 |
static::$user_can_update_plugins = \mainwp_current_user_can( 'dashboard', 'update_plugins' ); |
| 399 |
} |
| 400 |
return static::$user_can_update_plugins; |
| 401 |
} |
| 402 |
|
| 403 |
/** |
| 404 |
* Renders updates page. |
| 405 |
* |
| 406 |
* @param string $abandoned_tab Render abandoned plugins|themes tab, abandoned_plugins|abandoned_themes. |
| 407 |
* |
| 408 |
* @uses \MainWP\Dashboard\MainWP_DB_Common::get_user_extension() |
| 409 |
* @uses \MainWP\Dashboard\MainWP_DB_Common::get_groups_for_current_user() |
| 410 |
* @uses \MainWP\Dashboard\MainWP_DB::get_websites_by_group_id() |
| 411 |
* @uses \MainWP\Dashboard\MainWP_DB::get_website_option() |
| 412 |
* @uses \MainWP\Dashboard\MainWP_DB::fetch_object() |
| 413 |
* @uses \MainWP\Dashboard\MainWP_DB::data_seek() |
| 414 |
* @uses \MainWP\Dashboard\MainWP_Utility::array_sort() |
| 415 |
*/ |
| 416 |
public static function render( $abandoned_tab = '' ) { // phpcs:ignore Generic.Metrics.CyclomaticComplexity -- NOSONAR - current complexity is the only way to achieve desired results, pull request solutions appreciated. |
| 417 |
|
| 418 |
static::handle_limit_sites(); |
| 419 |
|
| 420 |
$websites = static::get_sites_for_current_user(); |
| 421 |
$userExtension = MainWP_DB_Common::instance()->get_user_extension(); |
| 422 |
$site_view = (int) $userExtension->site_view; |
| 423 |
|
| 424 |
$site_offset_for_groups = array(); |
| 425 |
$all_groups = array(); |
| 426 |
$sites_in_groups = array(); |
| 427 |
$all_groups_sites = array(); |
| 428 |
|
| 429 |
if ( MAINWP_VIEW_PER_GROUP === $site_view ) { |
| 430 |
$groups = MainWP_DB_Common::instance()->get_groups_for_current_user(); |
| 431 |
foreach ( $groups as $group ) { |
| 432 |
$all_groups[ $group->id ] = $group->name; |
| 433 |
} |
| 434 |
foreach ( $all_groups as $group_id => $group_name ) { |
| 435 |
$all_groups_sites[ $group_id ] = array(); |
| 436 |
$group_sites = MainWP_DB::instance()->get_websites_by_group_id( $group_id ); |
| 437 |
foreach ( $group_sites as $site ) { |
| 438 |
if ( ! isset( $sites_in_groups[ $site->id ] ) ) { |
| 439 |
$sites_in_groups[ $site->id ] = 1; |
| 440 |
} |
| 441 |
$all_groups_sites[ $group_id ][] = $site->id; |
| 442 |
} |
| 443 |
unset( $group_sites ); |
| 444 |
} |
| 445 |
|
| 446 |
$sites_not_in_groups = array(); |
| 447 |
$pos = 0; |
| 448 |
MainWP_DB::data_seek( $websites, 0 ); |
| 449 |
while ( $websites && ( $website = MainWP_DB::fetch_object( $websites ) ) ) { |
| 450 |
$site_offset_for_groups[ $website->id ] = $pos; |
| 451 |
++$pos; |
| 452 |
if ( ! isset( $sites_in_groups[ $website->id ] ) ) { |
| 453 |
$sites_not_in_groups[] = $website->id; |
| 454 |
} |
| 455 |
} |
| 456 |
|
| 457 |
if ( ! empty( $sites_not_in_groups ) ) { |
| 458 |
$all_groups_sites[0] = $sites_not_in_groups; |
| 459 |
$all_groups[0] = esc_html__( 'Others', 'mainwp' ); |
| 460 |
} |
| 461 |
} |
| 462 |
|
| 463 |
$decodedDismissedPlugins = ! empty( $userExtension->dismissed_plugins ) ? json_decode( $userExtension->dismissed_plugins, true ) : array(); |
| 464 |
$decodedDismissedThemes = ! empty( $userExtension->dismissed_themes ) ? json_decode( $userExtension->dismissed_themes, true ) : array(); |
| 465 |
$decodedDismissedCores = ! empty( $userExtension->ignored_wp_upgrades ) ? json_decode( $userExtension->ignored_wp_upgrades, true ) : array(); |
| 466 |
|
| 467 |
$total_wp_upgrades = 0; |
| 468 |
$total_plugin_upgrades = 0; |
| 469 |
$total_translation_upgrades = 0; |
| 470 |
$total_theme_upgrades = 0; |
| 471 |
$total_sync_errors = 0; |
| 472 |
$total_plugins_outdate = 0; |
| 473 |
$total_themes_outdate = 0; |
| 474 |
|
| 475 |
$allTranslations = array(); |
| 476 |
$translationsInfo = array(); |
| 477 |
$allPlugins = array(); |
| 478 |
$pluginsInfo = array(); |
| 479 |
$allThemes = array(); |
| 480 |
$themesInfo = array(); |
| 481 |
|
| 482 |
$allPluginsOutdate = array(); |
| 483 |
$allThemesOutdate = array(); |
| 484 |
|
| 485 |
MainWP_DB::data_seek( $websites, 0 ); |
| 486 |
|
| 487 |
while ( $websites && ( $website = MainWP_DB::fetch_object( $websites ) ) ) { |
| 488 |
|
| 489 |
$wp_upgrades = ! empty( $website->wp_upgrades ) ? json_decode( $website->wp_upgrades, true ) : array(); |
| 490 |
$ignored_core_upgrades = ! empty( $website->ignored_wp_upgrades ) ? json_decode( $website->ignored_wp_upgrades, true ) : array(); |
| 491 |
|
| 492 |
if ( $website->is_ignoreCoreUpdates || MainWP_Common_Functions::instance()->is_ignored_updates( $wp_upgrades, $ignored_core_upgrades, 'core' ) || MainWP_Common_Functions::instance()->is_ignored_updates( $wp_upgrades, $decodedDismissedCores, 'core' ) ) { |
| 493 |
$wp_upgrades = array(); |
| 494 |
} |
| 495 |
|
| 496 |
if ( is_array( $wp_upgrades ) && ! empty( $wp_upgrades ) ) { |
| 497 |
++$total_wp_upgrades; |
| 498 |
} |
| 499 |
|
| 500 |
$translation_upgrades = json_decode( $website->translation_upgrades, true ); |
| 501 |
|
| 502 |
if ( ! empty( $website->ignored_trans_updates ) ) { |
| 503 |
$translation_upgrades = array(); |
| 504 |
} |
| 505 |
|
| 506 |
$plugin_upgrades = json_decode( $website->plugin_upgrades, true ); |
| 507 |
if ( $website->is_ignorePluginUpdates ) { |
| 508 |
$plugin_upgrades = array(); |
| 509 |
} |
| 510 |
|
| 511 |
$theme_upgrades = json_decode( $website->theme_upgrades, true ); |
| 512 |
if ( $website->is_ignoreThemeUpdates ) { |
| 513 |
$theme_upgrades = array(); |
| 514 |
} |
| 515 |
|
| 516 |
$decodedPremiumUpgrades = MainWP_DB::instance()->get_website_option( $website, 'premium_upgrades' ); |
| 517 |
$decodedPremiumUpgrades = ! empty( $decodedPremiumUpgrades ) ? json_decode( $decodedPremiumUpgrades, true ) : array(); |
| 518 |
|
| 519 |
if ( is_array( $decodedPremiumUpgrades ) ) { |
| 520 |
foreach ( $decodedPremiumUpgrades as $crrSlug => $premiumUpgrade ) { |
| 521 |
$premiumUpgrade['premium'] = true; |
| 522 |
|
| 523 |
if ( 'plugin' === $premiumUpgrade['type'] ) { |
| 524 |
if ( ! is_array( $plugin_upgrades ) ) { |
| 525 |
$plugin_upgrades = array(); |
| 526 |
} |
| 527 |
if ( ! $website->is_ignorePluginUpdates ) { |
| 528 |
$premiumUpgrade = array_filter( $premiumUpgrade ); |
| 529 |
if ( ! isset( $plugin_upgrades[ $crrSlug ] ) ) { |
| 530 |
continue; // to fix missing update name. |
| 531 |
} |
| 532 |
$plugin_upgrades[ $crrSlug ] = array_merge( $plugin_upgrades[ $crrSlug ], $premiumUpgrade ); |
| 533 |
} |
| 534 |
} elseif ( 'theme' === $premiumUpgrade['type'] ) { |
| 535 |
if ( ! is_array( $theme_upgrades ) ) { |
| 536 |
$theme_upgrades = array(); |
| 537 |
} |
| 538 |
if ( ! $website->is_ignoreThemeUpdates ) { |
| 539 |
$theme_upgrades[ $crrSlug ] = $premiumUpgrade; |
| 540 |
} |
| 541 |
} |
| 542 |
} |
| 543 |
} |
| 544 |
|
| 545 |
if ( is_array( $translation_upgrades ) ) { |
| 546 |
$total_translation_upgrades += count( $translation_upgrades ); |
| 547 |
} |
| 548 |
|
| 549 |
if ( is_array( $plugin_upgrades ) && ! $website->is_ignorePluginUpdates ) { |
| 550 |
$_ignored_plugins = json_decode( $website->ignored_plugins, true ); |
| 551 |
if ( is_array( $_ignored_plugins ) ) { |
| 552 |
$plugin_upgrades = MainWP_Common_Functions::instance()->get_not_ignored_updates_themesplugins( $plugin_upgrades, $_ignored_plugins ); |
| 553 |
} |
| 554 |
|
| 555 |
$_ignored_plugins = json_decode( $userExtension->ignored_plugins, true ); |
| 556 |
if ( is_array( $_ignored_plugins ) ) { |
| 557 |
$plugin_upgrades = MainWP_Common_Functions::instance()->get_not_ignored_updates_themesplugins( $plugin_upgrades, $_ignored_plugins ); |
| 558 |
} |
| 559 |
$total_plugin_upgrades += count( $plugin_upgrades ); |
| 560 |
} |
| 561 |
|
| 562 |
if ( is_array( $theme_upgrades ) ) { |
| 563 |
$_ignored_themes = json_decode( $website->ignored_themes, true ); |
| 564 |
if ( is_array( $_ignored_themes ) ) { |
| 565 |
$theme_upgrades = MainWP_Common_Functions::instance()->get_not_ignored_updates_themesplugins( $theme_upgrades, $_ignored_themes ); |
| 566 |
} |
| 567 |
|
| 568 |
$_ignored_themes = json_decode( $userExtension->ignored_themes, true ); |
| 569 |
if ( is_array( $_ignored_themes ) ) { |
| 570 |
$theme_upgrades = MainWP_Common_Functions::instance()->get_not_ignored_updates_themesplugins( $theme_upgrades, $_ignored_themes ); |
| 571 |
} |
| 572 |
|
| 573 |
$total_theme_upgrades += count( $theme_upgrades ); |
| 574 |
} |
| 575 |
|
| 576 |
$themesIgnoredAbandoned_perSites = array(); |
| 577 |
$ignoredAbandoned_themes = MainWP_DB::instance()->get_website_option( $website, 'themes_outdate_dismissed' ); |
| 578 |
$ignoredAbandoned_themes = ! empty( $ignoredAbandoned_themes ) ? json_decode( $ignoredAbandoned_themes, true ) : array(); |
| 579 |
|
| 580 |
if ( is_array( $ignoredAbandoned_themes ) ) { |
| 581 |
$ignoredAbandoned_themes = array_filter( $ignoredAbandoned_themes ); |
| 582 |
$themesIgnoredAbandoned_perSites = array_merge( $themesIgnoredAbandoned_perSites, $ignoredAbandoned_themes ); |
| 583 |
} |
| 584 |
|
| 585 |
$ignoredAbandoned_plugins = MainWP_DB::instance()->get_website_option( $website, 'plugins_outdate_dismissed' ); |
| 586 |
$ignoredAbandoned_plugins = ! empty( $ignoredAbandoned_plugins ) ? json_decode( $ignoredAbandoned_plugins, true ) : array(); |
| 587 |
|
| 588 |
$plugins_outdate = MainWP_DB::instance()->get_website_option( $website, 'plugins_outdate_info' ); |
| 589 |
$plugins_outdate = ! empty( $plugins_outdate ) ? json_decode( $plugins_outdate, true ) : array(); |
| 590 |
|
| 591 |
$themes_outdate = MainWP_DB::instance()->get_website_option( $website, 'themes_outdate_info' ); |
| 592 |
$themes_outdate = ! empty( $themes_outdate ) ? json_decode( $themes_outdate, true ) : array(); |
| 593 |
|
| 594 |
if ( is_array( $plugins_outdate ) ) { |
| 595 |
if ( is_array( $ignoredAbandoned_plugins ) ) { |
| 596 |
$plugins_outdate = array_diff_key( $plugins_outdate, $ignoredAbandoned_plugins ); |
| 597 |
} |
| 598 |
|
| 599 |
if ( is_array( $decodedDismissedPlugins ) ) { |
| 600 |
$plugins_outdate = array_diff_key( $plugins_outdate, $decodedDismissedPlugins ); |
| 601 |
} |
| 602 |
|
| 603 |
$total_plugins_outdate += count( $plugins_outdate ); |
| 604 |
} |
| 605 |
|
| 606 |
if ( is_array( $themes_outdate ) ) { |
| 607 |
if ( is_array( $themesIgnoredAbandoned_perSites ) ) { |
| 608 |
$themes_outdate = array_diff_key( $themes_outdate, $themesIgnoredAbandoned_perSites ); |
| 609 |
} |
| 610 |
|
| 611 |
if ( is_array( $decodedDismissedThemes ) ) { |
| 612 |
$themes_outdate = array_diff_key( $themes_outdate, $decodedDismissedThemes ); |
| 613 |
} |
| 614 |
|
| 615 |
$total_themes_outdate += count( $themes_outdate ); |
| 616 |
} |
| 617 |
|
| 618 |
// to fix displaying per sites/tags. |
| 619 |
if ( is_array( $plugins_outdate ) ) { |
| 620 |
foreach ( $plugins_outdate as $slug => $plugin_outdate ) { |
| 621 |
$slug = esc_html( $slug ); |
| 622 |
if ( ! isset( $allPluginsOutdate[ $slug ] ) ) { |
| 623 |
$allPluginsOutdate[ $slug ] = array( |
| 624 |
'name' => esc_html( $plugin_outdate['Name'] ), |
| 625 |
'cnt' => 1, |
| 626 |
'uri' => esc_html( $plugin_outdate['PluginURI'] ), |
| 627 |
); |
| 628 |
} else { |
| 629 |
++$allPluginsOutdate[ $slug ]['cnt']; |
| 630 |
} |
| 631 |
} |
| 632 |
} |
| 633 |
|
| 634 |
if ( is_array( $themes_outdate ) ) { |
| 635 |
foreach ( $themes_outdate as $slug => $theme_outdate ) { |
| 636 |
$slug = esc_html( $slug ); |
| 637 |
if ( ! isset( $allThemesOutdate[ $slug ] ) ) { |
| 638 |
$allThemesOutdate[ $slug ] = array( |
| 639 |
'name' => esc_html( $theme_outdate['Name'] ), |
| 640 |
'cnt' => 1, |
| 641 |
); |
| 642 |
} else { |
| 643 |
++$allThemesOutdate[ $slug ]['cnt']; |
| 644 |
} |
| 645 |
} |
| 646 |
} |
| 647 |
|
| 648 |
if ( MAINWP_VIEW_PER_PLUGIN_THEME === $site_view ) { |
| 649 |
if ( is_array( $translation_upgrades ) ) { |
| 650 |
foreach ( $translation_upgrades as $translation_upgrade ) { |
| 651 |
$slug = esc_html( $translation_upgrade['slug'] ); |
| 652 |
if ( ! isset( $allTranslations[ $slug ] ) ) { |
| 653 |
$allTranslations[ $slug ] = array( |
| 654 |
'name' => isset( $translation_upgrade['name'] ) ? esc_html( $translation_upgrade['name'] ) : $slug, |
| 655 |
'cnt' => 1, |
| 656 |
); |
| 657 |
} else { |
| 658 |
++$allTranslations[ $slug ]['cnt']; |
| 659 |
} |
| 660 |
|
| 661 |
$translationsInfo[ $slug ] = array( |
| 662 |
'name' => isset( $translation_upgrade['name'] ) ? esc_html( $translation_upgrade['name'] ) : $slug, |
| 663 |
'slug' => $slug, |
| 664 |
'version' => esc_html( $translation_upgrade['version'] ), |
| 665 |
); |
| 666 |
} |
| 667 |
} |
| 668 |
|
| 669 |
if ( is_array( $plugin_upgrades ) ) { |
| 670 |
foreach ( $plugin_upgrades as $slug => $plugin_upgrade ) { |
| 671 |
if ( ! isset( $allPlugins[ $slug ] ) ) { |
| 672 |
$allPlugins[ $slug ] = array( |
| 673 |
'name' => esc_html( $plugin_upgrade['Name'] ), |
| 674 |
'cnt' => 1, |
| 675 |
); |
| 676 |
} else { |
| 677 |
++$allPlugins[ $slug ]['cnt']; |
| 678 |
} |
| 679 |
|
| 680 |
$pluginsInfo[ $slug ] = array( |
| 681 |
'name' => esc_html( $plugin_upgrade['Name'] ), |
| 682 |
'slug' => isset( $plugin_upgrade['update']['slug'] ) ? esc_html( $plugin_upgrade['update']['slug'] ) : '', |
| 683 |
'premium' => ( isset( $plugin_upgrade['premium'] ) ? esc_html( $plugin_upgrade['premium'] ) : 0 ), |
| 684 |
'PluginURI' => esc_html( $plugin_upgrade['PluginURI'] ), |
| 685 |
'version' => esc_html( $plugin_upgrade['Version'] ), |
| 686 |
); |
| 687 |
} |
| 688 |
} |
| 689 |
|
| 690 |
if ( is_array( $theme_upgrades ) ) { |
| 691 |
foreach ( $theme_upgrades as $slug => $theme_upgrade ) { |
| 692 |
if ( ! isset( $allThemes[ $slug ] ) ) { |
| 693 |
$allThemes[ $slug ] = array( |
| 694 |
'name' => esc_html( $theme_upgrade['Name'] ), |
| 695 |
'cnt' => 1, |
| 696 |
); |
| 697 |
} else { |
| 698 |
++$allThemes[ $slug ]['cnt']; |
| 699 |
} |
| 700 |
|
| 701 |
$up_th_name = isset( $theme_upgrade['Name'] ) ? esc_html( $theme_upgrade['Name'] ) : ''; |
| 702 |
|
| 703 |
if ( empty( $up_th_name ) ) { |
| 704 |
$up_th_name = isset( $theme_upgrade['name'] ) ? esc_html( $theme_upgrade['name'] ) : 'N/A'; |
| 705 |
} |
| 706 |
|
| 707 |
$themesInfo[ $slug ] = array( |
| 708 |
'name' => $up_th_name, |
| 709 |
'premium' => ( isset( $theme_upgrade['premium'] ) ? esc_html( $theme_upgrade['premium'] ) : 0 ), |
| 710 |
); |
| 711 |
} |
| 712 |
} |
| 713 |
} |
| 714 |
|
| 715 |
if ( '' !== $website->sync_errors ) { |
| 716 |
++$total_sync_errors; |
| 717 |
} |
| 718 |
} |
| 719 |
|
| 720 |
/** |
| 721 |
* Filter: mainwp_updates_translation_sort_by |
| 722 |
* |
| 723 |
* Filters the default sorting option for Translation updates. |
| 724 |
* |
| 725 |
* @since 4.1 |
| 726 |
*/ |
| 727 |
$allTranslationsSortBy = apply_filters( 'mainwp_updates_translation_sort_by', 'name' ); |
| 728 |
|
| 729 |
/** |
| 730 |
* Filter: mainwp_updates_plugins_sort_by |
| 731 |
* |
| 732 |
* Filters the default sorting option for Plugin updates. |
| 733 |
* |
| 734 |
* @since 4.1 |
| 735 |
*/ |
| 736 |
$allPluginsSortBy = apply_filters( 'mainwp_updates_plugins_sort_by', 'name' ); |
| 737 |
|
| 738 |
/** |
| 739 |
* Filter: mainwp_updates_themes_sort_by |
| 740 |
* |
| 741 |
* Filters the default sorting option for Theme updates. |
| 742 |
* |
| 743 |
* @since 4.1 |
| 744 |
*/ |
| 745 |
$allThemesSortBy = apply_filters( 'mainwp_updates_themes_sort_by', 'name' ); |
| 746 |
|
| 747 |
/** |
| 748 |
* Filter: mainwp_updates_abandoned_plugins_sort_by |
| 749 |
* |
| 750 |
* Filters the default sorting option for Abandoned plugins. |
| 751 |
* |
| 752 |
* @since 4.1 |
| 753 |
*/ |
| 754 |
$allPluginsOutdateSortBy = apply_filters( 'mainwp_updates_abandoned_plugins_sort_by', 'name' ); |
| 755 |
|
| 756 |
/** |
| 757 |
* Filter: mainwp_updates_abandoned_themes_sort_by |
| 758 |
* |
| 759 |
* Filters the default sorting option for Abandoned themes. |
| 760 |
* |
| 761 |
* @since 4.1 |
| 762 |
*/ |
| 763 |
$allThemesOutdateSortBy = apply_filters( 'mainwp_updates_abandoned_themes_sort_by', 'name' ); |
| 764 |
|
| 765 |
MainWP_Utility::array_sort( $allTranslations, $allTranslationsSortBy ); |
| 766 |
MainWP_Utility::array_sort( $allPlugins, $allPluginsSortBy ); |
| 767 |
MainWP_Utility::array_sort( $allThemes, $allThemesSortBy ); |
| 768 |
MainWP_Utility::array_sort( $allPluginsOutdate, $allPluginsOutdateSortBy ); |
| 769 |
MainWP_Utility::array_sort( $allThemesOutdate, $allThemesOutdateSortBy ); |
| 770 |
|
| 771 |
$mainwp_show_language_updates = get_option( 'mainwp_show_language_updates', 1 ); |
| 772 |
|
| 773 |
/** |
| 774 |
* Limits number of updates to process. |
| 775 |
* |
| 776 |
* Limits the number of updates that will be processed in a single run on Update Everything action. |
| 777 |
* |
| 778 |
* @since 4.0 |
| 779 |
*/ |
| 780 |
$limit_updates_all = apply_filters( 'mainwp_limit_updates_all', 0 ); |
| 781 |
// phpcs:disable WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 782 |
if ( 0 < $limit_updates_all && isset( $_GET['continue_update'] ) && '' !== $_GET['continue_update'] ) { |
| 783 |
static::$continue_update = sanitize_text_field( wp_unslash( $_GET['continue_update'] ) ); |
| 784 |
if ( ( 'plugins_upgrade_all' === static::$continue_update || 'themes_upgrade_all' === static::$continue_update || 'translations_upgrade_all' === static::$continue_update ) && isset( $_GET['slug'] ) && '' !== $_GET['slug'] ) { |
| 785 |
static::$continue_update_slug = wp_unslash( $_GET['slug'] ); |
| 786 |
} |
| 787 |
} |
| 788 |
|
| 789 |
$current_tab = ''; |
| 790 |
|
| 791 |
if ( isset( $_GET['tab'] ) ) { |
| 792 |
$current_tab = sanitize_text_field( wp_unslash( $_GET['tab'] ) ); |
| 793 |
if ( ! in_array( $current_tab, array( 'wordpress-updates', 'updates-ignore', 'plugins-updates', 'themes-updates', 'translations-updates', true ) ) ) { |
| 794 |
$current_tab = 'plugins-updates'; |
| 795 |
} |
| 796 |
} elseif ( 'abandoned_plugins' === $abandoned_tab ) { |
| 797 |
$current_tab = 'abandoned-plugins'; |
| 798 |
} elseif ( 'abandoned_themes' === $abandoned_tab ) { |
| 799 |
$current_tab = 'abandoned-themes'; |
| 800 |
} |
| 801 |
|
| 802 |
if ( empty( $current_tab ) ) { |
| 803 |
$current_tab = 'plugins-updates'; |
| 804 |
} |
| 805 |
|
| 806 |
// phpcs:enable |
| 807 |
static::render_header( $current_tab ); |
| 808 |
|
| 809 |
static::render_header_tabs( $mainwp_show_language_updates, $current_tab, $total_wp_upgrades, $total_plugin_upgrades, $total_theme_upgrades, $total_translation_upgrades, $total_plugins_outdate, $total_themes_outdate, $site_view ); |
| 810 |
|
| 811 |
?> |
| 812 |
<div class="ui padded segment" id="mainwp-manage-updates"> |
| 813 |
<?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-manage-updates-message' ) ) { ?> |
| 814 |
<div class="ui info message"> |
| 815 |
<i class="close icon mainwp-notice-dismiss" notice-id="mainwp-manage-updates-message"></i> |
| 816 |
<div><?php /* translators: 1: opening anchor tag for plugins, 2: closing anchor tag, 3: opening anchor tag for themes, 4: closing anchor tag with icon, 5: opening anchor tag for WordPress core, 6: closing anchor tag with icon */ printf( esc_html__( 'Manage available updates for all your child sites. From here, you can update update %1$splugins%2$s, %3$sthemes%4$s, and %5$sWordPress core%6$s.', 'mainwp' ), '<a href="https://docs.mainwp.com/sites/updates/manage-updates#plugin-updates" target="_blank">', '</a>', '<a href="https://docs.mainwp.com/sites/updates/manage-updates#theme-updates" target="_blank">', '</a> <i class="external alternate icon"></i>', '<a href="https://docs.mainwp.com/sites/updates/manage-updates#wordpress-core-updates" target="_blank">', '</a> <i class="external alternate icon"></i>' ); ?></div> |
| 817 |
<div><?php /* translators: 1: opening anchor tag for WordPress core, 2: closing anchor tag with icon, 3: opening anchor tag for plugins, 4: closing anchor tag with icon, 5: opening anchor tag for themes, 6: closing anchor tag with icon */ printf( esc_html__( 'Also, from here, you can ignore updates for %1$sWordPress core%2$s, %3$splugins%4$s, and %5$sthemes%6$s.', 'mainwp' ), '<a href="https://docs.mainwp.com/sites/updates/manage-updates#wordpress-core-updates" target="_blank">', '</a> <i class="external alternate icon"></i>', '<a href="https://docs.mainwp.com/sites/updates/manage-updates#ignore-plugin-updates" target="_blank">', '</a> <i class="external alternate icon"></i>', '<a href="https://docs.mainwp.com/sites/updates/manage-updates#ignore-theme-updates" target="_blank">', '</a> <i class="external alternate icon"></i>' ); ?></div> |
| 818 |
</div> |
| 819 |
<?php } ?> |
| 820 |
<?php |
| 821 |
|
| 822 |
$hooks_tabs = apply_filters( 'mainwp_pages_updates_render_tabs', false, $current_tab ); |
| 823 |
|
| 824 |
if ( false === $hooks_tabs ) { |
| 825 |
if ( 'wordpress-updates' === $current_tab ) { |
| 826 |
static::render_wp_update_tab( $websites, $userExtension, $total_wp_upgrades, $all_groups_sites, $all_groups, $site_offset_for_groups, $site_view ); |
| 827 |
} elseif ( 'updates-ignore' === $current_tab ) { |
| 828 |
static::render_wp_ignore_update_tab( $websites, $userExtension ); |
| 829 |
} elseif ( 'plugins-updates' === $current_tab ) { |
| 830 |
static::render_plugins_update_tab( $websites, $total_plugin_upgrades, $userExtension, $all_groups_sites, $all_groups, $allPlugins, $pluginsInfo, $site_offset_for_groups, $site_view ); |
| 831 |
} elseif ( 'themes-updates' === $current_tab ) { |
| 832 |
static::render_themes_update_tab( $websites, $total_theme_upgrades, $userExtension, $all_groups_sites, $all_groups, $allThemes, $themesInfo, $site_offset_for_groups, $site_view ); |
| 833 |
} elseif ( 'translations-updates' === $current_tab ) { |
| 834 |
static::render_trans_update_tab( $websites, $total_translation_upgrades, $userExtension, $all_groups_sites, $all_groups, $allTranslations, $translationsInfo, $mainwp_show_language_updates, $site_offset_for_groups, $site_view ); |
| 835 |
} elseif ( 'abandoned-plugins' === $current_tab ) { |
| 836 |
static::render_abandoned_plugins_tab( $websites, $all_groups_sites, $all_groups, $allPluginsOutdate, $decodedDismissedPlugins, $site_offset_for_groups, $site_view ); |
| 837 |
} elseif ( 'abandoned-themes' === $current_tab ) { |
| 838 |
static::render_abandoned_themes_tab( $websites, $all_groups_sites, $all_groups, $allThemesOutdate, $decodedDismissedThemes, $site_offset_for_groups, $site_view ); |
| 839 |
} |
| 840 |
?> |
| 841 |
</div> |
| 842 |
<?php |
| 843 |
static::render_js_updates( $site_view ); |
| 844 |
} |
| 845 |
|
| 846 |
static::render_updates_modal(); |
| 847 |
|
| 848 |
static::render_plugin_details_modal(); |
| 849 |
MainWP_UI::render_modal_upload_icon(); |
| 850 |
static::render_screen_options_modal(); |
| 851 |
static::render_changes_history_modal(); |
| 852 |
static::render_footer(); |
| 853 |
?> |
| 854 |
<script type="text/javascript"> |
| 855 |
mainwp_manage_updates_screen_options = function () { |
| 856 |
jQuery( '#mainwp-manage-updates-screen-options-modal' ).modal( 'show' ); |
| 857 |
jQuery( '#manage-updates-screen-options-form' ).submit( function() { |
| 858 |
jQuery( '#mainwp-manage-updates-screen-options-modal' ).modal( 'hide' ); |
| 859 |
} ); |
| 860 |
return false; |
| 861 |
}; |
| 862 |
</script> |
| 863 |
<?php |
| 864 |
} |
| 865 |
|
| 866 |
/** |
| 867 |
* Render WP updates tab. |
| 868 |
* |
| 869 |
* @param object $websites Object containing child sites info. |
| 870 |
* @param object $userExtension User Extension object. |
| 871 |
* @param int $total_wp_upgrades Number of available WP upates. |
| 872 |
* @param array $all_groups_sites Array containing all groups and sites. |
| 873 |
* @param array $all_groups Array containing all groups. |
| 874 |
* @param int $site_offset_for_groups Offset value. |
| 875 |
* @param string $site_view Current view. |
| 876 |
* |
| 877 |
* @uses \MainWP\Dashboard\MainWP_DB::data_seek() |
| 878 |
* @uses \MainWP\Dashboard\MainWP_Updates_Per_Group::render_wpcore_updates() |
| 879 |
* @uses \MainWP\Dashboard\MainWP_Updates_Per_Site::render_wpcore_updates() |
| 880 |
*/ |
| 881 |
public static function render_wp_update_tab( $websites, $userExtension, $total_wp_upgrades, $all_groups_sites, $all_groups, $site_offset_for_groups, $site_view ) { |
| 882 |
?> |
| 883 |
<div class="ui active tab" data-tab="wordpress-updates"> |
| 884 |
<?php |
| 885 |
/** |
| 886 |
* Action: mainwp_updates_before_wp_updates |
| 887 |
* |
| 888 |
* Fires at the top of the WP updates tab. |
| 889 |
* |
| 890 |
* @param object $websites Object containing child sites info. |
| 891 |
* @param int $total_wp_upgrades Number of available WP upates. |
| 892 |
* @param array $all_groups_sites Array containing all groups and sites. |
| 893 |
* @param array $all_groups Array containing all groups. |
| 894 |
* @param int $site_offset_for_groups Offset value. |
| 895 |
* |
| 896 |
* @since 4.1 |
| 897 |
*/ |
| 898 |
do_action( 'mainwp_updates_before_wp_updates', $websites, $total_wp_upgrades, $all_groups_sites, $all_groups, $site_offset_for_groups ); |
| 899 |
if ( MAINWP_VIEW_PER_GROUP === $site_view ) { |
| 900 |
/** |
| 901 |
* Action: mainwp_updates_pergroup_before_wp_updates |
| 902 |
* |
| 903 |
* Fires at the top of the WP updates tab, per Group view. |
| 904 |
* |
| 905 |
* @param object $websites Object containing child sites info. |
| 906 |
* @param int $total_wp_upgrades Number of available WP upates. |
| 907 |
* @param array $all_groups_sites Array containing all groups and sites. |
| 908 |
* @param array $all_groups Array containing all groups. |
| 909 |
* @param int $site_offset_for_groups Offset value. |
| 910 |
* |
| 911 |
* @since 4.1 |
| 912 |
*/ |
| 913 |
do_action( 'mainwp_updates_pergroup_before_wp_updates', $websites, $total_wp_upgrades, $all_groups_sites, $all_groups, $site_offset_for_groups ); |
| 914 |
MainWP_Updates_Per_Group::render_wpcore_updates( $websites, $userExtension, $total_wp_upgrades, $all_groups_sites, $all_groups, $site_offset_for_groups ); |
| 915 |
/** |
| 916 |
* Action: mainwp_updates_pergroup_after_wp_updates |
| 917 |
* |
| 918 |
* Fires at the bottom of the WP updates tab, per Group view. |
| 919 |
* |
| 920 |
* @param object $websites Object containing child sites info. |
| 921 |
* @param int $total_wp_upgrades Number of available WP upates. |
| 922 |
* @param array $all_groups_sites Array containing all groups and sites. |
| 923 |
* @param array $all_groups Array containing all groups. |
| 924 |
* @param int $site_offset_for_groups Offset value. |
| 925 |
* |
| 926 |
* @since 4.1 |
| 927 |
*/ |
| 928 |
do_action( 'mainwp_updates_pergroup_after_wp_updates', $websites, $total_wp_upgrades, $all_groups_sites, $all_groups, $site_offset_for_groups ); |
| 929 |
} else { |
| 930 |
/** |
| 931 |
* Action: mainwp_updates_persite_before_wp_updates |
| 932 |
* |
| 933 |
* Fires at the top of the WP updates tab, per Site view. |
| 934 |
* |
| 935 |
* @param object $websites Object containing child sites info. |
| 936 |
* @param int $total_wp_upgrades Number of available WP upates. |
| 937 |
* @param array $all_groups_sites Array containing all groups and sites. |
| 938 |
* @param array $all_groups Array containing all groups. |
| 939 |
* @param int $site_offset_for_groups Offset value. |
| 940 |
* |
| 941 |
* @since 4.1 |
| 942 |
*/ |
| 943 |
do_action( 'mainwp_updates_pergroup_before_wp_updates', $websites, $total_wp_upgrades, $all_groups_sites, $all_groups, $site_offset_for_groups ); |
| 944 |
MainWP_DB::data_seek( $websites, 0 ); |
| 945 |
MainWP_Updates_Per_Site::render_wpcore_updates( $websites, $userExtension, $total_wp_upgrades ); |
| 946 |
/** |
| 947 |
* Action: mainwp_updates_persite_after_wp_updates |
| 948 |
* |
| 949 |
* Fires at the bottom of the WP updates tab, per Site view. |
| 950 |
* |
| 951 |
* @param object $websites Object containing child sites info. |
| 952 |
* @param int $total_wp_upgrades Number of available WP upates. |
| 953 |
* @param array $all_groups_sites Array containing all groups and sites. |
| 954 |
* @param array $all_groups Array containing all groups. |
| 955 |
* @param int $site_offset_for_groups Offset value. |
| 956 |
* |
| 957 |
* @since 4.1 |
| 958 |
*/ |
| 959 |
do_action( 'mainwp_updates_persite_after_wp_updates', $websites, $total_wp_upgrades, $all_groups_sites, $all_groups, $site_offset_for_groups ); |
| 960 |
} |
| 961 |
/** |
| 962 |
* Action: mainwp_updates_after_wp_updates |
| 963 |
* |
| 964 |
* Fires at the top of the WP updates tab. |
| 965 |
* |
| 966 |
* @param object $websites Object containing child sites info. |
| 967 |
* @param int $total_wp_upgrades Number of available WP upates. |
| 968 |
* @param array $all_groups_sites Array containing all groups and sites. |
| 969 |
* @param array $all_groups Array containing all groups. |
| 970 |
* @param int $site_offset_for_groups Offset value. |
| 971 |
* |
| 972 |
* @since 4.1 |
| 973 |
*/ |
| 974 |
do_action( 'mainwp_updates_after_wp_updates', $websites, $total_wp_upgrades, $all_groups_sites, $all_groups, $site_offset_for_groups ); |
| 975 |
?> |
| 976 |
</div> |
| 977 |
<?php |
| 978 |
} |
| 979 |
|
| 980 |
|
| 981 |
/** |
| 982 |
* Renders WP updates tab. |
| 983 |
* |
| 984 |
* @param array $websites Object containing child sites info. |
| 985 |
* @param object $userExtension User extension. |
| 986 |
*/ |
| 987 |
public static function render_wp_ignore_update_tab( $websites, $userExtension ) { |
| 988 |
MainWP_WP_Updates::instance()->render_ignore( $websites, $userExtension ); |
| 989 |
} |
| 990 |
|
| 991 |
/** |
| 992 |
* Renders WP updates tab. |
| 993 |
* |
| 994 |
* @param object $websites Object containing child sites info. |
| 995 |
* @param int $total_plugin_upgrades Number of available plugin updates. |
| 996 |
* @param object $userExtension User extension. |
| 997 |
* @param array $all_groups_sites Array of all groups and sites. |
| 998 |
* @param array $all_groups Array of all groups. |
| 999 |
* @param array $allPlugins Array of all plugins. |
| 1000 |
* @param array $pluginsInfo Array of all plugins info. |
| 1001 |
* @param int $site_offset_for_groups Offset value. |
| 1002 |
* @param string $site_view Current view. |
| 1003 |
* |
| 1004 |
* @uses \MainWP\Dashboard\MainWP_Updates_Per_Group::render_plugins_updates() |
| 1005 |
* @uses \MainWP\Dashboard\MainWP_Updates_Per_Item::render_plugins_updates() |
| 1006 |
* @uses \MainWP\Dashboard\MainWP_Updates_Per_Site::render_plugins_updates() |
| 1007 |
*/ |
| 1008 |
public static function render_plugins_update_tab( $websites, $total_plugin_upgrades, $userExtension, $all_groups_sites, $all_groups, $allPlugins, $pluginsInfo, $site_offset_for_groups, $site_view ) { //phpcs:ignore -- NOSONAR - compatible. |
| 1009 |
$trustedPlugins = json_decode( $userExtension->trusted_plugins, true ); |
| 1010 |
if ( ! is_array( $trustedPlugins ) ) { |
| 1011 |
$trustedPlugins = array(); |
| 1012 |
} |
| 1013 |
?> |
| 1014 |
<div class="ui active tab" data-tab="plugins-updates"> |
| 1015 |
<?php |
| 1016 |
/** |
| 1017 |
* Action: mainwp_updates_before_plugin_updates |
| 1018 |
* |
| 1019 |
* Fires at the top of the Plugin updates tab. |
| 1020 |
* |
| 1021 |
* @param object $websites Object containing child sites info. |
| 1022 |
* @param int $total_plugin_upgrades Number of available plugin updates. |
| 1023 |
* @param object $userExtension User extension. |
| 1024 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1025 |
* @param array $all_groups Array of all groups. |
| 1026 |
* @param array $allPlugins Array of all plugins. |
| 1027 |
* @param array $pluginsInfo Array of all plugins info. |
| 1028 |
* @param int $site_offset_for_groups Offset value. |
| 1029 |
* |
| 1030 |
* @since 4.1 |
| 1031 |
*/ |
| 1032 |
do_action( 'mainwp_updates_before_plugin_updates', $websites, $total_plugin_upgrades, $userExtension, $all_groups_sites, $all_groups, $allPlugins, $pluginsInfo, $site_offset_for_groups ); |
| 1033 |
if ( MAINWP_VIEW_PER_SITE === $site_view ) { |
| 1034 |
/** |
| 1035 |
* Action: mainwp_updates_persite_before_plugin_updates |
| 1036 |
* |
| 1037 |
* Fires at the top of the Plugin updates tab, per Site view. |
| 1038 |
* |
| 1039 |
* @param object $websites Object containing child sites info. |
| 1040 |
* @param int $total_plugin_upgrades Number of available plugin updates. |
| 1041 |
* @param object $userExtension User extension. |
| 1042 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1043 |
* @param array $all_groups Array of all groups. |
| 1044 |
* @param array $allPlugins Array of all plugins. |
| 1045 |
* @param array $pluginsInfo Array of all plugins info. |
| 1046 |
* @param int $site_offset_for_groups Offset value. |
| 1047 |
* |
| 1048 |
* @since 4.1 |
| 1049 |
*/ |
| 1050 |
do_action( 'mainwp_updates_persite_before_plugin_updates', $websites, $total_plugin_upgrades, $userExtension, $all_groups_sites, $all_groups, $allPlugins, $pluginsInfo, $site_offset_for_groups ); |
| 1051 |
MainWP_Updates_Per_Site::render_plugins_updates( $websites, $total_plugin_upgrades, $userExtension, $trustedPlugins ); |
| 1052 |
/** |
| 1053 |
* Action: mainwp_updates_persite_after_plugin_updates |
| 1054 |
* |
| 1055 |
* Fires at the bottom of the Plugin updates tab, per Site view. |
| 1056 |
* |
| 1057 |
* @param object $websites Object containing child sites info. |
| 1058 |
* @param int $total_plugin_upgrades Number of available plugin updates. |
| 1059 |
* @param object $userExtension User extension. |
| 1060 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1061 |
* @param array $all_groups Array of all groups. |
| 1062 |
* @param array $allPlugins Array of all plugins. |
| 1063 |
* @param array $pluginsInfo Array of all plugins info. |
| 1064 |
* @param int $site_offset_for_groups Offset value. |
| 1065 |
* |
| 1066 |
* @since 4.1 |
| 1067 |
*/ |
| 1068 |
do_action( 'mainwp_updates_persite_after_plugin_updates', $websites, $total_plugin_upgrades, $userExtension, $all_groups_sites, $all_groups, $allPlugins, $pluginsInfo, $site_offset_for_groups ); |
| 1069 |
} elseif ( MAINWP_VIEW_PER_GROUP === $site_view ) { |
| 1070 |
/** |
| 1071 |
* Action: mainwp_updates_pergroup_before_plugin_updates |
| 1072 |
* |
| 1073 |
* Fires at the top of the Plugin updates tab, per Group view. |
| 1074 |
* |
| 1075 |
* @param object $websites Object containing child sites info. |
| 1076 |
* @param int $total_plugin_upgrades Number of available plugin updates. |
| 1077 |
* @param object $userExtension User extension. |
| 1078 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1079 |
* @param array $all_groups Array of all groups. |
| 1080 |
* @param array $allPlugins Array of all plugins. |
| 1081 |
* @param array $pluginsInfo Array of all plugins info. |
| 1082 |
* @param int $site_offset_for_groups Offset value. |
| 1083 |
* |
| 1084 |
* @since 4.1 |
| 1085 |
*/ |
| 1086 |
do_action( 'mainwp_updates_pergroup_before_plugin_updates', $websites, $total_plugin_upgrades, $userExtension, $all_groups_sites, $all_groups, $allPlugins, $pluginsInfo, $site_offset_for_groups ); |
| 1087 |
MainWP_Updates_Per_Group::render_plugins_updates( $websites, $total_plugin_upgrades, $userExtension, $all_groups_sites, $all_groups, $site_offset_for_groups, $trustedPlugins ); |
| 1088 |
/** |
| 1089 |
* Action: mainwp_updates_pergroup_after_plugin_updates |
| 1090 |
* |
| 1091 |
* Fires at the bottom of the Plugin updates tab, per Group view. |
| 1092 |
* |
| 1093 |
* @param object $websites Object containing child sites info. |
| 1094 |
* @param int $total_plugin_upgrades Number of available plugin updates. |
| 1095 |
* @param object $userExtension User extension. |
| 1096 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1097 |
* @param array $all_groups Array of all groups. |
| 1098 |
* @param array $allPlugins Array of all plugins. |
| 1099 |
* @param array $pluginsInfo Array of all plugins info. |
| 1100 |
* @param int $site_offset_for_groups Offset value. |
| 1101 |
* |
| 1102 |
* @since 4.1 |
| 1103 |
*/ |
| 1104 |
do_action( 'mainwp_updates_pergroup_after_plugin_updates', $websites, $total_plugin_upgrades, $userExtension, $all_groups_sites, $all_groups, $allPlugins, $pluginsInfo, $site_offset_for_groups ); |
| 1105 |
} else { |
| 1106 |
/** |
| 1107 |
* Action: mainwp_updates_perplugin_before_plugin_updates |
| 1108 |
* |
| 1109 |
* Fires at the top of the Plugin updates tab, per Plugin view. |
| 1110 |
* |
| 1111 |
* @param object $websites Object containing child sites info. |
| 1112 |
* @param int $total_plugin_upgrades Number of available plugin updates. |
| 1113 |
* @param object $userExtension User extension. |
| 1114 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1115 |
* @param array $all_groups Array of all groups. |
| 1116 |
* @param array $allPlugins Array of all plugins. |
| 1117 |
* @param array $pluginsInfo Array of all plugins info. |
| 1118 |
* @param int $site_offset_for_groups Offset value. |
| 1119 |
* |
| 1120 |
* @since 4.1 |
| 1121 |
*/ |
| 1122 |
do_action( 'mainwp_updates_perplugin_before_plugin_updates', $websites, $total_plugin_upgrades, $userExtension, $all_groups_sites, $all_groups, $allPlugins, $pluginsInfo, $site_offset_for_groups ); |
| 1123 |
MainWP_Updates_Per_Item::render_plugins_updates( $websites, $total_plugin_upgrades, $userExtension, $allPlugins, $pluginsInfo, $trustedPlugins ); |
| 1124 |
/** |
| 1125 |
* Action: mainwp_updates_perplugin_after_plugin_updates |
| 1126 |
* |
| 1127 |
* Fires at the bottom of the Plugin updates tab, per Plugin view. |
| 1128 |
* |
| 1129 |
* @param object $websites Object containing child sites info. |
| 1130 |
* @param int $total_plugin_upgrades Number of available plugin updates. |
| 1131 |
* @param object $userExtension User extension. |
| 1132 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1133 |
* @param array $all_groups Array of all groups. |
| 1134 |
* @param array $allPlugins Array of all plugins. |
| 1135 |
* @param array $pluginsInfo Array of all plugins info. |
| 1136 |
* @param int $site_offset_for_groups Offset value. |
| 1137 |
* |
| 1138 |
* @since 4.1 |
| 1139 |
*/ |
| 1140 |
do_action( 'mainwp_updates_perplugin_after_plugin_updates', $websites, $total_plugin_upgrades, $userExtension, $all_groups_sites, $all_groups, $allPlugins, $pluginsInfo, $site_offset_for_groups ); |
| 1141 |
} |
| 1142 |
/** |
| 1143 |
* Action: mainwp_updates_after_plugin_updates |
| 1144 |
* |
| 1145 |
* Fires at the bottom of the Plugin updates tab. |
| 1146 |
* |
| 1147 |
* @param object $websites Object containing child sites info. |
| 1148 |
* @param int $total_plugin_upgrades Number of available plugin updates. |
| 1149 |
* @param object $userExtension User extension. |
| 1150 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1151 |
* @param array $all_groups Array of all groups. |
| 1152 |
* @param array $allPlugins Array of all plugins. |
| 1153 |
* @param array $pluginsInfo Array of all plugins info. |
| 1154 |
* @param int $site_offset_for_groups Offset value. |
| 1155 |
* |
| 1156 |
* @since 4.1 |
| 1157 |
*/ |
| 1158 |
do_action( 'mainwp_updates_after_plugin_updates', $websites, $total_plugin_upgrades, $userExtension, $all_groups_sites, $all_groups, $allPlugins, $pluginsInfo, $site_offset_for_groups ); |
| 1159 |
?> |
| 1160 |
</div> |
| 1161 |
<?php |
| 1162 |
} |
| 1163 |
|
| 1164 |
/** |
| 1165 |
* Renders theme update tab. |
| 1166 |
* |
| 1167 |
* @param object $websites Object containing child sites info. |
| 1168 |
* @param int $total_theme_upgrades Number of available theme updates. |
| 1169 |
* @param object $userExtension User extension. |
| 1170 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1171 |
* @param array $all_groups Array of all groups. |
| 1172 |
* @param array $allThemes Array of all themes. |
| 1173 |
* @param array $themesInfo Array of all themes info. |
| 1174 |
* @param int $site_offset_for_groups Offset value. |
| 1175 |
* @param string $site_view Current view. |
| 1176 |
* |
| 1177 |
* @uses \MainWP\Dashboard\MainWP_Updates_Per_Group::render_themes_updates() |
| 1178 |
* @uses \MainWP\Dashboard\MainWP_Updates_Per_Item::render_themes_updates() |
| 1179 |
* @uses \MainWP\Dashboard\MainWP_Updates_Per_Site::render_themes_updates() |
| 1180 |
*/ |
| 1181 |
public static function render_themes_update_tab( $websites, $total_theme_upgrades, $userExtension, $all_groups_sites, $all_groups, $allThemes, $themesInfo, $site_offset_for_groups, $site_view ) { //phpcs:ignore -- NOSONAR - compatible. |
| 1182 |
$trustedThemes = json_decode( $userExtension->trusted_themes, true ); |
| 1183 |
if ( ! is_array( $trustedThemes ) ) { |
| 1184 |
$trustedThemes = array(); |
| 1185 |
} |
| 1186 |
?> |
| 1187 |
<div class="ui active tab" data-tab="themes-updates"> |
| 1188 |
<?php |
| 1189 |
/** |
| 1190 |
* Action: mainwp_updates_before_theme_updates |
| 1191 |
* |
| 1192 |
* Fires at the top of the Theme updates tab. |
| 1193 |
* |
| 1194 |
* @param object $websites Object containing child sites info. |
| 1195 |
* @param int $total_theme_upgrades Number of available theme updates. |
| 1196 |
* @param object $userExtension User extension. |
| 1197 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1198 |
* @param array $all_groups Array of all groups. |
| 1199 |
* @param array $allThemes Array of all themes. |
| 1200 |
* @param array $themesInfo Array of all themes info. |
| 1201 |
* @param int $site_offset_for_groups Offset value. |
| 1202 |
* |
| 1203 |
* @since 4.1 |
| 1204 |
*/ |
| 1205 |
do_action( 'mainwp_updates_before_theme_updates', $websites, $total_theme_upgrades, $userExtension, $all_groups_sites, $all_groups, $allThemes, $themesInfo, $site_offset_for_groups ); |
| 1206 |
if ( MAINWP_VIEW_PER_SITE === $site_view ) { |
| 1207 |
/** |
| 1208 |
* Action: mainwp_updates_persite_before_theme_updates |
| 1209 |
* |
| 1210 |
* Fires at the top of the Theme updates tab, per Site view. |
| 1211 |
* |
| 1212 |
* @param object $websites Object containing child sites info. |
| 1213 |
* @param int $total_theme_upgrades Number of available theme updates. |
| 1214 |
* @param object $userExtension User extension. |
| 1215 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1216 |
* @param array $all_groups Array of all groups. |
| 1217 |
* @param array $allThemes Array of all themes. |
| 1218 |
* @param array $themesInfo Array of all themes info. |
| 1219 |
* @param int $site_offset_for_groups Offset value. |
| 1220 |
* |
| 1221 |
* @since 4.1 |
| 1222 |
*/ |
| 1223 |
do_action( 'mainwp_updates_persite_before_theme_updates', $websites, $total_theme_upgrades, $userExtension, $all_groups_sites, $all_groups, $allThemes, $themesInfo, $site_offset_for_groups ); |
| 1224 |
MainWP_Updates_Per_Site::render_themes_updates( $websites, $total_theme_upgrades, $userExtension, $trustedThemes ); |
| 1225 |
/** |
| 1226 |
* Action: mainwp_updates_persite_after_theme_updates |
| 1227 |
* |
| 1228 |
* Fires at the bottom of the Theme updates tab, per Site view. |
| 1229 |
* |
| 1230 |
* @param object $websites Object containing child sites info. |
| 1231 |
* @param int $total_theme_upgrades Number of available theme updates. |
| 1232 |
* @param object $userExtension User extension. |
| 1233 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1234 |
* @param array $all_groups Array of all groups. |
| 1235 |
* @param array $allThemes Array of all themes. |
| 1236 |
* @param array $themesInfo Array of all themes info. |
| 1237 |
* @param int $site_offset_for_groups Offset value. |
| 1238 |
* |
| 1239 |
* @since 4.1 |
| 1240 |
*/ |
| 1241 |
do_action( 'mainwp_updates_persite_after_theme_updates', $websites, $total_theme_upgrades, $userExtension, $all_groups_sites, $all_groups, $allThemes, $themesInfo, $site_offset_for_groups ); |
| 1242 |
} elseif ( MAINWP_VIEW_PER_GROUP === $site_view ) { |
| 1243 |
/** |
| 1244 |
* Action: mainwp_updates_pergroup_before_theme_updates |
| 1245 |
* |
| 1246 |
* Fires at the top of the Theme updates tab, per Group view. |
| 1247 |
* |
| 1248 |
* @param object $websites Object containing child sites info. |
| 1249 |
* @param int $total_theme_upgrades Number of available theme updates. |
| 1250 |
* @param object $userExtension User extension. |
| 1251 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1252 |
* @param array $all_groups Array of all groups. |
| 1253 |
* @param array $allThemes Array of all themes. |
| 1254 |
* @param array $themesInfo Array of all themes info. |
| 1255 |
* @param int $site_offset_for_groups Offset value. |
| 1256 |
* |
| 1257 |
* @since 4.1 |
| 1258 |
*/ |
| 1259 |
do_action( 'mainwp_updates_pergroup_before_theme_updates', $websites, $total_theme_upgrades, $userExtension, $all_groups_sites, $all_groups, $allThemes, $themesInfo, $site_offset_for_groups ); |
| 1260 |
MainWP_Updates_Per_Group::render_themes_updates( $websites, $total_theme_upgrades, $userExtension, $all_groups_sites, $all_groups, $site_offset_for_groups, $trustedThemes ); |
| 1261 |
/** |
| 1262 |
* Action: mainwp_updates_pergroup_after_theme_updates |
| 1263 |
* |
| 1264 |
* Fires at the bottom of the Theme updates tab, per Group view. |
| 1265 |
* |
| 1266 |
* @param object $websites Object containing child sites info. |
| 1267 |
* @param int $total_theme_upgrades Number of available theme updates. |
| 1268 |
* @param object $userExtension User extension. |
| 1269 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1270 |
* @param array $all_groups Array of all groups. |
| 1271 |
* @param array $allThemes Array of all themes. |
| 1272 |
* @param array $themesInfo Array of all themes info. |
| 1273 |
* @param int $site_offset_for_groups Offset value. |
| 1274 |
* |
| 1275 |
* @since 4.1 |
| 1276 |
*/ |
| 1277 |
do_action( 'mainwp_updates_pergroup_after_theme_updates', $websites, $total_theme_upgrades, $userExtension, $all_groups_sites, $all_groups, $allThemes, $themesInfo, $site_offset_for_groups ); |
| 1278 |
} else { |
| 1279 |
/** |
| 1280 |
* Action: mainwp_updates_pertheme_before_theme_updates |
| 1281 |
* |
| 1282 |
* Fires at the top of the Theme updates tab, per Theme view. |
| 1283 |
* |
| 1284 |
* @param object $websites Object containing child sites info. |
| 1285 |
* @param int $total_theme_upgrades Number of available theme updates. |
| 1286 |
* @param object $userExtension User extension. |
| 1287 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1288 |
* @param array $all_groups Array of all groups. |
| 1289 |
* @param array $allThemes Array of all themes. |
| 1290 |
* @param array $themesInfo Array of all themes info. |
| 1291 |
* @param int $site_offset_for_groups Offset value. |
| 1292 |
* |
| 1293 |
* @since 4.1 |
| 1294 |
*/ |
| 1295 |
do_action( 'mainwp_updates_pertheme_before_theme_updates', $websites, $total_theme_upgrades, $userExtension, $all_groups_sites, $all_groups, $allThemes, $themesInfo, $site_offset_for_groups ); |
| 1296 |
MainWP_Updates_Per_Item::render_themes_updates( $websites, $total_theme_upgrades, $userExtension, $allThemes, $themesInfo, $trustedThemes ); |
| 1297 |
/** |
| 1298 |
* Action: mainwp_updates_pertheme_after_theme_updates |
| 1299 |
* |
| 1300 |
* Fires at the bottom of the Theme updates tab, per Theme view. |
| 1301 |
* |
| 1302 |
* @param object $websites Object containing child sites info. |
| 1303 |
* @param int $total_theme_upgrades Number of available theme updates. |
| 1304 |
* @param object $userExtension User extension. |
| 1305 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1306 |
* @param array $all_groups Array of all groups. |
| 1307 |
* @param array $allThemes Array of all themes. |
| 1308 |
* @param array $themesInfo Array of all themes info. |
| 1309 |
* @param int $site_offset_for_groups Offset value. |
| 1310 |
* |
| 1311 |
* @since 4.1 |
| 1312 |
*/ |
| 1313 |
do_action( 'mainwp_updates_pertheme_after_theme_updates', $websites, $total_theme_upgrades, $userExtension, $all_groups_sites, $all_groups, $allThemes, $themesInfo, $site_offset_for_groups ); |
| 1314 |
} |
| 1315 |
/** |
| 1316 |
* Action: mainwp_updates_after_theme_updates |
| 1317 |
* |
| 1318 |
* Fires at the bottom of the Theme updates tab. |
| 1319 |
* |
| 1320 |
* @param object $websites Object containing child sites info. |
| 1321 |
* @param int $total_theme_upgrades Number of available theme updates. |
| 1322 |
* @param object $userExtension User extension. |
| 1323 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1324 |
* @param array $all_groups Array of all groups. |
| 1325 |
* @param array $allThemes Array of all themes. |
| 1326 |
* @param array $themesInfo Array of all themes info. |
| 1327 |
* @param int $site_offset_for_groups Offset value. |
| 1328 |
* |
| 1329 |
* @since 4.1 |
| 1330 |
*/ |
| 1331 |
do_action( 'mainwp_updates_after_theme_updates', $websites, $total_theme_upgrades, $userExtension, $all_groups_sites, $all_groups, $allThemes, $themesInfo, $site_offset_for_groups ); |
| 1332 |
?> |
| 1333 |
</div> |
| 1334 |
<?php |
| 1335 |
} |
| 1336 |
|
| 1337 |
/** |
| 1338 |
* Renders translations update tab. |
| 1339 |
* |
| 1340 |
* @param object $websites Object containing child sites info. |
| 1341 |
* @param int $total_translation_upgrades Number of available translation updates. |
| 1342 |
* @param object $userExtension User extension. |
| 1343 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1344 |
* @param array $all_groups Array of all groups. |
| 1345 |
* @param array $allTranslations Array of all translations. |
| 1346 |
* @param array $translationsInfo Array of all translations info. |
| 1347 |
* @param bool $mainwp_show_language_updates Either or not show language updates. |
| 1348 |
* @param int $site_offset_for_groups Offset value. |
| 1349 |
* @param string $site_view Current Site view. |
| 1350 |
* |
| 1351 |
* @uses \MainWP\Dashboard\MainWP_Updates_Per_Group::render_trans_update() |
| 1352 |
* @uses \MainWP\Dashboard\MainWP_Updates_Per_Item::render_trans_update() |
| 1353 |
* @uses \MainWP\Dashboard\MainWP_Updates_Per_Site::render_trans_update() |
| 1354 |
*/ |
| 1355 |
public static function render_trans_update_tab( $websites, $total_translation_upgrades, $userExtension, $all_groups_sites, $all_groups, $allTranslations, $translationsInfo, $mainwp_show_language_updates, $site_offset_for_groups, $site_view ) { //phpcs:ignore -- NOSONAR - compatible. |
| 1356 |
if ( 1 === (int) $mainwp_show_language_updates ) { |
| 1357 |
?> |
| 1358 |
<div class="ui active tab" data-tab="translations-updates"> |
| 1359 |
<?php |
| 1360 |
/** |
| 1361 |
* Action: mainwp_updates_before_translation_updates |
| 1362 |
* |
| 1363 |
* Fires at the top of the Translation updates tab. |
| 1364 |
* |
| 1365 |
* @param object $websites Object containing child sites info. |
| 1366 |
* @param int $total_translation_upgrades Number of available translation updates. |
| 1367 |
* @param object $userExtension User extension. |
| 1368 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1369 |
* @param array $all_groups Array of all groups. |
| 1370 |
* @param array $allTranslations Array of all translations. |
| 1371 |
* @param array $translationsInfo Array of all translations info. |
| 1372 |
* @param int $site_offset_for_groups Offset value. |
| 1373 |
* |
| 1374 |
* @since 4.1 |
| 1375 |
*/ |
| 1376 |
do_action( 'mainwp_updates_before_translation_updates', $websites, $total_translation_upgrades, $userExtension, $all_groups_sites, $all_groups, $allTranslations, $translationsInfo, $mainwp_show_language_updates, $site_offset_for_groups ); |
| 1377 |
if ( MAINWP_VIEW_PER_SITE === $site_view ) { |
| 1378 |
/** |
| 1379 |
* Action: mainwp_updates_persite_before_translation_updates |
| 1380 |
* |
| 1381 |
* Fires at the top of the Translation updates tab, per Site view. |
| 1382 |
* |
| 1383 |
* @param object $websites Object containing child sites info. |
| 1384 |
* @param int $total_translation_upgrades Number of available translation updates. |
| 1385 |
* @param object $userExtension User extension. |
| 1386 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1387 |
* @param array $all_groups Array of all groups. |
| 1388 |
* @param array $allTranslations Array of all translations. |
| 1389 |
* @param array $translationsInfo Array of all translations info. |
| 1390 |
* @param int $site_offset_for_groups Offset value. |
| 1391 |
* |
| 1392 |
* @since 4.1 |
| 1393 |
*/ |
| 1394 |
do_action( 'mainwp_updates_persite_before_translation_updates', $websites, $total_translation_upgrades, $userExtension, $all_groups_sites, $all_groups, $allTranslations, $translationsInfo, $mainwp_show_language_updates, $site_offset_for_groups ); |
| 1395 |
MainWP_Updates_Per_Site::render_trans_update( $websites, $total_translation_upgrades, $userExtension ); |
| 1396 |
/** |
| 1397 |
* Action: mainwp_updates_persite_after_translation_updates |
| 1398 |
* |
| 1399 |
* Fires at the bottom of the Translation updates tab, per Site view. |
| 1400 |
* |
| 1401 |
* @param object $websites Object containing child sites info. |
| 1402 |
* @param int $total_translation_upgrades Number of available translation updates. |
| 1403 |
* @param object $userExtension User extension. |
| 1404 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1405 |
* @param array $all_groups Array of all groups. |
| 1406 |
* @param array $allTranslations Array of all translations. |
| 1407 |
* @param array $translationsInfo Array of all translations info. |
| 1408 |
* @param int $site_offset_for_groups Offset value. |
| 1409 |
* |
| 1410 |
* @since 4.1 |
| 1411 |
*/ |
| 1412 |
do_action( 'mainwp_updates_persite_after_translation_updates', $websites, $total_translation_upgrades, $userExtension, $all_groups_sites, $all_groups, $allTranslations, $translationsInfo, $mainwp_show_language_updates, $site_offset_for_groups ); |
| 1413 |
} elseif ( MAINWP_VIEW_PER_GROUP === $site_view ) { |
| 1414 |
/** |
| 1415 |
* Action: mainwp_updates_pergroup_before_translation_updates |
| 1416 |
* |
| 1417 |
* Fires at the top of the Translation updates tab, per Group view. |
| 1418 |
* |
| 1419 |
* @param object $websites Object containing child sites info. |
| 1420 |
* @param int $total_translation_upgrades Number of available translation updates. |
| 1421 |
* @param object $userExtension User extension. |
| 1422 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1423 |
* @param array $all_groups Array of all groups. |
| 1424 |
* @param array $allTranslations Array of all translations. |
| 1425 |
* @param array $translationsInfo Array of all translations info. |
| 1426 |
* @param int $site_offset_for_groups Offset value. |
| 1427 |
* |
| 1428 |
* @since 4.1 |
| 1429 |
*/ |
| 1430 |
do_action( 'mainwp_updates_pergroup_before_translation_updates', $websites, $total_translation_upgrades, $userExtension, $all_groups_sites, $all_groups, $allTranslations, $translationsInfo, $mainwp_show_language_updates, $site_offset_for_groups ); |
| 1431 |
MainWP_Updates_Per_Group::render_trans_update( $websites, $total_translation_upgrades, $all_groups_sites, $all_groups, $site_offset_for_groups, $userExtension ); |
| 1432 |
/** |
| 1433 |
* Action: mainwp_updates_pergroup_after_translation_updates |
| 1434 |
* |
| 1435 |
* Fires at the bottom of the Translation updates tab, per Group view. |
| 1436 |
* |
| 1437 |
* @param object $websites Object containing child sites info. |
| 1438 |
* @param int $total_translation_upgrades Number of available translation updates. |
| 1439 |
* @param object $userExtension User extension. |
| 1440 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1441 |
* @param array $all_groups Array of all groups. |
| 1442 |
* @param array $allTranslations Array of all translations. |
| 1443 |
* @param array $translationsInfo Array of all translations info. |
| 1444 |
* @param int $site_offset_for_groups Offset value. |
| 1445 |
* |
| 1446 |
* @since 4.1 |
| 1447 |
*/ |
| 1448 |
do_action( 'mainwp_updates_pergroup_after_translation_updates', $websites, $total_translation_upgrades, $userExtension, $all_groups_sites, $all_groups, $allTranslations, $translationsInfo, $mainwp_show_language_updates, $site_offset_for_groups ); |
| 1449 |
} else { |
| 1450 |
/** |
| 1451 |
* Action: mainwp_updates_pertranslation_before_translation_updates |
| 1452 |
* |
| 1453 |
* Fires at the top of the Translation updates tab, per Translation view. |
| 1454 |
* |
| 1455 |
* @param object $websites Object containing child sites info. |
| 1456 |
* @param int $total_translation_upgrades Number of available translation updates. |
| 1457 |
* @param object $userExtension User extension. |
| 1458 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1459 |
* @param array $all_groups Array of all groups. |
| 1460 |
* @param array $allTranslations Array of all translations. |
| 1461 |
* @param array $translationsInfo Array of all translations info. |
| 1462 |
* @param int $site_offset_for_groups Offset value. |
| 1463 |
* |
| 1464 |
* @since 4.1 |
| 1465 |
*/ |
| 1466 |
do_action( 'mainwp_updates_pertranslation_before_translation_updates', $websites, $total_translation_upgrades, $userExtension, $all_groups_sites, $all_groups, $allTranslations, $translationsInfo, $mainwp_show_language_updates, $site_offset_for_groups ); |
| 1467 |
MainWP_Updates_Per_Item::render_trans_update( $websites, $total_translation_upgrades, $userExtension, $allTranslations, $translationsInfo ); |
| 1468 |
/** |
| 1469 |
* Action: mainwp_updates_pertranslation_after_translation_updates |
| 1470 |
* |
| 1471 |
* Fires at the bottom of the Translation updates tab, per Translation view. |
| 1472 |
* |
| 1473 |
* @param object $websites Object containing child sites info. |
| 1474 |
* @param int $total_translation_upgrades Number of available translation updates. |
| 1475 |
* @param object $userExtension User extension. |
| 1476 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1477 |
* @param array $all_groups Array of all groups. |
| 1478 |
* @param array $allTranslations Array of all translations. |
| 1479 |
* @param array $translationsInfo Array of all translations info. |
| 1480 |
* @param int $site_offset_for_groups Offset value. |
| 1481 |
* |
| 1482 |
* @since 4.1 |
| 1483 |
*/ |
| 1484 |
do_action( 'mainwp_updates_pertranslation_after_translation_updates', $websites, $total_translation_upgrades, $userExtension, $all_groups_sites, $all_groups, $allTranslations, $translationsInfo, $mainwp_show_language_updates, $site_offset_for_groups ); |
| 1485 |
} |
| 1486 |
/** |
| 1487 |
* Action: mainwp_updates_after_translation_updates |
| 1488 |
* |
| 1489 |
* Fires at the bottom of the Translation updates tab. |
| 1490 |
* |
| 1491 |
* @param object $websites Object containing child sites info. |
| 1492 |
* @param int $total_translation_upgrades Number of available translation updates. |
| 1493 |
* @param object $userExtension User extension. |
| 1494 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1495 |
* @param array $all_groups Array of all groups. |
| 1496 |
* @param array $allTranslations Array of all translations. |
| 1497 |
* @param array $translationsInfo Array of all translations info. |
| 1498 |
* @param int $site_offset_for_groups Offset value. |
| 1499 |
* |
| 1500 |
* @since 4.1 |
| 1501 |
*/ |
| 1502 |
do_action( 'mainwp_updates_after_translation_updates', $websites, $total_translation_upgrades, $userExtension, $all_groups_sites, $all_groups, $allTranslations, $translationsInfo, $mainwp_show_language_updates, $site_offset_for_groups ); |
| 1503 |
?> |
| 1504 |
</div> |
| 1505 |
<?php |
| 1506 |
} |
| 1507 |
} |
| 1508 |
|
| 1509 |
/** |
| 1510 |
* Renders abandoned plugins tab. |
| 1511 |
* |
| 1512 |
* @param object $websites Object containing child sites info. |
| 1513 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1514 |
* @param array $all_groups Array of all groups. |
| 1515 |
* @param array $allPluginsOutdate Array of all abandoned plugins. |
| 1516 |
* @param array $decodedDismissedPlugins Array of dismissed abandoned plugins. |
| 1517 |
* @param int $site_offset_for_groups Offset value. |
| 1518 |
* @param string $site_view Current site view. |
| 1519 |
* |
| 1520 |
* @uses \MainWP\Dashboard\MainWP_Updates_Per_Group::render_abandoned_plugins() |
| 1521 |
* @uses \MainWP\Dashboard\MainWP_Updates_Per_Item::render_abandoned_plugins() |
| 1522 |
* @uses \MainWP\Dashboard\MainWP_Updates_Per_Site::render_abandoned_plugins() |
| 1523 |
*/ |
| 1524 |
public static function render_abandoned_plugins_tab( $websites, $all_groups_sites, $all_groups, $allPluginsOutdate, $decodedDismissedPlugins, $site_offset_for_groups, $site_view ) { |
| 1525 |
?> |
| 1526 |
<div class="ui active tab" data-tab="abandoned-plugins"> |
| 1527 |
<?php |
| 1528 |
/** |
| 1529 |
* Action: mainwp_updates_before_abandoned_plugins |
| 1530 |
* |
| 1531 |
* Fires at the top of the Abandoned plugins tab. |
| 1532 |
* |
| 1533 |
* @param object $websites Object containing child sites info. |
| 1534 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1535 |
* @param array $all_groups Array of all groups. |
| 1536 |
* @param array $allPluginsOutdate Array of all abandoned plugins. |
| 1537 |
* @param array $decodedDismissedPlugins Array of dismissed abandoned plugins. |
| 1538 |
* @param int $site_offset_for_groups Offset value. |
| 1539 |
* |
| 1540 |
* @since 4.1 |
| 1541 |
*/ |
| 1542 |
do_action( 'mainwp_updates_before_abandoned_plugins', $websites, $all_groups_sites, $all_groups, $allPluginsOutdate, $decodedDismissedPlugins, $site_offset_for_groups ); |
| 1543 |
if ( MAINWP_VIEW_PER_SITE === $site_view ) { |
| 1544 |
/** |
| 1545 |
* Action: mainwp_updates_persite_before_abandoned_plugins |
| 1546 |
* |
| 1547 |
* Fires at the top of the Abandoned plugins tab, per Site view. |
| 1548 |
* |
| 1549 |
* @param object $websites Object containing child sites info. |
| 1550 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1551 |
* @param array $all_groups Array of all groups. |
| 1552 |
* @param array $allPluginsOutdate Array of all abandoned plugins. |
| 1553 |
* @param array $decodedDismissedPlugins Array of dismissed abandoned plugins. |
| 1554 |
* @param int $site_offset_for_groups Offset value. |
| 1555 |
* |
| 1556 |
* @since 4.1 |
| 1557 |
*/ |
| 1558 |
do_action( 'mainwp_updates_persite_before_abandoned_plugins', $websites, $all_groups_sites, $all_groups, $allPluginsOutdate, $decodedDismissedPlugins, $site_offset_for_groups ); |
| 1559 |
MainWP_Updates_Per_Site::render_abandoned_plugins( $websites, $allPluginsOutdate, $decodedDismissedPlugins ); |
| 1560 |
/** |
| 1561 |
* Action: mainwp_updates_persite_after_abandoned_plugins |
| 1562 |
* |
| 1563 |
* Fires at the bottom of the Abandoned plugins tab, per Site view. |
| 1564 |
* |
| 1565 |
* @param object $websites Object containing child sites info. |
| 1566 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1567 |
* @param array $all_groups Array of all groups. |
| 1568 |
* @param array $allPluginsOutdate Array of all abandoned plugins. |
| 1569 |
* @param array $decodedDismissedPlugins Array of dismissed abandoned plugins. |
| 1570 |
* @param int $site_offset_for_groups Offset value. |
| 1571 |
* |
| 1572 |
* @since 4.1 |
| 1573 |
*/ |
| 1574 |
do_action( 'mainwp_updates_persite_after_abandoned_plugins', $websites, $all_groups_sites, $all_groups, $allPluginsOutdate, $decodedDismissedPlugins, $site_offset_for_groups ); |
| 1575 |
} elseif ( MAINWP_VIEW_PER_GROUP === $site_view ) { |
| 1576 |
/** |
| 1577 |
* Action: mainwp_updates_pergroup_before_abandoned_plugins |
| 1578 |
* |
| 1579 |
* Fires at the top of the Abandoned plugins tab, per Group view. |
| 1580 |
* |
| 1581 |
* @param object $websites Object containing child sites info. |
| 1582 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1583 |
* @param array $all_groups Array of all groups. |
| 1584 |
* @param array $allPluginsOutdate Array of all abandoned plugins. |
| 1585 |
* @param array $decodedDismissedPlugins Array of dismissed abandoned plugins. |
| 1586 |
* @param int $site_offset_for_groups Offset value. |
| 1587 |
* |
| 1588 |
* @since 4.1 |
| 1589 |
*/ |
| 1590 |
do_action( 'mainwp_updates_pergroup_before_abandoned_plugins', $websites, $all_groups_sites, $all_groups, $allPluginsOutdate, $decodedDismissedPlugins, $site_offset_for_groups ); |
| 1591 |
MainWP_Updates_Per_Group::render_abandoned_plugins( $websites, $allPluginsOutdate, $all_groups_sites, $all_groups, $site_offset_for_groups, $decodedDismissedPlugins ); |
| 1592 |
/** |
| 1593 |
* Action: mainwp_updates_pergroup_after_abandoned_plugins |
| 1594 |
* |
| 1595 |
* Fires at the bottom of the Abandoned plugins tab, per Group view. |
| 1596 |
* |
| 1597 |
* @param object $websites Object containing child sites info. |
| 1598 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1599 |
* @param array $all_groups Array of all groups. |
| 1600 |
* @param array $allPluginsOutdate Array of all abandoned plugins. |
| 1601 |
* @param array $decodedDismissedPlugins Array of dismissed abandoned plugins. |
| 1602 |
* @param int $site_offset_for_groups Offset value. |
| 1603 |
* |
| 1604 |
* @since 4.1 |
| 1605 |
*/ |
| 1606 |
do_action( 'mainwp_updates_pergroup_after_abandoned_plugins', $websites, $all_groups_sites, $all_groups, $allPluginsOutdate, $decodedDismissedPlugins, $site_offset_for_groups ); |
| 1607 |
} else { |
| 1608 |
/** |
| 1609 |
* Action: mainwp_updates_perplugin_before_abandoned_plugins |
| 1610 |
* |
| 1611 |
* Fires at the top of the Abandoned plugins tab, per Plugin view. |
| 1612 |
* |
| 1613 |
* @param object $websites Object containing child sites info. |
| 1614 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1615 |
* @param array $all_groups Array of all groups. |
| 1616 |
* @param array $allPluginsOutdate Array of all abandoned plugins. |
| 1617 |
* @param array $decodedDismissedPlugins Array of dismissed abandoned plugins. |
| 1618 |
* @param int $site_offset_for_groups Offset value. |
| 1619 |
* |
| 1620 |
* @since 4.1 |
| 1621 |
*/ |
| 1622 |
do_action( 'mainwp_updates_perplugin_before_abandoned_plugins', $websites, $all_groups_sites, $all_groups, $allPluginsOutdate, $decodedDismissedPlugins, $site_offset_for_groups ); |
| 1623 |
MainWP_Updates_Per_Item::render_abandoned_plugins( $websites, $allPluginsOutdate, $decodedDismissedPlugins ); |
| 1624 |
/** |
| 1625 |
* Action: mainwp_updates_perplugin_after_abandoned_plugins |
| 1626 |
* |
| 1627 |
* Fires at the bottom of the Abandoned plugins tab, per Plugin view. |
| 1628 |
* |
| 1629 |
* @param object $websites Object containing child sites info. |
| 1630 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1631 |
* @param array $all_groups Array of all groups. |
| 1632 |
* @param array $allPluginsOutdate Array of all abandoned plugins. |
| 1633 |
* @param array $decodedDismissedPlugins Array of dismissed abandoned plugins. |
| 1634 |
* @param int $site_offset_for_groups Offset value. |
| 1635 |
* |
| 1636 |
* @since 4.1 |
| 1637 |
*/ |
| 1638 |
do_action( 'mainwp_updates_perplugin_after_abandoned_plugins', $websites, $all_groups_sites, $all_groups, $allPluginsOutdate, $decodedDismissedPlugins, $site_offset_for_groups ); |
| 1639 |
} |
| 1640 |
/** |
| 1641 |
* Action: mainwp_updates_after_abandoned_plugins |
| 1642 |
* |
| 1643 |
* Fires at the bottom of the Abandoned plugins tab. |
| 1644 |
* |
| 1645 |
* @param object $websites Object containing child sites info. |
| 1646 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1647 |
* @param array $all_groups Array of all groups. |
| 1648 |
* @param array $allPluginsOutdate Array of all abandoned plugins. |
| 1649 |
* @param array $decodedDismissedPlugins Array of dismissed abandoned plugins. |
| 1650 |
* @param int $site_offset_for_groups Offset value. |
| 1651 |
* |
| 1652 |
* @since 4.1 |
| 1653 |
*/ |
| 1654 |
do_action( 'mainwp_updates_after_abandoned_plugins', $websites, $all_groups_sites, $all_groups, $allPluginsOutdate, $decodedDismissedPlugins, $site_offset_for_groups ); |
| 1655 |
?> |
| 1656 |
</div> |
| 1657 |
<?php |
| 1658 |
} |
| 1659 |
|
| 1660 |
/** |
| 1661 |
* Renders abandoned themes tab. |
| 1662 |
* |
| 1663 |
* @param object $websites Object containing child sites info. |
| 1664 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1665 |
* @param array $all_groups Array of all groups. |
| 1666 |
* @param array $allThemesOutdate Array of all abandoned plugins. |
| 1667 |
* @param array $decodedDismissedThemes Array of dismissed abandoned plugins. |
| 1668 |
* @param int $site_offset_for_groups Offset value. |
| 1669 |
* @param string $site_view Current site view. |
| 1670 |
* |
| 1671 |
* @uses \MainWP\Dashboard\MainWP_Updates_Per_Group::render_abandoned_themes() |
| 1672 |
* @uses \MainWP\Dashboard\MainWP_Updates_Per_Item::render_abandoned_themes() |
| 1673 |
* @uses \MainWP\Dashboard\MainWP_Updates_Per_Site::render_abandoned_themes() |
| 1674 |
*/ |
| 1675 |
public static function render_abandoned_themes_tab( $websites, $all_groups_sites, $all_groups, $allThemesOutdate, $decodedDismissedThemes, $site_offset_for_groups, $site_view ) { |
| 1676 |
?> |
| 1677 |
<div class="ui active tab" data-tab="abandoned-themes"> |
| 1678 |
<?php |
| 1679 |
/** |
| 1680 |
* Action: mainwp_updates_before_abandoned_themes |
| 1681 |
* |
| 1682 |
* Fires at the top of the Abandoned themes tab. |
| 1683 |
* |
| 1684 |
* @param object $websites Object containing child sites info. |
| 1685 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1686 |
* @param array $all_groups Array of all groups. |
| 1687 |
* @param array $allThemesOutdate Array of all abandoned plugins. |
| 1688 |
* @param array $decodedDismissedThemes Array of dismissed abandoned plugins. |
| 1689 |
* @param int $site_offset_for_groups Offset value. |
| 1690 |
* |
| 1691 |
* @since 4.1 |
| 1692 |
*/ |
| 1693 |
do_action( 'mainwp_updates_before_abandoned_themes', $websites, $all_groups_sites, $all_groups, $allThemesOutdate, $decodedDismissedThemes, $site_offset_for_groups ); |
| 1694 |
if ( MAINWP_VIEW_PER_SITE === $site_view ) { |
| 1695 |
/** |
| 1696 |
* Action: mainwp_updates_persite_before_abandoned_themes |
| 1697 |
* |
| 1698 |
* Fires at the top of the Abandoned themes tab, per Site view. |
| 1699 |
* |
| 1700 |
* @param object $websites Object containing child sites info. |
| 1701 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1702 |
* @param array $all_groups Array of all groups. |
| 1703 |
* @param array $allThemesOutdate Array of all abandoned plugins. |
| 1704 |
* @param array $decodedDismissedThemes Array of dismissed abandoned plugins. |
| 1705 |
* @param int $site_offset_for_groups Offset value. |
| 1706 |
* |
| 1707 |
* @since 4.1 |
| 1708 |
*/ |
| 1709 |
do_action( 'mainwp_updates_persite_before_abandoned_themes', $websites, $all_groups_sites, $all_groups, $allThemesOutdate, $decodedDismissedThemes, $site_offset_for_groups ); |
| 1710 |
MainWP_Updates_Per_Site::render_abandoned_themes( $websites, $allThemesOutdate, $decodedDismissedThemes ); |
| 1711 |
/** |
| 1712 |
* Action: mainwp_updates_persite_after_abandoned_themes |
| 1713 |
* |
| 1714 |
* Fires at the bottom of the Abandoned themes tab, per Site view. |
| 1715 |
* |
| 1716 |
* @param object $websites Object containing child sites info. |
| 1717 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1718 |
* @param array $all_groups Array of all groups. |
| 1719 |
* @param array $allThemesOutdate Array of all abandoned plugins. |
| 1720 |
* @param array $decodedDismissedThemes Array of dismissed abandoned plugins. |
| 1721 |
* @param int $site_offset_for_groups Offset value. |
| 1722 |
* |
| 1723 |
* @since 4.1 |
| 1724 |
*/ |
| 1725 |
do_action( 'mainwp_updates_persite_after_abandoned_themes', $websites, $all_groups_sites, $all_groups, $allThemesOutdate, $decodedDismissedThemes, $site_offset_for_groups ); |
| 1726 |
} elseif ( MAINWP_VIEW_PER_GROUP === $site_view ) { |
| 1727 |
/** |
| 1728 |
* Action: mainwp_updates_pergroup_before_abandoned_themes |
| 1729 |
* |
| 1730 |
* Fires at the top of the Abandoned themes tab, per Group view. |
| 1731 |
* |
| 1732 |
* @param object $websites Object containing child sites info. |
| 1733 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1734 |
* @param array $all_groups Array of all groups. |
| 1735 |
* @param array $allThemesOutdate Array of all abandoned plugins. |
| 1736 |
* @param array $decodedDismissedThemes Array of dismissed abandoned plugins. |
| 1737 |
* @param int $site_offset_for_groups Offset value. |
| 1738 |
* |
| 1739 |
* @since 4.1 |
| 1740 |
*/ |
| 1741 |
do_action( 'mainwp_updates_pergroup_before_abandoned_themes', $websites, $all_groups_sites, $all_groups, $allThemesOutdate, $decodedDismissedThemes, $site_offset_for_groups ); |
| 1742 |
MainWP_Updates_Per_Group::render_abandoned_themes( $websites, $allThemesOutdate, $all_groups_sites, $all_groups, $site_offset_for_groups, $decodedDismissedThemes ); |
| 1743 |
/** |
| 1744 |
* Action: mainwp_updates_pergroup_after_abandoned_themes |
| 1745 |
* |
| 1746 |
* Fires at the bottom of the Abandoned themes tab, per Group view. |
| 1747 |
* |
| 1748 |
* @param object $websites Object containing child sites info. |
| 1749 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1750 |
* @param array $all_groups Array of all groups. |
| 1751 |
* @param array $allThemesOutdate Array of all abandoned plugins. |
| 1752 |
* @param array $decodedDismissedThemes Array of dismissed abandoned plugins. |
| 1753 |
* @param int $site_offset_for_groups Offset value. |
| 1754 |
* |
| 1755 |
* @since 4.1 |
| 1756 |
*/ |
| 1757 |
do_action( 'mainwp_updates_pergroup_after_abandoned_themes', $websites, $all_groups_sites, $all_groups, $allThemesOutdate, $decodedDismissedThemes, $site_offset_for_groups ); |
| 1758 |
} else { |
| 1759 |
/** |
| 1760 |
* Action: mainwp_updates_pertheme_before_abandoned_themes |
| 1761 |
* |
| 1762 |
* Fires at the top of the Abandoned themes tab, per Theme view. |
| 1763 |
* |
| 1764 |
* @param object $websites Object containing child sites info. |
| 1765 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1766 |
* @param array $all_groups Array of all groups. |
| 1767 |
* @param array $allThemesOutdate Array of all abandoned plugins. |
| 1768 |
* @param array $decodedDismissedThemes Array of dismissed abandoned plugins. |
| 1769 |
* @param int $site_offset_for_groups Offset value. |
| 1770 |
* |
| 1771 |
* @since 4.1 |
| 1772 |
*/ |
| 1773 |
do_action( 'mainwp_updates_pertheme_before_abandoned_themes', $websites, $all_groups_sites, $all_groups, $allThemesOutdate, $decodedDismissedThemes, $site_offset_for_groups ); |
| 1774 |
MainWP_Updates_Per_Item::render_abandoned_themes( $websites, $allThemesOutdate, $decodedDismissedThemes ); |
| 1775 |
/** |
| 1776 |
* Action: mainwp_updates_pertheme_after_abandoned_themes |
| 1777 |
* |
| 1778 |
* Fires at the bottom of the Abandoned themes tab, per Theme view. |
| 1779 |
* |
| 1780 |
* @param object $websites Object containing child sites info. |
| 1781 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1782 |
* @param array $all_groups Array of all groups. |
| 1783 |
* @param array $allThemesOutdate Array of all abandoned plugins. |
| 1784 |
* @param array $decodedDismissedThemes Array of dismissed abandoned plugins. |
| 1785 |
* @param int $site_offset_for_groups Offset value. |
| 1786 |
* |
| 1787 |
* @since 4.1 |
| 1788 |
*/ |
| 1789 |
do_action( 'mainwp_updates_pertheme_after_abandoned_themes', $websites, $all_groups_sites, $all_groups, $allThemesOutdate, $decodedDismissedThemes, $site_offset_for_groups ); |
| 1790 |
} |
| 1791 |
/** |
| 1792 |
* Action: mainwp_updates_after_abandoned_themes |
| 1793 |
* |
| 1794 |
* Fires at the bottom of the Abandoned themes tab. |
| 1795 |
* |
| 1796 |
* @param object $websites Object containing child sites info. |
| 1797 |
* @param array $all_groups_sites Array of all groups and sites. |
| 1798 |
* @param array $all_groups Array of all groups. |
| 1799 |
* @param array $allThemesOutdate Array of all abandoned plugins. |
| 1800 |
* @param array $decodedDismissedThemes Array of dismissed abandoned plugins. |
| 1801 |
* @param int $site_offset_for_groups Offset value. |
| 1802 |
* |
| 1803 |
* @since 4.1 |
| 1804 |
*/ |
| 1805 |
do_action( 'mainwp_updates_after_abandoned_themes', $websites, $all_groups_sites, $all_groups, $allThemesOutdate, $decodedDismissedThemes, $site_offset_for_groups ); |
| 1806 |
?> |
| 1807 |
</div> |
| 1808 |
<?php |
| 1809 |
} |
| 1810 |
|
| 1811 |
/** |
| 1812 |
* Renders JavaScript for update page. |
| 1813 |
* |
| 1814 |
* @param string $site_view current site view. |
| 1815 |
*/ |
| 1816 |
public static function render_js_updates( $site_view ) { |
| 1817 |
$table_features = array( |
| 1818 |
'searching' => 'false', |
| 1819 |
'paging' => 'false', |
| 1820 |
'stateSave' => 'true', |
| 1821 |
'info' => 'false', |
| 1822 |
'exclusive' => 'false', |
| 1823 |
'duration' => '200', |
| 1824 |
); |
| 1825 |
/** |
| 1826 |
* Filter: mainwp_updates_table_features |
| 1827 |
* |
| 1828 |
* Filters the Updates table features. |
| 1829 |
* |
| 1830 |
* @since 4.1 |
| 1831 |
*/ |
| 1832 |
$table_features = apply_filters( 'mainwp_updates_table_features', $table_features ); |
| 1833 |
?> |
| 1834 |
<script type="text/javascript"> |
| 1835 |
jQuery( document ).ready( function ($) { |
| 1836 |
jQuery( '#mainwp-manage-updates .ui.accordion' ).accordion( { |
| 1837 |
"exclusive": <?php echo esc_html( $table_features['exclusive'] ); ?>, |
| 1838 |
"duration": <?php echo esc_html( $table_features['duration'] ); ?>, |
| 1839 |
onOpen: function(){ |
| 1840 |
//mainwp_datatable_init_and_fix_recalc('table.mainwp-manage-updates-item-table'); |
| 1841 |
} |
| 1842 |
} ); |
| 1843 |
|
| 1844 |
$('table.mainwp-js-persistent-table').each(function () { |
| 1845 |
const table = this; // DOM element |
| 1846 |
new TablePersistentState(table, { |
| 1847 |
headerSelector: '.handle-accordion-sorting', |
| 1848 |
onPersist:function( { table, column, direction, isrestore } ){ |
| 1849 |
if(isrestore){ |
| 1850 |
const $th = $(table).find( |
| 1851 |
`.handle-accordion-sorting[data-key="${column}"]` // header column must have data-key property. |
| 1852 |
); |
| 1853 |
if (!$th) return; |
| 1854 |
setTimeout(function () {// to fix binding delay issue. |
| 1855 |
$($th).trigger('click'); |
| 1856 |
if(direction === 'desc'){ |
| 1857 |
$($th).trigger('click'); |
| 1858 |
} |
| 1859 |
}, 500); |
| 1860 |
} |
| 1861 |
} |
| 1862 |
}); |
| 1863 |
}); |
| 1864 |
|
| 1865 |
} ); |
| 1866 |
|
| 1867 |
mainwp_datatable_init_and_fix_recalc = function(selector){ |
| 1868 |
jQuery(selector).each( function(e) { |
| 1869 |
if(jQuery(this).is(":visible")){ |
| 1870 |
jQuery(this).css( 'display', 'table' ); |
| 1871 |
jQuery(this).DataTable().destroy(); |
| 1872 |
let tb = jQuery(this).DataTable({ |
| 1873 |
"paging":false, |
| 1874 |
"info": false, |
| 1875 |
"searching": false, |
| 1876 |
"ordering" : false, |
| 1877 |
"responsive": true |
| 1878 |
}); |
| 1879 |
tb.columns.adjust(); |
| 1880 |
tb.responsive.recalc(); |
| 1881 |
} |
| 1882 |
}); |
| 1883 |
} |
| 1884 |
|
| 1885 |
|
| 1886 |
|
| 1887 |
jQuery( document ).on( 'click', '.trigger-all-accordion', function() { |
| 1888 |
if ( jQuery( this ).hasClass( 'active' ) ) { |
| 1889 |
jQuery( this ).removeClass( 'active' ); |
| 1890 |
jQuery( '#mainwp-manage-updates .ui.accordion tr.title' ).each( function( i ) { |
| 1891 |
if ( jQuery( this ).hasClass( 'active' ) ) { |
| 1892 |
jQuery( this ).trigger( 'click' ); |
| 1893 |
} |
| 1894 |
} ); |
| 1895 |
} else { |
| 1896 |
jQuery( this ).addClass( 'active' ); |
| 1897 |
jQuery( '#mainwp-manage-updates .ui.accordion tr.title' ).each( function( i ) { |
| 1898 |
if ( !jQuery( this ).hasClass( 'active' ) ) { |
| 1899 |
jQuery( this ).trigger( 'click' ); |
| 1900 |
} |
| 1901 |
} ); |
| 1902 |
} |
| 1903 |
} ); |
| 1904 |
|
| 1905 |
</script> |
| 1906 |
<?php |
| 1907 |
|
| 1908 |
if ( MAINWP_VIEW_PER_GROUP === $site_view ) { |
| 1909 |
?> |
| 1910 |
<script type="text/javascript"> |
| 1911 |
jQuery( document ).ready( function () { |
| 1912 |
updatesoverview_updates_init_group_view(); |
| 1913 |
} ); |
| 1914 |
</script> |
| 1915 |
<?php |
| 1916 |
} |
| 1917 |
} |
| 1918 |
|
| 1919 |
|
| 1920 |
/** |
| 1921 |
* Gets sites for updates |
| 1922 |
* |
| 1923 |
* @return object Object containing websites info. |
| 1924 |
* |
| 1925 |
* @uses \MainWP\Dashboard\MainWP_DB::query() |
| 1926 |
* @uses \MainWP\Dashboard\MainWP_DB::get_sql_website_by_id() |
| 1927 |
* @uses \MainWP\Dashboard\MainWP_DB::get_sql_websites_for_current_user() |
| 1928 |
* @uses \MainWP\Dashboard\MainWP_DB::fetch_object() |
| 1929 |
* @uses \MainWP\Dashboard\MainWP_DB::data_seek() |
| 1930 |
* @uses \MainWP\Dashboard\MainWP_System_Utility::get_current_wpid() |
| 1931 |
*/ |
| 1932 |
public static function get_sites_for_current_user() { |
| 1933 |
/** |
| 1934 |
* Current user global. |
| 1935 |
* |
| 1936 |
* @global string |
| 1937 |
*/ |
| 1938 |
global $current_user; |
| 1939 |
|
| 1940 |
$current_wpid = MainWP_System_Utility::get_current_wpid(); |
| 1941 |
if ( $current_wpid ) { |
| 1942 |
$sql = MainWP_DB::instance()->get_sql_website_by_id( $current_wpid, false, array( 'premium_upgrades', 'plugins_outdate_dismissed', 'themes_outdate_dismissed', 'ignored_wp_upgrades', 'ignored_trans_updates', 'plugins_outdate_info', 'themes_outdate_info', 'favi_icon', 'site_info' ) ); |
| 1943 |
} else { |
| 1944 |
$staging_enabled = is_plugin_active( 'mainwp-staging-extension/mainwp-staging-extension.php' ) || is_plugin_active( 'mainwp-timecapsule-extension/mainwp-timecapsule-extension.php' ); |
| 1945 |
$is_staging = 'no'; |
| 1946 |
if ( $staging_enabled ) { |
| 1947 |
$staging_updates_view = MainWP_System_Utility::get_select_staging_view_sites(); |
| 1948 |
if ( 'staging' === $staging_updates_view ) { |
| 1949 |
$is_staging = 'yes'; |
| 1950 |
} |
| 1951 |
} |
| 1952 |
$params = array( |
| 1953 |
'connected' => 'yes', |
| 1954 |
'maybe_cache' => true, |
| 1955 |
); |
| 1956 |
|
| 1957 |
$limit_sites = get_option( 'mainwp_manage_updates_limit_sites' ); |
| 1958 |
if ( ! empty( $limit_sites ) ) { |
| 1959 |
$params['limit_sites'] = $limit_sites; |
| 1960 |
} |
| 1961 |
$sql = MainWP_DB::instance()->get_sql_websites_for_current_user( false, null, 'wp.url', false, false, null, false, array( 'wp_upgrades', 'ignored_wp_upgrades', 'ignored_trans_updates', 'premium_upgrades', 'rollback_updates_data', 'plugins_outdate_dismissed', 'themes_outdate_dismissed', 'plugins_outdate_info', 'themes_outdate_info', 'favi_icon', 'site_info' ), $is_staging, $params ); |
| 1962 |
} |
| 1963 |
return MainWP_DB::instance()->query( $sql ); |
| 1964 |
} |
| 1965 |
|
| 1966 |
/** |
| 1967 |
* Renders header tabs |
| 1968 |
* |
| 1969 |
* @param bool $show_language_updates show language update. |
| 1970 |
* @param string $current_tab current tab. |
| 1971 |
* @param int $total_wp_upgrades total WP update. |
| 1972 |
* @param int $total_plugin_upgrades total plugins update. |
| 1973 |
* @param int $total_theme_upgrades total themes update. |
| 1974 |
* @param int $total_translation_upgrades total translation update. |
| 1975 |
* @param int $total_plugins_outdate total plugins outdate. |
| 1976 |
* @param int $total_themes_outdate total theme outdate. |
| 1977 |
* @param string $site_view current site view. |
| 1978 |
*/ |
| 1979 |
public static function render_header_tabs( $show_language_updates, $current_tab, $total_wp_upgrades, $total_plugin_upgrades, $total_theme_upgrades, $total_translation_upgrades, $total_plugins_outdate, $total_themes_outdate, $site_view ) { // phpcs:ignore -- NOSONAR -Current complexity is the only way to achieve desired results, pull request solutions appreciated. |
| 1980 |
|
| 1981 |
/** |
| 1982 |
* Action: mainwp_updates_before_nav_tabs |
| 1983 |
* |
| 1984 |
* Fires before the navigation tabs on the Updates page. |
| 1985 |
* |
| 1986 |
* @since 4.1 |
| 1987 |
*/ |
| 1988 |
do_action( 'mainwp_updates_before_nav_tabs' ); |
| 1989 |
|
| 1990 |
$header_tabs = array( |
| 1991 |
'plugins-updates' => array( |
| 1992 |
'slug' => 'plugins-updates', |
| 1993 |
'title' => esc_html__( 'Plugin Updates', 'mainwp' ), |
| 1994 |
'total_upgrades' => $total_plugin_upgrades, |
| 1995 |
), |
| 1996 |
'themes-updates' => array( |
| 1997 |
'slug' => 'themes-updates', |
| 1998 |
'title' => esc_html__( 'Theme Updates', 'mainwp' ), |
| 1999 |
'total_upgrades' => $total_theme_upgrades, |
| 2000 |
), |
| 2001 |
'wordpress-updates' => array( |
| 2002 |
'slug' => 'wordpress-updates', |
| 2003 |
'title' => esc_html__( 'WordPress Updates', 'mainwp' ), |
| 2004 |
'total_upgrades' => $total_wp_upgrades, |
| 2005 |
), |
| 2006 |
); |
| 2007 |
|
| 2008 |
if ( $show_language_updates ) { |
| 2009 |
$header_tabs['translations-updates'] = array( |
| 2010 |
'slug' => 'translations-updates', |
| 2011 |
'title' => esc_html__( 'Translations Updates', 'mainwp' ), |
| 2012 |
'total_upgrades' => $total_translation_upgrades, |
| 2013 |
); |
| 2014 |
} |
| 2015 |
|
| 2016 |
$header_tabs['abandoned-plugins'] = array( |
| 2017 |
'slug' => 'abandoned-plugins', |
| 2018 |
'title' => esc_html__( 'Abandoned Plugins', 'mainwp' ), |
| 2019 |
'total_upgrades' => $total_plugins_outdate, |
| 2020 |
); |
| 2021 |
|
| 2022 |
$header_tabs['abandoned-themes'] = array( |
| 2023 |
'slug' => 'abandoned-themes', |
| 2024 |
'title' => esc_html__( 'Abandoned Themes', 'mainwp' ), |
| 2025 |
'total_upgrades' => $total_themes_outdate, |
| 2026 |
); |
| 2027 |
|
| 2028 |
$header_tabs = apply_filters( 'mainwp_page_hearder_tabs_updates', $header_tabs ); |
| 2029 |
|
| 2030 |
?> |
| 2031 |
<div id="mainwp-page-navigation-wrapper"> |
| 2032 |
<div class="ui vertical menu mainwp-page-navigation"> |
| 2033 |
<?php |
| 2034 |
foreach ( $header_tabs as $slug => $tab ) { |
| 2035 |
if ( empty( $tab['title'] ) ) { |
| 2036 |
continue; |
| 2037 |
} |
| 2038 |
?> |
| 2039 |
<a class="<?php echo $slug === $current_tab ? 'active' : ''; ?> item" data-tab="<?php echo esc_html( $slug ); ?>" href="admin.php?page=UpdatesManage&tab=<?php echo esc_html( $slug ); ?>"><?php echo esc_html( $tab['title'] ); ?><div class="ui small <?php echo empty( $tab['total_upgrades'] ) ? 'green' : 'red'; ?> label" timestamp="<?php echo esc_html( time() ); ?>"><?php echo intval( $tab['total_upgrades'] ); ?></div></a> |
| 2040 |
<?php |
| 2041 |
} |
| 2042 |
?> |
| 2043 |
</div> |
| 2044 |
</div> |
| 2045 |
<?php |
| 2046 |
|
| 2047 |
$hide_show_updates_per = 'updates-ignore' === $current_tab ? true : false; |
| 2048 |
|
| 2049 |
$hide_show_updates_per = apply_filters( 'mainwp_updates_hide_show_updates_per', $hide_show_updates_per, $current_tab ); |
| 2050 |
|
| 2051 |
$show_select_staging_sites = is_plugin_active( 'mainwp-staging-extension/mainwp-staging-extension.php' ); |
| 2052 |
$has_ignored_updates = in_array( |
| 2053 |
$current_tab, |
| 2054 |
array( 'wordpress-updates', 'plugins-updates', 'themes-updates' ), |
| 2055 |
true |
| 2056 |
) && 0 < static::get_ignored_updates_count( $current_tab ); |
| 2057 |
$show_updates_actions_bar = $has_ignored_updates |
| 2058 |
|| ( 'plugins-updates' === $current_tab && 0 < $total_plugin_upgrades ) |
| 2059 |
|| ( 'themes-updates' === $current_tab && 0 < $total_theme_upgrades ) |
| 2060 |
|| ( 'wordpress-updates' === $current_tab && 0 < $total_wp_upgrades ) |
| 2061 |
|| ( 'translations-updates' === $current_tab && 0 < $total_translation_upgrades ) |
| 2062 |
|| ( 'abandoned-plugins' === $current_tab && 0 < $total_plugins_outdate ) |
| 2063 |
|| ( 'abandoned-themes' === $current_tab && 0 < $total_themes_outdate ); |
| 2064 |
$current_tab_updates_count = 0; |
| 2065 |
|
| 2066 |
if ( 'plugins-updates' === $current_tab ) { |
| 2067 |
$current_tab_updates_count = $total_plugin_upgrades; |
| 2068 |
} elseif ( 'themes-updates' === $current_tab ) { |
| 2069 |
$current_tab_updates_count = $total_theme_upgrades; |
| 2070 |
} elseif ( 'wordpress-updates' === $current_tab ) { |
| 2071 |
$current_tab_updates_count = $total_wp_upgrades; |
| 2072 |
} elseif ( 'translations-updates' === $current_tab ) { |
| 2073 |
$current_tab_updates_count = $total_translation_upgrades; |
| 2074 |
} |
| 2075 |
|
| 2076 |
/** |
| 2077 |
* Action: mainwp_updates_after_nav_tabs |
| 2078 |
* |
| 2079 |
* Fires after the navigation tabs on the Updates page. |
| 2080 |
* |
| 2081 |
* @since 4.1 |
| 2082 |
*/ |
| 2083 |
do_action( 'mainwp_updates_after_nav_tabs' ); |
| 2084 |
|
| 2085 |
/** |
| 2086 |
* Action: mainwp_updates_before_actions_bar |
| 2087 |
* |
| 2088 |
* Fires before the actions bar on the Updates page. |
| 2089 |
* |
| 2090 |
* @since 4.1 |
| 2091 |
*/ |
| 2092 |
do_action( 'mainwp_updates_before_actions_bar' ); |
| 2093 |
?> |
| 2094 |
|
| 2095 |
<?php if ( ! $hide_show_updates_per || $show_select_staging_sites ) : ?> |
| 2096 |
<?php if ( $show_updates_actions_bar ) : ?> |
| 2097 |
<div class="mainwp-sub-header"> |
| 2098 |
<div class="ui three column grid"> |
| 2099 |
<div class="left aligned middle aligned column"> |
| 2100 |
<?php static::render_updates_view_options( $site_view ); ?> |
| 2101 |
<?php |
| 2102 |
if ( $show_select_staging_sites ) { |
| 2103 |
static::render_select_staging_sites_view(); |
| 2104 |
} |
| 2105 |
?> |
| 2106 |
</div> |
| 2107 |
<div class="center aligned middle aligned column"></div> |
| 2108 |
<div class="right aligned middle aligned column"> |
| 2109 |
<?php |
| 2110 |
/** |
| 2111 |
* Action: mainwp_widget_updates_actions_top |
| 2112 |
* |
| 2113 |
* Updates actions top content. |
| 2114 |
* |
| 2115 |
* @since 5.5 |
| 2116 |
*/ |
| 2117 |
do_action( 'mainwp_widget_updates_actions_top', $current_tab ); |
| 2118 |
?> |
| 2119 |
<?php static::render_updates_actions_buttons( $current_tab, $current_tab_updates_count ); ?> |
| 2120 |
<?php static::render_button_view_ignored_updates( $current_tab ); ?> |
| 2121 |
<?php static::render_abandoned_plugins_themes_buttons( $current_tab ); ?> |
| 2122 |
</div> |
| 2123 |
</div> |
| 2124 |
</div> |
| 2125 |
<?php elseif ( $show_select_staging_sites ) : ?> |
| 2126 |
<div class="mainwp-sub-header"> |
| 2127 |
<div class="ui three column grid"> |
| 2128 |
<div class="left aligned middle aligned column"> |
| 2129 |
<?php static::render_select_staging_sites_view(); ?> |
| 2130 |
</div> |
| 2131 |
<div class="center aligned middle aligned column"></div> |
| 2132 |
<div class="right aligned middle aligned column"> |
| 2133 |
</div> |
| 2134 |
</div> |
| 2135 |
</div> |
| 2136 |
<?php endif; ?> |
| 2137 |
<?php endif; ?> |
| 2138 |
<?php |
| 2139 |
/** |
| 2140 |
* Action: mainwp_updates_after_actions_bar |
| 2141 |
* |
| 2142 |
* Fires after the actions bar on the Updates page. |
| 2143 |
* |
| 2144 |
* @since 4.1 |
| 2145 |
*/ |
| 2146 |
do_action( 'mainwp_updates_after_actions_bar' ); |
| 2147 |
} |
| 2148 |
|
| 2149 |
/** |
| 2150 |
* Method handle_post_staging_sites_view. |
| 2151 |
* |
| 2152 |
* @return void |
| 2153 |
*/ |
| 2154 |
public static function handle_post_staging_sites_view() { |
| 2155 |
//phpcs:disable WordPress.Security.NonceVerification.Missing |
| 2156 |
if ( isset( $_POST['mainwpStagingNonceView'] ) && wp_verify_nonce( sanitize_key( $_POST['mainwpStagingNonceView'] ), 'mainwpStagingNonceView' ) ) { |
| 2157 |
global $current_user; |
| 2158 |
if ( isset( $_POST['select_staging_options_siteview'] ) && in_array( $_POST['select_staging_options_siteview'], array( 'live', 'staging' ), true ) ) { |
| 2159 |
update_user_option( $current_user->ID, 'mainwp_staging_options_updates_view', $_POST['select_staging_options_siteview'] ); |
| 2160 |
} |
| 2161 |
} |
| 2162 |
//phpcs:enable WordPress.Security.NonceVerification.Missing |
| 2163 |
} |
| 2164 |
|
| 2165 |
/** |
| 2166 |
* Method render_select_staging_sites_view. |
| 2167 |
* |
| 2168 |
* @return void |
| 2169 |
*/ |
| 2170 |
public static function render_select_staging_sites_view() { |
| 2171 |
$view = MainWP_System_Utility::get_select_staging_view_sites(); |
| 2172 |
$view_stagings = 'staging' === (string) $view ? true : false; |
| 2173 |
|
| 2174 |
?> |
| 2175 |
<form method="post" action="" style="display:inline"> |
| 2176 |
<select class="ui dropdown mini" id="mainwp_staging_select_options_siteview" name="select_staging_options_siteview"> |
| 2177 |
<option value="live" <?php echo $view_stagings ? '' : 'selected'; ?>><?php esc_html_e( 'Production sites', 'mainwp' ); ?></option> |
| 2178 |
<option value="staging" <?php echo $view_stagings ? 'selected' : ''; ?>><?php esc_html_e( 'Staging sites', 'mainwp' ); ?></option> |
| 2179 |
</select> |
| 2180 |
<?php wp_nonce_field( 'mainwpStagingNonceView', 'mainwpStagingNonceView' ); ?> |
| 2181 |
</form> |
| 2182 |
<script type="text/javascript"> |
| 2183 |
jQuery(document).ready(function ($) { |
| 2184 |
jQuery("#mainwp_staging_select_options_siteview").change(function() { |
| 2185 |
jQuery(this).closest("form").submit(); |
| 2186 |
}); |
| 2187 |
}) |
| 2188 |
</script> |
| 2189 |
<?php |
| 2190 |
} |
| 2191 |
|
| 2192 |
|
| 2193 |
/** |
| 2194 |
* Method render_updates_view_options(). |
| 2195 |
* |
| 2196 |
* @param mixed $site_view Site view. |
| 2197 |
* @return void |
| 2198 |
*/ |
| 2199 |
public static function render_updates_view_options( $site_view = '' ) { |
| 2200 |
?> |
| 2201 |
<form method="post" action="" class="ui mini form" style="display:inline flow-root"> |
| 2202 |
<?php MainWP_UI::generate_wp_nonce( 'mainwp-admin-nonce' ); ?> |
| 2203 |
<select class="ui mini dropdown" onchange="mainwp_siteview_onchange(this)" id="mainwp_select_options_siteview" name="select_mainwp_options_siteview"> |
| 2204 |
<option value="1" class="item" <?php echo MAINWP_VIEW_PER_SITE === $site_view ? 'selected' : ''; ?>><?php esc_html_e( 'Show updates per Site', 'mainwp' ); ?></option> |
| 2205 |
<option value="0" class="item" <?php echo MAINWP_VIEW_PER_PLUGIN_THEME === $site_view ? 'selected' : ''; ?>><?php esc_html_e( 'Show updates per Item', 'mainwp' ); ?></option> |
| 2206 |
<option value="2" class="item" <?php echo MAINWP_VIEW_PER_GROUP === $site_view ? 'selected' : ''; ?>><?php esc_html_e( 'Show updates per Tag', 'mainwp' ); ?></option> |
| 2207 |
</select> |
| 2208 |
</form> |
| 2209 |
<?php |
| 2210 |
} |
| 2211 |
|
| 2212 |
/** |
| 2213 |
* Method render_abandoned_plugins_themes_buttons(). |
| 2214 |
* |
| 2215 |
* @param mixed $current_tab Current tab. |
| 2216 |
* @return void |
| 2217 |
*/ |
| 2218 |
public static function render_abandoned_plugins_themes_buttons( $current_tab = '' ) { |
| 2219 |
if ( 'abandoned-plugins' === $current_tab ) { |
| 2220 |
?> |
| 2221 |
<a href="#" onClick="updatesoverview_bulk_check_abandoned('plugin'); return false;" class="ui green mini basic button"><?php esc_html_e( 'Check for Abandoned Plugins', 'mainwp' ); ?></a> |
| 2222 |
<?php } elseif ( 'abandoned-themes' === $current_tab ) { ?> |
| 2223 |
<a href="#" onClick="updatesoverview_bulk_check_abandoned('theme'); return false;" class="ui green mini basic button"><?php esc_html_e( 'Check for Abandoned Themes', 'mainwp' ); ?></a> |
| 2224 |
<?php |
| 2225 |
} |
| 2226 |
} |
| 2227 |
|
| 2228 |
/** |
| 2229 |
* Method get_ignored_core_versions(). |
| 2230 |
* |
| 2231 |
* @param array $decodedIgnoredCores Decoded ignored cores. |
| 2232 |
* |
| 2233 |
* @return array Ignored core versions. |
| 2234 |
*/ |
| 2235 |
public static function get_ignored_core_versions( $decodedIgnoredCores ) { |
| 2236 |
if ( |
| 2237 |
! is_array( $decodedIgnoredCores ) |
| 2238 |
|| empty( $decodedIgnoredCores['ignored_versions'] ) |
| 2239 |
|| ! is_array( $decodedIgnoredCores['ignored_versions'] ) |
| 2240 |
) { |
| 2241 |
return array(); |
| 2242 |
} |
| 2243 |
|
| 2244 |
return array_filter( $decodedIgnoredCores['ignored_versions'] ); |
| 2245 |
} |
| 2246 |
|
| 2247 |
/** |
| 2248 |
* Method get_ignored_updates_count(). |
| 2249 |
* |
| 2250 |
* @param string $current_tab Current tab. |
| 2251 |
* |
| 2252 |
* @return int Ignored updates count. |
| 2253 |
*/ |
| 2254 |
public static function get_ignored_updates_count( $current_tab = '' ) { //phpcs:ignore -- NOSONAR - complex. |
| 2255 |
if ( ! in_array( $current_tab, array( 'wordpress-updates', 'plugins-updates', 'themes-updates' ), true ) ) { |
| 2256 |
return 0; |
| 2257 |
} |
| 2258 |
|
| 2259 |
if ( isset( static::$ignored_updates_counts[ $current_tab ] ) ) { |
| 2260 |
return static::$ignored_updates_counts[ $current_tab ]; |
| 2261 |
} |
| 2262 |
|
| 2263 |
$count = 0; |
| 2264 |
$userExtension = MainWP_DB_Common::instance()->get_user_extension(); |
| 2265 |
|
| 2266 |
if ( 'plugins-updates' === $current_tab ) { |
| 2267 |
$decodedIgnoredPlugins = is_object( $userExtension ) && ! empty( $userExtension->ignored_plugins ) ? json_decode( $userExtension->ignored_plugins, true ) : array(); |
| 2268 |
$count = is_array( $decodedIgnoredPlugins ) ? count( $decodedIgnoredPlugins ) : 0; |
| 2269 |
} elseif ( 'themes-updates' === $current_tab ) { |
| 2270 |
$decodedIgnoredThemes = is_object( $userExtension ) && ! empty( $userExtension->ignored_themes ) ? json_decode( $userExtension->ignored_themes, true ) : array(); |
| 2271 |
$count = is_array( $decodedIgnoredThemes ) ? count( $decodedIgnoredThemes ) : 0; |
| 2272 |
} elseif ( 'wordpress-updates' === $current_tab ) { |
| 2273 |
$decodedIgnoredCores = is_object( $userExtension ) && ! empty( $userExtension->ignored_wp_upgrades ) ? json_decode( $userExtension->ignored_wp_upgrades, true ) : array(); |
| 2274 |
$count = count( static::get_ignored_core_versions( $decodedIgnoredCores ) ); |
| 2275 |
} |
| 2276 |
|
| 2277 |
$websites = MainWP_DB::instance()->query( |
| 2278 |
MainWP_DB::instance()->get_sql_websites_for_current_user( |
| 2279 |
false, |
| 2280 |
null, |
| 2281 |
'wp.url', |
| 2282 |
false, |
| 2283 |
false, |
| 2284 |
null, |
| 2285 |
false, |
| 2286 |
array( 'ignored_wp_upgrades' ) |
| 2287 |
) |
| 2288 |
); |
| 2289 |
|
| 2290 |
while ( $websites && ( $website = MainWP_DB::fetch_object( $websites ) ) ) { |
| 2291 |
if ( 'plugins-updates' === $current_tab ) { |
| 2292 |
$decodedIgnoredPlugins = ! empty( $website->ignored_plugins ) ? json_decode( $website->ignored_plugins, true ) : array(); |
| 2293 |
if ( ! empty( $decodedIgnoredPlugins ) && is_array( $decodedIgnoredPlugins ) ) { |
| 2294 |
++$count; |
| 2295 |
} |
| 2296 |
} elseif ( 'themes-updates' === $current_tab ) { |
| 2297 |
$decodedIgnoredThemes = ! empty( $website->ignored_themes ) ? json_decode( $website->ignored_themes, true ) : array(); |
| 2298 |
if ( ! empty( $decodedIgnoredThemes ) && is_array( $decodedIgnoredThemes ) ) { |
| 2299 |
++$count; |
| 2300 |
} |
| 2301 |
} elseif ( 'wordpress-updates' === $current_tab && empty( $website->is_ignoreCoreUpdates ) ) { |
| 2302 |
$decodedIgnoredCores = ! empty( $website->ignored_wp_upgrades ) ? json_decode( $website->ignored_wp_upgrades, true ) : array(); |
| 2303 |
if ( ! empty( static::get_ignored_core_versions( $decodedIgnoredCores ) ) ) { |
| 2304 |
++$count; |
| 2305 |
} |
| 2306 |
} |
| 2307 |
} |
| 2308 |
|
| 2309 |
if ( $websites ) { |
| 2310 |
MainWP_DB::free_result( $websites ); |
| 2311 |
} |
| 2312 |
|
| 2313 |
static::$ignored_updates_counts[ $current_tab ] = $count; |
| 2314 |
|
| 2315 |
return $count; |
| 2316 |
} |
| 2317 |
|
| 2318 |
/** |
| 2319 |
* Method render_updates_actions_buttons(). |
| 2320 |
* |
| 2321 |
* @param mixed $current_tab Current tab. |
| 2322 |
* @param int $updates_count Available updates count. |
| 2323 |
* @return void |
| 2324 |
*/ |
| 2325 |
public static function render_updates_actions_buttons( $current_tab, $updates_count = 0 ) { |
| 2326 |
$has_updates = 0 < intval( $updates_count ); |
| 2327 |
|
| 2328 |
if ( 'plugins-updates' === $current_tab ) { |
| 2329 |
if ( static::user_can_update_plugins() ) { |
| 2330 |
if ( $has_updates ) { |
| 2331 |
static::set_continue_update_html_selector( 'plugins_global_upgrade_all' ); |
| 2332 |
?> |
| 2333 |
<a href="javascript:void(0)" onClick="updatesoverview_plugins_global_upgrade_all( false, true ); return false;" class="mainwp-update-selected-button ui mini green basic button"><?php esc_html_e( 'Update Selected Plugins', 'mainwp' ); ?></a> |
| 2334 |
<a href="javascript:void(0)" onClick="updatesoverview_plugins_global_upgrade_all(); return false;" class="mainwp-update-all-button ui mini green button"><?php esc_html_e( 'Update All Plugins', 'mainwp' ); ?></a> |
| 2335 |
<?php |
| 2336 |
} else { |
| 2337 |
?> |
| 2338 |
<a href="javascript:void(0)" class="mainwp-update-selected-button ui mini green basic disabled button" aria-disabled="true" tabindex="-1"><?php esc_html_e( 'Update Selected Plugins', 'mainwp' ); ?></a> |
| 2339 |
<a href="javascript:void(0)" class="mainwp-update-all-button ui mini green disabled button" aria-disabled="true" tabindex="-1"><?php esc_html_e( 'Update All Plugins', 'mainwp' ); ?></a> |
| 2340 |
<?php |
| 2341 |
} |
| 2342 |
} |
| 2343 |
} elseif ( 'themes-updates' === $current_tab ) { |
| 2344 |
if ( static::user_can_update_themes() ) { |
| 2345 |
if ( $has_updates ) { |
| 2346 |
static::set_continue_update_html_selector( 'themes_global_upgrade_all' ); |
| 2347 |
?> |
| 2348 |
<a href="javascript:void(0)" onClick="updatesoverview_themes_global_upgrade_all( false, true ); return false;" class="mainwp-update-selected-button ui mini green basic button"><?php esc_html_e( 'Update Selected Themes', 'mainwp' ); ?></a> |
| 2349 |
<a href="javascript:void(0)" onClick="updatesoverview_themes_global_upgrade_all(); return false;" class="mainwp-update-all-button ui mini green button"><?php esc_html_e( 'Update All Themes', 'mainwp' ); ?></a> |
| 2350 |
<?php |
| 2351 |
} else { |
| 2352 |
?> |
| 2353 |
<a href="javascript:void(0)" class="mainwp-update-selected-button ui mini green basic disabled button" aria-disabled="true" tabindex="-1"><?php esc_html_e( 'Update Selected Themes', 'mainwp' ); ?></a> |
| 2354 |
<a href="javascript:void(0)" class="mainwp-update-all-button ui mini green disabled button" aria-disabled="true" tabindex="-1"><?php esc_html_e( 'Update All Themes', 'mainwp' ); ?></a> |
| 2355 |
<?php |
| 2356 |
} |
| 2357 |
} |
| 2358 |
} elseif ( 'wordpress-updates' === $current_tab ) { |
| 2359 |
if ( static::user_can_update_wp() ) { |
| 2360 |
if ( $has_updates ) { |
| 2361 |
static::set_continue_update_html_selector( 'wpcore_global_upgrade_all' ); |
| 2362 |
?> |
| 2363 |
<a href="javascript:void(0)" class="mainwp-update-selected-button ui green mini basic button" onclick="event.stopPropagation(); updatesoverview_wordpress_global_upgrade_all( false, true ); return false;"><?php esc_html_e( 'Update Selected WP Cores', 'mainwp' ); ?></a> |
| 2364 |
<a href="javascript:void(0)" class="mainwp-update-all-button ui green mini button" onclick="updatesoverview_wordpress_global_upgrade_all(); return false;"><?php esc_html_e( 'Update All WP Cores', 'mainwp' ); ?></a> |
| 2365 |
<?php |
| 2366 |
} else { |
| 2367 |
?> |
| 2368 |
<a href="javascript:void(0)" class="mainwp-update-selected-button ui green mini basic disabled button" aria-disabled="true" tabindex="-1"><?php esc_html_e( 'Update Selected WP Cores', 'mainwp' ); ?></a> |
| 2369 |
<a href="javascript:void(0)" class="mainwp-update-all-button ui green mini disabled button" aria-disabled="true" tabindex="-1"><?php esc_html_e( 'Update All WP Cores', 'mainwp' ); ?></a> |
| 2370 |
<?php |
| 2371 |
} |
| 2372 |
} |
| 2373 |
} elseif ( 'translations-updates' === $current_tab ) { |
| 2374 |
if ( static::user_can_update_trans() ) { |
| 2375 |
?> |
| 2376 |
<a href="javascript:void(0)" onClick="updatesoverview_translations_global_upgrade_all( false, true ); return false;" class="mainwp-update-selected-button ui button mini basic green"><?php esc_html_e( 'Update Selected Translations', 'mainwp' ); ?></a> |
| 2377 |
<a href="javascript:void(0)" onClick="updatesoverview_translations_global_upgrade_all(); return false;" class="mainwp-update-all-button ui button mini green"><?php esc_html_e( 'Update All Translations', 'mainwp' ); ?></a> |
| 2378 |
<?php |
| 2379 |
} |
| 2380 |
} |
| 2381 |
} |
| 2382 |
|
| 2383 |
|
| 2384 |
/** |
| 2385 |
* Method render_button_view_ignored_updates(). |
| 2386 |
* |
| 2387 |
* @uses \MainWP\Dashboard\MainWP_DB_Common::get_user_extension() |
| 2388 |
* @uses \MainWP\Dashboard\MainWP_DB::get_sql_websites_for_current_user() |
| 2389 |
* @uses \MainWP\Dashboard\MainWP_DB::fetch_object() |
| 2390 |
* |
| 2391 |
* @param string $current_tab current tab. |
| 2392 |
* |
| 2393 |
* @return null |
| 2394 |
*/ |
| 2395 |
public static function render_button_view_ignored_updates( $current_tab = '' ) { //phpcs:ignore -- NOSONAR - complex. |
| 2396 |
if ( ! in_array( $current_tab, array( 'wordpress-updates', 'plugins-updates', 'themes-updates' ) ) ) { |
| 2397 |
return; |
| 2398 |
} |
| 2399 |
$count_ignored_updates = static::get_ignored_updates_count( $current_tab ); |
| 2400 |
$ignored_core_url = add_query_arg( |
| 2401 |
array( |
| 2402 |
'page' => 'UpdatesManage', |
| 2403 |
'tab' => 'updates-ignore', |
| 2404 |
), |
| 2405 |
admin_url( 'admin.php' ) |
| 2406 |
); |
| 2407 |
$ignored_plugins_url = add_query_arg( |
| 2408 |
array( |
| 2409 |
'page' => 'PluginsIgnore', |
| 2410 |
), |
| 2411 |
admin_url( 'admin.php' ) |
| 2412 |
); |
| 2413 |
$ignored_themes_url = add_query_arg( |
| 2414 |
array( |
| 2415 |
'page' => 'ThemesIgnore', |
| 2416 |
), |
| 2417 |
admin_url( 'admin.php' ) |
| 2418 |
); |
| 2419 |
?> |
| 2420 |
<?php if ( 'wordpress-updates' === $current_tab && 0 < $count_ignored_updates ) : ?> |
| 2421 |
<a class="ui mini basic button" href="<?php echo esc_url( $ignored_core_url ); ?>" data-position="bottom right" data-tooltip="<?php esc_attr_e( 'Click here to see the list of ignored WordPress core updates.', 'mainwp' ); ?>" data-inverted=""><?php esc_html_e( 'View Ignored Updates', 'mainwp' ); ?></a> |
| 2422 |
<?php elseif ( 'plugins-updates' === $current_tab && 0 < $count_ignored_updates ) : ?> |
| 2423 |
<a class="ui mini basic button" href="<?php echo esc_url( $ignored_plugins_url ); ?>"><?php esc_html_e( 'View Ignored Updates', 'mainwp' ); ?></a> |
| 2424 |
<?php elseif ( 'themes-updates' === $current_tab && 0 < $count_ignored_updates ) : ?> |
| 2425 |
<a class="ui mini basic button" href="<?php echo esc_url( $ignored_themes_url ); ?>" ><?php esc_html_e( 'View Ignored Updates', 'mainwp' ); ?></a> |
| 2426 |
<?php endif; ?> |
| 2427 |
<?php |
| 2428 |
} |
| 2429 |
|
| 2430 |
/** |
| 2431 |
* Method handle_limit_sites(). |
| 2432 |
*/ |
| 2433 |
public static function handle_limit_sites(){ // phpcs:ignore -- NOSONAR - complex function. Current complexity is the only way to achieve desired results, pull request solutions appreciated. |
| 2434 |
// put hook here before loading sites. |
| 2435 |
$limit_number = apply_filters( 'mainwp_manage_updates_limit_loading', false, 'updates' ); |
| 2436 |
$current_limit = get_option( 'mainwp_manage_updates_limit_sites' ); |
| 2437 |
|
| 2438 |
if ( (int) $limit_number !== (int) $current_limit ) { |
| 2439 |
update_option( 'mainwp_manage_updates_limit_sites', $limit_number ); |
| 2440 |
update_option( 'mainwp_manage_updates_limit_current_page', 1 ); |
| 2441 |
} |
| 2442 |
|
| 2443 |
if ( ! empty( $limit_number ) ) { |
| 2444 |
|
| 2445 |
$count = MainWP_DB::instance()->get_websites_count( null, true ); |
| 2446 |
|
| 2447 |
$current_page = 1; |
| 2448 |
if ( isset( $_GET['current_page'] ) && isset( $_GET['_opennonce'] ) && wp_verify_nonce( sanitize_key( $_GET['_opennonce'] ), 'mainwp-admin-nonce' ) ) { |
| 2449 |
$current_page = intval( $_GET['current_page'] ); |
| 2450 |
} |
| 2451 |
|
| 2452 |
if ( 0 >= $current_page ) { |
| 2453 |
$current_page = 1; |
| 2454 |
} |
| 2455 |
|
| 2456 |
$total_page = ceil( $count / $limit_number ); |
| 2457 |
|
| 2458 |
if ( $current_page > $total_page ) { |
| 2459 |
$current_page = $total_page; |
| 2460 |
} |
| 2461 |
update_option( 'mainwp_manage_updates_limit_current_page', $current_page ); |
| 2462 |
} |
| 2463 |
} |
| 2464 |
|
| 2465 |
/** |
| 2466 |
* Method render_limit_load_sites(). |
| 2467 |
* |
| 2468 |
* @param int $limit_number limit loading sites. |
| 2469 |
*/ |
| 2470 |
public static function render_limit_load_sites( $limit_number) { // phpcs:ignore -- NOSONAR - complex function. Current complexity is the only way to achieve desired results, pull request solutions appreciated. |
| 2471 |
|
| 2472 |
$count = MainWP_DB::instance()->get_websites_count( null, true ); |
| 2473 |
$total_page = ceil( $count / $limit_number ); |
| 2474 |
|
| 2475 |
$current_page = (int) get_option( 'mainwp_manage_updates_limit_current_page' ); |
| 2476 |
|
| 2477 |
$first = 1 === $current_page; |
| 2478 |
$last = $total_page <= $current_page; |
| 2479 |
|
| 2480 |
?> |
| 2481 |
<div class="dt-paging paging_full_numbers"> |
| 2482 |
<div class="ui stackable pagination menu"><menu> |
| 2483 |
<?php if ( $first ) { ?> |
| 2484 |
<li class="dt-paging-button item disabled"><div class="page-link first" aria-controls="mainwp-manage-sites-table" aria-disabled="true" aria-label="First" data-dt-idx="first" tabindex="-1">First</div></li> |
| 2485 |
<li class="dt-paging-button item disabled"><div class="page-link previous" aria-controls="mainwp-manage-sites-table" aria-disabled="true" aria-label="Previous" data-dt-idx="previous" tabindex="-1">Previous</div></li> |
| 2486 |
<?php } else { ?> |
| 2487 |
<li class="dt-paging-button item"><a href="admin.php?page=UpdatesManage" class="page-link first" aria-controls="mainwp-manage-sites-table" aria-label="First" data-dt-idx="first" tabindex="0">First</a></li> |
| 2488 |
<li class="dt-paging-button item"><a href="admin.php?page=UpdatesManage¤t_page=<?php echo intval( $current_page - 1 ); ?>&_opennonce=<?php echo esc_html( wp_create_nonce( 'mainwp-admin-nonce' ) ); ?>" class="page-link previous" aria-controls="mainwp-manage-sites-table" aria-label="Previous" data-dt-idx="previous" tabindex="0">Previous</a></li> |
| 2489 |
<?php } ?> |
| 2490 |
<?php |
| 2491 |
for ( $i = 1; $i <= $total_page;$i++ ) { |
| 2492 |
?> |
| 2493 |
<li class="dt-paging-button item <?php echo $current_page === $i ? 'active' : ''; ?>"><a href="admin.php?page=UpdatesManage¤t_page=<?php echo intval( $i ); ?>&_opennonce=<?php echo esc_html( wp_create_nonce( 'mainwp-admin-nonce' ) ); ?>" class="page-link" aria-controls="mainwp-manage-sites-table" aria-current="page" data-dt-idx="1" tabindex="0"><?php echo intval( $i ); ?></a></li> |
| 2494 |
<?php |
| 2495 |
} |
| 2496 |
?> |
| 2497 |
<?php if ( $last ) { ?> |
| 2498 |
<li class="dt-paging-button item disabled"><div class="page-link next" aria-controls="mainwp-manage-sites-table" aria-disabled="true" aria-label="Next" data-dt-idx="next" tabindex="-1">Next</div></li> |
| 2499 |
<li class="dt-paging-button item disabled"><div class="page-link last" aria-controls="mainwp-manage-sites-table" aria-disabled="true" aria-label="Last" data-dt-idx="last" tabindex="-1">Last</div></li> |
| 2500 |
<?php } else { ?> |
| 2501 |
<li class="dt-paging-button item"><a href="admin.php?page=UpdatesManage¤t_page=<?php echo $current_page === $last ? intval( $last ) : intval( $current_page + 1 ); ?>&_opennonce=<?php echo esc_html( wp_create_nonce( 'mainwp-admin-nonce' ) ); ?>" class="page-link next" aria-controls="mainwp-manage-sites-table" aria-label="Next" data-dt-idx="next" tabindex="0">Next</a></li> |
| 2502 |
<li class="dt-paging-button item"><a href="admin.php?page=UpdatesManage¤t_page=<?php echo intval( $total_page ); ?>&_opennonce=<?php echo esc_html( wp_create_nonce( 'mainwp-admin-nonce' ) ); ?>" class="page-link last" aria-controls="mainwp-manage-sites-table" aria-label="Last" data-dt-idx="last" tabindex="0">Last</a></li> |
| 2503 |
<?php } ?> |
| 2504 |
</menu></div> |
| 2505 |
</div> |
| 2506 |
<br/> |
| 2507 |
<?php |
| 2508 |
} |
| 2509 |
|
| 2510 |
/** |
| 2511 |
* Cheks which primary backup plugin is being used. |
| 2512 |
* |
| 2513 |
* @param mixed $what Which backup plugin is being use. |
| 2514 |
* @param object $website Website array of information. |
| 2515 |
* |
| 2516 |
* @return boolean True|False. |
| 2517 |
*/ |
| 2518 |
public static function activated_primary_backup_plugin( $what, $website ) { |
| 2519 |
$plugins = json_decode( $website->plugins, 1 ); |
| 2520 |
if ( ! is_array( $plugins ) || empty( $plugins ) ) { |
| 2521 |
return false; |
| 2522 |
} |
| 2523 |
|
| 2524 |
$checks = array( |
| 2525 |
'backupbuddy' => 'backupbuddy/backupbuddy.php', |
| 2526 |
'backupwp' => array( 'backwpup/backwpup.php', 'backwpup-pro/backwpup.php' ), |
| 2527 |
'updraftplus' => 'updraftplus/updraftplus.php', |
| 2528 |
|
| 2529 |
); |
| 2530 |
|
| 2531 |
$slug = isset( $checks[ $what ] ) ? $checks[ $what ] : ''; |
| 2532 |
|
| 2533 |
if ( empty( $slug ) ) { |
| 2534 |
return false; |
| 2535 |
} |
| 2536 |
|
| 2537 |
$installed = false; |
| 2538 |
|
| 2539 |
foreach ( $plugins as $plugin ) { |
| 2540 |
if ( ( is_string( $slug ) && strtolower( $plugin['slug'] ) === $slug ) || ( is_array( $slug ) && in_array( $plugin['slug'], $slug ) ) ) { |
| 2541 |
if ( $plugin['active'] ) { |
| 2542 |
$installed = true; |
| 2543 |
} |
| 2544 |
break; |
| 2545 |
} |
| 2546 |
} |
| 2547 |
|
| 2548 |
return $installed; |
| 2549 |
} |
| 2550 |
|
| 2551 |
/** |
| 2552 |
* Sets the HTML selector to continue updates. |
| 2553 |
* |
| 2554 |
* @param string $current_update current update string. |
| 2555 |
* @param bool $slug Whether to update slug. |
| 2556 |
*/ |
| 2557 |
public static function set_continue_update_html_selector( $current_update, $slug = false ) { |
| 2558 |
|
| 2559 |
$check_slug = true; |
| 2560 |
if ( ! empty( $slug ) ) { |
| 2561 |
$check_slug = ( $slug === static::$continue_update_slug ) ? true : false; |
| 2562 |
} |
| 2563 |
|
| 2564 |
if ( $check_slug && $current_update === static::$continue_update ) { |
| 2565 |
static::$continue_selector = 'updatesoverview_continue_update_me'; |
| 2566 |
} else { |
| 2567 |
static::$continue_selector = ''; |
| 2568 |
} |
| 2569 |
} |
| 2570 |
|
| 2571 |
/** |
| 2572 |
* Gets the HTML selector to continue updates. |
| 2573 |
* |
| 2574 |
* @return void. |
| 2575 |
*/ |
| 2576 |
public static function get_continue_update_selector() { |
| 2577 |
echo esc_attr( static::$continue_selector ); |
| 2578 |
} |
| 2579 |
|
| 2580 |
/** |
| 2581 |
* Displays the updates modal window during updates. |
| 2582 |
*/ |
| 2583 |
public static function render_updates_modal() { |
| 2584 |
?> |
| 2585 |
<div class="ui modal" id="updatesoverview-backup-box"> |
| 2586 |
<div class="header"><?php esc_html_e( 'Backup Check', 'mainwp' ); ?></div> |
| 2587 |
<div class="scrolling content mainwp-modal-content"></div> |
| 2588 |
<div class="actions mainwp-modal-actions"> |
| 2589 |
<input id="updatesoverview-backup-all" type="button" name="Backup All" value="<?php esc_html_e( 'Backup All', 'mainwp' ); ?>" class="button-primary"/> |
| 2590 |
<a id="updatesoverview-backup-now" href="javascript:void(0)" target="_blank" style="display: none" class="button-primary button"><?php esc_html_e( 'Backup Now', 'mainwp' ); ?></a> |
| 2591 |
<input id="updatesoverview-backup-ignore" type="button" name="Ignore" value="<?php esc_html_e( 'Ignore', 'mainwp' ); ?>" class="button"/> |
| 2592 |
</div> |
| 2593 |
</div> |
| 2594 |
<?php |
| 2595 |
} |
| 2596 |
|
| 2597 |
/** |
| 2598 |
* Displays the plugin details modal window. |
| 2599 |
*/ |
| 2600 |
public static function render_plugin_details_modal() { |
| 2601 |
?> |
| 2602 |
<div class="ui modal" id="mainwp-plugin-details-modal"> |
| 2603 |
<i class="close icon"></i> |
| 2604 |
<div class="header"><?php echo esc_html__( 'Plugin Details', 'mainwp' ); ?></div> |
| 2605 |
<div class="content"> |
| 2606 |
<div class="ui embed"></div> |
| 2607 |
</div> |
| 2608 |
<div class="actions"> |
| 2609 |
</div> |
| 2610 |
</div> |
| 2611 |
<?php |
| 2612 |
} |
| 2613 |
|
| 2614 |
/** |
| 2615 |
* Method get_site_tz_info(). |
| 2616 |
* |
| 2617 |
* @param object $website Website. |
| 2618 |
* |
| 2619 |
* @return string Timezone site info. |
| 2620 |
*/ |
| 2621 |
public static function get_site_tz_info( $website ) { |
| 2622 |
if ( is_object( $website ) && ! empty( $website->site_info ) ) { |
| 2623 |
$wp_info = ! empty( $website->site_info ) ? json_decode( $website->site_info, true ) : array(); |
| 2624 |
if ( ! is_array( $wp_info ) ) { |
| 2625 |
$wp_info = array(); |
| 2626 |
} |
| 2627 |
$use_tzformat = ! empty( $wp_info['format_datetime'] ) && is_array( $wp_info['format_datetime'] ) ? $wp_info['format_datetime'] : array(); |
| 2628 |
$offs = ! empty( $use_tzformat['gmt_offset'] ) ? intval( $use_tzformat['gmt_offset'] ) : 0; |
| 2629 |
return esc_html__( '- Timezone:', 'mainwp' ) . ' UTC' . ( $offs >= 0 ? '+' . $offs : $offs ); |
| 2630 |
} |
| 2631 |
return ''; |
| 2632 |
} |
| 2633 |
|
| 2634 |
/** |
| 2635 |
* Method render_changes_history_modal() |
| 2636 |
*/ |
| 2637 |
public static function render_changes_history_modal() { |
| 2638 |
?> |
| 2639 |
<div class="ui modal" id="mainwp-plugin-theme-history-changes-modal"> |
| 2640 |
<i class="close icon"></i> |
| 2641 |
<div class="ui header"> |
| 2642 |
<div class="main-text"><?php esc_html_e( 'History', 'mainwp' ); ?></div> |
| 2643 |
<div class="sub header" style="display:none;"></div> |
| 2644 |
</div> |
| 2645 |
<div class="scrolling content"></div> |
| 2646 |
<div class="actions"> |
| 2647 |
<div class="ui two columns stackable grid"> |
| 2648 |
<div class="left aligned column col-left"></div> |
| 2649 |
<div class="right aligned column col-right"></div> |
| 2650 |
</div> |
| 2651 |
</div> |
| 2652 |
</div> |
| 2653 |
<?php |
| 2654 |
} |
| 2655 |
|
| 2656 |
/** |
| 2657 |
* Method render_screen_options_modal() |
| 2658 |
* |
| 2659 |
* Renders Page Settings Modal. |
| 2660 |
*/ |
| 2661 |
public static function render_screen_options_modal() { // phpcs:ignore -- NOSONAR - complex method. |
| 2662 |
|
| 2663 |
$snAutomaticDailyUpdate = (int) get_option( 'mainwp_automaticDailyUpdate' ); |
| 2664 |
$snPluginAutomaticDailyUpdate = (int) get_option( 'mainwp_pluginAutomaticDailyUpdate' ); |
| 2665 |
$snThemeAutomaticDailyUpdate = (int) get_option( 'mainwp_themeAutomaticDailyUpdate' ); |
| 2666 |
$snTransAutomaticUpdate = (int) get_option( 'mainwp_transAutomaticDailyUpdate' ); |
| 2667 |
|
| 2668 |
$mainwp_show_language_updates = (int) get_option( 'mainwp_show_language_updates', 1 ); |
| 2669 |
$disableUpdateConfirmations = (int) get_option( 'mainwp_disable_update_confirmations', 0 ); |
| 2670 |
$delay_autoupdate = (int) get_option( 'mainwp_delay_autoupdate', 1 ); |
| 2671 |
?> |
| 2672 |
<div class="ui modal" id="mainwp-manage-updates-screen-options-modal"> |
| 2673 |
<i class="close icon"></i> |
| 2674 |
<div class="header"><?php esc_html_e( 'Page Settings', 'mainwp' ); ?></div> |
| 2675 |
<div class="scrolling content ui form"> |
| 2676 |
<form method="POST" action="" id="manage-updates-screen-options-form" name="manage-updates-screen-options-form"> |
| 2677 |
<?php MainWP_UI::generate_wp_nonce( 'mainwp-admin-nonce' ); ?> |
| 2678 |
<input type="hidden" name="wp_nonce" value="<?php echo esc_attr( wp_create_nonce( 'UpdatesScrOptions' ) ); ?>" /> |
| 2679 |
<div class="ui grid field"> |
| 2680 |
<label class="six wide column middle aligned"><?php esc_html_e( 'Plugin advanced automatic updates', 'mainwp' ); ?></label> |
| 2681 |
<div class="ten wide column" data-tooltip="<?php esc_attr_e( 'Enable or disable automatic plugin updates.', 'mainwp' ); ?>" data-inverted="" data-position="bottom left"> |
| 2682 |
<select name="mainwp_pluginAutomaticDailyUpdate" id="mainwp_pluginAutomaticDailyUpdate" class="ui dropdown"> |
| 2683 |
<option value="1" <?php echo 1 === $snPluginAutomaticDailyUpdate ? 'selected' : ''; ?>><?php esc_html_e( 'Install Trusted Updates', 'mainwp' ); ?></option> |
| 2684 |
<option value="0" <?php echo ( false !== $snPluginAutomaticDailyUpdate && empty( $snPluginAutomaticDailyUpdate ) ) || 2 === $snPluginAutomaticDailyUpdate ? 'selected' : ''; ?>><?php esc_html_e( 'Disabled', 'mainwp' ); ?></option> |
| 2685 |
</select> |
| 2686 |
</div> |
| 2687 |
</div> |
| 2688 |
<div class="ui grid field"> |
| 2689 |
<label class="six wide column middle aligned"><?php esc_html_e( 'Theme advanced automatic updates', 'mainwp' ); ?></label> |
| 2690 |
<div class="ten wide column" data-tooltip="<?php esc_attr_e( 'Enable or disable automatic theme updates.', 'mainwp' ); ?>" data-inverted="" data-position="top left"> |
| 2691 |
<select name="mainwp_themeAutomaticDailyUpdate" id="mainwp_themeAutomaticDailyUpdate" class="ui dropdown"> |
| 2692 |
<option value="1" <?php echo 1 === $snThemeAutomaticDailyUpdate ? 'selected' : ''; ?>><?php esc_html_e( 'Install Trusted Updates', 'mainwp' ); ?></option> |
| 2693 |
<option value="0" <?php echo ( false !== $snThemeAutomaticDailyUpdate && 0 === $snThemeAutomaticDailyUpdate ) || 2 === $snThemeAutomaticDailyUpdate ? 'selected' : ''; ?>><?php esc_html_e( 'Disabled', 'mainwp' ); ?></option> |
| 2694 |
</select> |
| 2695 |
</div> |
| 2696 |
</div> |
| 2697 |
<div class="ui grid field"> |
| 2698 |
<label class="six wide column middle aligned"><?php esc_html_e( 'Translation advanced automatic updates', 'mainwp' ); ?></label> |
| 2699 |
<div class="ten wide column" data-tooltip="<?php esc_attr_e( 'Enable or disable automatic translation updates.', 'mainwp' ); ?>" data-inverted="" data-position="top left"> |
| 2700 |
<select name="mainwp_transAutomaticDailyUpdate" id="mainwp_transAutomaticDailyUpdate" class="ui dropdown"> |
| 2701 |
<option value="1" <?php echo 1 === $snTransAutomaticUpdate ? 'selected' : ''; ?>><?php esc_html_e( 'Install Trusted Updates', 'mainwp' ); ?></option> |
| 2702 |
<option value="0" <?php echo ( false !== $snTransAutomaticUpdate && 0 === $snTransAutomaticUpdate ) || 2 === $snTransAutomaticUpdate ? 'selected' : ''; ?>><?php esc_html_e( 'Disabled', 'mainwp' ); ?></option> |
| 2703 |
</select> |
| 2704 |
</div> |
| 2705 |
</div> |
| 2706 |
<div class="ui grid field"> |
| 2707 |
<label class="six wide column middle aligned"><?php esc_html_e( 'WP Core advanced automatic updates', 'mainwp' ); ?></label> |
| 2708 |
<div class="ten wide column" data-tooltip="<?php esc_attr_e( 'Enable or disable automatic WordPress core updates.', 'mainwp' ); ?>" data-inverted="" data-position="top left"> |
| 2709 |
<select name="mainwp_automaticDailyUpdate" id="mainwp_automaticDailyUpdate" class="ui dropdown"> |
| 2710 |
<option value="1" <?php echo 1 === $snAutomaticDailyUpdate ? 'selected' : ''; ?>><?php esc_html_e( 'Install Trusted Updates', 'mainwp' ); ?></option> |
| 2711 |
<option value="0" <?php echo ( false !== $snAutomaticDailyUpdate && 0 === $snAutomaticDailyUpdate ) || 2 === $snAutomaticDailyUpdate ? 'selected' : ''; ?>><?php esc_html_e( 'Disabled', 'mainwp' ); ?></option> |
| 2712 |
</select> |
| 2713 |
</div> |
| 2714 |
</div> |
| 2715 |
<div class="ui grid field"> |
| 2716 |
<label class="six wide column middle aligned"><?php esc_html_e( 'Advanced automatic updates delay', 'mainwp' ); ?></label> |
| 2717 |
<div class="ten wide column ui input" data-tooltip="<?php esc_attr_e( 'Set the number of days to delay automatic updates.', 'mainwp' ); ?>" data-inverted="" data-position="top left"> |
| 2718 |
<select name="mainwp_delay_autoupdate" id="mainwp_delay_autoupdate" class="ui dropdown"> |
| 2719 |
<option value="0" <?php echo 0 === $delay_autoupdate ? 'selected' : ''; ?>><?php esc_html_e( 'Delay off', 'mainwp' ); ?></option> |
| 2720 |
<option value="1" <?php echo 1 === $delay_autoupdate ? 'selected' : ''; ?>><?php esc_html_e( '1 day', 'mainwp' ); ?></option> |
| 2721 |
<option value="2" <?php echo 2 === $delay_autoupdate ? 'selected' : ''; ?>><?php esc_html_e( '2 days', 'mainwp' ); ?></option> |
| 2722 |
<option value="3" <?php echo 3 === $delay_autoupdate ? 'selected' : ''; ?>><?php esc_html_e( '3 days', 'mainwp' ); ?></option> |
| 2723 |
<option value="4" <?php echo 4 === $delay_autoupdate ? 'selected' : ''; ?>><?php esc_html_e( '4 days', 'mainwp' ); ?></option> |
| 2724 |
<option value="5" <?php echo 5 === $delay_autoupdate ? 'selected' : ''; ?>><?php esc_html_e( '5 days', 'mainwp' ); ?></option> |
| 2725 |
<option value="6" <?php echo 6 === $delay_autoupdate ? 'selected' : ''; ?>><?php esc_html_e( '6 days', 'mainwp' ); ?></option> |
| 2726 |
<option value="7" <?php echo 7 === $delay_autoupdate ? 'selected' : ''; ?>><?php esc_html_e( '7 days', 'mainwp' ); ?></option> |
| 2727 |
<option value="14" <?php echo 14 === $delay_autoupdate ? 'selected' : ''; ?>><?php esc_html_e( '14 days', 'mainwp' ); ?></option> |
| 2728 |
<option value="30" <?php echo 30 === $delay_autoupdate ? 'selected' : ''; ?>><?php esc_html_e( '30 days', 'mainwp' ); ?></option> |
| 2729 |
</select> |
| 2730 |
</div> |
| 2731 |
</div> |
| 2732 |
<div class="ui grid field"> |
| 2733 |
<label class="six wide column middle aligned"><?php esc_html_e( 'Show WordPress language updates', 'mainwp' ); ?></label> |
| 2734 |
<div class="ten wide column ui toggle checkbox" data-tooltip="<?php esc_attr_e( 'Enable if you want to manage Translation updates', 'mainwp' ); ?>" data-inverted="" data-position="top left"> |
| 2735 |
<input type="checkbox" name="mainwp_show_language_updates" id="mainwp_show_language_updates" <?php echo 1 === $mainwp_show_language_updates ? 'checked="true"' : ''; ?>/> |
| 2736 |
</div> |
| 2737 |
</div> |
| 2738 |
<div class="ui grid field"> |
| 2739 |
<label class="six wide column middle aligned"><?php esc_html_e( 'Update confirmations', 'mainwp' ); ?></label> |
| 2740 |
<div class="ten wide column ui toggle checkbox" data-tooltip="<?php esc_attr_e( 'Choose if you want to disable the popup confirmations when performing updates.', 'mainwp' ); ?>" data-inverted="" data-position="top left"> |
| 2741 |
<select name="mainwp_disable_update_confirmations" id="mainwp_disable_update_confirmations" class="ui dropdown"> |
| 2742 |
<option value="0" <?php echo 0 === $disableUpdateConfirmations ? 'selected' : ''; ?>><?php esc_html_e( 'Enable', 'mainwp' ); ?></option> |
| 2743 |
<option value="2" <?php echo 2 === $disableUpdateConfirmations ? 'selected' : ''; ?>><?php esc_html_e( 'Disable', 'mainwp' ); ?></option> |
| 2744 |
<option value="1" <?php echo 1 === $disableUpdateConfirmations ? 'selected' : ''; ?>><?php esc_html_e( 'Disable for single updates', 'mainwp' ); ?></option> |
| 2745 |
</select> |
| 2746 |
</div> |
| 2747 |
</div> |
| 2748 |
<div class="ui hidden divider"></div> |
| 2749 |
<div class="ui hidden divider"></div> |
| 2750 |
</div> |
| 2751 |
<div class="actions"> |
| 2752 |
<div class="ui two columns grid"> |
| 2753 |
<div class="left aligned column"></div> |
| 2754 |
<div class="ui right aligned column"> |
| 2755 |
<input type="submit" class="ui green button" name="btnSubmit" id="submit-manage-updates-settings" value="<?php esc_attr_e( 'Save Settings', 'mainwp' ); ?>" /> |
| 2756 |
</div> |
| 2757 |
</div> |
| 2758 |
</div> |
| 2759 |
</form> |
| 2760 |
</div> |
| 2761 |
<?php |
| 2762 |
} |
| 2763 |
|
| 2764 |
|
| 2765 |
/** |
| 2766 |
* Method mainwp_help_content() |
| 2767 |
* |
| 2768 |
* Creates the MainWP Help Documentation List for the help component in the sidebar. |
| 2769 |
*/ |
| 2770 |
public static function mainwp_help_content() { |
| 2771 |
if ( isset( $_GET['page'] ) && 'UpdatesManage' === $_GET['page'] ) { // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 2772 |
?> |
| 2773 |
<p><?php esc_html_e( 'If you need help with managing updates, please review following help documents', 'mainwp' ); ?></p> |
| 2774 |
<div class="ui list"> |
| 2775 |
<div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/updates/manage-updates#plugin-updates" target="_blank">Update Plugins</a></div> |
| 2776 |
<div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/updates/manage-updates#plugin-auto-updates" target="_blank">Plugins Auto Updates</a></div> |
| 2777 |
<div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/updates/manage-updates#ignore-plugin-updates" target="_blank">Ignore Plugin Updates</a></div> |
| 2778 |
<div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/updates/manage-updates#ignore-plugin-updates" target="_blank">Update Themes</a></div> |
| 2779 |
<div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/updates/manage-updates#theme-auto-updates" target="_blank">Themes Auto Updates</a></div> |
| 2780 |
<div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/updates/manage-updates#ignore-theme-updates" target="_blank">Ignore Theme Updates</a></div> |
| 2781 |
<div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/updates/manage-updates#wordpress-core-updates" target="_blank">Update WordPress Core</a></div> |
| 2782 |
<div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/updates/manage-updates#auto-update-wordpress-core" target="_blank">Auto Update WordPress Core</a></div> |
| 2783 |
<div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/updates/manage-updates#ignore-wordpress-core-updates" target="_blank">Ignore WordPress Core Update</a></div> |
| 2784 |
<div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/updates/manage-updates#safe-updates-%2F-rollback" target="_blank">Safe Updates/Updates Rollback</a></div> |
| 2785 |
<?php |
| 2786 |
/** |
| 2787 |
* Action: mainwp_updates_help_item |
| 2788 |
* |
| 2789 |
* Fires at the bottom of the help articles list in the Help sidebar on the Updates page. |
| 2790 |
* |
| 2791 |
* Suggested HTML markup: |
| 2792 |
* |
| 2793 |
* <div class="item"><a href="Your custom URL">Your custom text</a></div> |
| 2794 |
* |
| 2795 |
* @since 4.1 |
| 2796 |
*/ |
| 2797 |
do_action( 'mainwp_updates_help_item' ); |
| 2798 |
?> |
| 2799 |
</div> |
| 2800 |
<?php |
| 2801 |
} |
| 2802 |
} |
| 2803 |
} |
| 2804 |
|