芝麻web文件管理V1.00
\n";
} else {
echo "\n";
}
}
/**
* Process item.
*
* @since 2.8.0
*
* @param array $item Item.
* @param bool $ajax Ajax flag.
*
* @return string
*/
public static function process_item( $item, $ajax = false ) {
return self::process_item_url( $item, $ajax );
}
/**
* Process item by URL.
*
* @since 2.8.0
*
* @param array $item Item.
* @param bool $ajax Ajax flag.
*
* @return string
*/
private static function process_item_url( $item, $ajax = false ) {
if ( ! $ajax ) {
echo esc_html(
sprintf(
// translators: 1 item URL.
__( 'regenerate %s... ', 'w3-total-cache' ),
$item['url']
)
);
}
$result = wp_remote_request(
$item['url'],
array(
'headers' => array(
'w3tcalwayscached' => $item['key'],
),
)
);
if (
is_wp_error( $result )
|| empty( $result['response']['code'] )
|| 500 === $result['response']['code']
) {
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
error_log( 'failed to handle queue url' . $item['url'] );
return 'failed';
}
if ( empty( $result['headers'] ) || empty( $result['headers']['w3tcalwayscached'] ) ) {
if ( ! $ajax ) {
esc_html_e( "\n no evidence of cache refresh, will reprocess on next schedule/run\n ", 'w3-total-cache' );
}
return 'failed';
}
return 'ok';
}
}