MOON
Server: Apache
System: Linux nserver.cafsindia.com 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: cafsindia (1002)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: //home/cafsindia/public_html/wp-content/plugins/imageseo/src/Services/Register.php
<?php

namespace ImageSeoWP\Services;

if (!defined('ABSPATH')) {
    exit;
}

class Register
{
    public function __construct()
    {
        $this->optionServices = imageseo_get_service('Option');
    }

    public function register($email, $password, $options = [])
    {
        $response = wp_remote_post(IMAGESEO_API_URL . '/v1/customers/create', [
            'headers' => [
                'Content-Type' => 'application/json',
            ],
            'body' => json_encode([
                'firstname'       => isset($options['firstname']) ? $options['firstname'] : '',
                'lastname'        => isset($options['lastname']) ? $options['lastname'] : '',
                'newsletters'     => isset($options['newsletters']) ? $options['newsletters'] : false,
                'email'           => $email,
                'password'        => $password,
                'wp_url'          => site_url(),
                'withProject'     => true,
                'name'            => get_bloginfo('name'),
                'optins'          => 'terms',
            ]),
            'timeout' => 50,
        ]);

        if (is_wp_error($response)) {
            return null;
        }

        $body = json_decode(wp_remote_retrieve_body($response), true);

        if (!$body['success']) {
            return null;
        }

        $user = $body['result'];

        $options = $this->optionServices->getOptions();

        $options['api_key'] = $user['project_create']['api_key'];
        $options['allowed'] = true;
        $this->optionServices->setOptions($options);

        return $user;
    }
}