set_arg('method', 'domain'); $api->set_arg('domain', $domain); $api->get(); } /** * This method gets called when a mapped domain is removed. * * @since 2.0.0 * @param string $domain The domain name being removed. * @param int $site_id ID of the site that is receiving that mapping. * @return void */ public function on_remove_domain($domain, $site_id) { $api = new \WPE_API(); $api->set_arg('method', 'domain-remove'); $api->set_arg('domain', $domain); $api->get(); } /** * This method gets called when a new subdomain is being added. * * This happens every time a new site is added to a network running on subdomain mode. * * @since 2.0.0 * @param string $subdomain The subdomain being added to the network. * @param int $site_id ID of the site that is receiving that mapping. * @return void */ public function on_add_subdomain($subdomain, $site_id) { $this->on_add_domain($subdomain, $site_id); } /** * This method gets called when a new subdomain is being removed. * * This happens every time a new site is removed to a network running on subdomain mode. * * @since 2.0.0 * @param string $subdomain The subdomain being removed to the network. * @param int $site_id ID of the site that is receiving that mapping. * @return void */ public function on_remove_subdomain($subdomain, $site_id) { $this->on_remove_domain($subdomain, $site_id); } /** * Returns the description of this integration. * * @since 2.0.0 * @return string */ public function get_description() { $description = __('WP Engine drives your business forward faster with the first and only WordPress Digital Experience Platform. We offer the best WordPress hosting and developer experience on a proven, reliable architecture that delivers unparalleled speed, scalability, and security for your sites.', 'wp-ultimo'); $description .= '

' . __('We recommend to enter in contact with WP Engine support to ask for a Wildcard domain if you are using a subdomain install.', 'wp-ultimo') . ''; return $description; } /** * Returns the logo for the integration. * * @since 2.0.0 * @return string */ public function get_logo() { return wu_get_asset('wpengine.svg', 'img/hosts'); } /** * Tests the connection with the WP Engine API. * * @since 2.0.0 * @return void */ public function test_connection() { $api = new \WPE_API(); $api->set_arg('method', 'site'); $results = $api->get(); if (is_wp_error($results)) { wp_send_json_error($results->get_error_message()); } else { wp_send_json_success($results); } } }