' . esc_html__( 'Monitoring', 'mainwp' ) . '', 'read', 'MonitoringSites', array( static::get_class_name(), 'render_all_sites', ) ); add_action( 'load-' . static::$page, array( static::get_class_name(), 'on_load_page' ) ); } /** * Method on_load_page() * * Run on page load. * * @uses \MainWP\Dashboard\MainWP_Monitoring_Sites_List_Table */ public static function on_load_page() { add_filter( 'mainwp_header_actions_right', array( static::get_class_name(), 'screen_options' ), 10, 2 ); static::$sitesTable = new MainWP_Monitoring_Sites_List_Table(); } /** * Method screen_options() * * Create Page Settings button. * * @param mixed $input Page Settings button HTML. * * @return mixed Page Settings button. */ public static function screen_options( $input ) { return $input . ' '; } /** * Method render_screen_options() * * Render Page Settings Modal. */ public static function render_screen_options() { // phpcs:ignore -- NOSONAR -Current complexity is the only way to achieve desired results, pull request solutions appreciated. $columns = static::$sitesTable->get_columns(); if ( isset( $columns['cb'] ) ) { unset( $columns['cb'] ); } if ( isset( $columns['favicon'] ) ) { $columns['favicon'] = esc_html__( 'Favicon', 'mainwp' ); } if ( isset( $columns['login'] ) ) { $columns['login'] = esc_html__( 'Jump to WP Admin', 'mainwp' ); } if ( isset( $columns['site_preview'] ) ) { $columns['site_preview'] = esc_html__( 'Site preview', 'mainwp' ); } if ( isset( $columns['last24_status'] ) ) { $columns['last24_status'] = esc_html__( 'Last 24h Status', 'mainwp' ); } if ( isset( $columns['lighthouse_desktop_score'] ) ) { $columns['lighthouse_desktop_score'] = esc_html__( 'Lighthouse Desktop Score', 'mainwp' ); } if ( isset( $columns['lighthouse_mobile_score'] ) ) { $columns['lighthouse_mobile_score'] = esc_html__( 'Lighthouse Mobile Score', 'mainwp' ); } $sites_per_page = get_option( 'mainwp_default_monitoring_sites_per_page', 25 ); if ( isset( $columns['site_actions'] ) && empty( $columns['site_actions'] ) ) { $columns['site_actions'] = esc_html__( 'Actions', 'mainwp' ); } $show_cols = get_user_option( 'mainwp_settings_show_monitoring_sites_columns' ); if ( false === $show_cols ) { // to backwards. $show_cols = array(); foreach ( $columns as $name => $title ) { $show_cols[ $name ] = 1; } $user = wp_get_current_user(); if ( $user ) { update_user_option( $user->ID, 'mainwp_settings_show_monitoring_sites_columns', $show_cols, true ); } } if ( ! is_array( $show_cols ) ) { $show_cols = array(); } ?> prepare_items( false ); } /** This action is documented in ../pages/page-mainwp-manage-sites.php */ do_action( 'mainwp_pageheader_sites', 'MonitoringSites' ); ?>
display( $optimize_for_sites_table ); static::$sitesTable->clear_items(); ?>
prepare_items( true ); $output = static::$sitesTable->ajax_get_datatable_rows(); static::$sitesTable->clear_items(); wp_send_json( $output ); } }