Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/woocomme.../includes/admin
File: class-wc-admin-status.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Debug/Status page
[2] Fix | Delete
*
[3] Fix | Delete
* @package WooCommerce\Admin\System Status
[4] Fix | Delete
* @version 2.2.0
[5] Fix | Delete
*/
[6] Fix | Delete
[7] Fix | Delete
use Automattic\Jetpack\Constants;
[8] Fix | Delete
use Automattic\WooCommerce\Internal\Admin\Logging\PageController as LoggingPageController;
[9] Fix | Delete
[10] Fix | Delete
defined( 'ABSPATH' ) || exit;
[11] Fix | Delete
[12] Fix | Delete
/**
[13] Fix | Delete
* WC_Admin_Status Class.
[14] Fix | Delete
*/
[15] Fix | Delete
class WC_Admin_Status {
[16] Fix | Delete
/**
[17] Fix | Delete
* An instance of the DB log handler list table.
[18] Fix | Delete
*
[19] Fix | Delete
* @var WC_Admin_Log_Table_List
[20] Fix | Delete
*/
[21] Fix | Delete
private static $db_log_list_table;
[22] Fix | Delete
[23] Fix | Delete
/**
[24] Fix | Delete
* Handles output of the reports page in admin.
[25] Fix | Delete
*/
[26] Fix | Delete
public static function output() {
[27] Fix | Delete
include_once __DIR__ . '/views/html-admin-page-status.php';
[28] Fix | Delete
}
[29] Fix | Delete
[30] Fix | Delete
/**
[31] Fix | Delete
* Handles output of report.
[32] Fix | Delete
*/
[33] Fix | Delete
public static function status_report() {
[34] Fix | Delete
// Used by the report template.
[35] Fix | Delete
if ( ! class_exists( 'WC_Plugin_Updates' ) ) {
[36] Fix | Delete
include_once __DIR__ . '/plugin-updates/class-wc-plugin-updates.php';
[37] Fix | Delete
}
[38] Fix | Delete
[39] Fix | Delete
include_once __DIR__ . '/views/html-admin-page-status-report.php';
[40] Fix | Delete
}
[41] Fix | Delete
[42] Fix | Delete
/**
[43] Fix | Delete
* Handles output of tools.
[44] Fix | Delete
*/
[45] Fix | Delete
public static function status_tools() {
[46] Fix | Delete
if ( ! class_exists( 'WC_REST_System_Status_Tools_Controller' ) ) {
[47] Fix | Delete
wp_die( 'Cannot load the REST API to access WC_REST_System_Status_Tools_Controller.' );
[48] Fix | Delete
}
[49] Fix | Delete
[50] Fix | Delete
$tools = self::get_tools();
[51] Fix | Delete
$tool_requires_refresh = false;
[52] Fix | Delete
[53] Fix | Delete
if ( ! empty( $_GET['action'] ) && ! empty( $_REQUEST['_wpnonce'] ) && wp_verify_nonce( wp_unslash( $_REQUEST['_wpnonce'] ), 'debug_action' ) ) { // WPCS: input var ok, sanitization ok.
[54] Fix | Delete
$tools_controller = new WC_REST_System_Status_Tools_Controller();
[55] Fix | Delete
$action = wc_clean( wp_unslash( $_GET['action'] ) ); // WPCS: input var ok.
[56] Fix | Delete
[57] Fix | Delete
if ( array_key_exists( $action, $tools ) ) {
[58] Fix | Delete
$response = $tools_controller->execute_tool( $action );
[59] Fix | Delete
[60] Fix | Delete
$tool = $tools[ $action ];
[61] Fix | Delete
$tool_requires_refresh = $tool['requires_refresh'] ?? false;
[62] Fix | Delete
$tool = array(
[63] Fix | Delete
'id' => $action,
[64] Fix | Delete
'name' => $tool['name'],
[65] Fix | Delete
'action' => $tool['button'],
[66] Fix | Delete
'description' => $tool['desc'],
[67] Fix | Delete
'disabled' => $tool['disabled'] ?? false,
[68] Fix | Delete
);
[69] Fix | Delete
$tool = array_merge( $tool, $response );
[70] Fix | Delete
[71] Fix | Delete
/**
[72] Fix | Delete
* Fires after a WooCommerce system status tool has been executed.
[73] Fix | Delete
*
[74] Fix | Delete
* @param array $tool Details about the tool that has been executed.
[75] Fix | Delete
*/
[76] Fix | Delete
do_action( 'woocommerce_system_status_tool_executed', $tool );
[77] Fix | Delete
} else {
[78] Fix | Delete
$response = array(
[79] Fix | Delete
'success' => false,
[80] Fix | Delete
'message' => __( 'Tool does not exist.', 'woocommerce' ),
[81] Fix | Delete
);
[82] Fix | Delete
}
[83] Fix | Delete
[84] Fix | Delete
if ( $response['success'] ) {
[85] Fix | Delete
echo '<div class="updated inline"><p>' . esc_html( $response['message'] ) . '</p></div>';
[86] Fix | Delete
} else {
[87] Fix | Delete
echo '<div class="error inline"><p>' . esc_html( $response['message'] ) . '</p></div>';
[88] Fix | Delete
}
[89] Fix | Delete
}
[90] Fix | Delete
[91] Fix | Delete
// Display message if settings settings have been saved.
[92] Fix | Delete
if ( isset( $_REQUEST['settings-updated'] ) ) { // WPCS: input var ok.
[93] Fix | Delete
echo '<div class="updated inline"><p>' . esc_html__( 'Your changes have been saved.', 'woocommerce' ) . '</p></div>';
[94] Fix | Delete
}
[95] Fix | Delete
[96] Fix | Delete
if ( $tool_requires_refresh ) {
[97] Fix | Delete
$tools = self::get_tools();
[98] Fix | Delete
}
[99] Fix | Delete
[100] Fix | Delete
include_once __DIR__ . '/views/html-admin-page-status-tools.php';
[101] Fix | Delete
}
[102] Fix | Delete
[103] Fix | Delete
/**
[104] Fix | Delete
* Get tools.
[105] Fix | Delete
*
[106] Fix | Delete
* @return array of tools
[107] Fix | Delete
*/
[108] Fix | Delete
public static function get_tools() {
[109] Fix | Delete
$tools_controller = new WC_REST_System_Status_Tools_Controller();
[110] Fix | Delete
return $tools_controller->get_tools();
[111] Fix | Delete
}
[112] Fix | Delete
[113] Fix | Delete
/**
[114] Fix | Delete
* Show the logs page.
[115] Fix | Delete
*/
[116] Fix | Delete
public static function status_logs() {
[117] Fix | Delete
wc_get_container()->get( LoggingPageController::class )->render();
[118] Fix | Delete
}
[119] Fix | Delete
[120] Fix | Delete
/**
[121] Fix | Delete
* Show the log page contents for file log handler.
[122] Fix | Delete
*/
[123] Fix | Delete
public static function status_logs_file() {
[124] Fix | Delete
$logs = self::scan_log_files();
[125] Fix | Delete
[126] Fix | Delete
if ( ! empty( $_REQUEST['log_file'] ) && isset( $logs[ sanitize_title( wp_unslash( $_REQUEST['log_file'] ) ) ] ) ) { // WPCS: input var ok, CSRF ok.
[127] Fix | Delete
$viewed_log = $logs[ sanitize_title( wp_unslash( $_REQUEST['log_file'] ) ) ]; // WPCS: input var ok, CSRF ok.
[128] Fix | Delete
} elseif ( ! empty( $logs ) ) {
[129] Fix | Delete
$viewed_log = current( $logs );
[130] Fix | Delete
}
[131] Fix | Delete
[132] Fix | Delete
$handle = ! empty( $viewed_log ) ? self::get_log_file_handle( $viewed_log ) : '';
[133] Fix | Delete
[134] Fix | Delete
if ( ! empty( $_REQUEST['handle'] ) ) { // WPCS: input var ok, CSRF ok.
[135] Fix | Delete
self::remove_log();
[136] Fix | Delete
}
[137] Fix | Delete
[138] Fix | Delete
include_once __DIR__ . '/views/html-admin-page-status-logs.php';
[139] Fix | Delete
}
[140] Fix | Delete
[141] Fix | Delete
/**
[142] Fix | Delete
* Show the log page contents for db log handler.
[143] Fix | Delete
*/
[144] Fix | Delete
public static function status_logs_db() {
[145] Fix | Delete
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Nonce handled in flush_db_logs().
[146] Fix | Delete
if ( isset( $_REQUEST['flush-logs'] ) ) {
[147] Fix | Delete
self::flush_db_logs();
[148] Fix | Delete
}
[149] Fix | Delete
[150] Fix | Delete
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Nonce handled in log_table_bulk_actions().
[151] Fix | Delete
if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['log'] ) ) {
[152] Fix | Delete
self::log_table_bulk_actions();
[153] Fix | Delete
}
[154] Fix | Delete
[155] Fix | Delete
$log_table_list = self::get_db_log_list_table();
[156] Fix | Delete
$log_table_list->prepare_items();
[157] Fix | Delete
[158] Fix | Delete
include_once __DIR__ . '/views/html-admin-page-status-logs-db.php';
[159] Fix | Delete
}
[160] Fix | Delete
[161] Fix | Delete
/**
[162] Fix | Delete
* Retrieve metadata from a file. Based on WP Core's get_file_data function.
[163] Fix | Delete
*
[164] Fix | Delete
* @since 2.1.1
[165] Fix | Delete
* @param string $file Path to the file.
[166] Fix | Delete
* @return string
[167] Fix | Delete
*/
[168] Fix | Delete
public static function get_file_version( $file ) {
[169] Fix | Delete
[170] Fix | Delete
// Avoid notices if file does not exist.
[171] Fix | Delete
if ( ! file_exists( $file ) ) {
[172] Fix | Delete
return '';
[173] Fix | Delete
}
[174] Fix | Delete
[175] Fix | Delete
// We don't need to write to the file, so just open for reading.
[176] Fix | Delete
$fp = fopen( $file, 'r' ); // @codingStandardsIgnoreLine.
[177] Fix | Delete
[178] Fix | Delete
// Pull only the first 8kiB of the file in.
[179] Fix | Delete
$file_data = fread( $fp, 8192 ); // @codingStandardsIgnoreLine.
[180] Fix | Delete
[181] Fix | Delete
// PHP will close file handle, but we are good citizens.
[182] Fix | Delete
fclose( $fp ); // @codingStandardsIgnoreLine.
[183] Fix | Delete
[184] Fix | Delete
// Make sure we catch CR-only line endings.
[185] Fix | Delete
$file_data = str_replace( "\r", "\n", $file_data );
[186] Fix | Delete
$version = '';
[187] Fix | Delete
[188] Fix | Delete
if ( preg_match( '/^[ \t\/*#@]*' . preg_quote( '@version', '/' ) . '(.*)$/mi', $file_data, $match ) && $match[1] ) {
[189] Fix | Delete
$version = _cleanup_header_comment( $match[1] );
[190] Fix | Delete
}
[191] Fix | Delete
[192] Fix | Delete
return $version;
[193] Fix | Delete
}
[194] Fix | Delete
[195] Fix | Delete
/**
[196] Fix | Delete
* Return the log file handle.
[197] Fix | Delete
*
[198] Fix | Delete
* @param string $filename Filename to get the handle for.
[199] Fix | Delete
* @return string
[200] Fix | Delete
*/
[201] Fix | Delete
public static function get_log_file_handle( $filename ) {
[202] Fix | Delete
return substr( $filename, 0, strlen( $filename ) > 48 ? strlen( $filename ) - 48 : strlen( $filename ) - 4 );
[203] Fix | Delete
}
[204] Fix | Delete
[205] Fix | Delete
/**
[206] Fix | Delete
* Scan the template files.
[207] Fix | Delete
*
[208] Fix | Delete
* @param string $template_path Path to the template directory.
[209] Fix | Delete
* @return array
[210] Fix | Delete
*/
[211] Fix | Delete
public static function scan_template_files( $template_path ) {
[212] Fix | Delete
$files = is_string( $template_path ) ? @scandir( $template_path ) : array(); // @codingStandardsIgnoreLine.
[213] Fix | Delete
$result = array();
[214] Fix | Delete
[215] Fix | Delete
if ( ! empty( $files ) ) {
[216] Fix | Delete
[217] Fix | Delete
foreach ( $files as $key => $value ) {
[218] Fix | Delete
[219] Fix | Delete
if ( ! in_array( $value, array( '.', '..' ), true ) ) {
[220] Fix | Delete
[221] Fix | Delete
if ( is_dir( $template_path . DIRECTORY_SEPARATOR . $value ) ) {
[222] Fix | Delete
$sub_files = self::scan_template_files( $template_path . DIRECTORY_SEPARATOR . $value );
[223] Fix | Delete
foreach ( $sub_files as $sub_file ) {
[224] Fix | Delete
$result[] = $value . DIRECTORY_SEPARATOR . $sub_file;
[225] Fix | Delete
}
[226] Fix | Delete
} else {
[227] Fix | Delete
$result[] = $value;
[228] Fix | Delete
}
[229] Fix | Delete
}
[230] Fix | Delete
}
[231] Fix | Delete
}
[232] Fix | Delete
return $result;
[233] Fix | Delete
}
[234] Fix | Delete
[235] Fix | Delete
/**
[236] Fix | Delete
* Scan the log files.
[237] Fix | Delete
*
[238] Fix | Delete
* @return array
[239] Fix | Delete
*/
[240] Fix | Delete
public static function scan_log_files() {
[241] Fix | Delete
return WC_Log_Handler_File::get_log_files();
[242] Fix | Delete
}
[243] Fix | Delete
[244] Fix | Delete
/**
[245] Fix | Delete
* Get latest version of a theme by slug.
[246] Fix | Delete
*
[247] Fix | Delete
* @param object $theme WP_Theme object.
[248] Fix | Delete
* @return string Version number if found.
[249] Fix | Delete
*/
[250] Fix | Delete
public static function get_latest_theme_version( $theme ) {
[251] Fix | Delete
include_once ABSPATH . 'wp-admin/includes/theme.php';
[252] Fix | Delete
[253] Fix | Delete
$api = themes_api(
[254] Fix | Delete
'theme_information',
[255] Fix | Delete
array(
[256] Fix | Delete
'slug' => $theme->get_stylesheet(),
[257] Fix | Delete
'fields' => array(
[258] Fix | Delete
'sections' => false,
[259] Fix | Delete
'tags' => false,
[260] Fix | Delete
),
[261] Fix | Delete
)
[262] Fix | Delete
);
[263] Fix | Delete
[264] Fix | Delete
$update_theme_version = 0;
[265] Fix | Delete
[266] Fix | Delete
// Check .org for updates.
[267] Fix | Delete
if ( is_object( $api ) && ! is_wp_error( $api ) && isset( $api->version ) ) {
[268] Fix | Delete
$update_theme_version = $api->version;
[269] Fix | Delete
} elseif ( strstr( $theme->{'Author URI'}, 'woothemes' ) ) { // Check WooThemes Theme Version.
[270] Fix | Delete
$theme_dir = substr( strtolower( str_replace( ' ', '', $theme->Name ) ), 0, 45 ); // @codingStandardsIgnoreLine.
[271] Fix | Delete
$theme_version_data = get_transient( $theme_dir . '_version_data' );
[272] Fix | Delete
[273] Fix | Delete
if ( false === $theme_version_data ) {
[274] Fix | Delete
$theme_changelog = wp_safe_remote_get( 'http://dzv365zjfbd8v.cloudfront.net/changelogs/' . $theme_dir . '/changelog.txt' );
[275] Fix | Delete
$cl_lines = explode( "\n", wp_remote_retrieve_body( $theme_changelog ) );
[276] Fix | Delete
if ( ! empty( $cl_lines ) ) {
[277] Fix | Delete
foreach ( $cl_lines as $line_num => $cl_line ) {
[278] Fix | Delete
if ( preg_match( '/^[0-9]/', $cl_line ) ) {
[279] Fix | Delete
$theme_date = str_replace( '.', '-', trim( substr( $cl_line, 0, strpos( $cl_line, '-' ) ) ) );
[280] Fix | Delete
$theme_version = preg_replace( '~[^0-9,.]~', '', stristr( $cl_line, 'version' ) );
[281] Fix | Delete
$theme_update = trim( str_replace( '*', '', $cl_lines[ $line_num + 1 ] ) );
[282] Fix | Delete
$theme_version_data = array(
[283] Fix | Delete
'date' => $theme_date,
[284] Fix | Delete
'version' => $theme_version,
[285] Fix | Delete
'update' => $theme_update,
[286] Fix | Delete
'changelog' => $theme_changelog,
[287] Fix | Delete
);
[288] Fix | Delete
set_transient( $theme_dir . '_version_data', $theme_version_data, DAY_IN_SECONDS );
[289] Fix | Delete
break;
[290] Fix | Delete
}
[291] Fix | Delete
}
[292] Fix | Delete
}
[293] Fix | Delete
}
[294] Fix | Delete
[295] Fix | Delete
if ( ! empty( $theme_version_data['version'] ) ) {
[296] Fix | Delete
$update_theme_version = $theme_version_data['version'];
[297] Fix | Delete
}
[298] Fix | Delete
}
[299] Fix | Delete
[300] Fix | Delete
return $update_theme_version;
[301] Fix | Delete
}
[302] Fix | Delete
[303] Fix | Delete
/**
[304] Fix | Delete
* Remove/delete the chosen file.
[305] Fix | Delete
*/
[306] Fix | Delete
public static function remove_log() {
[307] Fix | Delete
if ( empty( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( wp_unslash( $_REQUEST['_wpnonce'] ), 'remove_log' ) ) { // WPCS: input var ok, sanitization ok.
[308] Fix | Delete
wp_die( esc_html__( 'Action failed. Please refresh the page and retry.', 'woocommerce' ) );
[309] Fix | Delete
}
[310] Fix | Delete
[311] Fix | Delete
if ( ! empty( $_REQUEST['handle'] ) ) { // WPCS: input var ok.
[312] Fix | Delete
$log_handler = new WC_Log_Handler_File();
[313] Fix | Delete
$log_handler->remove( wp_unslash( $_REQUEST['handle'] ) ); // WPCS: input var ok, sanitization ok.
[314] Fix | Delete
}
[315] Fix | Delete
[316] Fix | Delete
wp_safe_redirect( esc_url_raw( admin_url( 'admin.php?page=wc-status&tab=logs' ) ) );
[317] Fix | Delete
exit();
[318] Fix | Delete
}
[319] Fix | Delete
[320] Fix | Delete
/**
[321] Fix | Delete
* Return a stored instance of the DB log list table class.
[322] Fix | Delete
*
[323] Fix | Delete
* @return WC_Admin_Log_Table_List
[324] Fix | Delete
*/
[325] Fix | Delete
public static function get_db_log_list_table() {
[326] Fix | Delete
if ( is_null( self::$db_log_list_table ) ) {
[327] Fix | Delete
self::$db_log_list_table = new WC_Admin_Log_Table_List();
[328] Fix | Delete
}
[329] Fix | Delete
[330] Fix | Delete
return self::$db_log_list_table;
[331] Fix | Delete
}
[332] Fix | Delete
[333] Fix | Delete
[334] Fix | Delete
/**
[335] Fix | Delete
* Clear DB log table.
[336] Fix | Delete
*
[337] Fix | Delete
* @since 3.0.0
[338] Fix | Delete
*/
[339] Fix | Delete
private static function flush_db_logs() {
[340] Fix | Delete
check_admin_referer( 'bulk-logs' );
[341] Fix | Delete
[342] Fix | Delete
if ( ! current_user_can( 'manage_woocommerce' ) ) {
[343] Fix | Delete
wp_die( esc_html__( 'You do not have permission to manage log entries.', 'woocommerce' ) );
[344] Fix | Delete
}
[345] Fix | Delete
[346] Fix | Delete
WC_Log_Handler_DB::flush();
[347] Fix | Delete
[348] Fix | Delete
$sendback = wp_sanitize_redirect( admin_url( 'admin.php?page=wc-status&tab=logs' ) );
[349] Fix | Delete
[350] Fix | Delete
wp_safe_redirect( $sendback );
[351] Fix | Delete
exit;
[352] Fix | Delete
}
[353] Fix | Delete
[354] Fix | Delete
/**
[355] Fix | Delete
* Bulk DB log table actions.
[356] Fix | Delete
*
[357] Fix | Delete
* @since 3.0.0
[358] Fix | Delete
*/
[359] Fix | Delete
private static function log_table_bulk_actions() {
[360] Fix | Delete
check_admin_referer( 'bulk-logs' );
[361] Fix | Delete
[362] Fix | Delete
if ( ! current_user_can( 'manage_woocommerce' ) ) {
[363] Fix | Delete
wp_die( esc_html__( 'You do not have permission to manage log entries.', 'woocommerce' ) );
[364] Fix | Delete
}
[365] Fix | Delete
[366] Fix | Delete
$log_ids = (array) filter_input( INPUT_GET, 'log', FILTER_CALLBACK, array( 'options' => 'absint' ) );
[367] Fix | Delete
[368] Fix | Delete
$action = self::get_db_log_list_table()->current_action();
[369] Fix | Delete
[370] Fix | Delete
if ( 'delete' === $action ) {
[371] Fix | Delete
WC_Log_Handler_DB::delete( $log_ids );
[372] Fix | Delete
[373] Fix | Delete
$sendback = remove_query_arg( array( 'action', 'action2', 'log', '_wpnonce', '_wp_http_referer' ), wp_get_referer() );
[374] Fix | Delete
[375] Fix | Delete
wp_safe_redirect( $sendback );
[376] Fix | Delete
exit();
[377] Fix | Delete
}
[378] Fix | Delete
}
[379] Fix | Delete
[380] Fix | Delete
/**
[381] Fix | Delete
* Prints table info if a base table is not present.
[382] Fix | Delete
*/
[383] Fix | Delete
private static function output_tables_info() {
[384] Fix | Delete
$missing_tables = WC_Install::verify_base_tables( false );
[385] Fix | Delete
if ( 0 === count( $missing_tables ) ) {
[386] Fix | Delete
return;
[387] Fix | Delete
}
[388] Fix | Delete
?>
[389] Fix | Delete
[390] Fix | Delete
<br>
[391] Fix | Delete
<strong style="color:#a00;">
[392] Fix | Delete
<span class="dashicons dashicons-warning"></span>
[393] Fix | Delete
<?php
[394] Fix | Delete
echo esc_html(
[395] Fix | Delete
sprintf(
[396] Fix | Delete
// translators: Comma separated list of missing tables.
[397] Fix | Delete
__( 'Missing base tables: %s. Some WooCommerce functionality may not work as expected.', 'woocommerce' ),
[398] Fix | Delete
implode( ', ', $missing_tables )
[399] Fix | Delete
)
[400] Fix | Delete
);
[401] Fix | Delete
?>
[402] Fix | Delete
</strong>
[403] Fix | Delete
[404] Fix | Delete
<?php
[405] Fix | Delete
}
[406] Fix | Delete
[407] Fix | Delete
/**
[408] Fix | Delete
* Prints the information about plugins for the system status report.
[409] Fix | Delete
* Used for both active and inactive plugins sections.
[410] Fix | Delete
*
[411] Fix | Delete
* @param array $plugins List of plugins to display.
[412] Fix | Delete
* @param array $untested_plugins List of plugins that haven't been tested with the current WooCommerce version.
[413] Fix | Delete
* @return void
[414] Fix | Delete
*/
[415] Fix | Delete
private static function output_plugins_info( $plugins, $untested_plugins ) {
[416] Fix | Delete
$wc_version = Constants::get_constant( 'WC_VERSION' );
[417] Fix | Delete
[418] Fix | Delete
if ( 'major' === Constants::get_constant( 'WC_SSR_PLUGIN_UPDATE_RELEASE_VERSION_TYPE' ) ) {
[419] Fix | Delete
// Since we're only testing against major, we don't need to show minor and patch version.
[420] Fix | Delete
$wc_version = $wc_version[0] . '.0';
[421] Fix | Delete
}
[422] Fix | Delete
[423] Fix | Delete
foreach ( $plugins as $plugin ) {
[424] Fix | Delete
if ( ! empty( $plugin['name'] ) ) {
[425] Fix | Delete
// Link the plugin name to the plugin url if available.
[426] Fix | Delete
$plugin_name = esc_html( $plugin['name'] );
[427] Fix | Delete
if ( ! empty( $plugin['url'] ) ) {
[428] Fix | Delete
$plugin_name = '<a href="' . esc_url( $plugin['url'] ) . '" aria-label="' . esc_attr__( 'Visit plugin homepage', 'woocommerce' ) . '" target="_blank">' . $plugin_name . '</a>';
[429] Fix | Delete
}
[430] Fix | Delete
[431] Fix | Delete
$has_newer_version = false;
[432] Fix | Delete
$version_string = $plugin['version'];
[433] Fix | Delete
$network_string = '';
[434] Fix | Delete
if ( strstr( $plugin['url'], 'woothemes.com' ) || strstr( $plugin['url'], 'woocommerce.com' ) || strstr( $plugin['url'], 'woo.com' ) ) {
[435] Fix | Delete
if ( ! empty( $plugin['version_latest'] ) && version_compare( $plugin['version_latest'], $plugin['version'], '>' ) ) {
[436] Fix | Delete
/* translators: 1: current version. 2: latest version */
[437] Fix | Delete
$version_string = sprintf( __( '%1$s (update to version %2$s is available)', 'woocommerce' ), $plugin['version'], $plugin['version_latest'] );
[438] Fix | Delete
}
[439] Fix | Delete
[440] Fix | Delete
if ( false !== $plugin['network_activated'] ) {
[441] Fix | Delete
$network_string = ' &ndash; <strong style="color: black;">' . esc_html__( 'Network enabled', 'woocommerce' ) . '</strong>';
[442] Fix | Delete
}
[443] Fix | Delete
}
[444] Fix | Delete
$untested_string = '';
[445] Fix | Delete
if ( array_key_exists( $plugin['plugin'], $untested_plugins ) ) {
[446] Fix | Delete
$untested_string = ' &ndash; <strong style="color: #a00;">';
[447] Fix | Delete
[448] Fix | Delete
/* translators: %s: version */
[449] Fix | Delete
$untested_string .= esc_html( sprintf( __( 'Installed version not tested with active version of WooCommerce %s', 'woocommerce' ), $wc_version ) );
[450] Fix | Delete
[451] Fix | Delete
$untested_string .= '</strong>';
[452] Fix | Delete
}
[453] Fix | Delete
?>
[454] Fix | Delete
<tr>
[455] Fix | Delete
<td><?php echo wp_kses_post( $plugin_name ); ?></td>
[456] Fix | Delete
<td class="help">&nbsp;</td>
[457] Fix | Delete
<td>
[458] Fix | Delete
<?php
[459] Fix | Delete
/* translators: %s: plugin author */
[460] Fix | Delete
printf( esc_html__( 'by %s', 'woocommerce' ), esc_html( $plugin['author_name'] ) );
[461] Fix | Delete
echo ' &ndash; ' . esc_html( $version_string ) . $untested_string . $network_string; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
[462] Fix | Delete
?>
[463] Fix | Delete
</td>
[464] Fix | Delete
</tr>
[465] Fix | Delete
<?php
[466] Fix | Delete
}
[467] Fix | Delete
}
[468] Fix | Delete
}
[469] Fix | Delete
}
[470] Fix | Delete
[471] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function