Prep Plugin for release on WordPress.org

Escape everything that should be escaped.
Add nonce checks where needed.
Sanitize all inputs.
Apply Code style changes across the codebase.
Correct many deprecation notices.
Optimize load order of many filters.
This commit is contained in:
David Stone
2025-04-07 09:15:21 -06:00
parent f05ab77418
commit a815fdf179
290 changed files with 2999 additions and 3269 deletions

View File

@ -11,7 +11,6 @@
namespace WP_Ultimo\Managers;
use WP_Ultimo\Managers\Base_Manager;
use WP_Ultimo\Models\Webhook;
use WP_Ultimo\Logger;
@ -126,7 +125,7 @@ class Webhook_Manager extends Base_Manager {
public function send_webhook($webhook, $data, $blocking = true, $count = true) {
if ( ! $data) {
return;
return null;
}
$request = wp_remote_post(
@ -205,9 +204,7 @@ class Webhook_Manager extends Base_Manager {
$event = wu_get_event_type($_POST['webhook_event']);
$webhook_data = [
'webhook_url' => $_POST['webhook_url'],
'event' => $_POST['webhook_event'],
'active' => true,
'active' => true,
];
$webhook = new Webhook($webhook_data);
@ -249,8 +246,7 @@ class Webhook_Manager extends Base_Manager {
';
if ( ! current_user_can('manage_network')) {
echo __('You do not have enough permissions to read the logs of this webhook.', 'wp-multisite-waas');
esc_html_e('You do not have enough permissions to read the logs of this webhook.', 'wp-multisite-waas');
exit;
}
@ -271,7 +267,7 @@ class Webhook_Manager extends Base_Manager {
Logger::read_lines("webhook-$id", 5)
);
echo implode('', $logs);
echo implode('', $logs); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
exit;
}
@ -291,7 +287,7 @@ class Webhook_Manager extends Base_Manager {
*/
protected function create_event($event_name, $id, $url, $data, $response, $is_error = false) {
$message = sprintf('Sent a %s event to the URL %s with data: %s ', $event_name, $url, json_encode($data));
$message = sprintf('Sent a %s event to the URL %s with data: %s ', $event_name, $url, wp_json_encode($data));
if ( ! $is_error) {
$message .= empty($response) ? sprintf('Got response: %s', $response) : 'To debug the remote server response, turn the "Wait for Response" option on the WP Multisite WaaS Settings > API & Webhooks Tab';