Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/woocomme.../src/Internal/Admin
File: SystemStatusReport.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Add additional system status report sections.
[2] Fix | Delete
*/
[3] Fix | Delete
[4] Fix | Delete
namespace Automattic\WooCommerce\Internal\Admin;
[5] Fix | Delete
[6] Fix | Delete
use Automattic\WooCommerce\Admin\Notes\Notes;
[7] Fix | Delete
defined( 'ABSPATH' ) || exit;
[8] Fix | Delete
[9] Fix | Delete
/**
[10] Fix | Delete
* SystemStatusReport class.
[11] Fix | Delete
*/
[12] Fix | Delete
class SystemStatusReport {
[13] Fix | Delete
/**
[14] Fix | Delete
* Class instance.
[15] Fix | Delete
*
[16] Fix | Delete
* @var SystemStatus instance
[17] Fix | Delete
*/
[18] Fix | Delete
protected static $instance = null;
[19] Fix | Delete
[20] Fix | Delete
/**
[21] Fix | Delete
* Get class instance.
[22] Fix | Delete
*/
[23] Fix | Delete
public static function get_instance() {
[24] Fix | Delete
if ( ! self::$instance ) {
[25] Fix | Delete
self::$instance = new self();
[26] Fix | Delete
}
[27] Fix | Delete
return self::$instance;
[28] Fix | Delete
}
[29] Fix | Delete
[30] Fix | Delete
/**
[31] Fix | Delete
* Hook into WooCommerce.
[32] Fix | Delete
*/
[33] Fix | Delete
public function __construct() {
[34] Fix | Delete
add_action( 'woocommerce_system_status_report', array( $this, 'system_status_report' ) );
[35] Fix | Delete
}
[36] Fix | Delete
[37] Fix | Delete
/**
[38] Fix | Delete
* Hooks extra necessary sections into the system status report template
[39] Fix | Delete
*/
[40] Fix | Delete
public function system_status_report() {
[41] Fix | Delete
?>
[42] Fix | Delete
<table class="wc_status_table widefat" cellspacing="0">
[43] Fix | Delete
<thead>
[44] Fix | Delete
<tr>
[45] Fix | Delete
<th colspan="5" data-export-label="Admin">
[46] Fix | Delete
<h2>
[47] Fix | Delete
<?php esc_html_e( 'Admin', 'woocommerce' ); ?><?php echo wc_help_tip( esc_html__( 'This section shows details of WC Admin.', 'woocommerce' ) ); ?>
[48] Fix | Delete
</h2>
[49] Fix | Delete
</th>
[50] Fix | Delete
</tr>
[51] Fix | Delete
</thead>
[52] Fix | Delete
<tbody>
[53] Fix | Delete
<?php
[54] Fix | Delete
$this->render_features();
[55] Fix | Delete
$this->render_daily_cron();
[56] Fix | Delete
$this->render_options();
[57] Fix | Delete
$this->render_notes();
[58] Fix | Delete
$this->render_onboarding_state();
[59] Fix | Delete
?>
[60] Fix | Delete
</tbody>
[61] Fix | Delete
</table>
[62] Fix | Delete
<?php
[63] Fix | Delete
}
[64] Fix | Delete
[65] Fix | Delete
/**
[66] Fix | Delete
* Render features rows.
[67] Fix | Delete
*/
[68] Fix | Delete
public function render_features() {
[69] Fix | Delete
/**
[70] Fix | Delete
* Filter the admin feature configs.
[71] Fix | Delete
*
[72] Fix | Delete
* @since 6.5.0
[73] Fix | Delete
*/
[74] Fix | Delete
$features = apply_filters( 'woocommerce_admin_get_feature_config', wc_admin_get_feature_config() );
[75] Fix | Delete
$enabled_features = array_filter( $features );
[76] Fix | Delete
$disabled_features = array_filter(
[77] Fix | Delete
$features,
[78] Fix | Delete
function( $feature ) {
[79] Fix | Delete
return empty( $feature );
[80] Fix | Delete
}
[81] Fix | Delete
);
[82] Fix | Delete
[83] Fix | Delete
?>
[84] Fix | Delete
<tr>
[85] Fix | Delete
<td data-export-label="Enabled Features">
[86] Fix | Delete
<?php esc_html_e( 'Enabled Features', 'woocommerce' ); ?>:
[87] Fix | Delete
</td>
[88] Fix | Delete
<td class="help"><?php echo wc_help_tip( esc_html__( 'Which features are enabled?', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
[89] Fix | Delete
<td>
[90] Fix | Delete
<?php
[91] Fix | Delete
echo esc_html( implode( ', ', array_keys( $enabled_features ) ) )
[92] Fix | Delete
?>
[93] Fix | Delete
</td>
[94] Fix | Delete
</tr>
[95] Fix | Delete
[96] Fix | Delete
<tr>
[97] Fix | Delete
<td data-export-label="Disabled Features">
[98] Fix | Delete
<?php esc_html_e( 'Disabled Features', 'woocommerce' ); ?>:
[99] Fix | Delete
</td>
[100] Fix | Delete
<td class="help"><?php echo wc_help_tip( esc_html__( 'Which features are disabled?', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
[101] Fix | Delete
<td>
[102] Fix | Delete
<?php
[103] Fix | Delete
echo esc_html( implode( ', ', array_keys( $disabled_features ) ) )
[104] Fix | Delete
?>
[105] Fix | Delete
</td>
[106] Fix | Delete
</tr>
[107] Fix | Delete
<?php
[108] Fix | Delete
}
[109] Fix | Delete
[110] Fix | Delete
[111] Fix | Delete
/**
[112] Fix | Delete
* Render daily cron row.
[113] Fix | Delete
*/
[114] Fix | Delete
public function render_daily_cron() {
[115] Fix | Delete
$next_daily_cron = wp_next_scheduled( 'wc_admin_daily' );
[116] Fix | Delete
?>
[117] Fix | Delete
<tr>
[118] Fix | Delete
<td data-export-label="Daily Cron">
[119] Fix | Delete
<?php esc_html_e( 'Daily Cron', 'woocommerce' ); ?>:
[120] Fix | Delete
</td>
[121] Fix | Delete
<td class="help"><?php echo wc_help_tip( esc_html__( 'Is the daily cron job active, when does it next run?', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
[122] Fix | Delete
<td>
[123] Fix | Delete
<?php
[124] Fix | Delete
if ( empty( $next_daily_cron ) ) {
[125] Fix | Delete
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . esc_html__( 'Not scheduled', 'woocommerce' ) . '</mark>';
[126] Fix | Delete
} else {
[127] Fix | Delete
echo '<mark class="yes"><span class="dashicons dashicons-yes"></span> Next scheduled: ' . esc_html( date_i18n( 'Y-m-d H:i:s P', $next_daily_cron ) ) . '</mark>';
[128] Fix | Delete
}
[129] Fix | Delete
?>
[130] Fix | Delete
</td>
[131] Fix | Delete
</tr>
[132] Fix | Delete
<?php
[133] Fix | Delete
}
[134] Fix | Delete
[135] Fix | Delete
/**
[136] Fix | Delete
* Render option row.
[137] Fix | Delete
*/
[138] Fix | Delete
public function render_options() {
[139] Fix | Delete
$woocommerce_admin_install_timestamp = get_option( 'woocommerce_admin_install_timestamp' );
[140] Fix | Delete
[141] Fix | Delete
$all_options_expected = is_numeric( $woocommerce_admin_install_timestamp )
[142] Fix | Delete
&& 0 < (int) $woocommerce_admin_install_timestamp
[143] Fix | Delete
&& is_array( get_option( 'woocommerce_onboarding_profile', array() ) );
[144] Fix | Delete
[145] Fix | Delete
?>
[146] Fix | Delete
<tr>
[147] Fix | Delete
<td data-export-label="Options">
[148] Fix | Delete
<?php esc_html_e( 'Options', 'woocommerce' ); ?>:
[149] Fix | Delete
</td>
[150] Fix | Delete
<td class="help"><?php echo wc_help_tip( esc_html__( 'Do the important options return expected values?', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
[151] Fix | Delete
<td>
[152] Fix | Delete
<?php
[153] Fix | Delete
if ( $all_options_expected ) {
[154] Fix | Delete
echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>';
[155] Fix | Delete
} else {
[156] Fix | Delete
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . esc_html__( 'Not all expected', 'woocommerce' ) . '</mark>';
[157] Fix | Delete
}
[158] Fix | Delete
?>
[159] Fix | Delete
</td>
[160] Fix | Delete
</tr>
[161] Fix | Delete
<?php
[162] Fix | Delete
}
[163] Fix | Delete
[164] Fix | Delete
/**
[165] Fix | Delete
* Render the notes row.
[166] Fix | Delete
*/
[167] Fix | Delete
public function render_notes() {
[168] Fix | Delete
$notes_count = Notes::get_notes_count();
[169] Fix | Delete
[170] Fix | Delete
?>
[171] Fix | Delete
<tr>
[172] Fix | Delete
<td data-export-label="Notes">
[173] Fix | Delete
<?php esc_html_e( 'Notes', 'woocommerce' ); ?>:
[174] Fix | Delete
</td>
[175] Fix | Delete
<td class="help"><?php echo wc_help_tip( esc_html__( 'How many notes in the database?', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
[176] Fix | Delete
<td>
[177] Fix | Delete
<?php
[178] Fix | Delete
echo esc_html( $notes_count )
[179] Fix | Delete
?>
[180] Fix | Delete
</td>
[181] Fix | Delete
</tr>
[182] Fix | Delete
<?php
[183] Fix | Delete
}
[184] Fix | Delete
[185] Fix | Delete
/**
[186] Fix | Delete
* Render the onboarding state row.
[187] Fix | Delete
*/
[188] Fix | Delete
public function render_onboarding_state() {
[189] Fix | Delete
$onboarding_profile = get_option( 'woocommerce_onboarding_profile', array() );
[190] Fix | Delete
$onboarding_state = '-';
[191] Fix | Delete
[192] Fix | Delete
if ( isset( $onboarding_profile['skipped'] ) && $onboarding_profile['skipped'] ) {
[193] Fix | Delete
$onboarding_state = 'skipped';
[194] Fix | Delete
}
[195] Fix | Delete
[196] Fix | Delete
if ( isset( $onboarding_profile['completed'] ) && $onboarding_profile['completed'] ) {
[197] Fix | Delete
$onboarding_state = 'completed';
[198] Fix | Delete
}
[199] Fix | Delete
[200] Fix | Delete
?>
[201] Fix | Delete
<tr>
[202] Fix | Delete
<td data-export-label="Onboarding">
[203] Fix | Delete
<?php esc_html_e( 'Onboarding', 'woocommerce' ); ?>:
[204] Fix | Delete
</td>
[205] Fix | Delete
<td class="help"><?php echo wc_help_tip( esc_html__( 'Was onboarding completed or skipped?', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
[206] Fix | Delete
<td>
[207] Fix | Delete
<?php
[208] Fix | Delete
echo esc_html( $onboarding_state )
[209] Fix | Delete
?>
[210] Fix | Delete
</td>
[211] Fix | Delete
</tr>
[212] Fix | Delete
<?php
[213] Fix | Delete
}
[214] Fix | Delete
[215] Fix | Delete
}
[216] Fix | Delete
[217] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function